From 2a6e8a7b7ae844232b880eef48efe06845f98205 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Nov 2013 18:16:54 +0100 Subject: fix more cases of mkdir_asstring() argument overquoting Change-Id: I7dd4024fb6fceb47431b626b586a471b74789cdc Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake2.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index bfecb924c0..c02f65d77c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -502,7 +502,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) incr_lflags += var("QMAKE_LFLAGS_RELEASE"); t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)\n\t"; if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir) << "\n\t"; + t << mkdir_p_asstring(destdir, false) << "\n\t"; t << "$(LINK) " << incr_lflags << " " << var("QMAKE_LINK_O_FLAG") << incr_target_dir << " $(INCREMENTAL_OBJECTS)\n"; //communicated below @@ -528,7 +528,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << " " << var("POST_TARGETDEPS"); } if(!destdir.isEmpty()) - t << "\n\t" << mkdir_p_asstring(destdir); + t << "\n\t" << mkdir_p_asstring(destdir, false); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" << var("QMAKE_PRE_LINK"); @@ -685,7 +685,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->first("QMAKE_PKGINFO").isEmpty()) { ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO")); - QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents"); + QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents"; t << pkginfo << ": \n\t"; if(!destdir.isEmpty()) t << mkdir_p_asstring(destdir) << "\n\t"; @@ -697,7 +697,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) { ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE")); bundledFiles << resources; - QString destdir = escapeFilePath(project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources"); + QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources"; t << resources << ": \n\t"; t << mkdir_p_asstring(destdir) << "\n\t"; t << "@touch " << resources << "\n\t\n"; @@ -710,7 +710,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); t << info_plist_out << ": \n\t"; if(!destdir.isEmpty()) - t << mkdir_p_asstring(destdir) << "\n\t"; + t << mkdir_p_asstring(destdir, false) << "\n\t"; ProStringList commonSedArgs; if (!project->values("VERSION").isEmpty()) commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" "; -- cgit v1.2.3 From 1a1f25781deb89ec0b295215d6a6a46bdb20be3a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 13 Nov 2013 17:13:27 +0100 Subject: Fix mkdir command in Windows shell for paths with forward-slashes In particular this triggers in some cases of package building where we are using a Qt version which for some reason has forward slashes in its install prefix. Any mkdir command run with this Qt build will fail because only backslashes are recognized as path separators. Task-number: QTBUG-34886 Change-Id: I2f957c6d348852ec555a67a35ae39921523b7b3e Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 3093c834cc..f628ca7ac4 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -92,7 +92,7 @@ bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const QString MakefileGenerator::mkdir_p_asstring(const QString &dir, bool escape) const { - QString edir = escape ? escapeFilePath(dir) : dir; + QString edir = escape ? escapeFilePath(Option::fixPathToTargetOS(dir, false, false)) : dir; return "@" + makedir.arg(edir); } -- cgit v1.2.3 From 8259e45c1e87c66ac8c39f1ebaccd7d753fb55fb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Nov 2013 19:50:30 +0100 Subject: install pdb files for dlltarget Task-number: QTBUG-31129 Change-Id: I49ef3472d12b291999b4194b014b200df4b0f22d Reviewed-by: Joerg Bornemann --- qmake/generators/win32/msvc_nmake.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 37ba3a66ef..723f2a03e9 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -235,8 +235,10 @@ QString NmakeMakefileGenerator::defaultInstall(const QString &t) if(targetdir.right(1) != Option::dir_sep) targetdir += Option::dir_sep; - if(t == "target" && project->first("TEMPLATE") == "lib") { - if(project->isActiveConfig("shared") && project->isActiveConfig("debug")) { + if (project->isActiveConfig("debug")) { + if (t == "dlltarget" + || (project->first("TEMPLATE") == "lib" + && project->isActiveConfig("shared"))) { QString pdb_target = getPdbTarget(); pdb_target.remove('"'); QString src_targ = (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) + pdb_target; -- cgit v1.2.3 From ef510adea5995e7cacee2697b389c48bd9b19f70 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Nov 2013 13:53:04 +0100 Subject: adequately shell-escape generated sed commands Change-Id: I39c8c4ab3da69bd21beace56f5cf3070301ac015 Reviewed-by: Joerg Bornemann --- qmake/generators/makefile.cpp | 12 +++++++++++- qmake/generators/makefile.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f628ca7ac4..d88c6e447a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -43,6 +43,9 @@ #include "option.h" #include "cachekeys.h" #include "meta.h" + +#include + #include #include #include @@ -52,6 +55,7 @@ #include #include #include + #if defined(Q_OS_UNIX) #include #else @@ -3345,11 +3349,17 @@ QString MakefileGenerator::installMetaFile(const ProKey &replace_rule, const QSt 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 \"s," + match + "," + replace + ",g\""; + ret += " -e " + shellQuote("s," + match + "," + replace + ",g"); } ret += " \"" + src + "\" >\"" + dst + "\""; } return ret; } +QString MakefileGenerator::shellQuote(const QString &str) +{ + return isWindowsShell() ? QMakeInternal::IoUtils::shellQuoteWin(str) + : QMakeInternal::IoUtils::shellQuoteUnix(str); +} + QT_END_NAMESPACE diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index 09327c599c..4b8a96c15f 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -271,6 +271,7 @@ public: virtual bool mergeBuildProject(MakefileGenerator * /*other*/) { return false; } virtual bool openOutput(QFile &, const QString &build) const; bool isWindowsShell() const { return Option::dir_sep == QLatin1String("\\"); } + QString shellQuote(const QString &str); }; inline void MakefileGenerator::setNoIO(bool o) -- cgit v1.2.3 From a0e32cbf74e977cdb02defc91081f19b7746c392 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Nov 2013 14:58:22 +0100 Subject: fix handling of | in s/// commands of built-in sed Change-Id: I139d007d68fb0aed4d9fbe57a14d1ede81ba40d8 Reviewed-by: Joerg Bornemann --- qmake/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/main.cpp b/qmake/main.cpp index b1929e0d21..340567a27d 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -106,7 +106,7 @@ static int doSed(int argc, char **argv) } } if (phase == 1 - && (c == QLatin1Char('+') || c == QLatin1Char('?') + && (c == QLatin1Char('+') || c == QLatin1Char('?') || c == QLatin1Char('|') || c == QLatin1Char('{') || c == QLatin1Char('}') || c == QLatin1Char('(') || c == QLatin1Char(')'))) { // translate sed rx to QRegExp -- cgit v1.2.3 From 3d89b10db979cb501c21bfb2052210dbbb127dbb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 20 Nov 2013 15:50:43 +0100 Subject: fix handling of \\ in replacement string in s/// cmd of built-in sed QString::replace() has no way of escaping capture group references, so simply disarm double backslashes. of course this is broken, but we'd need to reimplement it from scratch to fix it properly. "corner case" ... Change-Id: I357fbfd22c9c4a68809e5af6efad1de3a95706b5 Reviewed-by: Joerg Bornemann --- qmake/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'qmake') diff --git a/qmake/main.cpp b/qmake/main.cpp index 340567a27d..79e3739f56 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -133,6 +133,7 @@ static int doSed(int argc, char **argv) SedSubst subst; subst.from = QRegExp(phases.at(0)); subst.to = phases.at(1); + subst.to.replace("\\\\", "\\"); // QString::replace(rx, sub) groks \1, but not \\. substs << subst; } } else if (argv[i][0] == '-' && argv[i][1] != 0) { -- cgit v1.2.3