Added 64-bit architectures to the fat build script
authorSam Lantinga <slouken@libsdl.org>
Sat, 05 Sep 2009 10:39:18 +0000
changeset 3248cde30895105d
parent 3247 2dcfb4e07a57
child 3249 2befcf0c5ce0
Added 64-bit architectures to the fat build script
build-scripts/fatbuild.sh
src/cpuinfo/SDL_cpuinfo.c
src/video/cocoa/SDL_cocoamodes.m
     1.1 --- a/build-scripts/fatbuild.sh	Sat Sep 05 09:55:25 2009 +0000
     1.2 +++ b/build-scripts/fatbuild.sh	Sat Sep 05 10:39:18 2009 +0000
     1.3 @@ -9,12 +9,12 @@
     1.4  # Generic, cross-platform CFLAGS you always want go here.
     1.5  CFLAGS="-O3 -g -pipe"
     1.6  
     1.7 -# PowerPC configure flags (10.4 runtime compatibility)
     1.8 +# PowerPC 32-bit configure flags (10.4 runtime compatibility)
     1.9  # We dynamically load X11, so using the system X11 headers is fine.
    1.10  CONFIG_PPC="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \
    1.11  --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.12  
    1.13 -# PowerPC compiler flags
    1.14 +# PowerPC 32-bit compiler flags
    1.15  CC_PPC="gcc-4.0 -arch ppc"
    1.16  CXX_PPC="g++-4.0 -arch ppc"
    1.17  CFLAGS_PPC=""
    1.18 @@ -24,18 +24,44 @@
    1.19  -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include \
    1.20  -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
    1.21  
    1.22 -# PowerPC linker flags
    1.23 -LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.3 \
    1.24 +# PowerPC 32-bit linker flags
    1.25 +LFLAGS_PPC="-arch ppc -mmacosx-version-min=10.4 \
    1.26  -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
    1.27  -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1 \
    1.28  -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
    1.29  
    1.30 -# Intel configure flags (10.4 runtime compatibility)
    1.31 +# PowerPC 64-bit configure flags (10.5 runtime compatibility)
    1.32 +# We dynamically load X11, so using the system X11 headers is fine.
    1.33 +CONFIG_PPC64="--build=`uname -p`-apple-darwin --host=powerpc-apple-darwin \
    1.34 +--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.35 +
    1.36 +# PowerPC 64-bit compiler flags
    1.37 +CC_PPC64="gcc-4.0 -arch ppc64"
    1.38 +CXX_PPC64="g++-4.0 -arch ppc64"
    1.39 +CFLAGS_PPC64=""
    1.40 +CPPFLAGS_PPC64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
    1.41 +-nostdinc \
    1.42 +-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
    1.43 +-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include \
    1.44 +-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include"
    1.45 +
    1.46 +# PowerPC 64-bit linker flags
    1.47 +LFLAGS_PPC64="-arch ppc64 -mmacosx-version-min=10.5 \
    1.48 +-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
    1.49 +-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/ppc64 \
    1.50 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
    1.51 +
    1.52 +# Intel 32-bit configure flags (10.4 runtime compatibility)
    1.53  # We dynamically load X11, so using the system X11 headers is fine.
    1.54  CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
    1.55  --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.56  
    1.57 -# Intel compiler flags
    1.58 +# Intel 32-bit configure flags (10.4 runtime compatibility)
    1.59 +# We dynamically load X11, so using the system X11 headers is fine.
    1.60 +CONFIG_X86="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
    1.61 +--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.62 +
    1.63 +# Intel 32-bit compiler flags
    1.64  CC_X86="gcc-4.0 -arch i386"
    1.65  CXX_X86="g++-4.0 -arch i386"
    1.66  CFLAGS_X86="-mmacosx-version-min=10.4"
    1.67 @@ -45,12 +71,33 @@
    1.68  -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include \
    1.69  -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
    1.70  
    1.71 -# Intel linker flags
    1.72 +# Intel 32-bit linker flags
    1.73  LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
    1.74  -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
    1.75  -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1 \
    1.76  -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
    1.77  
    1.78 +# Intel 64-bit configure flags (10.5 runtime compatibility)
    1.79 +# We dynamically load X11, so using the system X11 headers is fine.
    1.80 +CONFIG_X64="--build=`uname -p`-apple-darwin --host=i386-apple-darwin \
    1.81 +--x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib"
    1.82 +
    1.83 +# Intel 64-bit compiler flags
    1.84 +CC_X64="gcc-4.0 -arch x86_64"
    1.85 +CXX_X64="g++-4.0 -arch x86_64"
    1.86 +CFLAGS_X64="-mmacosx-version-min=10.5"
    1.87 +CPPFLAGS_X64="-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
    1.88 +-nostdinc \
    1.89 +-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
    1.90 +-I/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/include \
    1.91 +-isystem /Developer/SDKs/MacOSX10.5.sdk/usr/include"
    1.92 +
    1.93 +# Intel 64-bit linker flags
    1.94 +LFLAGS_X64="-arch x86_64 -mmacosx-version-min=10.5 \
    1.95 +-F/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks \
    1.96 +-L/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/x86_64 \
    1.97 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"
    1.98 +
    1.99  #
   1.100  # Find the configure script
   1.101  #
   1.102 @@ -61,8 +108,8 @@
   1.103  #
   1.104  # Figure out which phase to build:
   1.105  # all,
   1.106 -# configure, configure-ppc, configure-x86,
   1.107 -# make, make-ppc, make-x86, merge
   1.108 +# configure, configure-ppc, configure-ppc64, configure-x86, configure-x64
   1.109 +# make, make-ppc, make-ppc64, make-x86, make-x64, merge
   1.110  # install
   1.111  # clean
   1.112  if test x"$1" = x; then
   1.113 @@ -73,32 +120,52 @@
   1.114  case $phase in
   1.115      all)
   1.116          configure_ppc="yes"
   1.117 +        configure_ppc64="yes"
   1.118          configure_x86="yes"
   1.119 +        configure_x64="yes"
   1.120          make_ppc="yes"
   1.121 +        make_ppc64="yes"
   1.122          make_x86="yes"
   1.123 +        make_x64="yes"
   1.124          merge="yes"
   1.125          ;;
   1.126      configure)
   1.127          configure_ppc="yes"
   1.128 +        configure_ppc64="yes"
   1.129          configure_x86="yes"
   1.130 +        configure_x64="yes"
   1.131          ;;
   1.132      configure-ppc)
   1.133          configure_ppc="yes"
   1.134          ;;
   1.135 +    configure-ppc64)
   1.136 +        configure_ppc64="yes"
   1.137 +        ;;
   1.138      configure-x86)
   1.139          configure_x86="yes"
   1.140          ;;
   1.141 +    configure-x64)
   1.142 +        configure_x64="yes"
   1.143 +        ;;
   1.144      make)
   1.145          make_ppc="yes"
   1.146 +        make_ppc64="yes"
   1.147          make_x86="yes"
   1.148 +        make_x64="yes"
   1.149          merge="yes"
   1.150          ;;
   1.151      make-ppc)
   1.152          make_ppc="yes"
   1.153          ;;
   1.154 +    make-ppc64)
   1.155 +        make_ppc64="yes"
   1.156 +        ;;
   1.157      make-x86)
   1.158          make_x86="yes"
   1.159          ;;
   1.160 +    make-x64)
   1.161 +        make_x64="yes"
   1.162 +        ;;
   1.163      merge)
   1.164          merge="yes"
   1.165          ;;
   1.166 @@ -126,16 +193,24 @@
   1.167          ;;
   1.168      clean)
   1.169          clean_ppc="yes"
   1.170 +        clean_ppc64="yes"
   1.171          clean_x86="yes"
   1.172 +        clean_x64="yes"
   1.173          ;;
   1.174      clean-ppc)
   1.175          clean_ppc="yes"
   1.176          ;;
   1.177 +    clean-ppc64)
   1.178 +        clean_ppc64="yes"
   1.179 +        ;;
   1.180      clean-x86)
   1.181          clean_x86="yes"
   1.182          ;;
   1.183 +    clean-x64)
   1.184 +        clean_x64="yes"
   1.185 +        ;;
   1.186      *)
   1.187 -        echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]"
   1.188 +        echo "Usage: $0 [all|configure[-ppc|-ppc64|-x86|-x64]|make[-ppc|-ppc64|-x86|-x64]|merge|install|clean[-ppc|-ppc64|-x86|-x64]]"
   1.189          exit 1
   1.190          ;;
   1.191  esac
   1.192 @@ -155,7 +230,7 @@
   1.193  #
   1.194  # Create the build directories
   1.195  #
   1.196 -for dir in build build/ppc build/x86; do
   1.197 +for dir in build build/ppc build/ppc64 build/x86 build/x64; do
   1.198      if test -d $dir; then
   1.199          :
   1.200      else
   1.201 @@ -164,7 +239,7 @@
   1.202  done
   1.203  
   1.204  #
   1.205 -# Build the PowerPC binary
   1.206 +# Build the PowerPC 32-bit binary
   1.207  #
   1.208  if test x$configure_ppc = xyes; then
   1.209      (cd build/ppc && \
   1.210 @@ -175,7 +250,18 @@
   1.211  fi
   1.212  
   1.213  #
   1.214 -# Build the Intel binary
   1.215 +# Build the PowerPC 64-bit binary
   1.216 +#
   1.217 +if test x$configure_ppc64 = xyes; then
   1.218 +    (cd build/ppc64 && \
   1.219 +     sh ../../configure $CONFIG_PPC64 CC="$CC_PPC64" CXX="$CXX_PPC64" CFLAGS="$CFLAGS $CFLAGS_PPC64" CPPFLAGS="$CPPFLAGS_PPC64" LDFLAGS="$LFLAGS_PPC64") || exit 2
   1.220 +fi
   1.221 +if test x$make_ppc64 = xyes; then
   1.222 +    (cd build/ppc64 && ls include && make -j$NJOB) || exit 3
   1.223 +fi
   1.224 +
   1.225 +#
   1.226 +# Build the Intel 32-bit binary
   1.227  #
   1.228  if test x$configure_x86 = xyes; then
   1.229      (cd build/x86 && \
   1.230 @@ -186,6 +272,17 @@
   1.231  fi
   1.232  
   1.233  #
   1.234 +# Build the Intel 32-bit binary
   1.235 +#
   1.236 +if test x$configure_x64 = xyes; then
   1.237 +    (cd build/x64 && \
   1.238 +     sh ../../configure $CONFIG_X64 CC="$CC_X64" CXX="$CXX_X64" CFLAGS="$CFLAGS $CFLAGS_X64" CPPFLAGS="$CPPFLAGS_X64" LDFLAGS="$LFLAGS_X64") || exit 2
   1.239 +fi
   1.240 +if test x$make_x64 = xyes; then
   1.241 +    (cd build/x64 && make -j$NJOB) || exit 3
   1.242 +fi
   1.243 +
   1.244 +#
   1.245  # Combine into fat binary
   1.246  #
   1.247  if test x$merge = xyes; then
     2.1 --- a/src/cpuinfo/SDL_cpuinfo.c	Sat Sep 05 09:55:25 2009 +0000
     2.2 +++ b/src/cpuinfo/SDL_cpuinfo.c	Sat Sep 05 10:39:18 2009 +0000
     2.3 @@ -25,7 +25,7 @@
     2.4  
     2.5  #include "SDL_cpuinfo.h"
     2.6  
     2.7 -#if defined(__MACOSX__) && defined(__ppc__)
     2.8 +#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
     2.9  #include <sys/sysctl.h>         /* For AltiVec check */
    2.10  #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
    2.11  #include <signal.h>
    2.12 @@ -356,7 +356,7 @@
    2.13  CPU_haveAltiVec(void)
    2.14  {
    2.15      volatile int altivec = 0;
    2.16 -#if defined(__MACOSX__) && defined(__ppc__)
    2.17 +#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
    2.18      int selectors[2] = { CTL_HW, HW_VECTORUNIT };
    2.19      int hasVectorUnit = 0;
    2.20      size_t length = sizeof(hasVectorUnit);
     3.1 --- a/src/video/cocoa/SDL_cocoamodes.m	Sat Sep 05 09:55:25 2009 +0000
     3.2 +++ b/src/video/cocoa/SDL_cocoamodes.m	Sat Sep 05 10:39:18 2009 +0000
     3.3 @@ -23,7 +23,7 @@
     3.4  
     3.5  #include "SDL_cocoavideo.h"
     3.6  
     3.7 -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
     3.8 +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
     3.9  /* 
    3.10      Add methods to get at private members of NSScreen. 
    3.11      Since there is a bug in Apple's screen switching code
    3.12 @@ -250,7 +250,7 @@
    3.13          CGReleaseDisplayFadeReservation(fade_token);
    3.14      }
    3.15  
    3.16 -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
    3.17 +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
    3.18      /* 
    3.19          There is a bug in Cocoa where NSScreen doesn't synchronize
    3.20          with CGDirectDisplay, so the main screen's frame is wrong.