diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/symbian/symmake.cpp | 86 |
1 files changed, 69 insertions, 17 deletions
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 13c4fd4..5e27af5 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -299,12 +299,23 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme } generatedFiles << pkgFile.fileName(); + QTextStream t(&pkgFile); + + QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); + QString wrapperStreamBuffer; + QTextStream tw(&wrapperStreamBuffer); + + QString dateStr = QDateTime::currentDateTime().toString(Qt::ISODate); // Header info - QTextStream t(&pkgFile); - t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl; - t << "; This file is generated by qmake and should not be modified by the user" << endl; - t << ";" << endl << endl; + QString wrapperPkgFilename = QString("%1_installer.%2") + .arg(fixedTarget) + .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); // Construct QStringList from pkg_prerules since we need search it before printed to file QStringList rawPkgPreRules; @@ -327,8 +338,9 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme if (!containsStartWithItem('&', rawPkgPreRules)) { // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) - t << "; Language" << endl; - t << "&EN" << endl << endl; + QString languageCode = "; Language\n&EN\n\n"; + t << languageCode; + tw << languageCode; } else { // In case user defines langs, he must take care also about SIS header if (!containsStartWithItem('#', rawPkgPreRules)) @@ -337,34 +349,51 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme // name of application, UID and version QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); + QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n"; + QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET"))); + visualTarget = removePathSeparators(visualTarget); + QString wrapperTarget = visualTarget + " installer"; - if (!containsStartWithItem('#', rawPkgPreRules)) { - QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET"))); - visualTarget = removePathSeparators(visualTarget); + if (installerSisHeader.startsWith("0x", Qt::CaseInsensitive)) { + tw << sisHeader.arg(wrapperTarget).arg(installerSisHeader).arg(applicationVersion); + } else { + tw << installerSisHeader << endl; + } - t << "; SIS header: name, uid, version" << endl; - t << QString("#{\"%1\"},(%2),%3").arg(visualTarget).arg(uid3).arg(applicationVersion) << endl << endl; + if (!containsStartWithItem('#', rawPkgPreRules)) { + t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); } // Localized vendor name + QString vendorName; if (!containsStartWithItem('%', rawPkgPreRules)) { - t << "; Localised Vendor name" << endl; - t << "%{\"Vendor\"}" << endl << endl; + vendorName += "; Localised Vendor name\n%{\"Vendor\"}\n\n"; } // Unique vendor name if (!containsStartWithItem(':', rawPkgPreRules)) { - t << "; Unique Vendor name" << endl; - t << ":\"Vendor\"" << endl << endl; + vendorName += "; Unique Vendor name\n:\"Vendor\"\n\n"; } + t << vendorName; + tw << vendorName; + // PKG pre-rules - these are added before actual file installations i.e. SIS package body if (rawPkgPreRules.size()) { - t << "; Manual PKG pre-rules from PRO files" << endl; + QString comment = "\n; Manual PKG pre-rules from PRO files\n"; + t << comment; + tw << 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("#")) { + tw << item << endl; + } t << item << endl; } t << endl; + tw << endl; } // Begin Manufacturer block @@ -387,7 +416,6 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)") .arg(epocRoot()); - if (targetType == TypeExe) { // deploy .exe file t << "; Executable and default resource files" << endl; @@ -476,6 +504,30 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme << " - \"\", FILETEXT, TEXTEXIT" << endl << "ENDIF ; MANUFACTURER" << endl; } + + // Write wrapper pkg + if (!installerSisHeader.isEmpty()) { + QFile wrapperPkgFile(wrapperPkgFilename); + if (!wrapperPkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) { + PRINT_FILE_CREATE_ERROR(wrapperPkgFilename); + return; + } + + generatedFiles << wrapperPkgFile.fileName(); + QTextStream twf(&wrapperPkgFile); + + twf << wrapperStreamBuffer << endl; + + // Wrapped files deployment + QString currentPath = qmake_getpwd(); + QString sisName = QString("%1.sis").arg(fixedTarget); + twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl; + + QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); + bootStrapPath.append("/bootstrap.sis"); + QFileInfo fi(fileInfo(bootStrapPath)); + twf << "@\"" << fi.absoluteFilePath() << "\",(0x2002CCCD)" << endl; + } } bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src) |