diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/createpackage.bat | 3 | ||||
-rw-r--r-- | bin/createpackage.pl | 169 | ||||
-rw-r--r-- | bin/patch_capabilities.pl | 143 | ||||
-rwxr-xr-x | bin/syncqt | 5 |
4 files changed, 319 insertions, 1 deletions
diff --git a/bin/createpackage.bat b/bin/createpackage.bat new file mode 100644 index 0000000..b5ede18 --- /dev/null +++ b/bin/createpackage.bat @@ -0,0 +1,3 @@ +@echo off +set scriptpath=%~dp0 +perl %scriptpath%createpackage.pl %*
\ No newline at end of file diff --git a/bin/createpackage.pl b/bin/createpackage.pl new file mode 100644 index 0000000..a180864 --- /dev/null +++ b/bin/createpackage.pl @@ -0,0 +1,169 @@ +#!\usr\bin\perl +############################################################################################ +# +# Convenience script for creating signed packages you can install on your phone. +# +# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +# Contact: Qt Software Information (qt-info@nokia.com) +# +############################################################################################ + +use strict; + +# use a command-line parsing module +use Getopt::Long; +# Use file name parsing module +use File::Basename; + +sub Usage() { + print "\n"; + print "==========================================================================================\n"; + print "Convenience script for creating signed packages you can install on your phone.\n"; + print "\n"; + print "Usage: createpackage.pl [-i] templatepkg target-platform [certificate key [passphrase]]\n"; + print "\n"; + print "Where parameters are as follows:\n"; + print " [-i|install] = Install the package right away using PC suite\n"; + print " [-p|preprocess] = Only preprocess the template .pkg file.\n"; + print " templatepkg = Name of .pkg file template\n"; + print " target = Either debug or release\n"; + print " platform = One of the supported platform\n"; + print " winscw | gcce | armv5 | armv6 | armv7\n"; + print " certificate = The certificate file used for signing\n"; + print " key = The certificate's private key file\n"; + print " passphrase = The certificate's private key file's passphrase\n"; + print "\n"; + print "For example:\n"; + print " createpackage.pl fluidlauncher_template.pkg release-armv5\n"; + print "\n"; + print "If no certificate and key files are provided, either a RnD certificate or\n"; + print "a self-signed certificate from Qt installation root directory is used.\n"; + print "\n"; + print "==========================================================================================\n"; + exit(); +} + +# Read given options +my $install = ""; +my $preprocessonly = ""; +unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly)){ + Usage(); +} + +# Read params to variables +my $templatepkg = $ARGV[0]; +my $targetplatform = lc $ARGV[1]; + +my @tmpvalues = split('-', $targetplatform); +my $target = $tmpvalues[0]; +my $platform = $tmpvalues[1];; + +# Convert visual target to real target (debug->udeb and release->urel) +$target =~ s/debug/udeb/i; +$target =~ s/release/urel/i; + +my $certificate = $ARGV[2]; +my $key = $ARGV[3]; +my $passphrase = $ARGV[4]; + +# Generate output pkg basename (i.e. file name without extension) +my $pkgoutputbasename = $templatepkg; +$pkgoutputbasename =~ s/_template\.pkg/_$targetplatform/g; +$pkgoutputbasename = lc($pkgoutputbasename); + +# Store output file names to variables +my $pkgoutput = lc($pkgoutputbasename.".pkg"); +my $unsigned_sis_name = $pkgoutputbasename."_unsigned.sis"; +my $signed_sis_name = $pkgoutputbasename.".sis"; + +# Store some utility variables +my $scriptpath = dirname(__FILE__); +my $certtext = $certificate; +my $certpath = $scriptpath; +$certpath =~ s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash +$certpath = $certpath."../"; # certificates are one step up in hierarcy +$certpath =~ s-/-\\-go; # for those working with UNIX shells + +# Check some pre-conditions and print error messages if needed +unless (length($templatepkg) && length($platform) && length($target)) { + print "\nError: Template PKG filename, platform or target 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 = $certpath."rd.cer"; + $key = $certpath."rd-key.pem"; + + stat($certificate); + unless( -e _ ) { + $certtext = "Self Signed"; + $certificate = $certpath."selfsigned.cer"; + $key = $certpath."selfsigned.key"; + } +} + +# Remove any existing .sis packages +unlink $unsigned_sis_name; +unlink $signed_sis_name; +unlink $pkgoutput; + +# Preprocess PKG +local $/; +# read template file +open( TEMPLATE, $templatepkg) or die "Error '$templatepkg': $!\n"; +$_=<TEMPLATE>; +close (TEMPLATE); + +# replace the PKG variables +s/\$\(PLATFORM\)/$platform/gm; +s/\$\(TARGET\)/$target/gm; + +#write the output +open( OUTPUT, ">$pkgoutput" ) or die "Error '$pkgoutput' $!\n"; +print OUTPUT $_; +close OUTPUT; + +if ($preprocessonly) { + exit; +} + +# Create and sign SIS +system ("makesis $pkgoutput $unsigned_sis_name"); +system ("signsis $unsigned_sis_name $signed_sis_name $certificate $key $passphrase"); + +# Check if creating signed SIS Succeeded +stat($signed_sis_name); +if( -e _ ) { + print ("\nSuccessfully created $signed_sis_name using certificate $certtext!\n"); + + # remove temporary pkg and unsigned sis + unlink $pkgoutput; + 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"); +} + + +#end of file diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl new file mode 100644 index 0000000..cf8353e --- /dev/null +++ b/bin/patch_capabilities.pl @@ -0,0 +1,143 @@ +####################################################################### +# +# A script for setting binary capabilities based on .pkg file contents. +# +# Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). +# Contact: Nokia Corporation (qt-info@nokia.com) +# +####################################################################### + +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"); + print("\nUsage: patch_capabilities.pl pkg_filename [target-platform] [capability list]\n"); + print(" If template .pkg file is given, next agrument must be 'target-platform'.\n"); + print("\nE.g. patch_capabilities.pl myapp_template.pkg release-armv5 \"All -TCB\"\n"); + exit(); +} + +my @capabilitiesToSet = ("LocalServices", "NetworkServices", "ReadUserData", "UserEnvironment", "WriteUserData"); + +# If arguments were given to the script, +if (@ARGV) +{ + # Parse the first given script argument as a ".pkg" file name. + my $pkgFileName = shift(@ARGV); + + # 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; + unless ($targetplatform = shift(@ARGV)) + { + Usage(); + } + + 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 the specified ".pkg" file exists (and can be read), + if (($pkgFileName =~ m|\.pkg$|i) && -r($pkgFileName)) + { + # If there are more arguments given, parse them as capabilities. + if (@ARGV) + { + @capabilitiesToSet = (); + while (@ARGV) + { + push (@capabilitiesToSet, pop(@ARGV)); + } + } + + # Start with no binaries listed. + my @binaries = (); + + my $tempPkgFileName = $pkgFileName."_@@TEMP@@"; + unlink($tempPkgFileName); + open (NEW_PKG, ">>".$tempPkgFileName); + open (PKG, "<".$pkgFileName); + + # Parse each line. + while (<PKG>) + { + my $line = $_; + my $newLine = $line; + if ( $line =~ m/^\#.*\(0x[0-9|a-f|A-F]*\).*$/) + { + $newLine =~ s/\(0x./\(0xE/; + } + print NEW_PKG $newLine; + + chomp ($line); + + # If the line specifies a file, parse the source and destination locations. + if ($line =~ m|\"([^\"]+)\"\s*\-\s*\"([^\"]+)\"|) + { + my $sourcePath = $1; + my $destinationPath = $2; + + # If the given file is a binary, check the target and binary type (+ the actual filename) from its path. + if ($sourcePath =~ m:/epoc32/release/([^/]+)/(udeb|urel|\$\(TARGET\))/(\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; + } + + push (@binaries, $sourcePath); + } + } + } + + close (PKG); + close (NEW_PKG); + + unlink($pkgFileName); + rename($tempPkgFileName, $pkgFileName); + + print ("\n"); + + my $baseCommandToExecute = "elftran -vid 0x0 -capability \""; + if (@capabilitiesToSet) + { + $baseCommandToExecute .= join(" ", @capabilitiesToSet); + } + $baseCommandToExecute .= "\" "; + + # Actually set the capabilities of the listed binaries. + foreach my $binaryPath(@binaries) + { + # Create the command line for setting the capabilities. + my $commandToExecute = $baseCommandToExecute; + $commandToExecute .= $binaryPath; + + # Actually execute the elftran command to set the capabilities. + system ($commandToExecute." > NUL"); + print ("Executed ".$commandToExecute."\n"); + + ## Create another command line to check that the set capabilities are correct. + #$commandToExecute = "elftran -dump s ".$binaryPath; + } + + print ("\n"); + } +} +else +{ + Usage(); +} @@ -1,7 +1,7 @@ #!/usr/bin/perl -w ###################################################################### # -# Synchronizes Qt header files - internal Qt development tool. +# Synchronizes Qt header files - internal development tool. # # Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). # Contact: Nokia Corporation (qt-info@nokia.com) @@ -24,6 +24,7 @@ $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", @@ -42,6 +43,7 @@ my %modules = ( # path to module name map "QtDBus" => "$basedir/src/dbus", "QtWebKit" => "$basedir/src/3rdparty/webkit/WebCore", "phonon" => "$basedir/src/phonon", + "QtMultimedia" => "$basedir/src/multimedia", ); my %moduleheaders = ( # restrict the module headers to those found in relative path "QtWebKit" => "../WebKit/qt/Api", @@ -687,6 +689,7 @@ foreach (@modules_to_sync) { $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"); } } } |