From a2f2c87f320873d1968d931ad69a0f640c5545b1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 24 Mar 2010 12:15:34 +0200 Subject: Made it possible to define more than one language using pkg_prerules The pkg statements were generated in invalid order if user used pkg_prerules to redefine languages supported by the pkg file. Also made it possible to override dependency statements autogenerated for Qt and QtWebkit, as these statements need to be user defined in case of multiple languages. Defining the following in .pro removes all dependencies from pkg rules: default_deployment.pkg_prerules -= \ pkg_depends_webkit \ pkg_depends_qt \ pkg_platform_dependencies Task-number: QTBUG-9279 Reviewed-by: Janne Anttila --- mkspecs/common/symbian/symbian.conf | 8 ++++++- mkspecs/features/symbian/qt.prf | 10 +++++--- qmake/generators/symbian/symmake.cpp | 44 ++++++++++++++++++++++++++---------- src/corelib/corelib.pro | 1 - src/gui/gui.pro | 1 - 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 1d00b03..c39b39d 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -135,8 +135,14 @@ INCLUDEPATH = \ # RVCT seems to do this automatically, but WINSCW compiler does not, so add it here. MMP_RULES += "USERINCLUDE ." +# pkg_depends_webkit, pkg_depends_core, and pkg_platform_dependencies can be removed by developer +# if multiple languages need to be supported by pkg file. In that case the developer should declare +# multiple language compatible dependency statements him/herself. + +default_deployment.pkg_prerules += pkg_depends_webkit pkg_depends_qt pkg_platform_dependencies + # Supports S60 3.0, 3.1, 3.2 and 5.0 by default -default_deployment.pkg_prerules = \ +pkg_platform_dependencies = \ "; Default HW/platform dependencies" \ "[0x101F7961],0,0,0,{\"S60ProductID\"}" \ "[0x102032BE],0,0,0,{\"S60ProductID\"}" \ diff --git a/mkspecs/features/symbian/qt.prf b/mkspecs/features/symbian/qt.prf index 275b86a..b2156a9 100644 --- a/mkspecs/features/symbian/qt.prf +++ b/mkspecs/features/symbian/qt.prf @@ -22,19 +22,23 @@ load(qt) INCLUDEPATH = $$PREPEND_INCLUDEPATH $$INCLUDEPATH # Add dependency to Qt package to all other projects besides Qt libs. -# Note: Qt libs with full capabilities has UID3 of 0x2001E61C, +# Note: Qt libs package with full capabilities has UID3 of 0x2001E61C, # while self-signed version typically has temporary UID3 of 0xE001E61C. contains(CONFIG, qt):!contains(TARGET.UID3, 0x2001E61C):!contains(TARGET.UID3, 0xE001E61C):isEmpty(QT_LIBINFIX) { - default_deployment.pkg_prerules += \ + pkg_depends_qt += \ "; Default dependency to Qt libraries" \ "(0x2001E61C), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"Qt\"}" # Projects linking to webkit need dependency to webkit contains(QT, webkit): { - default_deployment.pkg_prerules += \ + pkg_depends_webkit += \ "; Dependency to Qt Webkit" \ "(0x200267C2), $${QT_MAJOR_VERSION}, $${QT_MINOR_VERSION}, $${QT_PATCH_VERSION}, {\"QtWebKit\"}" + } else { + default_deployment.pkg_prerules -= pkg_depends_webkit } +} else { + default_deployment.pkg_prerules -= pkg_depends_webkit pkg_depends_qt } isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index c6023b5..1470a12 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -322,17 +322,36 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme tw << headerComment.arg(wrapperPkgFilename).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 + // in case user wants comments to go with the rules. QStringList rawPkgPreRules; + QStringList languageRules; + QStringList headerRules; foreach(QString deploymentItem, project->values("DEPLOYMENT")) { foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_prerules")) { QStringList pkgrulesValue = project->values(pkgrulesItem); // If there is no stringlist defined for a rule, use rule name directly // This is convenience for defining single line mmp statements if (pkgrulesValue.isEmpty()) { - rawPkgPreRules << pkgrulesItem; + if (pkgrulesItem.startsWith("&")) + languageRules << pkgrulesItem; + else if (pkgrulesItem.startsWith("#")) + headerRules << pkgrulesItem; + else + rawPkgPreRules << pkgrulesItem; } else { - foreach(QString pkgrule, pkgrulesValue) { - rawPkgPreRules << pkgrule; + if (containsStartWithItem('&', pkgrulesValue)) { + foreach(QString pkgrule, pkgrulesValue) { + languageRules << pkgrule; + } + } else if (containsStartWithItem('#', pkgrulesValue)) { + foreach(QString pkgrule, pkgrulesValue) { + headerRules << pkgrule; + } + } else { + foreach(QString pkgrule, pkgrulesValue) { + rawPkgPreRules << pkgrule; + } } } } @@ -340,17 +359,17 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme // Apply some defaults if specific data does not exist in PKG pre-rules - if (!containsStartWithItem('&', rawPkgPreRules)) { + if (languageRules.isEmpty()) { // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS) - QString languageCode = "; Language\n&EN\n\n"; - t << languageCode; - tw << languageCode; - } else { + languageRules << "; Language\n&EN\n\n"; + } else if (headerRules.isEmpty()) { // In case user defines langs, he must take care also about SIS header - if (!containsStartWithItem('#', rawPkgPreRules)) - fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); + fprintf(stderr, "Warning: If language is defined with DEPLOYMENT pkg_prerules, also the SIS header must be defined\n"); } + t << languageRules.join("\n") << endl; + tw << languageRules.join("\n") << endl; + // 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"; @@ -364,9 +383,10 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme tw << installerSisHeader << endl; } - if (!containsStartWithItem('#', rawPkgPreRules)) { + if (headerRules.isEmpty()) t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion); - } + else + t << headerRules.join("\n") << endl; // Localized vendor name QString vendorName; diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index efee610..717b95e 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -38,7 +38,6 @@ symbian: { # Partial upgrade SIS file vendorinfo = \ - "&EN" \ "; Localised Vendor name" \ "%{\"Nokia, Qt\"}" \ " " \ diff --git a/src/gui/gui.pro b/src/gui/gui.pro index d46f3b4..d2401f4 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -60,7 +60,6 @@ symbian: { # Partial upgrade SIS file vendorinfo = \ - "&EN" \ "; Localised Vendor name" \ "%{\"Nokia, Qt\"}" \ " " \ -- cgit v0.12