Index: build-scripts/fatbuild.sh =================================================================== --- build-scripts/fatbuild.sh (revision 5321) +++ build-scripts/fatbuild.sh (working copy) @@ -17,8 +17,11 @@ exit 1 fi -# See if we can use 10.2 or 10.3 runtime compatibility -if [ -d "$SDK_PATH/MacOSX10.2.8.sdk" ]; then +# set the minimum OS version SDK installed on this system +SDK_NAME=MacOSX10.2.8.sdk +MIN_VERSION=1020 +# See if we can use 10.2 runtime compatibility +if [ -d "$SDK_PATH/$SDK_NAME" ]; then # PowerPC configure flags (10.2 runtime compatibility) # We dynamically load X11, so using the system X11 headers is fine. CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \ @@ -28,20 +31,50 @@ CC_PPC="gcc-3.3 -arch ppc" CXX_PPC="g++-3.3 -arch ppc" CFLAGS_PPC="" - CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ + CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MIN_VERSION \ -nostdinc \ --F$SDK_PATH/MacOSX10.2.8.sdk/System/Library/Frameworks \ --I$SDK_PATH/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ --isystem $SDK_PATH/MacOSX10.2.8.sdk/usr/include" +-F$SDK_PATH/$SDK_NAME/System/Library/Frameworks \ +-I$SDK_PATH/$SDK_NAME/usr/include/gcc/darwin/3.3 \ +-isystem $SDK_PATH/$SDK_NAME/usr/include" # PowerPC linker flags LFLAGS_PPC="-Wl,-headerpad_max_install_names -arch ppc \ --L$SDK_PATH/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \ --F$SDK_PATH/MacOSX10.2.8.sdk/System/Library/Frameworks \ --Wl,-syslibroot,$SDK_PATH/MacOSX10.2.8.sdk" +-L$SDK_PATH/$SDK_NAME/usr/lib/gcc/darwin/3.3 \ +-F$SDK_PATH/$SDK_NAME/System/Library/Frameworks \ +-Wl,-syslibroot,$SDK_PATH/$SDK_NAME" -else # 10.2 or 10.3 SDK +else # 10.2 or 10.3 SDK - Try for 10.3.9, or 10.4 or 10.5 + SDK_NAME=MacOSX10.3.9.sdk + MIN_VERSION=1030 + VERSION_MIN=10.3 + if [ ! -d $SDK_PATH/$SDK_NAME ]; then + SDK_NAME=MacOSX10.4u.sdk + MIN_VERSION=1040 + VERSION_MIN=10.4 + fi + if [ ! -d $SDK_PATH/$SDK_NAME ]; then + SDK_NAME=MacOSX10.5.sdk + MIN_VERSION=1050 + VERSION_MIN=10.5 + fi + # Xcode 3.2 (Snow Leopard) names it darwin10 even though powerpc only runs darwin9 + GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1" + # This is for Xcode 3.x (Leopard) + if [ ! -d "$GCCUSRPATH" ]; then + GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1" + fi + + # This is for Xcode 2.x (Tiger) + if [ ! -d "$GCCUSRPATH" ]; then + GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin8/4.0.1" + fi + + if [ ! -d "$GCCUSRPATH" ]; then + echo "Couldn't find any GCC usr path" + exit 1 + fi + # PowerPC configure flags (10.3 runtime compatibility) # We dynamically load X11, so using the system X11 headers is fine. CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \ @@ -51,30 +84,49 @@ CC_PPC="gcc-4.0 -arch ppc" CXX_PPC="g++-4.0 -arch ppc" CFLAGS_PPC="" - CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1030 \ + CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MIN_VERSION \ -nostdinc \ --F$SDK_PATH/MacOSX10.3.9.sdk/System/Library/Frameworks \ --I$SDK_PATH/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1/include \ --isystem $SDK_PATH/MacOSX10.3.9.sdk/usr/include" +-F$SDK_PATH/$SDK_NAME/System/Library/Frameworks \ +-I$GCCUSRPATH/include \ +-isystem $SDK_PATH/$SDK_NAME/usr/include" # PowerPC linker flags - LFLAGS_PPC="-Wl,-headerpad_max_install_names -arch ppc -mmacosx-version-min=10.3 \ --L$SDK_PATH/MacOSX10.3.9.sdk/usr/lib/gcc/powerpc-apple-darwin9/4.0.1 \ --F$SDK_PATH/MacOSX10.3.9.sdk/System/Library/Frameworks \ --Wl,-syslibroot,$SDK_PATH/MacOSX10.3.9.sdk" + LFLAGS_PPC="-Wl,-headerpad_max_install_names -arch ppc -mmacosx-version-min=$VERSION_MIN \ +-L$GCCUSRPATH \ +-F$SDK_PATH/$SDK_NAME/System/Library/Frameworks \ +-Wl,-syslibroot,$SDK_PATH/$SDK_NAME" fi # 10.2 or 10.3 SDK # Intel configure flags (10.4 runtime compatibility) +# Check min version again in case it is set for 10.3 for PPC which Intel doesn't support +SDK_NAME=MacOSX10.4u.sdk +MIN_VERSION=1040 +VERSION_MIN=10.4 +if [ ! -d $SDK_PATH/$SDK_NAME ]; then + SDK_NAME=MacOSX10.5.sdk + MIN_VERSION=1050 + VERSION_MIN=10.5 +fi +if [ ! -d $SDK_PATH/$SDK_NAME ]; then + SDK_NAME=MacOSX10.6.sdk + MIN_VERSION=1060 + VERSION_MIN=10.6 +fi # We dynamically load X11, so using the system X11 headers is fine. CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \ --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib" -# They changed this to "darwin10" in Xcode 3.2 (Snow Leopard). -GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1" +# This is for Xcode 3.2 (Snow Leopard). +GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1" +# This is for Xcode 3.x (Leopard). if [ ! -d "$GCCUSRPATH" ]; then - GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1" + GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1" fi +# This is for Xcode 2.x (Tiger) +if [ ! -d "$GCCUSRPATH" ]; then + GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1" +fi if [ ! -d "$GCCUSRPATH" ]; then echo "Couldn't find any GCC usr path" @@ -84,17 +136,17 @@ # Intel compiler flags CC_X86="gcc-4.0 -arch i386" CXX_X86="g++-4.0 -arch i386" -CFLAGS_X86="-mmacosx-version-min=10.4" -CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ +CFLAGS_X86="-mmacosx-version-min=$VERSION_MIN" +CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MIN_VERSION \ -nostdinc \ --F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \ +-F$SDK_PATH/$SDK_NAME/System/Library/Frameworks \ -I$GCCUSRPATH/include \ --isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include" +-isystem $SDK_PATH/$SDK_NAME/usr/include" # Intel linker flags -LFLAGS_X86="-Wl,-headerpad_max_install_names -arch i386 -mmacosx-version-min=10.4 \ +LFLAGS_X86="-Wl,-headerpad_max_install_names -arch i386 -mmacosx-version-min=$VERSION_MIN \ -L$GCCUSRPATH \ --Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk" +-Wl,-syslibroot,$SDK_PATH/$SDK_NAME" # # Find the configure script @@ -237,10 +289,11 @@ output=.libs sh $auxdir/mkinstalldirs build/$output cd build - target=`find . -mindepth 3 -type f -name '*.dylib' | head -1 | sed 's|.*/||'` - (lipo -create -o $output/$target `find . -mindepth 3 -type f -name "*.dylib"` && - ln -sf $target $output/libSDL-1.2.0.dylib && - ln -sf $target $output/libSDL.dylib && + target=`find . -mindepth 3 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'` + (if test "x$target" != x; then + lipo -create -o $output/$target `find . -mindepth 3 -maxdepth 4 -type f -name "*.dylib"` && + ln -sf $target $output/libSDL.dylib + fi && lipo -create -o $output/libSDL.a */build/.libs/libSDL.a && cp $native_path/build/.libs/libSDL.la $output && cp $native_path/build/.libs/libSDL.lai $output &&