diff options
author | Xizhi Zhu <xizhi.zhu@gmail.com> | 2012-01-23 21:25:30 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-31 07:08:31 +0100 |
commit | ba9302b8a9b6b50f37987261c1ade9af2ade2d3c (patch) | |
tree | 5ca4d3d9b963b5b1afc40b396c773e90072f0818 /bin | |
parent | d1a2b53aaf76f48e195260a415ca406fa1ef01a2 (diff) |
Remove Symbian specific code from qtbase.
Change-Id: I27d37d914b71e1e43c94e2a975ffec49e1ecd456
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/createpackage | 3 | ||||
-rwxr-xr-x | bin/createpackage.bat | 44 | ||||
-rwxr-xr-x | bin/createpackage.pl | 439 | ||||
-rwxr-xr-x | bin/elf2e32_qtwrapper | 3 | ||||
-rw-r--r-- | bin/elf2e32_qtwrapper.bat | 3 | ||||
-rwxr-xr-x | bin/elf2e32_qtwrapper.pl | 325 | ||||
-rwxr-xr-x | bin/patch_capabilities | 3 | ||||
-rw-r--r-- | bin/patch_capabilities.bat | 1 | ||||
-rwxr-xr-x | bin/patch_capabilities.pl | 398 |
9 files changed, 0 insertions, 1219 deletions
diff --git a/bin/createpackage b/bin/createpackage deleted file mode 100755 index fdd4eebdea..0000000000 --- a/bin/createpackage +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -scriptpath=`dirname $0` -perl $scriptpath/createpackage.pl "$@" diff --git a/bin/createpackage.bat b/bin/createpackage.bat deleted file mode 100755 index cf815b58a4..0000000000 --- a/bin/createpackage.bat +++ /dev/null @@ -1,44 +0,0 @@ -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: -:: Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -:: Contact: http://www.qt-project.org/ -:: -:: This file is part of the test suite of the Qt Toolkit. -:: -:: $QT_BEGIN_LICENSE:LGPL$ -:: GNU Lesser General Public License Usage -:: 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. -:: -:: GNU General Public License Usage -:: Alternatively, this file may be used under the terms of the GNU General -:: Public License version 3.0 as published by the Free Software Foundation -:: and appearing in the file LICENSE.GPL included in the packaging of this -:: file. Please review the following information to ensure the GNU General -:: Public License version 3.0 requirements will be met: -:: http://www.gnu.org/copyleft/gpl.html. -:: -:: Other Usage -:: Alternatively, this file may be used in accordance with the terms and -:: conditions contained in a signed written agreement between you and Nokia. -:: -:: -:: -:: -:: -:: -:: $QT_END_LICENSE$ -:: -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -@echo off -set scriptpath=%~dp0 -perl %scriptpath%createpackage.pl %* diff --git a/bin/createpackage.pl b/bin/createpackage.pl deleted file mode 100755 index d4a953dfdd..0000000000 --- a/bin/createpackage.pl +++ /dev/null @@ -1,439 +0,0 @@ -#!/usr/bin/perl -############################################################################# -## -## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -## Contact: http://www.qt-project.org/ -## -## This file is part of the S60 port of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL$ -## GNU Lesser General Public License Usage -## 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. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU General -## Public License version 3.0 as published by the Free Software Foundation -## and appearing in the file LICENSE.GPL included in the packaging of this -## file. Please review the following information to ensure the GNU General -## Public License version 3.0 requirements will be met: -## http://www.gnu.org/copyleft/gpl.html. -## -## Other Usage -## Alternatively, this file may be used in accordance with the terms and -## conditions contained in a signed written agreement between you and Nokia. -## -## -## -## -## -## -## $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"; - -my $certtext = $certificate; - -# 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 - my $scriptpath = dirname(__FILE__); - my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs"); - - unless (-e $certpath) { - my $qmakeCmd = File::Spec->catfile($scriptpath, "qmake"); - $certpath = `$qmakeCmd -query QT_INSTALL_PREFIX`; - $certpath =~ s/\s+$//; - $certpath = File::Spec->catdir($certpath, "src/s60installs"); - } - - $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 deleted file mode 100755 index a3a4065f30..0000000000 --- a/bin/elf2e32_qtwrapper +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -scriptpath=`dirname $0` -perl $scriptpath/elf2e32_qtwrapper.pl "$@" diff --git a/bin/elf2e32_qtwrapper.bat b/bin/elf2e32_qtwrapper.bat deleted file mode 100644 index 52910df007..0000000000 --- a/bin/elf2e32_qtwrapper.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -set scriptpath=%~dp0 -perl %scriptpath%elf2e32_qtwrapper.pl %* diff --git a/bin/elf2e32_qtwrapper.pl b/bin/elf2e32_qtwrapper.pl deleted file mode 100755 index a9ea771181..0000000000 --- a/bin/elf2e32_qtwrapper.pl +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/perl -w -############################################################################# -## -## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -## Contact: http://www.qt-project.org/ -## -## This file is part of the utilities of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL$ -## GNU Lesser General Public License Usage -## 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. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU General -## Public License version 3.0 as published by the Free Software Foundation -## and appearing in the file LICENSE.GPL included in the packaging of this -## file. Please review the following information to ensure the GNU General -## Public License version 3.0 requirements will be met: -## http://www.gnu.org/copyleft/gpl.html. -## -## Other Usage -## Alternatively, this file may be used in accordance with the terms and -## conditions contained in a signed written agreement between you and Nokia. -## -## -## -## -## -## -## $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/patch_capabilities b/bin/patch_capabilities deleted file mode 100755 index 0d8962260e..0000000000 --- a/bin/patch_capabilities +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -scriptpath=`dirname $0` -perl $scriptpath/patch_capabilities.pl "$@" diff --git a/bin/patch_capabilities.bat b/bin/patch_capabilities.bat deleted file mode 100644 index 6a0c4d777a..0000000000 --- a/bin/patch_capabilities.bat +++ /dev/null @@ -1 +0,0 @@ -@perl.exe -S %~dp0patch_capabilities.pl %* diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl deleted file mode 100755 index daa5e12930..0000000000 --- a/bin/patch_capabilities.pl +++ /dev/null @@ -1,398 +0,0 @@ -#!/usr/bin/perl -############################################################################# -## -## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -## Contact: http://www.qt-project.org/ -## -## This file is part of the S60 port of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL$ -## GNU Lesser General Public License Usage -## 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. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU General -## Public License version 3.0 as published by the Free Software Foundation -## and appearing in the file LICENSE.GPL included in the packaging of this -## file. Please review the following information to ensure the GNU General -## Public License version 3.0 requirements will be met: -## http://www.gnu.org/copyleft/gpl.html. -## -## Other Usage -## Alternatively, this file may be used in accordance with the terms and -## conditions contained in a signed written agreement between you and Nokia. -## -## -## -## -## -## -## $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(); -} |