Fix compiling Mac OS 10.5 Universal App Bundle

Need to be able to specify minimum Mac OS X version outside of the
Makefile to avoid conflicting CFLAGS.
Moved -mmacosx-version-min LDFLAGS into the Makefile.
Moved -arch x86_64 from OPTIMIZEVM to CFLAGS to fix linker errors
(previously make-macosx-ub.sh passed it to CFLAGS manually).
This commit is contained in:
Zack Middleton 2017-05-24 14:09:48 -05:00
parent 3b0a862290
commit abce15055c
2 changed files with 25 additions and 17 deletions

View file

@ -409,7 +409,17 @@ ifeq ($(PLATFORM),darwin)
RENDERER_LIBS=
OPTIMIZEVM=
BASE_CFLAGS += -mmacosx-version-min=10.7 -DMAC_OS_X_VERSION_MIN_REQUIRED=1070
# Default minimum Mac OS X version
ifeq ($(MACOSX_VERSION_MIN),)
MACOSX_VERSION_MIN=10.7
endif
# Multiply by 100 and then remove decimal. 10.7 -> 1070.0 -> 1070
MAC_OS_X_VERSION_MIN_REQUIRED=$(shell echo '$(MACOSX_VERSION_MIN) * 100' | bc | cut -d. -f1)
LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN)
BASE_CFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) \
-DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED)
ifeq ($(ARCH),ppc)
BASE_CFLAGS += -arch ppc -faltivec
@ -425,7 +435,8 @@ ifeq ($(PLATFORM),darwin)
BASE_CFLAGS += -arch i386 -m32 -mstackrealign
endif
ifeq ($(ARCH),x86_64)
OPTIMIZEVM += -arch x86_64 -mfpmath=sse
OPTIMIZEVM += -mfpmath=sse
BASE_CFLAGS += -arch x86_64
endif
# When compiling on OSX for OSX, we're not cross compiling as far as the

View file

@ -15,29 +15,26 @@ fi
unset X86_64_SDK
unset X86_64_CFLAGS
unset X86_64_LDFLAGS
unset X86_64_MACOSX_VERSION_MIN
unset X86_SDK
unset X86_CFLAGS
unset X86_LDFLAGS
unset X86_MACOSX_VERSION_MIN
unset PPC_64_SDK
unset PPC_CFLAGS
unset PPC_LDFLAGS
unset PPC_MACOSX_VERSION_MIN
if [ -d /Developer/SDKs/MacOSX10.5.sdk ]; then
X86_64_SDK=/Developer/SDKs/MacOSX10.5.sdk
X86_64_CFLAGS="-arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
X86_64_LDFLAGS=" -mmacosx-version-min=10.5"
X86_64_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
X86_64_MACOSX_VERSION_MIN="10.5"
X86_SDK=/Developer/SDKs/MacOSX10.5.sdk
X86_CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
X86_LDFLAGS=" -mmacosx-version-min=10.5"
X86_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
X86_MACOSX_VERSION_MIN="10.5"
PPC_SDK=/Developer/SDKs/MacOSX10.5.sdk
PPC_CFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk \
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050"
PPC_LDFLAGS=" -mmacosx-version-min=10.5"
PPC_CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
PPC_MACOSX_VERSION_MIN="10.5"
fi
if [ -z $X86_64_SDK ] || [ -z $X86_SDK ] || [ -z $PPC_SDK ]; then
@ -70,7 +67,7 @@ NCPU=`sysctl -n hw.ncpu`
#if [ -d build/release-release-x86_64 ]; then
# rm -r build/release-darwin-x86_64
#fi
(ARCH=x86_64 CC=gcc-4.0 CFLAGS=$X86_64_CFLAGS LDFLAGS=$X86_64_LDFLAGS make -j$NCPU) || exit 1;
(ARCH=x86_64 CC=gcc-4.0 CFLAGS=$X86_64_CFLAGS MACOSX_VERSION_MIN=$X86_64_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo;echo
@ -78,7 +75,7 @@ echo;echo
#if [ -d build/release-darwin-x86 ]; then
# rm -r build/release-darwin-x86
#fi
(ARCH=x86 CC=gcc-4.0 CFLAGS=$X86_CFLAGS LDFLAGS=$X86_LDFLAGS make -j$NCPU) || exit 1;
(ARCH=x86 CC=gcc-4.0 CFLAGS=$X86_CFLAGS MACOSX_VERSION_MIN=$X86_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo;echo
@ -86,7 +83,7 @@ echo;echo
#if [ -d build/release-darwin-ppc ]; then
# rm -r build/release-darwin-ppc
#fi
(ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS LDFLAGS=$PPC_LDFLAGS make -j$NCPU) || exit 1;
(ARCH=ppc CC=gcc-4.0 CFLAGS=$PPC_CFLAGS MACOSX_VERSION_MIN=$PPC_MACOSX_VERSION_MIN make -j$NCPU) || exit 1;
echo