From deb3c134b5b718e429a71ed0cff8f1f711b30e62 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 3 Feb 2012 18:03:24 +0100 Subject: remove injection of default_pre in infile()/$$fromfile() this is a hack from the times when these functions were (ab)used to inspect proper project files, but the inclusion was done with a clean project, so that the included files did not have any functions to work with. Change-Id: I19925e8ead597ca38df040000c183e368b32c06d Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index f6e26254c5..397b4aee18 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1635,10 +1635,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash Date: Tue, 21 Feb 2012 22:23:48 +0100 Subject: give load()/include() with target and infile()/$$fromfile() a clean environment load()/include() with a target namespace would inherit the current context. however, if you source a project with all bells and whistles, this makes completely no sense and may be actually counterproductive. infile()/$$fromfile() would have interited only the functions from the current context. that was only a hack to support abusing them. Change-Id: I2e992b923d9e5b0e5056001ca49b35de573abc63 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index 397b4aee18..ecd31d5234 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1633,7 +1633,7 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash Date: Fri, 3 Feb 2012 18:34:56 +0100 Subject: make QMakeProject's copy c'tor actually behave like one instead of initializing base_vars with the original's vars, initialize vars itself. this has two consequences: - there is no need to call read(0) to initialize vars - one cannot usefully call the complex read() anymore, as that would re-initialize vars from base_vars this is much closer to an actual copy than the previous "seeding with existing project". Change-Id: Ib007bc5b779aedb680a27329aa578f7c604a4308 Reviewed-by: Joerg Bornemann Reviewed-by: Marius Storm-Olsen --- qmake/generators/mac/pbuilder_pbx.cpp | 1 - qmake/project.cpp | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 70efff0bcd..770a1ad34e 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -178,7 +178,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) } if(tmp_proj.first("TEMPLATE") == "subdirs") { QMakeProject *pp = new QMakeProject(&tmp_proj); - pp->read(0); pb_subdirs += new ProjectBuilderSubDirs(pp, dir); } else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") { QString pbxproj = qmake_getpwd() + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix(); diff --git a/qmake/project.cpp b/qmake/project.cpp index ecd31d5234..7f73b1f56f 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -627,10 +627,11 @@ QMakeProject::init(QMakeProperty *p) reset(); } -QMakeProject::QMakeProject(QMakeProject *p, const QHash *vars) +// Duplicate project. It is *not* allowed to call the complex read() functions on the copy. +QMakeProject::QMakeProject(QMakeProject *p, const QHash *_vars) { init(p->properties()); - base_vars = vars ? *vars : p->variables(); + vars = _vars ? *_vars : p->variables(); for(QHash::iterator it = p->replaceFunctions.begin(); it != p->replaceFunctions.end(); ++it) { it.value()->ref(); replaceFunctions.insert(it.key(), it.value()); -- cgit v1.2.1 From 84ddc063805deaa6e76eeff56076f5f359635073 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 30 Jan 2012 15:47:45 +0100 Subject: do not re-evaluate spec+cache in build passes clean up the somewhat convoluted code paths which forced re-evaluation. now that the spec+cache are evaluated in a completely clean context anyway, there is no point in re-evaluating them for build passes. Change-Id: I12279083238e9ca7028af97f45e2638c8dc715b8 Reviewed-by: Joerg Bornemann Reviewed-by: Marius Storm-Olsen --- qmake/project.cpp | 7 +++---- qmake/project.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index 7f73b1f56f..35aaee9775 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1257,7 +1257,7 @@ QMakeProject::read(const QString &project, uchar cmd) bool QMakeProject::read(uchar cmd) { - if(cfile.isEmpty()) { + if ((cmd & ReadSetup) && base_vars.isEmpty()) { // hack to get the Option stuff in there base_vars["QMAKE_EXT_CPP"] = Option::cpp_ext; base_vars["QMAKE_EXT_C"] = Option::c_ext; @@ -1266,12 +1266,12 @@ QMakeProject::read(uchar cmd) if(!Option::user_template_prefix.isEmpty()) base_vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix); - if ((cmd & ReadSetup) && Option::mkfile::do_cache) { // parse the cache + if (Option::mkfile::do_cache) { // parse the cache if (Option::output_dir.startsWith(Option::mkfile::project_build_root)) Option::mkfile::cachefile_depth = Option::output_dir.mid(Option::mkfile::project_build_root.length()).count('/'); } - if (cmd & ReadSetup) { // parse mkspec + { // parse mkspec QString qmakespec = Option::mkfile::qmakespec; while(qmakespec.endsWith(QLatin1Char('/'))) qmakespec.truncate(qmakespec.length()-1); @@ -1307,7 +1307,6 @@ QMakeProject::read(uchar cmd) //before commandline if (cmd & ReadSetup) { - cfile = pfile; parser.file = "(internal)"; parser.from_file = false; parser.line_no = 1; //really arg count now.. duh diff --git a/qmake/project.h b/qmake/project.h index 6422ed1f32..979f1480bd 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -81,7 +81,7 @@ class QMakeProject bool recursive; bool own_prop; bool backslashWarned; - QString pfile, cfile; + QString pfile; QMakeProperty *prop; void reset(); QStringList extra_configs; -- cgit v1.2.1 From 52843c1988aaf9be8f255a340f5f21c20489de42 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 24 Feb 2012 17:53:30 +0100 Subject: de-duplicate feature and mkspec root candidate lists Change-Id: I03f5b5903a133e5386b9ebef640ddbacdf3ebcd4 Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 1 + qmake/project.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'qmake') diff --git a/qmake/option.cpp b/qmake/option.cpp index 4e0d5b198e..3fc66a8f3d 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -595,6 +595,7 @@ QStringList Option::mkspecPaths() if (!Option::mkfile::project_root.isEmpty()) ret << Option::mkfile::project_root + concat; ret << QLibraryInfo::location(QLibraryInfo::HostDataPath) + concat; + ret.removeDuplicates(); return ret; } diff --git a/qmake/project.cpp b/qmake/project.cpp index 35aaee9775..a9e99e4b79 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -593,6 +593,7 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) concat_it != concat.end(); ++concat_it) feature_roots << (QLibraryInfo::location(QLibraryInfo::HostDataPath) + mkspecs_concat + (*concat_it)); + feature_roots.removeDuplicates(); return feature_roots; } -- cgit v1.2.1 From 9d5e721e96f19812a766a4c7d3f8b41f455f507c Mon Sep 17 00:00:00 2001 From: Max Desyatov Date: Fri, 2 Mar 2012 13:33:17 +0200 Subject: escape *_script_file usages in MingwMakefileGenerator::writeObjectsPart Task-number: QTBUG-24595 Change-Id: I1e78a6015247b9e41ae2b05b50fdedf0613f00f1 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/mingw_make.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 03460551a9..c088e8e480 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -404,14 +404,14 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) QString ar_cmd = project->values("QMAKE_LIB").join(" "); if (ar_cmd.isEmpty()) ar_cmd = "armar --create"; - objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + ar_script_file; + objectsLinkLine = ar_cmd + " " + var("DEST_TARGET") + " --via " + escapeFilePath(ar_script_file); } else { // Strip off any options since the ar commands will be read from file. QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; if (ar_cmd.isEmpty()) ar_cmd = "ar"; createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); - objectsLinkLine = ar_cmd + " -M < " + ar_script_file; + objectsLinkLine = ar_cmd + " -M < " + escapeFilePath(ar_script_file); } } else { QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); @@ -420,10 +420,10 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) } if (project->isActiveConfig("rvct_linker")) { createRvctObjectScriptFile(ld_script_file, project->values("OBJECTS")); - objectsLinkLine = QString::fromLatin1("--via ") + ld_script_file; + objectsLinkLine = QString::fromLatin1("--via ") + escapeFilePath(ld_script_file); } else { createLdObjectScriptFile(ld_script_file, project->values("OBJECTS")); - objectsLinkLine = ld_script_file; + objectsLinkLine = escapeFilePath(ld_script_file); } } Win32MakefileGenerator::writeObjectsPart(t); -- cgit v1.2.1 From 11f9d187312f54dce4f5233b7fe696a0d949facc Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Tue, 6 Mar 2012 13:13:09 +0100 Subject: Fix finding specs in the unsupported/ directory. The -spec argument was interpreted as a relative directory as soon as it contained a slash. Fix this by checking if the directory exists before attempting to interpret it. Change-Id: Ide8f0418abc719b0be582d2d72642a141f6c6dea Reviewed-by: Oswald Buddenhagen --- qmake/option.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/option.cpp b/qmake/option.cpp index 3fc66a8f3d..ef613b90ad 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -149,8 +149,11 @@ static QString detectProjectFile(const QString &path) static QString cleanSpec(const QString &spec) { QString ret = QDir::cleanPath(spec); - if (ret.contains('/')) - ret = QDir::cleanPath(QFileInfo(ret).absoluteFilePath()); + if (ret.contains('/')) { + const QFileInfo specDirInfo(ret); + if (specDirInfo.exists() && specDirInfo.isDir()) + ret = QDir::cleanPath(specDirInfo.absoluteFilePath()); + } return ret; } -- cgit v1.2.1 From 4958c138a79f6597b635aa0ed356f0fbd8fa929c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 2 Mar 2012 17:27:33 +0100 Subject: don't add bogus /mkspecs to QMAKE_MKSPECS the project build root can of course be empty - if there is neither an mkspecs/ nor a .qmake.cache - or no project in the first place (-query). Change-Id: I9595b0b4ad80a9086dcd48c9ae62b3e8bd1b6f2f Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/option.cpp b/qmake/option.cpp index ef613b90ad..b2a1e6982f 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -594,7 +594,8 @@ QStringList Option::mkspecPaths() for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it) ret << ((*it) + concat); } - ret << Option::mkfile::project_build_root + concat; + if (!Option::mkfile::project_build_root.isEmpty()) + ret << Option::mkfile::project_build_root + concat; if (!Option::mkfile::project_root.isEmpty()) ret << Option::mkfile::project_root + concat; ret << QLibraryInfo::location(QLibraryInfo::HostDataPath) + concat; -- cgit v1.2.1 From 6c612c933803ef57ea45e907d0181b40659148ac Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 7 Mar 2012 13:31:04 +0100 Subject: move postProcessProject() call to sane location there is totally no reason to call it unless the project is actually used for makefile generation, and the excessive calls actually mess up things. Change-Id: Idb7912a5404f6054010d2f29cce820a167de4f6f Reviewed-by: Marius Storm-Olsen --- qmake/generators/metamakefile.cpp | 4 ++++ qmake/project.cpp | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 39dd4ab797..b855585500 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -447,6 +447,8 @@ QT_END_INCLUDE_NAMESPACE MakefileGenerator * MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) { + Option::postProcessProject(proj); + MakefileGenerator *mkfile = NULL; if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { mkfile = new ProjectGenerator; @@ -492,6 +494,8 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) MetaMakefileGenerator * MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success) { + Option::postProcessProject(proj); + MetaMakefileGenerator *ret = 0; if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { diff --git a/qmake/project.cpp b/qmake/project.cpp index a9e99e4b79..7655f05f2e 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1386,7 +1386,6 @@ QMakeProject::read(uchar cmd) break; } } - Option::postProcessProject(this); // let Option post-process return true; } -- cgit v1.2.1