summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-09-06 10:36:09 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-09-06 13:08:20 (GMT)
commitd3064666be3909583ccdb873672011d1db4588e4 (patch)
treedc42e967f236f1b0aeec3e380662d704abea8fe6
parentf4bada8cbba5f209556ad4e3703d412e4146a0af (diff)
downloadQt-d3064666be3909583ccdb873672011d1db4588e4.zip
Qt-d3064666be3909583ccdb873672011d1db4588e4.tar.gz
Qt-d3064666be3909583ccdb873672011d1db4588e4.tar.bz2
Fixes for QMAKE_EXTRA_* variable handling in symbian-sbsv2
- No longer require PRE_TARGETDEPS items to be absolute, which was difficult to achieve sometimes as qmake doesn't provide method for absolutizing paths. - Do smart command replacement for commands containing $$QMAKE_* command variables, such as $$QMAKE_COPY, when generating bld.inf extensions for QMAKE_EXTRA_* variables. $$QMAKE_* command variables cannot be passed to sbsv2 toolchain directly, as it uses cygwin in windows, and they can't simply be replaced to use sbsv2 equivalents in symbian.conf, because generated wrapper makefiles need them to be Windows compatible. Reviewed-by: axis
-rw-r--r--mkspecs/common/symbian/symbian-mmp.conf12
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp43
2 files changed, 47 insertions, 8 deletions
diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf
index 4230ad7..5292781 100644
--- a/mkspecs/common/symbian/symbian-mmp.conf
+++ b/mkspecs/common/symbian/symbian-mmp.conf
@@ -55,3 +55,15 @@ symbian {
}
}
}
+
+# Variables for replacing equivalent QMAKE_* variables in bld.inf for FLM execution of commands
+symbian-sbsv2 {
+ QMAKE_SBSV2_COPY = $(GNUCP)
+ QMAKE_SBSV2_COPY_DIR = $(GNUCP) -r
+ QMAKE_SBSV2_MOVE = $(GNUMV)
+ QMAKE_SBSV2_DEL_FILE = $(GNURM) -f
+ QMAKE_SBSV2_MKDIR = $(GNUMKDIR)
+ QMAKE_SBSV2_DEL_DIR = $(GNURMDIR)
+ QMAKE_SBSV2_DEL_TREE = $(GNURM) -rf
+}
+
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index e794351..c66c1b8 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -413,6 +413,28 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
}
}
+ QMap<QString, QString> commandsToReplace;
+ commandsToReplace.insert(project->values("QMAKE_COPY").join(" "),
+ project->values("QMAKE_SBSV2_COPY").join(" "));
+ commandsToReplace.insert(project->values("QMAKE_COPY_DIR").join(" "),
+ project->values("QMAKE_SBSV2_COPY_DIR").join(" "));
+ commandsToReplace.insert(project->values("QMAKE_MOVE").join(" "),
+ project->values("QMAKE_SBSV2_MOVE").join(" "));
+ commandsToReplace.insert(project->values("QMAKE_DEL_FILE").join(" "),
+ project->values("QMAKE_SBSV2_DEL_FILE").join(" "));
+ commandsToReplace.insert(project->values("QMAKE_MKDIR").join(" "),
+ project->values("QMAKE_SBSV2_MKDIR").join(" "));
+ commandsToReplace.insert(project->values("QMAKE_DEL_DIR").join(" "),
+ project->values("QMAKE_SBSV2_DEL_DIR").join(" "));
+ commandsToReplace.insert(project->values("QMAKE_DEL_TREE").join(" "),
+ project->values("QMAKE_SBSV2_DEL_TREE").join(" "));
+
+ // If commandItem starts with any $$QMAKE_* commands, do a replace for SBS equivalent
+ // Command replacement is done only for the start of the command or right after
+ // concatenation operators (&& and ||), as otherwise unwanted replacements might occur.
+ static QString cmdFind("(^|&&\\s*|\\|\\|\\s*)%1");
+ static QString cmdReplace("\\1%1");
+
// Write extra compilers and targets to initialize QMAKE_ET_* variables
// Cache results to avoid duplicate calls when creating wrapper makefile
QTextStream extraCompilerStream(&extraCompilersCache);
@@ -424,13 +446,7 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
// are not necessary.
QStringList allPreDeps;
foreach(QString item, project->values("PRE_TARGETDEPS")) {
- // Predeps get mangled in windows, so fix them to more sbsv2 friendly format
-#if defined(Q_OS_WIN)
- if (item.mid(1, 1) == ":")
- item = item.mid(0, 1).toUpper().append(item.mid(1)); // Fix drive to uppercase
-#endif
- item.replace("\\", "/");
- allPreDeps << escapeDependencyPath(item);
+ allPreDeps.append(fileInfo(item).absoluteFilePath());
}
foreach (QString item, project->values("GENERATED_SOURCES")) {
@@ -460,7 +476,6 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
QStringList deps = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_DEPS.") + item + targetItem);
QString commandItem = project->values(QLatin1String("QMAKE_INTERNAL_ET_PARSED_CMD.") + item + targetItem).join(" ");
-
// Make sure all deps paths are absolute
QString absoluteDeps;
foreach (QString depItem, deps) {
@@ -474,6 +489,18 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
t << "OPTION PREDEP_TARGET " << absoluteTarget << endl;
t << "OPTION DEPS " << absoluteDeps << endl;
+ // Iterate command replacements in reverse alphabetical order of keys so
+ // that keys which are starts of other longer keys are iterated after longer keys.
+ QMapIterator<QString, QString> cmdIter(commandsToReplace);
+ cmdIter.toBack();
+ while (cmdIter.hasPrevious()) {
+ cmdIter.previous();
+ if (commandItem.contains(cmdIter.key())) {
+ commandItem.replace(QRegExp(cmdFind.arg(cmdIter.key())),
+ cmdReplace.arg(cmdIter.value()));
+ }
+ }
+
if (commandItem.indexOf("$(INCPATH)") != -1)
commandItem.replace("$(INCPATH)", incPath.join(" "));
if (commandItem.indexOf("$(DEFINES)") != -1)