From 8b515b6a58283d9f3429251044df43007705c88b Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 7 Feb 2010 14:21:35 +0000 Subject: [PATCH] Add an OS X build script that generates fat binaries. --- Makefile.am | 2 +- build-osx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100755 build-osx diff --git a/Makefile.am b/Makefile.am index 57ee74b..9cb329a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = src test doc DIST_SUBDIRS = $(SUBDIRS) -EXTRA_DIST = bootstrap AUTHORS \ +EXTRA_DIST = bootstrap build-osx build-win32 AUTHORS \ m4/cflags.m4 m4/func.m4 \ msvc/config.h \ msvc/libzzuf.vcproj msvc/libzzuf.vcxproj \ diff --git a/build-osx b/build-osx new file mode 100755 index 0000000..1ffbb23 --- /dev/null +++ b/build-osx @@ -0,0 +1,44 @@ +#! /bin/sh + +## OS X fat binary compilation for zzuf -- Sam Hocevar + +set -x +set -e + +I386CC=i686-apple-darwin10-gcc-4.2.1 + +if ! "${I386CC}" -v >/dev/null 2>&1; then + echo "${I386CC} not found, please fix build script" +fi + +# Clean up our working directory +SRCDIR="`pwd`" +DIRNAME="zzuf-osx-`sed -ne 's/^AC_INIT(.*, \(.*\)).*/\1/p' configure.ac`" +INSTALLDIR="`pwd`/${DIRNAME}" +BUILDDIR="${INSTALLDIR}/build" +rm -Rf "${INSTALLDIR}" +rm -f "${INSTALLDIR}.zip" +mkdir "${INSTALLDIR}" +mkdir "${INSTALLDIR}/build" + +cd "${INSTALLDIR}/build" +# Build for i386 +"${SRCDIR}/configure" --host=i686-apple-darwin10 CC="${I386CC}" +(cd src; make libzzuf.la) +cp src/.libs/libzzuf.dylib src/libzzuf-i386.dylib +make distclean +# Build for x86_64 +"${SRCDIR}/configure" +make +mv src/.libs/libzzuf.dylib src/libzzuf-x86_64.dylib +# Create fat binary +lipo src/libzzuf-i386.dylib src/libzzuf-x86_64.dylib -create -o src/.libs/libzzuf.dylib + +make install DESTDIR="${INSTALLDIR}" pkglibdir=/.libs/ pkgdatadir=/ bindir=/ man1dir=/doc man3dir=/doc +rm -Rf "${INSTALLDIR}/build" + +# Pack the directory +cd "${SRCDIR}" +tar cvzf "${DIRNAME}.tar.gz" "${DIRNAME}" +rm -Rf "${INSTALLDIR}" +