Xcode 2.1 cleanup, universal binary experiments
[TestXSLT.git] / libs / compile_libs_universal.sh
1 #!/bin/sh
2
3 echo executing $0
4 echo ACTION is $ACTION
5
6 SDKFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
7
8 LIBS_TAR_DIR="`pwd`/libs"
9 LIBS_DEST_DIR="$BUILD_DIR/libs"
10 LIBS_INST_DIR="$LIBS_DEST_DIR/inst"
11 LIBS_SRC_DIR="$LIBS_DEST_DIR/src"
12
13 TAR_LIBXML2="$LIBS_TAR_DIR/libxml2-2.6.17.tar.gz"
14 TAR_LIBXSLT="$LIBS_TAR_DIR/libxslt-1.1.12.tar.gz"
15 TAR_EXPAT="$LIBS_TAR_DIR/expat-2005-01-28.tar.gz"
16 TAR_SABLOT="$LIBS_TAR_DIR/Sablot-1.0.2.tar.gz"
17
18 echo $LIBS_TAR_DIR / $LIBS_DEST_DIR / $LIBS_INST_DIR / $LIBS_BUILD_DIR
19
20 [ -e "$LIBS_TAR_DIR" ]  || exit 1
21 [ -e "$LIBS_DEST_DIR" ] || mkdir -p "$LIBS_DEST_DIR"  || exit 1
22 [ -e "$LIBS_INST_DIR" ] || mkdir -p "$LIBS_INST_DIR"  || exit 1
23 [ -e "$LIBS_SRC_DIR" ]  || mkdir -p "$LIBS_SRC_DIR"   || exit 1
24
25
26
27
28 #### setup libxml2
29 LIB="$LIBS_DEST_DIR/libxml2.dylib"
30 if [ ! -e "$LIB" ]; then
31
32         for arch in i386 ppc; do
33
34                 echo building "$LIB-$arch"
35
36                 cd "$LIBS_SRC_DIR"
37                 tar -xzf "$TAR_LIBXML2"
38                 cd libxml2-*
39                 make distclean
40                 CC="gcc $SDKFLAGS --host=$arch -arch $arch" ./configure --without-python --prefix="$LIBS_INST_DIR-$arch"
41                 make install
42
43         done
44
45         lipo -create "$LIBS_INST_DIR-ppc/lib/libxml2.dylib" "$LIBS_INST_DIR-i386/lib/libxml2.dylib" -output "$LIB"
46         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
47
48         #cp "$LIBS_INST_DIR/lib/libxml2.dylib" "$LIB"
49
50 fi
51
52
53
54 #### setup libxslt
55 LIB="$LIBS_DEST_DIR/libxslt.dylib"
56 if [ ! -e "$LIB" ]; then
57
58         for arch in i386 ppc; do
59         
60                 echo building "$LIB-$arch"
61
62                 cd "$LIBS_SRC_DIR"
63                 tar -xzf "$TAR_LIBXSLT"
64                 cd libxslt-*
65                 make distclean
66                 CC="gcc $SDKFLAGS -arch $arch" ./configure --prefix="$LIBS_INST_DIR-$arch" --with-libxml-prefix="$LIBS_INST_DIR-$arch"
67                 make install
68
69         done
70
71         lipo -create "$LIBS_INST_DIR-ppc/lib/libxslt.dylib" "$LIBS_INST_DIR-i386/lib/libxslt.dylib" -output "$LIB"
72         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
73
74         lipo -create "$LIBS_INST_DIR-ppc/lib/libexslt.dylib" "$LIBS_INST_DIR-i386/lib/libexslt.dylib" -output "$LIBS_DEST_DIR/libexslt.dylib"
75         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIBS_DEST_DIR/libexslt.dylib" "$BUILD_DIR"
76
77
78
79 fi
80
81
82 #### setup libexpat
83 LIB="$LIBS_DEST_DIR/libexpat.dylib"
84 if [ ! -e "$LIB" ]; then
85
86         for arch in i386 ppc; do
87         
88                 echo building "$LIB-$arch"
89
90                 cd "$LIBS_SRC_DIR"
91                 tar -xzf "$TAR_EXPAT"
92                 cd expat-*
93                 make distclean
94                 CC="gcc $SDKFLAGS -arch $arch" ./configure --prefix="$LIBS_INST_DIR-$arch"
95                 INSTALL_ROOT="/" make -e install
96
97         done
98         
99         #cp "$LIBS_INST_DIR/lib/libexpat.dylib" "$LIB"
100         lipo -create "$LIBS_INST_DIR-ppc/lib/libexpat.dylib" "$LIBS_INST_DIR-i386/lib/libexpat.dylib" -output "$LIB"
101         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
102         
103 fi
104
105
106 #### setup libSablot
107 LIB="$LIBS_DEST_DIR/libSablot.dylib"
108 if [ ! -e "$LIB" ]; then
109
110         for arch in i386 ppc; do
111         
112                 echo building "$LIB-$arch"
113
114                 cd "$LIBS_SRC_DIR"
115                 tar -xzf "$TAR_SABLOT"
116                 cd Sablot-*
117                 make distclean
118
119                 CXX="g++ $SDKFLAGS -arch $arch" ./configure --disable-adding-meta --with-expat="$LIBS_INST_DIR-$arch" --prefix="$LIBS_INST_DIR-$arch"
120                 make install
121         done
122         
123         #cp "$LIBS_INST_DIR/lib/libSablot.dylib" "$LIB"
124         lipo -create "$LIBS_INST_DIR-ppc/lib/libSablot.dylib" "$LIBS_INST_DIR-i386/lib/libSablot.dylib" -output "$LIB"
125         perl "$LIBS_TAR_DIR/fix_install_paths.pl" "$LIB" "$BUILD_DIR"
126
127 fi
128
129
130 exit
131
132 SUBDIR=libxml2
133 GNUSTYLEPREFIX=$TARGET_BUILD_DIR/libxml2-gnustyle
134 ICONVPREFIX=$TARGET_BUILD_DIR/libiconv-gnustyle
135
136 # make sure things match our expectations
137 #
138 if [ ! -d $SUBDIR ]; then
139         echo no $SUBDIR dir in current dir `pwd`, cannot continue!
140         exit 1
141 fi
142
143
144 if [ x$ACTION = "xclean" ]; then
145
146         echo cleaning up...
147         rm -rf $GNUSTYLEPREFIX
148         cd $SUBDIR
149         make distclean
150
151 elif [ x$ACTION = "x" ]; then
152
153         echo building...
154
155         cd $SUBDIR
156
157         if [ ! -f Makefile ]; then
158
159                 echo no Makefile, running configure
160
161                 ./configure --prefix=$GNUSTYLEPREFIX --without-python --with-iconv=$ICONVPREFIX
162
163         fi
164
165         
166         if [ ! -d $GNUSTYLEPREFIX ]; then
167
168                 make install
169
170         fi
171
172
173 fi
174
175
176
177