From 553ffa01188d3c14bec02e5f4b8d72291677b8ef Mon Sep 17 00:00:00 2001 From: Andreas Hartmetz Date: Thu, 23 Feb 2012 15:05:39 +0100 Subject: Revert "Escape project file name in makefile rebuild rules." It was the result of miscoordination between Andreas Holzammer and me, duplicating the functional change of commit ea2c9f764fed654a57972223449f41e208e05863. This reverts commit 8b7a9b4898c85e81d87cf642ec59ce85e917ee35. Change-Id: I9a47746c1c12ca00b2dc5c5d50e99f9bf990e3f7 Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index dd098596e9..7a00e0b48d 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2508,10 +2508,10 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListtarget << "-qmake_all: "; if(project->isEmpty("QMAKE_NOFORCE")) @@ -2520,10 +2520,10 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList Date: Thu, 23 Feb 2012 10:43:25 +1000 Subject: Fixed resolution of QMAKESPEC on Windows. base_vars["QMAKESPEC_ORIGINAL"] is not guaranteed to be set the first time resolveSpec is called, since an include() can wipe it out. Change it so that resolveSpec is called repeatedly until some QMAKESPEC_ORIGINAL is set. The code which attempted to remove all of the path up to the last / was incorrect and must have been dead code (or its wrongness didn't matter) until now. Change-Id: I2b31ae10fc284ac7293c3cd95e5a2fd503ca7ab0 Reviewed-by: Marius Storm-Olsen --- qmake/project.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index 2029e068ec..a8620334d8 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1528,12 +1528,15 @@ QMakeProject::resolveSpec(QString *spec, const QString &qmakespec) // We can't resolve symlinks as they do on Unix, so configure.exe puts the source of the // qmake.conf at the end of the default/qmake.conf in the QMAKESPEC_ORG variable. const QStringList &spec_org = base_vars["QMAKESPEC_ORIGINAL"]; - if (!spec_org.isEmpty()) { + if (spec_org.isEmpty()) { + // try again the next time around + *spec = QString(); + } else { *spec = spec_org.at(0); #endif int lastSlash = spec->lastIndexOf(QLatin1Char('/')); if (lastSlash != -1) - spec->remove(lastSlash + 1); + spec->remove(0, lastSlash + 1); } } } -- cgit v1.2.3 From cbf8f03cf4f3b0aa49c9f35c9ae0e3304f142ac7 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 7 Feb 2012 15:28:55 +0100 Subject: Create target pkgconfig dir in qmake generated Windows Makefiles Change-Id: Icea70987ee3c6040ca3ba278a578849cb74156f4 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/winmakefile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qmake') diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 5f0828383f..a26be16f78 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -844,6 +844,12 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t) QString dst_pc = pkgConfigFileName(false); if (!dst_pc.isEmpty()) { dst_pc = filePrefixRoot(root, targetdir + dst_pc); + const QString dst_pc_dir = fileInfo(dst_pc).path(); + if (!dst_pc_dir.isEmpty()) { + if (!ret.isEmpty()) + ret += "\n\t"; + ret += mkdir_p_asstring(dst_pc_dir, true); + } if(!ret.isEmpty()) ret += "\n\t"; ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\""; -- cgit v1.2.3 From 219a688ac17052e4bb3aac9ff8a813e3f4d8da01 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 9 Feb 2012 10:03:15 +0100 Subject: Add TARGET_VERSION_EXT to pkgConfiglibName The libName that is used in pkgConfig files should include the TARGET_VERSION_EXT. This is needed because in Win32MakefileGenerator::fixTargetExt(), the TARGET_VERSION_EXT is added to the library name. In Win32MakefileGenerator::processVars(), if TARGET_VERSION_EXT is empty, it is set to VER_MAJ. On platforms != Windows, TARGET_VERSION_EXT does not seem to be used. We probably got away with this so far because pkgconfig files generation for win32 was just added in 4.8 and nobody uses them yet, and because on platforms != windows the TARGET_VERSION_EXT is not used. Change-Id: I56f239e389f0ef926030e4c2376cadd92c4f673c Reviewed-by: Oswald Buddenhagen --- qmake/generators/makefile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'qmake') diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7a00e0b48d..59a615e63a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -3287,6 +3287,7 @@ MakefileGenerator::writePkgConfigFile() } else { pkgConfiglibDir = "-L${libdir}"; pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length()); + pkgConfiglibName += project->first("TARGET_VERSION_EXT"); } t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl; -- cgit v1.2.3 From e34ee3127043773a037bfd18a2d457d409032ee5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 2 Feb 2012 18:11:16 +0100 Subject: remove fallback re-initialization of TARGET after parsing project we already initialize it before parsing a project. if a project is daft enough to clear TARGET, it does not deserve differently than breaking. Change-Id: I6c727bc27d72a00e84b676ae3c169024bdb2d929 Reviewed-by: Joerg Bornemann --- qmake/project.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index a8620334d8..3546ac9877 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1444,9 +1444,6 @@ QMakeProject::read(uchar cmd) parse("CONFIG += " + Option::after_user_configs.join(" "), vars); } - if(pfile != "-" && vars["TARGET"].isEmpty()) - vars["TARGET"].append(QFileInfo(pfile).baseName()); - if(cmd & ReadFeatures) { debug_msg(1, "Processing default_post: %s", vars["CONFIG"].join("::").toLatin1().constData()); doProjectInclude("default_post", IncludeFlagFeature, vars); -- cgit v1.2.3 From e76d72aec544878d976423e2136e7787aba980ab Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 24 Feb 2012 09:10:52 +0100 Subject: don't generate bogus TARGETs Change-Id: Ia99cd8862157e5630506d02b3c7e9b35d4bc3302 Reviewed-by: Joerg Bornemann --- qmake/generators/projectgenerator.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index 4d1a310daf..a2eb45ef40 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -85,12 +85,6 @@ ProjectGenerator::init() templ.prepend(Option::user_template_prefix); v["TEMPLATE_ASSIGN"] += templ; - //figure out target - if(Option::output.fileName() == "-") - v["TARGET_ASSIGN"] = QStringList("unknown"); - else - v["TARGET_ASSIGN"] = QStringList(QFileInfo(Option::output).baseName()); - //the scary stuff if(project->first("TEMPLATE_ASSIGN") != "subdirs") { QString builtin_regex = project_builtin_regx(); @@ -360,6 +354,12 @@ ProjectGenerator::writeMakefile(QTextStream &t) t << endl << "# Directories" << "\n" << getWritableVar("SUBDIRS"); } else { + //figure out target + QString ofn = QFileInfo(static_cast(t.device())->fileName()).completeBaseName(); + if (ofn.isEmpty() || ofn == "-") + ofn = "unknown"; + project->variables()["TARGET_ASSIGN"] = QStringList(ofn); + t << getWritableVar("TARGET_ASSIGN") << getWritableVar("CONFIG", false) << getWritableVar("CONFIG_REMOVE", false) -- cgit v1.2.3 From dd7befcfd84a9a648fa467dda3fe45988bfc5604 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 3 Feb 2012 18:28:54 +0100 Subject: scope context saving more minimally no point in saving the context when we are not actually modifying the current context. Change-Id: Id6f51a163e86bdf402aa0713737b655db68e7ee8 Reviewed-by: Joerg Bornemann Reviewed-by: Marius Storm-Olsen --- qmake/project.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index 3546ac9877..eb07dea654 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1712,9 +1712,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash sc = scope_blocks; - IteratorBlock *it = iterator; - FunctionBlock *fu = function; if(flags & (IncludeFlagNewProject|IncludeFlagNewParser)) { // The "project's variables" are used in other places (eg. export()) so it's not // possible to use "place" everywhere. Instead just set variables and grab them later @@ -1730,11 +1727,14 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash sc = scope_blocks; + IteratorBlock *it = iterator; + FunctionBlock *fu = function; parsed = read(file, place); + iterator = it; + function = fu; + scope_blocks = sc; } - iterator = it; - function = fu; - scope_blocks = sc; } if(parsed) { if(place["QMAKE_INTERNAL_INCLUDED_FILES"].indexOf(orig_file) == -1) -- cgit v1.2.3 From bf29a8a27dad02f4956695e60e5be929e5ede039 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 22 Feb 2012 19:33:53 +0100 Subject: don't look for features in PrefixPath it's generally redundant with DataPath which we already look into. this is consistent with where mkspecs are looked for. i don't think anyone will notice this "loss" ... Change-Id: Iab7c35cc22ba53e1005f26b5d85d41cf4dafad07 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 eb07dea654..0445c8eee9 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -590,10 +590,6 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0) } } } - for(QStringList::Iterator concat_it = concat.begin(); - concat_it != concat.end(); ++concat_it) - feature_roots << (QLibraryInfo::location(QLibraryInfo::PrefixPath) + - mkspecs_concat + (*concat_it)); for(QStringList::Iterator concat_it = concat.begin(); concat_it != concat.end(); ++concat_it) feature_roots << (QLibraryInfo::location(QLibraryInfo::DataPath) + -- cgit v1.2.3 From 059200a44ba7177d0c9ec6bb5e6ee0b7e0c3f017 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 23 Feb 2012 17:05:28 +0100 Subject: move .qmake.cache search to Option this is a one-time operation which depends only on the invocation, so this new home is much more appropriate. Change-Id: I11ef30a8227afed06e58e64e65809dba25e81567 Reviewed-by: Joerg Bornemann --- qmake/main.cpp | 5 +++++ qmake/option.cpp | 29 +++++++++++++++++++++++++++++ qmake/option.h | 2 ++ qmake/project.cpp | 32 +++----------------------------- 4 files changed, 39 insertions(+), 29 deletions(-) (limited to 'qmake') diff --git a/qmake/main.cpp b/qmake/main.cpp index 38e09f60fd..54cf9f9bdf 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -163,6 +163,11 @@ int runQMake(int argc, char **argv) fn = fn.right(fn.length() - di - 1); } + if (!Option::prepareProject()) { + exit_val = 3; + break; + } + // read project.. if(!project.read(fn)) { fprintf(stderr, "Error processing project file: %s\n", diff --git a/qmake/option.cpp b/qmake/option.cpp index 431299b46b..306e6b5286 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -116,6 +116,7 @@ bool Option::mkfile::do_dep_heuristics = true; bool Option::mkfile::do_preprocess = false; bool Option::mkfile::do_stub_makefile = false; bool Option::mkfile::do_cache = true; +QString Option::mkfile::project_build_root; QString Option::mkfile::cachefile; QStringList Option::mkfile::project_files; QString Option::mkfile::qmakespec_commandline; @@ -567,6 +568,34 @@ void Option::applyHostMode() } } +bool Option::prepareProject() +{ + mkfile::project_build_root.clear(); + if (mkfile::do_cache) { + if (mkfile::cachefile.isEmpty()) { //find it as it has not been specified + QDir dir(output_dir); + while (!dir.exists(QLatin1String(".qmake.cache"))) + if (dir.isRoot() || !dir.cdUp()) + goto no_cache; + mkfile::cachefile = dir.filePath(QLatin1String(".qmake.cache")); + mkfile::project_build_root = dir.path(); + } else { + QFileInfo fi(mkfile::cachefile); + mkfile::cachefile = QDir::cleanPath(fi.absoluteFilePath()); + mkfile::project_build_root = QDir::cleanPath(fi.absolutePath()); + } + + if (mkfile::qmakespec.isEmpty()) { + QMakeProject cproj; + if (!cproj.read(mkfile::cachefile, QMakeProject::ReadProFile)) + return false; + mkfile::qmakespec = cproj.first(QLatin1String("QMAKESPEC")); + } + } + no_cache: + return true; +} + bool Option::postProcessProject(QMakeProject *project) { Option::cpp_ext = project->variables()["QMAKE_EXT_CPP"]; diff --git a/qmake/option.h b/qmake/option.h index ee8a1c2403..b8a3b561fa 100644 --- a/qmake/option.h +++ b/qmake/option.h @@ -108,6 +108,7 @@ struct Option //both of these must be called.. static int init(int argc=0, char **argv=0); //parse cmdline static void applyHostMode(); + static bool prepareProject(); static bool postProcessProject(QMakeProject *); enum StringFixFlags { @@ -201,6 +202,7 @@ struct Option static bool do_dep_heuristics; static bool do_preprocess; static bool do_stub_makefile; + static QString project_build_root; static QString cachefile; static int cachefile_depth; static QStringList project_files; diff --git a/qmake/project.cpp b/qmake/project.cpp index 0445c8eee9..1179812b1b 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1281,35 +1281,9 @@ QMakeProject::read(uchar cmd) base_vars["TEMPLATE_PREFIX"] = QStringList(Option::user_template_prefix); if ((cmd & ReadSetup) && Option::mkfile::do_cache) { // parse the cache - int cache_depth = -1; - QString qmake_cache = Option::mkfile::cachefile; - if(qmake_cache.isEmpty()) { //find it as it has not been specified - QString dir = Option::output_dir; - while(!QFile::exists((qmake_cache = dir + QLatin1String("/.qmake.cache")))) { - dir = dir.left(dir.lastIndexOf(QLatin1Char('/'))); - if(dir.isEmpty() || dir.indexOf(QLatin1Char('/')) == -1) { - qmake_cache = ""; - break; - } - if(cache_depth == -1) - cache_depth = 1; - else - cache_depth++; - } - } else { - QString abs_cache = QFileInfo(Option::mkfile::cachefile).absoluteDir().path(); - if(Option::output_dir.startsWith(abs_cache)) - cache_depth = Option::output_dir.mid(abs_cache.length()).count('/'); - } - if(!qmake_cache.isEmpty()) { - QHash cache; - if(read(qmake_cache, cache)) { - Option::mkfile::cachefile_depth = cache_depth; - Option::mkfile::cachefile = qmake_cache; - if(Option::mkfile::qmakespec.isEmpty() && !cache["QMAKESPEC"].isEmpty()) - Option::mkfile::qmakespec = cache["QMAKESPEC"].first(); - } - } + 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 QString qmakespec = fixEnvVariables(Option::mkfile::qmakespec); -- cgit v1.2.3 From 08fe1f6871169bf36ee58025da40824547c21b5f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 24 Feb 2012 12:11:51 +0100 Subject: resolve relative spec paths already on the command line this is way more predictable than resolving it later. Change-Id: I0ce27977b795bde9235e1d51d6f2d0d917f2398c Reviewed-by: Joerg Bornemann --- qmake/option.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'qmake') diff --git a/qmake/option.cpp b/qmake/option.cpp index 306e6b5286..0c649fdd77 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -147,6 +147,14 @@ static QString detectProjectFile(const QString &path) return ret; } +static QString cleanSpec(const QString &spec) +{ + QString ret = QDir::cleanPath(spec); + if (ret.contains('/')) + ret = QDir::cleanPath(QFileInfo(ret).absoluteFilePath()); + return ret; +} + QString project_builtin_regx(); bool usage(const char *a0) { @@ -315,7 +323,7 @@ Option::parseCommandLine(int argc, char **argv, int skip) } else if(opt == "cache") { Option::mkfile::cachefile = argv[++x]; } else if(opt == "platform" || opt == "spec") { - Option::mkfile::qmakespec = argv[++x]; + Option::mkfile::qmakespec = cleanSpec(argv[++x]); Option::mkfile::qmakespec_commandline = argv[x]; } else { fprintf(stderr, "***Unknown option -%s\n", opt.toLatin1().constData()); -- cgit v1.2.3