summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-11-16 15:13:52 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-13 18:56:34 +0000
commitab0cc3055d3d1f0faa98f96a7e8ae58b6ef6461a (patch)
treeba14bef85165e3dadaac1b46f5c6cd8a734ececf
parent8861b82f9ef59fa871adc86552012cd90eee6e09 (diff)
move all target spec handling to qmake-based configure system
we pull this feat off by booting configure with a dummy spec. the proper spec gets loaded subsequently. note that it was necessary to move the cache loading after processing the early checks (from which the spec handling is triggered). this is just fine, as the cache is needed only by tests, which are forbidden at this stage by definition. Change-Id: I5120e25a8bf05fb8cc5485fd93cf6387301089aa Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rwxr-xr-xconfigure99
-rw-r--r--configure.json7
-rw-r--r--configure.pri33
-rw-r--r--mkspecs/dummy/qmake.conf8
-rw-r--r--mkspecs/features/qt_configure.prf16
-rw-r--r--tools/configure/configureapp.cpp49
6 files changed, 57 insertions, 155 deletions
diff --git a/configure b/configure
index 100c3db0d2..82df73fb1b 100755
--- a/configure
+++ b/configure
@@ -283,23 +283,6 @@ getQMakeConf()
getSingleQMakeVariable "$1" "$specvals"
}
-resolveDeviceMkspec()
-{
- result=$(find "$relpath/mkspecs/devices/" -type d -name "*$1*" | sed "s,^$relpath/mkspecs/,,")
- match_count=$(echo "$result" | wc -w)
- if [ "$match_count" -gt 1 ]; then
- echo >&2 "Error: Multiple matches for device '$1'. Candidates are:"
- tabbed_result=$(echo "$result" | sed 's,^, ,')
- echo >&2 "$tabbed_result"
- echo "undefined"
- elif [ "$match_count" -eq 0 ]; then
- echo >&2 "Error: No device matching '$1'"
- echo "undefined"
- else
- echo "$result"
- fi
-}
-
#-------------------------------------------------------------------------------
# operating system detection
#-------------------------------------------------------------------------------
@@ -366,14 +349,6 @@ unset QTDIR
# initalize internal variables
CFG_RELEASE_TOOLS=no
-
-XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++"
-XPLATFORM_MAC=no # Whether target platform is macOS, iOS, tvOS, or watchOS
-XPLATFORM_IOS=no # Whether target platform is iOS
-XPLATFORM_TVOS=no # Whether target platform is tvOS
-XPLATFORM_WATCHOS=no # Whether target platform is watchOS
-XPLATFORM_ANDROID=no
-XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*)
PLATFORM=
OPT_SHADOW=maybe
OPT_VERBOSE=no
@@ -503,13 +478,6 @@ while [ "$#" -gt 0 ]; do
platform)
PLATFORM="$VAL"
;;
- xplatform)
- XPLATFORM="$VAL"
- ;;
- device)
- XPLATFORM=`resolveDeviceMkspec $VAL`
- [ "$XPLATFORM" = "undefined" ] && exit 101
- ;;
optimized-qmake|optimized-tools)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_RELEASE_TOOLS="$VAL"
@@ -711,44 +679,6 @@ if [ -z "$PLATFORM" ]; then
esac
fi
-[ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
-
-case "$XPLATFORM" in
- *win32-g++*)
- XPLATFORM_MINGW=yes
- ;;
- *qnx-*)
- ;;
- *haiku-*)
- ;;
- *ios*)
- XPLATFORM_MAC=yes
- XPLATFORM_IOS=yes
- ;;
- *tvos*)
- XPLATFORM_MAC=yes
- XPLATFORM_TVOS=yes
- ;;
- *watchos*)
- XPLATFORM_MAC=yes
- XPLATFORM_WATCHOS=yes
- ;;
- *macx*)
- XPLATFORM_MAC=yes
- ;;
- *integrity*)
- ;;
- # XPLATFORM_ANDROID should not be set for unsupported/android-g++
- *unsupported*)
- ;;
- *android-g++*)
- XPLATFORM_ANDROID=g++
- ;;
- *android-clang*)
- XPLATFORM_ANDROID=clang
- ;;
-esac
-
#-------------------------------------------------------------------------------
# command line and environment validation
#-------------------------------------------------------------------------------
@@ -758,14 +688,9 @@ if [ -d "$PLATFORM" ]; then
else
QMAKESPEC="$relpath/mkspecs/${PLATFORM}"
fi
-if [ -d "$XPLATFORM" ]; then
- XQMAKESPEC="$XPLATFORM"
-else
- XQMAKESPEC="$relpath/mkspecs/${XPLATFORM}"
-fi
if [ "$BUILD_ON_MAC" = "yes" ]; then
- if [ `basename $QMAKESPEC` = "macx-xcode" ] || [ `basename $XQMAKESPEC` = "macx-xcode" ]; then
+ if [ `basename $QMAKESPEC` = "macx-xcode" ]; then
echo >&2
echo " Platform 'macx-xcode' should not be used when building Qt/Mac." >&2
echo " Please build Qt/Mac with 'macx-clang' or 'macx-g++', then use" >&2
@@ -787,26 +712,6 @@ if [ '!' -d "$QMAKESPEC" ]; then
echo
exit 2
fi
-if [ '!' -d "$XQMAKESPEC" ]; then
- echo
- echo " The specified system/compiler is not supported:"
- echo
- echo " $XQMAKESPEC"
- echo
- echo " Please see the README file for a complete list."
- echo
- exit 2
-fi
-if [ '!' -f "${XQMAKESPEC}/qplatformdefs.h" ]; then
- echo
- echo " The specified system/compiler port is not complete:"
- echo
- echo " $XQMAKESPEC/qplatformdefs.h"
- echo
- echo " Please information use the contact form at http://www.qt.io/contact-us"
- echo
- exit 2
-fi
#-------------------------------------------------------------------------------
# build tree initialization
@@ -980,7 +885,7 @@ cat > "$QTCONFFILE" <<EOF
[EffectivePaths]
Prefix=..
[Paths]
-TargetSpec=$XPLATFORM
+TargetSpec=dummy
HostSpec=$PLATFORM
EOF
if [ x"$relpath" != x"$outpath" ]; then
diff --git a/configure.json b/configure.json
index 59358180d0..77f956ed1a 100644
--- a/configure.json
+++ b/configure.json
@@ -423,7 +423,7 @@
"features": {
"prepare": {
- "output": [ "prepareOptions", "preparePaths" ]
+ "output": [ "prepareSpec", "prepareOptions", "preparePaths" ]
},
"machineTuple": {
"condition": "!config.linux || config.android || tests.machineTuple",
@@ -984,6 +984,11 @@
"earlyReport": [
{
+ "type": "fatal",
+ "condition": "input.xplatform != '' && input.device != ''",
+ "message": "Cannot specify both -xplatform and -device."
+ },
+ {
"condition": "!features.prepare",
"comment": "This is not an actual report - instead, it activates the early setup."
},
diff --git a/configure.pri b/configure.pri
index b8e338bb54..92020abbbb 100644
--- a/configure.pri
+++ b/configure.pri
@@ -476,6 +476,37 @@ defineTest(reloadSpec) {
}
}
+defineTest(qtConfOutput_prepareSpec) {
+ device = $$eval(config.input.device)
+ !isEmpty(device) {
+ devices = $$files($$[QT_HOST_DATA/src]/mkspecs/devices/*$$device*)
+ isEmpty(devices): \
+ qtConfFatalError("No device matching '$$device'.")
+ !count(devices, 1) {
+ err = "Multiple matches for device '$$device'. Candidates are:"
+ for (d, devices): \
+ err += " $$basename(d)"
+ qtConfFatalError($$err)
+ }
+ XSPEC = $$relative_path($$devices, $$[QT_HOST_DATA/src]/mkspecs)
+ }
+ xspec = $$eval(config.input.xplatform)
+ !isEmpty(xspec) {
+ !exists($$[QT_HOST_DATA/src]/mkspecs/$$xspec/qmake.conf): \
+ qtConfFatalError("Invalid target platform '$$xspec'.")
+ XSPEC = $$xspec
+ }
+ isEmpty(XSPEC): \
+ XSPEC = $$[QMAKE_SPEC]
+ export(XSPEC)
+ QMAKESPEC = $$[QT_HOST_DATA/src]/mkspecs/$$XSPEC
+ export(QMAKESPEC)
+
+ # deviceOptions() below contains conditionals coming form the spec,
+ # so this cannot be delayed for a batch reload.
+ reloadSpec()
+}
+
defineTest(qtConfOutput_prepareOptions) {
$${currentConfig}.output.devicePro += \
$$replace(config.input.device-option, "^([^=]+) *= *(.*)$", "\\1 = \\2")
@@ -649,7 +680,7 @@ defineReplace(printHostPaths) {
$$printInstallPath(HostLibraries, hostlibdir, lib) \
$$printInstallPath(HostData, hostdatadir, .) \
"Sysroot=$$config.input.sysroot" \
- "TargetSpec=$$[QMAKE_XSPEC]" \
+ "TargetSpec=$$XSPEC" \
"HostSpec=$$[QMAKE_SPEC]"
return($$ret)
}
diff --git a/mkspecs/dummy/qmake.conf b/mkspecs/dummy/qmake.conf
new file mode 100644
index 0000000000..7077fe6345
--- /dev/null
+++ b/mkspecs/dummy/qmake.conf
@@ -0,0 +1,8 @@
+#
+# Minimal qmake configuration qt_configure.prf is run with.
+#
+
+# Make spec_post.prf happy.
+MAKEFILE_GENERATOR = DUMMY
+QMAKE_PLATFORM = dummy_platform
+QMAKE_COMPILER = dummy_compiler
diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf
index b7b4e1f994..41bd75c45d 100644
--- a/mkspecs/features/qt_configure.prf
+++ b/mkspecs/features/qt_configure.prf
@@ -1768,6 +1768,14 @@ QMAKE_SAVED_ARGS = $$QMAKE_EXTRA_ARGS
QMAKE_REDO_CONFIG = false
qtConfParseCommandLine()
+for (currentConfig, allConfigs) {
+ qtConfSetModuleName()
+ qtConfSetupModuleOutputs()
+ # do early checks, mainly to validate the command line
+ qtConfProcessEarlyChecks()
+}
+qtConfCheckErrors()
+
!isEmpty(_QMAKE_SUPER_CACHE_): \
QMAKE_CONFIG_CACHE = $$dirname(_QMAKE_SUPER_CACHE_)/config.cache
else: \
@@ -1790,14 +1798,6 @@ QMAKE_CONFIG_LOG = $$OUT_PWD/config.log
!equals(QMAKE_CONFIG_CACHE_USE, all): \
write_file($$QMAKE_CONFIG_LOG, "")
-for (currentConfig, allConfigs) {
- qtConfSetModuleName()
- qtConfSetupModuleOutputs()
- # do early checks, mainly to validate the command line
- qtConfProcessEarlyChecks()
-}
-qtConfCheckErrors()
-
CONFIG += qt_conf_tests_allowed
logn()
logn("Running configuration tests...")
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 373fc89090..2ffec0707f 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -130,20 +130,6 @@ void Configure::parseCmdLine()
}
}
- // Then look for XQMAKESPEC
- bool isDeviceMkspec = false;
- for (int j = 0 ; j < argCount; ++j)
- {
- if ((configCmdLine.at(j) == "-xplatform") || (configCmdLine.at(j) == "-device")) {
- isDeviceMkspec = (configCmdLine.at(j) == "-device");
- ++j;
- if (j == argCount)
- break;
- dictionary["XQMAKESPEC"] = configCmdLine.at(j);
- break;
- }
- }
-
for (; i<configCmdLine.size(); ++i) {
if (configCmdLine.at(i) == "-platform") {
++i;
@@ -151,10 +137,6 @@ void Configure::parseCmdLine()
break;
dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
dictionary[ "QMAKESPEC_FROM" ] = "commandline";
- } else if (configCmdLine.at(i) == "-xplatform"
- || configCmdLine.at(i) == "-device") {
- ++i;
- // do nothing
}
else if (configCmdLine.at(i) == "-no-syncqt")
@@ -207,34 +189,6 @@ void Configure::parseCmdLine()
dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
}
}
-
- if (isDeviceMkspec) {
- const QStringList devices = mkspecs.filter("devices/", Qt::CaseInsensitive);
- const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive);
-
- if (family.isEmpty()) {
- dictionary[ "DONE" ] = "error";
- cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl;
- } else if (family.size() > 1) {
- dictionary[ "DONE" ] = "error";
-
- cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl;
-
- foreach (const QString &device, family)
- cout << "\t* " << device << endl;
- } else {
- Q_ASSERT(family.size() == 1);
- dictionary["XQMAKESPEC"] = family.at(0);
- }
-
- } else {
- // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
- if (dictionary.contains("XQMAKESPEC") &&
- !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
- dictionary[ "DONE" ] = "error";
- cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
- }
- }
}
void Configure::generateHeaders()
@@ -361,8 +315,7 @@ void Configure::buildQmake()
confStream << "[EffectivePaths]" << endl
<< "Prefix=.." << endl
<< "[Paths]" << endl
- << "TargetSpec=" << (dictionary.contains("XQMAKESPEC")
- ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"]) << endl
+ << "TargetSpec=dummy" << endl
<< "HostSpec=" << dictionary["QMAKESPEC"] << endl;
if (sourcePath != buildPath)
confStream << "[EffectiveSourcePaths]" << endl