ovalue = ovalue substr(value, 1, RSTART - 1)
var = substr(value, RSTART + 2, RLENGTH - 2)
value = substr(value, RSTART + RLENGTH)
- if (var ~ /^{/) {
+ if (var ~ /^\{/) {
var = substr(var, 2, length(var) - 2)
}
ovalue = ovalue values[var]
echo "$2" "$eq" "$3" >> "$DEVICE_VARS_FILE"
}
+resolveDeviceMkspec()
+{
+ result=$(find "$relpath/mkspecs/devices/" -type d -name "*$VAL*" | sed "s,^$relpath/mkspecs/,,")
+ match_count=$(echo "$result" | wc -w)
+ if [ "$match_count" -gt 1 ]; then
+ echo >&2 "Error: Multiple matches for device '$VAL'. 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 '$VAL'"
+ echo "undefined"
+ else
+ echo "$result"
+ fi
+}
+
#-------------------------------------------------------------------------------
# operating system detection
#-------------------------------------------------------------------------------
# initalize internal variables
CFG_CONFIGURE_EXIT_ON_ERROR=yes
CFG_PROFILE=no
-CFG_EXCEPTIONS=unspecified
CFG_GUI=auto # (yes|no|auto)
CFG_WIDGETS=yes
CFG_QCONFIG=full
CFG_RPATH=yes
CFG_FRAMEWORK=auto
MAC_CONFIG_TEST_COMMANDLINE= # used to make the configure tests run with the correct arch's and SDK settings
-CFG_MAC_DWARF2=auto
CFG_MAC_HARFBUZZ=no
CFG_SXE=no
CFG_PREFIX_INSTALL=yes
QT_CFLAGS_GSTREAMER=
QT_LIBS_GSTREAMER=
+# default qpa platform
+QT_QPA_DEFAULT_PLATFORM=
+
#-------------------------------------------------------------------------------
# check SQL drivers available in this package
#-------------------------------------------------------------------------------
VAL=no
;;
#Qt style yes options
- -profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-eglfs|-directfb|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-qml-debug|-javascript-jit|-rpath|-pkg-config|-force-pkg-config|-icu|-force-asserts|-testcocoon)
+ -profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-eglfs|-directfb|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-qml-debug|-javascript-jit|-rpath|-pkg-config|-force-pkg-config|-icu|-force-asserts|-testcocoon)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
shift
VAL=$1
;;
- -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir)
+ -prefix|-docdir|-headerdir|-plugindir|-importdir|-datadir|-libdir|-bindir|-translationdir|-sysconfdir|-examplesdir|-testsdir|-depths|-make|-nomake|-platform|-xplatform|-device|-device-option|-sdk|-arch|-host-arch|-mysql_config|-sysroot|-hostdatadir|-hostbindir|-qpa)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
shift
VAL="$1"
VAL=`echo $1 | sed 's,-R,,'`
fi
;;
- -l?*)
+ -l?*|-l)
VAR="add_link"
- VAL=`echo $1 | sed 's,-l,,'`
+ if [ "$1" = "-l" ]; then
+ shift
+ VAL="$1"
+ else
+ VAL=`echo $1 | sed 's,-l,,'`
+ fi
;;
-F?*|-F)
VAR="add_fpath"
UNKNOWN_OPT=yes
fi
;;
- dwarf2)
- if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
- CFG_MAC_DWARF2="$VAL"
- else
- UNKNOWN_OPT=yes
- fi
- ;;
arch|host-arch)
OPT_OBSOLETE_HOST_ARG=yes
;;
QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
fi
;;
- exceptions|g++-exceptions)
- if [ "$VAL" = "no" ]; then
- CFG_EXCEPTIONS=no
- elif [ "$VAL" = "yes" ]; then
- CFG_EXCEPTIONS=yes
- else
- UNKNOWN_OPT=yes
- fi
- ;;
platform)
PLATFORM="$VAL"
# keep compatibility with old platform names
case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
;;
device)
- XPLATFORM="devices/$VAL"
+ XPLATFORM=`resolveDeviceMkspec $VAL`
+ [ "$XPLATFORM" = "undefined" ] && exit 101
;;
device-option)
DEV_VAR=`echo $VAL | sed "s,^\(.*\)=.*,\1,"`
DEV_VAL=`echo $VAL | sed "s,^.*=\(.*\),\1,"`
DeviceVar set $DEV_VAR $DEV_VAL
;;
+ qpa)
+ QT_QPA_DEFAULT_PLATFORM="$VAL"
+ ;;
debug-and-release)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_DEBUG_RELEASE="$VAL"
fi
#-------------------------------------------------------------------------------
-# write out device config before we run the test.
-#-------------------------------------------------------------------------------
-if cmp -s "$DEVICE_VARS_FILE" "$outpath/mkspecs/qdevice.pri"; then
- rm -f "$DEVICE_VARS_FILE"
-else
- mv -f $DEVICE_VARS_FILE "$outpath/mkspecs/qdevice.pri"
-fi
-
-#-------------------------------------------------------------------------------
# tests that don't need qmake (must be run before displaying help)
#-------------------------------------------------------------------------------
fi
fi
-#auto-detect DWARF2 on the mac
-if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
- if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
- CFG_MAC_DWARF2=no
- else
- CFG_MAC_DWARF2=yes
- fi
-fi
-
# auto-detect support for separate debug info in objcopy
if [ "$CFG_SEPARATE_DEBUG_INFO" != "no" ] && [ "$CFG_SHARED" = "yes" ]; then
TEST_COMPILER_CFLAGS=`getXQMakeConf QMAKE_CFLAGS`
[-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-testsdir <dir>]
[-release] [-debug] [-debug-and-release]
[-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile]
- [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility]
- [-accessibility] [-no-sql-<driver>] [-sql-<driver>]
+ [-largefile] [-no-accessibility] [-accessibility] [-no-sql-<driver>] [-sql-<driver>]
[-plugin-sql-<driver>] [-system-sqlite]
[-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
[-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng] [-qt-libpng] [-system-libpng]
-no-largefile ...... Disables large file support.
+ -largefile ......... Enables Qt to access files larger than 4 GB.
- -no-exceptions ..... Disable exceptions on compilers that support it.
- * -exceptions ........ Enable exceptions on compilers that support it.
-
-no-accessibility .. Do not compile Accessibility support.
* -accessibility ..... Compile Accessibility support.
$DFBN -no-directfb ....... Do not compile DirectFB support.
$DFBY -directfb .......... Compile DirectFB support.
+ -qpa <name> ......... Sets the default QPA platform (e.g xcb, cocoa, windows).
+
-xplatform target ... The target platform when cross-compiling.
-sysroot <dir> ...... Sets <dir> as the target compiler's and qmake's sysroot.
link tools against those frameworks.
-no-framework ...... Do not build Qt as a series of frameworks.
- * -dwarf2 ............ Enable dwarf2 debugging symbols.
- -no-dwarf2 ......... Disable dwarf2 debugging symbols.
-
-sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. This option requires gcc 4.
To use a different SDK with gcc 3.3, set the SDKROOT environment variable.
fi
#-------------------------------------------------------------------------------
+# write out device config before we run the test.
+#-------------------------------------------------------------------------------
+if cmp -s "$DEVICE_VARS_FILE" "$outpath/mkspecs/qdevice.pri"; then
+ rm -f "$DEVICE_VARS_FILE"
+else
+ mv -f $DEVICE_VARS_FILE "$outpath/mkspecs/qdevice.pri"
+fi
+
+#-------------------------------------------------------------------------------
# tests that need qmake
#-------------------------------------------------------------------------------
# detect avx support
if [ "${CFG_AVX}" = "auto" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx "avx" $L_FLAGS $I_FLAGS $l_FLAGS "-mavx"; then
- CFG_AVX=yes
+ case "$XQMAKESPEC" in
+ *g++*|*-clang*)
+ # Some clang versions produce internal compiler errors compiling Qt AVX code
+ case `$TEST_COMPILER --version` in
+ Apple\ clang\ version\ 2*|Apple\ clang\ version\ 3.0*)
+ CFG_AVX=no
+ if [ "$OPT_VERBOSE" = "yes" ]; then
+ echo 'AVX support disabled for blacklisted clang compiler'
+ fi
+ ;;
+ *)
+ CFG_AVX=yes
+ ;;
+ esac
+ ;;
+ *)
+ CFG_AVX=yes
+ ;;
+ esac
else
CFG_AVX=no
fi
fi
# detect avx2 support
+if [ "${CFG_AVX}" = "no" ]; then
+ CFG_AVX2=no
+fi
if [ "${CFG_AVX2}" = "auto" ]; then
if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/avx2 "avx2" $L_FLAGS $I_FLAGS $l_FLAGS "-march=core-avx2"; then
CFG_AVX2=yes
fi
fi
+# auto-detect GTK style support
+if [ "$CFG_GLIB" = "yes" -a "$CFG_QGTKSTYLE" != "no" ]; then
+ if [ -n "$PKG_CONFIG" ]; then
+ QT_CFLAGS_QGTKSTYLE=`$PKG_CONFIG --cflags gtk+-2.0 ">=" 2.10 atk 2>/dev/null`
+ QT_LIBS_QGTKSTYLE=`$PKG_CONFIG --libs gobject-2.0 2>/dev/null`
+ fi
+ if [ -n "$QT_CFLAGS_QGTKSTYLE" ] ; then
+ CFG_QGTKSTYLE=yes
+ QT_CONFIG="$QT_CONFIG gtkstyle"
+ QMakeVar set QT_CFLAGS_QGTKSTYLE "$QT_CFLAGS_QGTKSTYLE"
+ QMakeVar set QT_LIBS_QGTKSTYLE "$QT_LIBS_QGTKSTYLE"
+ else
+ if [ "$CFG_QGTKSTYLE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
+ echo "Gtk theme support cannot be enabled due to functionality tests!"
+ echo " Turn on verbose messaging (-v) to $0 to see the fin al report."
+ echo " If you believe this message is in error you may use the continue"
+ echo " switch (-continue) to $0 to continue."
+ exit 101
+ else
+ CFG_QGTKSTYLE=no
+ fi
+ fi
+elif [ "$CFG_GLIB" = "no" ]; then
+ CFG_QGTKSTYLE=no
+fi
+
# ### Vestige
if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
if [ -n "$PKG_CONFIG" ]; then
fi
fi
+# Determine the default QPA platform
+if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
+ # check the mkspec
+ QT_QPA_DEFAULT_PLATFORM=`getXQMakeConf QT_QPA_DEFAULT_PLATFORM`
+ if [ -z "$QT_QPA_DEFAULT_PLATFORM" ]; then
+ if [ "$BUILD_ON_MAC" = "yes" ]; then
+ QT_QPA_DEFAULT_PLATFORM="cocoa"
+ elif [ "$UNAME_SYSTEM" = "QNX" ]; then
+ QT_QPA_DEFAULT_PLATFORM="qnx"
+ else
+ QT_QPA_DEFAULT_PLATFORM="xcb"
+ fi
+ fi
+fi
+
if [ -n "$QMAKE_CFLAGS_XCB" ] || [ -n "$QMAKE_LIBS_XCB" ]; then
QMakeVar set QMAKE_CFLAGS_XCB "$QMAKE_CFLAGS_XCB"
QMakeVar set QMAKE_LIBS_XCB "$QMAKE_LIBS_XCB"
# ask for all that hasn't been auto-detected or specified in the arguments
#-------------------------------------------------------------------------------
-# enable dwarf2 support on Mac
-if [ "$CFG_MAC_DWARF2" = "yes" ]; then
- QT_CONFIG="$QT_CONFIG dwarf2"
-fi
-
-# Detect the default arch (x86 or x86_64) on Mac OS X
-if [ "$BUILD_ON_MAC" = "yes" ] && [ "$QT_CROSS_COMPILE" = "no" ]; then
- DEFAULT_ARCH=
- case `file "${outpath}/bin/qmake"` in
- *i?86)
- DEFAULT_ARCH=x86
- ;;
- *x86_64)
- DEFAULT_ARCH=x86_64
- ;;
- *ppc|*ppc64|*)
- # unsupported/unknown
- ;;
- esac
-
- if [ -n "$DEFAULT_ARCH" ]; then
- [ "$OPT_VERBOSE" = "yes" ] && echo "Setting default Mac OS X architechture to $DEFAULT_ARCH."
- QT_CONFIG="$QT_CONFIG $DEFAULT_ARCH"
- QMAKE_CONFIG="$QMAKE_CONFIG $DEFAULT_ARCH"
- # Make the application arch follow the Qt arch
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG $DEFAULT_ARCH"
- fi
-fi
-
# ### Vestige
if [ "$CFG_PHONON_BACKEND" = "yes" ]; then
QT_CONFIG="$QT_CONFIG phonon-backend"
QMakeVar add QMAKE_OBJECTIVE_CFLAGS_WARN_ON "$W_FLAGS"
fi
-# turn off exceptions for the compilers that support it
-if [ "$XPLATFORM" != "$PLATFORM" ]; then
- COMPILER=`echo $XPLATFORM | cut -f 2- -d-`
-else
- COMPILER=`echo $PLATFORM | cut -f 2- -d-`
-fi
-
-if [ "$CFG_EXCEPTIONS" != "no" ]; then
- QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
-fi
-
if [ "$XPLATFORM_MINGW" = "yes" ]; then
# mkspecs/features/win32/default_pre.prf sets "no-rtti".
# Follow default behavior of configure.exe by overriding with "rtti".
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QML_NO_DEBUGGER"
fi
-if [ "$CFG_EXCEPTIONS" = "no" ]; then
- case "$COMPILER" in
- g++*)
- QMakeVar add QMAKE_CFLAGS -fno-exceptions
- QMakeVar add QMAKE_CXXFLAGS -fno-exceptions
- QMakeVar add QMAKE_LFLAGS -fno-exceptions
- ;;
- cc*)
- case "$PLATFORM" in
- irix-cc*)
- QMakeVar add QMAKE_CFLAGS -LANG:exceptions=off
- QMakeVar add QMAKE_CXXFLAGS -LANG:exceptions=off
- QMakeVar add QMAKE_LFLAGS -LANG:exceptions=off
- ;;
- *) ;;
- esac
- ;;
- *) ;;
- esac
- QMAKE_CONFIG="$QMAKE_CONFIG exceptions_off"
-fi
-
-case "$COMPILER" in
-g++*)
+case "$QMAKE_CONF_COMPILER" in
+*g++*)
# GNU C++
COMPILER_VERSION=`${QMAKE_CONF_COMPILER} -dumpversion 2>/dev/null`
[ "$CFG_PNG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_PNG"
[ "$CFG_JPEG" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_IMAGEFORMAT_JPEG"
[ "$CFG_ZLIB" != "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_ZLIB"
-[ "$CFG_EXCEPTIONS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EXCEPTIONS"
[ "$CFG_SXE" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SXE"
[ "$CFG_DBUS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_DBUS"
EOF
fi
+echo "#define QT_QPA_DEFAULT_PLATFORM_NAME \"$QT_QPA_DEFAULT_PLATFORM\"" >>"$outpath/src/corelib/global/qconfig.h.new"
+
# avoid unecessary rebuilds by copying only if qconfig.h has changed
if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then
rm -f "$outpath/src/corelib/global/qconfig.h.new"
QT_NAMESPACE = $QT_NAMESPACE
EOF
+
+if [ -n "$PKG_CONFIG_SYSROOT_DIR" ] || [ -n "$PKG_CONFIG_LIBDIR" ]; then
+ echo "# pkgconfig" >> "$QTCONFIG.tmp"
+ echo "PKG_CONFIG_SYSROOT_DIR = $PKG_CONFIG_SYSROOT_DIR" >> "$QTCONFIG.tmp"
+ echo "PKG_CONFIG_LIBDIR = $PKG_CONFIG_LIBDIR" >> "$QTCONFIG.tmp"
+ echo >> $"$QTCONFIG.tmp"
+fi
+
if [ -n "$CFG_SYSROOT" ]; then
echo "# sysroot" >>"$QTCONFIG.tmp"
echo `basename "$XQMAKESPEC"` \{ >>"$QTCONFIG.tmp"
#-------------------------------------------------------------------------------
exec 3>&1 1>$outpath/config.summary # redirect output temporarily to config.summary
-case "$COMPILER" in
-g++*)
- if [ "$CFG_EXCEPTIONS" != "no" ]; then
- cat <<EOF
-
- This target is using the GNU C++ compiler ($PLATFORM).
-
- Recent versions of this compiler automatically include code for
- exceptions, which increase both the size of the Qt libraries and
- the amount of memory taken by your applications.
-
- You may choose to re-run `basename $0` with the -no-exceptions
- option to compile Qt without exceptions. This is completely binary
- compatible, and existing applications will continue to work.
-
-EOF
- fi
- ;;
-cc*)
- case "$PLATFORM" in
- irix-cc*)
- if [ "$CFG_EXCEPTIONS" != "no" ]; then
- cat <<EOF
-
- This target is using the MIPSpro C++ compiler ($PLATFORM).
-
- You may choose to re-run `basename $0` with the -no-exceptions
- option to compile Qt without exceptions. This will make the
- size of the Qt library smaller and reduce the amount of memory
- taken by your applications.
-
-EOF
- fi
- ;;
- *) ;;
- esac
- ;;
-*) ;;
-esac
-
echo
if [ "$XPLATFORM" = "$PLATFORM" ]; then
echo "Build type: $PLATFORM"