diff options
author | Hib Eris <hib@hiberis.nl> | 2012-02-08 12:36:28 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-29 16:46:21 (GMT) |
commit | 28f294e1e98f2437ce0d9614e698df7c8dc52dc6 (patch) | |
tree | 210360100acde9fb069f3b4a8611db8139ba41b9 /qmake | |
parent | c354d16cc64cf516a0b5149cdc9ef74de096a998 (diff) | |
download | Qt-28f294e1e98f2437ce0d9614e698df7c8dc52dc6.zip Qt-28f294e1e98f2437ce0d9614e698df7c8dc52dc6.tar.gz Qt-28f294e1e98f2437ce0d9614e698df7c8dc52dc6.tar.bz2 |
Implement missing replacements when installing .pc files for win32
This implements replacements for win32 makefile generators similar
to the replacement functionality in unix makefile generators.
To enable Makefile code generation for replacements in win32 makefile
generators, you must set QMAKE_STREAM_EDITOR to e.g. sed.
When building for win32, sed is normally only available in the
mingw/msys build environment and when cross compiling on unix.
In these cases QMAKE_STREAM_EDITOR is set to sed in qmake.conf.
For other win32 build environments QMAKE_STREAM_EDITOR is not set
in qmake.conf and the replacements Makefile code is not generated.
(cherry picked from qtbase commit 78faefdbb1ccc296c967dde40e2a7a1c78e4cec2)
Change-Id: Ie5de5d517eafaeaa2544f1e972aec3fe11d0a6f1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/win32/winmakefile.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 3cdabdb..f692b49 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -650,6 +650,7 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t) t << "DEF_FILE = " << varList("DEF_FILE") << endl; t << "RES_FILE = " << varList("RES_FILE") << endl; // Not on mingw, can't see why not though... t << "COPY = " << var("QMAKE_COPY") << endl; + t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; @@ -847,7 +848,22 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) dst_pc = filePrefixRoot(root, targetdir + dst_pc); if(!ret.isEmpty()) ret += "\n\t"; - ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\""; + const QString replace_rule("QMAKE_PKGCONFIG_INSTALL_REPLACE"); + if (project->isEmpty(replace_rule) + || project->isActiveConfig("no_sed_meta_install") + || project->isEmpty("QMAKE_STREAM_EDITOR")) { + ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\""; + } else { + ret += "-$(SED)"; + QStringList replace_rules = project->values(replace_rule); + for (int r = 0; r < replace_rules.size(); ++r) { + const QString match = project->first(replace_rules.at(r) + ".match"), + replace = project->first(replace_rules.at(r) + ".replace"); + if (!match.isEmpty() /*&& match != replace*/) + ret += " -e \"s," + match + "," + replace + ",g\""; + } + ret += " \"" + pkgConfigFileName(true) + "\" >\"" + dst_pc + "\""; + } if(!uninst.isEmpty()) uninst.append("\n\t"); uninst.append("-$(DEL_FILE) \"" + dst_pc + "\""); |