From 9a0ee67e04c16494321ed1d0736c2015f9910dcc Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Tue, 24 Apr 2018 17:24:15 -0500 Subject: [PATCH] Make macOS Universal Bundle target 10.6 for x86 and x86_64 SDL 2.0.5 dropped support for macOS 10.5 so target 10.6 instead. The PPC build uses SDL 2.0.1 so it still targets 10.5. macOS 10.5 (x86, x86_64) should automatically run the PPC build using Rosetta. Revert MAN-AT-ARMS' change to SDL 2.0.8 SDL_platform.h that allowed targeting macOS 10.5 for the sake of PPC. It also incorrectly allowed x86 and x86_64 to target 10.5 as well. (Also macOS PPC uses separate headers now.) --- code/SDL2/include/SDL_platform.h | 7 +++--- make-macosx-app.sh | 38 +++++++++++++++++++++++++++++--- make-macosx-ub.sh | 35 ++++++++++++++++++++--------- make-macosx.sh | 17 +++++++++++--- 4 files changed, 77 insertions(+), 20 deletions(-) diff --git a/code/SDL2/include/SDL_platform.h b/code/SDL2/include/SDL_platform.h index e9faa049..7dea4ce9 100644 --- a/code/SDL2/include/SDL_platform.h +++ b/code/SDL2/include/SDL_platform.h @@ -83,10 +83,9 @@ /* if not compiling for iOS */ #undef __MACOSX__ #define __MACOSX__ 1 -/* modified to 1050 for PPC Build*/ -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -# error SDL for Mac OS X only supports deploying on 10.5 and above. -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# error SDL for Mac OS X only supports deploying on 10.6 and above. +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ #endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ diff --git a/make-macosx-app.sh b/make-macosx-app.sh index 9acb40be..14662046 100755 --- a/make-macosx-app.sh +++ b/make-macosx-app.sh @@ -283,7 +283,9 @@ fi cp code/libs/macosx/*.dylib "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}" cp ${ICNSDIR}/${ICNS} "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/$ICNS" || exit 1; echo -n ${PKGINFO} > "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/PkgInfo" || exit 1; -echo " + +# create Info.Plist +PLIST=" @@ -310,14 +312,44 @@ echo " CGDisableCoalescedUpdates LSMinimumSystemVersion - ${MACOSX_DEPLOYMENT_TARGET} + ${MACOSX_DEPLOYMENT_TARGET}" + +if [ -n "${MACOSX_DEPLOYMENT_TARGET_PPC}" ] || [ -n "${MACOSX_DEPLOYMENT_TARGET_X86}" ] || [ -n "${MACOSX_DEPLOYMENT_TARGET_X86_64}" ]; then + PLIST="${PLIST} + LSMinimumSystemVersionByArchitecture + " + + if [ -n "${MACOSX_DEPLOYMENT_TARGET_PPC}" ]; then + PLIST="${PLIST} + ppc + ${MACOSX_DEPLOYMENT_TARGET_PPC}" + fi + + if [ -n "${MACOSX_DEPLOYMENT_TARGET_X86}" ]; then + PLIST="${PLIST} + i386 + ${MACOSX_DEPLOYMENT_TARGET_X86}" + fi + + if [ -n "${MACOSX_DEPLOYMENT_TARGET_X86_64}" ]; then + PLIST="${PLIST} + x86_64 + ${MACOSX_DEPLOYMENT_TARGET_X86_64}" + fi + + PLIST="${PLIST} + " +fi + +PLIST="${PLIST} NSHumanReadableCopyright QUAKE III ARENA Copyright © 1999-2000 id Software, Inc. All rights reserved. NSPrincipalClass NSApplication -" > "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Info.plist" +" +echo -e "${PLIST}" > "${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/Info.plist" # action takes care of generating universal binaries if lipo is available # otherwise, it falls back to using a simple copy, expecting the first item in diff --git a/make-macosx-ub.sh b/make-macosx-ub.sh index 997c9f42..fd472f9b 100755 --- a/make-macosx-ub.sh +++ b/make-macosx-ub.sh @@ -37,12 +37,33 @@ if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then PPC_MACOSX_VERSION_MIN="10.5" fi +# SDL 2.0.5+ (x86, x86_64) only supports MacOSX 10.6 and later +if [ -d /Developer/SDKs/MacOSX10.6.sdk ]; then + X86_64_SDK=/Developer/SDKs/MacOSX10.6.sdk + X86_64_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk" + X86_64_MACOSX_VERSION_MIN="10.6" + + X86_SDK=/Developer/SDKs/MacOSX10.6.sdk + X86_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk" + X86_MACOSX_VERSION_MIN="10.6" +else + # Don't try to compile with 10.5 version min + X86_64_SDK= + X86_SDK= +fi +# end SDL 2.0.5 + if [ -z $X86_64_SDK ] || [ -z $X86_SDK ] || [ -z $PPC_SDK ]; then echo "\ ERROR: This script is for building a Universal Binary. You cannot build for a different architecture unless you have the proper Mac OS X SDKs installed. If you just want to to compile for your own system run - 'make-macosx.sh' instead of this script." + 'make-macosx.sh' instead of this script. + + In order to build a binary with maximum compatibility you must + build on Mac OS X 10.6 and have the MacOSX10.5 and MacOSX10.6 + SDKs installed from the Xcode install disk Packages folder." + exit 1 fi @@ -51,15 +72,6 @@ echo "Building X86 Client/Dedicated Server against \"$X86_SDK\"" echo "Building PPC Client/Dedicated Server against \"$PPC_SDK\"" echo -if [ "$X86_64_SDK" != "/Developer/SDKs/MacOSX10.5.sdk" ] || \ - [ "$X86_SDK" != "/Developer/SDKs/MacOSX10.5.sdk" ]; then - echo "\ -WARNING: in order to build a binary with maximum compatibility you must - build on Mac OS X 10.5 using Xcode 3.1 and have the MacOSX10.5 - SDKs installed from the Xcode install disk Packages folder." -sleep 3 -fi - # For parallel make on multicore boxes... NCPU=`sysctl -n hw.ncpu` @@ -89,4 +101,7 @@ echo # use the following shell script to build a universal application bundle export MACOSX_DEPLOYMENT_TARGET="10.5" +export MACOSX_DEPLOYMENT_TARGET_PPC="$PPC_MACOSX_VERSION_MIN" +export MACOSX_DEPLOYMENT_TARGET_X86="$X86_MACOSX_VERSION_MIN" +export MACOSX_DEPLOYMENT_TARGET_X86_64="$X86_64_MACOSX_VERSION_MIN" "./make-macosx-app.sh" release diff --git a/make-macosx.sh b/make-macosx.sh index 6090bed0..be1ae774 100755 --- a/make-macosx.sh +++ b/make-macosx.sh @@ -43,10 +43,18 @@ unset ARCH_SDK unset ARCH_CFLAGS unset ARCH_MACOSX_VERSION_MIN -if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then - ARCH_SDK=/Developer/SDKs/MacOSX10.5.sdk - ARCH_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk" +# SDL 2.0.1 (ppc) supports MacOSX 10.5 +# SDL 2.0.5+ (x86, x86_64) supports MacOSX 10.6 and later +if [ $BUILDARCH = "ppc" ]; then + if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then + ARCH_SDK=/Developer/SDKs/MacOSX10.5.sdk + ARCH_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk" + fi ARCH_MACOSX_VERSION_MIN="10.5" +elif [ -d /Developer/SDKs/MacOSX10.6.sdk ]; then + ARCH_SDK=/Developer/SDKs/MacOSX10.6.sdk + ARCH_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.6.sdk" + ARCH_MACOSX_VERSION_MIN="10.6" else ARCH_MACOSX_VERSION_MIN="10.7" fi @@ -71,4 +79,7 @@ NCPU=`sysctl -n hw.ncpu` # use the following shell script to build an application bundle export MACOSX_DEPLOYMENT_TARGET="${ARCH_MACOSX_VERSION_MIN}" +export MACOSX_DEPLOYMENT_TARGET_PPC= +export MACOSX_DEPLOYMENT_TARGET_X86= +export MACOSX_DEPLOYMENT_TARGET_X86_64= "./make-macosx-app.sh" release ${BUILDARCH}