Fat build doesn't support PPC anymore. SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Sun, 14 Aug 2011 17:17:17 -0400
branchSDL-1.2
changeset 5608 2bee7f46cb2b
parent 5607 01a3ec16d8d5
child 5610 e55f9d0e117a
Fat build doesn't support PPC anymore.
build-scripts/fatbuild.sh
--- a/build-scripts/fatbuild.sh	Thu Aug 11 18:50:45 2011 +0200
+++ b/build-scripts/fatbuild.sh	Sun Aug 14 17:17:17 2011 -0400
@@ -4,98 +4,72 @@
 
 # Number of CPUs (for make -j)
 NCPU=`sysctl -n hw.ncpu`
-NJOB=$NCPU
-#NJOB=`expr $NCPU + 1`
+if test x$NJOB = x; then
+    NJOB=$NCPU
+fi
+
+# SDK path
+if test x$SDK_PATH = x; then
+    SDK_PATH=/Developer/SDKs
+fi
 
 # Generic, cross-platform CFLAGS you always want go here.
 CFLAGS="-O3 -g -pipe"
 
-# Locate Xcode SDK path
-SDK_PATH=/Developer/SDKs
-if [ ! -d $SDK_PATH ]; then
-    echo "Couldn't find SDK path"
-    exit 1
-fi
-
-# See if we can use 10.2 or 10.3 runtime compatibility
-if [ -d "$SDK_PATH/MacOSX10.2.8.sdk" ]; 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 \
---x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
-
-    # PowerPC compiler flags
-    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 \
--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"
-
-    # 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"
-
-else # 10.2 or 10.3 SDK
-
-    # 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 \
---x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
-
-    # PowerPC compiler flags
-    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 \
--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"
-
-    # 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"
-
-fi # 10.2 or 10.3 SDK
-
-# Intel configure flags (10.4 runtime compatibility)
+# Intel 32-bit configure flags (10.4 runtime compatibility)
 # 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"
-if [ ! -d "$GCCUSRPATH" ]; then
-    GCCUSRPATH="$SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1"
+# They changed this from "darwin9" to "darwin10" in Xcode 3.2 (Snow Leopard).
+GCCUSRPATH_X86=`ls -d $SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin*/4.0.1`
+if [ ! -d "$GCCUSRPATH_X86" ]; then
+    echo "Couldn't find any GCC usr path for 32-bit x86"
+    exit 1
 fi
-
-if [ ! -d "$GCCUSRPATH" ]; then
-    echo "Couldn't find any GCC usr path"
+GCCUSRPATH_X64=`ls -d $SDK_PATH/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin*/4.0.1`
+if [ ! -d "$GCCUSRPATH_X64" ]; then
+    echo "Couldn't find any GCC usr path for 64-bit x86"
     exit 1
 fi
 
-# Intel compiler flags
+# Intel 32-bit 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 \
 -nostdinc \
 -F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
--I$GCCUSRPATH/include \
+-I$GCCUSRPATH_X86/include \
 -isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include"
 
-# Intel linker flags
-LFLAGS_X86="-Wl,-headerpad_max_install_names -arch i386 -mmacosx-version-min=10.4 \
--L$GCCUSRPATH \
+# Intel 32-bit linker flags
+LFLAGS_X86="-arch i386 -Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 \
+-F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
+-L$GCCUSRPATH_X86 \
 -Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk"
 
+# Intel 64-bit configure flags (10.5 runtime compatibility)
+# We dynamically load X11, so using the system X11 headers is fine.
+CONFIG_X64="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
+--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
+
+# Intel 64-bit compiler flags
+CC_X64="gcc-4.0 -arch x86_64"
+CXX_X64="g++-4.0 -arch x86_64"
+CFLAGS_X64="-mmacosx-version-min=10.5"
+CPPFLAGS_X64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
+-nostdinc \
+-F$SDK_PATH/MacOSX10.5.sdk/System/Library/Frameworks \
+-I$GCCUSRPATH_X64/include \
+-isystem $SDK_PATH/MacOSX10.5.sdk/usr/include"
+
+# Intel 64-bit linker flags
+LFLAGS_X64="-arch x86_64 -Wl,-headerpad_max_install_names -mmacosx-version-min=10.5 \
+-F$SDK_PATH/MacOSX10.5.sdk/System/Library/Frameworks \
+-L$GCCUSRPATH_X64/x86_64 \
+-Wl,-syslibroot,$SDK_PATH/MacOSX10.5.sdk"
+
 #
 # Find the configure script
 #
@@ -106,8 +80,8 @@
 #
 # Figure out which phase to build:
 # all,
-# configure, configure-ppc, configure-x86,
-# make, make-ppc, make-x86, merge
+# configure, configure-ppc, configure-ppc64, configure-x86, configure-x64
+# make, make-ppc, make-ppc64, make-x86, make-x64, merge
 # install
 # clean
 if test x"$1" = x; then
@@ -118,32 +92,52 @@
 case $phase in
     all)
         configure_ppc="yes"
+        configure_ppc64="yes"
         configure_x86="yes"
+        configure_x64="yes"
         make_ppc="yes"
+        make_ppc64="yes"
         make_x86="yes"
+        make_x64="yes"
         merge="yes"
         ;;
     configure)
         configure_ppc="yes"
+        configure_ppc64="yes"
         configure_x86="yes"
+        configure_x64="yes"
         ;;
     configure-ppc)
         configure_ppc="yes"
         ;;
+    configure-ppc64)
+        configure_ppc64="yes"
+        ;;
     configure-x86)
         configure_x86="yes"
         ;;
+    configure-x64)
+        configure_x64="yes"
+        ;;
     make)
         make_ppc="yes"
+        make_ppc64="yes"
         make_x86="yes"
+        make_x64="yes"
         merge="yes"
         ;;
     make-ppc)
         make_ppc="yes"
         ;;
+    make-ppc64)
+        make_ppc64="yes"
+        ;;
     make-x86)
         make_x86="yes"
         ;;
+    make-x64)
+        make_x64="yes"
+        ;;
     merge)
         merge="yes"
         ;;
@@ -171,16 +165,24 @@
         ;;
     clean)
         clean_ppc="yes"
+        clean_ppc64="yes"
         clean_x86="yes"
+        clean_x64="yes"
         ;;
     clean-ppc)
         clean_ppc="yes"
         ;;
+    clean-ppc64)
+        clean_ppc64="yes"
+        ;;
     clean-x86)
         clean_x86="yes"
         ;;
+    clean-x64)
+        clean_x64="yes"
+        ;;
     *)
-        echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]"
+        echo "Usage: $0 [all|configure[-ppc|-ppc64|-x86|-x64]|make[-ppc|-ppc64|-x86|-x64]|merge|install|clean[-ppc|-ppc64|-x86|-x64]]"
         exit 1
         ;;
 esac
@@ -188,9 +190,15 @@
     powerpc)
         native_path=ppc
         ;;
+    powerpc64)
+        native_path=ppc64
+        ;;
     *86)
         native_path=x86
         ;;
+    x86_64)
+        native_path=x64
+        ;;
     *)
         echo "Couldn't figure out native architecture path"
         exit 1
@@ -200,7 +208,7 @@
 #
 # Create the build directories
 #
-for dir in build build/ppc build/x86; do
+for dir in build build/ppc build/ppc64 build/x86 build/x64; do
     if test -d $dir; then
         :
     else
@@ -209,18 +217,7 @@
 done
 
 #
-# Build the PowerPC binary
-#
-if test x$configure_ppc = xyes; then
-    (cd build/ppc && \
-     sh ../../configure $CONFIG_PPC CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
-fi
-if test x$make_ppc = xyes; then
-    (cd build/ppc && ls include && make -j$NJOB) || exit 3
-fi
-
-#
-# Build the Intel binary
+# Build the Intel 32-bit binary
 #
 if test x$configure_x86 = xyes; then
     (cd build/x86 && \
@@ -231,15 +228,25 @@
 fi
 
 #
+# Build the Intel 32-bit binary
+#
+if test x$configure_x64 = xyes; then
+    (cd build/x64 && \
+     sh ../../configure $CONFIG_X64 CC="$CC_X64" CXX="$CXX_X64" CFLAGS="$CFLAGS $CFLAGS_X64" CPPFLAGS="$CPPFLAGS_X64" LDFLAGS="$LFLAGS_X64") || exit 2
+fi
+if test x$make_x64 = xyes; then
+    (cd build/x64 && make -j$NJOB) || exit 3
+fi
+
+#
 # Combine into fat binary
 #
 if test x$merge = xyes; then
     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 &&
+    target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
+    (lipo -create -o $output/$target `find . -mindepth 4 -maxdepth 4 -type f -name "*.dylib"` &&
      ln -sf $target $output/libSDL.dylib &&
      lipo -create -o $output/libSDL.a */build/.libs/libSDL.a &&
      cp $native_path/build/.libs/libSDL.la $output &&