Updated fatbuild.sh to match 1.2 version.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 19 Sep 2011 01:49:29 -0400
changeset 59613bd7ed5f3895
parent 5959 d773f75cea1a
child 5962 17cadf0c466e
Updated fatbuild.sh to match 1.2 version.
build-scripts/fatbuild.sh
     1.1 --- a/build-scripts/fatbuild.sh	Sun Sep 18 13:01:33 2011 +0300
     1.2 +++ b/build-scripts/fatbuild.sh	Mon Sep 19 01:49:29 2011 -0400
     1.3 @@ -16,59 +16,27 @@
     1.4  # Generic, cross-platform CFLAGS you always want go here.
     1.5  CFLAGS="-O3 -g -pipe"
     1.6  
     1.7 -# Intel 32-bit configure flags (10.4 runtime compatibility)
     1.8  # We dynamically load X11, so using the system X11 headers is fine.
     1.9 -CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
    1.10 +BASE_CONFIG_FLAGS="--build=`uname -p`-apple-darwin \
    1.11  --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.12  
    1.13 -# They changed this from "darwin9" to "darwin10" in Xcode 3.2 (Snow Leopard).
    1.14 -GCCUSRPATH_X86=`ls -d $SDK_PATH/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin*/4.0.1`
    1.15 -if [ ! -d "$GCCUSRPATH_X86" ]; then
    1.16 -    echo "Couldn't find any GCC usr path for 32-bit x86"
    1.17 -    exit 1
    1.18 -fi
    1.19 -GCCUSRPATH_X64=`ls -d $SDK_PATH/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin*/4.0.1`
    1.20 -if [ ! -d "$GCCUSRPATH_X64" ]; then
    1.21 -    echo "Couldn't find any GCC usr path for 64-bit x86"
    1.22 -    exit 1
    1.23 -fi
    1.24 +# PowerPC 32-bit compiler flags
    1.25 +CONFIG_PPC="--host=powerpc-apple-darwin"
    1.26 +CC_PPC="gcc-4.0"
    1.27 +CXX_PPC="g++-4.0"
    1.28 +BUILD_FLAGS_PPC="-arch ppc -mmacosx-version-min=10.4"
    1.29  
    1.30  # Intel 32-bit compiler flags
    1.31 -CC_X86="gcc-4.0 -arch i386"
    1.32 -CXX_X86="g++-4.0 -arch i386"
    1.33 -CFLAGS_X86="-mmacosx-version-min=10.4"
    1.34 -CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
    1.35 --nostdinc \
    1.36 --F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
    1.37 --I$GCCUSRPATH_X86/include \
    1.38 --isystem $SDK_PATH/MacOSX10.4u.sdk/usr/include"
    1.39 -
    1.40 -# Intel 32-bit linker flags
    1.41 -LFLAGS_X86="-arch i386 -Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 \
    1.42 --F$SDK_PATH/MacOSX10.4u.sdk/System/Library/Frameworks \
    1.43 --L$GCCUSRPATH_X86 \
    1.44 --Wl,-syslibroot,$SDK_PATH/MacOSX10.4u.sdk"
    1.45 -
    1.46 -# Intel 64-bit configure flags (10.5 runtime compatibility)
    1.47 -# We dynamically load X11, so using the system X11 headers is fine.
    1.48 -CONFIG_X64="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
    1.49 ---x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.50 +CONFIG_X86="--host=i386-apple-darwin"
    1.51 +CC_X86="gcc"
    1.52 +CXX_X86="g++"
    1.53 +BUILD_FLAGS_X86="-arch i386 -mmacosx-version-min=10.4"
    1.54  
    1.55  # Intel 64-bit compiler flags
    1.56 -CC_X64="gcc-4.0 -arch x86_64"
    1.57 -CXX_X64="g++-4.0 -arch x86_64"
    1.58 -CFLAGS_X64="-mmacosx-version-min=10.5"
    1.59 -CPPFLAGS_X64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
    1.60 --nostdinc \
    1.61 --F$SDK_PATH/MacOSX10.5.sdk/System/Library/Frameworks \
    1.62 --I$GCCUSRPATH_X64/include \
    1.63 --isystem $SDK_PATH/MacOSX10.5.sdk/usr/include"
    1.64 -
    1.65 -# Intel 64-bit linker flags
    1.66 -LFLAGS_X64="-arch x86_64 -Wl,-headerpad_max_install_names -mmacosx-version-min=10.5 \
    1.67 --F$SDK_PATH/MacOSX10.5.sdk/System/Library/Frameworks \
    1.68 --L$GCCUSRPATH_X64/x86_64 \
    1.69 --Wl,-syslibroot,$SDK_PATH/MacOSX10.5.sdk"
    1.70 +CONFIG_X64="--host=x86_64-apple-darwin"
    1.71 +CC_X64="gcc"
    1.72 +CXX_X64="g++"
    1.73 +BUILD_FLAGS_X64="-arch x86_64 -mmacosx-version-min=10.6"
    1.74  
    1.75  #
    1.76  # Find the configure script
    1.77 @@ -77,11 +45,19 @@
    1.78  auxdir=$srcdir/build-scripts
    1.79  cd $srcdir
    1.80  
    1.81 +allow_ppc="yes"
    1.82 +which gcc-4.0 >/dev/null 2>/dev/null
    1.83 +if [ "x$?" = "x1" ]; then
    1.84 +    #echo "WARNING: Can't find gcc-4.0, which means you don't have Xcode 3."
    1.85 +    #echo "WARNING: Therefore, we can't do PowerPC support."
    1.86 +    allow_ppc="no"
    1.87 +fi
    1.88 +
    1.89  #
    1.90  # Figure out which phase to build:
    1.91  # all,
    1.92 -# configure, configure-x86, configure-x64
    1.93 -# make, make-x86, make-x64, merge
    1.94 +# configure, configure-ppc, configure-x86, configure-x64
    1.95 +# make, make-ppc, make-x86, make-x64, merge
    1.96  # install
    1.97  # clean
    1.98  if test x"$1" = x; then
    1.99 @@ -91,16 +67,22 @@
   1.100  fi
   1.101  case $phase in
   1.102      all)
   1.103 +        configure_ppc="$allow_ppc"
   1.104          configure_x86="yes"
   1.105          configure_x64="yes"
   1.106 +        make_ppc="$allow_ppc"
   1.107          make_x86="yes"
   1.108          make_x64="yes"
   1.109          merge="yes"
   1.110          ;;
   1.111      configure)
   1.112 +        configure_ppc="$allow_ppc"
   1.113          configure_x86="yes"
   1.114          configure_x64="yes"
   1.115          ;;
   1.116 +    configure-ppc)
   1.117 +        configure_ppc="$allow_ppc"
   1.118 +        ;;
   1.119      configure-x86)
   1.120          configure_x86="yes"
   1.121          ;;
   1.122 @@ -108,10 +90,14 @@
   1.123          configure_x64="yes"
   1.124          ;;
   1.125      make)
   1.126 +        make_ppc="$allow_ppc"
   1.127          make_x86="yes"
   1.128          make_x64="yes"
   1.129          merge="yes"
   1.130          ;;
   1.131 +    make-ppc)
   1.132 +        make_ppc="$allow_ppc"
   1.133 +        ;;
   1.134      make-x86)
   1.135          make_x86="yes"
   1.136          ;;
   1.137 @@ -144,9 +130,13 @@
   1.138          install_man="yes"
   1.139          ;;
   1.140      clean)
   1.141 +        clean_ppc="yes"
   1.142          clean_x86="yes"
   1.143          clean_x64="yes"
   1.144          ;;
   1.145 +    clean-ppc)
   1.146 +        clean_ppc="yes"
   1.147 +        ;;
   1.148      clean-x86)
   1.149          clean_x86="yes"
   1.150          ;;
   1.151 @@ -154,7 +144,7 @@
   1.152          clean_x64="yes"
   1.153          ;;
   1.154      *)
   1.155 -        echo "Usage: $0 [all|configure[-x86|-x64]|make[-x86|-x64]|merge|install|clean[-x86|-x64]]"
   1.156 +        echo "Usage: $0 [all|configure[-ppc|-x86|-x64]|make[-ppc|-x86|-x64]|merge|install|clean[-ppc|-x86|-x64]]"
   1.157          exit 1
   1.158          ;;
   1.159  esac
   1.160 @@ -162,6 +152,9 @@
   1.161      *86)
   1.162          native_path=x86
   1.163          ;;
   1.164 +    *powerpc)
   1.165 +        native_path=ppc
   1.166 +        ;;
   1.167      x86_64)
   1.168          native_path=x64
   1.169          ;;
   1.170 @@ -174,7 +167,7 @@
   1.171  #
   1.172  # Create the build directories
   1.173  #
   1.174 -for dir in build build/x86 build/x64; do
   1.175 +for dir in build build/ppc build/x86 build/x64; do
   1.176      if test -d $dir; then
   1.177          :
   1.178      else
   1.179 @@ -182,23 +175,34 @@
   1.180      fi
   1.181  done
   1.182  
   1.183 +
   1.184 +#
   1.185 +# Build the PowerPC 32-bit binary
   1.186 +#
   1.187 +if test x$configure_ppc = xyes; then
   1.188 +    (cd build/ppc && \
   1.189 +     sh ../../configure $BASE_CONFIG_FLAGS $CONFIG_PPC CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $BUILD_FLAGS_PPC $CFLAGS_PPC" LDFLAGS="$BUILD_FLAGS_PPC $LFLAGS_PPC") || exit 2
   1.190 +fi
   1.191 +if test x$make_ppc = xyes; then
   1.192 +    (cd build/ppc && make -j$NJOB) || exit 3
   1.193 +fi
   1.194  #
   1.195  # Build the Intel 32-bit binary
   1.196  #
   1.197  if test x$configure_x86 = xyes; then
   1.198      (cd build/x86 && \
   1.199 -     sh ../../configure $CONFIG_X86 CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
   1.200 +     sh ../../configure $BASE_CONFIG_FLAGS $CONFIG_X86 CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $BUILD_FLAGS_X86 $CFLAGS_X86" LDFLAGS="$BUILD_FLAGS_X86 $LFLAGS_X86") || exit 2
   1.201  fi
   1.202  if test x$make_x86 = xyes; then
   1.203      (cd build/x86 && make -j$NJOB) || exit 3
   1.204  fi
   1.205  
   1.206  #
   1.207 -# Build the Intel 32-bit binary
   1.208 +# Build the Intel 64-bit binary
   1.209  #
   1.210  if test x$configure_x64 = xyes; then
   1.211      (cd build/x64 && \
   1.212 -     sh ../../configure $CONFIG_X64 CC="$CC_X64" CXX="$CXX_X64" CFLAGS="$CFLAGS $CFLAGS_X64" CPPFLAGS="$CPPFLAGS_X64" LDFLAGS="$LFLAGS_X64") || exit 2
   1.213 +     sh ../../configure $BASE_CONFIG_FLAGS $CONFIG_X64 CC="$CC_X64" CXX="$CXX_X64" CFLAGS="$CFLAGS $BUILD_FLAGS_X64 $CFLAGS_X64" LDFLAGS="$BUILD_FLAGS_X64 $LFLAGS_X64") || exit 2
   1.214  fi
   1.215  if test x$make_x64 = xyes; then
   1.216      (cd build/x64 && make -j$NJOB) || exit 3
   1.217 @@ -291,6 +295,9 @@
   1.218      echo $*
   1.219      $* || exit 6
   1.220  }
   1.221 +if test x$clean_ppc = xyes; then
   1.222 +    do_clean rm -r build/ppc
   1.223 +fi
   1.224  if test x$clean_x86 = xyes; then
   1.225      do_clean rm -r build/x86
   1.226  fi