3 # Build a fat binary on Mac OS X, thanks Ryan!
5 # PowerPC compiler flags (10.2 runtime compatibility)
8 CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
10 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
11 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
12 -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
14 # PowerPC linker flags
15 LFLAGS_PPC="-arch ppc \
16 -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \
17 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
18 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
20 # Intel compiler flags (10.4 runtime compatibility)
22 CFLAGS_X86="-arch i386 -mmacosx-version-min=10.4"
23 CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
25 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
26 -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
27 -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
30 LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
31 -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \
32 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
35 # Find the configure script
37 srcdir=`dirname $0`/..
38 auxdir=$srcdir/build-scripts
42 # Figure out which phase to build:
44 # configure, configure-ppc, configure-x86,
45 # make, make-ppc, make-x86, merge
47 if test x"$1" = x; then
107 echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge]"
119 echo "Couldn't figure out native architecture path"
125 # Create the build directories
127 for dir in build build/ppc build/x86; do
128 if test -d $dir; then
136 # Build the PowerPC binary
138 if test x$configure_ppc = xyes; then
140 sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CFLAGS="$CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
142 if test x$make_ppc = xyes; then
143 (cd build/ppc && make) || exit 3
147 # Build the Intel binary
149 if test x$configure_x86 = xyes; then
151 sh ../../configure --build=`uname -p`-apple-darwin --host=i686-apple-darwin CC="$CC_X86" CFLAGS="$CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
153 if test x$make_x86 = xyes; then
154 (cd build/x86 && make) || exit 3
158 # Combine into fat binary
160 if test x$merge = xyes; then
162 sh $auxdir/mkinstalldirs build/$output
164 target=`find . -mindepth 3 -type f -name '*.dylib' | head -1 | sed 's|.*/||'`
165 (lipo -create -o $output/$target `find . -mindepth 3 -type f -name "*.dylib"` &&
166 ln -sf $target $output/libSDL-1.2.0.dylib &&
167 ln -sf $target $output/libSDL.dylib &&
168 lipo -create -o $output/libSDL.a */build/.libs/libSDL.a &&
169 cp $native_path/build/.libs/libSDL.la $output &&
170 cp $native_path/build/.libs/libSDL.lai $output &&
171 cp $native_path/build/libSDL.la . &&
172 lipo -create -o libSDLmain.a */build/libSDLmain.a &&
173 echo "Build complete!" &&
174 echo "Files can be found in the build directory.") || exit 4
186 if test x$prefix = x; then
189 if test x$exec_prefix = x; then
192 if test x$bindir = x; then
193 bindir=$exec_prefix/bin
195 if test x$libdir = x; then
196 libdir=$exec_prefix/lib
198 if test x$includedir = x; then
199 includedir=$prefix/include
201 if test x$datadir = x; then
202 datadir=$prefix/share
204 if test x$mandir = x; then
207 if test x$install_bin = xyes; then
208 do_install sh $auxdir/mkinstalldirs $bindir
209 do_install /usr/bin/install -c -m 755 build/$native_path/sdl-config $bindir/sdl-config
211 if test x$install_hdrs = xyes; then
212 do_install sh $auxdir/mkinstalldirs $includedir/SDL
213 for src in $srcdir/include/*.h; do \
214 file=`echo $src | sed -e 's|^.*/||'`; \
215 do_install /usr/bin/install -c -m 644 $src $includedir/SDL/$file; \
217 do_install /usr/bin/install -c -m 644 $srcdir/include/SDL_config_macosx.h $includedir/SDL/SDL_config.h
219 if test x$install_lib = xyes; then
220 do_install sh $auxdir/mkinstalldirs $libdir
221 do_install sh build/$native_path/libtool --mode=install /usr/bin/install -c build/libSDL.la $libdir/libSDL.la
222 do_install /usr/bin/install -c -m 644 build/libSDLmain.a $libdir/libSDLmain.a
223 do_install ranlib $libdir/libSDLmain.a
225 if test x$install_data = xyes; then
226 do_install sh $auxdir/mkinstalldirs $datadir/aclocal
227 do_install /usr/bin/install -c -m 644 $srcdir/sdl.m4 $datadir/aclocal/sdl.m4
229 if test x$install_man = xyes; then
230 do_install sh $auxdir/mkinstalldirs $mandir/man3
231 for src in $srcdir/docs/man3/*.3; do \
232 file=`echo $src | sed -e 's|^.*/||'`; \
233 do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \