summaryrefslogtreecommitdiffstats
path: root/qmake/generators
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2019-06-03 14:39:07 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2019-06-03 14:58:39 +0200
commit60136b1a846ca5aedeb588edaa178927abb002ec (patch)
tree1e24064ac1253c0a70f1a832d540ee98c379c0c3 /qmake/generators
parent7029ecade96876d08af7d576e0b81417502acbaa (diff)
Fix meta file replacements if matches are empty
QMake code like rplc.match = QMAKE_PRL_INSTALL_REPLACE += rplc led to the generation of invalid sed calls in the Makefile. It is already actively checked for empty matches, but if *all* matches are empty, the sed call looks like sed foo > bar which is invalid. Task-number: QTBUG-75901 Change-Id: I173ed99826414dcf06253a15a247f7d067ee3977 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'qmake/generators')
-rw-r--r--qmake/generators/makefile.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index bfef31f17e..6edaf1f70e 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3437,19 +3437,23 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
|| project->isActiveConfig("no_sed_meta_install")) {
ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
} else {
- ret += "-$(SED)";
+ QString sedargs;
const ProStringList &replace_rules = project->values(replace_rule);
for (int r = 0; r < replace_rules.size(); ++r) {
const ProString match = project->first(ProKey(replace_rules.at(r) + ".match")),
replace = project->first(ProKey(replace_rules.at(r) + ".replace"));
if (!match.isEmpty() /*&& match != replace*/) {
- ret += " -e " + shellQuote("s," + match + "," + replace + ",g");
+ sedargs += " -e " + shellQuote("s," + match + "," + replace + ",g");
if (isWindowsShell() && project->first(ProKey(replace_rules.at(r) + ".CONFIG")).contains("path"))
- ret += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ sedargs += " -e " + shellQuote("s," + windowsifyPath(match.toQString())
+ "," + windowsifyPath(replace.toQString()) + ",gi");
}
}
- ret += ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ if (sedargs.isEmpty()) {
+ ret += "-$(INSTALL_FILE) " + escapeFilePath(src) + ' ' + escapeFilePath(dst);
+ } else {
+ ret += "-$(SED) " + sedargs + ' ' + escapeFilePath(src) + " > " + escapeFilePath(dst);
+ }
}
return ret;
}