From 8ebc7e967c5d245ffab5dcbf666fc01a4df4fe6a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 15 Nov 2016 20:49:43 +0100 Subject: [PATCH] move configure -redo handling (mostly) to qmake-based system the qmake bootstrap uses some of the options, so the configures still read config.opt for their own purposes, but the general handling is entirely in the new system now. Change-Id: I2c6c657d4da01c8d520ac74795454747bb224bdd Reviewed-by: Lars Knoll --- configure | 55 ++-------------------------- configure.pri | 24 ++++++++++++ mkspecs/features/data/configure.json | 2 + mkspecs/features/qt_configure.prf | 23 ++++++++++-- tools/configure/configureapp.cpp | 52 ++------------------------ tools/configure/configureapp.h | 3 +- 6 files changed, 53 insertions(+), 106 deletions(-) diff --git a/configure b/configure index 9fcf066928..2fa44880c3 100755 --- a/configure +++ b/configure @@ -84,9 +84,8 @@ if [ x"$1" = x"-top-level" ]; then shift fi -CFG_REDO=no -OPT_CMDLINE= # excluding -verbose (for config.opt) -QMAKE_CMDLINE= # including -verbose (for actual parsing) +OPT_CMDLINE= # expanded version for the script +QMAKE_CMDLINE= # verbatim version for qmake call set -f # suppress globbing in for loop SAVED_IFS=$IFS IFS=' @@ -104,14 +103,8 @@ for i in "$@"; do fi for a in `cat $optfile`; do OPT_CMDLINE="$OPT_CMDLINE -$a" - QMAKE_CMDLINE="$QMAKE_CMDLINE $a" done - CFG_REDO=yes # suppress repeated config.opt writeout - continue - ;; - -v|-verbose|--verbose|-no-v|-no-verbose|--no-verbose) ;; *) OPT_CMDLINE="$OPT_CMDLINE @@ -122,7 +115,7 @@ $i" $i" done set -- -for i in $QMAKE_CMDLINE; do +for i in $OPT_CMDLINE; do set -- "$@" "$i" done set +f @@ -466,13 +459,11 @@ XPLATFORM_WATCHOS=no # Whether target platform is watchOS XPLATFORM_ANDROID=no XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) PLATFORM= -OPT_CONFIRM_LICENSE=no OPT_SHADOW=maybe OPT_VERBOSE=no OPT_HELP= CFG_SILENT=no OPT_MAC_SDK= -COMMERCIAL_USER=ask CFG_DEV=no # initalize variables used for installation @@ -726,19 +717,6 @@ while [ "$#" -gt 0 ]; do developer-build) CFG_DEV="yes" ;; - commercial) - COMMERCIAL_USER="yes" - ;; - opensource) - COMMERCIAL_USER="no" - ;; - confirm-license) - if [ "$VAL" = "yes" ]; then - OPT_CONFIRM_LICENSE="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; h|help) if [ "$VAL" = "yes" ]; then OPT_HELP="$VAL" @@ -1645,33 +1623,6 @@ fi "$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled" -- "$@" || exit -#------------------------------------------------------------------------------- -# finally save the executed command to another script -#------------------------------------------------------------------------------- -if [ $CFG_REDO = no ]; then - if [ "$COMMERCIAL_USER" = "ask" ]; then - if grep '^QT_EDITION = OpenSource$' "$outpath/mkspecs/qconfig.pri" >/dev/null 2>&1; then - OPT_CMDLINE="$OPT_CMDLINE --opensource" - else - OPT_CMDLINE="$OPT_CMDLINE --commercial" - fi - fi - if [ "$OPT_CONFIRM_LICENSE" = "no" ]; then - OPT_CMDLINE="$OPT_CMDLINE --confirm-license" - fi - - # skip first line, as it's always empty due to unconditional field separation - echo "$OPT_CMDLINE" | tail -n +2 > config.opt - - [ -f "config.status" ] && rm -f config.status - echo "#!/bin/sh" > config.status - echo "$relpathMangled/$relconf -redo \"\$@\"" >> config.status - chmod +x config.status -fi - #------------------------------------------------------------------------------- # final notes for the user #------------------------------------------------------------------------------- diff --git a/configure.pri b/configure.pri index 526b09e965..e19861b533 100644 --- a/configure.pri +++ b/configure.pri @@ -91,11 +91,14 @@ defineReplace(qtConfFunc_licenseCheck) { val = $$lower($$prompt("Which edition of Qt do you want to use? ", false)) equals(val, c) { commercial = yes + QMAKE_SAVED_ARGS += -commercial } else: equals(val, o) { commercial = no + QMAKE_SAVED_ARGS += -opensource } else { next() } + export(QMAKE_SAVED_ARGS) break() } } else { @@ -206,6 +209,8 @@ defineReplace(qtConfFunc_licenseCheck) { val = $$lower($$prompt("Do you accept the terms of $$affix license? ", false)) equals(val, y)|equals(val, yes) { logn() + QMAKE_SAVED_ARGS += -confirm-license + export(QMAKE_SAVED_ARGS) return(true) } else: equals(val, n)|equals(val, no) { return(false) @@ -722,3 +727,22 @@ discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri) QMAKE_POST_CONFIGURE += \ "include(\$\$[QT_HOST_DATA/get]/mkspecs/qconfig.pri)" \ "include(\$\$[QT_HOST_DATA/get]/mkspecs/qmodule.pri)" + +defineTest(createConfigStatus) { + $$QMAKE_REDO_CONFIG: return() + cfg = $$relative_path($$_PRO_FILE_PWD_/configure, $$OUT_PWD) + ext = + equals(QMAKE_HOST.os, Windows) { + ext = .bat + cont = \ + "$$system_quote($$system_path($$cfg)$$ext) -redo %*" + } else { + cont = \ + "$${LITERAL_HASH}!/bin/sh" \ + "exec $$system_quote($$cfg) -redo \"$@\"" + } + write_file($$OUT_PWD/config.status$$ext, cont, exe)|error() +} + +QMAKE_POST_CONFIGURE += \ + "createConfigStatus()" diff --git a/mkspecs/features/data/configure.json b/mkspecs/features/data/configure.json index a937f79b99..20a83025e6 100644 --- a/mkspecs/features/data/configure.json +++ b/mkspecs/features/data/configure.json @@ -9,6 +9,8 @@ "recheck": { "type": "void", "name": "cache_use", "value": "positive" }, "recheck-all": { "type": "void", "name": "cache_use", "value": "none" }, + + "redo": { "type": "redo" } } }, diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 1be92a8b43..936a563b9e 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -177,6 +177,17 @@ defineTest(qtConfCommandline_addString) { export(config.input.$$opt) } +defineTest(qtConfCommandline_redo) { + !exists($$OUT_PWD/config.opt) { + qtConfAddError("No config.opt present - cannot redo configuration.") + return() + } + QMAKE_EXTRA_ARGS = $$cat($$OUT_PWD/config.opt, lines) $$QMAKE_EXTRA_ARGS + export(QMAKE_EXTRA_ARGS) + QMAKE_REDO_CONFIG = true + export(QMAKE_REDO_CONFIG) +} + defineTest(qtConfParseCommandLine) { customCalls = for (cc, allConfigs) { @@ -1752,6 +1763,8 @@ for(ever) { for (currentConfig, allConfigs): \ qtConfSetupLibraries() +QMAKE_SAVED_ARGS = $$QMAKE_EXTRA_ARGS +QMAKE_REDO_CONFIG = false qtConfParseCommandLine() !isEmpty(_QMAKE_SUPER_CACHE_): \ @@ -1829,13 +1842,17 @@ for (currentConfig, allConfigs) { !isEmpty(QT_CONFIGURE_SKIPPED_MODULES): \ qtConfAddNote("The following modules are not being compiled in this configuration:" $$QT_CONFIGURE_SKIPPED_MODULES) +logn("Done running configuration tests.") +logn() + +!$$QMAKE_REDO_CONFIG { + write_file($$OUT_PWD/config.opt, QMAKE_SAVED_ARGS)|error() +} + # these come from the pri files loaded above. for (p, QMAKE_POST_CONFIGURE): \ eval($$p) -logn("Done running configuration tests.") -logn() - logn("Configure summary:") logn() qtConfPrintReport() diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index cfba57272f..49dab2fcd4 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -107,10 +107,6 @@ Configure::Configure(int& argc, char** argv) //Only used when cross compiling. dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg"; - dictionary[ "REDO" ] = "no"; - - dictionary[ "BUILDTYPE" ] = "none"; - QString tmp = dictionary[ "QMAKESPEC" ]; if (tmp.contains("\\")) { tmp = tmp.mid(tmp.lastIndexOf("\\") + 1); @@ -145,6 +141,7 @@ void Configure::parseCmdLine() sourcePathMangled = QFileInfo(sourcePath).path(); buildPathMangled = QFileInfo(buildPath).path(); } + qmakeCmdLine = configCmdLine; int argCount = configCmdLine.size(); int i = 0; @@ -152,7 +149,6 @@ void Configure::parseCmdLine() // Look first for -redo for (int k = 0 ; k < argCount; ++k) { if (configCmdLine.at(k) == "-redo") { - dictionary["REDO"] = "yes"; configCmdLine.removeAt(k); if (!reloadCmdLine(k)) { dictionary["DONE"] = "error"; @@ -178,13 +174,7 @@ void Configure::parseCmdLine() } for (; i dictionary; - QStringList configCmdLine; + QStringList configCmdLine, qmakeCmdLine; QString outputLine; @@ -80,7 +80,6 @@ private: QString formatPath(const QString &path); bool reloadCmdLine(int idx); - void saveCmdLine(); }; class FileWriter : public QTextStream