From 492d7d14fc813a858fa98ae048137a6b45155db0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Aug 2016 13:04:24 +0200 Subject: improve handling of test commands which produce output never use $$system() directly, but instead use qtRunLoggedCommand() with a newly introduced out parameter. that way we can print the command's raw output, which should help debugging configure problems. additionally, we now consistently check the exit code of all executed commands, which should avoid confusing followup errors. note that as a side effect some calls now use $$system()'s 'lines' mode instead of the bizarre default splitting mode. this has no impact on any of the cases, which is why it is basically a negligible style change at this point. however, qtLog() gained support for arguments with more than one element to accommodate this. Change-Id: I40d907e27de32dfec8d6086ce7d93fc4be18241f Reviewed-by: Lars Knoll --- mkspecs/features/configure_base.prf | 8 ++++++-- mkspecs/features/qt_configure.prf | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'mkspecs/features') diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index f62142f84d..08edba4b1c 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -26,14 +26,18 @@ isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false defineTest(qtLog) { write_file($$QMAKE_CONFIG_LOG, 1, append) - $$QMAKE_CONFIG_VERBOSE: log("$$1$$escape_expand(\\n)") + $$QMAKE_CONFIG_VERBOSE: for (l, 1): log("$$l$$escape_expand(\\n)") } defineTest(qtRunLoggedCommand) { qtLog("+ $$1") - output = $$system("( $$1 ) 2>&1", blob, result) + output = $$system("( $$1 ) 2>&1", lines, result) qtLog($$output) + !isEmpty(2) { + $$2 = $$output + export($$2) + } !equals(result, 0): return(false) return(true) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 7a289f7b94..a0e5b1a772 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -331,13 +331,13 @@ defineTest(qtConfTest_pkgConfig) { !qtConfPkgConfigPackageExists($$pkg_config, $$args): \ return(false) - $${1}.libs = $$system("$$pkg_config --libs $$args", lines) - $${1}.cflags = $$system("$$pkg_config --cflags $$args", lines) - includes = $$system("$$pkg_config --cflags-only-I $$args", lines) + qtRunLoggedCommand("$$pkg_config --modversion $$args", version)|return(false) + qtRunLoggedCommand("$$pkg_config --libs $$args", $${1}.libs)|return(false) + qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) + qtRunLoggedCommand("$$pkg_config --cflags-only-I $$args", includes)|return(false) eval(includes = $$includes) includes ~= s/^-I//g $${1}.includedir = "$$val_escape(includes)" - version = $$system("$$pkg_config --modversion $$args") $${1}.version = $$first(version) export($${1}.libs) export($${1}.cflags) @@ -356,7 +356,7 @@ defineTest(qtConfTest_getPkgConfigVariable) { return(false) variable = $$eval($${1}.pkg-config-variable) - $${1}.value = $$system("$$pkg_config --variable=$$variable $$args") + qtRunLoggedCommand("$$pkg_config --variable=$$variable $$args", $${1}.value)|return(false) export($${1}.value) return(true) } -- cgit v1.2.3