summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-11-05 14:20:00 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-11-08 09:51:36 (GMT)
commite8b10f2239a15e8d0ad1b676b7f03d03543efc67 (patch)
tree33cc4ac939182de63f0233d579982c82189377f4 /qmake
parentd3f8374c9e980b9e74cde2ee6cba8dd8312e5ac4 (diff)
downloadQt-e8b10f2239a15e8d0ad1b676b7f03d03543efc67.zip
Qt-e8b10f2239a15e8d0ad1b676b7f03d03543efc67.tar.gz
Qt-e8b10f2239a15e8d0ad1b676b7f03d03543efc67.tar.bz2
Allow pkg_prerules and pkg_postrules to be targeted to separate files
Pkg_prerules and pkg_postrules can now be targeted to apply only to main template pkg, installer pkg, or stub pkg file using .main, .installer, or .stub suffix on the variable. Also clarified documentation of these variables. Cherry picked to 4.7 branch from master branch as part of QTBUG-15068, original commit: a537137fffd72d153a35828228c00567a563e787 Task-number: QTBUG-15068 Task-number: QTBUG-13159 Reviewed-by: axis Conflicts: doc/src/development/qmake-manual.qdoc doc/src/snippets/code/doc_src_qmake-manual.qdoc
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/symbian/symbiancommon.cpp235
-rw-r--r--qmake/generators/symbian/symbiancommon.h11
2 files changed, 167 insertions, 79 deletions
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index 6fea8fd..3183e27 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -204,44 +204,71 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB
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
+ QStringList commonRawPreRules;
+ QStringList mainRawPreRules;
+ QStringList instRawPreRules;
+ QStringList stubRawPreRules;
+
+ // 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;
+ // Note that it makes no sense to have file specific language or header rules,
+ // except what is provided for installer header via "DEPLOYMENT.installer_header" variable,
+ // because stub and main headers should always match. Vendor rules are similarly limited to
+ // make code cleaner as it is unlikely anyone will want different vendor in different files.
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()) {
- if (pkgrulesItem.startsWith("&"))
- languageRules << pkgrulesItem;
- else if (pkgrulesItem.startsWith("#"))
- headerRules << pkgrulesItem;
- else
- rawPkgPreRules << pkgrulesItem;
- } else {
- 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;
- }
- }
- }
+ QStringList vendorRules;
+
+ QStringList commonRawPostRules;
+ QStringList mainRawPostRules;
+ QStringList instRawPostRules;
+ QStringList stubRawPostRules;
+
+ QStringList failList; // Used for detecting incorrect usage
+
+ QString emptySuffix;
+ QString mainSuffix(".main");
+ QString instSuffix(".installer");
+ QString stubSuffix(".stub");
+
+ foreach(QString item, project->values("DEPLOYMENT")) {
+ parsePreRules(item, emptySuffix, &commonRawPreRules, &languageRules, &headerRules, &vendorRules);
+ parsePreRules(item, mainSuffix, &mainRawPreRules, &failList, &failList, &failList);
+ parsePreRules(item, instSuffix, &instRawPreRules, &failList, &failList, &failList);
+ parsePreRules(item, stubSuffix, &stubRawPreRules, &failList, &failList, &failList);
+
+ parsePostRules(item, emptySuffix, &commonRawPostRules);
+ parsePostRules(item, mainSuffix, &mainRawPostRules);
+ parsePostRules(item, instSuffix, &instRawPostRules);
+ parsePostRules(item, stubSuffix, &stubRawPostRules);
+ }
+
+ if (!failList.isEmpty()) {
+ fprintf(stderr, "Warning: Custom language, header, or vendor definitions are not "
+ "supported by file specific pkg_prerules.* variables.\n"
+ "Use plain pkg_prerules and/or DEPLOYMENT.installer_header for customizing "
+ "these items.\n");
+ }
+
+ foreach(QString item, commonRawPreRules) {
+ if (item.startsWith("(")) {
+ // Only regular pkg file should have package dependencies
+ mainRawPreRules << item;
+ } else if (item.startsWith("[")) {
+ // stub pkg file should not have platform dependencies
+ mainRawPreRules << item;
+ instRawPreRules << item;
+ } else {
+ mainRawPreRules << item;
+ instRawPreRules << item;
+ stubRawPreRules << item;
}
}
- // Apply some defaults if specific data does not exist in PKG pre-rules
+ // Currently common postrules only go to main
+ mainRawPostRules << commonRawPostRules;
+ // Apply some defaults if specific data does not exist in PKG pre-rules
if (languageRules.isEmpty()) {
// language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS)
languageRules << "; Language\n&EN\n\n";
@@ -313,49 +340,38 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB
ts << headerRules.join("\n") << endl;
}
- // Localized vendor name
- QString vendorName;
- if (!containsStartWithItem('%', rawPkgPreRules)) {
- vendorName += "; Localised Vendor name\n%{\"Vendor\"}\n\n";
+ // Vendor name
+ if (!containsStartWithItem('%', vendorRules)) {
+ vendorRules << "; Default localized vendor name\n%{\"Vendor\"}\n\n";
}
-
- // Unique vendor name
- if (!containsStartWithItem(':', rawPkgPreRules)) {
- vendorName += "; Unique Vendor name\n:\"Vendor\"\n\n";
+ if (!containsStartWithItem(':', vendorRules)) {
+ vendorRules << "; Default unique vendor name\n:\"Vendor\"\n\n";
}
- t << vendorName;
- tw << vendorName;
- ts << vendorName;
+ t << vendorRules.join("\n") << endl;
+ tw << vendorRules.join("\n") << endl;
+ ts << vendorRules.join("\n") << endl;
// 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";
+ QString comment = "\n; Manual PKG pre-rules from PRO files\n";
+
+ if (mainRawPreRules.size()) {
t << comment;
+ t << mainRawPreRules.join("\n") << endl;
+ }
+ if (instRawPreRules.size()) {
tw << comment;
+ tw << instRawPreRules.join("\n") << endl;
+ }
+ if (stubRawPreRules.size()) {
ts << comment;
-
- foreach(QString item, rawPkgPreRules) {
- // 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;
- }
- else {
- t << item << endl;
- ts << item << endl;
- tw << item << endl;
- }
- }
- t << endl;
- ts << endl;
- tw << endl;
+ ts << stubRawPreRules.join("\n") << endl;
}
+ t << endl;
+ tw << endl;
+ ts << endl;
+
// Begin Manufacturer block
if (!project->values("DEPLOYMENT.manufacturers").isEmpty()) {
QString manufacturerStr("IF ");
@@ -481,21 +497,19 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB
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;
- foreach(QString deploymentItem, project->values("DEPLOYMENT")) {
- foreach(QString pkgrulesItem, project->values(deploymentItem + ".pkg_postrules")) {
- 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 statements
- if (pkgrulesValue.isEmpty()) {
- t << pkgrulesItem << endl;
- } else {
- foreach(QString pkgrule, pkgrulesValue) {
- t << pkgrule << endl;
- }
- }
- t << endl;
- }
+ comment = "; Manual PKG post-rules from PRO files\n";
+
+ if (mainRawPostRules.size()) {
+ t << comment;
+ t << mainRawPostRules.join("\n") << endl;
+ }
+ if (instRawPostRules.size()) {
+ tw << comment;
+ tw << instRawPostRules.join("\n") << endl;
+ }
+ if (stubRawPostRules.size()) {
+ ts << comment;
+ ts << stubRawPostRules.join("\n") << endl;
}
// Close Manufacturer block
@@ -1037,3 +1051,66 @@ void SymbianCommonGenerator::fillQt2S60LangMapTable()
qt2S60LangMapTable.insert("ny", "SC"); //Chewa //
}
+void SymbianCommonGenerator::parsePreRules(const QString &deploymentVariable,
+ const QString &variableSuffix,
+ QStringList *rawRuleList,
+ QStringList *languageRuleList,
+ QStringList *headerRuleList,
+ QStringList *vendorRuleList)
+{
+ QMakeProject *project = generator->project;
+ foreach(QString pkgrulesItem, project->values(deploymentVariable + ".pkg_prerules" + variableSuffix)) {
+ 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 statements
+ if (pkgrulesValue.isEmpty()) {
+ if (pkgrulesItem.startsWith("&"))
+ *languageRuleList << pkgrulesItem;
+ else if (pkgrulesItem.startsWith("#"))
+ *headerRuleList << pkgrulesItem;
+ else if (pkgrulesItem.startsWith("%") || pkgrulesItem.startsWith(":"))
+ *vendorRuleList << pkgrulesItem;
+ else
+ *rawRuleList << pkgrulesItem;
+ } else {
+ if (containsStartWithItem('&', pkgrulesValue)) {
+ foreach(QString pkgrule, pkgrulesValue) {
+ *languageRuleList << pkgrule;
+ }
+ } else if (containsStartWithItem('#', pkgrulesValue)) {
+ foreach(QString pkgrule, pkgrulesValue) {
+ *headerRuleList << pkgrule;
+ }
+ } else if (containsStartWithItem('%', pkgrulesValue)
+ || containsStartWithItem(':', pkgrulesValue)) {
+ foreach(QString pkgrule, pkgrulesValue) {
+ *vendorRuleList << pkgrule;
+ }
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ *rawRuleList << pkgrule;
+ }
+ }
+ }
+ }
+}
+
+void SymbianCommonGenerator::parsePostRules(const QString &deploymentVariable,
+ const QString &variableSuffix,
+ QStringList *rawRuleList)
+{
+ QMakeProject *project = generator->project;
+ foreach(QString pkgrulesItem, project->values(deploymentVariable + ".pkg_postrules" + variableSuffix)) {
+ 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 statements
+ if (pkgrulesValue.isEmpty()) {
+ *rawRuleList << pkgrulesItem;
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ *rawRuleList << pkgrule;
+ }
+ }
+ }
+}
+
diff --git a/qmake/generators/symbian/symbiancommon.h b/qmake/generators/symbian/symbiancommon.h
index dae1e4a..80f2079 100644
--- a/qmake/generators/symbian/symbiancommon.h
+++ b/qmake/generators/symbian/symbiancommon.h
@@ -86,6 +86,17 @@ protected:
QStringList symbianLangCodesFromTsFiles();
void fillQt2S60LangMapTable();
+ void parsePreRules(const QString &deploymentVariable,
+ const QString &variableSuffix,
+ QStringList *rawRuleList,
+ QStringList *languageRuleList,
+ QStringList *headerRuleList,
+ QStringList *vendorRuleList);
+ void parsePostRules(const QString &deploymentVariable,
+ const QString &variableSuffix,
+ QStringList *rawRuleList);
+
+
protected:
MakefileGenerator *generator;