Mercurial > sdl-ios-xcode
comparison build-scripts/fatbuild.sh @ 1741:d67622addf51
fatbuild fixes:
- A change to define CXX in fatbuild, which comforts the configure script a little, even if we don't use C++ anywhere.
- Some code to see how many CPU cores exist and parallelize make across them.
- CFLAGS that apply to both archs are specified seperately (-O3, -pipe, etc)
- -fvisibility=hidden for the gcc4 builds
- a "clean", "clean-ppc" and "clean-x86" command
- Fix to SDL_config_macosx.h for the HAVE_ALLOCA_H thing.
Now builds on an Intel Mac.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 27 Apr 2006 11:18:03 +0000 |
parents | 3a3e847aadb9 |
children | af4352da64d8 |
comparison
equal
deleted
inserted
replaced
1740:db7e15a99cb3 | 1741:d67622addf51 |
---|---|
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 | |
5 # Number of CPUs (for make -j) | |
6 #NCPU=1 | |
7 NCPU=`sysctl -n hw.ncpu` | |
8 | |
9 # !!! FIXME: other CFLAGS? | |
10 # Generic, cross-platform CFLAGS you always want go here. | |
11 CFLAGS="-O3 -g -pipe" | |
4 | 12 |
5 # PowerPC compiler flags (10.2 runtime compatibility) | 13 # PowerPC compiler flags (10.2 runtime compatibility) |
6 CC_PPC="gcc-3.3 -arch ppc" | 14 CC_PPC="gcc-3.3 -arch ppc" |
15 CXX_PPC="g++-3.3 -arch ppc" | |
7 CFLAGS_PPC="" | 16 CFLAGS_PPC="" |
8 CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ | 17 CPPFLAGS_PPC="-DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ |
9 -nostdinc \ | 18 -nostdinc \ |
10 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ | 19 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ |
11 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ | 20 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ |
17 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ | 26 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ |
18 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" | 27 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" |
19 | 28 |
20 # Intel compiler flags (10.4 runtime compatibility) | 29 # Intel compiler flags (10.4 runtime compatibility) |
21 CC_X86="gcc-4.0 -arch i386" | 30 CC_X86="gcc-4.0 -arch i386" |
31 CXX_X86="g++-4.0 -arch i386" | |
22 CFLAGS_X86="-mmacosx-version-min=10.4" | 32 CFLAGS_X86="-mmacosx-version-min=10.4" |
23 CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ | 33 CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \ |
24 -nostdinc \ | 34 -nostdinc -fvisibility=hidden \ |
25 -F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks \ | 35 -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 \ | 36 -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" | 37 -isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include" |
28 | 38 |
29 # Intel linker flags | 39 # Intel linker flags |
42 # Figure out which phase to build: | 52 # Figure out which phase to build: |
43 # all, | 53 # all, |
44 # configure, configure-ppc, configure-x86, | 54 # configure, configure-ppc, configure-x86, |
45 # make, make-ppc, make-x86, merge | 55 # make, make-ppc, make-x86, merge |
46 # install | 56 # install |
57 # clean | |
47 if test x"$1" = x; then | 58 if test x"$1" = x; then |
48 phase=all | 59 phase=all |
49 else | 60 else |
50 phase="$1" | 61 phase="$1" |
51 fi | 62 fi |
101 install_data="yes" | 112 install_data="yes" |
102 ;; | 113 ;; |
103 install-man) | 114 install-man) |
104 install_man="yes" | 115 install_man="yes" |
105 ;; | 116 ;; |
117 clean) | |
118 clean_ppc="yes" | |
119 clean_x86="yes" | |
120 ;; | |
121 clean-ppc) | |
122 clean_ppc="yes" | |
123 ;; | |
124 clean-x86) | |
125 clean_x86="yes" | |
126 ;; | |
106 *) | 127 *) |
107 echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge]" | 128 echo "Usage: $0 [all|configure[-ppc|-x86]|make[-ppc|-x86]|merge|install|clean]" |
108 exit 1 | 129 exit 1 |
109 ;; | 130 ;; |
110 esac | 131 esac |
111 case `uname -p` in | 132 case `uname -p` in |
112 powerpc) | 133 powerpc) |
135 # | 156 # |
136 # Build the PowerPC binary | 157 # Build the PowerPC binary |
137 # | 158 # |
138 if test x$configure_ppc = xyes; then | 159 if test x$configure_ppc = xyes; then |
139 (cd build/ppc && \ | 160 (cd build/ppc && \ |
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 | 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 |
141 fi | 162 fi |
142 if test x$make_ppc = xyes; then | 163 if test x$make_ppc = xyes; then |
143 (cd build/ppc && make) || exit 3 | 164 (cd build/ppc && make -j$NCPU) || exit 3 |
144 fi | 165 fi |
145 | 166 |
146 # | 167 # |
147 # Build the Intel binary | 168 # Build the Intel binary |
148 # | 169 # |
149 if test x$configure_x86 = xyes; then | 170 if test x$configure_x86 = xyes; then |
150 (cd build/x86 && \ | 171 (cd build/x86 && \ |
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 | 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 |
152 fi | 173 fi |
153 if test x$make_x86 = xyes; then | 174 if test x$make_x86 = xyes; then |
154 (cd build/x86 && make) || exit 3 | 175 (cd build/x86 && make -j$NCPU) || exit 3 |
155 fi | 176 fi |
156 | 177 |
157 # | 178 # |
158 # Combine into fat binary | 179 # Combine into fat binary |
159 # | 180 # |
231 for src in $srcdir/docs/man3/*.3; do \ | 252 for src in $srcdir/docs/man3/*.3; do \ |
232 file=`echo $src | sed -e 's|^.*/||'`; \ | 253 file=`echo $src | sed -e 's|^.*/||'`; \ |
233 do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \ | 254 do_install /usr/bin/install -c -m 644 $src $mandir/man3/$file; \ |
234 done | 255 done |
235 fi | 256 fi |
257 | |
258 # | |
259 # Clean up | |
260 # | |
261 do_clean() | |
262 { | |
263 echo $* | |
264 $* || exit 6 | |
265 } | |
266 if test x$clean_x86 = xyes; then | |
267 do_clean rm -r build/x86 | |
268 fi | |
269 if test x$clean_ppc = xyes; then | |
270 do_clean rm -r build/ppc | |
271 fi | |
272 |