From 41ef1095b4ef4786615f8987013233b4bd2b3b45 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 28 Apr 2014 17:21:53 +0200 Subject: remove automagic command path fixing misfeature Qmake tried to extract the actual executable part of an extra compiler's commands and depend_command value and then "fix" it by replacing the directory separators in it with their local versions and calling QDir::cleanPath on it. This misfeature was implemented incompletely and led to unexpected results (see the numerous attempts to fix QTBUG-16372). The user is responsible for passing a correct command by calling the shell_quote or shell_escape functions if necessary. Change-Id: Ic4bfe9eeb697775cd99c865e7a9d335e63605dea Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefile.cpp | 56 ++++--------------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 0e3e058c7b..0deb08a82e 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1749,23 +1749,7 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil QString tmp_out = project->values(ProKey(comp + ".output")).first().toQString(); if(tmp_out.isEmpty()) return false; - QString tmp_cmd; - const ProKey ckey(comp + ".commands"); - if (!project->isEmpty(ckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(ckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - cmdline[argv0] = Option::fixPathToTargetOS(cmdline.at(argv0).toQString(), false); - tmp_cmd = cmdline.join(' '); - } - } - + const QString tmp_cmd = project->values(ProKey(comp + ".commands")).join(' '); if (config.indexOf("combine") != -1) { QString cmd = replaceExtraCompilerVariables(tmp_cmd, QString(), tmp_out); if(system(cmd.toLatin1().constData())) @@ -1829,42 +1813,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { QString tmp_out = fileFixify(project->first(ProKey(*it + ".output")).toQString(), Option::output_dir, Option::output_dir); - QString tmp_cmd; - const ProKey ckey(*it + ".commands"); - if (!project->isEmpty(ckey)) { - QStringList cmdline = project->values(ckey).toQStringList(); - int argv0 = findExecutable(cmdline); - if(argv0 != -1) { - cmdline[argv0] = escapeFilePath(Option::fixPathToTargetOS(cmdline.at(argv0), false)); - tmp_cmd = cmdline.join(' '); - } - } - QString tmp_dep_cmd; + const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' '); + const QString tmp_dep_cmd = project->values(ProKey(*it + "depend_command")).join(' '); QString dep_cd_cmd; - const ProKey dckey(*it + ".depend_command"); - if (!project->isEmpty(dckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(dckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - QString arg = cmdline.at(argv0).toQString(); - const QString c = Option::fixPathToLocalOS(arg, true); - if(exists(c)) { - arg = escapeFilePath(Option::fixPathToLocalOS(arg, false)); - } else { - arg = escapeFilePath(arg); - } - QFileInfo cmdFileInfo(arg); - if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists()) { - cmdline[argv0] = arg; - tmp_dep_cmd = cmdline.join(' '); - } - } + if (!tmp_dep_cmd.isEmpty()) { dep_cd_cmd = QLatin1String("cd ") + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && "); -- cgit v1.2.3