From 8fe40ca28e88d156b9a0ef9cc4c818a666499231 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 14 May 2010 16:59:11 +0100 Subject: Fix generation of stub sis files Convert paths in DEPLOYMENT to the rom drive (z:) Filter out unwanted parts of the header (dependencies) Task-number: QTBUG-10118 Reviewed-by: Alessandro Portale --- bin/createpackage.pl | 2 +- mkspecs/features/sis_targets.prf | 2 +- qmake/generators/symbian/symbiancommon.cpp | 83 +++++++++++++++++++++++++----- 3 files changed, 71 insertions(+), 16 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 7453ba5..0cc1a9c 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -181,7 +181,7 @@ if ($signed_sis_name eq "") { } my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis"; -my $stub_sis_name = $sisoutputbasename."_stub.sis"; +my $stub_sis_name = $sisoutputbasename.".sis"; # Store some utility variables my $scriptpath = dirname(__FILE__); diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index 7d70fc6..da2d250 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -59,7 +59,7 @@ contains(TEMPLATE, app)|!count(DEPLOYMENT, 1) { ) ok_stub_sis_target.target = ok_stub_sis - ok_stub_sis_target.commands = createpackage.bat -s $(QT_SIS_OPTIONS) $$basename(TARGET)_template.pkg \ + ok_stub_sis_target.commands = createpackage.bat -s $(QT_SIS_OPTIONS) $$basename(TARGET)_stub.pkg \ $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE) QMAKE_EXTRA_TARGETS += sis_target \ diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index adbd009..ce796c3 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -142,6 +142,13 @@ void SymbianCommonGenerator::removeEpocSpecialCharacters(QString& str) removeSpecialCharacters(str); } +QString romPath(const QString& path) +{ + if(path.length() > 2 && path[1] == ':') + return QLatin1String("z:") + path.mid(2); + return QLatin1String("z:") + path; +} + void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocBuild) { QMakeProject *project = generator->project; @@ -150,8 +157,8 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB pkgTarget = project->first("TARGET"); pkgTarget = generator->unescapeFilePath(pkgTarget); pkgTarget = removePathSeparators(pkgTarget); - QString pkgFilename = Option::output_dir + QLatin1Char('/') + QString("%1_template.%2") - .arg(pkgTarget).arg("pkg"); + QString pkgFilename = Option::output_dir + QLatin1Char('/') + + QString("%1_template.pkg").arg(pkgTarget); QFile pkgFile(pkgFilename); if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -159,8 +166,19 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB return; } + QString stubPkgFileName = Option::output_dir + QLatin1Char('/') + + QString("%1_stub.pkg").arg(pkgTarget); + + QFile stubPkgFile(stubPkgFileName); + if (!stubPkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + PRINT_FILE_CREATE_ERROR(stubPkgFileName); + return; + } + generatedFiles << pkgFile.fileName(); QTextStream t(&pkgFile); + generatedFiles << stubPkgFile.fileName(); + QTextStream ts(&stubPkgFile); QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); if (installerSisHeader.isEmpty()) @@ -180,6 +198,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB ";\n\n"; t << headerComment.arg(pkgFilename).arg(dateStr); tw << headerComment.arg(wrapperPkgFilename).arg(dateStr); + ts << headerComment.arg(stubPkgFileName).arg(dateStr); // Construct QStringList from pkg_prerules since we need search it before printed to file // Note: Though there can't be more than one language or header line, use stringlists @@ -229,6 +248,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB t << languageRules.join("\n") << endl; tw << languageRules.join("\n") << endl; + ts << languageRules.join("\n") << endl; // name of application, UID and version QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); @@ -244,10 +264,14 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB tw << installerSisHeader << endl; } - if (headerRules.isEmpty()) + if (headerRules.isEmpty()) { t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); - else + ts << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); + } + else { t << headerRules.join("\n") << endl; + ts << headerRules.join("\n") << endl; + } // Localized vendor name QString vendorName; @@ -262,22 +286,38 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB t << vendorName; tw << vendorName; + ts << vendorName; // PKG pre-rules - these are added before actual file installations i.e. SIS package body if (rawPkgPreRules.size()) { QString comment = "\n; Manual PKG pre-rules from PRO files\n"; t << comment; tw << comment; + ts << comment; foreach(QString item, rawPkgPreRules) { - // Only regular pkg file should have package dependencies or pkg header if that is - // defined using prerules. - if (!item.startsWith("(") && !item.startsWith("#")) { + // Only regular pkg file should have package dependencies + if (item.startsWith("(")) { + t << item << endl; + } + // stub pkg file should not have platform dependencies + else if (item.startsWith("[")) { + t << item << endl; + tw << item << endl; + } + // Only regular and stub should have pkg header if that is defined using prerules. + else if (!item.startsWith("#")) { + t << item << endl; + ts << item << endl; + } + else { + t << item << endl; + ts << item << endl; tw << item << endl; } - t << item << endl; } t << endl; + ts << endl; tw << endl; } @@ -319,41 +359,54 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // deploy .exe file t << "; Executable and default resource files" << endl; QString exeFile = fixedTarget + ".exe"; - t << QString("\"%1/%2\" - \"%3\\%4\"") + t << QString("\"%1/%2\" - \"%3\\%4\"") .arg(destDirBin) .arg(exeFile) .arg(installPathBin) .arg(exeFile) << endl; + ts << QString("\"\" - \"%1\\%2\"") + .arg(romPath(installPathBin)) + .arg(exeFile) << endl; // deploy rsc & reg_rsc file if (!project->isActiveConfig("no_icon")) { - t << QString("\"%1/%2\" - \"%3\\%4\"") + t << QString("\"%1/%2\" - \"%3\\%4\"") .arg(destDirResource) .arg(fixedTarget + ".rsc") .arg(installPathResource) .arg(fixedTarget + ".rsc") << endl; + ts << QString("\"\" - \"%1\\%2\"") + .arg(romPath(installPathResource)) + .arg(fixedTarget + ".rsc") << endl; - t << QString("\"%1/%2\" - \"%3\\%4\"") + t << QString("\"%1/%2\" - \"%3\\%4\"") .arg(destDirRegResource) .arg(fixedTarget + "_reg.rsc") .arg(installPathRegResource) .arg(fixedTarget + "_reg.rsc") << endl; + ts << QString("\"\" - \"%1\\%2\"") + .arg(romPath(installPathRegResource)) + .arg(fixedTarget + "_reg.rsc") << endl; if (!iconFile.isEmpty()) { if (epocBuild) { - t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") + t << QString("\"%1epoc32/data/z%2\" - \"!:%3\"") .arg(epocRoot()) .arg(iconFile) .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + ts << QString("\"\" - \"%1\"") + .arg(romPath(QDir::toNativeSeparators(iconFile))) << endl << endl; } else { QDir mifIconDir(project->first("DESTDIR")); QFileInfo mifIcon(mifIconDir.relativeFilePath(project->first("TARGET"))); QString mifIconFileName = mifIcon.fileName(); mifIconFileName.append(".mif"); - t << QString("\"%1/%2\" - \"!:%3\"") + t << QString("\"%1/%2\" - \"!:%3\"") .arg(mifIcon.path()) .arg(mifIconFileName) .arg(QDir::toNativeSeparators(iconFile)) << endl << endl; + ts << QString("\"\" - \"%1\"") + .arg(romPath(QDir::toNativeSeparators(iconFile))) << endl << endl; } } } @@ -389,9 +442,11 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB } } - t << QString("\"%1\" - \"%2\"").arg(from.replace('\\','/')).arg(to) << endl; + t << QString("\"%1\" - \"%2\"").arg(from.replace('\\','/')).arg(to) << endl; + ts << QString("\"\" - \"%1\"").arg(romPath(to)) << endl; } t << endl; + ts << endl; // PKG post-rules - these are added after actual file installations i.e. SIS package body t << "; Manual PKG post-rules from PRO files" << endl; -- cgit v0.12