diff options
-rw-r--r-- | bin/createpackage.bat | 105 | ||||
-rw-r--r-- | bin/createpackage.pl | 156 | ||||
-rw-r--r-- | qmake/generators/symbian/initprojectdeploy_symbian.cpp | 2 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 23 | ||||
-rw-r--r-- | qmake/generators/symbian/symmake.h | 2 |
5 files changed, 165 insertions, 123 deletions
diff --git a/bin/createpackage.bat b/bin/createpackage.bat index 116d52b..b5ede18 100644 --- a/bin/createpackage.bat +++ b/bin/createpackage.bat @@ -1,106 +1,3 @@ @echo off - -set installsigned_old=%installsigned% -set pkgfile_old=%pkgfile% -set basename_old=%basename% -set signsis1_old=%signsis1% -set signsis2_old=%signsis2% -set signsis3_old=%signsis3% -set unsigned_sis_name_old=%unsigned_sis_name% -set signed_sis_name_old=%signed_sis_name% -set scriptpath_old=%scriptpath% -set certificate_old=%certificate% - -rem Help text -if "%1"=="" ( - echo Convenience script for creating signed packages you can install on your phone. - echo Usage: createpackage.bat [-i] myexample_armv5_udeb.pkg [certificate key [passphrase]] - echo. - echo If no certificate and key files are provided, either a RnD certificate or - echo a self-signed certificate from Qt installation root directory is used. - echo. - echo To install the package right away using PC suite, use -i argument. - goto done -) - -if "%1"=="-i" ( - set installsigned=true - set pkgfile=%2 - set basename=%~n2 - set signsis1=%3 - set signsis2=%4 - set signsis3=%5 -) else ( - set installsigned=false - set pkgfile=%1 - set basename=%~n1 - set signsis1=%2 - set signsis2=%3 - set signsis3=%4 -) - -set unsigned_sis_name=%basename%_unsigned.sis -set signed_sis_name=%basename%.sis - -rem Get absolute path to this script set scriptpath=%~dp0 - -rem Check the .pkg actually exists. -if not exist %pkgfile% ( - echo Error: Package description file '%pkgfile%' does not exist. - goto done -) - -rem Remove any existing .sis packages -if exist %signed_sis_name% del %signed_sis_name% -if exist %unsigned_sis_name% del %unsigned_sis_name% - -rem Create .sis package -makesis %pkgfile% %unsigned_sis_name% - -rem If no certificate is given, check default options -if x%signsis1% == x ( - rem If RnD certificate is not found, sign with self signed certificate - if not exist %scriptpath%..\rd.cer ( - set certificate=Self signed - signsis %unsigned_sis_name% %signed_sis_name% %scriptpath%..\selfsigned.cer %scriptpath%..\selfsigned.key - goto install - ) - - rem Sign with RnD certificate - set certificate=RnD - signsis %unsigned_sis_name% %signed_sis_name% %scriptpath%..\rd.cer %scriptpath%..\rd-key.pem -) else ( - if x%signsis2% == x ( - echo Custom certificate key file parameter missing. - goto cleanup - ) - - set certificate=%signsis1% - signsis %unsigned_sis_name% %signed_sis_name% %signsis1% %signsis2% %signsis3% -) - -:install -if exist %signed_sis_name% ( - echo Successfully created %signed_sis_name% using certificate %certificate% - if "%installsigned%" == "true" ( - echo Installing %signed_sis_name%... - call %signed_sis_name% - ) -) - -:cleanup -if exist %unsigned_sis_name% del %unsigned_sis_name% - -:done - -set installsigned=%installsigned_old% -set pkgfile=%pkgfile_old% -set basename=%basename_old% -set signsis1=%signsis1_old% -set signsis2=%signsis2_old% -set signsis3=%signsis3_old% -set unsigned_sis_name=%unsigned_sis_name_old% -set signed_sis_name=%signed_sis_name_old% -set scriptpath=%scriptpath_old% -set certificate=%certificate_old% +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..8501174 --- /dev/null +++ b/bin/createpackage.pl @@ -0,0 +1,156 @@ +#!\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 platform target [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 " templatepkg = Name of .pkg file template\n"; + print " platform = One of the supported platform\n"; + print " GCCE | ARMV5 | ARMV6 | ARMV7\n"; + print " target = Either UDEB or UREL\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 "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 = ""; +unless (GetOptions('i|install' => \$install)){ + Usage(); +} + +# Read params to variables +my $templatepkg = $ARGV[0]; +my $platform = uc $ARGV[1]; +my $target = uc $ARGV[2]; +my $visualtarget = $target; +$visualtarget =~ s/udeb/debug/i; +$visualtarget =~ s/urel/release/i; + +my $certificate = $ARGV[3]; +my $key = $ARGV[4]; +my $passphrase = $ARGV[5]; + +# Generate output pkg basename (i.e. file name without extension) +my $pkgoutputbasename = $templatepkg; +$pkgoutputbasename =~ s/_template\.pkg/_$visualtarget-$platform/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; + +# 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/qmake/generators/symbian/initprojectdeploy_symbian.cpp b/qmake/generators/symbian/initprojectdeploy_symbian.cpp index e903fc1..3bc2391 100644 --- a/qmake/generators/symbian/initprojectdeploy_symbian.cpp +++ b/qmake/generators/symbian/initprojectdeploy_symbian.cpp @@ -331,7 +331,7 @@ void initProjectDeploySymbian(QMakeProject* project, if (deployBinaries) { // Executables and libraries are deployed to \sys\bin QFileInfo releasePath(epocRoot() + "epoc32\\release\\" + platform + "\\" + build + "\\"); - deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName()), + deploymentList.append(CopyItem(Option::fixPathToLocalOS(releasePath.absolutePath() + "\\" + info.fileName(), false, true), Option::fixPathToLocalOS(deploymentDrive + QLatin1String(SYSBIN_DIR "\\") + info.fileName()))); } if (isPlugin(info, devicePath)) { diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index c20ecf3..b4d693c 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -194,13 +194,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) } if (generatePkg) { - QStringList platformList = project->values("SYMBIAN_PLATFORMS"); - foreach(QString platform, platformList) { - if (platform.compare("WINSCW", Qt::CaseInsensitive)) { - generatePkgFile(platform.toLower(), "udeb", iconFile); - generatePkgFile(platform.toLower(), "urel", iconFile); - } - } + generatePkgFile(iconFile); } writeBldInfContent(t, generatePkg); @@ -258,13 +252,10 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) return true; } -void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile) +void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile) { - QString build = (config == "udeb") ? "debug" : "release"; - QString pkgFilename = QString("%1_%2-%3.%4") + QString pkgFilename = QString("%1_template.%2") .arg(fileInfo(project->projectFile()).completeBaseName()) - .arg(build) - .arg(compiler) .arg("pkg"); QFile pkgFile(pkgFilename); if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -344,10 +335,8 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QString installPathRegResource = "!:\\private\\10003a3f\\import\\apps"; // Find location of builds - QString epocReleasePath = QString("%1epoc32/release/%2/%3") - .arg(epocRoot()) - .arg(compiler) - .arg(config); + QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)") + .arg(epocRoot()); if (targetType == TypeExe) { @@ -391,7 +380,7 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS QString remoteTestPath; remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); - initProjectDeploySymbian(project, depList, remoteTestPath, true, compiler, config, generatedDirs, generatedFiles); + initProjectDeploySymbian(project, depList, remoteTestPath, true, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); if (depList.size()) t << "; DEPLOYMENT" << endl; for (int i = 0; i < depList.size(); ++i) { diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h index 22dc4c9..2fea29b 100644 --- a/qmake/generators/symbian/symmake.h +++ b/qmake/generators/symbian/symmake.h @@ -84,7 +84,7 @@ protected: QString canonizePath(const QString& origPath); virtual bool writeMakefile(QTextStream &t); - void generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile); + void generatePkgFile(const QString &iconFile); bool containsStartWithItem(const QChar &c, const QStringList& src); virtual void init(); |