summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2011-01-20 11:58:58 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-01-26 07:31:20 (GMT)
commit30cc65cc395d2793a5ea43fdc34373c07f07dffd (patch)
treebf7425902435e0df13649c59c1a741aaf387bfdc
parentf2b1d67146193709b4657ca45a9a0f496da70823 (diff)
downloadQt-30cc65cc395d2793a5ea43fdc34373c07f07dffd.zip
Qt-30cc65cc395d2793a5ea43fdc34373c07f07dffd.tar.gz
Qt-30cc65cc395d2793a5ea43fdc34373c07f07dffd.tar.bz2
Improved QMAKE_POST_LINK support in symbian-sbsv2
QMAKE_POST_LINK value handling now uses the same automatic replacements as QMAKE_EXTRA_COMPILERS and QMAKE_EXTRA_TARGETS handling. In practice this means that it is now possible to use $$QMAKE_COPY and friends in QMAKE_POST_LINK value also with symbian-sbsv2 mkspec, and that any backslashes in the value are assumed to be path separators and will be converted to forward slashes. Task-number: QTBUG-16753 Reviewed-by: Janne Koskinen (cherry picked from commit 9fec1802952457178a9b31c55b4c6e3ea60fcb80)
-rw-r--r--qmake/generators/symbian/symmake_sbsv2.cpp56
1 files changed, 34 insertions, 22 deletions
diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp
index 47c5b31..6d01523 100644
--- a/qmake/generators/symbian/symmake_sbsv2.cpp
+++ b/qmake/generators/symbian/symmake_sbsv2.cpp
@@ -72,6 +72,35 @@ static QString sbsRvctPrefix;
extern char **environ;
#endif
+static void fixFlmCmd(QString *cmdLine, const QMap<QString, QString> &commandsToReplace)
+{
+ // 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(QLatin1String("(^|&&\\s*|\\|\\|\\s*)%1"));
+ static QString cmdReplace(QLatin1String("\\1%1"));
+
+ // $$escape_expand(\\n\\t) doesn't work for bld.inf files, but is often used as command
+ // separator, so replace it with "&&" command concatenator.
+ cmdLine->replace("\n\t", "&&");
+
+ // 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 (cmdLine->contains(cmdIter.key()))
+ cmdLine->replace(QRegExp(cmdFind.arg(cmdIter.key())), cmdReplace.arg(cmdIter.value()));
+ }
+
+ // Sbsv2 toolchain strips all backslashes (even double ones) from option parameters, so just
+ // assume all backslashes are directory separators and replace them with slashes.
+ // Problem: If some command actually needs backslashes for something else than dir separator,
+ // we are out of luck.
+ cmdLine->replace("\\", "/");
+}
+
// Copies Qt FLMs to correct location under epocroot.
// This is not done by configure as it is possible to change epocroot after configure.
void SymbianSbsv2MakefileGenerator::exportFlm()
@@ -563,12 +592,6 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
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);
@@ -623,26 +646,13 @@ 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)
commandItem.replace("$(DEFINES)", defines.join(" "));
- // Sbsv2 strips all backslashes (even doubles ones) from option parameters, so just replace them with slashes
- // Problem: If some command actually needs backslashes for something else than dir separator, we are out of luck...
- commandItem.replace("\\", "/");
+ fixFlmCmd(&commandItem, commandsToReplace);
+
t << "OPTION COMMAND " << commandItem << endl;
t << "END" << endl;
}
@@ -672,8 +682,10 @@ void SymbianSbsv2MakefileGenerator::writeBldInfExtensionRulesPart(QTextStream& t
// Write post link rules
if (!project->isEmpty("QMAKE_POST_LINK")) {
+ QString postLinkCmd = var("QMAKE_POST_LINK");
+ fixFlmCmd(&postLinkCmd, commandsToReplace);
t << "START EXTENSION qt/qmake_post_link" << endl;
- t << "OPTION POST_LINK_CMD " << var("QMAKE_POST_LINK") << endl;
+ t << "OPTION POST_LINK_CMD " << postLinkCmd << endl;
t << "OPTION LINK_TARGET " << removePathSeparators(escapeFilePath(fileFixify(project->first("TARGET"))).append(".").append(getTargetExtension())) << endl;
t << "END" << endl;
t << endl;