source: zzuf/trunk/build-osx @ 4357

Last change on this file since 4357 was 4319, checked in by Sam Hocevar, 11 years ago

Add an OS X build script that generates fat binaries.

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#! /bin/sh
2
3##  OS X fat binary compilation for zzuf -- Sam Hocevar <sam@hocevar.net>
4
5set -x
6set -e
7
8I386CC=i686-apple-darwin10-gcc-4.2.1
9
10if ! "${I386CC}" -v >/dev/null 2>&1; then
11  echo "${I386CC} not found, please fix build script"
12fi
13
14# Clean up our working directory
15SRCDIR="`pwd`"
16DIRNAME="zzuf-osx-`sed -ne 's/^AC_INIT(.*, \(.*\)).*/\1/p' configure.ac`"
17INSTALLDIR="`pwd`/${DIRNAME}"
18BUILDDIR="${INSTALLDIR}/build"
19rm -Rf "${INSTALLDIR}"
20rm -f "${INSTALLDIR}.zip"
21mkdir "${INSTALLDIR}"
22mkdir "${INSTALLDIR}/build"
23
24cd "${INSTALLDIR}/build"
25# Build for i386
26"${SRCDIR}/configure" --host=i686-apple-darwin10 CC="${I386CC}"
27(cd src; make libzzuf.la)
28cp src/.libs/libzzuf.dylib src/libzzuf-i386.dylib
29make distclean
30# Build for x86_64
31"${SRCDIR}/configure"
32make
33mv src/.libs/libzzuf.dylib src/libzzuf-x86_64.dylib
34# Create fat binary
35lipo src/libzzuf-i386.dylib src/libzzuf-x86_64.dylib -create -o src/.libs/libzzuf.dylib
36
37make install DESTDIR="${INSTALLDIR}" pkglibdir=/.libs/ pkgdatadir=/ bindir=/ man1dir=/doc man3dir=/doc
38rm -Rf "${INSTALLDIR}/build"
39
40# Pack the directory
41cd "${SRCDIR}"
42tar cvzf "${DIRNAME}.tar.gz" "${DIRNAME}"
43rm -Rf "${INSTALLDIR}"
44
Note: See TracBrowser for help on using the repository browser.