comparison build-scripts/fatbuild.sh @ 1657:5b0805ceb50f SDL-1.3

Merge trunk-1.3-2
author Sam Lantinga <slouken@libsdl.org>
date Fri, 28 Apr 2006 16:55:41 +0000
parents 9f59d4c5aaea
children 14717b52abc0
comparison
equal deleted inserted replaced
1656:96c2f89cc7e1 1657:5b0805ceb50f
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)
6 NCPU=`sysctl -n hw.ncpu`
7 NJOB=$NCPU
8 #NJOB=`expr $NCPU + 1`
9
10 # Generic, cross-platform CFLAGS you always want go here.
11 CFLAGS="-O3 -g -pipe"
12
5 # PowerPC compiler flags (10.2 runtime compatibility) 13 # PowerPC compiler flags (10.2 runtime compatibility)
6 CC_PPC="gcc-3.3" 14 CC_PPC="gcc-3.3 -arch ppc"
7 CFLAGS_PPC="-arch ppc" 15 CXX_PPC="g++-3.3 -arch 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 \
12 -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include" 21 -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include"
16 -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \ 25 -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/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" 30 CC_X86="gcc-4.0 -arch i386"
22 CFLAGS_X86="-arch i386 -mmacosx-version-min=10.4" 31 CXX_X86="g++-4.0 -arch i386"
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 \
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"
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 && ls include && make -j$NJOB) || 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=i386-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$NJOB) || 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