diff --git a/config.tests/unix/arch.test b/config.tests/unix/arch.test index f25076600c89387e7abff3949889063b7c5a933d..7250d737ba01fed3b9c2ea42116f7b23834cf449 100755 --- a/config.tests/unix/arch.test +++ b/config.tests/unix/arch.test @@ -19,20 +19,6 @@ fi LFLAGS="$SYSROOT_FLAG" CXXFLAGS="$SYSROOT_FLAG" -while [ "$#" -gt 0 ]; do - PARAM=$1 - case $PARAM in - -sdk) - LFLAGS="$LFLAGS -Wl,-syslibroot,$2" - CXXFLAGS="$CXXFLAGS -isysroot $2" - shift - ;; - *) ;; - esac - shift -done - - # debuggery [ "$VERBOSE" = "yes" ] && echo "Determining architecture... ($*)" diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 3f8c5c51a29b663eebe4ab0ea9597100a269cdd2..79e7619d5bbb34b93681d729ba25174e25e7e920 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -32,11 +32,6 @@ while [ "$#" -gt 0 ]; do MAC_ARCH_LFLAGS="$MAC_ARCH_LFLAGS -arch $2" shift ;; - -sdk) - LFLAGS="$LFLAGS -Wl,-syslibroot,$2" - CXXFLAGS="$CXXFLAGS -isysroot $2" - shift - ;; -F*|-m*|-x*) LFLAGS="$LFLAGS $PARAM" CXXFLAGS="$CXXFLAGS $PARAM" diff --git a/configure b/configure index 77536b0563d8161e5b0d4eacd574e6dbd169655c..ccd2782e62503434f41dc893c4e8aadc9e005e43 100755 --- a/configure +++ b/configure @@ -859,7 +859,6 @@ CFG_EVENTFD=auto CFG_RPATH=yes CFG_FRAMEWORK=auto CFG_MAC_HARFBUZZ=no -CFG_SDK= DEFINES= D_FLAGS= I_FLAGS= @@ -1303,7 +1302,6 @@ while [ "$#" -gt 0 ]; do ;; sdk) if [ "$BUILD_ON_MAC" = "yes" ]; then - CFG_SDK="$VAL" DeviceVar set QMAKE_MAC_SDK "$VAL" else UNKNOWN_OPT=yes @@ -2616,13 +2614,6 @@ if [ "$CFG_FORCEDEBUGINFO" = "yes" ]; then QT_CONFIG="$QT_CONFIG force_debug_info" fi -# pass on $CFG_SDK to the arch/configure tests. -if [ -n "$CFG_SDK" ]; then - MAC_SDK_FLAG="-sdk $CFG_SDK" -else - MAC_SDK_FLAG= -fi - # disable GTK style support auto-detection on Mac if [ "$BUILD_ON_MAC" = "yes" ] && [ "$CFG_QGTKSTYLE" = "auto" ]; then CFG_QGTKSTYLE=no @@ -3329,8 +3320,8 @@ Qt/Mac only: link tools against those frameworks. -no-framework ...... Do not build Qt as a series of frameworks. - -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. + -sdk <sdk> ......... Build Qt using Apple provided SDK <sdk>. The argument should be + one of the available SDKs as listed by 'xcodebuild -showsdks'. -harfbuzz .......... Use HarfBuzz to do text layout instead of Core Text when possible. * -no-harfbuzz ....... Disable HarfBuzz on Mac. It can still be enabled by setting @@ -3821,7 +3812,7 @@ compileTest() path=config.tests/$1 name=$2 shift 2 - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS $MAC_SDK_FLAG "$@" + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" "$path" "$name" $I_FLAGS $D_FLAGS $L_FLAGS "$@" } #------------------------------------------------------------------------------- @@ -3830,7 +3821,7 @@ compileTest() # Use config.tests/arch/arch.pro to have the compiler tell us what the target architecture is OUTFILE=$outpath/arch.result -"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "target" $MAC_SDK_FLAG +"$unixtests/arch.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" "$OUTFILE" "target" if [ $? -eq 0 ]; then eval `cat "$OUTFILE"` else diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf index 66104308999904cef251050c4ef2eb5f3de6fd34..57719e003f6ef194150452793c12bb6b0980f8d8 100644 --- a/mkspecs/common/mac.conf +++ b/mkspecs/common/mac.conf @@ -12,8 +12,11 @@ QMAKE_RESOURCE = /Developer/Tools/Rez QMAKE_EXTENSION_SHLIB = dylib QMAKE_LIBDIR = -QMAKE_INCDIR_OPENGL = $$QMAKE_MAC_SDK/System/Library/Frameworks/OpenGL.framework/Headers \ - $$QMAKE_MAC_SDK/System/Library/Frameworks/AGL.framework/Headers/ + +# sdk.prf will prefix the proper SDK sysroot +QMAKE_INCDIR_OPENGL = \ + /System/Library/Frameworks/OpenGL.framework/Headers \ + /System/Library/Frameworks/AGL.framework/Headers/ QMAKE_FIX_RPATH = install_name_tool -id diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf index 5eab94896b0ffbb601536a312372d35c7cc044d7..955baa3ed2bd4c139c9512c978bdcaf0e74b59ff 100644 --- a/mkspecs/features/mac/sdk.prf +++ b/mkspecs/features/mac/sdk.prf @@ -1,8 +1,24 @@ -!isEmpty(QMAKE_MAC_SDK) { - !macx-xcode:!macx-pbuilder { - QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK - QMAKE_OBJECTIVE_CFLAGS += -isysroot $$QMAKE_MAC_SDK - QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK - QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK +!host_build:!isEmpty(QMAKE_MAC_SDK) { + + contains(QMAKE_MAC_SDK, .*/.*): \ + error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)") + + QMAKE_MAC_SDK_INFO = $$system("xcodebuild -sdk $$QMAKE_MAC_SDK -version 2>/dev/null", lines) + isEmpty(QMAKE_MAC_SDK_INFO): error("Could not resolve SDK \'$$QMAKE_MAC_SDK\'") + + defineReplace(qtMacSDKInfo): \ + return($$replace($$list($$find(QMAKE_MAC_SDK_INFO, ^$$1:)), ^$$1:(.*), \\1)) + + QMAKE_MAC_SDK_PATH = $$qtMacSDKInfo(Path) + + !equals(MAKEFILE_GENERATOR, XCODE) { + QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH + QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH + QMAKE_OBJECTIVE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH + QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH } + + sysrootified = + for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val + QMAKE_INCDIR_OPENGL = $$sysrootified }