summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-07-29 05:37:57 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-07-29 05:37:57 (GMT)
commitd050cb9c44d3c185a36f2af8be36ab70ce7a794e (patch)
tree5b7a9e3a37c22f7da643114e42531f68ff15f382 /qmake
parent369d1e0999d1fd130777e0f48831734d30d03efa (diff)
downloadQt-d050cb9c44d3c185a36f2af8be36ab70ce7a794e.zip
Qt-d050cb9c44d3c185a36f2af8be36ab70ce7a794e.tar.gz
Qt-d050cb9c44d3c185a36f2af8be36ab70ce7a794e.tar.bz2
Extended PKG customization possibilities via qmake.
Task: 242139 This commit replaces Symbian specific 'depends' keyword in qmake DEPLOYMENT variable with two more generic ones. The new keywords are 'pkg_prerules' and 'pkg_postrules', and they allow developer to pass raw data to PKG file. The strings in 'pkg_prerules' are added before PKG file package-body headers and 'pkg_postrules' after them. Correspondingly as old 'depends' keyword, the new keywords are not parsed by qmake, so they must be in a format understood by Symbian package generation tools. Note that 'pkg_prerules' can also replace default language, package-header and vendor statements in pkg file. If you decide to override any of these statements, you need to pay attention that also other statements stay valid.
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/symbian/symmake.cpp106
-rw-r--r--qmake/generators/symbian/symmake.h1
2 files changed, 85 insertions, 22 deletions
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index ec19675..34ab560 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -286,36 +286,67 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS
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;
-
- // language, (*** hardcoded to english atm)
- t << "; Language" << endl;
- t << "&EN" << endl << endl;
+
+ // Construct QStringList from pkg_prerules since we need search it before printed to file
+ QStringList rawPkgPreRules;
+ 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;
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ rawPkgPreRules << pkgrule;
+ }
+ }
+ }
+ }
+
+ // Apply some defaults if specific data does not exist in PKG pre-rules
+
+ if(!containsStartWithItem('&', rawPkgPreRules)) {
+ // language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS)
+ t << "; Language" << endl;
+ t << "&EN" << endl << endl;
+ } else {
+ // 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");
+ }
// name of application, UID and version
QString applicationName = project->first("TARGET");
int last = applicationName.lastIndexOf(QLatin1Char('/'));
applicationName = applicationName.mid( last == -1 ? 0 : last+1 );
-
QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ',');
+
+ if(!containsStartWithItem('#', rawPkgPreRules)) {
+ t << "; SIS header: name, uid, version" << endl;
+ t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl;
+ }
- t << "; SIS header: name, uid, version" << endl;
- t << QString("#{\"%1\"},(%2),%3").arg(applicationName).arg(uid3).arg(applicationVersion) << endl << endl;
-
- // vendor names (*** hardcoded for now)
- t << "; Localised Vendor name" << endl;
- t << "%{\"Nokia, Qt Software\"}" << endl << endl;
- t << "; Unique Vendor name" << endl;
- t << ":\"Nokia, Qt Software\"" << endl << endl;
-
- // Dependencies
- t << "; Dependencies" << endl;
- foreach(QString item, project->values("DEPLOYMENT")) {
- QStringList dependencies = project->values(item + ".depends");
- foreach(QString dependency, dependencies) {
- t << dependency << endl;
- }
+ // Localized vendor name
+ if(!containsStartWithItem('%', rawPkgPreRules)) {
+ t << "; Localised Vendor name" << endl;
+ t << "%{\"Vendor\"}" << endl << endl;
+ }
+
+ // Unique vendor name
+ if(!containsStartWithItem(':', rawPkgPreRules)) {
+ t << "; Unique Vendor name" << endl;
+ t << ":\"Vendor\"" << endl << endl;
}
- t << endl;
+
+ // PKG pre-rules - these are added before actual file installations i.e. SISX package body
+ if(rawPkgPreRules.size()) {
+ t << "; Manual PKG pre-rules from PRO files" << endl;
+ foreach(QString item, rawPkgPreRules) {
+ t << item << endl;
+ }
+ t << endl;
+ }
// install paths on the phone *** should be dynamic at some point
QString installPathBin = "!:\\sys\\bin";
@@ -378,10 +409,41 @@ bool SymbianMakefileGenerator::generatePkgFile(const QString &compiler, const QS
.arg(QString(depList.at(i).from).replace('\\','/'))
.arg(depList.at(i).to) << endl;
}
+ t << endl;
+
+ // PKG post-rules - these are added after actual file installations i.e. SISX 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 mmp statements
+ if (pkgrulesValue.isEmpty()){
+ t << pkgrulesItem << endl;
+ } else {
+ foreach(QString pkgrule, pkgrulesValue) {
+ t << pkgrule << endl;
+ }
+ }
+ t << endl;
+ }
+ }
return true;
}
+bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src)
+{
+ bool result = false;
+ foreach (QString str, src) {
+ if (str.startsWith(c)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+}
+
bool SymbianMakefileGenerator::writeCustomDefFile() {
if(targetType.compare("plugin", Qt::CaseInsensitive) == 0 && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) {
// Create custom def file for plugin
diff --git a/qmake/generators/symbian/symmake.h b/qmake/generators/symbian/symmake.h
index 52c3c4d..aade0a0 100644
--- a/qmake/generators/symbian/symmake.h
+++ b/qmake/generators/symbian/symmake.h
@@ -86,6 +86,7 @@ protected:
virtual bool writeMakefile(QTextStream &t);
bool generatePkgFile(const QString &compiler, const QString &config, const QString &iconFile);
+ bool containsStartWithItem(const QChar &c, const QStringList& src);
virtual void init();