2013-02-19 19:35:10 +00:00
|
|
|
#!/usr/bin/env perl
|
2011-09-09 08:37:30 +00:00
|
|
|
#############################################################################
|
|
|
|
##
|
2016-01-15 07:08:27 +00:00
|
|
|
## Copyright (C) 2016 The Qt Company Ltd.
|
2016-01-21 02:33:50 +00:00
|
|
|
## Copyright (C) 2016 Intel Corporation.
|
2016-01-15 07:08:27 +00:00
|
|
|
## Contact: https://www.qt.io/licensing/
|
2011-09-09 08:37:30 +00:00
|
|
|
##
|
|
|
|
## This file is part of the build configuration tools of the Qt Toolkit.
|
|
|
|
##
|
2016-01-15 07:08:27 +00:00
|
|
|
## $QT_BEGIN_LICENSE:LGPL$
|
2012-09-19 12:28:29 +00:00
|
|
|
## Commercial License Usage
|
|
|
|
## Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
## accordance with the commercial license agreement provided with the
|
|
|
|
## Software or, alternatively, in accordance with the terms contained in
|
2015-01-28 08:44:43 +00:00
|
|
|
## a written agreement between you and The Qt Company. For licensing terms
|
2016-01-15 07:08:27 +00:00
|
|
|
## and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
## information use the contact form at https://www.qt.io/contact-us.
|
2012-09-19 12:28:29 +00:00
|
|
|
##
|
2011-09-09 08:37:30 +00:00
|
|
|
## GNU Lesser General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
## Alternatively, this file may be used under the terms of the GNU Lesser
|
2016-01-15 07:08:27 +00:00
|
|
|
## General Public License version 3 as published by the Free Software
|
|
|
|
## Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
|
|
## packaging of this file. Please review the following information to
|
|
|
|
## ensure the GNU Lesser General Public License version 3 requirements
|
|
|
|
## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
2015-01-28 08:44:43 +00:00
|
|
|
##
|
2016-01-15 07:08:27 +00:00
|
|
|
## GNU General Public License Usage
|
|
|
|
## Alternatively, this file may be used under the terms of the GNU
|
|
|
|
## General Public License version 2.0 or (at your option) the GNU General
|
|
|
|
## Public license version 3 or any later version approved by the KDE Free
|
|
|
|
## Qt Foundation. The licenses are as published by the Free Software
|
|
|
|
## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
|
|
## included in the packaging of this file. Please review the following
|
|
|
|
## information to ensure the GNU General Public License requirements will
|
|
|
|
## be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
|
|
## https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-09-09 08:37:30 +00:00
|
|
|
##
|
|
|
|
## $QT_END_LICENSE$
|
|
|
|
##
|
|
|
|
#############################################################################
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#
|
|
|
|
# Synchronizes Qt header files - internal development tool.
|
|
|
|
#
|
|
|
|
|
|
|
|
# use packages -------------------------------------------------------
|
|
|
|
use File::Basename;
|
|
|
|
use File::Path;
|
2012-04-25 12:29:58 +00:00
|
|
|
use File::Spec;
|
2011-04-27 10:05:43 +00:00
|
|
|
use Cwd;
|
2010-11-15 19:55:17 +00:00
|
|
|
use Cwd 'abs_path';
|
2011-04-27 10:05:43 +00:00
|
|
|
use Config;
|
|
|
|
use strict;
|
2012-01-11 18:12:27 +00:00
|
|
|
use warnings;
|
2011-06-30 04:51:16 +00:00
|
|
|
use English qw(-no_match_vars );
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-05-25 10:52:14 +00:00
|
|
|
my $normalizePath_fixDrive = ($^O eq "msys" ? 1 : 0);
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: normalizePath(\$path)
|
|
|
|
# Params: Reference to a path that's going to be normalized.
|
|
|
|
#
|
|
|
|
# Purpose: Converts the path into a form that can be used as include
|
|
|
|
# path from C++ sources and qmake's .pro files.
|
|
|
|
# Only relevant on Windows.
|
|
|
|
# Returns: -none-
|
|
|
|
######################################################################
|
|
|
|
sub normalizePath {
|
|
|
|
my $s = shift;
|
|
|
|
$$s =~ s=\\=/=g;
|
2013-04-20 09:13:58 +00:00
|
|
|
if ($normalizePath_fixDrive && ($$s =~ m,^/([a-zA-Z])/(.*), || $$s =~ m,^([a-zA-Z]):/(.*),)) {
|
2012-05-25 10:52:14 +00:00
|
|
|
$$s = lc($1) . ":/$2";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
# set output basedir to be where ever syncqt is run from
|
|
|
|
our $out_basedir = getcwd();
|
2012-05-25 10:52:14 +00:00
|
|
|
normalizePath(\$out_basedir);
|
2010-11-15 19:55:17 +00:00
|
|
|
our $basedir;
|
|
|
|
our $quoted_basedir;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-05-25 10:52:14 +00:00
|
|
|
# Make sure we use Windows line endings for chomp and friends on Windows.
|
|
|
|
$INPUT_RECORD_SEPARATOR = "\r\n" if ($^O eq "msys");
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
# will be defined based on the modules sync.profile
|
2014-01-30 18:34:49 +00:00
|
|
|
our (%modules, %moduleheaders, @allmoduleheadersprivate, %classnames, %deprecatedheaders);
|
2012-06-19 20:21:35 +00:00
|
|
|
our @qpa_headers = ();
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2014-01-30 18:34:49 +00:00
|
|
|
# will be derived from sync.profile
|
|
|
|
our %reverse_classnames = ();
|
2015-11-26 16:15:38 +00:00
|
|
|
my %ignore_for_include_check = ();
|
|
|
|
my %ignore_for_qt_begin_namespace_check = ();
|
2014-01-30 18:34:49 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
# global variables (modified by options)
|
2010-11-15 19:55:17 +00:00
|
|
|
my $isunix = 0;
|
2011-04-27 10:05:43 +00:00
|
|
|
my $module = 0;
|
|
|
|
my $showonly = 0;
|
2011-07-07 18:05:49 +00:00
|
|
|
my $verbose_level = 1;
|
2011-04-27 10:05:43 +00:00
|
|
|
my $remove_stale = 1;
|
|
|
|
my $force_win = 0;
|
|
|
|
my $force_relative = 0;
|
|
|
|
my $check_includes = 0;
|
|
|
|
my $copy_headers = 0;
|
|
|
|
my $create_private_headers = 1;
|
2012-08-31 14:33:33 +00:00
|
|
|
my $minimal = 0;
|
2013-03-20 15:51:32 +00:00
|
|
|
my $module_version = 0;
|
2011-04-27 10:05:43 +00:00
|
|
|
my @modules_to_sync ;
|
|
|
|
$force_relative = 1 if ( -d "/System/Library/Frameworks" );
|
2010-11-15 19:55:17 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
# functions ----------------------------------------------------------
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: showUsage()
|
|
|
|
# Params: -none-
|
|
|
|
#
|
|
|
|
# Purpose: Show the usage of the script.
|
|
|
|
# Returns: -none-
|
|
|
|
######################################################################
|
|
|
|
sub showUsage
|
|
|
|
{
|
|
|
|
print "$0 usage:\n";
|
2010-11-15 19:55:17 +00:00
|
|
|
print " <module directory> Specifies which module to sync header files for (required for shadow builds!)\n\n";
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
print " -copy Copy headers instead of include-fwd(default: " . ($copy_headers ? "yes" : "no") . ")\n";
|
|
|
|
print " -remove-stale Removes stale headers (default: " . ($remove_stale ? "yes" : "no") . ")\n";
|
|
|
|
print " -relative Force relative symlinks (default: " . ($force_relative ? "yes" : "no") . ")\n";
|
|
|
|
print " -windows Force platform to Windows (default: " . ($force_win ? "yes" : "no") . ")\n";
|
|
|
|
print " -showonly Show action but not perform (default: " . ($showonly ? "yes" : "no") . ")\n";
|
2012-08-31 14:33:33 +00:00
|
|
|
print " -minimal Do not create CamelCase headers (default: " . ($minimal ? "yes" : "no") . ")\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n";
|
2013-03-20 15:51:32 +00:00
|
|
|
print " -version <VERSION> Specify the module's version (default: detect from qglobal.h)\n";
|
2011-07-07 18:05:49 +00:00
|
|
|
print " -quiet Only report problems, not activity (same as -verbose 0)\n";
|
|
|
|
print " -v, -verbose <level> Sets the verbosity level (max. 4) (default: $verbose_level)\n";
|
|
|
|
print " The short form increases the level by +1\n";
|
2010-11-25 02:21:06 +00:00
|
|
|
print " -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR>\n";
|
2011-05-18 13:23:51 +00:00
|
|
|
print " Create headers for <NAME> with original headers in\n";
|
|
|
|
print " <HEADERDIR> relative to <PROFILEDIR> \n";
|
2010-11-15 15:43:22 +00:00
|
|
|
print " -private Force copy private headers (default: " . ($create_private_headers ? "yes" : "no") . ")\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
print " -help This help\n";
|
|
|
|
exit 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: checkUnix()
|
|
|
|
# Params: -none-
|
|
|
|
#
|
|
|
|
# Purpose: Check if script runs on a Unix system or not. Cygwin
|
|
|
|
# systems are _not_ detected as Unix systems.
|
|
|
|
# Returns: 1 if a unix system, else 0.
|
|
|
|
######################################################################
|
|
|
|
sub checkUnix {
|
|
|
|
my ($r) = 0;
|
|
|
|
if ( $force_win != 0) {
|
|
|
|
return 0;
|
|
|
|
} elsif ( -f "/bin/uname" ) {
|
|
|
|
$r = 1;
|
|
|
|
(-f "\\bin\\uname") && ($r = 0);
|
|
|
|
} elsif ( -f "/usr/bin/uname" ) {
|
|
|
|
$r = 1;
|
|
|
|
(-f "\\usr\\bin\\uname") && ($r = 0);
|
|
|
|
}
|
|
|
|
if($r) {
|
|
|
|
$_ = $Config{'osname'};
|
|
|
|
$r = 0 if( /(ms)|(cyg)win/i );
|
|
|
|
}
|
|
|
|
return $r;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub checkRelative {
|
|
|
|
my ($dir) = @_;
|
|
|
|
return 0 if($dir =~ /^\//);
|
|
|
|
return 0 if(!checkUnix() && $dir =~ /[a-zA-Z]:[\/\\]/);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-05-28 18:57:07 +00:00
|
|
|
######################################################################
|
|
|
|
# Syntax: shouldMasterInclude(iheader)
|
|
|
|
# Params: iheader, string, filename to verify inclusion
|
|
|
|
#
|
|
|
|
# Purpose: Determines if header should be in the master include file.
|
|
|
|
# Returns: 0 if file contains "#pragma qt_no_master_include" or not
|
|
|
|
# able to open, else 1.
|
|
|
|
######################################################################
|
|
|
|
sub shouldMasterInclude {
|
|
|
|
my ($iheader) = @_;
|
|
|
|
return 0 if (basename($iheader) =~ /_/);
|
|
|
|
return 0 if (basename($iheader) =~ /qconfig/);
|
|
|
|
if (open(F, "<$iheader")) {
|
|
|
|
while (<F>) {
|
|
|
|
chomp;
|
2016-02-24 11:57:18 +00:00
|
|
|
chop if /\r$/;
|
2013-05-28 18:57:07 +00:00
|
|
|
return 0 if (/^\#pragma qt_no_master_include$/);
|
|
|
|
}
|
|
|
|
close(F);
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
######################################################################
|
2016-08-31 13:39:30 +00:00
|
|
|
# Syntax: classNames(iheader, clean, requires)
|
2011-04-27 10:05:43 +00:00
|
|
|
# Params: iheader, string, filename to parse for classname "symlinks"
|
2012-12-22 21:12:02 +00:00
|
|
|
# (out) clean, boolean, will be set to false if the header isn't clean
|
2016-08-31 13:39:30 +00:00
|
|
|
# (out) requires, string, will be set to non-empty if the header
|
|
|
|
# requires a feature
|
2011-04-27 10:05:43 +00:00
|
|
|
#
|
|
|
|
# Purpose: Scans through iheader to find all classnames that should be
|
|
|
|
# synced into library's include structure.
|
|
|
|
# Returns: List of all class names in a file.
|
|
|
|
######################################################################
|
|
|
|
sub classNames {
|
|
|
|
my @ret;
|
2016-08-31 13:39:30 +00:00
|
|
|
my ($iheader, $clean, $requires) = @_;
|
2012-12-22 21:12:02 +00:00
|
|
|
$$clean = 1;
|
2016-08-31 13:39:30 +00:00
|
|
|
$$requires = "";
|
2010-11-15 19:55:17 +00:00
|
|
|
|
2014-01-30 18:34:49 +00:00
|
|
|
my $ihdrbase = basename($iheader);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
my $parsable = "";
|
|
|
|
if(open(F, "<$iheader")) {
|
|
|
|
while(<F>) {
|
|
|
|
my $line = $_;
|
|
|
|
chomp $line;
|
|
|
|
chop $line if ($line =~ /\r$/);
|
|
|
|
if($line =~ /^\#/) {
|
2012-12-22 21:12:02 +00:00
|
|
|
$$clean = 0 if ($line =~ m/^#pragma qt_sync_skip_header_check/);
|
2011-04-27 10:05:43 +00:00
|
|
|
return @ret if($line =~ m/^#pragma qt_sync_stop_processing/);
|
|
|
|
push(@ret, $1) if($line =~ m/^#pragma qt_class\(([^)]*)\)[\r\n]*$/);
|
|
|
|
$line = 0;
|
|
|
|
}
|
|
|
|
if($line) {
|
|
|
|
$line =~ s,//.*$,,; #remove c++ comments
|
2016-09-26 12:22:28 +00:00
|
|
|
$line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro
|
2011-04-27 10:05:43 +00:00
|
|
|
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro
|
2012-03-06 19:14:25 +00:00
|
|
|
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro
|
2011-04-27 10:05:43 +00:00
|
|
|
$line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
|
2014-10-31 05:44:13 +00:00
|
|
|
$line .= ";" if($line =~ m/^QT_WARNING_(PUSH|POP|DISABLE_\w+\(.*\))[\r\n]*$/); # qt macros
|
2016-08-31 13:39:30 +00:00
|
|
|
$$requires = $1 if ($line =~ m/^QT_REQUIRE_CONFIG\((.*)\);[\r\n]*$/);
|
2011-04-27 10:05:43 +00:00
|
|
|
$parsable .= " " . $line;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(F);
|
|
|
|
}
|
|
|
|
|
|
|
|
my $last_definition = 0;
|
|
|
|
my @namespaces;
|
|
|
|
for(my $i = 0; $i < length($parsable); $i++) {
|
|
|
|
my $definition = 0;
|
|
|
|
my $character = substr($parsable, $i, 1);
|
|
|
|
if($character eq "/" && substr($parsable, $i+1, 1) eq "*") { #I parse like this for greedy reasons
|
|
|
|
for($i+=2; $i < length($parsable); $i++) {
|
|
|
|
my $end = substr($parsable, $i, 2);
|
|
|
|
if($end eq "*/") {
|
|
|
|
$last_definition = $i+2;
|
|
|
|
$i++;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elsif($character eq "{") {
|
|
|
|
my $brace_depth = 1;
|
|
|
|
my $block_start = $i + 1;
|
|
|
|
BLOCK: for($i+=1; $i < length($parsable); $i++) {
|
|
|
|
my $ignore = substr($parsable, $i, 1);
|
|
|
|
if($ignore eq "{") {
|
|
|
|
$brace_depth++;
|
|
|
|
} elsif($ignore eq "}") {
|
|
|
|
$brace_depth--;
|
|
|
|
unless($brace_depth) {
|
|
|
|
for(my $i2 = $i+1; $i2 < length($parsable); $i2++) {
|
|
|
|
my $end = substr($parsable, $i2, 1);
|
|
|
|
if($end eq ";" || $end ne " ") {
|
|
|
|
$definition = substr($parsable, $last_definition, $block_start - $last_definition) . "}";
|
|
|
|
$i = $i2 if($end eq ";");
|
|
|
|
$last_definition = $i + 1;
|
|
|
|
last BLOCK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elsif($character eq ";") {
|
|
|
|
$definition = substr($parsable, $last_definition, $i - $last_definition + 1);
|
|
|
|
$last_definition = $i + 1;
|
|
|
|
} elsif($character eq "}") {
|
|
|
|
# a naked } must be a namespace ending
|
|
|
|
# if it's not a namespace, it's eaten by the loop above
|
|
|
|
pop @namespaces;
|
|
|
|
$last_definition = $i + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (substr($parsable, $last_definition, $i - $last_definition + 1) =~ m/ namespace ([^ ]*) /
|
|
|
|
&& substr($parsable, $i+1, 1) eq "{") {
|
|
|
|
push @namespaces, $1;
|
|
|
|
|
|
|
|
# Eat the opening { so that the condensing loop above doesn't see it
|
|
|
|
$i++;
|
|
|
|
$last_definition = $i + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($definition) {
|
|
|
|
$definition =~ s=[\n\r]==g;
|
|
|
|
my @symbols;
|
2012-02-26 08:34:36 +00:00
|
|
|
my $post_kw = qr/Q_DECL_FINAL|final|sealed/; # add here macros and keywords that go after the class-name of a class definition
|
2011-04-27 10:05:43 +00:00
|
|
|
if($definition =~ m/^ *typedef *.*\(\*([^\)]*)\)\(.*\);$/) {
|
|
|
|
push @symbols, $1;
|
|
|
|
} elsif($definition =~ m/^ *typedef +(.*) +([^ ]*);$/) {
|
|
|
|
push @symbols, $2;
|
2014-07-08 11:27:52 +00:00
|
|
|
} elsif($definition =~ m/^ *(template *<.*> *)?(class|struct) +([^ <>]* +)?((?!$post_kw)[^<\s]+) ?(<[^>]*> ?)?\s*(?:$post_kw)?\s*((,|:)\s*(public|protected|private) *.*)? *\{\}$/o) {
|
2011-04-27 10:05:43 +00:00
|
|
|
push @symbols, $4;
|
|
|
|
} elsif($definition =~ m/^ *Q_DECLARE_.*ITERATOR\((.*)\);$/) {
|
|
|
|
push @symbols, "Q" . $1 . "Iterator";
|
|
|
|
push @symbols, "QMutable" . $1 . "Iterator";
|
|
|
|
}
|
|
|
|
|
2012-01-04 13:34:39 +00:00
|
|
|
our $publicclassregexp;
|
2011-04-27 10:05:43 +00:00
|
|
|
foreach my $symbol (@symbols) {
|
|
|
|
$symbol = (join("::", @namespaces) . "::" . $symbol) if (scalar @namespaces);
|
2012-01-04 13:34:39 +00:00
|
|
|
|
2014-01-30 18:34:49 +00:00
|
|
|
my $revhdr = $reverse_classnames{$symbol};
|
|
|
|
next if (defined($revhdr) and $revhdr ne $ihdrbase);
|
2012-12-12 11:06:21 +00:00
|
|
|
if ($symbol =~ /^Q[^:]*$/) { # no-namespace, starting with Q
|
2012-01-04 13:34:39 +00:00
|
|
|
push @ret, $symbol;
|
|
|
|
} elsif (defined($publicclassregexp)) {
|
|
|
|
push @ret, $symbol if ($symbol =~ $publicclassregexp);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return @ret;
|
|
|
|
}
|
|
|
|
|
2015-11-26 16:33:04 +00:00
|
|
|
sub check_header {
|
|
|
|
my ($lib, $header, $iheader, $public_header, $private_header) = @_;
|
|
|
|
my $header_skip_qt_begin_namespace_test = 0;
|
|
|
|
|
2016-08-15 09:31:22 +00:00
|
|
|
return if ($ignore_for_include_check{$header});
|
2015-11-26 16:33:04 +00:00
|
|
|
if ($public_header) {
|
|
|
|
$header_skip_qt_begin_namespace_test = 1 if ($ignore_for_qt_begin_namespace_check{$header});
|
|
|
|
}
|
|
|
|
|
|
|
|
open(F, "<$iheader") or return;
|
|
|
|
my $qt_begin_namespace_found = 0;
|
|
|
|
my $qt_end_namespace_found = 0;
|
|
|
|
my $qt_namespace_suffix = "";
|
|
|
|
my $line;
|
|
|
|
my $stop_processing = 0;
|
|
|
|
my $we_mean_it = 0;
|
|
|
|
while ($line = <F>) {
|
|
|
|
chomp $line;
|
|
|
|
my $output_line = 1;
|
|
|
|
if ($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) {
|
|
|
|
$stop_processing = 1;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
if ($line =~ /^ *\# *include/) {
|
|
|
|
my $include = $line;
|
|
|
|
if ($line =~ /<.*>/) {
|
|
|
|
$include =~ s,.*<(.*)>.*,$1,;
|
|
|
|
} elsif ($line =~ /".*"/) {
|
|
|
|
$include =~ s,.*"(.*)".*,$1,;
|
|
|
|
} else {
|
|
|
|
$include = 0;
|
|
|
|
}
|
|
|
|
if ($include && $public_header) {
|
2016-09-14 14:48:10 +00:00
|
|
|
print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p\.h$/);
|
2015-11-26 16:33:04 +00:00
|
|
|
for my $trylib (keys(%modules)) {
|
|
|
|
if (-e "$out_basedir/include/$trylib/$include") {
|
2015-07-09 19:55:21 +00:00
|
|
|
print STDERR "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n";
|
2015-11-26 16:33:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} elsif (!$private_header) {
|
|
|
|
if ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE(_[A-Z_]+)?\s*$/) {
|
|
|
|
$qt_namespace_suffix = defined($1) ? $1 : "";
|
|
|
|
$qt_begin_namespace_found = 1;
|
|
|
|
} elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE$qt_namespace_suffix\s*$/) {
|
|
|
|
$qt_end_namespace_found = 1;
|
|
|
|
}
|
|
|
|
} elsif ($line =~ "^// We mean it.") {
|
|
|
|
++$we_mean_it;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($public_header) {
|
|
|
|
if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) {
|
|
|
|
if ($qt_begin_namespace_found == 0) {
|
2015-07-09 19:55:21 +00:00
|
|
|
print STDERR "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n";
|
2015-11-26 16:33:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) {
|
2015-07-09 19:55:21 +00:00
|
|
|
print STDERR "$lib: WARNING: $iheader has QT_BEGIN_NAMESPACE$qt_namespace_suffix but no QT_END_NAMESPACE$qt_namespace_suffix\n";
|
2015-11-26 16:33:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} elsif ($private_header) {
|
2015-07-09 19:55:21 +00:00
|
|
|
print STDERR "$lib: WARNING: $iheader does not have the \"We mean it.\" warning\n" if (!$we_mean_it);
|
2015-11-26 16:33:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close(F);
|
|
|
|
}
|
|
|
|
|
2011-07-07 18:48:02 +00:00
|
|
|
sub make_path {
|
|
|
|
my ($dir, $lib, $be_verbose) = @_;
|
|
|
|
unless(-e $dir) {
|
|
|
|
mkpath $dir;
|
|
|
|
$dir = "<outbase>" . substr($dir, length($out_basedir)) if ($be_verbose < 3);
|
|
|
|
print "$lib: mkpath $dir\n" if ($be_verbose > 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
######################################################################
|
|
|
|
# Syntax: syncHeader(header, iheader, copy, timestamp)
|
|
|
|
# Params: header, string, filename to create "symlink" for
|
|
|
|
# iheader, string, destination name of symlink
|
|
|
|
# copy, forces header to be a copy of iheader
|
|
|
|
# timestamp, the requested modification time if copying
|
|
|
|
#
|
|
|
|
# Purpose: Syncronizes header to iheader
|
|
|
|
# Returns: 1 if successful, else 0.
|
|
|
|
######################################################################
|
|
|
|
sub syncHeader {
|
2011-07-07 18:48:02 +00:00
|
|
|
my ($lib, $header, $iheader, $copy, $ts) = @_;
|
2012-05-25 10:52:14 +00:00
|
|
|
normalizePath(\$iheader);
|
|
|
|
normalizePath(\$header);
|
2011-07-07 18:48:02 +00:00
|
|
|
return copyFile($lib, $iheader, $header) if($copy);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
unless(-e $header) {
|
|
|
|
my $header_dir = dirname($header);
|
2011-07-07 18:48:02 +00:00
|
|
|
make_path($header_dir, $lib, $verbose_level);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#write it
|
|
|
|
my $iheader_out = fixPaths($iheader, $header_dir);
|
2012-02-20 00:23:26 +00:00
|
|
|
open(HEADER, ">$header") || die "Could not open $header for writing: $!\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
print HEADER "#include \"$iheader_out\"\n";
|
|
|
|
close HEADER;
|
|
|
|
if(defined($ts)) {
|
|
|
|
utime(time, $ts, $header) or die "$iheader, $header";
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: fixPaths(file, dir)
|
|
|
|
# Params: file, string, filepath to be made relative to dir
|
|
|
|
# dir, string, dirpath for point of origin
|
|
|
|
#
|
|
|
|
# Purpose: file is made relative (if possible) of dir.
|
|
|
|
# Returns: String with the above applied conversion.
|
|
|
|
######################################################################
|
2012-04-25 12:29:58 +00:00
|
|
|
|
|
|
|
sub cleanupPath {
|
|
|
|
my ($file) = @_;
|
|
|
|
normalizePath(\$file);
|
|
|
|
while ($file =~ s,/[^/]+/\.\./,/,) {}
|
|
|
|
return $file;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
sub fixPaths {
|
|
|
|
my ($file, $dir) = @_;
|
2012-04-25 12:29:58 +00:00
|
|
|
|
|
|
|
my $out = File::Spec->abs2rel(cleanupPath($file), cleanupPath($dir));
|
|
|
|
$out =~ s,\\,/,g;
|
2014-11-27 13:12:40 +00:00
|
|
|
$out = "\"$out\"" if ($out =~ / /);
|
2012-04-25 12:29:58 +00:00
|
|
|
return $out;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: fileContents(filename)
|
|
|
|
# Params: filename, string, filename of file to return contents
|
|
|
|
#
|
|
|
|
# Purpose: Get the contents of a file.
|
|
|
|
# Returns: String with contents of the file, or empty string if file
|
|
|
|
# doens't exist.
|
|
|
|
# Warning: Dies if it does exist but script cannot get read access.
|
|
|
|
######################################################################
|
|
|
|
sub fileContents {
|
|
|
|
my ($filename) = @_;
|
|
|
|
my $filecontents = "";
|
|
|
|
if (-e $filename) {
|
|
|
|
open(I, "< $filename") || die "Could not open $filename for reading, read block?";
|
|
|
|
local $/;
|
|
|
|
binmode I;
|
|
|
|
$filecontents = <I>;
|
|
|
|
close I;
|
|
|
|
}
|
|
|
|
return $filecontents;
|
|
|
|
}
|
|
|
|
|
2013-05-28 18:28:54 +00:00
|
|
|
######################################################################
|
|
|
|
# Syntax: writeFile(filename, contents)
|
|
|
|
# Params: filename, string, filename of file to write
|
|
|
|
# contents, string, new contents for the file
|
|
|
|
#
|
|
|
|
# Purpose: Write file with given contents. If new contents match old
|
|
|
|
# ones, do no change the file's timestamp.
|
|
|
|
# Returns: 1 if the file's contents changed.
|
|
|
|
######################################################################
|
|
|
|
sub writeFile {
|
|
|
|
my ($filename, $contents, $lib, $what) = @_;
|
|
|
|
my $oldcontents = fileContents($filename);
|
|
|
|
$oldcontents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms
|
|
|
|
if ($oldcontents ne $contents) {
|
|
|
|
open(O, "> " . $filename) || die "Could not open $filename for writing: $!\n";
|
|
|
|
print O $contents;
|
|
|
|
close O;
|
|
|
|
if ($lib && $verbose_level) {
|
|
|
|
my $action = ($oldcontents eq "") ? "created" : "updated";
|
|
|
|
print "$lib: $action $what\n";
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
######################################################################
|
|
|
|
# Syntax: fileCompare(file1, file2)
|
|
|
|
# Params: file1, string, filename of first file
|
|
|
|
# file2, string, filename of second file
|
|
|
|
#
|
|
|
|
# Purpose: Determines if files are equal, and which one is newer.
|
|
|
|
# Returns: 0 if files are equal no matter the timestamp, -1 if file1
|
|
|
|
# is newer, 1 if file2 is newer.
|
|
|
|
######################################################################
|
|
|
|
sub fileCompare {
|
|
|
|
my ($file1, $file2) = @_;
|
|
|
|
my $file1contents = fileContents($file1);
|
|
|
|
my $file2contents = fileContents($file2);
|
|
|
|
if (! -e $file1) { return 1; }
|
|
|
|
if (! -e $file2) { return -1; }
|
|
|
|
return $file1contents ne $file2contents ? (stat($file2))[9] <=> (stat($file1))[9] : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: copyFile(file, ifile)
|
|
|
|
# Params: file, string, filename to create duplicate for
|
|
|
|
# ifile, string, destination name of duplicate
|
|
|
|
#
|
|
|
|
# Purpose: Keeps files in sync so changes in the newer file will be
|
|
|
|
# written to the other.
|
|
|
|
# Returns: 1 if files were synced, else 0.
|
|
|
|
# Warning: Dies if script cannot get write access.
|
|
|
|
######################################################################
|
|
|
|
sub copyFile
|
|
|
|
{
|
2011-07-07 18:48:02 +00:00
|
|
|
my ($lib, $file,$ifile, $copy,$knowdiff,$filecontents,$ifilecontents) = @_;
|
2011-04-27 10:05:43 +00:00
|
|
|
# Bi-directional synchronization
|
|
|
|
open( I, "< " . $file ) || die "Could not open $file for reading";
|
|
|
|
local $/;
|
|
|
|
binmode I;
|
|
|
|
$filecontents = <I>;
|
|
|
|
close I;
|
|
|
|
if ( open(I, "< " . $ifile) ) {
|
|
|
|
local $/;
|
|
|
|
binmode I;
|
|
|
|
$ifilecontents = <I>;
|
|
|
|
close I;
|
|
|
|
$copy = fileCompare($file, $ifile);
|
|
|
|
$knowdiff = 0,
|
|
|
|
} else {
|
|
|
|
$copy = -1;
|
|
|
|
$knowdiff = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $knowdiff || ($filecontents ne $ifilecontents) ) {
|
|
|
|
if ( $copy > 0 ) {
|
|
|
|
my $file_dir = dirname($file);
|
2011-07-07 18:48:02 +00:00
|
|
|
make_path($file_dir, $lib, $verbose_level);
|
2011-04-27 10:05:43 +00:00
|
|
|
open(O, "> " . $file) || die "Could not open $file for writing (no write permission?)";
|
|
|
|
local $/;
|
|
|
|
binmode O;
|
|
|
|
print O $ifilecontents;
|
|
|
|
close O;
|
|
|
|
utime time, (stat($ifile))[9], $file;
|
|
|
|
return 1;
|
|
|
|
} elsif ( $copy < 0 ) {
|
|
|
|
my $ifile_dir = dirname($ifile);
|
2011-07-07 18:48:02 +00:00
|
|
|
make_path($ifile_dir, $lib, $verbose_level);
|
2011-04-27 10:05:43 +00:00
|
|
|
open(O, "> " . $ifile) || die "Could not open $ifile for writing (no write permission?)";
|
|
|
|
local $/;
|
|
|
|
binmode O;
|
|
|
|
print O $filecontents;
|
|
|
|
close O;
|
|
|
|
utime time, (stat($file))[9], $ifile;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Syntax: findFiles(dir, match, descend)
|
|
|
|
# Params: dir, string, directory to search for name
|
|
|
|
# match, string, regular expression to match in dir
|
|
|
|
# descend, integer, 0 = non-recursive search
|
|
|
|
# 1 = recurse search into subdirectories
|
|
|
|
#
|
|
|
|
# Purpose: Finds files matching a regular expression.
|
|
|
|
# Returns: List of matching files.
|
|
|
|
#
|
|
|
|
# Examples:
|
|
|
|
# findFiles("/usr","\.cpp$",1) - finds .cpp files in /usr and below
|
|
|
|
# findFiles("/tmp","^#",0) - finds #* files in /tmp
|
|
|
|
######################################################################
|
|
|
|
sub findFiles {
|
|
|
|
my ($dir,$match,$descend) = @_;
|
|
|
|
my ($file,$p,@files);
|
|
|
|
local(*D);
|
2012-05-25 10:52:14 +00:00
|
|
|
normalizePath(\$dir);
|
2011-04-27 10:05:43 +00:00
|
|
|
($dir eq "") && ($dir = ".");
|
|
|
|
if ( opendir(D,$dir) ) {
|
|
|
|
if ( $dir eq "." ) {
|
|
|
|
$dir = "";
|
|
|
|
} else {
|
|
|
|
($dir =~ /\/$/) || ($dir .= "/");
|
|
|
|
}
|
|
|
|
foreach $file ( sort readdir(D) ) {
|
|
|
|
next if ( $file =~ /^\.\.?$/ );
|
|
|
|
$p = $file;
|
|
|
|
($file =~ /$match/) && (push @files, $p);
|
|
|
|
if ( $descend && -d $p && ! -l $p ) {
|
|
|
|
push @files, &findFiles($p,$match,$descend);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(D);
|
|
|
|
}
|
|
|
|
return @files;
|
|
|
|
}
|
|
|
|
|
2012-08-27 06:44:39 +00:00
|
|
|
sub listSubdirs {
|
|
|
|
my @subdirs = @_;
|
|
|
|
foreach my $subdir (@subdirs) {
|
|
|
|
opendir DIR, $subdir or die "Huh, directory ".$subdir." cannot be opened.";
|
|
|
|
foreach my $t (sort readdir(DIR)) {
|
|
|
|
push @subdirs, "$subdir/$t" if(-d "$subdir/$t" && !($t eq ".") &&
|
|
|
|
!($t eq "..") && !($t eq ".obj") &&
|
|
|
|
!($t eq ".moc") && !($t eq ".rcc") &&
|
|
|
|
!($t eq ".uic") && !($t eq "build") &&
|
|
|
|
!($t eq "doc"));
|
|
|
|
}
|
|
|
|
closedir DIR;
|
|
|
|
}
|
|
|
|
return @subdirs;
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
######################################################################
|
|
|
|
# Syntax: loadSyncProfile()
|
|
|
|
#
|
|
|
|
# Purpose: Locates the sync.profile.
|
|
|
|
# Returns: Hashmap of module name -> directory.
|
|
|
|
######################################################################
|
|
|
|
sub loadSyncProfile {
|
|
|
|
my ($srcbase, $outbase) = @_;
|
2011-07-07 18:05:49 +00:00
|
|
|
if ($verbose_level) {
|
|
|
|
print("<srcbase> = $$srcbase \n");
|
|
|
|
print("<outbase> = $$outbase \n");
|
|
|
|
}
|
2010-11-15 19:55:17 +00:00
|
|
|
|
|
|
|
my $syncprofile = "$$srcbase/sync.profile";
|
|
|
|
my $result;
|
|
|
|
unless ($result = do "$syncprofile") {
|
|
|
|
die "syncqt couldn't parse $syncprofile: $@" if $@;
|
|
|
|
die "syncqt couldn't execute $syncprofile: $!" unless defined $result;
|
|
|
|
}
|
2014-01-30 18:34:49 +00:00
|
|
|
|
|
|
|
for my $fn (keys %classnames) {
|
|
|
|
for my $cn (split(/,/, $classnames{$fn})) {
|
|
|
|
$reverse_classnames{$cn} = $fn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
2012-04-11 12:34:39 +00:00
|
|
|
sub basePrettify {
|
|
|
|
my ($arg) = @_;
|
|
|
|
$$arg =~ s,^\Q$basedir\E,<srcbase>,;
|
|
|
|
$$arg =~ s,^\Q$out_basedir\E,<outbase>,;
|
|
|
|
}
|
|
|
|
|
2012-04-11 13:40:37 +00:00
|
|
|
sub cleanPath {
|
|
|
|
my ($arg) = @_;
|
|
|
|
while ($arg =~ s,[^/]+/\.\.(/|$),,) {}
|
|
|
|
return $arg;
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
sub locateSyncProfile
|
|
|
|
{
|
|
|
|
my ($directory) = @_;
|
|
|
|
$directory = abs_path($directory);
|
2012-01-23 14:04:53 +00:00
|
|
|
while (1) {
|
|
|
|
my $file = $directory."/sync.profile";
|
|
|
|
return $file if (-e $file);
|
|
|
|
my $odir = $directory;
|
2010-11-15 19:55:17 +00:00
|
|
|
$directory = dirname($directory);
|
2012-01-23 14:04:53 +00:00
|
|
|
return undef if ($directory eq $odir);
|
2010-11-15 19:55:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-19 20:21:35 +00:00
|
|
|
sub isQpaHeader
|
|
|
|
{
|
|
|
|
my ($header) = @_;
|
|
|
|
foreach my $qpa_header (@qpa_headers) {
|
|
|
|
return 1 if ($header =~ $qpa_header);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-08-31 13:39:30 +00:00
|
|
|
sub globosort($$) {
|
|
|
|
my ($a, $b) = @_;
|
|
|
|
if ($a =~ /^q(.*)global\.h$/) {
|
|
|
|
my $sa = $1;
|
|
|
|
if ($b =~ /^q(.*)global\.h$/) {
|
|
|
|
my $sb = $1;
|
|
|
|
# Compare stems so qglobal.h (empty stem) is first:
|
|
|
|
return $sa cmp $sb;
|
|
|
|
}
|
|
|
|
return -1; # $a is global, so before $b
|
|
|
|
}
|
|
|
|
return +1 if $b =~ /^q.*global\.h$/; # $a not global, so after $b
|
|
|
|
return $a cmp $b;
|
|
|
|
}
|
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
# check if this is an in-source build, and if so use that as the basedir too
|
|
|
|
$basedir = locateSyncProfile($out_basedir);
|
2011-04-07 14:40:33 +00:00
|
|
|
if ($basedir) {
|
|
|
|
$basedir = dirname($basedir) ;
|
2012-05-25 10:52:14 +00:00
|
|
|
normalizePath(\$basedir);
|
2011-04-07 14:40:33 +00:00
|
|
|
$quoted_basedir = "\Q$basedir";
|
|
|
|
}
|
2010-11-15 19:55:17 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# "main" function
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
while ( @ARGV ) {
|
|
|
|
my $var = 0;
|
|
|
|
my $val = 0;
|
|
|
|
|
|
|
|
#parse
|
|
|
|
my $arg = shift @ARGV;
|
2010-11-25 02:21:06 +00:00
|
|
|
if ($arg eq "-h" || $arg eq "-help" || $arg eq "-?" || $arg eq "?") {
|
2011-04-27 10:05:43 +00:00
|
|
|
$var = "show_help";
|
|
|
|
$val = "yes";
|
|
|
|
} elsif($arg eq "-copy") {
|
|
|
|
$var = "copy";
|
|
|
|
$val = "yes";
|
|
|
|
} elsif($arg eq "-o" || $arg eq "-outdir") {
|
|
|
|
$var = "output";
|
|
|
|
$val = shift @ARGV;
|
|
|
|
} elsif($arg eq "-showonly" || $arg eq "-remove-stale" || $arg eq "-windows" ||
|
|
|
|
$arg eq "-relative" || $arg eq "-check-includes") {
|
|
|
|
$var = substr($arg, 1);
|
|
|
|
$val = "yes";
|
|
|
|
} elsif($arg =~ /^-no-(.*)$/) {
|
|
|
|
$var = $1;
|
|
|
|
$val = "no";
|
|
|
|
#these are for commandline compat
|
|
|
|
} elsif($arg eq "-inc") {
|
|
|
|
$var = "output";
|
|
|
|
$val = shift @ARGV;
|
|
|
|
} elsif($arg eq "-module") {
|
|
|
|
$var = "module";
|
|
|
|
$val = shift @ARGV;
|
|
|
|
} elsif($arg eq "-separate-module") {
|
|
|
|
$var = "separate-module";
|
|
|
|
$val = shift @ARGV;
|
|
|
|
} elsif($arg eq "-show") {
|
|
|
|
$var = "showonly";
|
|
|
|
$val = "yes";
|
|
|
|
} elsif($arg eq "-quiet") {
|
2011-07-07 18:05:49 +00:00
|
|
|
$var = "verbose";
|
|
|
|
$val = "0";
|
|
|
|
} elsif($arg eq "-v") {
|
|
|
|
$var = "verbose";
|
2011-04-27 10:05:43 +00:00
|
|
|
$val = "yes";
|
2011-07-07 18:05:49 +00:00
|
|
|
} elsif($arg eq "-verbose") {
|
|
|
|
$var = "verbose";
|
|
|
|
$val = shift @ARGV;
|
2012-08-31 14:33:33 +00:00
|
|
|
} elsif($arg eq "-minimal") {
|
|
|
|
$var = "minimal";
|
|
|
|
$val = "yes";
|
2010-11-15 15:43:22 +00:00
|
|
|
} elsif($arg eq "-private") {
|
|
|
|
$var = "create_private_headers";
|
|
|
|
$val = "yes";
|
2013-03-20 15:51:32 +00:00
|
|
|
} elsif($arg eq "-version") {
|
|
|
|
$var = "version";
|
2010-11-25 02:21:06 +00:00
|
|
|
$val = shift @ARGV;
|
2010-11-15 19:55:17 +00:00
|
|
|
} elsif($arg =~/^-/) {
|
2015-12-05 00:04:38 +00:00
|
|
|
print STDERR "ERROR: Unknown option: $arg\n\n" if (!$var);
|
2010-11-15 19:55:17 +00:00
|
|
|
showUsage();
|
|
|
|
} else {
|
|
|
|
$basedir = locateSyncProfile($arg);
|
|
|
|
die "Could not find a sync.profile for '$arg'\n" if (!$basedir);
|
|
|
|
$basedir = dirname($basedir);
|
2012-05-25 10:52:14 +00:00
|
|
|
normalizePath(\$basedir);
|
2011-04-07 14:40:33 +00:00
|
|
|
$quoted_basedir = "\Q$basedir";
|
2010-11-15 19:55:17 +00:00
|
|
|
$var = "ignore";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#do something
|
|
|
|
if(!$var || $var eq "show_help") {
|
2015-12-05 00:04:38 +00:00
|
|
|
print STDERR "ERROR: Unknown option: $arg\n\n" if (!$var);
|
2011-04-27 10:05:43 +00:00
|
|
|
showUsage();
|
|
|
|
} elsif ($var eq "copy") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$copy_headers++;
|
|
|
|
} elsif($showonly) {
|
|
|
|
$copy_headers--;
|
|
|
|
}
|
|
|
|
} elsif ($var eq "showonly") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$showonly++;
|
|
|
|
} elsif($showonly) {
|
|
|
|
$showonly--;
|
|
|
|
}
|
2011-07-07 18:05:49 +00:00
|
|
|
} elsif ($var eq "verbose") {
|
2011-04-27 10:05:43 +00:00
|
|
|
if($val eq "yes") {
|
2011-07-07 18:05:49 +00:00
|
|
|
$verbose_level++;
|
|
|
|
} elsif($val eq "no" && $verbose_level) {
|
|
|
|
$verbose_level--;
|
|
|
|
} else {
|
|
|
|
$verbose_level = int($val);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
} elsif ($var eq "check-includes") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$check_includes++;
|
|
|
|
} elsif($check_includes) {
|
|
|
|
$check_includes--;
|
|
|
|
}
|
|
|
|
} elsif ($var eq "remove-stale") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$remove_stale++;
|
|
|
|
} elsif($remove_stale) {
|
|
|
|
$remove_stale--;
|
|
|
|
}
|
|
|
|
} elsif ($var eq "windows") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$force_win++;
|
|
|
|
} elsif($force_win) {
|
|
|
|
$force_win--;
|
|
|
|
}
|
|
|
|
} elsif ($var eq "relative") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$force_relative++;
|
|
|
|
} elsif($force_relative) {
|
|
|
|
$force_relative--;
|
|
|
|
}
|
2012-08-31 14:33:33 +00:00
|
|
|
} elsif ($var eq "minimal") {
|
|
|
|
if($val eq "yes") {
|
|
|
|
$minimal++;
|
|
|
|
} elsif($minimal) {
|
|
|
|
$minimal--;
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
} elsif ($var eq "module") {
|
|
|
|
push @modules_to_sync, $val;
|
|
|
|
} elsif ($var eq "separate-module") {
|
|
|
|
my ($module, $prodir, $headerdir) = split(/:/, $val);
|
|
|
|
$modules{$module} = $prodir;
|
|
|
|
push @modules_to_sync, $module;
|
|
|
|
$moduleheaders{$module} = $headerdir;
|
2013-03-20 15:51:32 +00:00
|
|
|
} elsif ($var eq "version") {
|
2010-11-25 02:21:06 +00:00
|
|
|
if($val) {
|
2013-03-20 15:51:32 +00:00
|
|
|
$module_version = $val;
|
2010-11-25 02:21:06 +00:00
|
|
|
} else {
|
2013-03-20 15:51:32 +00:00
|
|
|
die "The -version option requires an argument";
|
2010-11-25 02:21:06 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
} elsif ($var eq "output") {
|
|
|
|
my $outdir = $val;
|
|
|
|
if(checkRelative($outdir)) {
|
|
|
|
$out_basedir = getcwd();
|
|
|
|
chomp $out_basedir;
|
|
|
|
$out_basedir .= "/" . $outdir;
|
|
|
|
} else {
|
|
|
|
$out_basedir = $outdir;
|
|
|
|
}
|
2012-05-25 10:52:14 +00:00
|
|
|
normalizePath(\$out_basedir);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-15 19:55:17 +00:00
|
|
|
|
|
|
|
# if we have no $basedir we cannot be sure which sources you want, so die
|
|
|
|
die "Could not find any sync.profile for your module!\nPass <module directory> to syncqt to sync your header files.\nsyncqt failed" if (!$basedir);
|
2015-09-18 01:17:40 +00:00
|
|
|
die "The -version argument is mandatory" if (!$module_version);
|
2010-11-15 19:55:17 +00:00
|
|
|
|
2011-08-04 20:54:50 +00:00
|
|
|
our @ignore_headers = ();
|
2011-03-10 15:23:01 +00:00
|
|
|
our @ignore_for_master_contents = ();
|
|
|
|
our @ignore_for_include_check = ();
|
|
|
|
our @ignore_for_qt_begin_namespace_check = ();
|
|
|
|
our @ignore_for_qt_module_check = ();
|
2012-04-11 12:13:01 +00:00
|
|
|
our %inject_headers = ();
|
2011-03-10 15:23:01 +00:00
|
|
|
|
2010-11-15 19:55:17 +00:00
|
|
|
# load the module's sync.profile here, before we can
|
|
|
|
loadSyncProfile(\$basedir, \$out_basedir);
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
@modules_to_sync = keys(%modules) if($#modules_to_sync == -1);
|
|
|
|
|
2016-08-15 09:32:06 +00:00
|
|
|
for my $p (keys %inject_headers) {
|
|
|
|
push @ignore_for_include_check, @{$inject_headers{$p}};
|
|
|
|
}
|
|
|
|
|
2011-08-16 08:50:00 +00:00
|
|
|
my %allmoduleheadersprivate = map { $_ => 1 } @allmoduleheadersprivate;
|
2015-11-26 16:15:38 +00:00
|
|
|
%ignore_for_include_check = map { $_ => 1 } @ignore_for_include_check;
|
|
|
|
%ignore_for_qt_begin_namespace_check = map { $_ => 1 } @ignore_for_qt_begin_namespace_check;
|
2011-08-16 08:50:00 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
$isunix = checkUnix; #cache checkUnix
|
|
|
|
|
|
|
|
foreach my $lib (@modules_to_sync) {
|
2012-09-18 15:19:31 +00:00
|
|
|
die "No such module: $lib" unless(defined $modules{$lib});
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#iteration info
|
2013-06-07 13:55:30 +00:00
|
|
|
my $module = $modules{$lib};
|
|
|
|
my $is_qt = !($module =~ s/^!//);
|
|
|
|
my @dirs = split(/;/, $module);
|
2012-12-03 19:33:48 +00:00
|
|
|
my $dir = $dirs[0];
|
2015-11-10 17:40:04 +00:00
|
|
|
shift @dirs if ($dir =~ s/^>//);
|
2011-04-20 18:57:51 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
my $pathtoheaders = "";
|
|
|
|
$pathtoheaders = $moduleheaders{$lib} if ($moduleheaders{$lib});
|
|
|
|
|
2011-08-16 08:50:00 +00:00
|
|
|
my $allheadersprivate = 0;
|
|
|
|
$allheadersprivate = 1 if $allmoduleheadersprivate{$lib};
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#information used after the syncing
|
|
|
|
my $pri_install_classes = "";
|
|
|
|
my $pri_install_files = "";
|
2017-10-23 13:42:52 +00:00
|
|
|
my $pri_install_ifiles = "";
|
2011-04-27 10:05:43 +00:00
|
|
|
my $pri_install_pfiles = "";
|
2016-10-10 17:29:54 +00:00
|
|
|
my $pri_install_ipfiles = "";
|
2012-05-08 10:50:50 +00:00
|
|
|
my $pri_install_qpafiles = "";
|
2014-02-03 21:22:14 +00:00
|
|
|
my $pri_injections = "";
|
2012-12-22 21:12:02 +00:00
|
|
|
my $pri_clean_files = "";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2013-05-28 18:57:07 +00:00
|
|
|
my $libcapitals = uc($lib);
|
2016-08-31 13:39:30 +00:00
|
|
|
my %master_contents = ();
|
2013-05-28 18:57:07 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
#remove the old files
|
|
|
|
if($remove_stale) {
|
2012-04-11 13:40:37 +00:00
|
|
|
my %injections = ();
|
|
|
|
for my $p (keys %inject_headers) {
|
|
|
|
next unless ($p =~ /^\Q$dir\E(\/|$)/);
|
|
|
|
my $sp = $p;
|
|
|
|
$sp =~ s,^\Q$basedir\E/,$out_basedir/,;
|
|
|
|
for my $n (@{$inject_headers{$p}}) {
|
|
|
|
$injections{$sp."/".$n} = 1;
|
|
|
|
}
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
my @subdirs = ("$out_basedir/include/$lib");
|
|
|
|
foreach my $subdir (@subdirs) {
|
|
|
|
if (opendir DIR, $subdir) {
|
2012-07-17 13:39:54 +00:00
|
|
|
foreach my $t (sort { $b cmp $a } readdir(DIR)) {
|
2016-08-26 14:46:40 +00:00
|
|
|
next if ($t =~ /\.pri$/);
|
Modularize the new configure system (infrastructure part)
This change implements the required infrastructure to modularize the new
configuration system.
This requires a hierarchy of configuration files, both for handling
multiple repositories and for individual modules inside the same
repository.
When configuring, they all need to get loaded first, as command line
processing needs to know about all possible command line options.
When the command line has been processed, the individual configuration
files need to get processed one after the other and independently from
each other.
Configure is now automatically invoked when building the a project
tree's "root" project; this works with both modular and top-level builds
of Qt (the latter with an according change in the super repo). As an
immediate consequence, the -skip option moves to the super repo with a
different implementation, as configuration is now done after the repo
list is determined. The option belongs there anyway.
This commit also adds an optional testDir entry to the json file. Like
this, we can still have all configure tests in qtbase/config.tests and
the configuration file in, e.g., corelib can reference those.
The files section can now be left out as long as a 'module' entry is
present, specifying the module name. The names of the files to generate
can then be deduced from that name. We still need to be able to specify
names directly for the global configuration files.
qtConfig() now also queries features which are module-specific. As it is
sometimes necessary to query the configuration of modules which should
not be actually linked (and cannot in the case of subdirs projects), the
new variable QT_FOR_CONFIG which allows specifying configuration-only
dependencies is introduced.
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: Id1b518a3aa34044748b87fb8fac14d79653f6b18
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-25 13:45:44 +00:00
|
|
|
next if ($t =~ /^qt[a-z0-9]+-config(_p)?\.h$/);
|
2011-04-27 10:05:43 +00:00
|
|
|
my $file = "$subdir/$t";
|
|
|
|
if(-d $file) {
|
|
|
|
push @subdirs, $file unless($t eq "." || $t eq "..");
|
|
|
|
} else {
|
|
|
|
my @files = ($file);
|
|
|
|
#push @files, "$out_basedir/include/Qt/$t" if(-e "$out_basedir/include/Qt/$t");
|
|
|
|
foreach my $file (@files) {
|
|
|
|
my $remove_file = 0;
|
|
|
|
if(open(F, "<$file")) {
|
|
|
|
while(my $line = <F>) {
|
|
|
|
chomp $line;
|
|
|
|
if($line =~ /^\#include \"([^\"]*)\"$/) {
|
|
|
|
my $include = $1;
|
|
|
|
$include = $subdir . "/" . $include unless(substr($include, 0, 1) eq "/");
|
2012-04-11 13:40:37 +00:00
|
|
|
$remove_file = 1 unless(-e $include or defined $injections{cleanPath($include)});
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
|
|
|
$remove_file = 0;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(F);
|
|
|
|
unlink $file if($remove_file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir DIR;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#create the new ones
|
2012-12-03 19:33:48 +00:00
|
|
|
foreach my $current_dir (@dirs) {
|
2012-12-03 19:35:02 +00:00
|
|
|
my $thisprivate = 0;
|
|
|
|
($current_dir =~ s/^\^//) and $thisprivate = 1;
|
2011-10-20 13:45:20 +00:00
|
|
|
my @headers_paths = split(/;/, $pathtoheaders);
|
|
|
|
if (@headers_paths) {
|
|
|
|
@headers_paths = map { "$current_dir/$_" } @headers_paths;
|
|
|
|
} else {
|
|
|
|
push @headers_paths, $current_dir;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2011-10-20 13:45:20 +00:00
|
|
|
foreach my $headers_dir (@headers_paths) {
|
|
|
|
#calc subdirs
|
2012-08-27 06:44:39 +00:00
|
|
|
my @subdirs = listSubdirs($headers_dir);
|
2011-10-20 13:45:20 +00:00
|
|
|
|
|
|
|
#calc files and "copy" them
|
|
|
|
foreach my $subdir (@subdirs) {
|
|
|
|
my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
|
Modularize the new configure system (infrastructure part)
This change implements the required infrastructure to modularize the new
configuration system.
This requires a hierarchy of configuration files, both for handling
multiple repositories and for individual modules inside the same
repository.
When configuring, they all need to get loaded first, as command line
processing needs to know about all possible command line options.
When the command line has been processed, the individual configuration
files need to get processed one after the other and independently from
each other.
Configure is now automatically invoked when building the a project
tree's "root" project; this works with both modular and top-level builds
of Qt (the latter with an according change in the super repo). As an
immediate consequence, the -skip option moves to the super repo with a
different implementation, as configuration is now done after the repo
list is determined. The option belongs there anyway.
This commit also adds an optional testDir entry to the json file. Like
this, we can still have all configure tests in qtbase/config.tests and
the configuration file in, e.g., corelib can reference those.
The files section can now be left out as long as a 'module' entry is
present, specifying the module name. The names of the files to generate
can then be deduced from that name. We still need to be able to specify
names directly for the global configuration files.
qtConfig() now also queries features which are module-specific. As it is
sometimes necessary to query the configuration of modules which should
not be actually linked (and cannot in the case of subdirs projects), the
new variable QT_FOR_CONFIG which allows specifying configuration-only
dependencies is introduced.
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: Id1b518a3aa34044748b87fb8fac14d79653f6b18
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-25 13:45:44 +00:00
|
|
|
@headers = grep(!/^qt[a-z0-9]+-config(_p)?\.h$/, @headers);
|
2014-02-03 21:22:14 +00:00
|
|
|
if (defined $inject_headers{$subdir}) {
|
|
|
|
foreach my $if (@{$inject_headers{$subdir}}) {
|
2017-03-20 11:08:14 +00:00
|
|
|
my $cif = $if;
|
|
|
|
$cif =~ s/^\^//;
|
|
|
|
@headers = grep(!/^\Q$cif\E$/, @headers); #in case we configure'd previously
|
2014-02-03 21:22:14 +00:00
|
|
|
push @headers, "*".$if;
|
|
|
|
}
|
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
my $header_dirname = "";
|
|
|
|
foreach my $header (@headers) {
|
2014-02-03 21:22:14 +00:00
|
|
|
my $shadow = ($header =~ s/^\*//);
|
2017-03-20 11:08:14 +00:00
|
|
|
my $no_stamp = $shadow && ($header =~ s/^\^//);
|
2016-09-14 14:48:10 +00:00
|
|
|
$header = 0 if ($header =~ /^ui_.*\.h$/);
|
2011-10-20 13:45:20 +00:00
|
|
|
foreach (@ignore_headers) {
|
|
|
|
$header = 0 if($header eq $_);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
if($header) {
|
|
|
|
my $header_copies = 0;
|
|
|
|
#figure out if it is a public header
|
|
|
|
my $public_header = $header;
|
Expose QPA API under qpa/*
The main reasons for doing this are:
1. _qpa.h end up in the master QtGui include file. QtGui is meant for
userland applications. qpa code is neither binary nor source compatible.
Inadvertant use of QPA api makes the user code binary-incompatible.
2. syncqt creates forwarding headers for non-private header files. This
gives people the impression that this is public API.
As discussed on the mailing list, even though QPA api is internal and subject
to change, it needs to treated differently from private headers since they
will be used by in-qtbase and out-of-qtbase plugins.
This commit does the following:
1. The _qpa in QPA header files is dropped.
2. syncqt now treats any file with qplatform prefix as a special file and
moves it to qpa/ directory. The recommended way of using QPA API in plugins
is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API
from multiple modules (for example, qplatformfoo might be in QtPrintSupport)
3. The user needs to explicitly add QT += <module>-private to get access to
the qpa api.
4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo
includes.
This commit does not change the cpp filenames. This requires a more careful
merging of existing non qpa cpp files and existing cpp files on a case by
case basis. This can be done at anytime.
The following files are not renamed as part of this changed but will be fixed
as part of a future change:
src/gui/kernel/qgenericpluginfactory_qpa.h
src/gui/kernel/qgenericplugin_qpa.h
src/gui/kernel/qwindowsysteminterface_qpa.h
files were renamed using
for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done
for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done
includes were renamed using script
for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do
sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \
-e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \
-e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \
-e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \
$file
done
Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-04-26 23:33:35 +00:00
|
|
|
my $qpa_header = 0;
|
2012-06-19 20:21:35 +00:00
|
|
|
if(isQpaHeader($public_header)) {
|
Expose QPA API under qpa/*
The main reasons for doing this are:
1. _qpa.h end up in the master QtGui include file. QtGui is meant for
userland applications. qpa code is neither binary nor source compatible.
Inadvertant use of QPA api makes the user code binary-incompatible.
2. syncqt creates forwarding headers for non-private header files. This
gives people the impression that this is public API.
As discussed on the mailing list, even though QPA api is internal and subject
to change, it needs to treated differently from private headers since they
will be used by in-qtbase and out-of-qtbase plugins.
This commit does the following:
1. The _qpa in QPA header files is dropped.
2. syncqt now treats any file with qplatform prefix as a special file and
moves it to qpa/ directory. The recommended way of using QPA API in plugins
is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API
from multiple modules (for example, qplatformfoo might be in QtPrintSupport)
3. The user needs to explicitly add QT += <module>-private to get access to
the qpa api.
4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo
includes.
This commit does not change the cpp filenames. This requires a more careful
merging of existing non qpa cpp files and existing cpp files on a case by
case basis. This can be done at anytime.
The following files are not renamed as part of this changed but will be fixed
as part of a future change:
src/gui/kernel/qgenericpluginfactory_qpa.h
src/gui/kernel/qgenericplugin_qpa.h
src/gui/kernel/qwindowsysteminterface_qpa.h
files were renamed using
for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done
for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done
includes were renamed using script
for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do
sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \
-e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \
-e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \
-e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \
$file
done
Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-04-26 23:33:35 +00:00
|
|
|
$public_header = 0;
|
|
|
|
$qpa_header = 1;
|
2016-09-14 14:48:10 +00:00
|
|
|
} elsif ($allheadersprivate || $thisprivate || $public_header =~ /_p(ch)?\.h$/) {
|
2011-10-20 13:45:20 +00:00
|
|
|
$public_header = 0;
|
|
|
|
} else {
|
|
|
|
foreach (@ignore_for_master_contents) {
|
|
|
|
$public_header = 0 if($header eq $_);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
|
2012-12-22 21:12:02 +00:00
|
|
|
my $clean_header;
|
2016-08-31 13:39:30 +00:00
|
|
|
my $requires;
|
2011-10-20 13:45:20 +00:00
|
|
|
my $iheader = $subdir . "/" . $header;
|
2014-02-03 21:22:14 +00:00
|
|
|
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
|
2015-11-27 11:19:33 +00:00
|
|
|
if ($check_includes) {
|
2015-12-02 09:51:39 +00:00
|
|
|
# We need both $public_header and $private_header because QPA headers count as neither
|
|
|
|
my $private_header = !$public_header && !$qpa_header
|
|
|
|
&& $header =~ /_p\.h$/ && $subdir !~ /3rdparty/;
|
|
|
|
check_header($lib, $header, $iheader, $public_header, $private_header);
|
2015-11-27 11:19:33 +00:00
|
|
|
}
|
2016-10-07 15:18:50 +00:00
|
|
|
my @classes = ();
|
|
|
|
push @classes, classNames($iheader, \$clean_header, \$requires)
|
|
|
|
if (!$shadow && $public_header && !$minimal && $is_qt);
|
|
|
|
my $classname = $classnames{$header};
|
|
|
|
push @classes, split(/,/, $classname) if ($classname);
|
2011-10-20 13:45:20 +00:00
|
|
|
if($showonly) {
|
|
|
|
print "$header [$lib]\n";
|
|
|
|
foreach(@classes) {
|
|
|
|
print "SYMBOL: $_\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
} else {
|
2014-02-03 21:22:14 +00:00
|
|
|
my $ts = $shadow ? 0 : (stat($iheader))[9];
|
2011-10-20 13:45:20 +00:00
|
|
|
#find out all the places it goes..
|
2014-01-30 19:27:00 +00:00
|
|
|
my $oheader;
|
2011-10-20 13:45:20 +00:00
|
|
|
if ($public_header) {
|
2014-01-30 19:27:00 +00:00
|
|
|
$oheader = "$out_basedir/include/$lib/$header";
|
2011-10-20 13:45:20 +00:00
|
|
|
foreach my $full_class (@classes) {
|
|
|
|
my $header_base = basename($header);
|
|
|
|
# Strip namespaces:
|
|
|
|
my $class = $full_class;
|
|
|
|
$class =~ s/^.*:://;
|
|
|
|
# if ($class =~ m/::/) {
|
|
|
|
# class =~ s,::,/,g;
|
|
|
|
# }
|
2011-11-04 11:20:49 +00:00
|
|
|
|
2014-02-03 21:22:14 +00:00
|
|
|
$header_copies++ if (!$shadow && syncHeader($lib, "$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0, $ts));
|
2011-11-04 11:20:49 +00:00
|
|
|
}
|
Expose QPA API under qpa/*
The main reasons for doing this are:
1. _qpa.h end up in the master QtGui include file. QtGui is meant for
userland applications. qpa code is neither binary nor source compatible.
Inadvertant use of QPA api makes the user code binary-incompatible.
2. syncqt creates forwarding headers for non-private header files. This
gives people the impression that this is public API.
As discussed on the mailing list, even though QPA api is internal and subject
to change, it needs to treated differently from private headers since they
will be used by in-qtbase and out-of-qtbase plugins.
This commit does the following:
1. The _qpa in QPA header files is dropped.
2. syncqt now treats any file with qplatform prefix as a special file and
moves it to qpa/ directory. The recommended way of using QPA API in plugins
is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API
from multiple modules (for example, qplatformfoo might be in QtPrintSupport)
3. The user needs to explicitly add QT += <module>-private to get access to
the qpa api.
4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo
includes.
This commit does not change the cpp filenames. This requires a more careful
merging of existing non qpa cpp files and existing cpp files on a case by
case basis. This can be done at anytime.
The following files are not renamed as part of this changed but will be fixed
as part of a future change:
src/gui/kernel/qgenericpluginfactory_qpa.h
src/gui/kernel/qgenericplugin_qpa.h
src/gui/kernel/qwindowsysteminterface_qpa.h
files were renamed using
for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done
for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done
includes were renamed using script
for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do
sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \
-e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \
-e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \
-e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \
$file
done
Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-04-26 23:33:35 +00:00
|
|
|
} elsif ($create_private_headers && !$qpa_header) {
|
2014-01-30 19:27:00 +00:00
|
|
|
$oheader = "$out_basedir/include/$lib/$module_version/$lib/private/$header";
|
Expose QPA API under qpa/*
The main reasons for doing this are:
1. _qpa.h end up in the master QtGui include file. QtGui is meant for
userland applications. qpa code is neither binary nor source compatible.
Inadvertant use of QPA api makes the user code binary-incompatible.
2. syncqt creates forwarding headers for non-private header files. This
gives people the impression that this is public API.
As discussed on the mailing list, even though QPA api is internal and subject
to change, it needs to treated differently from private headers since they
will be used by in-qtbase and out-of-qtbase plugins.
This commit does the following:
1. The _qpa in QPA header files is dropped.
2. syncqt now treats any file with qplatform prefix as a special file and
moves it to qpa/ directory. The recommended way of using QPA API in plugins
is: #include <qpa/qplatformfoo.h>. This allows the user include QPA API
from multiple modules (for example, qplatformfoo might be in QtPrintSupport)
3. The user needs to explicitly add QT += <module>-private to get access to
the qpa api.
4. Creates compat headers for the olden style qplatformfoo_qpa.h and QPlatformFoo
includes.
This commit does not change the cpp filenames. This requires a more careful
merging of existing non qpa cpp files and existing cpp files on a case by
case basis. This can be done at anytime.
The following files are not renamed as part of this changed but will be fixed
as part of a future change:
src/gui/kernel/qgenericpluginfactory_qpa.h
src/gui/kernel/qgenericplugin_qpa.h
src/gui/kernel/qwindowsysteminterface_qpa.h
files were renamed using
for x in `find . -name "qplatform*_qpa.h"`; do git mv $x "${x/_qpa.h/.h}"; done
for x in `find . -name "qplatform*_qpa_p.h"`; do git mv $x "${x/_qpa_p.h/_p.h}"; done
includes were renamed using script
for file in `find . -name "*.h" -or -name "*.cpp" -or -name "*.mm"`; do
sed -i -e 's,.*#.*include.*<\(Qt.*/\)\?\(QPlatform.*\)>,#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.*"\(Qt.*/\)\?\(QPlatform.*\)",#include <qpa/\L\2.h>,g' \
-e 's,.*#.*include.* "\(qplatform.*\)_qpa.h",#include <qpa/\L\1.h>,g' \
-e 's,.*#.*include.*"\(qplatform.*\)_qpa_p.h",#include <qpa/\L\1_p.h>,g' \
-e 's,.*#.*include.*<\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)>,#include <qpa/\2\3>,g' \
-e 's,.*#.*include.*"\(Qt.*/\|Qt.*/private/\|private/\)\?\(qplatform.*\)_qpa\(.*\)",#include <qpa/\2\3>,g' \
$file
done
Change-Id: I04a350314a45746e3911f54b3b21ad03315afb67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-04-26 23:33:35 +00:00
|
|
|
} elsif ($create_private_headers) {
|
2014-01-30 19:27:00 +00:00
|
|
|
$oheader = "$out_basedir/include/$lib/$module_version/$lib/qpa/$header";
|
2011-04-20 18:57:51 +00:00
|
|
|
}
|
2014-02-03 21:22:14 +00:00
|
|
|
$header_copies++ if (!$shadow && syncHeader($lib, $oheader, $iheader, $copy_headers, $ts));
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2014-01-30 20:01:23 +00:00
|
|
|
my $pri_install_iheader = fixPaths($iheader, $dir);
|
2014-02-03 21:22:14 +00:00
|
|
|
my $injection = "";
|
2017-10-23 13:42:52 +00:00
|
|
|
if ($public_header) {
|
2014-01-30 20:00:49 +00:00
|
|
|
foreach my $class (@classes) {
|
|
|
|
# Strip namespaces:
|
|
|
|
$class =~ s/^.*:://;
|
|
|
|
# if ($class =~ m/::/) {
|
|
|
|
# $class =~ s,::,/,g;
|
|
|
|
# }
|
|
|
|
my $class_header = fixPaths("$out_basedir/include/$lib/$class", $dir) . " ";
|
|
|
|
$pri_install_classes .= $class_header
|
|
|
|
unless($pri_install_classes =~ $class_header);
|
2014-02-03 21:22:14 +00:00
|
|
|
$injection .= ":$class";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2017-10-23 13:42:52 +00:00
|
|
|
|
|
|
|
if ($shadow) {
|
|
|
|
$pri_install_ifiles .= "$pri_install_iheader ";
|
|
|
|
} else {
|
|
|
|
# put it into the master file
|
|
|
|
$master_contents{$public_header} = $requires if (shouldMasterInclude($iheader));
|
|
|
|
|
|
|
|
# deal with the install directives
|
|
|
|
$pri_install_files .= "$pri_install_iheader ";
|
|
|
|
$pri_clean_files .= "$pri_install_iheader".($requires ? ":".$requires : "")." " if ($clean_header);
|
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
}
|
2012-05-08 10:50:50 +00:00
|
|
|
elsif ($qpa_header) {
|
|
|
|
$pri_install_qpafiles.= "$pri_install_iheader ";;
|
|
|
|
}
|
2016-10-10 17:29:54 +00:00
|
|
|
elsif ($shadow) {
|
|
|
|
$pri_install_ipfiles .= "$pri_install_iheader ";
|
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
else {
|
|
|
|
$pri_install_pfiles.= "$pri_install_iheader ";;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2014-02-03 21:22:14 +00:00
|
|
|
$pri_injections .= fixPaths($iheader, "$out_basedir/include/$lib")
|
2017-03-20 11:08:14 +00:00
|
|
|
.":".($no_stamp ? "^" : "").fixPaths($oheader, "$out_basedir/include/$lib")
|
2014-02-03 21:22:14 +00:00
|
|
|
.$injection." " if ($shadow);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2011-07-07 18:05:49 +00:00
|
|
|
|
2011-10-20 13:45:20 +00:00
|
|
|
if ($verbose_level && $header_copies) {
|
|
|
|
my $new_header_dirname = dirname($iheader);
|
2012-04-11 12:34:39 +00:00
|
|
|
basePrettify(\$new_header_dirname) if ($new_header_dirname && $verbose_level < 2);
|
2011-10-20 13:45:20 +00:00
|
|
|
my $header_base = basename($iheader);
|
|
|
|
if ($verbose_level < 3) {
|
|
|
|
my $line_prefix = ",";
|
|
|
|
if ($new_header_dirname ne $header_dirname) {
|
|
|
|
$line_prefix = "$lib: created fwd-include header(s) for $new_header_dirname/ {";
|
|
|
|
$line_prefix = " }\n".$line_prefix if ($header_dirname);
|
|
|
|
$header_dirname = $new_header_dirname;
|
|
|
|
} else {
|
|
|
|
$line_prefix = ",";
|
|
|
|
}
|
|
|
|
print "$line_prefix $header_base ($header_copies)";
|
|
|
|
} else { # $verbose_level >= 3
|
2012-04-11 12:34:39 +00:00
|
|
|
basePrettify(\$iheader) if ($verbose_level == 3);
|
2011-10-20 13:45:20 +00:00
|
|
|
print "$lib: created $header_copies fwd-include headers for $iheader\n";
|
2011-07-07 18:05:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2011-10-20 13:45:20 +00:00
|
|
|
print " }\n" if ($header_dirname && $verbose_level > 0 && $verbose_level < 3);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-31 13:39:30 +00:00
|
|
|
# populate the master include:
|
|
|
|
my $master_contents =
|
|
|
|
"#ifndef QT_".$libcapitals."_MODULE_H\n" .
|
|
|
|
"#define QT_".$libcapitals."_MODULE_H\n" .
|
|
|
|
"#include <$lib/${lib}Depends>\n" .
|
|
|
|
join("", map {
|
|
|
|
my $rq = $master_contents{$_};
|
|
|
|
($rq ? "#if QT_CONFIG($rq)\n" : "") .
|
|
|
|
"#include \"$_\"\n" .
|
|
|
|
($rq ? "#endif\n" : "")
|
|
|
|
} sort globosort keys %master_contents) .
|
2013-05-28 18:57:07 +00:00
|
|
|
"#include \"".lc($lib)."version.h\"\n" .
|
|
|
|
"#endif\n";
|
|
|
|
|
2013-06-07 13:55:30 +00:00
|
|
|
unless ($showonly || $minimal || !$is_qt) {
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
# create deprecated headers
|
|
|
|
my $first = 1;
|
|
|
|
while (my ($header, $include) = each %{$deprecatedheaders{$lib}}) {
|
|
|
|
my $public_header = 0;
|
|
|
|
$public_header = 1 unless ($allheadersprivate || ($header =~ /_p\.h$/));
|
|
|
|
next unless ($public_header || $create_private_headers);
|
|
|
|
|
|
|
|
my $header_path = "$out_basedir/include/$lib/";
|
|
|
|
unless ($public_header) {
|
2012-06-04 15:12:24 +00:00
|
|
|
$header_path .= "$module_version/$lib/private/";
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
}
|
|
|
|
$header_path .= "$header";
|
|
|
|
|
|
|
|
unless (-e $header_path) {
|
|
|
|
my $guard = "DEPRECATED_HEADER_" . $lib . "_" . $header;
|
|
|
|
$guard =~ s/([^a-zA-Z0-9_])/_/g;
|
|
|
|
|
2012-02-19 23:40:12 +00:00
|
|
|
my $header_dir = dirname($header_path);
|
|
|
|
make_path($header_dir, $lib, $verbose_level);
|
|
|
|
|
2013-05-28 18:29:47 +00:00
|
|
|
my $hdrcont =
|
|
|
|
"#ifndef $guard\n" .
|
|
|
|
"#define $guard\n";
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
my $warning = "Header <$lib/";
|
|
|
|
$warning .= "private/" unless ($public_header);
|
|
|
|
$warning .= "$header> is deprecated. Please include <$include> instead.";
|
2013-05-28 18:29:47 +00:00
|
|
|
$hdrcont .=
|
|
|
|
"#if defined(__GNUC__)\n" .
|
|
|
|
"# warning $warning\n" .
|
|
|
|
"#elif defined(_MSC_VER)\n" .
|
|
|
|
"# pragma message (\"$warning\")\n" .
|
|
|
|
"#endif\n" .
|
|
|
|
"#include <$include>\n";
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
if ($public_header) {
|
2013-05-28 18:29:47 +00:00
|
|
|
$hdrcont .=
|
|
|
|
"#if 0\n" .
|
|
|
|
"#pragma qt_no_master_include\n" .
|
|
|
|
"#endif\n";
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
}
|
2013-05-28 18:29:47 +00:00
|
|
|
$hdrcont .=
|
|
|
|
"#endif\n";
|
|
|
|
if (writeFile($header_path, $hdrcont)) {
|
|
|
|
if ($verbose_level < 3) {
|
|
|
|
my $line_prefix = ",";
|
|
|
|
$line_prefix = "$lib: created deprecated header(s) {" if ($first);
|
|
|
|
print "$line_prefix $header";
|
|
|
|
} else {
|
|
|
|
print "$lib: created deprecated header $header => $include\n";
|
|
|
|
}
|
|
|
|
$first = 0;
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-08 19:29:23 +00:00
|
|
|
|
|
|
|
my $addendum = fixPaths($header_path, $dir) . " ";
|
|
|
|
if ($public_header) {
|
|
|
|
$pri_install_files .= $addendum;
|
|
|
|
} else {
|
|
|
|
$pri_install_pfiles .= $addendum;
|
|
|
|
}
|
Add deprecated headers support to syncqt
When renaming classes, or when moving classes from one module to
another, it's useful to have a simple way of supporting the old
API/location for some time. To this end, syncqt shall now recognize
a "deprecatedheaders" section in sync.profile. It looks like this:
%deprecatedheaders = (
"QtDeclarative" => {
"qquickcanvas.h" => "QtQuick2/qquickcanvas.h",
"qquickitem.h" => "QtQuick2/qquickitem.h",
"QQuickCanvas" => "QtQuick2/QQuickCanvas",
"QQuickItem" => "QtQuick2/QQuickItem",
}
);
In the above example, syncqt would generate a header called
qquickcanvas.h for the QtDeclarative module; when included, this
header will issue a warning and include <QtQuick2/qquickcanvas.h>.
And so on, for the other entries.
Deprecated headers are installed along with the module's normal
headers.
Change-Id: Ie2518b42275c2b2ff44216f07d376ccf5be6dc45
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-25 13:53:39 +00:00
|
|
|
}
|
|
|
|
if ($verbose_level < 3) {
|
|
|
|
print " }\n" unless ($first);
|
|
|
|
}
|
|
|
|
|
2012-07-17 14:09:41 +00:00
|
|
|
# module version header
|
|
|
|
my $vheader = "$out_basedir/include/$lib/".lc($lib)."version.h";
|
|
|
|
my $VHeader = "$out_basedir/include/$lib/${lib}Version";
|
|
|
|
syncHeader($lib, $VHeader, $vheader, 0);
|
|
|
|
$pri_install_files .= fixPaths($vheader, $dir) . " ";
|
|
|
|
$pri_install_classes .= fixPaths($VHeader, $dir) . " ";
|
2013-05-17 17:53:25 +00:00
|
|
|
my @versions = split(/\./, $module_version);
|
|
|
|
my $modulehexstring = sprintf("0x%02X%02X%02X", $versions[0], $versions[1], $versions[2]);
|
|
|
|
my $vhdrcont =
|
|
|
|
"/* This file was generated by syncqt. */\n".
|
|
|
|
"#ifndef QT_".uc($lib)."_VERSION_H\n".
|
|
|
|
"#define QT_".uc($lib)."_VERSION_H\n".
|
|
|
|
"\n".
|
|
|
|
"#define ".uc($lib)."_VERSION_STR \"".$module_version."\"\n".
|
|
|
|
"\n".
|
|
|
|
"#define ".uc($lib)."_VERSION ".$modulehexstring."\n".
|
|
|
|
"\n".
|
|
|
|
"#endif // QT_".uc($lib)."_VERSION_H\n";
|
|
|
|
writeFile($vheader, $vhdrcont, $lib, "version header");
|
2012-07-17 14:09:41 +00:00
|
|
|
|
2013-05-28 18:57:07 +00:00
|
|
|
my $master_include = "$out_basedir/include/$lib/$lib";
|
|
|
|
$pri_install_files .= fixPaths($master_include, $dir) . " ";
|
|
|
|
writeFile($master_include, $master_contents, $lib, "master header");
|
2013-06-07 13:55:30 +00:00
|
|
|
}
|
2013-05-28 18:57:07 +00:00
|
|
|
|
2013-06-07 13:55:30 +00:00
|
|
|
unless ($showonly || $minimal) {
|
2011-04-27 10:05:43 +00:00
|
|
|
#handle the headers.pri for each module
|
|
|
|
my $headers_pri_contents = "";
|
|
|
|
$headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
|
2017-10-23 13:42:52 +00:00
|
|
|
$headers_pri_contents .= "SYNCQT.INJECTED_HEADER_FILES = $pri_install_ifiles\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
$headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
|
|
|
|
$headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
|
2016-10-10 17:29:54 +00:00
|
|
|
$headers_pri_contents .= "SYNCQT.INJECTED_PRIVATE_HEADER_FILES = $pri_install_ipfiles\n";
|
2012-05-08 10:50:50 +00:00
|
|
|
$headers_pri_contents .= "SYNCQT.QPA_HEADER_FILES = $pri_install_qpafiles\n";
|
2012-12-22 21:12:02 +00:00
|
|
|
$headers_pri_contents .= "SYNCQT.CLEAN_HEADER_FILES = $pri_clean_files\n";
|
2014-02-03 21:22:14 +00:00
|
|
|
$headers_pri_contents .= "SYNCQT.INJECTIONS = $pri_injections\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
my $headers_pri_file = "$out_basedir/include/$lib/headers.pri";
|
2013-05-28 18:28:54 +00:00
|
|
|
writeFile($headers_pri_file, $headers_pri_contents, $lib, "headers.pri file");
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit 0;
|