1#!/bin/sh
2#
3# Building OSX fat binaries is easy.
4#
5# - start in a clean directory.
6# - copy the shell script below to a file and edit the file to your needs.
7#
8# 1.) modify export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
9# to include all architectures you need.
10# 2.) add whatever you want to the ./configure line.
11# 3.) execute the script.
12# 4.) do a 'make install'
13#
14#
15# make clean or make distclean before building this
16#
17# tell systems before leopard that we like to build for 10.5 or higher
18# with MACOSX_DEPLOYMENT_TARGET=10.5
19# starting with leopard we have to add -mmacosx-version-min=10.5
20# to the CFLAGS and export MACOSX_DEPLOYMENT_TARGET!?
21
22##  for tiger, leopard and snow leopard you might use this
23## export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc -arch ppc64'
24## export MACOSX_DEPLOYMENT_TARGET=10.4
25## export LDFLAGS=$GEOIP_ARCH
26## export CFLAGS="-mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk $GEOIP_ARCH"
27
28# here we go for leopard and snow leopard
29#export GEOIP_ARCH='-arch i386 -arch x86_64 -arch ppc'
30#export MACOSX_DEPLOYMENT_TARGET=10.5
31#export LDFLAGS=$GEOIP_ARCH
32#export CFLAGS="-g -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk $GEOIP_ARCH"
33#./configure --disable-dependency-tracking
34#perl -i.bak -pe'/^archive_cmds=/ and !/\bGEOIP_ARCH\b/ and s/-dynamiclib\b/-dynamiclib \\\$(GEOIP_ARCH)/' ./libtool
35#make
36
37# and this is lion with the new xcode
38P=`xcode-select -print-path`
39export GEOIP_ARCH='-arch i386 -arch x86_64'
40export MACOSX_DEPLOYMENT_TARGET=10.7
41export LDFLAGS=$GEOIP_ARCH
42export CFLAGS="-g -mmacosx-version-min=10.7 -isysroot $P/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk $GEOIP_ARCH"
43./configure --disable-dependency-tracking
44make
45