comparison build-scripts/fatbuild.sh @ 1742:af4352da64d8

Fixed bug #206, fatbuild.sh works flawlessly on Intel Macs
author Sam Lantinga <slouken@libsdl.org>
date Fri, 28 Apr 2006 05:38:06 +0000
parents d67622addf51
children 70a4d819e95e
comparison
equal deleted inserted replaced
1741:d67622addf51 1742:af4352da64d8
1 #!/bin/sh 1 #!/bin/sh
2 # 2 #
3 # Build a fat binary on Mac OS X, thanks Ryan! 3 # Build a fat binary on Mac OS X, thanks Ryan!
4 4
5 # Number of CPUs (for make -j) 5 # Number of CPUs (for make -j)
6 #NCPU=1
7 NCPU=`sysctl -n hw.ncpu` 6 NCPU=`sysctl -n hw.ncpu`
8 7 NJOB=`expr $NCPU + 1`
9 # !!! FIXME: other CFLAGS? 8
10 # Generic, cross-platform CFLAGS you always want go here. 9 # Generic, cross-platform CFLAGS you always want go here.
11 CFLAGS="-O3 -g -pipe" 10 CFLAGS="-O3 -g -pipe"
12 11
13 # PowerPC compiler flags (10.2 runtime compatibility) 12 # PowerPC compiler flags (10.2 runtime compatibility)
14 CC_PPC="gcc-3.3 -arch ppc" 13 CC_PPC="gcc-3.3 -arch ppc"
15 CXX_PPC="g++-3.3 -arch ppc"
16 CFLAGS_PPC="" 14 CFLAGS_PPC=""
17 CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ 15 CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \
18 -nostdinc \ 16 -nostdinc \
19 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ 17 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
20 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ 18 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \
26 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ 24 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \
27 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" 25 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk"
28 26
29 # Intel compiler flags (10.4 runtime compatibility) 27 # Intel compiler flags (10.4 runtime compatibility)
30 CC_X86="gcc-4.0 -arch i386" 28 CC_X86="gcc-4.0 -arch i386"
31 CXX_X86="g++-4.0 -arch i386"
32 CFLAGS_X86="-mmacosx-version-min=10.4" 29 CFLAGS_X86="-mmacosx-version-min=10.4"
33 CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ 30 CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
34 -nostdinc -fvisibility=hidden \ 31 -nostdinc \
35 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \ 32 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \
36 -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \ 33 -I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1/include \
37 -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include" 34 -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include"
38 35
39 # Intel linker flags 36 # Intel linker flags
156 # 153 #
157 # Build the PowerPC binary 154 # Build the PowerPC binary
158 # 155 #
159 if test x$configure_ppc = xyes; then 156 if test x$configure_ppc = xyes; then
160 (cd build/ppc && \ 157 (cd build/ppc && \
161 sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CXX="$CXX_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2 158 sh ../../configure --build=`uname -p`-apple-darwin --host=powerpc-apple-darwin CC="$CC_PPC" CFLAGS="$CFLAGS $CFLAGS_PPC" CPPFLAGS="$CPPFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2
162 fi 159 fi
163 if test x$make_ppc = xyes; then 160 if test x$make_ppc = xyes; then
164 (cd build/ppc && make -j$NCPU) || exit 3 161 (cd build/ppc && ls include && make -j$NJOB) || exit 3
165 fi 162 fi
166 163
167 # 164 #
168 # Build the Intel binary 165 # Build the Intel binary
169 # 166 #
170 if test x$configure_x86 = xyes; then 167 if test x$configure_x86 = xyes; then
171 (cd build/x86 && \ 168 (cd build/x86 && \
172 sh ../../configure --build=`uname -p`-apple-darwin --host=i686-apple-darwin CC="$CC_X86" CXX="$CXX_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 169 sh ../../configure --build=`uname -p`-apple-darwin --host=i386-apple-darwin CC="$CC_X86" CFLAGS="$CFLAGS $CFLAGS_X86" CPPFLAGS="$CPPFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2
173 fi 170 fi
174 if test x$make_x86 = xyes; then 171 if test x$make_x86 = xyes; then
175 (cd build/x86 && make -j$NCPU) || exit 3 172 (cd build/x86 && make -j$NJOB) || exit 3
176 fi 173 fi
177 174
178 # 175 #
179 # Combine into fat binary 176 # Combine into fat binary
180 # 177 #