diff --git a/config.tests/common/verifyspec/verifyspec.pro b/config.tests/common/verifyspec/verifyspec.pro index d78ed2985a..11a280e4ce 100644 --- a/config.tests/common/verifyspec/verifyspec.pro +++ b/config.tests/common/verifyspec/verifyspec.pro @@ -1 +1,37 @@ SOURCES = verifyspec.cpp + +# Provide a function to be used by mkspecs +defineTest(deviceSanityCheckCompiler) { + equals(QMAKE_HOST.os, Windows): \ + sfx = .exe + else: \ + sfx = + + # Build the compiler filename using the first value in QMAKE_CXX in order to + # support tools like ccache, which give QMAKE_CXX values of the form: + # ccache + compiler = $$first(QMAKE_CXX)$$sfx + + # Check if the binary exists with an absolute path. Do this check + # before the CROSS_COMPILE empty check below to allow the mkspec + # to derive the compiler path from other device options. + exists($$compiler): return() + + # Check for possible reasons of failure + # check if CROSS_COMPILE device-option is set + isEmpty(CROSS_COMPILE): \ + error("CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=") + + # Check if QMAKE_CXX points to an executable. + ensurePathEnv() + for (dir, QMAKE_PATH_ENV) { + exists($$dir/$${compiler}): \ + return() + } + + # QMAKE_CXX does not point to a compiler. + error("Compiler $$QMAKE_CXX not found. Check the value of CROSS_COMPILE -device-option") +} + +defined(qtConfSanitizeMkspec, test): \ + qtConfSanitizeMkspec() diff --git a/config_help.txt b/config_help.txt index 28634be947..bf50491110 100644 --- a/config_help.txt +++ b/config_help.txt @@ -85,7 +85,6 @@ Build options: -framework ........... Build Qt framework bundles [yes] (Apple only) -platform ... Select host mkspec [detected] - -host-option ..... Add option for the host mkspec -xplatform .. Select target mkspec when cross-compiling [PLATFORM] -device ....... Cross-compile for device -device-option ... Add option for the device mkspec diff --git a/configure b/configure index c297bca9e8..82df73fb1b 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,43 +115,16 @@ $i" $i" done set -- -for i in $QMAKE_CMDLINE; do +for i in $OPT_CMDLINE; do set -- "$@" "$i" done set +f IFS=$SAVED_IFS -# initialize global variables -DEVICE_VARS_FILE=.device.vars -HOST_VARS_FILE=.host.vars - -:> "$DEVICE_VARS_FILE" -:> "$HOST_VARS_FILE" - #------------------------------------------------------------------------------- # utility functions #------------------------------------------------------------------------------- -makeabs() -{ - local FILE="$1" - local RES="$FILE" - if [ -z "${FILE##/*}" ]; then - true - elif [ "$OSTYPE" = "msys" -a -z "${FILE##[a-zA-Z]:[/\\]*}" ]; then - true - else - RES=$PWD/$FILE - fi - RES=$RES/ - while true; do - nres=`echo "$RES" | sed 's,/[^/][^/]*/\.\./,/,g; s,/\./,/,g'` - test x"$nres" = x"$RES" && break - RES=$nres - done - echo "$RES" | sed 's,//,/,g; s,/$,,' -} - # Helper function for getQMakeConf. It parses include statements in # qmake.conf and prints out the expanded file expandQMakeConf() @@ -172,15 +138,7 @@ expandQMakeConf() echo "WARNING: Unable to find file $conf_file" >&2 continue fi - expandQMakeConf "$conf_file" "$2" - ;; - *load\(device_config\)*) - conf_file="$2" - if [ ! -f "$conf_file" ]; then - echo "WARNING: Unable to find file $conf_file" >&2 - continue - fi - expandQMakeConf "$conf_file" "$2" + expandQMakeConf "$conf_file" ;; *) echo "$line" @@ -195,12 +153,6 @@ BEGIN { values["LITERAL_WHITESPACE"] = " " values["LITERAL_DOLLAR"] = "$" } -/^!?host_build:/ { - scopeStart = index($0, ":") + 1 - condition = substr($0, 0, scopeStart - 2) - if (condition != "'"$1"'") { next } - $0 = substr($0, scopeStart) -} /^[_A-Z0-9.]+[ \t]*\+?=/ { valStart = index($0, "=") + 1 @@ -325,72 +277,12 @@ macSDKify() getQMakeConf() { if [ -z "$specvals" ]; then - specvals=`expandQMakeConf "$QMAKESPEC/qmake.conf" "$HOST_VARS_FILE" | extractQMakeVariables "host_build"` + specvals=`expandQMakeConf "$QMAKESPEC/qmake.conf" | extractQMakeVariables` if [ "$BUILD_ON_MAC" = "yes" ]; then specvals=$(macSDKify "$specvals"); fi fi getSingleQMakeVariable "$1" "$specvals" } -getXQMakeConf() -{ - if [ -z "$xspecvals" ]; then - xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" "$DEVICE_VARS_FILE" | extractQMakeVariables "!host_build"` - if [ "$XPLATFORM_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi - fi - getSingleQMakeVariable "$1" "$xspecvals" -} - -#------------------------------------------------------------------------------- -# device options -#------------------------------------------------------------------------------- -DeviceVar() -{ - case "$1" in - set) - eq="=" - ;; - *) - echo >&2 "BUG: wrong command to DeviceVar: $1" - ;; - esac - - echo "$2" "$eq" "$3" >> "$DEVICE_VARS_FILE" -} - -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 -} - -#------------------------------------------------------------------------------- -# Host options -#------------------------------------------------------------------------------- -HostVar() -{ - case "$1" in - set) - eq="=" - ;; - *) - echo >&2 "BUG: wrong command to HostVar: $1" - ;; - esac - - echo "$2" "$eq" "$3" >> "$HOST_VARS_FILE" -} - #------------------------------------------------------------------------------- # operating system detection #------------------------------------------------------------------------------- @@ -452,83 +344,18 @@ fi # initalize variables #------------------------------------------------------------------------------- -# Use CC/CXX to run config.tests -mkdir -p "$outpath/config.tests" -rm -f "$outpath/config.tests/.qmake.cache" -: > "$outpath/config.tests/.qmake.cache" - # QTDIR may be set and point to an old or system-wide Qt installation 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_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 -QT_INSTALL_PREFIX= -QT_INSTALL_DOCS= -QT_INSTALL_HEADERS= -QT_INSTALL_LIBS= -QT_INSTALL_BINS= -QT_INSTALL_LIBEXECS= -QT_INSTALL_PLUGINS= -QT_INSTALL_IMPORTS= -QT_INSTALL_QML= -QT_INSTALL_ARCHDATA= -QT_INSTALL_DATA= -QT_INSTALL_TRANSLATIONS= -QT_INSTALL_SETTINGS= -QT_INSTALL_EXAMPLES= -QT_INSTALL_TESTS= -CFG_SYSROOT= -QT_HOST_PREFIX= -QT_HOST_BINS= -QT_HOST_LIBS= -QT_HOST_DATA= -QT_EXT_PREFIX= - -# Android vars -if [ -z "$ANDROID_SDK_ROOT" ]; then - if [ "$UNAME_SYSTEM" = "Darwin" ] && [ -d "$HOME/Library/Android/sdk" ]; then - ANDROID_SDK_ROOT="$HOME/Library/Android/sdk" - elif [ "$UNAME_SYSTEM" = "Linux" ] && [ -d "$HOME/Android/Sdk" ]; then - ANDROID_SDK_ROOT="$HOME/Android/Sdk" - fi -fi - -if [ -z "$ANDROID_NDK_ROOT" ]; then - if [ -d "$ANDROID_SDK_ROOT/ndk-bundle" ]; then - ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk-bundle" - elif [ "$UNAME_SYSTEM" = "Darwin" ] && [ -d "$HOME/Library/Android/sdk/ndk-bundle" ]; then - ANDROID_NDK_ROOT="$HOME/Library/Android/sdk/ndk-bundle" - elif [ "$UNAME_SYSTEM" = "Linux" ] && [ -d "$HOME/Android/Sdk/ndk-bundle" ]; then - ANDROID_NDK_ROOT="$HOME/Android/Sdk/ndk-bundle" - fi -fi - -CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT -CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT -CFG_DEFAULT_ANDROID_PLATFORM=android-16 -CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a -CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.9 -CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST - #------------------------------------------------------------------------------- # parse command line arguments #------------------------------------------------------------------------------- @@ -597,7 +424,6 @@ while [ "$#" -gt 0 ]; do -xplatform| \ -device| \ -device-option| \ - -host-option| \ -sdk| \ -android-sdk| \ -android-ndk| \ @@ -646,101 +472,12 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=no case "$VAR" in - prefix) - QT_INSTALL_PREFIX="$VAL" - ;; - hostprefix) - QT_HOST_PREFIX="$VAL" - ;; - hostdatadir) - QT_HOST_DATA="$VAL" - ;; - hostbindir) - QT_HOST_BINS="$VAL" - ;; - hostlibdir) - QT_HOST_LIBS="$VAL" - ;; - extprefix) - QT_EXT_PREFIX="$VAL" - ;; - docdir) - QT_INSTALL_DOCS="$VAL" - ;; - headerdir) - QT_INSTALL_HEADERS="$VAL" - ;; - plugindir) - QT_INSTALL_PLUGINS="$VAL" - ;; - importdir) - QT_INSTALL_IMPORTS="$VAL" - ;; - qmldir) - QT_INSTALL_QML="$VAL" - ;; - archdatadir) - QT_INSTALL_ARCHDATA="$VAL" - ;; - datadir) - QT_INSTALL_DATA="$VAL" - ;; - libdir) - QT_INSTALL_LIBS="$VAL" - ;; - translationdir) - QT_INSTALL_TRANSLATIONS="$VAL" - ;; - sysconfdir|settingsdir) - QT_INSTALL_SETTINGS="$VAL" - ;; - examplesdir) - QT_INSTALL_EXAMPLES="$VAL" - ;; - testsdir) - QT_INSTALL_TESTS="$VAL" - ;; - sysroot) - CFG_SYSROOT="$VAL" - ;; external-hostbindir) CFG_HOST_QT_TOOLS_PATH="$VAL" - HostVar set HOST_QT_TOOLS "$VAL" ;; - bindir) - QT_INSTALL_BINS="$VAL" - ;; - libexecdir) - QT_INSTALL_LIBEXECS="$VAL" - ;; - sdk) - if [ "$BUILD_ON_MAC" = "yes" ]; then - DeviceVar set !host_build:QMAKE_MAC_SDK "$VAL" - OPT_MAC_SDK="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; platform) PLATFORM="$VAL" ;; - xplatform) - XPLATFORM="$VAL" - ;; - device) - XPLATFORM=`resolveDeviceMkspec $VAL` - [ "$XPLATFORM" = "undefined" ] && exit 101 - ;; - device-option) - DEV_VAR=`echo $VAL | cut -d '=' -f 1` - DEV_VAL=`echo $VAL | cut -d '=' -f 2-` - DeviceVar set $DEV_VAR "$DEV_VAL" - ;; - host-option) - HOST_VAR=`echo $VAL | cut -d '=' -f 1` - HOST_VAL=`echo $VAL | cut -d '=' -f 2-` - HostVar set $HOST_VAR "$HOST_VAL" - ;; optimized-qmake|optimized-tools) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then CFG_RELEASE_TOOLS="$VAL" @@ -749,19 +486,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" @@ -782,24 +506,6 @@ while [ "$#" -gt 0 ]; do # need to keep this here, to ensure qmake is built silently CFG_SILENT="$VAL" ;; - android-sdk) - CFG_DEFAULT_ANDROID_SDK_ROOT="$VAL" - ;; - android-ndk) - CFG_DEFAULT_ANDROID_NDK_ROOT="$VAL" - ;; - android-ndk-platform) - CFG_DEFAULT_ANDROID_PLATFORM="$VAL" - ;; - android-ndk-host) - CFG_DEFAULT_ANDROID_NDK_HOST="$VAL" - ;; - android-arch) - CFG_DEFAULT_ANDROID_TARGET_ARCH="$VAL" - ;; - android-toolchain-version) - CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION="$VAL" - ;; *) ;; esac @@ -973,115 +679,18 @@ 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 #------------------------------------------------------------------------------- -if [ "$XPLATFORM_ANDROID" != "no" ]; then - if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then - case $PLATFORM in - linux-*) - if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86" ]; then - CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86 - elif [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/linux-x86_64" ]; then - CFG_DEFAULT_ANDROID_NDK_HOST=linux-x86_64 - fi - ;; - macx-*) - CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86 - if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/darwin-x86_64" ]; then - CFG_DEFAULT_ANDROID_NDK_HOST=darwin-x86_64 - fi - ;; - win32-*) - CFG_DEFAULT_ANDROID_NDK_HOST=windows - if [ -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/windows-x86_64" ]; then - CFG_DEFAULT_ANDROID_NDK_HOST=windows-x86_64 - fi - ;; - esac - fi - - if [ -z "$CFG_DEFAULT_ANDROID_NDK_ROOT" ]; then - echo - echo "Can not find Android NDK. Please use -android-ndk option to specify one" - exit 1 - fi - if [ -z "$CFG_DEFAULT_ANDROID_SDK_ROOT" ]; then - echo - echo "Can not find Android SDK. Please use -android-sdk option to specify one" - exit 1 - fi - if [ -z "CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt" ]; then - echo - echo "Can not detect Android NDK toolchain. Please use -android-toolchain-version to specify" - exit 1 - fi - if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ] || [ ! -d "$CFG_DEFAULT_ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION/prebuilt/$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then - echo - echo "Can not detect the android host. Please use -android-ndk-host option to specify one" - exit 1 - fi - - DeviceVar set DEFAULT_ANDROID_SDK_ROOT "$CFG_DEFAULT_ANDROID_SDK_ROOT" - DeviceVar set DEFAULT_ANDROID_NDK_ROOT "$CFG_DEFAULT_ANDROID_NDK_ROOT" - DeviceVar set DEFAULT_ANDROID_PLATFORM "$CFG_DEFAULT_ANDROID_PLATFORM" - DeviceVar set DEFAULT_ANDROID_NDK_HOST "$CFG_DEFAULT_ANDROID_NDK_HOST" - DeviceVar set DEFAULT_ANDROID_TARGET_ARCH "$CFG_DEFAULT_ANDROID_TARGET_ARCH" - DeviceVar set DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION "$CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION" -fi - if [ -d "$PLATFORM" ]; then QMAKESPEC="$PLATFORM" 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 @@ -1103,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 @@ -1156,283 +745,6 @@ if [ "$OPT_SHADOW" = "yes" ]; then mkdir -p "$outpath/mkspecs" fi -if [ "$XPLATFORM_ANDROID" = "no" ]; then - TEST_COMPILER=`getXQMakeConf QMAKE_CXX` - GCC_MACHINE_DUMP= - case "$TEST_COMPILER" in *g++) GCC_MACHINE_DUMP=$($TEST_COMPILER -dumpmachine);; esac - if [ -n "$GCC_MACHINE_DUMP" ]; then - DeviceVar set GCC_MACHINE_DUMP $($TEST_COMPILER -dumpmachine) - fi -fi - -#------------------------------------------------------------------------------- -# postprocess installation and deployment paths -#------------------------------------------------------------------------------- - -if [ -z "$QT_INSTALL_PREFIX" ]; then - if [ "$CFG_DEV" = "yes" ]; then - QT_INSTALL_PREFIX="$outpath" # In Development, we use sandboxed builds by default - else - QT_INSTALL_PREFIX="/usr/local/Qt-${QT_VERSION}" # the default install prefix is /usr/local/Qt-$QT_VERSION - fi -fi -QT_INSTALL_PREFIX=`makeabs "$QT_INSTALL_PREFIX"` - -if [ -z "$QT_EXT_PREFIX" ]; then - QT_EXT_PREFIX=$QT_INSTALL_PREFIX - if [ -n "$CFG_SYSROOT" ]; then - QMAKE_SYSROOTIFY=true - else - QMAKE_SYSROOTIFY=false - fi -else - QT_EXT_PREFIX=`makeabs "$QT_EXT_PREFIX"` - QMAKE_SYSROOTIFY=false -fi - -if [ -z "$QT_HOST_PREFIX" ]; then - if $QMAKE_SYSROOTIFY; then - QT_HOST_PREFIX=$CFG_SYSROOT$QT_EXT_PREFIX - else - QT_HOST_PREFIX=$QT_EXT_PREFIX - fi - HAVE_HOST_PATH=false -else - QT_HOST_PREFIX=`makeabs "$QT_HOST_PREFIX"` - HAVE_HOST_PATH=true -fi - -#------- make the paths relative to the prefixes -------- - -PREFIX_COMPLAINTS= -PREFIX_REMINDER=false -while read basevar baseoption var option; do - eval path=\$QT_${basevar}_$var - [ -z "$path" ] && continue - path=`makeabs "$path"` - eval base=\$QT_${basevar}_PREFIX - rel=${path##$base} - if [ x"$rel" = x"$path" ]; then - if [ x"$option" != x"sysconf" ]; then - PREFIX_COMPLAINTS="$PREFIX_COMPLAINTS - NOTICE: -${option}dir is not a subdirectory of ${baseoption}prefix." - eval \$HAVE_${basevar}_PATH || PREFIX_REMINDER=true - fi - eval QT_REL_${basevar}_$var=\$rel - elif [ -z "$rel" ]; then - eval QT_REL_${basevar}_$var=. - else - eval QT_REL_${basevar}_$var=\${rel#/} - fi -done < "$outpath/src/corelib/global/qconfig.cpp.new" < "$QTCONFFILE" <> "$QTCONFFILE" <> "$QTCONFFILE" <> "$QTCONFFILE" </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 #------------------------------------------------------------------------------- @@ -1707,12 +935,7 @@ else echo fi -if [ -n "$PREFIX_COMPLAINTS" ]; then - echo - echo "$PREFIX_COMPLAINTS" - echo -fi - +QT_INSTALL_PREFIX=`sed -ne 's/^Prefix=//p' < "$outpath/qmake/builtin-qt.conf"` MAKE=`basename "$MAKE"` echo echo Qt is now configured for building. Just run \'$MAKE\'. diff --git a/configure.json b/configure.json index c13f44ed00..51eab72df2 100644 --- a/configure.json +++ b/configure.json @@ -1,5 +1,7 @@ { "files": { + "builtinQtConf": "qmake/builtin-qt.conf", + "qconfigSource": "src/corelib/global/qconfig.cpp", "publicHeader": "src/corelib/global/qconfig.h", "privateHeader": "src/corelib/global/qconfig_p.h", "publicPro": "mkspecs/qconfig.pri", @@ -43,7 +45,7 @@ "libexecdir": "string", "plugindir": "string", "qmldir": "string", - "settingsdir": "string", + "settingsdir": { "type": "string", "name": "sysconfdir" }, "sysconfdir": "string", "testsdir": "string", "translationdir": "string", @@ -65,7 +67,6 @@ "commercial": "void", "compile-examples": { "type": "boolean", "name": "compile_examples" }, "confirm-license": "void", - "continue": "void", "dbus": { "type": "optionalString", "values": [ "no", "yes", "linked", "runtime" ] }, "dbus-linked": { "type": "void", "name": "dbus", "value": "linked" }, "dbus-runtime": { "type": "void", "name": "dbus", "value": "runtime" }, @@ -73,7 +74,7 @@ "debug-and-release": { "type": "boolean", "name": "debug_and_release" }, "developer-build": "void", "device": "string", - "device-option": "string", + "device-option": "addString", "force-asserts": { "type": "boolean", "name": "force_asserts" }, "force-debug-info": { "type": "boolean", "name": "force_debug_info" }, "force-pkg-config": { "type": "void", "name": "pkg-config" }, @@ -83,7 +84,6 @@ "gnumake": { "type": "boolean", "name": "GNUmake" }, "gui": "boolean", "headersclean": "boolean", - "host-option": "string", "incredibuild-xge": { "type": "boolean", "name": "incredibuild_xge" }, "libudev": "boolean", "ltcg": "boolean", @@ -190,9 +190,9 @@ "testTypeDependencies": { "linkerSupportsFlag": [ "use_gold_linker" ], - "verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs" ], + "verifySpec": [ "shared", "use_gold_linker", "compiler-flags", "gcc-sysroot", "qmakeargs", "commit" ], "compile": [ "verifyspec" ], - "detectPkgConfig": [ "cross_compile" ], + "detectPkgConfig": [ "cross_compile", "machineTuple" ], "library": [ "pkg-config" ], "getPkgConfigVariable": [ "pkg-config" ], "neon": [ "architecture" ] @@ -203,6 +203,10 @@ }, "tests": { + "machineTuple": { + "label": "machine tuple", + "type": "machineTuple" + }, "verifyspec": { "label": "valid makespec", "type": "verifySpec", @@ -419,6 +423,16 @@ }, "features": { + "prepare": { + "output": [ "prepareSpec", "prepareOptions", "preparePaths" ] + }, + "machineTuple": { + "condition": "!config.linux || config.android || tests.machineTuple", + "output": [ "machineTuple" ] + }, + "commit": { + "output": [ "commitOptions" ] + }, "android-style-assets": { "label": "Android Style Assets", "condition": "config.android", @@ -978,6 +992,15 @@ }, "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." + }, { "type": "fatal", "condition": "!call.licenseCheck", diff --git a/configure.pri b/configure.pri index 526b09e965..0dfe6cc719 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) @@ -228,6 +233,14 @@ defineReplace(qtConfFunc_licenseCheck) { # custom tests +# this is meant for linux device specs only +defineTest(qtConfTest_machineTuple) { + qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", $${1}.tuple)|return(false) + $${1}.cache += tuple + export($${1}.cache) + return(true) +} + defineTest(qtConfTest_architecture) { !qtConfTest_compile($${1}): \ error("Could not determine $$eval($${1}.label). See config.log for details.") @@ -323,11 +336,9 @@ defineTest(qtConfTest_detectPkgConfig) { } pkgConfigLibdir = $$sysroot/usr/lib/pkgconfig:$$sysroot/usr/share/pkgconfig - gcc { - qtRunLoggedCommand("$$QMAKE_CXX -dumpmachine", gccMachineDump): \ - !isEmpty(gccMachineDump): \ - pkgConfigLibdir = "$$pkgConfigLibdir:$$sysroot/usr/lib/$$gccMachineDump/pkgconfig" - } + machineTuple = $$eval($${currentConfig}.tests.machineTuple.tuple) + !isEmpty(machineTuple): \ + pkgConfigLibdir = "$$pkgConfigLibdir:$$sysroot/usr/lib/$$machineTuple/pkgconfig" qtConfAddNote("PKG_CONFIG_LIBDIR automatically set to $$pkgConfigLibdir") } @@ -432,6 +443,436 @@ defineTest(qtConfTest_checkCompiler) { # custom outputs +# this reloads the qmakespec as completely as reasonably possible. +defineTest(reloadSpec) { + bypassNesting() { + for (f, QMAKE_INTERNAL_INCLUDED_FILES) { + contains(f, .*/mkspecs/.*):\ + !contains(f, .*/(qt_build_config|qt_parts|qt_configure|configure_base)\\.prf): \ + discard_from($$f) + } + # nobody's going to try to re-load the features above, + # so don't bother with being selective. + QMAKE_INTERNAL_INCLUDED_FEATURES = + + _SAVED_CONFIG = $$CONFIG + load(spec_pre) + load(device_config) # avoid that the spec loads it later. + # discard possible settings from an earlier configure run. + discard_from($$[QT_HOST_DATA/get]/mkspecs/qdevice.pri) + # qdevice.pri gets written too late (and we can't write it early + # enough, as it's populated in stages, with later ones depending + # on earlier ones). so inject its variables manually. + for (l, $${currentConfig}.output.devicePro): \ + eval($$l) + include($$QMAKESPEC/qmake.conf) + load(spec_post) + load(default_pre) + CONFIG += $$_SAVED_CONFIG + + # ensure pristine environment for configuration. again. + discard_from($$[QT_HOST_DATA/get]/mkspecs/qconfig.pri) + discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri) + } +} + +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") + darwin:!isEmpty(config.input.sdk) { + $${currentConfig}.output.devicePro += \ + "QMAKE_MAC_SDK = $$val_escape(config.input.sdk)" + } + android { + sdk_root = $$eval(config.input.android-sdk) + isEmpty(sdk_root): \ + sdk_root = $$getenv(ANDROID_SDK_ROOT) + isEmpty(sdk_root) { + for(ever) { + equals(QMAKE_HOST.os, Linux): \ + sdk_root = $$(HOME)/Android/Sdk + else: equals(QMAKE_HOST.os, Darwin): \ + sdk_root = $$(HOME)/Library/Android/sdk + else: \ + break() + !exists($$sdk_root): \ + sdk_root = + break() + } + } + isEmpty(sdk_root): \ + qtConfFatalError("Cannot find Android SDK." \ + "Please use -android-sdk option to specify one.") + + ndk_root = $$eval(config.input.android-ndk) + isEmpty(ndk_root): \ + ndk_root = $$getenv(ANDROID_NDK_ROOT) + isEmpty(ndk_root) { + for(ever) { + exists($$sdk_root/ndk-bundle) { + ndk_root = $$sdk_root/ndk-bundle + break() + } + equals(QMAKE_HOST.os, Linux): \ + ndk_root = $$(HOME)/Android/Sdk/ndk-bundle + else: equals(QMAKE_HOST.os, Darwin): \ + ndk_root = $$(HOME)/Library/Android/sdk/ndk-bundle + else: \ + break() + !exists($$ndk_root): \ + ndk_root = + break() + } + } + isEmpty(ndk_root): \ + qtConfFatalError("Cannot find Android NDK." \ + "Please use -android-ndk option to specify one.") + + ndk_tc_ver = $$eval(config.input.android-toolchain-version) + isEmpty(ndk_tc_ver): \ + ndk_tc_ver = 4.9 + !exists($$ndk_root/toolchains/arm-linux-androideabi-$$ndk_tc_ver/prebuilt/*): \ + qtConfFatalError("Cannot detect Android NDK toolchain." \ + "Please use -android-toolchain-version to specify it.") + + ndk_tc_pfx = $$ndk_root/toolchains/arm-linux-androideabi-$$ndk_tc_ver/prebuilt + ndk_host = $$eval(config.input.android-ndk-host) + isEmpty(ndk_host): \ + ndk_host = $$getenv(ANDROID_NDK_HOST) + isEmpty(ndk_host) { + equals(QMAKE_HOST.os, Linux) { + ndk_host_64 = linux-x86_64 + ndk_host_32 = linux-x86 + } else: equals(QMAKE_HOST.os, Darwin) { + ndk_host_64 = darwin-x86_64 + ndk_host_32 = darwin-x86 + } else: equals(QMAKE_HOST.os, Windows) { + ndk_host_64 = windows-x86_64 + ndk_host_32 = windows + } else { + qtConfFatalError("Host operating system not supported by Android.") + } + !exists($$ndk_tc_pfx/$$ndk_host_64/*): ndk_host_64 = + !exists($$ndk_tc_pfx/$$ndk_host_32/*): ndk_host_32 = + equals(QMAKE_HOST.arch, x86_64):!isEmpty(ndk_host_64) { + ndk_host = $$ndk_host_64 + } else: equals(QMAKE_HOST.arch, x86):!isEmpty(ndk_host_32) { + ndk_host = $$ndk_host_32 + } else { + !isEmpty(ndk_host_64): \ + ndk_host = $$ndk_host_64 + else: !isEmpty(ndk_host_32): \ + ndk_host = $$ndk_host_32 + else: \ + qtConfFatalError("Cannot detect the Android host." \ + "Please use -android-ndk-host option to specify one.") + qtConfAddNotice("Available Android host does not match host architecture.") + } + } else { + !exists($$ndk_tc_pfx/$$ndk_host/*): \ + qtConfFatalError("Specified Android NDK host is invalid.") + } + + target_arch = $$eval(config.input.android-arch) + isEmpty(target_arch): \ + target_arch = armeabi-v7a + + platform = $$eval(config.input.android-ndk-platform) + isEmpty(platform): \ + platform = android-16 ### the windows configure disagrees ... + + $${currentConfig}.output.devicePro += \ + "DEFAULT_ANDROID_SDK_ROOT = $$val_escape(sdk_root)" \ + "DEFAULT_ANDROID_NDK_ROOT = $$val_escape(ndk_root)" \ + "DEFAULT_ANDROID_PLATFORM = $$platform" \ + "DEFAULT_ANDROID_NDK_HOST = $$ndk_host" \ + "DEFAULT_ANDROID_TARGET_ARCH = $$target_arch" \ + "DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION = $$ndk_tc_ver" + } + + export($${currentConfig}.output.devicePro) + + # reload the spec to make the settings actually take effect. + !isEmpty($${currentConfig}.output.devicePro): \ + reloadSpec() +} + +defineTest(qtConfOutput_machineTuple) { + $${currentConfig}.output.devicePro += \ + "GCC_MACHINE_DUMP = $$eval($${currentConfig}.tests.machineTuple.tuple)" + export($${currentConfig}.output.devicePro) + + # for completeness, one could reload the spec here, + # but no downstream users actually need that. +} + +defineTest(qtConfOutput_commitOptions) { + # qdevice.pri needs to be written early, because the compile tests require it. + write_file($$QT_BUILD_TREE/mkspecs/qdevice.pri, $${currentConfig}.output.devicePro)|error() +} + +# type (empty or 'host'), option name, default value +defineTest(processQtPath) { + out_var = config.rel_input.$${2} + path = $$eval(config.input.$${2}) + isEmpty(path) { + $$out_var = $$3 + } else { + path = $$absolute_path($$path, $$OUT_PWD) + rel = $$relative_path($$path, $$eval(config.input.$${1}prefix)) + isEmpty(rel) { + $$out_var = . + } else: contains(rel, \.\..*) { + !equals(2, sysconfdir) { + PREFIX_COMPLAINTS += "-$$2 is not a subdirectory of -$${1}prefix." + export(PREFIX_COMPLAINTS) + !$$eval(have_$${1}prefix) { + PREFIX_REMINDER = true + export(PREFIX_REMINDER) + } + } + $$out_var = $$path + } else { + $$out_var = $$rel + } + } + export($$out_var) +} + +defineTest(addConfStr) { + QT_CONFIGURE_STR_OFFSETS += " $$QT_CONFIGURE_STR_OFF," + QT_CONFIGURE_STRS += " \"$$1\\0\"" + QT_CONFIGURE_STR_OFF = $$num_add($$QT_CONFIGURE_STR_OFF, $$str_size($$1), 1) + export(QT_CONFIGURE_STR_OFFSETS) + export(QT_CONFIGURE_STRS) + export(QT_CONFIGURE_STR_OFF) +} + +defineReplace(printInstallPath) { + val = $$eval(config.rel_input.$$2) + equals(val, $$3): return() + return("$$1=$$val") +} + +defineReplace(printInstallPaths) { + ret = \ + $$printInstallPath(Documentation, docdir, doc) \ + $$printInstallPath(Headers, headerdir, include) \ + $$printInstallPath(Libraries, libdir, lib) \ + $$printInstallPath(LibraryExecutables, libexecdir, $$DEFAULT_LIBEXEC) \ + $$printInstallPath(Binaries, bindir, bin) \ + $$printInstallPath(Plugins, plugindir, plugins) \ + $$printInstallPath(Imports, importdir, imports) \ + $$printInstallPath(Qml2Imports, qmldir, qml) \ + $$printInstallPath(ArchData, archdatadir, .) \ + $$printInstallPath(Data, datadir, .) \ + $$printInstallPath(Translations, translationdir, translations) \ + $$printInstallPath(Examples, examplesdir, examples) \ + $$printInstallPath(Tests, testsdir, tests) + return($$ret) +} + +defineReplace(printHostPaths) { + ret = \ + "HostPrefix=$$config.input.hostprefix" \ + $$printInstallPath(HostBinaries, hostbindir, bin) \ + $$printInstallPath(HostLibraries, hostlibdir, lib) \ + $$printInstallPath(HostData, hostdatadir, .) \ + "Sysroot=$$config.input.sysroot" \ + "TargetSpec=$$XSPEC" \ + "HostSpec=$$[QMAKE_SPEC]" + return($$ret) +} + +defineTest(qtConfOutput_preparePaths) { + isEmpty(config.input.prefix) { + $$qtConfEvaluate("features.developer-build"): \ + config.input.prefix = $$QT_BUILD_TREE # In Development, we use sandboxed builds by default + else: \ + config.input.prefix = /usr/local/Qt-$$[QT_VERSION] + have_prefix = false + } else { + config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD) + have_prefix = true + } + + isEmpty(config.input.extprefix) { + config.input.extprefix = $$config.input.prefix + !isEmpty(config.input.sysroot): \ + qmake_sysrootify = true + else: \ + qmake_sysrootify = false + } else { + config.input.extprefix = $$absolute_path($$config.input.extprefix, $$OUT_PWD) + qmake_sysrootify = false + } + + isEmpty(config.input.hostprefix) { + $$qmake_sysrootify: \ + config.input.hostprefix = $$config.input.sysroot$$config.input.extprefix + else: \ + config.input.hostprefix = $$config.input.extprefix + have_hostprefix = false + } else { + isEqual(config.input.hostprefix, yes): \ + config.input.hostprefix = $$QT_BUILD_TREE + else: \ + config.input.hostprefix = $$absolute_path($$config.input.hostprefix, $$OUT_PWD) + have_hostprefix = true + } + + PREFIX_COMPLAINTS = + PREFIX_REMINDER = false + win32: \ + DEFAULT_LIBEXEC = bin + else: \ + DEFAULT_LIBEXEC = libexec + darwin: \ + DEFAULT_SYSCONFDIR = /Library/Preferences/Qt + else: \ + DEFAULT_SYSCONFDIR = etc/xdg + + processQtPath("", headerdir, include) + processQtPath("", libdir, lib) + processQtPath("", bindir, bin) + processQtPath("", datadir, .) + !equals(config.rel_input.datadir, .): \ + data_pfx = $$config.rel_input.datadir/ + processQtPath("", docdir, $${data_pfx}doc) + processQtPath("", translationdir, $${data_pfx}translations) + processQtPath("", examplesdir, $${data_pfx}examples) + processQtPath("", testsdir, tests) + processQtPath("", archdatadir, .) + !equals(config.rel_input.archdatadir, .): \ + archdata_pfx = $$config.rel_input.archdatadir/ + processQtPath("", libexecdir, $${archdata_pfx}$$DEFAULT_LIBEXEC) + processQtPath("", plugindir, $${archdata_pfx}plugins) + processQtPath("", importdir, $${archdata_pfx}imports) + processQtPath("", qmldir, $${archdata_pfx}qml) + processQtPath("", sysconfdir, $$DEFAULT_SYSCONFDIR) + $$have_hostprefix { + processQtPath(host, hostbindir, bin) + processQtPath(host, hostlibdir, lib) + processQtPath(host, hostdatadir, .) + } else { + processQtPath(host, hostbindir, $$config.rel_input.bindir) + processQtPath(host, hostlibdir, $$config.rel_input.libdir) + processQtPath(host, hostdatadir, $$config.rel_input.archdatadir) + } + + !isEmpty(PREFIX_COMPLAINTS) { + PREFIX_COMPLAINTS = "$$join(PREFIX_COMPLAINTS, "$$escape_expand(\\n)Note: ")" + $$PREFIX_REMINDER: \ + PREFIX_COMPLAINTS += "Maybe you forgot to specify -prefix/-hostprefix?" + qtConfAddNote($$PREFIX_COMPLAINTS) + } + + # populate qconfig.cpp (for qtcore) + + QT_CONFIGURE_STR_OFF = 0 + QT_CONFIGURE_STR_OFFSETS = + QT_CONFIGURE_STRS = + + addConfStr($$config.rel_input.docdir) + addConfStr($$config.rel_input.headerdir) + addConfStr($$config.rel_input.libdir) + addConfStr($$config.rel_input.libexecdir) + addConfStr($$config.rel_input.bindir) + addConfStr($$config.rel_input.plugindir) + addConfStr($$config.rel_input.importdir) + addConfStr($$config.rel_input.qmldir) + addConfStr($$config.rel_input.archdatadir) + addConfStr($$config.rel_input.datadir) + addConfStr($$config.rel_input.translationdir) + addConfStr($$config.rel_input.examplesdir) + addConfStr($$config.rel_input.testsdir) + + $${currentConfig}.output.qconfigSource = \ + "/* Installation date */" \ + "static const char qt_configure_installation [12+11] = \"qt_instdate=2012-12-20\";" \ + "" \ + "/* Installation Info */" \ + "static const char qt_configure_prefix_path_str [12+256] = \"qt_prfxpath=$$config.input.prefix\";" \ + "" \ + "static const short qt_configure_str_offsets[] = {" \ + $$QT_CONFIGURE_STR_OFFSETS \ + "};" \ + "static const char qt_configure_strs[] =" \ + $$QT_CONFIGURE_STRS \ + ";" \ + "" \ + "$${LITERAL_HASH}define QT_CONFIGURE_SETTINGS_PATH \"$$config.rel_input.sysconfdir\"" \ + "" \ + "$${LITERAL_HASH}define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12" + export($${currentConfig}.output.qconfigSource) + + # populate qmake/builtin-qt.conf + + $${currentConfig}.output.builtinQtConf = \ + " " \ + "===========================================================" \ + "==================== qt.conf beginning ====================" \ + "===========================================================" \ + "[Paths]" \ + "ExtPrefix=$$config.input.extprefix" \ + "Prefix=$$config.input.prefix" \ + $$printInstallPaths() \ + "Settings=$$config.rel_input.sysconfdir" \ + $$printHostPaths() + export($${currentConfig}.output.builtinQtConf) + + # create bin/qt.conf. this doesn't use the regular file output + # mechanism, as the file is relied upon by configure tests. + + cont = \ + "[EffectivePaths]" \ + "Prefix=.." \ + "[DevicePaths]" \ + "Prefix=$$config.input.prefix" \ + $$printInstallPaths() \ + "[Paths]" \ + "Prefix=$$config.input.extprefix" \ + $$printInstallPaths() \ + $$printHostPaths() + !equals(QT_SOURCE_TREE, $$QT_BUILD_TREE): \ + cont += \ + "[EffectiveSourcePaths]" \ + "Prefix=$$QT_SOURCE_TREE" + write_file($$QT_BUILD_TREE/bin/qt.conf, cont)|error() + reload_properties() +} + defineTest(qtConfOutput_shared) { !$${2}: return() @@ -643,6 +1084,15 @@ defineReplace(qtConfOutputPostProcess_publicPro) { return($$output) } +defineReplace(qtConfOutputPostProcess_privatePro) { + output = $$1 + + !isEmpty(config.input.external-hostbindir): \ + output += "HOST_QT_TOOLS = $$val_escape(config.input.external-hostbindir)" + + return($$output) +} + defineReplace(qtConfOutputPostProcess_publicHeader) { qt_version = $$[QT_VERSION] output = \ @@ -722,3 +1172,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/doc/global/externalsites/qtcreator.qdoc b/doc/global/externalsites/qtcreator.qdoc index f73b17c92f..0e66610d84 100644 --- a/doc/global/externalsites/qtcreator.qdoc +++ b/doc/global/externalsites/qtcreator.qdoc @@ -81,6 +81,34 @@ \externalpage http://doc.qt.io/qtcreator/creator-version-control.html \title Qt Creator: Using Version Control Systems */ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-bazaar.html + \title Qt Creator: Using Bazaar +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-clearcase.html + \title Qt Creator: Using ClearCase +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-cvs.html + \title Qt Creator: Using CVS +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-git.html + \title Qt Creator: Using Git +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-mercurial.html + \title Qt Creator: Using Mercurial +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-perforce.html + \title Qt Creator: Using Perforce +*/ +/*! + \externalpage http://doc.qt.io/qtcreator/creator-vcs-subversion.html + \title Qt Creator: Using Subversion +*/ /*! \externalpage http://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html \title Qt Creator: Keyboard Shortcuts diff --git a/doc/global/manifest-meta.qdocconf b/doc/global/manifest-meta.qdocconf index 7ebe86a431..865a457581 100644 --- a/doc/global/manifest-meta.qdocconf +++ b/doc/global/manifest-meta.qdocconf @@ -33,7 +33,6 @@ manifestmeta.filters = highlighted android thumbnail ios manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ "QtQuick/Qt Quick Demo - Photo Surface" \ "QtQuick/Qt Quick Demo - Tweet Search" \ - "QtQuick/Qt Quick Demo - Maroon*" \ "QtQuick/Qt Quick Demo - Calqlatr" \ "QtQuick/Qt Quick Demo - StocQt" \ "QtQuick/Qt Quick Demo - Clocks" \ @@ -45,14 +44,12 @@ manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \ "QtQuickDialogs/Qt Quick System Dialog Examples" \ "QtWinExtras/Quick Player" \ "QtMultimedia/QML Video Shader Effects Example" \ - "QtCanvas3D/Planets Example" \ "QtCanvas3D/Interactive Mobile Phone Example" \ "QtLocation/Map Viewer (QML)" manifestmeta.highlighted.attributes = isHighlighted:true -manifestmeta.android.names = "QtQuick/Qt Quick Demo - Maroon*" \ - "QtQuick/Qt Quick Demo - Calqlatr" \ +manifestmeta.android.names = "QtQuick/Qt Quick Demo - Calqlatr" \ "QtWidgets/Application Chooser Example" \ "QtWidgets/Stickman Example" \ "QtWidgets/Move Blocks Example" \ diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index fe8b7fb87e..28f3dade07 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -14,12 +14,14 @@ defines += Q_QDOC \ Q_NO_USING_KEYWORD \ __cplusplus \ Q_COMPILER_INITIALIZER_LISTS \ + Q_COMPILER_UNICODE_STRINGS \ Q_COMPILER_UNIFORM_INIT \ Q_COMPILER_RVALUE_REFS Cpp.ignoretokens += \ ENGINIOCLIENT_EXPORT \ PHONON_EXPORT \ + Q_ALWAYS_INLINE \ Q_AUTOTEST_EXPORT \ Q_BLUETOOTH_EXPORT \ Q_COMPAT_EXPORT \ @@ -121,6 +123,7 @@ Cpp.ignoretokens += \ QT_END_NAMESPACE \ QT_FASTCALL \ QT_MUTEX_LOCK_NOEXCEPT \ + QT_WARNING_DISABLE_DEPRECATED \ QT_WARNING_PUSH \ QT_WARNING_POP \ QT_WIDGET_PLUGIN_EXPORT \ @@ -148,8 +151,11 @@ Cpp.ignoredirectives += \ Q_DUMMY_COMPARISON_OPERATOR \ Q_ENUM \ Q_ENUMS \ + Q_ENUM_NS \ Q_FLAG \ Q_FLAGS \ + Q_FLAG_NS \ + QT_HAS_INCLUDE \ Q_INTERFACES \ Q_PRIVATE_PROPERTY \ QT_FORWARD_DECLARE_CLASS \ diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp index 5aecea4968..192ffbd369 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.cpp +++ b/examples/widgets/painting/fontsampler/mainwindow.cpp @@ -49,7 +49,9 @@ ****************************************************************************/ #include +#if defined(QT_PRINTSUPPORT_LIB) #include +#endif #include "mainwindow.h" @@ -212,7 +214,7 @@ QMap MainWindow::currentPageMap() void MainWindow::on_printAction_triggered() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) pageMap = currentPageMap(); if (pageMap.count() == 0) @@ -229,12 +231,12 @@ void MainWindow::on_printAction_triggered() printer.setFromTo(1, pageMap.keys().count()); printDocument(&printer); -#endif // QT_NO_PRINTER +#endif } void MainWindow::printDocument(QPrinter *printer) { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) printer->setFromTo(1, pageMap.count()); QProgressDialog progress(tr("Preparing font samples..."), tr("&Cancel"), @@ -263,12 +265,12 @@ void MainWindow::printDocument(QPrinter *printer) } painter.end(); -#endif // QT_NO_PRINTER +#endif } void MainWindow::on_printPreviewAction_triggered() { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) pageMap = currentPageMap(); if (pageMap.count() == 0) @@ -279,12 +281,12 @@ void MainWindow::on_printPreviewAction_triggered() connect(&preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(printDocument(QPrinter*))); preview.exec(); -#endif // QT_NO_PRINTER +#endif } void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) { -#if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) +#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog) QString family = pageMap.keys()[index]; StyleItems items = pageMap[family]; @@ -347,5 +349,5 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer) } painter->restore(); -#endif // QT_NO_PRINTER +#endif } diff --git a/examples/widgets/painting/fontsampler/mainwindow.h b/examples/widgets/painting/fontsampler/mainwindow.h index 6d73e84ea3..8f59e1021b 100644 --- a/examples/widgets/painting/fontsampler/mainwindow.h +++ b/examples/widgets/painting/fontsampler/mainwindow.h @@ -55,6 +55,9 @@ #include #include +#if defined(QT_PRINTSUPPORT_LIB) +#include +#endif QT_BEGIN_NAMESPACE class QPrinter; class QTextEdit; @@ -74,9 +77,9 @@ public: public slots: void on_clearAction_triggered(); void on_markAction_triggered(); + void on_unmarkAction_triggered(); void on_printAction_triggered(); void on_printPreviewAction_triggered(); - void on_unmarkAction_triggered(); void printDocument(QPrinter *printer); void printPage(int index, QPainter *painter, QPrinter *printer); void showFont(QTreeWidgetItem *item); diff --git a/mkspecs/common/android-base-head.conf b/mkspecs/common/android-base-head.conf index b75bcfaacb..ae4933c453 100644 --- a/mkspecs/common/android-base-head.conf +++ b/mkspecs/common/android-base-head.conf @@ -1,5 +1,8 @@ load(device_config) +# In early configure setup; nothing useful to be done here. +isEmpty(DEFAULT_ANDROID_NDK_ROOT): return() + NDK_ROOT = $$(ANDROID_NDK_ROOT) !exists($$NDK_ROOT) { NDK_ROOT = $$DEFAULT_ANDROID_NDK_ROOT diff --git a/mkspecs/common/android-base-tail.conf b/mkspecs/common/android-base-tail.conf index 47eaa83e42..23bd6696de 100644 --- a/mkspecs/common/android-base-tail.conf +++ b/mkspecs/common/android-base-tail.conf @@ -1,3 +1,6 @@ +# In early configure setup; nothing useful to be done here. +isEmpty(DEFAULT_ANDROID_NDK_ROOT): return() + # -fstack-protector-strong offers good protection against stack smashing attacks. # It is (currently) enabled only on Android because we know for sure that Andoroid compilers supports it QMAKE_CFLAGS += -fstack-protector-strong -DANDROID diff --git a/mkspecs/devices/common/linux_device_post.conf b/mkspecs/devices/common/linux_device_post.conf index 88fa31d805..cf1608f32b 100644 --- a/mkspecs/devices/common/linux_device_post.conf +++ b/mkspecs/devices/common/linux_device_post.conf @@ -1,3 +1,7 @@ +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + contains(DISTRO_OPTS, deb-multi-arch) { QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP} @@ -10,5 +14,3 @@ contains(DISTRO_OPTS, boot2qt) { QMAKE_CFLAGS += $$COMPILER_FLAGS QMAKE_CXXFLAGS += $$COMPILER_FLAGS QMAKE_LFLAGS += $$LINKER_FLAGS - -deviceSanityCheckCompiler() diff --git a/mkspecs/devices/linux-archos-gen8-g++/qmake.conf b/mkspecs/devices/linux-archos-gen8-g++/qmake.conf index 891559f3bf..66662f90ca 100644 --- a/mkspecs/devices/linux-archos-gen8-g++/qmake.conf +++ b/mkspecs/devices/linux-archos-gen8-g++/qmake.conf @@ -16,6 +16,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QT_QPA_DEFAULT_PLATFORM = eglfs # modifications to g++.conf @@ -51,6 +55,4 @@ QMAKE_LIBS_EGL = -lEGL -lIMGegl -lsrv_um QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 $${QMAKE_LIBS_EGL} QMAKE_LIBS_OPENVG = -lOpenVG $${QMAKE_LIBS_EGL} -deviceSanityCheckCompiler() - load(qt_config) diff --git a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf index da2e046d08..74eaf0dd09 100644 --- a/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-amlogic-8726M-g++/qmake.conf @@ -12,6 +12,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -25,8 +29,6 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_CFLAGS += -mfloat-abi=softfp -mfpu=neon -mcpu=cortex-a9 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -deviceSanityCheckCompiler() - EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_8726m.cpp QT_QPA_DEFAULT_PLATFORM = eglfs diff --git a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf index 3bbb7b6db9..b131f65a79 100644 --- a/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf +++ b/mkspecs/devices/linux-arm-trident-pnx8473-g++/qmake.conf @@ -14,11 +14,17 @@ include(../../common/g++-unix.conf) load(device_config) -# Sanity checks -isEmpty(TRIDENT_SHINER_SDK_BUILDTREE): error("TRIDENT_SHINER_SDK_BUILDTREE needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDTREE=") -isEmpty(TRIDENT_SHINER_SDK_BUILDSPEC): error("TRIDENT_SHINER_SDK_BUILDSPEC needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDSPEC=") -isEmpty(TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2): error("TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2=") -isEmpty(TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2): error("TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2=") +defineTest(qtConfSanitizeMkspec) { + isEmpty(TRIDENT_SHINER_SDK_BUILDTREE): \ + error("TRIDENT_SHINER_SDK_BUILDTREE needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDTREE=") + isEmpty(TRIDENT_SHINER_SDK_BUILDSPEC): \ + error("TRIDENT_SHINER_SDK_BUILDSPEC needs to be set via -device-option TRIDENT_SHINER_SDK_BUILDSPEC=") + isEmpty(TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2): \ + error("TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_INCDIR_EGL_OPENGL_ES2=") + isEmpty(TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2): \ + error("TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2 needs to be set via -device-option TRIDENT_SHINER_SDK_LIBDIR_EGL_OPENGL_ES2=") + deviceSanityCheckCompiler() +} QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ @@ -35,8 +41,6 @@ QMAKE_CFLAGS += --sysroot=$${TRIDENT_SHINER_SDK_BUILDTREE}/open_source QMAKE_CXXFLAGS += --sysroot=$${TRIDENT_SHINER_SDK_BUILDTREE}/open_source_archive/linux/toolchains/gcc-4.5.2_uclibc/ QMAKE_LFLAGS += --sysroot=$${TRIDENT_SHINER_SDK_BUILDTREE}/open_source_archive/linux/toolchains/gcc-4.5.2_uclibc/ -deviceSanityCheckCompiler() - QMAKE_CFLAGS = -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard QMAKE_CXXFLAGS = $$QMAKE_CFLAGS diff --git a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf index e196f279d7..9211551daf 100644 --- a/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf +++ b/mkspecs/devices/linux-mipsel-broadcom-97425-g++/qmake.conf @@ -12,6 +12,16 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + isEmpty(B_REFSW_DEBUG): \ + error("B_REFSW_DEBUG needs to be set via -device-option B_REFSW_DEBUG=(y|n)") + isEmpty(BRCM_ROCKFORD_PATH): \ + error("BRCM_ROCKFORD_PATH needs to be set via -device-option BRCM_ROCKFORD_PATH=") + isEmpty(BRCM_APPLIBS_PATH): \ + error("BRCM_APPLIBS_PATH needs to be set via -device-option BRCM_APPLIBS_PATH=") + deviceSanityCheckCompiler() +} + # Modify the defaults we loaded above CROSS_COMPILE = mipsel-linux- QMAKE_CC = $${CROSS_COMPILE}gcc @@ -31,12 +41,6 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip BRCM_PLATFORM = 97425 -# Sanity checks -deviceSanityCheckCompiler() -isEmpty(B_REFSW_DEBUG):error("B_REFSW_DEBUG needs to be set via -device-option B_REFSW_DEBUG=(y|n).") -isEmpty(BRCM_ROCKFORD_PATH):error("BRCM_ROCKFORD_PATH needs to be set via -device-option BRCM_ROCKFORD_PATH=path.") -isEmpty(BRCM_APPLIBS_PATH):error("BRCM_APPLIBS_PATH needs to be set via -device-option BRCM_APPLIBS_PATH=path.") - # Figure the kind of directfb build used. BRCM_BUILD_TYPE = debug contains(B_REFSW_DEBUG, [Nn]) { diff --git a/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf b/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf index 18d07dad63..8dab1ea287 100644 --- a/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf +++ b/mkspecs/devices/linux-sh4-stmicro-ST7108-g++/qmake.conf @@ -14,6 +14,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -24,8 +28,6 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip -deviceSanityCheckCompiler() - QMAKE_LIBS_EGL += -lMali QT_QPA_DEFAULT_PLATFORM = eglfs diff --git a/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf b/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf index 5672829da9..04b0a80d1f 100644 --- a/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf +++ b/mkspecs/devices/linux-sh4-stmicro-ST7540-g++/qmake.conf @@ -14,6 +14,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -24,8 +28,6 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy QMAKE_NM = $${CROSS_COMPILE}nm -P QMAKE_STRIP = $${CROSS_COMPILE}strip -deviceSanityCheckCompiler() - QMAKE_INCDIR_EGL += $$[QT_SYSROOT]/root/modules/include/ QMAKE_LIBDIR_EGL += $$[QT_SYSROOT]/root/modules/ diff --git a/mkspecs/devices/linux-snowball-g++/qmake.conf b/mkspecs/devices/linux-snowball-g++/qmake.conf index 3520c7a922..9791119363 100644 --- a/mkspecs/devices/linux-snowball-g++/qmake.conf +++ b/mkspecs/devices/linux-snowball-g++/qmake.conf @@ -12,6 +12,10 @@ include(../../common/g++-unix.conf) load(device_config) +defineTest(qtConfSanitizeMkspec) { + deviceSanityCheckCompiler() +} + QMAKE_CC = $${CROSS_COMPILE}gcc QMAKE_CXX = $${CROSS_COMPILE}g++ QMAKE_LINK = $${QMAKE_CXX} @@ -26,6 +30,4 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \ -Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf -deviceSanityCheckCompiler() - load(qt_config) 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/configure.prf b/mkspecs/features/configure.prf index 4ca7c6ba07..934a18a924 100644 --- a/mkspecs/features/configure.prf +++ b/mkspecs/features/configure.prf @@ -4,6 +4,8 @@ cache() load(configure_base) +isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false + QMAKE_CONFIG_LOG = $$dirname(_QMAKE_CACHE_)/config.log recheck: write_file($$QMAKE_CONFIG_LOG, "") diff --git a/mkspecs/features/configure_base.prf b/mkspecs/features/configure_base.prf index dd1f4e5bfc..41f429e204 100644 --- a/mkspecs/features/configure_base.prf +++ b/mkspecs/features/configure_base.prf @@ -22,8 +22,6 @@ QMAKE_MAKE = $$(MAKE) # Make sure we don't inherit MAKEFLAGS - -i in particular is fatal. QMAKE_MAKE = "$${SETENV_PFX}MAKEFLAGS=$$SETENV_SFX $$QMAKE_MAKE" -isEmpty(QMAKE_CONFIG_VERBOSE): QMAKE_CONFIG_VERBOSE = false - defineTest(qtLog) { write_file($$QMAKE_CONFIG_LOG, 1, append) $$QMAKE_CONFIG_VERBOSE: for (l, 1): log("$$l$$escape_expand(\\n)") diff --git a/mkspecs/features/data/configure.json b/mkspecs/features/data/configure.json new file mode 100644 index 0000000000..8e5ff5f0a4 --- /dev/null +++ b/mkspecs/features/data/configure.json @@ -0,0 +1,25 @@ +{ + "files": { + }, + + "commandline": { + "options": { + "v": { "type": "enum", "name": "verbose", "values": { "yes": "true", "no": "false" } }, + "verbose": { "type": "enum", "values": { "yes": "true", "no": "false" } }, + + "continue": "void", + + "recheck": { "type": "void", "name": "cache_use", "value": "positive" }, + "recheck-all": { "type": "void", "name": "cache_use", "value": "none" }, + + "redo": { "type": "redo" } + } + + }, + + "features": { + "builtins": { + "output": [ "builtins" ] + } + } +} diff --git a/mkspecs/features/device_config.prf b/mkspecs/features/device_config.prf index 9281d3e407..c15559e174 100644 --- a/mkspecs/features/device_config.prf +++ b/mkspecs/features/device_config.prf @@ -1,45 +1,12 @@ # This file is loaded by some qmakespecs to get early configuration data. -host_build: \ - PRI_FILE_NAME = qhost.pri -else: \ - PRI_FILE_NAME = qdevice.pri -DEVICE_PRI = $$[QT_HOST_DATA/get]/mkspecs/$$PRI_FILE_NAME +# Some of these qmakespecs can be used also in host mode, but they are not +# supposed to be influenced by -device-option then. +host_build: return() + +DEVICE_PRI = $$[QT_HOST_DATA/get]/mkspecs/qdevice.pri exists($$DEVICE_PRI):include($$DEVICE_PRI) unset(DEVICE_PRI) # this variable can be persisted via qmake -set CROSS_COMPILE /foo -!host_build:isEmpty(CROSS_COMPILE): CROSS_COMPILE = $$[CROSS_COMPILE] - -# Provide a function to be used by mkspecs -defineTest(deviceSanityCheckCompiler) { - equals(QMAKE_HOST.os, Windows): \ - sfx = .exe - else: \ - sfx = - - # Build the compiler filename using the first value in QMAKE_CXX in order to - # support tools like ccache, which give QMAKE_CXX values of the form: - # ccache - compiler = $$first(QMAKE_CXX)$$sfx - - # Check if the binary exists with an absolute path. Do this check - # before the CROSS_COMPILE empty check below to allow the mkspec - # to derive the compiler path from other device options. - exists($$compiler):return() - - # Check for possible reasons of failure - # check if CROSS_COMPILE device-option is set - isEmpty(CROSS_COMPILE):error("CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=") - - # Check if QMAKE_CXX points to an executable. - ensurePathEnv() - for (dir, QMAKE_PATH_ENV) { - exists($$dir/$${compiler}): \ - return() - } - - # QMAKE_CXX does not point to a compiler. - error("Compiler $$QMAKE_CXX not found. Check the value of CROSS_COMPILE -device-option") -} - +isEmpty(CROSS_COMPILE): CROSS_COMPILE = $$[CROSS_COMPILE] diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 333d06f63a..119dc53d20 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -28,12 +28,13 @@ win32:count(MOC_INCLUDEPATH, 40, >) { # UIKit builds are always multi-arch due to simulator_and_device (unless # -sdk is used) so this feature cannot possibly work. if(gcc|intel_icl|msvc):!rim_qcc:!uikit:if(!macos|count(QMAKE_APPLE_DEVICE_ARCHS, 1)) { + moc_predefs.name = "Generate moc_predefs.h" moc_predefs.CONFIG = no_link gcc: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -dM -E -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} - else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} + else:intel_icl: moc_predefs.commands = $$QMAKE_CXX $$QMAKE_CXXFLAGS -QdM -P -Za -Fi${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} else:msvc { moc_predefs.commands += $$QMAKE_CXX -Bx$$shell_quote($$shell_path($$QMAKE_QMAKE)) $$QMAKE_CXXFLAGS \ - -E ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} + -E -Za ${QMAKE_FILE_IN} 2>NUL >${QMAKE_FILE_OUT} } else: error("Oops, I messed up") moc_predefs.output = $$MOC_DIR/moc_predefs.h moc_predefs.input = MOC_PREDEF_FILE diff --git a/mkspecs/features/qlalr.prf b/mkspecs/features/qlalr.prf index 941bfe0d9f..54d8b583c6 100644 --- a/mkspecs/features/qlalr.prf +++ b/mkspecs/features/qlalr.prf @@ -25,7 +25,7 @@ for (s, QLALRSOURCES) { $${base}.variable_out = GENERATED_SOURCES $${base}.depends += $$QMAKE_QLALR_EXE $${base}.commands = $$QMAKE_QLALR $$QMAKE_QLALRFLAGS ${QMAKE_FILE_IN} - silent: $${base}.commands = @echo qlalr ${QMAKE_FILE_IN} && $${base}.commands + silent: $${base}.commands = @echo qlalr ${QMAKE_FILE_IN} && $$eval($${base}.commands) $${base}.name = QLALR ${QMAKE_FILE_IN} $${base}_h.input = $$invar diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 9b3deff331..a620e94e97 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -162,7 +162,8 @@ defineTest(qtConfCommandline_addString) { val = $${2} isEmpty(val): val = $$qtConfGetNextCommandlineArg() - contains(val, "^-.*|[A-Z_]+=.*")|isEmpty(val) { + # Note: Arguments which are variable assignments are legit here. + contains(val, "^-.*")|isEmpty(val) { qtConfAddError("No value supplied to command line option '$$opt'.") return() } @@ -177,6 +178,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) { @@ -194,29 +206,6 @@ defineTest(qtConfParseCommandLine) { c = $$qtConfGetNextCommandlineArg() isEmpty(c): break() - # handle options to turn on verbose logging - contains(c, "^-v")|contains(c, "^--?verbose") { - QMAKE_CONFIG_VERBOSE = true - export(QMAKE_CONFIG_VERBOSE) - next() - } - contains(c, "^-no-v")|contains(c, "^--?no-verbose") { - QMAKE_CONFIG_VERBOSE = false - export(QMAKE_CONFIG_VERBOSE) - next() - } - - contains(c, "^--?recheck") { - QMAKE_CONFIG_CACHE_USE = positive - export(QMAKE_CONFIG_CACHE_USE) - next() - } - contains(c, "^--?recheck-all") { - QMAKE_CONFIG_CACHE_USE = none - export(QMAKE_CONFIG_CACHE_USE) - next() - } - didCustomCall = false for (customCall, customCalls) { $${customCall}($$c) { @@ -774,6 +763,7 @@ defineTest(qtConfTest_compile) { QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE" mkpath($$test_out_dir)|error() + write_file($$test_out_dir/.qmake.cache)|error() # add possible command line args qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) $$eval($${1}.literal_args) @@ -1622,6 +1612,19 @@ defineTest(qtConfOutput_privateFeature) { } } +# command line built-ins post-processing +defineTest(qtConfOutput_builtins) { + QMAKE_CONFIG_VERBOSE = $$eval(config.input.verbose) + isEmpty(QMAKE_CONFIG_VERBOSE): \ + QMAKE_CONFIG_VERBOSE = false + export(QMAKE_CONFIG_VERBOSE) + + QMAKE_CONFIG_CACHE_USE = $$eval(config.input.cache_use) + isEmpty(QMAKE_CONFIG_CACHE_USE): \ + QMAKE_CONFIG_CACHE_USE = all + export(QMAKE_CONFIG_CACHE_USE) +} + defineTest(qtConfProcessOneOutput) { feature = $${1} fpfx = $${currentConfig}.features.$${feature} @@ -1657,7 +1660,7 @@ defineTest(qtConfProcessOutput) { module = $$eval($${currentConfig}.module) # write it to the output files - isEmpty($${currentConfig}.files._KEYS_) { + !defined($${currentConfig}.files._KEYS_, var) { # set defaults that should work for most Qt modules isEmpty(module): \ error("Neither module nor files section specified in configuration file.") @@ -1677,7 +1680,7 @@ defineTest(qtConfProcessOutput) { $${currentConfig}.output.$$type += "$$k -= $$eval($${currentConfig}.output.$${type}.remove.$$k)" for (k, $${currentConfig}.output.$${type}.append._KEYS_): \ $${currentConfig}.output.$$type += "$$k += $$eval($${currentConfig}.output.$${type}.append.$$k)" - } else { + } else: contains(type, ".*Header") { for (define, $${currentConfig}.output.$${type}._KEYS_) { value = $$eval($${currentConfig}.output.$${type}.$${define}) $${currentConfig}.output.$$type += "$${LITERAL_HASH}define $$define $$value" @@ -1730,6 +1733,8 @@ isEmpty(configsToProcess): \ load(configure_base) QMAKE_POST_CONFIGURE = +config.builtins.dir = $$PWD/data +configsToProcess = builtins $$configsToProcess allConfigs = for(ever) { isEmpty(configsToProcess): \ @@ -1763,14 +1768,22 @@ for(ever) { for (currentConfig, allConfigs): \ qtConfSetupLibraries() +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: \ QMAKE_CONFIG_CACHE = $$dirname(_QMAKE_CACHE_)/config.cache -QMAKE_CONFIG_CACHE_USE = all - -qtConfParseCommandLine() - !equals(QMAKE_CONFIG_CACHE_USE, none) { include($$QMAKE_CONFIG_CACHE, , true) # this crudely determines when to discard the cache. this also catches the case @@ -1789,14 +1802,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...") @@ -1842,13 +1847,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/mkspecs/features/qt_tool.prf b/mkspecs/features/qt_tool.prf index 4b73b4b8f7..a8d589f0fa 100644 --- a/mkspecs/features/qt_tool.prf +++ b/mkspecs/features/qt_tool.prf @@ -27,7 +27,7 @@ DEFINES *= QT_USE_QSTRINGBUILDER vars = binary depends - isEmpty(HOST_QT_TOOLS) { + !host_build|isEmpty(HOST_QT_TOOLS) { load(resolve_target) !host_build|!force_bootstrap: MODULE_DEPENDS = $$replace(QT, -private$, _private) diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 3f266dd2a4..0ef0fa8fc7 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -1,4 +1,7 @@ +# In early configure setup; nothing useful to be done here. +isEmpty(QMAKE_CXX): return() + defineReplace(qtMakeExpand) { out = "$$1" for(ever) { diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index 495fd15e80..2c66e80db4 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -14,7 +14,7 @@ QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = QMAKE_CFLAGS_APP = -fPIC QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261 +QMAKE_CFLAGS_WARN_ON = -w1 -Wall -Wcheck -wd1572,873,2259,2261,3373 QMAKE_CFLAGS_WARN_OFF = -w QMAKE_CFLAGS_RELEASE = -O2 -falign-functions=16 -ansi-alias -fstrict-aliasing QMAKE_CFLAGS_DEBUG = -O0 -g diff --git a/mkspecs/macx-icc/qmake.conf b/mkspecs/macx-icc/qmake.conf index 990f3b39ee..0d349b2329 100644 --- a/mkspecs/macx-icc/qmake.conf +++ b/mkspecs/macx-icc/qmake.conf @@ -14,7 +14,7 @@ QMAKE_COMPILER = gcc clang intel_icc # icc pretends to be gcc and cla QMAKE_CC = icc QMAKE_CFLAGS = QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125,2259,2261,3280 +QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125,2259,2261,3280,3373 QMAKE_CFLAGS_WARN_OFF = -w QMAKE_CFLAGS_RELEASE = QMAKE_CFLAGS_DEBUG = -g diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index e19570bf16..7cf94c3e40 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -17,7 +17,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = bison -y QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809 +QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373 QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673 QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673 QMAKE_CFLAGS_RELEASE = -O2 -MD diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 33ec2508e2..de41e14e75 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -66,7 +66,6 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/io/qdir.cpp $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp \ $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstringlist.cpp $(SOURCE_PATH)/src/corelib/tools/qmap.cpp \ - $(SOURCE_PATH)/src/corelib/global/qconfig.cpp \ $(SOURCE_PATH)/src/corelib/tools/qstringbuilder.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlocale.cpp \ $(SOURCE_PATH)/src/corelib/tools/qlocale_tools.cpp \ @@ -225,7 +224,7 @@ qsettings.o: $(SOURCE_PATH)/src/corelib/io/qsettings.cpp qsystemerror.o: $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/kernel/qsystemerror.cpp -qlibraryinfo.o: $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp $(BUILD_PATH)/src/corelib/global/qconfig.cpp +qlibraryinfo.o: $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qlibraryinfo.cpp qnumeric.o: $(SOURCE_PATH)/src/corelib/global/qnumeric.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index db8572839e..6c1644004e 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -156,8 +156,6 @@ $(OBJS): $(PCH_OBJECT) $(QTOBJS): $(PCH_OBJECT) -qlibraryinfo.obj: $(BUILD_PATH)\src\corelib\global\qconfig.cpp - qmake_pch.obj: $(CXX) $(CXXFLAGS_BARE) -c -Yc -Fpqmake_pch.pch -TP $(QMKSRC)\qmake_pch.h diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index e3d76cd76e..8d5a9a7d0f 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -308,13 +308,13 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS"); + << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if (project->first("TEMPLATE") == "aux") { t << "\n\n"; return; } - t << " $(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); + if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 3a4f6242b2..da10b1984f 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -517,13 +517,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) t << "first: all\n"; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) - << ' ' << depVar("ALL_DEPS"); + << ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n"; + t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if (templateName == "aux") { t << "\n\n"; return; } - t << " $(DESTDIR_TARGET)\n\n"; - t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS"); if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <extraCompilerOutputs[inFile]; + const QString objectMappedFile = Project->extraCompilerOutputs.value(inFile); bool hasBuiltIn = false; if (!objectMappedFile.isEmpty()) { - hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile.at(0)); + hasBuiltIn = Project->hasBuiltinCompiler(objectMappedFile); + + // Remove the fake file suffix we've added initially to generate correct command lines. + inFile.chop(Project->customBuildToolFilterFileSuffix.length()); + // qDebug("*** Extra compiler file has object mapped file '%s' => '%s'", qPrintable(inFile), qPrintable(objectMappedFile.join(' '))); } @@ -2338,7 +2342,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) // compiler, too bad.. if (hasBuiltIn) { out = inFile; - inFile = objectMappedFile.at(0); + inFile = objectMappedFile; } // Dependency for the output diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index a5ee42a449..6a8d8b7e0f 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -111,7 +111,8 @@ const char _slnExtSections[] = "\n\tGlobalSection(ExtensibilityGlobals) = pos VcprojGenerator::VcprojGenerator() : Win32MakefileGenerator(), is64Bit(false), - projectWriter(0) + projectWriter(0), + customBuildToolFilterFileSuffix(QStringLiteral(".cbt")) { } @@ -800,10 +801,14 @@ void VcprojGenerator::init() if (!hasBuiltinCompiler(file)) { extraCompilerSources[file] += quc.toQString(); } else { + // Use a fake file name foo.moc.cbt for the project view. + // This prevents VS from complaining about a circular + // dependency from foo.moc -> foo.moc. QString out = Option::fixPathToTargetOS(replaceExtraCompilerVariables( compiler_out, file, QString(), NoShell), false); + out += customBuildToolFilterFileSuffix; extraCompilerSources[out] += quc.toQString(); - extraCompilerOutputs[out] = QStringList(file); // Can only have one + extraCompilerOutputs[out] = file; } } } diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h index 9ccd8c2552..e3e67d64b9 100644 --- a/qmake/generators/win32/msvc_vcproj.h +++ b/qmake/generators/win32/msvc_vcproj.h @@ -63,7 +63,8 @@ public: static bool hasBuiltinCompiler(const QString &file); QHash extraCompilerSources; - QHash extraCompilerOutputs; + QHash extraCompilerOutputs; + const QString customBuildToolFilterFileSuffix; bool usePCH; VCProjectWriter *projectWriter; diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 48df4ff916..3c029c8004 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -165,6 +165,9 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) void Win32MakefileGenerator::processVars() { + if (project->first("TEMPLATE").endsWith("aux")) + return; + project->values("QMAKE_ORIG_TARGET") = project->values("TARGET"); if (project->isEmpty("QMAKE_PROJECT_NAME")) project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET"); diff --git a/qmake/library/proitems.h b/qmake/library/proitems.h index 05d9e8da28..c81e205699 100644 --- a/qmake/library/proitems.h +++ b/qmake/library/proitems.h @@ -329,6 +329,9 @@ enum ProToken { // - function name: hash (2), length (1), chars (length) // - body length (2) // - body + TokTerminator (body length) + TokBypassNesting, // escape from function local variable scopes: + // - block length (2) + // - block + TokTerminator (block length) TokMask = 0xff, TokQuoted = 0x100, // The expression is quoted => join expanded stringlist TokNewStr = 0x200 // Next stringlist element diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index 02c910fe46..b30373b596 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -101,7 +101,7 @@ enum TestFunc { T_EXISTS, T_EXPORT, T_CLEAR, T_UNSET, T_EVAL, T_CONFIG, T_SYSTEM, T_DEFINED, T_DISCARD_FROM, T_CONTAINS, T_INFILE, T_COUNT, T_ISEMPTY, T_PARSE_JSON, T_INCLUDE, T_LOAD, T_DEBUG, T_LOG, T_MESSAGE, T_WARNING, T_ERROR, T_IF, - T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE + T_MKPATH, T_WRITE_FILE, T_TOUCH, T_CACHE, T_RELOAD_PROPERTIES }; void QMakeEvaluator::initFunctionStatics() @@ -200,6 +200,7 @@ void QMakeEvaluator::initFunctionStatics() { "write_file", T_WRITE_FILE }, { "touch", T_TOUCH }, { "cache", T_CACHE }, + { "reload_properties", T_RELOAD_PROPERTIES }, }; statics.functions.reserve((int)(sizeof(testInits)/sizeof(testInits[0]))); for (unsigned i = 0; i < sizeof(testInits)/sizeof(testInits[0]); ++i) @@ -560,11 +561,9 @@ void QMakeEvaluator::populateDeps( } } -ProStringList QMakeEvaluator::evaluateBuiltinExpand( - int func_t, const ProKey &func, const ProStringList &args) +QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( + int func_t, const ProKey &func, const ProStringList &args, ProStringList &ret) { - ProStringList ret; - traceMsg("calling built-in $$%s(%s)", dbgKey(func), dbgSepStrList(args)); switch (func_t) { @@ -1110,6 +1109,11 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( if (qfile.open(stdin, QIODevice::ReadOnly)) { QTextStream t(&qfile); const QString &line = t.readLine(); + if (t.atEnd()) { + fputs("\n", stderr); + evalError(fL1S("Unexpected EOF.")); + return ReturnError; + } ret = split_value_list(QStringRef(&line)); } } @@ -1279,7 +1283,7 @@ ProStringList QMakeEvaluator::evaluateBuiltinExpand( break; } - return ret; + return ReturnTrue; } QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( @@ -2012,6 +2016,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( } return writeFile(fL1S("cache "), fn, QIODevice::Append, false, varstr); } + case T_RELOAD_PROPERTIES: +#ifdef QT_BUILD_QMAKE + m_option->reloadProperties(); +#endif + return ReturnTrue; default: evalError(fL1S("Function '%1' is not implemented.").arg(function.toQString(m_tmp1))); return ReturnFalse; diff --git a/qmake/library/qmakeevaluator.cpp b/qmake/library/qmakeevaluator.cpp index fd24cf209d..767528eb57 100644 --- a/qmake/library/qmakeevaluator.cpp +++ b/qmake/library/qmakeevaluator.cpp @@ -594,6 +594,24 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock( tokPtr += blockLen; okey = true, or_op = false; // force next evaluation break; + case TokBypassNesting: + blockLen = getBlockLen(tokPtr); + if ((m_cumulative || okey != or_op) && blockLen) { + ProValueMapStack savedValuemapStack = m_valuemapStack; + m_valuemapStack.clear(); + m_valuemapStack.append(savedValuemapStack.takeFirst()); + traceMsg("visiting nesting-bypassing block"); + ret = visitProBlock(tokPtr); + traceMsg("visited nesting-bypassing block"); + savedValuemapStack.prepend(m_valuemapStack.first()); + m_valuemapStack = savedValuemapStack; + } else { + traceMsg("skipped nesting-bypassing block"); + ret = ReturnTrue; + } + tokPtr += blockLen; + okey = true, or_op = false; // force next evaluation + break; case TokTestDef: case TokReplaceDef: if (m_cumulative || okey != or_op) { @@ -1761,8 +1779,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateExpandFunction( ProStringList args; if (expandVariableReferences(tokPtr, 5, &args, true) == ReturnError) return ReturnError; - *ret = evaluateBuiltinExpand(func_t, func, args); - return ReturnTrue; + return evaluateBuiltinExpand(func_t, func, args, *ret); } QHash::ConstIterator it = diff --git a/qmake/library/qmakeevaluator.h b/qmake/library/qmakeevaluator.h index 3f2a22c567..544c257f07 100644 --- a/qmake/library/qmakeevaluator.h +++ b/qmake/library/qmakeevaluator.h @@ -212,7 +212,7 @@ public: VisitReturn evaluateExpandFunction(const ProKey &function, const ushort *&tokPtr, ProStringList *ret); VisitReturn evaluateConditionalFunction(const ProKey &function, const ushort *&tokPtr); - ProStringList evaluateBuiltinExpand(int func_t, const ProKey &function, const ProStringList &args); + VisitReturn evaluateBuiltinExpand(int func_t, const ProKey &function, const ProStringList &args, ProStringList &ret); VisitReturn evaluateBuiltinConditional(int func_t, const ProKey &function, const ProStringList &args); VisitReturn evaluateConditional(const QStringRef &cond, const QString &where, int line = -1); diff --git a/qmake/library/qmakeglobals.h b/qmake/library/qmakeglobals.h index 96c39fa168..1bb8632883 100644 --- a/qmake/library/qmakeglobals.h +++ b/qmake/library/qmakeglobals.h @@ -125,6 +125,7 @@ public: void setDirectories(const QString &input_dir, const QString &output_dir); #ifdef QT_BUILD_QMAKE void setQMakeProperty(QMakeProperty *prop) { property = prop; } + void reloadProperties() { property->reload(); } ProString propertyValue(const ProKey &name) const { return property->value(name); } #else # ifdef PROEVALUATOR_INIT_PROPS diff --git a/qmake/library/qmakeparser.cpp b/qmake/library/qmakeparser.cpp index 56b217dfbb..78350c76c4 100644 --- a/qmake/library/qmakeparser.cpp +++ b/qmake/library/qmakeparser.cpp @@ -118,6 +118,7 @@ static struct { QString strfor; QString strdefineTest; QString strdefineReplace; + QString strbypassNesting; QString stroption; QString strreturn; QString strnext; @@ -141,6 +142,7 @@ void QMakeParser::initialize() statics.strfor = QLatin1String("for"); statics.strdefineTest = QLatin1String("defineTest"); statics.strdefineReplace = QLatin1String("defineReplace"); + statics.strbypassNesting = QLatin1String("bypassNesting"); statics.stroption = QLatin1String("option"); statics.strreturn = QLatin1String("return"); statics.strnext = QLatin1String("next"); @@ -1157,6 +1159,25 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg } parseError(fL1S("%1(function) requires one literal argument.").arg(*defName)); return; + } else if (m_tmp == statics.strbypassNesting) { + if (*uce != TokFuncTerminator) { + bogusTest(tokPtr, fL1S("%1() requires zero arguments.").arg(m_tmp)); + return; + } + if (!(m_blockstack.top().nest & NestFunction)) { + bogusTest(tokPtr, fL1S("Unexpected %1().").arg(m_tmp)); + return; + } + if (m_invert) { + bogusTest(tokPtr, fL1S("Unexpected NOT operator in front of %1().").arg(m_tmp)); + return; + } + flushScopes(tokPtr); + putLineMarker(tokPtr); + putOperator(tokPtr); + putTok(tokPtr, TokBypassNesting); + enterScope(tokPtr, true, StCtrl); + return; } else if (m_tmp == statics.strreturn) { if (m_blockstack.top().nest & NestFunction) { if (argc > 1) { @@ -1425,7 +1446,7 @@ static bool getBlock(const ushort *tokens, int limit, int &offset, QString *outS "TokReturn", "TokBreak", "TokNext", "TokNot", "TokAnd", "TokOr", "TokBranch", "TokForLoop", - "TokTestDef", "TokReplaceDef" + "TokTestDef", "TokReplaceDef", "TokBypassNesting" }; while (offset != limit) { @@ -1509,6 +1530,9 @@ static bool getBlock(const ushort *tokens, int limit, int &offset, QString *outS if (ok) ok = getSubBlock(tokens, limit, offset, outStr, indent, "body"); break; + case TokBypassNesting: + ok = getSubBlock(tokens, limit, offset, outStr, indent, "block"); + break; default: Q_ASSERT(!"unhandled token"); } diff --git a/qmake/option.cpp b/qmake/option.cpp index fb49f5a100..b8102ecf06 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -638,6 +638,11 @@ qmakeAddCacheClear(qmakeCacheClearFunc func, void **data) cache_items.append(new QMakeCacheClearItem(func, data)); } +QString qmake_absoluteLocation() +{ + return Option::globals->qmake_abslocation; +} + QString qmake_libraryInfoFile() { if (!Option::globals->qtconf.isEmpty()) diff --git a/qmake/project.cpp b/qmake/project.cpp index 2f8411d52f..3a073b0954 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -99,8 +99,12 @@ QStringList QMakeProject::expand(const ProKey &func, const QList { m_current.clear(); - if (int func_t = statics.expands.value(func)) - return evaluateBuiltinExpand(func_t, func, prepareBuiltinArgs(args)).toQStringList(); + if (int func_t = statics.expands.value(func)) { + ProStringList ret; + if (evaluateBuiltinExpand(func_t, func, prepareBuiltinArgs(args), ret) == ReturnError) + exit(3); + return ret.toQStringList(); + } QHash::ConstIterator it = m_functionDefs.replaceFunctions.constFind(func); diff --git a/qmake/property.cpp b/qmake/property.cpp index d17d62481a..9a8db8904d 100644 --- a/qmake/property.cpp +++ b/qmake/property.cpp @@ -70,6 +70,12 @@ static const struct { QMakeProperty::QMakeProperty() : settings(0) { + reload(); +} + +void QMakeProperty::reload() +{ + QLibraryInfo::reload(); for (unsigned i = 0; i < sizeof(propList)/sizeof(propList[0]); i++) { QString name = QString::fromLatin1(propList[i].name); if (!propList[i].singular) { diff --git a/qmake/property.h b/qmake/property.h index cd04e4bc03..b0129196eb 100644 --- a/qmake/property.h +++ b/qmake/property.h @@ -50,6 +50,8 @@ public: QMakeProperty(); ~QMakeProperty(); + void reload(); + bool hasValue(const ProKey &); ProString value(const ProKey &); diff --git a/qmake/qmake-aux.pro b/qmake/qmake-aux.pro index 33a7fbfd2d..357ebc7367 100644 --- a/qmake/qmake-aux.pro +++ b/qmake/qmake-aux.pro @@ -6,6 +6,24 @@ QMAKE_DOCS = $$PWD/doc/qmake.qdocconf # qmake binary win32: EXTENSION = .exe + +!build_pass { + qmake_exe.target = $$OUT_PWD/qmake$$EXTENSION + qmake_exe.depends = ../bin/qmake$$EXTENSION builtin-qt.conf + equals(QMAKE_DIR_SEP, /): \ + qmake_exe.commands = cat ../bin/qmake$$EXTENSION builtin-qt.conf > qmake$$EXTENSION && chmod +x qmake$$EXTENSION + else: \ + qmake_exe.commands = copy /B ..\bin\qmake$$EXTENSION + builtin-qt.conf qmake$$EXTENSION + QMAKE_EXTRA_TARGETS += qmake_exe + + QMAKE_CLEAN += builtin-qt.conf + QMAKE_DISTCLEAN += qmake$$EXTENSION + + first.depends += qmake_exe + QMAKE_EXTRA_TARGETS += first +} + qmake.path = $$[QT_HOST_BINS] -qmake.files = $$OUT_PWD/../bin/qmake$$EXTENSION +qmake.files = $$OUT_PWD/qmake$$EXTENSION +qmake.CONFIG = no_check_exist executable INSTALLS += qmake diff --git a/qtbase.pro b/qtbase.pro index 4aa4d6f600..c0ce0972ef 100644 --- a/qtbase.pro +++ b/qtbase.pro @@ -28,7 +28,6 @@ QMAKE_DISTCLEAN += \ config.tests/.qmake.cache \ mkspecs/qconfig.pri \ mkspecs/qdevice.pri \ - mkspecs/qhost.pri \ mkspecs/qmodule.pri \ src/corelib/global/qconfig.h \ src/corelib/global/qconfig_p.h \ @@ -79,7 +78,7 @@ prefix_build|!equals(PWD, $$OUT_PWD) { mkspecs.path = $$[QT_HOST_DATA]/mkspecs mkspecs.files = \ $$OUT_PWD/mkspecs/qconfig.pri $$OUT_PWD/mkspecs/qmodule.pri \ - $$OUT_PWD/mkspecs/qdevice.pri $$OUT_PWD/mkspecs/qhost.pri \ + $$OUT_PWD/mkspecs/qdevice.pri \ $$files($$PWD/mkspecs/*) mkspecs.files -= $$PWD/mkspecs/modules $$PWD/mkspecs/modules-inst INSTALLS += mkspecs diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri index 58caacb837..4535880536 100644 --- a/src/android/jar/jar.pri +++ b/src/android/jar/jar.pri @@ -17,7 +17,9 @@ JAVASOURCES += \ $$PATHPREFIX/QtNativeLibrariesDir.java \ $$PATHPREFIX/QtSurface.java \ $$PATHPREFIX/ExtractStyle.java \ - $$PATHPREFIX/QtServiceDelegate.java + $$PATHPREFIX/EditMenu.java \ + $$PATHPREFIX/EditPopupMenu.java \ + $$PATHPREFIX/CursorHandle.java # install target.path = $$[QT_INSTALL_PREFIX]/jar diff --git a/src/android/templates/res/values/libs.xml b/src/android/templates/res/values/libs.xml index 43296f2e7a..77f422cfb2 100644 --- a/src/android/templates/res/values/libs.xml +++ b/src/android/templates/res/values/libs.xml @@ -1,7 +1,7 @@ - https://download.qt.io/ministro/android/qt5/qt-5.7 + https://download.qt.io/ministro/android/qt5/qt-5.8