summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-02-27 15:01:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-13 18:40:26 +0100
commitc45595d64831990311f92fcebc4e34e2797f5352 (patch)
tree016f45493da71e8f1166d5f49b4cab362d0a007b /configure
parente9837f79387c7b9cd8c1483f8f64352de07c5bda (diff)
Use tools from the SDK's toolchain instead of the ones in /usr/bin
For Mac OS X we currently specify build tools without an absolute path, which means we end up using the ones in /usr/bin. This is wrong, we should be using the tools from the toolchain of the chosen SDK. For iOS we do specify an absolute path, by resolving the toolchain path in the iOS makespecs. To solve the situation on Mac OS X, we move the logic of resolving the toolchain path to sdk.prf, and share it between OSX and iOS. For configure we need to duplicate some of the logic from sdk.prf, as configure pulls out QMAKE_CC and QMAKE_CXX for running some initial tests and building qmake. The new macSDKify function also solves the issue of missing sysroot and deployment version in the flags. Change-Id: Ib1d239c9904cf3ccee5214b313cf6205869a1462 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure54
1 files changed, 51 insertions, 3 deletions
diff --git a/configure b/configure
index 38f6375468..1382fd7704 100755
--- a/configure
+++ b/configure
@@ -226,12 +226,60 @@ getSingleQMakeVariable()
echo "$2" | $AWK "/^($1)=/ { print substr(\$0, index(\$0, \"=\") + 1) }"
}
+macSDKify()
+{
+ # Normally we take care of sysrootifying in sdk.prf, but configure extracts some
+ # values before qmake is even built, so we have to duplicate the logic here.
+
+ sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1")
+ if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi
+ sysroot=$(xcodebuild -sdk $sdk -version Path 2>/dev/null)
+ if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi
+
+ case "$sdk" in
+ macosx*)
+ version_min_flag="-mmacosx-version-min=$(getSingleQMakeVariable QMAKE_MACOSX_DEPLOYMENT_TARGET "$1")"
+ ;;
+ iphoneos*)
+ version_min_flag="-miphoneos-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
+ ;;
+ iphonesimulator*)
+ version_min_flag="-mios-simulator-version-min=$(getSingleQMakeVariable QMAKE_IOS_DEPLOYMENT_TARGET "$1")"
+ ;;
+ *)
+ ;;
+ esac
+
+ echo "$1" | while read line; do
+ case "$line" in
+ QMAKE_CC=*|QMAKE_CXX=*|QMAKE_FIX_RPATH=*|QMAKE_AR=*|QMAKE_RANLIB=*|QMAKE_LINK=*|QMAKE_LINK_SHLIB=*)
+ # Prefix tool with toolchain path
+ var=$(echo "$line" | cut -d '=' -f 1)
+ val=$(echo "$line" | cut -d '=' -f 2-)
+ sdk_val=$(xcrun -sdk $sdk -find $(echo $val | cut -d ' ' -f 1))
+ val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
+ echo "$var=$val"
+ ;;
+ QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_OBJECTIVE_CFLAGS=*)
+ echo "$line -isysroot $sysroot $version_min_flag"
+ ;;
+ QMAKE_LFLAGS=*)
+ echo "$line -Wl,-syslibroot,$sysroot $version_min_flag"
+ ;;
+ *)
+ echo "$line"
+ ;;
+ esac
+ done
+}
+
# relies on $QMAKESPEC being set correctly. parses include statements in
# qmake.conf and prints out the expanded file
getQMakeConf()
{
if [ -z "$specvals" ]; then
specvals=`expandQMakeConf "$QMAKESPEC/qmake.conf" | extractQMakeVariables "host_build"`
+ if [ "$BUILD_ON_MAC" = "yes" ]; then specvals=$(macSDKify "$specvals"); fi
fi
getSingleQMakeVariable "$1" "$specvals"
}
@@ -240,6 +288,7 @@ getXQMakeConf()
{
if [ -z "$xspecvals" ]; then
xspecvals=`expandQMakeConf "$XQMAKESPEC/qmake.conf" | extractQMakeVariables "!host_build"`
+ if [ "$BUILD_ON_MAC" = "yes" ]; then xspecvals=$(macSDKify "$xspecvals"); fi
fi
getSingleQMakeVariable "$1" "$xspecvals"
}
@@ -3892,12 +3941,11 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ];
EXEEXT=
fi
if [ "$BUILD_ON_MAC" = "yes" ]; then
- DEPLOYMENT_CFLAGS="-mmacosx-version-min=$(getQMakeConf QMAKE_MACOSX_DEPLOYMENT_TARGET)"
echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $DEPLOYMENT_CFLAGS \$(CARBON_CFLAGS)"
- EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS $DEPLOYMENT_CFLAGS \$(CARBON_CFLAGS)"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS \$(CARBON_CFLAGS)"
+ EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
EXTRA_OBJS="$EXTRA_OBJS \
qsettings_mac.o \
qcore_mac.o"