1#!/bin/sh
2
3rm -f	h2patch.ppc \
4	h2patch.x86 \
5	h2patch.x86_64 \
6	h2patch.bin
7make -f Makefile.darwin distclean
8
9OLDPATH=$PATH
10MAKE_CMD=make
11
12OSXBUILD=1
13export OSXBUILD
14
15# ppc
16PATH=/opt/cross_osx-ppc/bin:$OLDPATH
17CC=powerpc-apple-darwin9-gcc
18AS=powerpc-apple-darwin9-as
19AR=powerpc-apple-darwin9-ar
20RANLIB=powerpc-apple-darwin9-ranlib
21LIPO=powerpc-apple-darwin9-lipo
22export PATH CC AS AR RANLIB LIPO
23$MAKE_CMD -f Makefile.darwin MACH_TYPE=ppc $* || exit 1
24powerpc-apple-darwin9-strip -S h2patch || exit 1
25mv h2patch h2patch.ppc || exit 1
26$MAKE_CMD -f Makefile.darwin distclean
27
28# x86
29PATH=/opt/cross_osx-x86/bin:$OLDPATH
30CC=i686-apple-darwin9-gcc
31AS=i686-apple-darwin9-as
32AR=i686-apple-darwin9-ar
33RANLIB=i686-apple-darwin9-ranlib
34LIPO=i686-apple-darwin9-lipo
35export PATH CC AS AR RANLIB LIPO
36$MAKE_CMD -f Makefile.darwin MACH_TYPE=x86 $* || exit 1
37i686-apple-darwin9-strip -S h2patch || exit 1
38mv h2patch h2patch.x86 || exit 1
39$MAKE_CMD -f Makefile.darwin distclean
40
41# x86_64
42PATH=/opt/cross_osx-x86_64/usr/bin:$OLDPATH
43CC=x86_64-apple-darwin9-gcc
44AS=x86_64-apple-darwin9-as
45AR=x86_64-apple-darwin9-ar
46RANLIB=x86_64-apple-darwin9-ranlib
47LIPO=x86_64-apple-darwin9-lipo
48export PATH CC AS AR RANLIB LIPO
49$MAKE_CMD -f Makefile.darwin MACH_TYPE=x86_64 $* || exit 1
50x86_64-apple-darwin9-strip -S h2patch || exit 1
51mv h2patch h2patch.x86_64 || exit 1
52$MAKE_CMD -f Makefile.darwin distclean
53
54$LIPO -create -o h2patch.bin h2patch.ppc h2patch.x86 h2patch.x86_64 || exit 1
55