diff options
Diffstat (limited to 'qmake/generators/symbian/symbiancommon.cpp')
-rw-r--r-- | qmake/generators/symbian/symbiancommon.cpp | 90 |
1 files changed, 72 insertions, 18 deletions
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index b730d9e..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,9 +157,8 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB pkgTarget = project->first("TARGET"); pkgTarget = generator->unescapeFilePath(pkgTarget); pkgTarget = removePathSeparators(pkgTarget); - QString pkgFilename = QString("%1_template.%2").arg(pkgTarget).arg("pkg"); - if (!Option::output_dir.isEmpty()) - pkgFilename = Option::output_dir + '/' + pkgFilename; + QString pkgFilename = Option::output_dir + QLatin1Char('/') + + QString("%1_template.pkg").arg(pkgTarget); QFile pkgFile(pkgFilename); if (!pkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { @@ -160,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()) @@ -173,14 +190,15 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB QString dateStr = QDateTime::currentDateTime().toString(Qt::ISODate); // Header info - QString wrapperPkgFilename = QString("%1_installer.%2") - .arg(pkgTarget) - .arg("pkg"); + QString wrapperPkgFilename = Option::output_dir + QLatin1Char('/') + QString("%1_installer.%2") + .arg(pkgTarget).arg("pkg"); + QString headerComment = "; %1 generated by qmake at %2\n" "; This file is generated by qmake and should not be modified by the user\n" ";\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 @@ -230,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('.', ','); @@ -245,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; @@ -263,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; } @@ -320,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; } } } @@ -390,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; |