properly replace windows paths in installed meta files

it's bogus in the first place that the meta files contain windows paths,
but straightening that out is a prohibitive effort. so instead generate
additional s/// commands which take care of these paths.

fwiw, the generated s///i command is a gnu extension. but as we are
doing this on windows only where we are using our built-in sed command
anyway, this should be fine.

Task-number: QTBUG-33794
Change-Id: I46fcc598db12816ee56b5371ab184f6277eb3a22
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-11-20 15:14:52 +01:00 committed by The Qt Project
parent 39baff5847
commit 53f48a4ba2
3 changed files with 15 additions and 1 deletions

View File

@ -146,8 +146,10 @@ unix|win32-g++* {
rplbase = $$MODULE_BASE_OUTDIR
include_replace.match = $$rplbase/include
include_replace.replace = $$[QT_INSTALL_HEADERS/raw]
include_replace.CONFIG = path
lib_replace.match = $$rplbase/lib
lib_replace.replace = $$QMAKE_PKGCONFIG_LIBDIR
lib_replace.CONFIG = path
QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace
QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
}

View File

@ -3336,6 +3336,13 @@ MakefileGenerator::writePkgConfigFile()
t << endl;
}
static QString windowsifyPath(const QString &str)
{
// The paths are escaped in prl files, so every slash needs to turn into two backslashes.
// Then each backslash needs to be escaped for sed. And another level for C quoting here.
return QString(str).replace('/', "\\\\\\\\");
}
QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QString &src, const QString &dst)
{
QString ret;
@ -3348,8 +3355,12 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt
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*/)
if (!match.isEmpty() /*&& match != replace*/) {
ret += " -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())
+ "," + windowsifyPath(replace.toQString()) + ",gi");
}
}
ret += " \"" + src + "\" >\"" + dst + "\"";
}

View File

@ -34,5 +34,6 @@ wince*:QMAKE_POST_LINK =
unix|win32-g++* {
lib_replace.match = $$[QT_INSTALL_LIBS/get]
lib_replace.replace = $$[QT_INSTALL_LIBS/raw]
lib_replace.CONFIG = path
QMAKE_PRL_INSTALL_REPLACE += lib_replace
}