A script to build a fat version of the SDL library... completely untested!
authorSam Lantinga <slouken@libsdl.org>
Fri, 14 Apr 2006 05:43:04 +0000
changeset 16363d0dec74ad01
parent 1635 92947e3a18db
child 1637 9ba366b919c7
A script to build a fat version of the SDL library... completely untested!
build-scripts/fatbuild.sh
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build-scripts/fatbuild.sh	Fri Apr 14 05:43:04 2006 +0000
     1.3 @@ -0,0 +1,137 @@
     1.4 +#!/bin/sh
     1.5 +#
     1.6 +# Build a fat binary on Mac OS X, thanks Ryan!
     1.7 +
     1.8 +# PowerPC compiler flags (10.2 runtime compatibility)
     1.9 +CFLAGS_PPC=-DBUILD_PPC
    1.10 +xCFLAGS_PPC="-arch ppc \
    1.11 +-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
    1.12 +-I/Developer/SDKs/MacOSX10.2.8.sdk/Developer/Headers/FlatCarbon \
    1.13 +-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
    1.14 +-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
    1.15 +-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++ \
    1.16 +-I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin \
    1.17 +-isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
    1.18 +
    1.19 +# PowerPC linker flags 
    1.20 +xLFLAGS_PPC="-arch ppc -mmacosx-version-min=10.2 \
    1.21 +-L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
    1.22 +-F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
    1.23 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
    1.24 +
    1.25 +# Intel compiler flags (10.4 runtime compatibility)
    1.26 +CFLAGS_X86=-DBUILD_X86
    1.27 +xCFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
    1.28 +-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
    1.29 +
    1.30 +# Intel linker flags
    1.31 +xLFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
    1.32 +-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \
    1.33 +-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
    1.34 +
    1.35 +#
    1.36 +# Find the configure script
    1.37 +#
    1.38 +cd `dirname $0`/..
    1.39 +
    1.40 +#
    1.41 +# Figure out which phase to build:
    1.42 +# all,
    1.43 +# configure, configure-ppc, configure-x86,
    1.44 +# make, make-ppc, make-x86, merge
    1.45 +# install
    1.46 +if test x"$1" = x; then
    1.47 +    phase=all
    1.48 +else
    1.49 +    phase="$1"
    1.50 +fi
    1.51 +case $phase in
    1.52 +    all)
    1.53 +        configure_ppc="yes"
    1.54 +        configure_x86="yes"
    1.55 +        make_ppc="yes"
    1.56 +        make_x86="yes"
    1.57 +        merge="yes"
    1.58 +        ;;
    1.59 +    configure)
    1.60 +        configure_ppc="yes"
    1.61 +        configure_x86="yes"
    1.62 +        ;;
    1.63 +    configure-ppc)
    1.64 +        configure_ppc="yes"
    1.65 +        ;;
    1.66 +    configure-x86)
    1.67 +        configure_x86="yes"
    1.68 +        ;;
    1.69 +    make)
    1.70 +        make_ppc="yes"
    1.71 +        make_x86="yes"
    1.72 +        merge="yes"
    1.73 +        ;;
    1.74 +    make-ppc)
    1.75 +        make_ppc="yes"
    1.76 +        ;;
    1.77 +    make-x86)
    1.78 +        make_x86="yes"
    1.79 +        ;;
    1.80 +    merge)
    1.81 +        merge="yes"
    1.82 +        ;;
    1.83 +    install)
    1.84 +        make_x86="yes"
    1.85 +        ;;
    1.86 +esac
    1.87 +
    1.88 +#
    1.89 +# Create the build directories
    1.90 +#
    1.91 +for dir in build build/ppc build/x86; do
    1.92 +    if test -d $dir; then
    1.93 +        :
    1.94 +    else
    1.95 +        mkdir $dir || exit 1
    1.96 +    fi
    1.97 +done
    1.98 +
    1.99 +#
   1.100 +# Build the PowerPC binary
   1.101 +#
   1.102 +if test x$configure_ppc = xyes; then
   1.103 +    (cd build/ppc && \
   1.104 +     sh ../../configure CFLAGS="$CFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
   1.105 +fi
   1.106 +if test x$make_ppc = xyes; then
   1.107 +    (cd build/ppc && make) || exit 3
   1.108 +fi
   1.109 +
   1.110 +#
   1.111 +# Build the Intel binary
   1.112 +#
   1.113 +if test x$configure_x86 = xyes; then
   1.114 +    (cd build/x86 && \
   1.115 +     sh ../../configure CFLAGS="$CFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
   1.116 +fi
   1.117 +if test x$make_x86 = xyes; then
   1.118 +    (cd build/x86 && make) || exit 3
   1.119 +fi
   1.120 +
   1.121 +#
   1.122 +# Combine into fat binary
   1.123 +#
   1.124 +target=`echo build/x86/build/.libs/*.dylib | sed 's|.*/||'`
   1.125 +if test x$merge = xyes; then
   1.126 +    (cd build && \
   1.127 +     lipo -create -o $target */build/.libs/*.dylib &&
   1.128 +     lipo -create -o SDLMain.o */build/SDLMain.o &&
   1.129 +     ar cru libSDLmain.a SDLMain.o && ranlib libSDLmain.a &&
   1.130 +     echo "Build complete!" &&
   1.131 +     echo "Files can be found in the build directory.") || exit 4
   1.132 +fi
   1.133 +
   1.134 +#
   1.135 +# Install
   1.136 +#
   1.137 +if test x$install = xyes; then
   1.138 +    echo "Install not implemented"
   1.139 +    exit 1
   1.140 +fi