Mercurial > sdl-ios-xcode
comparison build-scripts/fatbuild.sh @ 1636:3d0dec74ad01
A script to build a fat version of the SDL library... completely untested!
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 14 Apr 2006 05:43:04 +0000 |
parents | |
children | 0f466fb614a9 |
comparison
equal
deleted
inserted
replaced
1635:92947e3a18db | 1636:3d0dec74ad01 |
---|---|
1 #!/bin/sh | |
2 # | |
3 # Build a fat binary on Mac OS X, thanks Ryan! | |
4 | |
5 # PowerPC compiler flags (10.2 runtime compatibility) | |
6 CFLAGS_PPC=-DBUILD_PPC | |
7 xCFLAGS_PPC="-arch ppc \ | |
8 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ | |
9 -I/Developer/SDKs/MacOSX10.2.8.sdk/Developer/Headers/FlatCarbon \ | |
10 -DMAC_OS_X_VERSION_MIN_REQUIRED=1020 \ | |
11 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3 \ | |
12 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++ \ | |
13 -I/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin \ | |
14 -isystem /Developer/SDKs/MacOSX10.2.8.sdk/usr/include" | |
15 | |
16 # PowerPC linker flags | |
17 xLFLAGS_PPC="-arch ppc -mmacosx-version-min=10.2 \ | |
18 -L/Developer/SDKs/MacOSX10.2.8.sdk/usr/lib/gcc/darwin/3.3 \ | |
19 -F/Developer/SDKs/MacOSX10.2.8.sdk/System/Library/Frameworks \ | |
20 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk" | |
21 | |
22 # Intel compiler flags (10.4 runtime compatibility) | |
23 CFLAGS_X86=-DBUILD_X86 | |
24 xCFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \ | |
25 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" | |
26 | |
27 # Intel linker flags | |
28 xLFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \ | |
29 -L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \ | |
30 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" | |
31 | |
32 # | |
33 # Find the configure script | |
34 # | |
35 cd `dirname $0`/.. | |
36 | |
37 # | |
38 # Figure out which phase to build: | |
39 # all, | |
40 # configure, configure-ppc, configure-x86, | |
41 # make, make-ppc, make-x86, merge | |
42 # install | |
43 if test x"$1" = x; then | |
44 phase=all | |
45 else | |
46 phase="$1" | |
47 fi | |
48 case $phase in | |
49 all) | |
50 configure_ppc="yes" | |
51 configure_x86="yes" | |
52 make_ppc="yes" | |
53 make_x86="yes" | |
54 merge="yes" | |
55 ;; | |
56 configure) | |
57 configure_ppc="yes" | |
58 configure_x86="yes" | |
59 ;; | |
60 configure-ppc) | |
61 configure_ppc="yes" | |
62 ;; | |
63 configure-x86) | |
64 configure_x86="yes" | |
65 ;; | |
66 make) | |
67 make_ppc="yes" | |
68 make_x86="yes" | |
69 merge="yes" | |
70 ;; | |
71 make-ppc) | |
72 make_ppc="yes" | |
73 ;; | |
74 make-x86) | |
75 make_x86="yes" | |
76 ;; | |
77 merge) | |
78 merge="yes" | |
79 ;; | |
80 install) | |
81 make_x86="yes" | |
82 ;; | |
83 esac | |
84 | |
85 # | |
86 # Create the build directories | |
87 # | |
88 for dir in build build/ppc build/x86; do | |
89 if test -d $dir; then | |
90 : | |
91 else | |
92 mkdir $dir || exit 1 | |
93 fi | |
94 done | |
95 | |
96 # | |
97 # Build the PowerPC binary | |
98 # | |
99 if test x$configure_ppc = xyes; then | |
100 (cd build/ppc && \ | |
101 sh ../../configure CFLAGS="$CFLAGS_PPC" LDFLAGS="$LFLAGS_PPC") || exit 2 | |
102 fi | |
103 if test x$make_ppc = xyes; then | |
104 (cd build/ppc && make) || exit 3 | |
105 fi | |
106 | |
107 # | |
108 # Build the Intel binary | |
109 # | |
110 if test x$configure_x86 = xyes; then | |
111 (cd build/x86 && \ | |
112 sh ../../configure CFLAGS="$CFLAGS_X86" LDFLAGS="$LFLAGS_X86") || exit 2 | |
113 fi | |
114 if test x$make_x86 = xyes; then | |
115 (cd build/x86 && make) || exit 3 | |
116 fi | |
117 | |
118 # | |
119 # Combine into fat binary | |
120 # | |
121 target=`echo build/x86/build/.libs/*.dylib | sed 's|.*/||'` | |
122 if test x$merge = xyes; then | |
123 (cd build && \ | |
124 lipo -create -o $target */build/.libs/*.dylib && | |
125 lipo -create -o SDLMain.o */build/SDLMain.o && | |
126 ar cru libSDLmain.a SDLMain.o && ranlib libSDLmain.a && | |
127 echo "Build complete!" && | |
128 echo "Files can be found in the build directory.") || exit 4 | |
129 fi | |
130 | |
131 # | |
132 # Install | |
133 # | |
134 if test x$install = xyes; then | |
135 echo "Install not implemented" | |
136 exit 1 | |
137 fi |