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 <lars.knoll@qt.io>
This commit is contained in:
parent
24cb1580e2
commit
8ebc7e967c
55
configure
vendored
55
configure
vendored
@ -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
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -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()"
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
"recheck": { "type": "void", "name": "cache_use", "value": "positive" },
|
||||
"recheck-all": { "type": "void", "name": "cache_use", "value": "none" },
|
||||
|
||||
"redo": { "type": "redo" }
|
||||
}
|
||||
|
||||
},
|
||||
|
@ -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()
|
||||
|
@ -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<configCmdLine.size(); ++i) {
|
||||
if (configCmdLine.at(i) == "-opensource") {
|
||||
dictionary[ "BUILDTYPE" ] = "opensource";
|
||||
}
|
||||
else if (configCmdLine.at(i) == "-commercial") {
|
||||
dictionary[ "BUILDTYPE" ] = "commercial";
|
||||
}
|
||||
else if (configCmdLine.at(i) == "-platform") {
|
||||
if (configCmdLine.at(i) == "-platform") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
@ -207,10 +197,6 @@ void Configure::parseCmdLine()
|
||||
else if (configCmdLine.at(i) == "-no-syncqt")
|
||||
dictionary[ "SYNCQT" ] = "no";
|
||||
|
||||
else if (configCmdLine.at(i) == "-confirm-license") {
|
||||
dictionary["LICENSE_CONFIRMED"] = "yes";
|
||||
}
|
||||
|
||||
// Directories ----------------------------------------------
|
||||
else if (configCmdLine.at(i) == "-prefix") {
|
||||
++i;
|
||||
@ -871,7 +857,7 @@ void Configure::configure()
|
||||
QStringList args;
|
||||
args << buildPath + "/bin/qmake"
|
||||
<< sourcePathMangled
|
||||
<< "--" << configCmdLine;
|
||||
<< "--" << qmakeCmdLine;
|
||||
|
||||
QString pwd = QDir::currentPath();
|
||||
QDir::setCurrent(buildPathMangled);
|
||||
@ -880,9 +866,6 @@ void Configure::configure()
|
||||
dictionary[ "DONE" ] = "error";
|
||||
}
|
||||
QDir::setCurrent(pwd);
|
||||
|
||||
if ((dictionary["REDO"] != "yes") && (dictionary["DONE"] != "error"))
|
||||
saveCmdLine();
|
||||
}
|
||||
|
||||
bool Configure::reloadCmdLine(int idx)
|
||||
@ -904,35 +887,6 @@ bool Configure::reloadCmdLine(int idx)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Configure::saveCmdLine()
|
||||
{
|
||||
if (dictionary[ "REDO" ] != "yes") {
|
||||
if (dictionary["BUILDTYPE"] == "none") {
|
||||
bool openSource = false;
|
||||
QFile inFile(buildPath + "/mkspecs/qconfig.pri");
|
||||
if (inFile.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream inStream(&inFile);
|
||||
while (!inStream.atEnd()) {
|
||||
if (inStream.readLine() == "QT_EDITION = OpenSource")
|
||||
openSource = true;
|
||||
}
|
||||
}
|
||||
configCmdLine.append(openSource ? "-opensource" : "-commercial");
|
||||
}
|
||||
if (dictionary["LICENSE_CONFIRMED"] != "yes")
|
||||
configCmdLine.append("-confirm-license");
|
||||
QFile outFile(buildPathMangled + "/config.opt");
|
||||
if (outFile.open(QFile::WriteOnly | QFile::Text)) {
|
||||
QTextStream outStream(&outFile);
|
||||
for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
|
||||
outStream << (*it) << endl;
|
||||
}
|
||||
outStream.flush();
|
||||
outFile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Configure::isDone()
|
||||
{
|
||||
return !dictionary["DONE"].isEmpty();
|
||||
|
@ -63,7 +63,7 @@ private:
|
||||
|
||||
// Our variable dictionaries
|
||||
QMap<QString,QString> 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
|
||||
|
Loading…
Reference in New Issue
Block a user