diff options
Diffstat (limited to 'mkspecs/features/qt_configure.prf')
-rw-r--r-- | mkspecs/features/qt_configure.prf | 468 |
1 files changed, 383 insertions, 85 deletions
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 81b820978a..168a8e64f2 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -1,3 +1,13 @@ +# +# W A R N I N G +# ------------- +# +# This file is not part of the Qt API. It exists purely as an +# implementation detail. It may change from version to version +# without notice, or even be removed. +# +# We mean it. +# QT_CONFIGURE_REPORT = QT_CONFIGURE_NOTES = @@ -51,6 +61,13 @@ defineTest(qtConfCommandlineSetInput) { val = $${2} !isEmpty($${currentConfig}.commandline.options.$${arg}.name): \ arg = $$eval($${currentConfig}.commandline.options.$${arg}.name) + !isEmpty(config.input.$$arg) { + oldval = $$eval(config.input.$$arg) + equals(oldval, $$val): \ + qtConfAddNote("Option '$$arg' with value '$$val' was specified twice") + else: \ + qtConfAddNote("Overriding option '$$arg' with '$$val' (was: '$$oldval')") + } config.input.$$arg = $$val export(config.input.$$arg) @@ -323,9 +340,21 @@ defineTest(qtConfParseCommandLine) { type = boolean } + isEmpty(type):contains(opt, "skip") { + isEmpty(skipOptionWarningAdded) { + qtConfAddWarning("Command line option -skip is only effective in top-level builds.") + skipOptionWarningAdded = 1 + } + val = $$qtConfGetNextCommandlineArg() + next() + } + isEmpty(type) { qtConfAddError("Unknown command line option '$$c'.") - return() + equals(config.input.continue, yes): \ + next() + else: \ + return() } call = "qtConfCommandline_$${type}" @@ -358,22 +387,31 @@ defineTest(qtConfTest_compilerSupportsFlag) { defineTest(qtConfTest_linkerSupportsFlag) { flag = $$eval($${1}.flag) + use_bfd_linker: \ + LFLAGS = -fuse-ld=bfd use_gold_linker: \ LFLAGS = -fuse-ld=gold + use_lld_linker: \ + LFLAGS = -fuse-ld=lld return($$qtConfToolchainSupportsFlag($$LFLAGS "-Wl,$$flag")) } defineReplace(qtConfFindInPathList) { + # This nesting is consistent with Apple ld -search_paths_first, + # and presumably with GNU ld (no actual documentation found). for (dir, 2) { - exists("$$dir/$${1}"): \ - return("$$dir/$${1}") + for (file, 1) { + exists("$$dir/$$file"): \ + return("$$dir/$$file") + } } return() } defineReplace(qtConfFindInPath) { ensurePathEnv() + equals(QMAKE_HOST.os, Windows):!contains(1, .*\\.exe): 1 = $${1}.exe return($$qtConfFindInPathList($$1, $$2 $$QMAKE_PATH_ENV)) } @@ -424,12 +462,12 @@ defineTest(qtConfSetupLibraries) { lpfx = $${currentConfig}.libraries.$${l} # 'export' may be omitted, in which case it falls back to the library's name !defined($${lpfx}.export, var) { - $${lpfx}.export = $$l + $${lpfx}.export = $$replace(l, -, _) export($${lpfx}.export) } # 'export' may also be empty, but we need a derived identifier alias = $$eval($${lpfx}.export) - isEmpty(alias): alias = $$l + isEmpty(alias): alias = $$replace(l, -, _) $${lpfx}.alias = $$alias export($${lpfx}.alias) # make it easy to refer to the library by its export name. @@ -488,6 +526,175 @@ defineTest(qtConfSetupLibraries) { } } +# libs-var, libs, in-paths, out-paths-var +defineTest(qtConfResolveLibs) { + ret = true + paths = $$3 + out = + copy = false + for (l, 2) { + $$copy { + copy = false + out += $$l + } else: equals(l, "-s") { + # em++ flag to link libraries from emscripten-ports; passed on literally. + copy = true + out += $$l + } else: contains(l, "^-L.*") { + lp = $$replace(l, "^-L", ) + !exists($$lp/.) { + qtLog("Library path $$val_escape(lp) is invalid.") + ret = false + } else { + paths += $$lp + } + } else: contains(l, "^-l.*") { + lib = $$replace(l, "^-l", ) + lcan = + integrity:contains(lib, "^.*\\.a") { + # INTEGRITY compiler searches for exact filename + # if -l argument has .a suffix + lcan += $${lib} + } else: contains(lib, "^:.*") { + # Use exact filename when -l:filename syntax is used. + lib ~= s/^:// + lcan += $${lib} + } else: unix { + # Under UNIX, we look for actual shared libraries, in addition + # to static ones. + shexts = $$QMAKE_EXTENSION_SHLIB $$QMAKE_EXTENSIONS_AUX_SHLIB + for (ext, shexts) { + lcan += $${QMAKE_PREFIX_SHLIB}$${lib}.$${ext} + } + lcan += \ + $${QMAKE_PREFIX_STATICLIB}$${lib}.$${QMAKE_EXTENSION_STATICLIB} + } else { + # Under Windows, we look only for static libraries, as even for DLLs + # one actually links against a static import library. + mingw { + lcan += \ + # MinGW supports UNIX-style library naming in addition to + # the MSVC style. + lib$${lib}.dll.a lib$${lib}.a \ + # Fun fact: prefix-less libraries are also supported. + $${lib}.dll.a $${lib}.a + } + lcan += $${lib}.lib + } + l = $$qtConfFindInPathList($$lcan, $$paths $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS) + isEmpty(l) { + qtLog("None of [$$val_escape(lcan)] found in [$$val_escape(paths)] and global paths.") + ret = false + } else { + out += $$l + } + } else { + out += $$l + } + } + $$1 = $$out + export($$1) + !isEmpty(4) { + $$4 = $$paths + export($$4) + } + return($$ret) +} + +# source-var +defineTest(qtConfResolveAllLibs) { + ret = true + !qtConfResolveLibs($${1}.libs, $$eval($${1}.libs), , $${1}.libdirs): \ + ret = false + for (b, $${1}.builds._KEYS_): \ + !qtConfResolveLibs($${1}.builds.$${b}, $$eval($${1}.builds.$${b}), $$eval($${1}.libdirs), ): \ + ret = false + return($$ret) +} + +# libs-var, in-paths, libs +defineTest(qtConfResolvePathLibs) { + ret = true + for (libdir, 2) { + !exists($$libdir/.) { + qtLog("Library path $$val_escape(libdir) is invalid.") + ret = false + } + } + !qtConfResolveLibs($$1, $$3, $$2): \ + ret = false + return($$ret) +} + +defineReplace(qtConfGetTestSourceList) { + result = + !isEmpty($${1}.test.inherit) { + base = $$section(1, ., 0, -2) + for (i, $${1}.test.inherit): \ + result += $$qtConfGetTestSourceList($${base}.$$i) + } + return($$result $$1) +} + +defineReplace(qtConfGetTestIncludes) { + defined($${1}._KEYS_, var) { + 1st = $$first($${1}._KEYS_) + equals(1st, 0) { + # array; recurse for every element + ret = + for (k, $${1}._KEYS_): \ + ret += $$qtConfGetTestIncludes($${1}.$$k) + return($$ret) + } + # object; try condition and recurse + !defined($${1}.headers, var):!defined($${1}.headers._KEYS_, var): \ # just plain broken without it + error("headers object '$$1' has no nested headers entry") + cond = $$eval($${1}.condition) + isEmpty(cond): \ # would be pointless otherwise + error("headers object '$$1' has no condition") + !$$qtConfEvaluate($$cond) { + qtLog("header entry '$$1' failed condition '$$cond'.") + return() + } + qtLog("header entry '$$1' passed condition.") + return($$qtConfGetTestIncludes($${1}.headers)) + } + return($$eval($$1)) # plain string - or nothing (can happen for top-level call only) +} + +# includes-var, in-paths, test-object-var +defineTest(qtConfResolvePathIncs) { + ret = true + for (incdir, 2) { + !exists($$incdir/.) { + qtLog("Include path $$val_escape(incdir) is invalid.") + ret = false + } + } + 2 -= $$QMAKE_DEFAULT_INCDIRS + $$1 = $$2 + export($$1) + wasm { + # FIXME: emcc downloads pre-built libraries and adds their include + # path to the clang call dynamically. it would be possible to parse + # the emcc -s USE_xyz=1 --cflags output to populate xzy_INCDIR and + # thus make the code below work. + return($$ret) + } + tests = $$qtConfGetTestSourceList($$3) + hdrs = + for (test, tests): \ + hdrs += $$qtConfGetTestIncludes($${test}.headers) + for (hdr, hdrs) { + h = $$qtConfFindInPathList($$hdr, $$2 $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS) + isEmpty(h) { + qtLog("$$hdr not found in [$$val_escape(2)] and global paths.") + ret = false + } + } + return($$ret) +} + # the library is specified inline in a 'libs' field. # overrides from the command line are accepted. defineTest(qtConfLibrary_inline) { @@ -517,7 +724,6 @@ defineTest(qtConfLibrary_inline) { vars += $$eval(config.commandline.rev_assignments.$${iv}) defined(config.input.$${iv}, var) { eval($${1}.builds.$${b} = $$eval(config.input.$${iv})) - export($${1}.builds.$${b}) $${1}.builds._KEYS_ *= $${b} any = true } else { @@ -532,36 +738,35 @@ defineTest(qtConfLibrary_inline) { export($${1}.builds._KEYS_) # we also reset the generic libs, to avoid surprises. $${1}.libs = - export($${1}.libs) } # direct libs. overwrites inline libs. - defined(config.input.$${input}.libs, var) { + defined(config.input.$${input}.libs, var): \ eval($${1}.libs = $$eval(config.input.$${input}.libs)) - export($${1}.libs) - } + + includes = $$eval(config.input.$${input}.incdir) # prefix. prepends to (possibly overwritten) inline libs. prefix = $$eval(config.input.$${input}.prefix) !isEmpty(prefix) { - $${1}.includedir = $$prefix/include - export($${1}.includedir) + includes += $$prefix/include $${1}.libs = -L$$prefix/lib $$eval($${1}.libs) - export($${1}.libs) - } - - incdir = $$eval(config.input.$${input}.incdir) - !isEmpty(incdir) { - $${1}.includedir = $$incdir - export($${1}.includedir) } libdir = $$eval(config.input.$${input}.libdir) !isEmpty(libdir) { - $${1}.libs = -L$$libdir $$eval($${1}.libs) - export($${1}.libs) + libs = + for (ld, libdir): \ + libs += -L$$ld + $${1}.libs = $$libs $$eval($${1}.libs) } + !qtConfResolveAllLibs($$1): \ + return(false) + + !qtConfResolvePathIncs($${1}.includedir, $$includes, $$2): \ + return(false) + return(true) } @@ -572,17 +777,13 @@ defineTest(qtConfLibrary_makeSpec) { isEmpty(spec): \ error("makeSpec source in library '$$eval($${1}.library)' does not specify 'spec'.") - $${1}.includedir = $$eval(QMAKE_INCDIR_$$spec) - export($${1}.includedir) - $${1}.libs = - for (l, QMAKE_LIBDIR_$$spec): \ - $${1}.libs += -L$$l - $${1}.libs += $$eval(QMAKE_LIBS_$$spec) - export($${1}.libs) + !qtConfResolvePathLibs($${1}.libs, $$eval(QMAKE_LIBDIR_$$spec), $$eval(QMAKE_LIBS_$$spec)): \ + return(false) - # the library definition is always in scope, so no point in exporting it. - $${1}.export = false - export($${1}.export) + !qtConfResolvePathIncs($${1}.includedir, $$eval(QMAKE_INCDIR_$$spec), $$2): \ + return(false) + + # note that the object is re-exported, because we resolve the libraries. return(true) } @@ -602,13 +803,22 @@ defineTest(qtConfLibrary_pkgConfig) { } qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false) - qtRunLoggedCommand("$$pkg_config --libs-only-L $$args", libpaths)|return(false) - qtRunLoggedCommand("$$pkg_config --libs-only-l $$args", libs)|return(false) version ~= s/[^0-9.].*$// $${1}.version = $$first(version) export($${1}.version) - eval($${1}.libs = $$libpaths $$libs) - export($${1}.libs) + + qtRunLoggedCommand("$$pkg_config --libs-only-L $$args", libpaths)|return(false) + qtRunLoggedCommand("$$pkg_config --libs-only-l $$args", libs)|return(false) + eval(libs = $$libpaths $$libs) + !qtConfResolveLibs($${1}.libs, $$libs): \ + return(false) + contains($${1}.libs, ".*\\.$${QMAKE_EXTENSION_STATICLIB}$") { + qtRunLoggedCommand("$$pkg_config --static --libs-only-L $$args", libpaths)|return(false) + qtRunLoggedCommand("$$pkg_config --static --libs-only-l $$args", libs)|return(false) + eval(libs = $$libpaths $$libs) + !qtConfResolveLibs($${1}.libs, $$libs): \ + return(false) + } qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) # Split CFLAGS into stuff that goes into DEFINES, INCLUDEPATH, and other stuff. @@ -633,10 +843,26 @@ defineTest(qtConfLibrary_pkgConfig) { } !isEmpty(ignored): \ qtLog("Note: Dropped compiler flags '$$ignored'.") + !qtConfResolvePathIncs($${1}.includedir, $$includes, $$2): \ + return(false) $${1}.defines = $$defines - export($${1}.defines) - $${1}.includedir = $$includes + + # now remove the content of the transitive deps we know about. + largs = $$qtConfAllLibraryArgs($$eval($${2}.dependencies)) + for (la, largs): \ + eval("$$la") + USES = $$eval($$list($$upper($$replace(QMAKE_USE, -, _)))) + # _CC == _LD for configure's library sources, so pick first arbitrarily. + DEPS = $$resolve_depends(USES, QMAKE_DEPENDS_, _CC) + for (DEP, DEPS) { + $${1}.libs -= $$eval(QMAKE_LIBS_$${DEP}) + $${1}.includedir -= $$eval(QMAKE_INCDIR_$${DEP}) + $${1}.defines -= $$eval(QMAKE_DEFINES_$${DEP}) + } + export($${1}.libs) export($${1}.includedir) + export($${1}.defines) + return(true) } @@ -658,7 +884,7 @@ defineTest(qtConfTest_getPkgConfigVariable) { } defineReplace(qtConfLibraryArgs) { - NAME = $$upper($$eval($${1}.library)) + NAME = $$upper($$replace($${1}.library, -, _)) qmake_args = "QMAKE_LIBS_$${NAME} = $$val_escape($${1}.libs)" for (b, $${1}.builds._KEYS_): \ qmake_args += "QMAKE_LIBS_$${NAME}_$$upper($$b) = $$val_escape($${1}.builds.$${b})" @@ -668,20 +894,36 @@ defineReplace(qtConfLibraryArgs) { defines = $$eval($${1}.defines) !isEmpty(defines): \ qmake_args += "QMAKE_DEFINES_$${NAME} = $$val_escape(defines)" + depends = $$eval($${2}.dependencies) + !isEmpty(depends) { + dep_uses = + for (use, depends): \ + dep_uses += $$section(use, :, 1, 1) + qmake_args += \ + "QMAKE_DEPENDS_$${NAME}_CC = $$upper($$replace(dep_uses, -, _))" \ + "QMAKE_DEPENDS_$${NAME}_LD = $$upper($$replace(dep_uses, -, _))" + } return($$qmake_args) } defineReplace(qtConfAllLibraryArgs) { isEmpty(1): return() dep_uses = + for (use, 1): \ + dep_uses += $$section(use, :, 1, 1) dep_args = - for (use, 1) { + seen = + for(ever) { + isEmpty(1): break() + use = $$take_last(1) + contains(seen, $$use): next() + seen += $$use use_cfg = $$section(use, :, 0, 0) - use_lib = $$section(use, :, 1, 1) - dep_uses += $$use_lib !isEmpty(use_cfg) { + use_lib = $$section(use, :, 1, 1) lpfx = $${use_cfg}.libraries.$$use_lib - dep_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source)) + dep_args += $$qtConfLibraryArgs($${lpfx}.sources.$$eval($${lpfx}.source), $$lpfx) + 1 += $$eval($${lpfx}.dependencies) } } return("QMAKE_USE += $$dep_uses" $$dep_args) @@ -710,6 +952,24 @@ defineTest(qtConfExportLibrary) { !isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines) includes = $$eval($${spfx}.includedir) !isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes) + uses = $$eval($${lpfx}.dependencies) + !isEmpty(uses) { + # FIXME: ideally, we would export transitive deps only for static + # libs, to not extend the link interface unduly. however, the system + # does currently not differentiate between public and private deps. + depends = + for (use, uses) { + use_cfg = $$section(use, :, 0, 0) + use_lib = $$section(use, :, 1, 1) + !isEmpty(use_cfg): \ + depends += $$upper($$eval($${use_cfg}.libraries.$${use_lib}.export)) + else: \ + depends += $$upper($$replace(use_lib, -, _)) + } + # we use suffixes instead of infixes, because $$resolve_depends() demands it. + qtConfOutputVar(assign, $$output, QMAKE_DEPENDS_$${NAME}_CC, $$depends) + qtConfOutputVar(assign, $$output, QMAKE_DEPENDS_$${NAME}_LD, $$depends) + } !isEmpty($${currentConfig}.module): \ qtConfExtendVar($$output, "QT.$${currentModule}_private.libraries", $$name) } @@ -735,7 +995,8 @@ defineTest(qtConfHandleLibrary) { export($${lpfx}.result) return() } - resolved_uses = $$eval($${lpfx}.resolved_uses) + $${lpfx}.dependencies = $$eval($${lpfx}.resolved_uses) + export($${lpfx}.dependencies) qtConfLoadResult($${lpfx}, $$1, "library") { $$eval($${lpfx}.result): \ @@ -772,8 +1033,8 @@ defineTest(qtConfHandleLibrary) { export($${lpfx}.source) # if the library defines a test, use it to verify the source. - !isEmpty($${lpfx}.test)|!isEmpty($${lpfx}.test._KEYS_) { - $${lpfx}.resolved_uses = $$currentConfig:$$1 $$resolved_uses + defined($${lpfx}.test, var)|defined($${lpfx}.test._KEYS_, var) { + $${lpfx}.resolved_uses = $$currentConfig:$$1 $${lpfx}.host = $$eval($${spfx}.host) !qtConfTest_compile($$lpfx) { qtLog(" => source failed verification.") @@ -878,7 +1139,7 @@ defineTest(qtConfTestPrepare_compile) { } } isEmpty(libConfig) { - nu = $$upper($$u) + nu = $$upper($$replace(u, -, _)) !defined(QMAKE_LIBS_$$nu, var): \ error("Test $$1 tries to use undeclared library '$$u'") # using an external library by exported name. @@ -897,8 +1158,12 @@ defineTest(qtConfTestPrepare_compile) { defineTest(qtConfPrepareCompileTestSource) { test_dir = $$2 - test_lang = $$eval($${1}.lang) - isEmpty(test_lang): test_lang = "c++" + tests = $$qtConfGetTestSourceList($$1) + + test_lang = "c++" + for (test, tests): \ + test_lang += $$eval($${test}.test.lang) + test_lang = $$last(test_lang) # Last non-empty, that is. equals(test_lang, "c++"): suffix = "cpp" else: equals(test_lang, "c"): suffix = "c" @@ -909,33 +1174,48 @@ defineTest(qtConfPrepareCompileTestSource) { # Create source code contents = "/* Generated by configure */" # Custom code before includes - for (ent, $$qtConfScalarOrList($${1}.head)): \ - contents += $$ent + for (test, tests): \ + for (ent, $$qtConfScalarOrList($${test}.test.head)): \ + contents += $$ent # Includes - for (ent, $$qtConfScalarOrList($${1}.include)): \ - contents += "$${LITERAL_HASH}include <$$ent>" + for (test, tests) { + hdrs = $$qtConfGetTestIncludes($${test}.test.include) + isEmpty(hdrs): \ + hdrs = $$qtConfGetTestIncludes($${test}.headers) + for (ent, hdrs): \ + contents += "$${LITERAL_HASH}include <$$ent>" + } # Custom code after includes - for (ent, $$qtConfScalarOrList($${1}.tail)): \ - contents += $$ent + for (test, tests): \ + for (ent, $$qtConfScalarOrList($${test}.test.tail)): \ + contents += $$ent # And finally the custom code inside main() contents += \ "int main(int argc, char **argv)" \ "{" \ " (void)argc; (void)argv;" \ " /* BEGIN TEST: */" - for (ent, $$qtConfScalarOrList($${1}.main)): \ - contents += " $$ent" + for (test, tests): \ + for (ent, $$qtConfScalarOrList($${test}.test.main)): \ + contents += " $$ent" contents += \ " /* END TEST */" \ " return 0;" \ "}" write_file($$test_dir/main.$$suffix, contents)|error() + for (test, tests) { + for (file, $$qtConfScalarOrList($${test}.test.files._KEYS_)): \ + write_file($$test_dir/$$file, $$qtConfScalarOrList($${test}.test.files.$${file}))|error() + } + # Create stub .pro file contents = "SOURCES = main.$$suffix" # Custom project code - for (ent, $$qtConfScalarOrList($${1}.qmake)): \ - contents += $$ent + pwd = $$val_escape($${currentConfig}.dir) + for (test, tests): \ + for (ent, $$qtConfScalarOrList($${test}.test.qmake)): \ + contents += $$replace(ent, "@PWD@", $$pwd) write_file($$test_dir/$$basename(test_dir).pro, contents)|error() } @@ -948,7 +1228,7 @@ defineTest(qtConfTest_compile) { isEmpty(test) { test_dir = $$test_base_out_dir/$$section(1, ".", -1) test_out_dir = $$test_dir - qtConfPrepareCompileTestSource($${1}.test, $$test_dir) + qtConfPrepareCompileTestSource($$1, $$test_dir) } else { test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test test_out_dir = $$test_base_out_dir/$$test @@ -971,8 +1251,12 @@ defineTest(qtConfTest_compile) { else: \ qmake_configs = "static" + use_bfd_linker: \ + qmake_configs += "use_bfd_linker" use_gold_linker: \ qmake_configs += "use_gold_linker" + use_lld_linker: \ + qmake_configs += "use_lld_linker" # disable warnings from the builds, since they're just noise at this point. qmake_configs += "warn_off" @@ -1038,9 +1322,9 @@ defineTest(qtConfTest_files) { for(i, $${1}.files._KEYS_) { f = $$eval($${1}.files.$${i}) qtLog("Searching for file $${f}.") - contains(f, ".*\.h") { + contains(f, ".*\\.h") { file = $$qtConfFindInPathList($$f, $$EXTRA_INCLUDEPATH $$QMAKE_DEFAULT_INCDIRS) - } else: contains(f, ".*\.(lib|so|a)") { + } else: contains(f, ".*\\.(lib|so|a)") { file = $$qtConfFindInPathList($$f, $$EXTRA_LIBDIR $$QMAKE_DEFAULT_LIBDIRS) } else { # assume we're looking for an executable @@ -1156,7 +1440,7 @@ defineTest(qtConfSetupTestTypeDeps) { } } -defineTest(qtConfEnsureTestTypeDeps) { +defineTest(qtConfEnsureTestTypeDepsOne) { depsn = $${currentConfig}.testTypeDependencies.$${1}._KEYS_ !isEmpty($$depsn) { for (dep, $$depsn) { @@ -1170,12 +1454,18 @@ defineTest(qtConfEnsureTestTypeDeps) { fwdsn = $${currentConfig}.testTypeForwards.$${1} !isEmpty($$fwdsn) { for (fwd, $$fwdsn): \ - qtConfEnsureTestTypeDeps($$fwd) + qtConfEnsureTestTypeDepsOne($$fwd) $$fwdsn = export($$fwdsn) } } +defineTest(qtConfEnsureTestTypeDeps) { + qtConfEnsureTestTypeDepsOne($$1) + currentConfig = config.builtins + qtConfEnsureTestTypeDepsOne($$1) +} + defineTest(qtRunSingleTest) { tpfx = $${currentConfig}.tests.$${1} defined($${tpfx}.result, var): \ @@ -1235,7 +1525,7 @@ defineReplace(qtConfEvaluate) { 1 ~= s/$$escape_expand(\\n) */ /g expr = $${1} expr ~= s/&&/ && /g - expr ~= s/\|\|/ || /g + expr ~= s/\\|\\|/ || /g expr ~= s/!/ ! /g expr ~= s/\\(/ ( /g expr ~= s/\\)/ ) /g @@ -1258,7 +1548,7 @@ defineReplace(qtConfEvaluateSingleExpression) { } else: contains(e, "^'.*'$") { # quoted literals result = $$replace(e, "^'(.*)'$", "\\1") - } else: contains(e, "^tests\..*") { + } else: contains(e, "^tests\\..*") { !qt_conf_tests_allowed: \ error("Expression '$${1}' refers to a test, which is not allowed at this stage of configuring.") test = $$section(e, ".", 1, 1) @@ -1269,7 +1559,7 @@ defineReplace(qtConfEvaluateSingleExpression) { error("Unknown test object $${test} in expression '$${1}'.") qtRunSingleTest($$test) result = $$eval($${currentConfig}.tests.$${test}.$${var}) - } else: contains(e, "^libs\..*") { + } else: contains(e, "^libs\\..*") { !qt_conf_tests_allowed: \ error("Expression '$${1}' refers to a library, which is not allowed at this stage of configuring.") lib = $$section(e, ".", 1, 1) @@ -1282,7 +1572,7 @@ defineReplace(qtConfEvaluateSingleExpression) { !defined($${currentConfig}.libraries.$${lib}.$${var}, var): \ var = sources.$$eval($${currentConfig}.libraries.$${lib}.source).$$var result = $$eval($${currentConfig}.libraries.$${lib}.$${var}) - } else: contains(e, "^features\..*") { + } else: contains(e, "^features\\..*") { feature = $$section(e, ".", 1, 1) var = $$section(e, ".", 2, -1) isEmpty(var): \ @@ -1306,33 +1596,33 @@ defineReplace(qtConfEvaluateSingleExpression) { !qtConfCheckFeature($$feature): \ error("Expression '$$1' is accessing non-emitted feature $${feature}.") result = $$eval($${currentConfig}.features.$${feature}.$${var}) - } else: contains(e, "^config\..*") { - var = $$replace(e, "^config\.", "") + } else: contains(e, "^config\\..*") { + var = $$replace(e, "^config\\.", "") result = false contains(CONFIG, $$var): result = true - } else: contains(e, "^module\..*") { - var = $$replace(e, "^module\.", "") + } else: contains(e, "^module\\..*") { + var = $$replace(e, "^module\\.", "") result = false qtConfHaveModule($$var): result = true - } else: contains(e, "^arch\..*") { - var = $$replace(e, "^arch\.", "") + } else: contains(e, "^arch\\..*") { + var = $$replace(e, "^arch\\.", "") result = false isEmpty(QT_ARCH): \ qtConfCheckFeature(architecture) contains(QT_ARCH, $$var): result = true - } else: contains(e, "^subarch\..*") { - var = $$replace(e, "^subarch\.", "") + } else: contains(e, "^subarch\\..*") { + var = $$replace(e, "^subarch\\.", "") result = false isEmpty(QT_ARCH): \ qtConfCheckFeature(architecture) contains(QT_CPU_FEATURES.$$QT_ARCH, $$var): result = true - } else: contains(e, "^input\..*") { + } else: contains(e, "^input\\..*") { result = $$eval(config.$$e) - } else: contains(e, "^var\..*") { - var = $$replace(e, "^var\.", "") + } else: contains(e, "^var\\..*") { + var = $$replace(e, "^var\\.", "") result = $$eval($$var) - } else: contains(e, "^call\..*") { - call = $$replace(e, "^call\.", "qtConfFunc_") + } else: contains(e, "^call\\..*") { + call = $$replace(e, "^call\\.", "qtConfFunc_") !defined($$call, replace): \ error("Call $$call referenced in expression '$${1}' does not exist") eval(result = \$\$"$$call"()) @@ -1660,6 +1950,11 @@ defineTest(qtConfCheckErrors) { # output generation # +defineTest(qtConfOutput_libraryPaths) { + qtLog("Global lib dirs: [$$val_escape(EXTRA_LIBDIR)] [$$val_escape(QMAKE_DEFAULT_LIBDIRS)]") + qtLog("Global inc dirs: [$$val_escape(EXTRA_INCLUDEPATH)] [$$val_escape(QMAKE_DEFAULT_INCDIRS)]") +} + # qtConfOutputVar(modifier, output, name, value) defineTest(qtConfOutputVar) { modifier = $$1 @@ -2028,6 +2323,9 @@ for(ever) { } configsToProcess = $$subconfigs $$configsToProcess } +# 'builtins' is used for command line parsing and test type dependency +# injection, but its features must not be processed regularly. +allModuleConfigs = $$member(allConfigs, 1, -1) QMAKE_SAVED_ARGS = $$QMAKE_EXTRA_ARGS QMAKE_REDO_CONFIG = false @@ -2036,7 +2334,7 @@ qtConfCheckErrors() !isEmpty(config.input.list-features) { all_ft = - for (currentConfig, allConfigs) { + for (currentConfig, allModuleConfigs) { for (k, $${currentConfig}.features._KEYS_) { pp = $$eval($${currentConfig}.features.$${k}.purpose) !isEmpty(pp) { @@ -2056,7 +2354,7 @@ qtConfCheckErrors() !isEmpty(config.input.list-libraries) { logn() - for (currentConfig, allConfigs) { + for (currentConfig, allModuleConfigs) { !isEmpty($${currentConfig}.exports._KEYS_) { !isEmpty($${currentConfig}.module): \ logn($$eval($${currentConfig}.module):) @@ -2093,7 +2391,7 @@ qtLog("Command line: $$qtSystemQuote($$QMAKE_SAVED_ARGS)") $$QMAKE_REDO_CONFIG: \ qtLog("config.opt: $$qtSystemQuote($$QMAKE_EXTRA_REDO_ARGS)") -for (currentConfig, allConfigs) { +for (currentConfig, allModuleConfigs) { qtConfSetModuleName() qtConfSetupModuleOutputs() # do early checks, mainly to validate the command line @@ -2137,7 +2435,7 @@ CONFIG += qt_conf_tests_allowed logn() logn("Running configuration tests...") -for (currentConfig, allConfigs) { +for (currentConfig, allModuleConfigs) { tdir = $$eval($${currentConfig}.testDir) isEmpty(tdir): tdir = config.tests QMAKE_CONFIG_TESTS_DIR = $$absolute_path($$tdir, $$eval($${currentConfig}.dir)) @@ -2201,7 +2499,7 @@ qtConfPrintReport() logn() logn("Qt is now configured for building. Just run '$$QMAKE_MAKE_NAME'.") pfx = $$[QT_INSTALL_PREFIX] -equals(pfx, $$[QT_INSTALL_PREFIX/get]) { +exists($$pfx/.qmake.cache) { logn("Once everything is built, Qt is installed.") logn("You should NOT run '$$QMAKE_MAKE_NAME install'.") logn("Note that this build cannot be deployed to other machines or devices.") |