summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit38be0d13830efd2d98281c645c3a60afe05ffece (patch)
tree6ea73f3ec77f7d153333779883e8120f82820abe /bin
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'bin')
-rwxr-xr-xbin/createpackage3
-rwxr-xr-xbin/createpackage.bat44
-rwxr-xr-xbin/createpackage.pl433
-rwxr-xr-xbin/elf2e32_qtwrapper3
-rw-r--r--bin/elf2e32_qtwrapper.bat3
-rwxr-xr-xbin/elf2e32_qtwrapper.pl325
-rwxr-xr-xbin/findtr189
-rwxr-xr-xbin/patch_capabilities3
-rw-r--r--bin/patch_capabilities.bat1
-rwxr-xr-xbin/patch_capabilities.pl398
-rwxr-xr-xbin/setcepaths.bat163
-rwxr-xr-xbin/syncqt1121
-rwxr-xr-xbin/syncqt.bat42
13 files changed, 2728 insertions, 0 deletions
diff --git a/bin/createpackage b/bin/createpackage
new file mode 100755
index 0000000000..fdd4eebdea
--- /dev/null
+++ b/bin/createpackage
@@ -0,0 +1,3 @@
+#!/bin/sh
+scriptpath=`dirname $0`
+perl $scriptpath/createpackage.pl "$@"
diff --git a/bin/createpackage.bat b/bin/createpackage.bat
new file mode 100755
index 0000000000..a946278073
--- /dev/null
+++ b/bin/createpackage.bat
@@ -0,0 +1,44 @@
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+:: All rights reserved.
+:: Contact: Nokia Corporation (qt-info@nokia.com)
+::
+:: This file is part of the test suite of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL$
+:: No Commercial Usage
+:: This file contains pre-release code and may not be distributed.
+:: You may use this file in accordance with the terms and conditions
+:: contained in the Technology Preview License Agreement accompanying
+:: this package.
+::
+:: GNU Lesser General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU Lesser
+:: General Public License version 2.1 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 2.1 requirements
+:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+::
+:: In addition, as a special exception, Nokia gives you certain additional
+:: rights. These rights are described in the Nokia Qt LGPL Exception
+:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+::
+:: If you have questions regarding the use of this file, please contact
+:: Nokia at qt-info@nokia.com.
+::
+::
+::
+::
+::
+::
+::
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+@echo off
+set scriptpath=%~dp0
+perl %scriptpath%createpackage.pl %*
diff --git a/bin/createpackage.pl b/bin/createpackage.pl
new file mode 100755
index 0000000000..b7457e1c0b
--- /dev/null
+++ b/bin/createpackage.pl
@@ -0,0 +1,433 @@
+#!/usr/bin/perl
+#############################################################################
+##
+## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the S60 port of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## No Commercial Usage
+## This file contains pre-release code and may not be distributed.
+## You may use this file in accordance with the terms and conditions
+## contained in the Technology Preview License Agreement accompanying
+## this package.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain additional
+## rights. These rights are described in the Nokia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+##
+##
+##
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+############################################################################################
+#
+# Convenience script for creating signed packages you can install on your phone.
+#
+############################################################################################
+
+use strict;
+
+# use a command-line parsing module
+use Getopt::Long;
+# Use file name parsing module
+use File::Basename;
+# Use File::Spec services mainly rel2abs
+use File::Spec;
+# Use File::Path - to make stub sis target directory
+use File::Path;
+# use CWD abs_bath, which is exported only on request
+use Cwd 'abs_path';
+use File::Copy;
+
+sub Usage() {
+ print <<ENDUSAGESTRING;
+
+==============================================================================================
+Convenience script for creating signed packages you can install on your phone.
+
+Usage: createpackage.pl [options] templatepkg [target]-[platform] [certificate key [passphrase]]
+
+Where supported options are as follows:
+ [-i|install] = Install the package right away using PC suite.
+ [-p|preprocess] = Only preprocess the template .pkg file.
+ [-c|certfile <file>] = The file containing certificate information for signing.
+ The file can have several certificates, each specified in
+ separate line. The certificate, key and passphrase in line
+ must be ';' separated. Lines starting with '#' are treated
+ as a comments. Also empty lines are ignored. The paths in
+ <file> can be absolute or relative to <file>.
+ [-u|unsigned] = Preserves the unsigned package.
+ [-o|only-unsigned] = Creates only unsigned package.
+ [-s|stub] = Generates stub sis for ROM.
+ [-n|sisname <name>] = Specifies the final sis name.
+ [-g|gcce-is-armv5] = Convert gcce platform to armv5.
+ [-d|dont-patch] = Skip automatic patching of capabilities and pkg file if default certificate
+ is used. Instead non-self-signable capabilities just cause warnings.
+ [-t|tmp-dir <path>] = Specifies temporary directory to be used for package creation.
+ Defaults to 'createpackage_tmp' under same directory as templatepkg.
+Where parameters are as follows:
+ templatepkg = Name of .pkg file template
+ target = Either debug or release
+ platform = One of the supported platform
+ winscw | gcce | armv5 | armv6 | armv7
+ Note that when packaging binaries built using gcce and symbian-sbsv2
+ mkspec, armv5 must be used for platform instead of gcce.
+ certificate = The certificate file used for signing
+ key = The certificate's private key file
+ passphrase = The passphrase of the certificate's private key file
+
+Example:
+ createpackage.pl fluidlauncher_template.pkg release-armv5
+
+Example with certfile:
+ createpackage.pl -c=mycerts.txt fluidlauncher_template.pkg release-armv5
+
+ Content of 'mycerts.txt' must be something like this:
+ # This is comment line, also the empty lines are ignored
+ rd.cer;rd-key.pem
+ .\\cert\\mycert.cer;.\\cert\\mykey.key;yourpassword
+ X:\\QtS60\\s60installs\\selfsigned.cer;X:\\QtS60\\s60installs\\selfsigned.key
+
+If no certificate and key files are provided, either a RnD certificate or
+a self-signed certificate from QtDir\\src\\s60installs directory is used.
+In the latter case the resulting package will also be automatically patched
+using patch_capabilities.pl script, which makes it unsuitable for distribution.
+Always specify certificates explicitly if you wish to distribute your package.
+
+==============================================================================================
+
+ENDUSAGESTRING
+
+ exit();
+}
+
+# Read given options
+my $install = "";
+my $preprocessonly = "";
+my $certfile = "";
+my $preserveUnsigned = "";
+my $stub = "";
+my $signed_sis_name = "";
+my $onlyUnsigned = "";
+my $convertGcce = "";
+my $dontPatchCaps = "";
+my $tempPackageDir = "";
+
+unless (GetOptions('i|install' => \$install,
+ 'p|preprocess' => \$preprocessonly,
+ 'c|certfile=s' => \$certfile,
+ 'u|unsigned' => \$preserveUnsigned,
+ 'o|only-unsigned' => \$onlyUnsigned,
+ 's|stub' => \$stub,
+ 'n|sisname=s' => \$signed_sis_name,
+ 'g|gcce-is-armv5' => \$convertGcce,
+ 'd|dont-patch' => \$dontPatchCaps,
+ 't|tmp-dir=s' => \$tempPackageDir,)) {
+ Usage();
+}
+
+my $epocroot = $ENV{EPOCROOT};
+my $epocToolsDir = "";
+if ($epocroot ne "") {
+ $epocroot =~ s,\\,/,g;
+ if ($epocroot =~ m,[^/]$,) {
+ $epocroot = $epocroot."/";
+ }
+ $epocToolsDir = "${epocroot}epoc32/tools/";
+}
+
+my $certfilepath = abs_path(dirname($certfile));
+
+# Read params to variables
+my $templatepkg = $ARGV[0];
+my $targetplatform = lc $ARGV[1];
+
+if ($targetplatform eq "") {
+ $targetplatform = "-";
+}
+
+my @tmpvalues = split('-', $targetplatform);
+my $target;
+$target = $tmpvalues[0] or $target = "";
+my $platform;
+$platform = $tmpvalues[1] or $platform = "";
+
+if ($platform =~ m/^gcce$/i) {
+ if (($convertGcce ne "")) {
+ $platform = "armv5";
+ } elsif ($ENV{SBS_HOME}) {
+ # Print a informative note in case suspected misuse is detected.
+ print "\nNote: You should use armv5 as platform or specify -g parameter to convert platform\n";
+ print " when packaging gcce binaries built using symbian-sbsv2 mkspec.\n\n";
+ }
+}
+
+# Convert visual target to real target (debug->udeb and release->urel)
+$target =~ s/debug/udeb/i;
+$target =~ s/release/urel/i;
+
+my $certificate;
+$certificate = $ARGV[2] or $certificate = "";
+my $key;
+$key = $ARGV[3] or $key = "";
+my $passphrase;
+$passphrase = $ARGV[4] or $passphrase = "";
+
+if ($tempPackageDir eq "") {
+ my ($templateVolume, $templatePath, $templateFileName) = File::Spec->splitpath($templatepkg);
+ $tempPackageDir = File::Spec->catpath($templateVolume, $templatePath."createpackage_tmp", "");
+}
+
+mkpath($tempPackageDir);
+
+# Generate output pkg basename (i.e. file name without extension)
+my $pkgoutputbasename = $templatepkg;
+$pkgoutputbasename =~ s/_template/_$targetplatform/g;
+$pkgoutputbasename =~ s/_installer\.pkg/_installer___temp\.pkg/g;
+$pkgoutputbasename =~ s/\.pkg//g;
+
+# Store output file names to variables
+my ($dummy1, $dummy2, $pkgoutput) = File::Spec->splitpath($pkgoutputbasename.".pkg");
+$pkgoutput = $tempPackageDir."/".$pkgoutput;
+my $sisoutputbasename;
+if ($signed_sis_name eq "") {
+ $sisoutputbasename = $pkgoutputbasename;
+ $sisoutputbasename =~ s/_$targetplatform//g;
+ $sisoutputbasename =~ s/_installer___temp/_installer/g;
+ $signed_sis_name = $sisoutputbasename.".sis";
+} else {
+ $sisoutputbasename = $signed_sis_name;
+ if ($sisoutputbasename =~ m/(\.sis$|\.sisx$)/i) {
+ $sisoutputbasename =~ s/$1//i;
+ } else {
+ $signed_sis_name = $signed_sis_name.".sis";
+ }
+}
+
+my $installer_unsigned_app_sis_name = "";
+my $installer_app_sis_name = "";
+
+if ($templatepkg =~ m/_installer\.pkg$/i && $onlyUnsigned) {
+ $installer_unsigned_app_sis_name = $templatepkg;
+ $installer_unsigned_app_sis_name =~ s/_installer.pkg$/_unsigned.sis/i;
+ $installer_app_sis_name = $installer_unsigned_app_sis_name;
+ $installer_app_sis_name =~ s/_unsigned.sis$/.sis/;
+}
+
+my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis";
+my $stub_sis_name = $sisoutputbasename.".sis";
+
+# Store some utility variables
+my $scriptpath = dirname(__FILE__);
+my $certtext = $certificate;
+# certificates are one step up in hierarchy
+my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs/");
+
+# Check some pre-conditions and print error messages if needed.
+unless (length($templatepkg)) {
+ print "\nERROR: Template PKG filename is not defined!\n";
+ Usage();
+}
+
+# Check template exist
+stat($templatepkg);
+unless( -e _ ) {
+ print "\nERROR: Package description file '$templatepkg' does not exist!\n";
+ Usage();
+}
+
+# Check certifcate preconditions and set default certificate variables if needed
+if (length($certificate)) {
+ unless(length($key)) {
+ print "\nERROR: Custom certificate key file parameter missing.!\n";
+ Usage();
+ }
+} else {
+ #If no certificate is given, check default options
+ $certtext = "RnD";
+ $certificate = File::Spec->catfile($certpath, "rd.cer");
+ $key = File::Spec->catfile($certpath, "rd-key.pem");
+
+ stat($certificate);
+ unless( -e _ ) {
+ $certtext = "Self Signed";
+ $certificate = File::Spec->catfile($certpath, "selfsigned.cer");
+ $key = File::Spec->catfile($certpath, "selfsigned.key");
+ }
+}
+
+# Read the certificates from file to two dimensional array
+my @certificates;
+if (length($certfile)) {
+ open CERTFILE, "<$certfile" or die $!;
+ while(<CERTFILE>){
+ s/#.*//; # ignore comments by erasing them
+ next if /^(\s)*$/; # skip blank lines
+ chomp; # remove trailing newline characters
+ my @certinfo = split(';', $_); # split row to certinfo
+
+ # Trim spaces
+ for(@certinfo) {
+ s/^\s+//;
+ s/\s+$//;
+ }
+
+ # Do some validation
+ unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) {
+ print "\nERROR: $certfile line '$_' does not contain valid information!\n";
+ Usage();
+ }
+
+ push @certificates, [@certinfo]; # push data to two dimensional array
+ }
+}
+
+# Remove any existing .sis packages
+unlink $unsigned_sis_name;
+if (!$onlyUnsigned) {
+ unlink $signed_sis_name;
+}
+unlink $pkgoutput;
+
+# Preprocess PKG
+
+local $/;
+# read template file
+open( TEMPLATE, $templatepkg) or die "ERROR: '$templatepkg': $!";
+$_=<TEMPLATE>;
+close (TEMPLATE);
+
+# If the pkg file does not contain macros, there is no need for platform or target.
+if (m/\$\(PLATFORM\)/) {
+ unless (length($platform) && length($target)) {
+ print "\nERROR: Platform or target is not defined!\n";
+ Usage();
+ }
+}
+
+# replace the PKG variables
+s/\$\(PLATFORM\)/$platform/gm;
+s/\$\(TARGET\)/$target/gm;
+
+if ($installer_unsigned_app_sis_name ne "") {
+ s/$installer_app_sis_name\"/$installer_unsigned_app_sis_name\"/;
+}
+
+#write the output
+open( OUTPUT, ">$pkgoutput" ) or die "ERROR: '$pkgoutput' $!";
+print OUTPUT $_;
+close OUTPUT;
+
+if ($preprocessonly) {
+ # Copy preprocessed file from tmp dir to pkg file dir
+ my ($templateVolume, $templatePath, $templateFileName) = File::Spec->splitpath($templatepkg);
+ my ($dummy1, $dummy2, $copyFileName) = File::Spec->splitpath($pkgoutput);
+ my $copyTarget = File::Spec->catpath($templateVolume, $templatePath, $copyFileName);
+ copy($pkgoutput, $copyTarget) or die "Preprocessed pkg file '$pkgoutput' cannot be copied.";
+ exit;
+}
+
+if($stub) {
+ if(!($epocroot)) { die("ERROR: EPOCROOT must be set to create stub sis files"); }
+ my $systeminstall = "${epocroot}epoc32/data/z/system/install";
+ mkpath($systeminstall);
+ my $stub_sis_name = $systeminstall."/".$stub_sis_name;
+ # Create stub SIS.
+ system ("${epocToolsDir}makesis -s $pkgoutput $stub_sis_name");
+} else {
+ if ($certtext eq "Self Signed"
+ && !@certificates
+ && $templatepkg !~ m/_installer\.pkg$/i
+ && !$onlyUnsigned) {
+ my $patch_capabilities = File::Spec->catfile(dirname($0), "patch_capabilities");
+ if ($dontPatchCaps) {
+ system ("$patch_capabilities -c $pkgoutput") and print ("Warning: Package check for self-signing viability failed. Installing the package on a device will most likely fail!\n\n");
+ } else {
+ print("Auto-patching self-signed package.\n");
+ system ("$patch_capabilities -t $tempPackageDir $pkgoutput") and die ("ERROR: Automatic patching failed");
+ }
+ }
+
+ # Create SIS.
+ # The 'and' is because system uses 0 to indicate success.
+ system ("${epocToolsDir}makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed");
+
+ print("\n");
+
+ my $targetInsert = "";
+ if ($targetplatform ne "-") {
+ $targetInsert = " for $targetplatform";
+ }
+
+ if ($onlyUnsigned) {
+ stat($unsigned_sis_name);
+ if( -e _ ) {
+ print ("Successfully created unsigned package ${unsigned_sis_name}${targetInsert}!\n");
+ } else {
+ print ("\nUnsigned package creation failed!\n");
+ }
+
+ print ("\n");
+ exit;
+ }
+
+ # Sign SIS with certificate info given as an argument.
+ my $relcert = File::Spec->abs2rel($certificate);
+ my $relkey = File::Spec->abs2rel($key);
+ # The 'and' is because system uses 0 to indicate success.
+ system ("${epocToolsDir}signsis $unsigned_sis_name $signed_sis_name $relcert $relkey $passphrase") and die ("ERROR: signsis failed");
+
+ # Check if creating signed SIS Succeeded
+ stat($signed_sis_name);
+ if( -e _ ) {
+ print ("Successfully created signed package ${signed_sis_name}${targetInsert} using certificate: $certtext!\n");
+
+ # Sign with additional certificates & keys
+ for my $row ( @certificates ) {
+ # Get certificate absolute file names, relative paths are relative to certfilepath
+ my $relcert = File::Spec->abs2rel(File::Spec->rel2abs( $row->[0], $certfilepath));
+ my $relkey = File::Spec->abs2rel(File::Spec->rel2abs( $row->[1], $certfilepath));
+
+ system ("${epocToolsDir}signsis $signed_sis_name $signed_sis_name $relcert $relkey $row->[2]");
+ print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n");
+ }
+
+ # remove temporary unsigned sis
+ if (!$preserveUnsigned) {
+ unlink $unsigned_sis_name;
+ }
+
+ # Install the sis if requested
+ if ($install) {
+ print ("\nInstalling $signed_sis_name...\n");
+ system ("$signed_sis_name");
+ }
+ } else {
+ # Lets leave the generated PKG for problem solving purposes
+ print ("\nSIS creation failed!\n");
+ }
+ print ("\n");
+}
+
+#end of file
diff --git a/bin/elf2e32_qtwrapper b/bin/elf2e32_qtwrapper
new file mode 100755
index 0000000000..a3a4065f30
--- /dev/null
+++ b/bin/elf2e32_qtwrapper
@@ -0,0 +1,3 @@
+#!/bin/sh
+scriptpath=`dirname $0`
+perl $scriptpath/elf2e32_qtwrapper.pl "$@"
diff --git a/bin/elf2e32_qtwrapper.bat b/bin/elf2e32_qtwrapper.bat
new file mode 100644
index 0000000000..52910df007
--- /dev/null
+++ b/bin/elf2e32_qtwrapper.bat
@@ -0,0 +1,3 @@
+@echo off
+set scriptpath=%~dp0
+perl %scriptpath%elf2e32_qtwrapper.pl %*
diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl
new file mode 100755
index 0000000000..24b910b868
--- /dev/null
+++ b/bin/elf2e32_qtwrapper.pl
@@ -0,0 +1,325 @@
+#!/usr/bin/perl -w
+#############################################################################
+##
+## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the utilities of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## No Commercial Usage
+## This file contains pre-release code and may not be distributed.
+## You may use this file in accordance with the terms and conditions
+## contained in the Technology Preview License Agreement accompanying
+## this package.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain additional
+## rights. These rights are described in the Nokia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+##
+##
+##
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+# A script to get around some shortcomings in elf2e32, namely:
+# - Returning 0 even when there are errors.
+# - Excluding symbols from the dso file even when they are present in the ELF file.
+# - Including symbols in the the dso file even when they are not present in the ELF file.
+# - Overwriting the old dso file even when there are no changes (increases build time).
+
+use File::Copy;
+
+my @args = ();
+my @definput;
+my @defoutput;
+my @dso;
+my @tmpdso;
+foreach (@ARGV) {
+ if (/^--definput/o) {
+ @definput = split('=', $_);
+ } elsif (/^--defoutput/o) {
+ @defoutput = split('=', $_);
+ } elsif (/^--dso/o) {
+ @dso = split('=', $_);
+ } elsif (/^--tmpdso/o) {
+ @tmpdso = split('=', $_);
+ $tmpdso[0] = "--dso";
+ } else {
+ push(@args, $_);
+ }
+}
+
+@definput = () if (!@definput || ! -e $definput[1]);
+
+if (@dso && !@tmpdso || !@dso && @tmpdso) {
+ print("--dso and --tmpdso must be used together.\n");
+ exit 1;
+}
+
+my $buildingLibrary = (@defoutput && @dso) ? 1 : 0;
+
+my $fixupFile = "";
+my $runCount = 0;
+my $returnCode = 0;
+
+# For debugging. Make it nonzero to give verbose output.
+my $debugScript = 1;
+my @usedDefFiles;
+sub recordDefFile {
+ return if (!$debugScript);
+
+ my ($msg, $file) = @_;
+ my $content = "$msg, $file:\n";
+ my $defFileFd;
+ if (!open($defFileFd, "< $file")) {
+ print("Warning: Could not open $file (for debug analysis)\n");
+ return;
+ }
+ while (<$defFileFd>) {
+ $content .= $_;
+ }
+
+ push(@usedDefFiles, $content);
+}
+sub printRecordedDefFiles {
+ return if (!$debugScript);
+
+ foreach (@usedDefFiles) {
+ print ("$_\n");
+ }
+}
+
+sub missingSymbolMismatch
+{
+ my $missingSymbolSum = $_[0];
+
+ printRecordedDefFiles;
+
+ print("Bug in the native elf2e32 tool: Number of missing symbols does not\n");
+ print("match number of removed symbols in the output DEF file.\n\n");
+
+ print("Original elf2e32 output:\n");
+ print(" $missingSymbolSum Frozen Export\(s\) missing from the ELF file\n\n");
+
+ print("However $defoutput[1] contains more missing entries than that.\n\n");
+
+ print("This needs to be fixed manually in the DEF file.\n");
+ exit(2);
+}
+
+if ($debugScript) {
+ print("PATH: $ENV{PATH}\n");
+ print("EPOCROOT: $ENV{EPOCROOT}\n");
+}
+
+while (1) {
+ if (++$runCount > 2) {
+ printRecordedDefFiles if ($debugScript);
+ print("Internal error in $0, link succeeded, but exports may be wrong.\n");
+ last;
+ }
+
+ my $elf2e32Pipe;
+ my $elf2e32Cmd = "elf2e32 @args"
+ . " " . join("=", @definput)
+ . " " . join("=", @defoutput)
+ . " " . join("=", @tmpdso);
+ open($elf2e32Pipe, "$elf2e32Cmd 2>&1 |") or die ("Could not run elf2e32");
+
+ my %fixupSymbols;
+ my $foundBrokenSymbols = 0;
+ my $missingSymbolSum = 0;
+ my $missingSymbolCount = 0;
+ my $errors = 0;
+ while (<$elf2e32Pipe>) {
+ print;
+ if (/Error:/io) {
+ $errors = 1;
+ } elsif (/symbol ([a-z0-9_]+) absent in the DEF file, but present in the ELF file/io) {
+ $fixupSymbols{$1} = 1;
+ $foundBrokenSymbols = 1;
+ } elsif (/([0-9]+) Frozen Export\(s\) missing from the ELF file/io) {
+ $missingSymbolSum = $1;
+ $foundBrokenSymbols = 1;
+ }
+ }
+ close($elf2e32Pipe);
+
+ if ($debugScript) {
+ recordDefFile("Run no $runCount, elf2e32 DEF file input", "$definput[1]");
+ recordDefFile("Run no $runCount, elf2e32 DEF file output", "$defoutput[1]");
+ }
+
+ if ($errors) {
+ $returnCode = 1;
+ last;
+ }
+
+ if ($buildingLibrary && $runCount == 1) {
+ my $tmpDefFile;
+ my $newDefFile;
+ my $origDefFile;
+ my $savedNewDefFileLine = "";
+ if ($definput[1]) {
+ open($origDefFile, "< $definput[1]") or die("Could not open $definput[1]");
+ }
+ open($newDefFile, "< $defoutput[1]") or die("Could not open $defoutput[1]");
+ open($tmpDefFile, "> $defoutput[1].tmp") or die("Could not open $defoutput[1].tmp");
+ print($tmpDefFile "EXPORTS\n") or die("Could not write to temporary DEF file: $!");
+ $fixupFile = "$defoutput[1].tmp";
+ while (1) {
+ my $origDefLine;
+ my $origSym;
+ my $origOrdinal;
+ my $origExtraData;
+ my $newDefLine;
+ my $newSym;
+ my $newOrdinal;
+ my $newExtraData;
+ my $defLine;
+ my $sym;
+ my $ordinal;
+ my $extraData;
+ if ($definput[1]) {
+ # Read from original def file, and skip non-symbol lines
+ while (1) {
+ $origDefLine = <$origDefFile>;
+ if (defined($origDefLine)) {
+ $origDefLine =~ s/[\n\r]//;
+ if ($origDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i) {
+ $origSym = $1;
+ $origOrdinal = $2;
+ $origExtraData = $3;
+ last;
+ }
+ } else {
+ last;
+ }
+ }
+ }
+
+ if ($savedNewDefFileLine) {
+ # This happens if the new def file was missing an entry.
+ $newDefLine = $savedNewDefFileLine;
+ $newDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i or die("$0: Shouldn't happen");
+ $newSym = $1;
+ $newOrdinal = $2;
+ $newExtraData = $3;
+ } else {
+ # Read from new def file, and skip non-symbol lines
+ while (1) {
+ $newDefLine = <$newDefFile>;
+ if (defined($newDefLine)) {
+ $newDefLine =~ s/[\n\r]//;
+ if ($newDefLine =~ /([a-z0-9_]+) +\@ *([0-9]+) (.*)/i) {
+ $newSym = $1;
+ $newOrdinal = $2;
+ $newExtraData = $3;
+ last;
+ }
+ } else {
+ last;
+ }
+ }
+ }
+ $savedNewDefFileLine = "";
+ last if (!defined($origDefLine) && !defined($newDefLine));
+
+ if (defined($origOrdinal) && (!defined($newOrdinal) || $origOrdinal != $newOrdinal)) {
+ # If the symbol is missing from the new def file, use the original symbol.
+ $savedNewDefFileLine = $newDefLine;
+ $defLine = $origDefLine;
+ $sym = $origSym;
+ $ordinal = $origOrdinal;
+ $extraData = $origExtraData;
+ } else {
+ $defLine = $newDefLine;
+ $sym = $newSym;
+ $ordinal = $newOrdinal;
+ if ($newExtraData =~ /ABSENT/) {
+ # Special case to keep "DATA [0-9]+" data in absent entries.
+ $extraData = $origExtraData;
+ } else {
+ $extraData = $newExtraData;
+ }
+ }
+ if (exists($fixupSymbols{$sym})) {
+ # Fix symbols that have returned after first being marked ABSENT.
+ $extraData =~ s/ ABSENT//;
+ } elsif ($defLine =~ s/; MISSING://) {
+ # Auto-absent symbols.
+ $extraData .= " ABSENT";
+ if (++$missingSymbolCount > $missingSymbolSum) {
+ missingSymbolMismatch($missingSymbolSum);
+ }
+ }
+ print($tmpDefFile "\t$sym \@ $ordinal $extraData\n") or die("Could not write to temporary DEF file: $!");
+ }
+ print($tmpDefFile "\n") or die("Could not write to temporary DEF file: $!");
+ close($origDefFile) if ($definput[1]);
+ close($newDefFile);
+ close($tmpDefFile);
+
+ $definput[1] = "$defoutput[1].tmp";
+
+ }
+ if (!$foundBrokenSymbols || $errors) {
+ last;
+ }
+
+ print("Rerunning elf2e32 due to DEF file / ELF file mismatch\n");
+};
+
+if ($fixupFile) {
+ unlink($defoutput[1]);
+ move($fixupFile, $defoutput[1]);
+}
+
+exit $returnCode if ($returnCode != 0);
+
+if ($buildingLibrary) {
+ my $differenceFound = 0;
+
+ if (-e $dso[1]) {
+ my $dsoFile;
+ my $tmpdsoFile;
+ my $dsoBuf;
+ my $tmpdsoBuf;
+ open($dsoFile, "< $dso[1]") or die("Could not open $dso[1]");
+ open($tmpdsoFile, "< $tmpdso[1]") or die("Could not open $tmpdso[1]");
+ binmode($dsoFile);
+ binmode($tmpdsoFile);
+ while(read($dsoFile, $dsoBuf, 4096) && read($tmpdsoFile, $tmpdsoBuf, 4096)) {
+ if ($dsoBuf ne $tmpdsoBuf) {
+ $differenceFound = 1;
+ }
+ }
+ close($tmpdsoFile);
+ close($dsoFile);
+ } else {
+ $differenceFound = 1;
+ }
+
+ if ($differenceFound) {
+ copy($tmpdso[1], $dso[1]) or die("Could not copy $tmpdso[1] to $dso[1]: $!");
+ }
+}
diff --git a/bin/findtr b/bin/findtr
new file mode 100755
index 0000000000..7df332522c
--- /dev/null
+++ b/bin/findtr
@@ -0,0 +1,189 @@
+#!/usr/bin/perl -w
+# vi:wrap:
+
+# See Qt I18N documentation for usage information.
+
+use POSIX qw(strftime);
+
+$projectid='PROJECT VERSION';
+$datetime = strftime "%Y-%m-%d %X %Z", localtime;
+$charset='iso-8859-1';
+$translator='FULLNAME <EMAIL@ADDRESS>';
+$revision_date='YYYY-MM-DD';
+
+$real_mark = "tr";
+$noop_mark = "QT_TR_NOOP";
+$scoped_mark = "qApp->translate";
+$noop_scoped_mark = "QT_TRANSLATE_NOOP";
+
+$header=
+'# This is a Qt message file in .po format. Each msgid starts with
+# a scope. This scope should *NOT* be translated - eg. translating
+# from French to English, "Foo::Bar" would be translated to "Pub",
+# not "Foo::Pub".
+msgid ""
+msgstr ""
+"Project-Id-Version: '.$projectid.'\n"
+"POT-Creation-Date: '.$datetime.'\n"
+"PO-Revision-Date: '.$revision_date.'\n"
+"Last-Translator: '.$translator.'\n"
+"Content-Type: text/plain; charset='.$charset.'\n"
+
+';
+
+
+
+
+$scope = "";
+
+if ( $#ARGV < 0 ) {
+ print STDERR "Usage: findtr sourcefile ... >project.po\n";
+ exit 1;
+}
+
+
+sub outmsg {
+ my ($file, $line, $scope, $msgid) = @_;
+ # unesc
+ $msgid =~ s/$esc:$esc:$esc/::/gs;
+ $msgid =~ s|$esc/$esc/$esc|//|gs;
+
+ # Remove blank lines
+ $msgid =~ s/\n\n+/\n/gs;
+ $msgid = "\"\"\n$msgid" if $msgid =~ /\n/s;
+ print "#: $file:$line\n";
+ $msgid =~ s/^"//; #"emacs bug
+ print "msgid \"${scope}::$msgid\n";
+ #print "msgstr \"$msgid\n";
+ print "msgstr \"\"\n";
+ print "\n";
+}
+
+sub justlines {
+ my $l = @_;
+ $l =~ tr|\n||dc;
+ return $l;
+}
+
+print $header;
+
+
+foreach $file ( @ARGV ) {
+ next unless open( I, "< $file" );
+
+ $source = join( "", <I> );
+
+ # Find esc. Avoid bad case 1/// -> 1/1/1/1 -> ///1
+ $esc = 1;
+ while ( $source =~ m!(?:$esc/$esc/$esc)|(?:$esc///)
+ |(?:$esc:$esc:$esc)|(?:$esc:\:\:)! ) {
+ $esc++;
+ }
+
+ # Hide quoted :: in practically all strings
+ $source =~ s/\"([^"\n]*)::([^"\n]*)\"/\"$1$esc:$esc:$esc$2\"/g;
+
+ # Hide quoted // in practically all strings
+ $source =~ s|\"([^"\n]*)//([^"\n]*)\"|\"$1$esc/$esc/$esc$2\"|g;
+
+
+ # strip comments -- does not handle "/*" in strings
+ while( $source =~ s|/\*(.*?)\*/|justlines($1)|ges ) { }
+ while( $source =~ s|//(.*?)\n|\n|g ) { }
+
+ while( $source =~ /
+ (?:
+ # Some doublequotes are "escaped" to help vim syntax highlight
+
+ # $1 = scope; $2 = parameters etc.
+ (?:
+ # Scoped function name ($1 is scope).
+ (\w+)::(?:\w+)
+ \s*
+ # Parameters etc up to open-curly - no semicolons
+ \(([^();]*)\)
+ \s*
+ (?:\{|:)
+ )
+ |
+ # $3 - one-argument msgid
+ (?:\b
+ # One of the marks
+ (?:$real_mark|$noop_mark)
+ \s*
+ # The parameter
+ \(\s*((?:"(?:[^"]|[^\\]\\")*"\s*)+)\)
+ )
+ |
+ # $4,$5 - two-argument msgid
+ (?:\b
+ # One of the scoped marks
+ (?:$scoped_mark|$noop_scoped_mark)
+ \s*
+ # The parameters
+ \(
+ # The scope parameter
+ \s*"([^\"]*)"
+ \s*,\s*
+ # The msgid parameter
+ \s*((?:\"(?:[^"]|[^\\]\\")*"\s*)+) #"emacs
+ \)
+ )
+ |
+ # $6,$7 - scoped one-argument msgid
+ (?:\b
+ # The scope
+ (\w+)::
+ # One of the marks
+ (?:$real_mark)
+ \s*
+ # The parameter
+ \(\s*((?:"(?:[^"]|[^\\]\\")*"\s*)+)\)
+ )
+ )/gsx )
+ {
+ @lines = split /^/m, "$`";
+ $line = @lines;
+ if ( defined( $1 ) ) {
+ if ( $scope ne $1 ) {
+ $sc=$1;
+ $etc=$2;
+ # remove strings
+ $etc =~ s/"(?:[^"]|[^\\]\\")"//g;
+ # count ( and )
+ @open = split /\(/m, $etc;
+ @close = split /\)/m, $etc;
+ if ( $#open == $#close ) {
+ $scope = $sc;
+ }
+ }
+ next;
+ }
+
+ if ( defined( $3 ) ) {
+ $this_scope = $scope;
+ $msgid = $3;
+ } elsif ( defined( $4 ) ) {
+ $this_scope = $4;
+ $msgid = $5;
+ } elsif ( defined( $6 ) ) {
+ $this_scope = $6;
+ $msgid = $7;
+ } else {
+ next;
+ }
+
+ $msgid =~ s/^\s*//;
+ $msgid =~ s/\s*$//;
+
+ # Might still be non-unique eg. tr("A" "B") vs. tr("A" "B").
+
+ $location{"${this_scope}::${msgid}"} = "$file:$line";
+ }
+}
+
+for $scoped_msgid ( sort keys %location ) {
+ ($scope,$msgid) = $scoped_msgid =~ m/([^:]*)::(.*)/s;
+ ($file,$line) = $location{$scoped_msgid} =~ m/([^:]*):(.*)/s;
+ outmsg($file,$line,$scope,$msgid);
+}
diff --git a/bin/patch_capabilities b/bin/patch_capabilities
new file mode 100755
index 0000000000..0d8962260e
--- /dev/null
+++ b/bin/patch_capabilities
@@ -0,0 +1,3 @@
+#!/bin/sh
+scriptpath=`dirname $0`
+perl $scriptpath/patch_capabilities.pl "$@"
diff --git a/bin/patch_capabilities.bat b/bin/patch_capabilities.bat
new file mode 100644
index 0000000000..6a0c4d777a
--- /dev/null
+++ b/bin/patch_capabilities.bat
@@ -0,0 +1 @@
+@perl.exe -S %~dp0patch_capabilities.pl %*
diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl
new file mode 100755
index 0000000000..40b6a175a4
--- /dev/null
+++ b/bin/patch_capabilities.pl
@@ -0,0 +1,398 @@
+#!/usr/bin/perl
+#############################################################################
+##
+## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is part of the S60 port of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## No Commercial Usage
+## This file contains pre-release code and may not be distributed.
+## You may use this file in accordance with the terms and conditions
+## contained in the Technology Preview License Agreement accompanying
+## this package.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 2.1 requirements
+## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## In addition, as a special exception, Nokia gives you certain additional
+## rights. These rights are described in the Nokia Qt LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## If you have questions regarding the use of this file, please contact
+## Nokia at qt-info@nokia.com.
+##
+##
+##
+##
+##
+##
+##
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+#######################################################################
+#
+# A script for setting binary capabilities based on .pkg file contents.
+#
+#######################################################################
+
+#
+# Note: Please make sure to output all changes done to the pkg file in a print statements
+# starting with "Patching: " to ease integration into IDEs!
+#
+
+use File::Copy;
+use File::Spec;
+use File::Path;
+
+sub Usage() {
+ print("This script can be used to set capabilities of all binaries\n");
+ print("specified for deployment in a .pkg file.\n");
+ print("If no capabilities are given, the binaries will be given the\n");
+ print("capabilities supported by self-signed certificates.\n\n");
+ print(" *** NOTE: If *_template.pkg file is given and one is using symbian-abld or\n");
+ print(" symbian-sbsv2 platform, 'target-platform' is REQUIRED. ***\n\n");
+ print(" *** NOTE2: When patching gcce binaries built with symbian-sbsv2 toolchain,\n");
+ print(" armv5 must be specified as platform.\n");
+ print("\nUsage: patch_capabilities.pl [-c|-t tmp_path] pkg_filename [target-platform [capability list]]\n");
+ print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n");
+ print("\nThe parameter -c can be used to just check if package is compatible with self-signing\n");
+ print("without actually doing any patching.\n");
+ print("Explicit capability list cannot be used with -c parameter.\n");
+ print("\nThe parameter -t can be used to specify a dir under which the temporary files are created.\n");
+ print("Defaults to 'patch_capabilities_tmp' under the path to pkg file.\n");
+ exit();
+}
+
+sub trim($) {
+ my $string = shift;
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+ return $string;
+}
+
+my $epocroot = $ENV{EPOCROOT};
+my $epocToolsDir = "";
+if ($epocroot ne "") {
+ $epocroot =~ s,\\,/,g;
+ if ($epocroot =~ m,[^/]$,) {
+ $epocroot = $epocroot."/";
+ }
+ $epocToolsDir = "${epocroot}epoc32/tools/";
+}
+
+my $nullDevice = "/dev/null";
+$nullDevice = "NUL" if ($^O =~ /MSWin/);
+
+my @capabilitiesToAllow = ("LocalServices", "NetworkServices", "ReadUserData", "UserEnvironment", "WriteUserData", "Location");
+my @capabilitiesSpecified = ();
+
+# If arguments were given to the script,
+if (@ARGV)
+{
+ # Parse the first given script argument as a ".pkg" file name.
+ my $pkgFileName = shift(@ARGV);
+ my $justCheck = "";
+ my $msgPrefix = "Patching:";
+ my $tempPatchPath = "";
+
+ if ($pkgFileName eq "-c") {
+ $pkgFileName = shift(@ARGV);
+ $justCheck = true;
+ $msgPrefix = "Warning:";
+ }
+
+ if ($pkgFileName eq "-t") {
+ $tempPatchPath = shift(@ARGV);
+ $pkgFileName = shift(@ARGV);
+ }
+
+ my ($pkgVolume, $pkgPath, $pkgPlainFileName) = File::Spec->splitpath($pkgFileName);
+ if ($tempPatchPath eq "") {
+ $tempPatchPath = File::Spec->catpath($pkgVolume, $pkgPath."patch_capabilities_tmp", "");
+ }
+
+ mkpath($tempPatchPath);
+
+ # These variables will only be set for template .pkg files.
+ my $target;
+ my $platform;
+
+ # Check if using template .pkg and set target/platform variables
+ if (($pkgFileName =~ m|_template\.pkg$|i) && -r($pkgFileName))
+ {
+ my $targetplatform;
+ my $templateFile;
+ my $templateContents;
+ open($templateFile, "< $pkgFileName") or die ("Could not open $pkgFileName");
+ $templateContents = <$templateFile>;
+ close($templateFile);
+ unless (($targetplatform = shift(@ARGV)) || $templateContents !~ /\$\(PLATFORM\)/)
+ {
+ Usage();
+ }
+ $targetplatform = "-" if (!$targetplatform);
+ my @tmpvalues = split('-', $targetplatform);
+ $target = $tmpvalues[0];
+ $platform = $tmpvalues[1];
+
+ # Convert visual target to real target (debug->udeb and release->urel)
+ $target =~ s/debug/udeb/i;
+ $target =~ s/release/urel/i;
+
+ if (($platform =~ m/^gcce$/i) && ($ENV{SBS_HOME})) {
+ # Print a informative note in case suspected misuse is detected.
+ print "\nNote: You must use armv5 as platform when packaging gcce binaries built using symbian-sbsv2 mkspec.\n";
+ }
+ }
+
+ # If the specified ".pkg" file exists (and can be read),
+ if (($pkgFileName =~ m|\.pkg$|i) && -r($pkgFileName))
+ {
+ print ("\n");
+ if ($justCheck) {
+ print ("Checking");
+ } else {
+ print ("Patching");
+ }
+ print (" package file and relevant binaries...\n");
+
+ if (!$justCheck) {
+ # If there are more arguments given, parse them as capabilities.
+ if (@ARGV)
+ {
+ @capabilitiesSpecified = ();
+ while (@ARGV)
+ {
+ push (@capabilitiesSpecified, pop(@ARGV));
+ }
+ }
+ }
+
+ # Start with no binaries listed.
+ my @binaries = ();
+ my $binariesDelimeter = "///";
+
+ my $tempPkgFileName = $tempPatchPath."/__TEMP__".$pkgPlainFileName;
+
+ if (!$justCheck) {
+ unlink($tempPkgFileName);
+ open (NEW_PKG, ">>".$tempPkgFileName);
+ }
+ open (PKG, "<".$pkgFileName);
+
+ my $checkFailed = "";
+ my $somethingPatched = "";
+
+ # Parse each line.
+ while (<PKG>)
+ {
+ my $line = $_;
+ my $newLine = $line;
+
+ # Patch pkg UID if it's in protected range
+ if ($line =~ m/^\#.*\((0x[0-7][0-9a-fA-F]*)\).*$/)
+ {
+ my $oldUID = $1;
+ print ("$msgPrefix UID $oldUID is not compatible with self-signing!\n");
+
+ if ($justCheck) {
+ $checkFailed = true;
+ } else {
+ my $newUID = $oldUID;
+ $newUID =~ s/0x./0xE/i;
+ $newLine =~ s/$oldUID/$newUID/;
+ print ("$msgPrefix Package UID changed to: $newUID.\n");
+ $somethingPatched = true;
+ }
+ }
+
+ # If the line specifies a file, parse the source and destination locations.
+ if ($line =~ m|^ *\"([^\"]+)\"\s*\-\s*\"([^\"]+)\"|)
+ {
+ my $sourcePath = $1;
+
+ # If the given file is a binary, check the target and binary type (+ the actual filename) from its path.
+ if ($sourcePath =~ m:\w+(\.dll|\.exe)$:i)
+ {
+ # Do preprocessing for template pkg,
+ # In case of template pkg target and platform variables are set
+ if(length($target) && length($platform))
+ {
+ $sourcePath =~ s/\$\(PLATFORM\)/$platform/gm;
+ $sourcePath =~ s/\$\(TARGET\)/$target/gm;
+ }
+
+ my ($dummy1, $dummy2, $binaryBaseName) = File::Spec->splitpath($sourcePath);
+
+ if ($justCheck) {
+ push (@binaries, $binaryBaseName.$binariesDelimeter.$sourcePath);
+ } else {
+ # Copy original files over to patching dir
+ # Patching dir will be flat to make it cleanable with QMAKE_CLEAN, so path
+ # will be collapsed into the file name to avoid name collisions in the rare
+ # case where custom pkg rules are used to install files with same names from
+ # different directories (probably using platform checks to choose only one of them.)
+ my $patchedSourcePath = $sourcePath;
+ $patchedSourcePath =~ s/[\/\\:]/_/g;
+ $patchedSourcePath = "$tempPatchPath/$patchedSourcePath";
+ $newLine =~ s/^.*(\.dll|\.exe)(.*)(\.dll|\.exe)/\"$patchedSourcePath$2$3/i;
+
+ copy($sourcePath, $patchedSourcePath) or die "$sourcePath cannot be copied for patching.";
+ push (@binaries, $binaryBaseName.$binariesDelimeter.$patchedSourcePath);
+ }
+ }
+ }
+
+ print NEW_PKG $newLine;
+
+ chomp ($line);
+ }
+
+ close (PKG);
+ if (!$justCheck) {
+ close (NEW_PKG);
+
+ unlink($pkgFileName);
+ rename($tempPkgFileName, $pkgFileName);
+ }
+ print ("\n");
+
+ my $baseCommandToExecute = "${epocToolsDir}elftran -vid 0x0 -capability \"%s\" ";
+
+ # Actually set the capabilities of the listed binaries.
+ foreach my $binariesItem(@binaries)
+ {
+ $binariesItem =~ m|^(.*)$binariesDelimeter(.*)$|;
+ my $binaryBaseName = $1;
+ my $binaryPath = $2;
+
+ # Create the command line for setting the capabilities.
+ my $commandToExecute = $baseCommandToExecute;
+ my $executeNeeded = "";
+ if (@capabilitiesSpecified)
+ {
+ $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesSpecified));
+ $executeNeeded = true;
+ my $capString = join(" ", @capabilitiesSpecified);
+ print ("$msgPrefix Patching the the Vendor ID to 0 and the capabilities used to: \"$capString\" in \"$binaryBaseName\".\n");
+ } else {
+ # Test which capabilities are present and then restrict them to the allowed set.
+ # This avoid raising the capabilities of apps that already have none.
+ my $dllCaps;
+ open($dllCaps, "${epocToolsDir}elftran -dump s $binaryPath |") or die ("ERROR: Could not execute elftran");
+ my $capsFound = 0;
+ my $originalVid;
+ my @capabilitiesToSet;
+ my $capabilitiesToAllow = join(" ", @capabilitiesToAllow);
+ my @capabilitiesToDrop;
+ while (<$dllCaps>) {
+ if (/^Secure ID: ([0-7][0-9a-fA-F]*)$/) {
+ my $exeSid = $1;
+ if ($binaryBaseName =~ /\.exe$/) {
+ # Installer refuses to install protected executables in a self signed package, so abort if one is detected.
+ # We can't simply just patch the executable SID, as any registration resources executable uses will be linked to it via SID.
+ print ("$msgPrefix Executable with SID in the protected range (0x$exeSid) detected: \"$binaryBaseName\". A self-signed sis with protected executables is not supported.\n\n");
+ $checkFailed = true;
+ }
+ }
+ if (/^Vendor ID: ([0-9a-fA-F]*)$/) {
+ $originalVid = "$1";
+ }
+ if (!$capsFound) {
+ $capsFound = 1 if (/Capabilities:/);
+ } else {
+ $_ = trim($_);
+ if ($capabilitiesToAllow =~ /$_/) {
+ push(@capabilitiesToSet, $_);
+ if (Location =~ /$_/i) {
+ print ("$msgPrefix \"Location\" capability detected for binary: \"$binaryBaseName\". This capability is not self-signable for S60 3rd edition feature pack 1 devices, so installing this package on those devices will most likely not work.\n\n");
+ }
+ } else {
+ push(@capabilitiesToDrop, $_);
+ }
+ }
+ }
+ close($dllCaps);
+ if ($originalVid !~ "00000000") {
+ print ("$msgPrefix Non-zero vendor ID (0x$originalVid) is incompatible with self-signed packages in \"$binaryBaseName\"");
+ if ($justCheck) {
+ print (".\n\n");
+ $checkFailed = true;
+ } else {
+ print (", setting it to zero.\n\n");
+ $executeNeeded = true;
+ }
+ }
+ if ($#capabilitiesToDrop) {
+ my $capsToDropStr = join("\", \"", @capabilitiesToDrop);
+ $capsToDropStr =~ s/\", \"$//;
+
+ if ($justCheck) {
+ print ("$msgPrefix The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package: \"$capsToDropStr\".\n\n");
+ $checkFailed = true;
+ } else {
+ if ($binaryBaseName =~ /\.exe$/) {
+ # While libraries often have capabilities they do not themselves need just to enable them to be loaded by wider variety of processes,
+ # executables are more likely to need every capability they have been assigned or they won't function correctly.
+ print ("$msgPrefix Executable with capabilities incompatible with self-signing detected: \"$binaryBaseName\". (Incompatible capabilities: \"$capsToDropStr\".) Reducing capabilities is only supported for libraries.\n");
+ $checkFailed = true;
+ } else {
+ print ("$msgPrefix The following capabilities used in \"$binaryBaseName\" are not compatible with a self-signed package and will be removed: \"$capsToDropStr\".\n");
+ $executeNeeded = true;
+ }
+ }
+ }
+ $commandToExecute = sprintf($baseCommandToExecute, join(" ", @capabilitiesToSet));
+ }
+ $commandToExecute .= $binaryPath;
+
+ if ($executeNeeded) {
+ # Actually execute the elftran command to set the capabilities.
+ print ("\n");
+ system ("$commandToExecute > $nullDevice");
+ $somethingPatched = true;
+ }
+ }
+
+ if ($checkFailed) {
+ print ("\n");
+ if ($justCheck) {
+ print ("$msgPrefix The package is not compatible with self-signing.\n");
+ } else {
+ print ("$msgPrefix Unable to patch the package for self-singing.\n");
+ }
+ print ("Use a proper developer certificate for signing this package.\n\n");
+ exit(1);
+ }
+
+ if ($justCheck) {
+ print ("Package is compatible with self-signing.\n");
+ } else {
+ if ($somethingPatched) {
+ print ("NOTE: A patched package may not work as expected due to reduced capabilities and other modifications,\n");
+ print (" so it should not be used for any kind of Symbian signing or distribution!\n");
+ print (" Use a proper certificate to avoid the need to patch the package.\n");
+ } else {
+ print ("No patching was required!\n");
+ }
+ }
+ print ("\n");
+ } else {
+ Usage();
+ }
+}
+else
+{
+ Usage();
+}
diff --git a/bin/setcepaths.bat b/bin/setcepaths.bat
new file mode 100755
index 0000000000..139ea68079
--- /dev/null
+++ b/bin/setcepaths.bat
@@ -0,0 +1,163 @@
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+:: All rights reserved.
+:: Contact: Nokia Corporation (qt-info@nokia.com)
+::
+:: This file is part of the tools applications of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL$
+:: No Commercial Usage
+:: This file contains pre-release code and may not be distributed.
+:: You may use this file in accordance with the terms and conditions
+:: contained in the Technology Preview License Agreement accompanying
+:: this package.
+::
+:: GNU Lesser General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU Lesser
+:: General Public License version 2.1 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 2.1 requirements
+:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+::
+:: In addition, as a special exception, Nokia gives you certain additional
+:: rights. These rights are described in the Nokia Qt LGPL Exception
+:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+::
+:: If you have questions regarding the use of this file, please contact
+:: Nokia at qt-info@nokia.com.
+::
+::
+::
+::
+::
+::
+::
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+@echo off
+IF "%1" EQU "wincewm50pocket-msvc2005" (
+checksdk.exe -sdk "Windows Mobile 5.0 Pocket PC SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 5.01 for Pocket PC selected, environment is set up
+) ELSE IF "%1" EQU "wincewm50smart-msvc2005" (
+checksdk.exe -sdk "Windows Mobile 5.0 Smartphone SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 5.01 for Smartphone for arm selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-x86-msvc2005" (
+checksdk.exe -sdk "STANDARDSDK_500 (x86)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-armv4i-msvc2005" (
+checksdk.exe -sdk "STANDARDSDK_500 (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for arm selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-mipsii-msvc2005" (
+checksdk.exe -sdk "STANDARDSDK_500 (MIPSII)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for mips-ii selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-mipsiv-msvc2005" (
+checksdk.exe -sdk "STANDARDSDK_500 (MIPSIV)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for mips-iv selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-sh4-msvc2005" (
+checksdk.exe -sdk "STANDARDSDK_500 (SH4)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for sh4 selected, environment is set up
+) ELSE IF "%1" EQU "wincewm60professional-msvc2005" (
+checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 6 Professional selected, environment is set up
+) ELSE IF "%1" EQU "wincewm65professional-msvc2005" (
+checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 6 Professional selected, environment is set up
+) ELSE IF "%1" EQU "wincewm60standard-msvc2005" (
+checksdk.exe -sdk "Windows Mobile 6 Standard SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 6 Standard selected, environment is set up
+) ELSE IF "%1" EQU "wincewm50pocket-msvc2008" (
+checksdk.exe -sdk "Windows Mobile 5.0 Pocket PC SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 5.01 for Pocket PC selected, environment is set up
+) ELSE IF "%1" EQU "wincewm50smart-msvc2008" (
+checksdk.exe -sdk "Windows Mobile 5.0 Smartphone SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 5.01 for Smartphone for arm selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-x86-msvc2008" (
+checksdk.exe -sdk "STANDARDSDK_500 (x86)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-armv4i-msvc2008" (
+checksdk.exe -sdk "STANDARDSDK_500 (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for arm selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-mipsii-msvc2008" (
+checksdk.exe -sdk "STANDARDSDK_500 (MIPSII)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for mips-ii selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-mipsiv-msvc2008" (
+checksdk.exe -sdk "STANDARDSDK_500 (MIPSIV)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for mips-iv selected, environment is set up
+) ELSE IF "%1" EQU "wince50standard-sh4-msvc2008" (
+checksdk.exe -sdk "STANDARDSDK_500 (SH4)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Standard SDK for sh4 selected, environment is set up
+) ELSE IF "%1" EQU "wincewm60professional-msvc2008" (
+checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 6 Professional selected, environment is set up
+) ELSE IF "%1" EQU "wincewm65professional-msvc2008" (
+checksdk.exe -sdk "Windows Mobile 6 Professional SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 6 Professional selected, environment is set up
+) ELSE IF "%1" EQU "wincewm60standard-msvc2008" (
+checksdk.exe -sdk "Windows Mobile 6 Standard SDK (ARMV4I)" -script tmp_created_script_setup.bat 1>NUL
+tmp_created_script_setup.bat
+del tmp_created_script_setup.bat
+echo Windows Mobile 6 Standard selected, environment is set up
+) ELSE (
+echo no SDK to build Windows CE selected
+echo.
+echo Current choices are:
+echo wincewm50pocket-msvc2005 - SDK for Windows Mobile 5.01 PocketPC
+echo wincewm50smart-msvc2005 - SDK for Windows Mobile 5.01 Smartphone
+echo wince50standard-x86-msvc2005 - Build for the WinCE standard SDK 5.0
+echo with x86 platform preset
+echo wince50standard-armv4i-msvc2005 - Build for the WinCE standard SDK 5.0
+echo with armv4i platform preset
+echo wince50standard-mipsiv-msvc2005 - Build for the WinCE standard SDK 5.0
+echo with mips platform preset
+echo wince50standard-sh4-msvc2005 - Build for the WinCE standard SDK 5.0
+echo with sh4 platform preset
+echo wincewm60professional-msvc2005 - SDK for Windows Mobile 6 professional
+echo wincewm60standard-msvc2005 - SDK for Windows Mobile 6 Standard
+echo and the corresponding versions for msvc2008.
+echo.
+)
+
+
+
diff --git a/bin/syncqt b/bin/syncqt
new file mode 100755
index 0000000000..b25a432d56
--- /dev/null
+++ b/bin/syncqt
@@ -0,0 +1,1121 @@
+#!/usr/bin/perl -w
+######################################################################
+#
+# Synchronizes Qt header files - internal development tool.
+#
+# Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+# Contact: Nokia Corporation (qt-info@nokia.com)
+#
+######################################################################
+
+# use packages -------------------------------------------------------
+use File::Basename;
+use File::Path;
+use Cwd;
+use Config;
+use strict;
+
+for (my $i = 0; $i < $#ARGV; $i++) {
+ if ($ARGV[$i] eq "-base-dir" && $i < $#ARGV - 1) {
+ $ENV{"QTDIR"} = $ARGV[$i + 1];
+ last;
+ }
+}
+
+die "syncqt: QTDIR not defined" if ! $ENV{"QTDIR"}; # sanity check
+
+# global variables
+my $isunix = 0;
+my $basedir = $ENV{"QTDIR"};
+$basedir =~ s=\\=/=g;
+my %modules = ( # path to module name map
+ "QtGui" => "$basedir/src/gui",
+ "QtOpenGL" => "$basedir/src/opengl",
+ "QtOpenVG" => "$basedir/src/openvg",
+ "QtCore" => "$basedir/src/corelib",
+ "QtXml" => "$basedir/src/xml",
+ "QtXmlPatterns" => "$basedir/src/xmlpatterns",
+ "QtSql" => "$basedir/src/sql",
+ "QtNetwork" => "$basedir/src/network",
+ "QtSvg" => "$basedir/src/svg",
+ "QtDeclarative" => "$basedir/src/declarative",
+ "QtScript" => "$basedir/src/script",
+ "QtScriptTools" => "$basedir/src/scripttools",
+ "Qt3Support" => "$basedir/src/qt3support",
+ "ActiveQt" => "$basedir/src/activeqt",
+ "QtTest" => "$basedir/src/testlib",
+ "QtHelp" => "$basedir/tools/assistant/lib",
+ "QtDesigner" => "$basedir/tools/designer/src/lib",
+ "QtUiTools" => "$basedir/tools/designer/src/uitools",
+ "QtDBus" => "$basedir/src/dbus",
+ "QtWebKit" => "$basedir/src/3rdparty/webkit/WebCore",
+ "phonon" => "$basedir/src/phonon",
+ "QtMultimedia" => "$basedir/src/multimedia",
+ "QtMeeGoGraphicsSystemHelper" => "$basedir/tools/qmeegographicssystemhelper",
+);
+my %moduleheaders = ( # restrict the module headers to those found in relative path
+ "QtWebKit" => "../WebKit/qt/Api",
+ "phonon" => "../3rdparty/phonon/phonon",
+);
+
+#$modules{"QtCore"} .= ";$basedir/mkspecs/" . $ENV{"MKSPEC"} if defined $ENV{"MKSPEC"};
+
+# global variables (modified by options)
+my $module = 0;
+my $showonly = 0;
+my $quiet = 0;
+my $remove_stale = 1;
+my $force_win = 0;
+my $force_relative = 0;
+my $check_includes = 0;
+my $copy_headers = 0;
+my $create_uic_class_map = 1;
+my $create_private_headers = 1;
+my @modules_to_sync ;
+$force_relative = 1 if ( -d "/System/Library/Frameworks" );
+my $out_basedir = $basedir;
+$out_basedir =~ s=\\=/=g;
+my $quoted_basedir = "\Q$basedir";
+
+# functions ----------------------------------------------------------
+
+######################################################################
+# Syntax: showUsage()
+# Params: -none-
+#
+# Purpose: Show the usage of the script.
+# Returns: -none-
+######################################################################
+sub showUsage
+{
+ print "$0 usage:\n";
+ 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";
+ print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n";
+ print " -quiet Only report problems, not activity (default: " . ($quiet ? "yes" : "no") . ")\n";
+ print " -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR> Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n";
+ 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;
+}
+
+######################################################################
+# 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;
+ return 0 if(/^\#pragma qt_no_master_include$/);
+ }
+ close(F);
+ } else {
+ return 0;
+ }
+ return 1;
+}
+
+######################################################################
+# Syntax: classNames(iheader)
+# Params: iheader, string, filename to parse for classname "symlinks"
+#
+# 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;
+ my ($iheader) = @_;
+ if(basename($iheader) eq "qglobal.h") {
+ push @ret, "QtGlobal";
+ } elsif(basename($iheader) eq "qendian.h") {
+ push @ret, "QtEndian";
+ } elsif(basename($iheader) eq "qconfig.h") {
+ push @ret, "QtConfig";
+ } elsif(basename($iheader) eq "qplugin.h") {
+ push @ret, "QtPlugin";
+ } elsif(basename($iheader) eq "qalgorithms.h") {
+ push @ret, "QtAlgorithms";
+ } elsif(basename($iheader) eq "qcontainerfwd.h") {
+ push @ret, "QtContainerFwd";
+ } elsif(basename($iheader) eq "qdebug.h") {
+ push @ret, "QtDebug";
+ } elsif(basename($iheader) eq "qevent.h") {
+ push @ret, "QtEvents";
+ } elsif(basename($iheader) eq "qnamespace.h") {
+ push @ret, "Qt"
+ } elsif(basename($iheader) eq "qssl.h") {
+ push @ret, "QSsl";
+ } elsif(basename($iheader) eq "qtest.h") {
+ push @ret, "QTest"
+ } elsif(basename($iheader) eq "qtconcurrentmap.h") {
+ push @ret, "QtConcurrentMap"
+ } elsif(basename($iheader) eq "qtconcurrentfilter.h") {
+ push @ret, "QtConcurrentFilter"
+ } elsif(basename($iheader) eq "qtconcurrentrun.h") {
+ push @ret, "QtConcurrentRun"
+ } elsif(basename($iheader) eq "qaudio.h") {
+ push @ret, "QAudio"
+ }
+
+ my $parsable = "";
+ if(open(F, "<$iheader")) {
+ while(<F>) {
+ my $line = $_;
+ chomp $line;
+ chop $line if ($line =~ /\r$/);
+ if($line =~ /^\#/) {
+ if($line =~ /\\$/) {
+ while($line = <F>) {
+ chomp $line;
+ last unless($line =~ /\\$/);
+ }
+ }
+ 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
+ $line .= ";" if($line =~ m/^Q_[A-Z_]*\(.*\)[\r\n]*$/); #qt macro
+ $line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro
+ $line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE[\r\n]*$/); #qt macro
+ $line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
+ $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;
+ if($definition =~ m/^ *typedef *.*\(\*([^\)]*)\)\(.*\);$/) {
+ push @symbols, $1;
+ } elsif($definition =~ m/^ *typedef +(.*) +([^ ]*);$/) {
+ push @symbols, $2;
+ } elsif($definition =~ m/^ *(template *<.*> *)?(class|struct) +([^ ]* +)?([^<\s]+) ?(<[^>]*> ?)?\s*((,|:)\s*(public|protected|private) *.*)? *\{\}$/) {
+ push @symbols, $4;
+ } elsif($definition =~ m/^ *Q_DECLARE_.*ITERATOR\((.*)\);$/) {
+ push @symbols, "Q" . $1 . "Iterator";
+ push @symbols, "QMutable" . $1 . "Iterator";
+ }
+
+ foreach my $symbol (@symbols) {
+ $symbol = (join("::", @namespaces) . "::" . $symbol) if (scalar @namespaces);
+ push @ret, $symbol
+ if ($symbol =~ /^Q[^:]*$/ # no-namespace, starting with Q
+ || $symbol =~ /^Phonon::/); # or in the Phonon namespace
+ }
+ }
+ }
+ return @ret;
+}
+
+######################################################################
+# 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 {
+ my ($header, $iheader, $copy, $ts) = @_;
+ $iheader =~ s=\\=/=g;
+ $header =~ s=\\=/=g;
+ return copyFile($iheader, $header) if($copy);
+
+ unless(-e $header) {
+ my $header_dir = dirname($header);
+ mkpath $header_dir, !$quiet;
+
+ #write it
+ my $iheader_out = fixPaths($iheader, $header_dir);
+ open HEADER, ">$header" || die "Could not open $header for writing!\n";
+ 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.
+######################################################################
+sub fixPaths {
+ my ($file, $dir) = @_;
+ $dir =~ s=^$quoted_basedir/=$out_basedir/= if(!($basedir eq $out_basedir));
+ $file =~ s=\\=/=g;
+ $dir =~ s=\\=/=g;
+
+ #setup
+ my $ret = $file;
+ $ret =~ s,/cygdrive/([a-zA-Z])/,$1:/,g;
+ my $file_dir = dirname($file);
+ if($file_dir eq ".") {
+ $file_dir = getcwd();
+ $file_dir =~ s=\\=/=g;
+ }
+ $file_dir =~ s,/cygdrive/([a-zA-Z])/,$1:/,g;
+ if($dir eq ".") {
+ $dir = getcwd();
+ $dir =~ s=\\=/=g;
+ }
+ $dir =~ s,/cygdrive/([a-zA-Z])/,$1:/,g;
+ return basename($file) if($file_dir eq $dir);
+
+ #guts
+ my $match_dir = 0;
+ for(my $i = 1; $i < length($file_dir); $i++) {
+ my $slash = index($file_dir, "/", $i);
+ last if($slash == -1);
+ my $tmp = substr($file_dir, 0, $slash);
+ last unless($dir =~ m,^\Q$tmp\E/,);
+ $match_dir = $tmp;
+ $i = $slash;
+ }
+ if($match_dir) {
+ my $after = substr($dir, length($match_dir));
+ my $count = ($after =~ tr,/,,);
+ my $dots = "";
+ for(my $i = 0; $i < $count; $i++) {
+ $dots .= "../";
+ }
+ $ret =~ s,^\Q$match_dir\E,$dots,;
+ }
+ $ret =~ s,/+,/,g;
+ return $ret;
+}
+
+######################################################################
+# 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;
+}
+
+######################################################################
+# 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
+{
+ my ($file,$ifile, $copy,$knowdiff,$filecontents,$ifilecontents) = @_;
+ # 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);
+ mkpath $file_dir, !$quiet unless(-e $file_dir);
+ 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);
+ mkpath $ifile_dir, !$quiet unless(-e $ifile_dir);
+ 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: symlinkFile(file, ifile)
+# Params: file, string, filename to create "symlink" for
+# ifile, string, destination name of symlink
+#
+# Purpose: File is symlinked to ifile (or copied if filesystem doesn't
+# support symlink).
+# Returns: 1 on success, else 0.
+######################################################################
+sub symlinkFile
+{
+ my ($file,$ifile) = @_;
+
+ if ($isunix) {
+ print "symlink created for $file " unless $quiet;
+ if ( $force_relative && ($ifile =~ /^$quoted_basedir/)) {
+ my $t = getcwd();
+ my $c = -1;
+ my $p = "../";
+ $t =~ s-^$quoted_basedir/--;
+ $p .= "../" while( ($c = index( $t, "/", $c + 1)) != -1 );
+ $file =~ s-^$quoted_basedir/-$p-;
+ print " ($file)\n" unless $quiet;
+ }
+ print "\n" unless $quiet;
+ return symlink($file, $ifile);
+ }
+ return copyFile($file, $ifile);
+}
+
+######################################################################
+# 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);
+ $dir =~ s=\\=/=g;
+ ($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;
+}
+
+# --------------------------------------------------------------------
+# "main" function
+# --------------------------------------------------------------------
+
+while ( @ARGV ) {
+ my $var = 0;
+ my $val = 0;
+
+ #parse
+ my $arg = shift @ARGV;
+ if ($arg eq "-h" || $arg eq "-help" || $arg eq "?") {
+ $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") {
+ $var = "quiet";
+ $val = "yes";
+ } elsif($arg eq "-base-dir") {
+ # skip, it's been dealt with at the top of the file
+ shift @ARGV;
+ next;
+ }
+
+ #do something
+ if(!$var || $var eq "show_help") {
+ print "Unknown option: $arg\n\n" if(!$var);
+ 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--;
+ }
+ } elsif ($var eq "quiet") {
+ if($val eq "yes") {
+ $quiet++;
+ } elsif($quiet) {
+ $quiet--;
+ }
+ } 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--;
+ }
+ } elsif ($var eq "module") {
+ print "module :$val:\n" unless $quiet;
+ die "No such module: $val" unless(defined $modules{$val});
+ 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;
+ $create_uic_class_map = 0;
+ $create_private_headers = 0;
+ } elsif ($var eq "output") {
+ my $outdir = $val;
+ if(checkRelative($outdir)) {
+ $out_basedir = getcwd();
+ chomp $out_basedir;
+ $out_basedir .= "/" . $outdir;
+ } else {
+ $out_basedir = $outdir;
+ }
+ # \ -> /
+ $out_basedir =~ s=\\=/=g;
+ }
+}
+@modules_to_sync = keys(%modules) if($#modules_to_sync == -1);
+
+$isunix = checkUnix; #cache checkUnix
+
+# create path
+mkpath "$out_basedir/include", !$quiet;
+mkpath "$out_basedir/include/Qt", !$quiet;
+
+my @ignore_headers = ();
+my $class_lib_map_contents = "";
+my @ignore_for_master_contents = ( "qt.h", "qpaintdevicedefs.h" );
+my @ignore_for_include_check = ( "qatomic.h" );
+my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h" );
+my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h", "qatomic_arm.h", "qatomic_armv7.h" );
+my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" );
+my %colliding_headers = ();
+my %inject_headers = ( "$basedir/src/corelib/global" => ( "qconfig.h" ) ); # all from build dir
+
+foreach my $lib (@modules_to_sync) {
+ #iteration info
+ my $dir = $modules{$lib};
+ my $pathtoheaders = "";
+ $pathtoheaders = $moduleheaders{$lib} if ($moduleheaders{$lib});
+
+ #information used after the syncing
+ my $pri_install_classes = "";
+ my $pri_install_files = "";
+ my $pri_install_pfiles = "";
+
+ my $libcapitals = $lib;
+ $libcapitals =~ y/a-z/A-Z/;
+ my $master_contents = "#ifndef QT_".$libcapitals."_MODULE_H\n#define QT_".$libcapitals."_MODULE_H\n";
+
+ #get dependencies
+ if(-e "$dir/" . basename($dir) . ".pro") {
+ if(open(F, "<$dir/" . basename($dir) . ".pro")) {
+ while(my $line = <F>) {
+ chomp $line;
+ if($line =~ /^ *QT *\+?= *([^\r\n]*)/) {
+ foreach(split(/ /, $1)) {
+ $master_contents .= "#include <QtCore/QtCore>\n" if($_ eq "core");
+ $master_contents .= "#include <QtGui/QtGui>\n" if($_ eq "gui");
+ $master_contents .= "#include <QtNetwork/QtNetwork>\n" if($_ eq "network");
+ $master_contents .= "#include <QtSvg/QtSvg>\n" if($_ eq "svg");
+ $master_contents .= "#include <QtDeclarative/QtDeclarative>\n" if($_ eq "declarative");
+ $master_contents .= "#include <QtScript/QtScript>\n" if($_ eq "script");
+ $master_contents .= "#include <QtScriptTools/QtScriptTools>\n" if($_ eq "scripttools");
+ $master_contents .= "#include <Qt3Support/Qt3Support>\n" if($_ eq "qt3support");
+ $master_contents .= "#include <QtSql/QtSql>\n" if($_ eq "sql");
+ $master_contents .= "#include <QtXml/QtXml>\n" if($_ eq "xml");
+ $master_contents .= "#include <QtXmlPatterns/QtXmlPatterns>\n" if($_ eq "xmlpatterns");
+ $master_contents .= "#include <QtOpenGL/QtOpenGL>\n" if($_ eq "opengl");
+ $master_contents .= "#include <QtOpenVG/QtOpenVG>\n" if($_ eq "openvg");
+ }
+ }
+ }
+ close(F);
+ }
+ }
+
+ #remove the old files
+ if($remove_stale) {
+ my @subdirs = ("$out_basedir/include/$lib");
+ foreach my $subdir (@subdirs) {
+ if (opendir DIR, $subdir) {
+ while(my $t = readdir(DIR)) {
+ 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 "/");
+ $remove_file = 1 unless(-e $include);
+ } else {
+ $remove_file = 0;
+ last;
+ }
+ }
+ close(F);
+ unlink $file if($remove_file);
+ }
+ }
+ }
+ }
+ closedir DIR;
+ }
+
+ }
+ }
+
+ #create the new ones
+ foreach my $current_dir (split(/;/, $dir)) {
+ my $headers_dir = $current_dir;
+ $headers_dir .= "/$pathtoheaders" if ($pathtoheaders);
+ #calc subdirs
+ my @subdirs = ($headers_dir);
+ foreach my $subdir (@subdirs) {
+ opendir DIR, $subdir or next;
+ while(my $t = 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"));
+ }
+ closedir DIR;
+ }
+
+ #calc files and "copy" them
+ foreach my $subdir (@subdirs) {
+ my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
+ if (defined $inject_headers{$subdir}) {
+ foreach my $if ($inject_headers{$subdir}) {
+ @headers = grep(!/^\Q$if\E$/, @headers); #in case we configure'd previously
+ push @headers, "*".$if;
+ }
+ }
+ foreach my $header (@headers) {
+ my $shadow = ($header =~ s/^\*//);
+ $header = 0 if($header =~ /^ui_.*.h/);
+ foreach (@ignore_headers) {
+ $header = 0 if($header eq $_);
+ }
+ if($header) {
+ my $header_copies = 0;
+ #figure out if it is a public header
+ my $public_header = $header;
+ if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
+ $public_header = 0;
+ } else {
+ foreach (@ignore_for_master_contents) {
+ $public_header = 0 if($header eq $_);
+ }
+ }
+
+ my $iheader = $subdir . "/" . $header;
+ $iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
+ my @classes = $public_header ? classNames($iheader) : ();
+ if($showonly) {
+ print "$header [$lib]\n";
+ foreach(@classes) {
+ print "SYMBOL: $_\n";
+ }
+ } else {
+ my $ts = (stat($iheader))[9];
+ #find out all the places it goes..
+ my @headers;
+ if ($public_header) {
+ @headers = ( "$out_basedir/include/$lib/$header" );
+
+ # write forwarding headers to include/Qt
+ if ($lib ne "phonon" && $subdir =~ /^$quoted_basedir\/src/) {
+ my $file_name = "$out_basedir/include/Qt/$header";
+ my $file_op = '>';
+ my $header_content = '';
+ if (exists $colliding_headers{$file_name}) {
+ $file_op = '>>';
+ } else {
+ $colliding_headers{$file_name} = 1;
+ my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.';
+ $header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" .
+ " #if defined(__GNUC__)\n" .
+ " #warning \"$warning_msg\"\n" .
+ " #elif defined(_MSC_VER)\n" .
+ " #pragma message(\"WARNING: $warning_msg\")\n" .
+ " #endif\n".
+ "#endif\n\n";
+ }
+ $header_content .= '#include "' . "../$lib/$header" . "\"\n";
+ open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n";
+ print HEADERFILE $header_content;
+ close HEADERFILE;
+ }
+
+ foreach my $full_class (@classes) {
+ my $header_base = basename($header);
+ # Strip namespaces:
+ my $class = $full_class;
+ $class =~ s/^.*:://;
+# if ($class =~ m/::/) {
+# class =~ s,::,/,g;
+# }
+ $class_lib_map_contents .= "QT_CLASS_LIB($full_class, $lib, $header_base)\n";
+ $header_copies++ if(syncHeader("$out_basedir/include/$lib/$class", "$out_basedir/include/$lib/$header", 0, $ts));
+
+ # KDE-Compat headers for Phonon
+ if ($lib eq "phonon") {
+ $header_copies++ if (syncHeader("$out_basedir/include/phonon_compat/Phonon/$class", "$out_basedir/include/$lib/$header", 0, $ts));
+ }
+ }
+ } elsif ($create_private_headers) {
+ @headers = ( "$out_basedir/include/$lib/private/$header" );
+ }
+ foreach(@headers) { #sync them
+ $header_copies++ if(syncHeader($_, $iheader, $copy_headers && !$shadow, $ts));
+ }
+
+ if($public_header) {
+ #put it into the master file
+ $master_contents .= "#include \"$public_header\"\n" if(shouldMasterInclude($iheader));
+
+ #deal with the install directives
+ if($public_header) {
+ my $pri_install_iheader = fixPaths($iheader, $current_dir);
+ foreach my $class (@classes) {
+ # Strip namespaces:
+ $class =~ s/^.*:://;
+# if ($class =~ m/::/) {
+# $class =~ s,::,/,g;
+# }
+ my $class_header = fixPaths("$out_basedir/include/$lib/$class",
+ $current_dir) . " ";
+ $pri_install_classes .= $class_header
+ unless($pri_install_classes =~ $class_header);
+ }
+ $pri_install_files.= "$pri_install_iheader ";;
+ }
+ }
+ else {
+ my $pri_install_iheader = fixPaths($iheader, $current_dir);
+ $pri_install_pfiles.= "$pri_install_iheader ";;
+ }
+ }
+ print "header created for $iheader ($header_copies)\n" if($header_copies > 0 && !$quiet);
+ }
+ }
+ }
+ }
+
+ # close the master include:
+ $master_contents .= "#endif\n";
+
+ unless($showonly) {
+ my @master_includes;
+ push @master_includes, "$out_basedir/include/$lib/$lib";
+ push @master_includes, "$out_basedir/include/phonon_compat/Phonon/Phonon" if ($lib eq "phonon");
+ foreach my $master_include (@master_includes) {
+ #generate the "master" include file
+ my @tmp = split(/;/,$modules{$lib});
+ $pri_install_files .= fixPaths($master_include, $tmp[0]) . " "; #get the master file installed too
+ if($master_include && -e $master_include) {
+ open MASTERINCLUDE, "<$master_include";
+ local $/;
+ binmode MASTERINCLUDE;
+ my $oldmaster = <MASTERINCLUDE>;
+ close MASTERINCLUDE;
+ $oldmaster =~ s/\r//g; # remove \r's , so comparison is ok on all platforms
+ $master_include = 0 if($oldmaster eq $master_contents);
+ }
+ if($master_include && $master_contents) {
+ my $master_dir = dirname($master_include);
+ mkpath $master_dir, !$quiet;
+ print "header (master) created for $lib\n" unless $quiet;
+ open MASTERINCLUDE, ">$master_include";
+ print MASTERINCLUDE $master_contents;
+ close MASTERINCLUDE;
+ }
+ }
+
+ #handle the headers.pri for each module
+ my $headers_pri_contents = "";
+ $headers_pri_contents .= "SYNCQT.HEADER_FILES = $pri_install_files\n";
+ $headers_pri_contents .= "SYNCQT.HEADER_CLASSES = $pri_install_classes\n";
+ $headers_pri_contents .= "SYNCQT.PRIVATE_HEADER_FILES = $pri_install_pfiles\n";
+ my $headers_pri_file = "$out_basedir/include/$lib/headers.pri";
+ if(-e $headers_pri_file) {
+ open HEADERS_PRI_FILE, "<$headers_pri_file";
+ local $/;
+ binmode HEADERS_PRI_FILE;
+ my $old_headers_pri_contents = <HEADERS_PRI_FILE>;
+ close HEADERS_PRI_FILE;
+ $old_headers_pri_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms
+ $headers_pri_file = 0 if($old_headers_pri_contents eq $headers_pri_contents);
+ }
+ if($headers_pri_file && $master_contents) {
+ my $headers_pri_dir = dirname($headers_pri_file);
+ mkpath $headers_pri_dir, !$quiet;
+ print "headers.pri file created for $lib\n" unless $quiet;
+ open HEADERS_PRI_FILE, ">$headers_pri_file";
+ print HEADERS_PRI_FILE $headers_pri_contents;
+ close HEADERS_PRI_FILE;
+ }
+ }
+}
+unless($showonly || !$create_uic_class_map) {
+ my $class_lib_map = "$out_basedir/src/tools/uic/qclass_lib_map.h";
+ if(-e $class_lib_map) {
+ open CLASS_LIB_MAP, "<$class_lib_map";
+ local $/;
+ binmode CLASS_LIB_MAP;
+ my $old_class_lib_map_contents = <CLASS_LIB_MAP>;
+ close CLASS_LIB_MAP;
+ $old_class_lib_map_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms
+ $class_lib_map = 0 if($old_class_lib_map_contents eq $class_lib_map_contents);
+ }
+ if($class_lib_map) {
+ my $class_lib_map_dir = dirname($class_lib_map);
+ mkpath $class_lib_map_dir, !$quiet;
+ open CLASS_LIB_MAP, ">$class_lib_map";
+ print CLASS_LIB_MAP $class_lib_map_contents;
+ close CLASS_LIB_MAP;
+ }
+}
+
+if($check_includes) {
+ for my $lib (keys(%modules)) {
+ #calc subdirs
+ my @subdirs = ($modules{$lib});
+ foreach my $subdir (@subdirs) {
+ opendir DIR, $subdir or die "Huh, directory ".$subdir." cannot be opened.";
+ while(my $t = 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"));
+ }
+ closedir DIR;
+ }
+
+ foreach my $subdir (@subdirs) {
+ my $header_skip_qt_module_test = 0;
+ foreach(@ignore_for_qt_module_check) {
+ foreach (split(/;/, $_)) {
+ $header_skip_qt_module_test = 1 if ($subdir =~ /^$_/);
+ }
+ }
+ my @headers = findFiles($subdir, "^[-a-z0-9_]*\\.h\$" , 0);
+ foreach my $header (@headers) {
+ my $header_skip_qt_begin_header_test = 0;
+ my $header_skip_qt_begin_namespace_test = 0;
+ $header = 0 if($header =~ /^ui_.*.h/);
+ foreach (@ignore_headers) {
+ $header = 0 if($header eq $_);
+ }
+ if($header) {
+ my $public_header = $header;
+ if($public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
+ $public_header = 0;
+ } else {
+ foreach (@ignore_for_master_contents) {
+ $public_header = 0 if($header eq $_);
+ }
+ if($public_header) {
+ foreach (@ignore_for_include_check) {
+ $public_header = 0 if($header eq $_);
+ }
+ foreach(@ignore_for_qt_begin_header_check) {
+ $header_skip_qt_begin_header_test = 1 if ($header eq $_);
+ }
+ foreach(@ignore_for_qt_begin_namespace_check) {
+ $header_skip_qt_begin_namespace_test = 1 if ($header eq $_);
+ }
+ }
+ }
+
+ my $iheader = $subdir . "/" . $header;
+ if($public_header) {
+ if(open(F, "<$iheader")) {
+ my $qt_module_found = 0;
+ my $qt_begin_header_found = 0;
+ my $qt_end_header_found = 0;
+ my $qt_begin_namespace_found = 0;
+ my $qt_end_namespace_found = 0;
+ my $line;
+ while($line = <F>) {
+ chomp $line;
+ my $output_line = 1;
+ if($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) {
+ last;
+ } elsif($line =~ /^ *\# *include/) {
+ my $include = $line;
+ if($line =~ /<.*>/) {
+ $include =~ s,.*<(.*)>.*,$1,;
+ } elsif($line =~ /".*"/) {
+ $include =~ s,.*"(.*)".*,$1,;
+ } else {
+ $include = 0;
+ }
+ if($include) {
+ for my $trylib (keys(%modules)) {
+ if(-e "$out_basedir/include/$trylib/$include") {
+ print "WARNING: $iheader includes $include when it should include $trylib/$include\n";
+ }
+ }
+ }
+ } elsif ($header_skip_qt_begin_header_test == 0 and $line =~ /^QT_BEGIN_HEADER\s*$/) {
+ $qt_begin_header_found = 1;
+ } elsif ($header_skip_qt_begin_header_test == 0 and $line =~ /^QT_END_HEADER\s*$/) {
+ $qt_end_header_found = 1;
+ } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_BEGIN_NAMESPACE\s*$/) {
+ $qt_begin_namespace_found = 1;
+ } elsif ($header_skip_qt_begin_namespace_test == 0 and $line =~ /^QT_END_NAMESPACE\s*$/) {
+ $qt_end_namespace_found = 1;
+ } elsif ($header_skip_qt_module_test == 0 and $line =~ /^QT_MODULE\(.*\)\s*$/) {
+ $qt_module_found = 1;
+ }
+ }
+ if ($header_skip_qt_begin_header_test == 0) {
+ if ($qt_begin_header_found == 0) {
+ print "WARNING: $iheader does not include QT_BEGIN_HEADER\n";
+ }
+
+ if ($qt_begin_header_found && $qt_end_header_found == 0) {
+ print "WARNING: $iheader has QT_BEGIN_HEADER but no QT_END_HEADER\n";
+ }
+ }
+
+ if ($header_skip_qt_begin_namespace_test == 0) {
+ if ($qt_begin_namespace_found == 0) {
+ print "WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n";
+ }
+
+ if ($qt_begin_namespace_found && $qt_end_namespace_found == 0) {
+ print "WARNING: $iheader has QT_BEGIN_NAMESPACE but no QT_END_NAMESPACE\n";
+ }
+ }
+
+ if ($header_skip_qt_module_test == 0) {
+ if ($qt_module_found == 0) {
+ print "WARNING: $iheader does not include QT_MODULE\n";
+ }
+ }
+ close(F);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+exit 0;
diff --git a/bin/syncqt.bat b/bin/syncqt.bat
new file mode 100755
index 0000000000..dd0da87f19
--- /dev/null
+++ b/bin/syncqt.bat
@@ -0,0 +1,42 @@
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+:: All rights reserved.
+:: Contact: Nokia Corporation (qt-info@nokia.com)
+::
+:: This file is part of the tools applications of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL$
+:: No Commercial Usage
+:: This file contains pre-release code and may not be distributed.
+:: You may use this file in accordance with the terms and conditions
+:: contained in the Technology Preview License Agreement accompanying
+:: this package.
+::
+:: GNU Lesser General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU Lesser
+:: General Public License version 2.1 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 2.1 requirements
+:: will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+::
+:: In addition, as a special exception, Nokia gives you certain additional
+:: rights. These rights are described in the Nokia Qt LGPL Exception
+:: version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+::
+:: If you have questions regarding the use of this file, please contact
+:: Nokia at qt-info@nokia.com.
+::
+::
+::
+::
+::
+::
+::
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+@rem ***** This assumes PERL is in the PATH *****
+@perl.exe -S syncqt %*