1#!/bin/sh
2
3#       Building on Mac OSX.  Note: only compiles in OGG and MP3
4#       support if the libraries are already setup within libs/,
5#       otherwise omits them.  To get an idea of how to build the
6#       libraries, see the 'mk-libmad-linux' and 'mk-tremor-linux'
7#       scripts.  The only difference is that on Mac OSX the
8#       'authgen.sh' line doesn't work, and you have to run
9#       './configure' instead.  Also it might be necessary to run
10#       'ranlib' on the resulting .a files.
11
12CFLAGS="-m32 -mmacosx-version-min=10.4 -DT_MACOSX"
13CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers -fpascal-strings"
14LIBS="-framework Carbon -framework CoreAudio"
15
16xx=libs/macosx-intel32-libmad.a
17[ -f $xx ] && {
18    CFLAGS="-DMP3_DECODE $CFLAGS"
19    LIBS="$LIBS $xx"
20    ranlib $xx	# OSX is fussy if you copy .a files and insists you run 'ranlib' on them
21}
22
23xx=libs/macosx-intel32-libvorbisidec.a
24[ -f $xx ] && {
25    CFLAGS="-DOGG_DECODE $CFLAGS"
26    LIBS="$LIBS $xx"
27    ranlib $xx	# OSX is fussy if you copy .a files and insists you run 'ranlib' on them
28}
29
30CC="cc $CFLAGS -Wall -O3 $LIBS -lm -lpthread"
31
32$CC sbagen.c -o sbagen || exit 1
33strip sbagen || exit 1
34