3 AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX`
6 VERSION=$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION$AUBIO_VERSION_STATUS
7 LIBVERSION=$LIBAUBIO_LT_CUR.$LIBAUBIO_LT_REV.$LIBAUBIO_LT_AGE
10 # add git abbreviated commit hash
11 #VERSION+=+$(git log --pretty=format:"%h" -1)
13 CFLAGS="-Werror -Ofast"
14 WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate"
22 trap cleanup SIGINT SIGTERM
24 function create_tarballs() {
25 # name version platform
27 tarfile=$OUTPUTDIR/$1-$2.$3_binary.tar.bz2
28 tar -C $AUBIO_TMPDIR/dist-$3/ -jcf "$tarfile" .
29 #rm -rf $AUBIO_TMPDIR/dist-$3
32 function create_framework() {
33 rm -rf $AUBIO_TMPDIR/framework-$3
34 mkdir -p $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework
35 cp -pr COPYING README.md $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework
36 pushd $AUBIO_TMPDIR/framework-$3
37 cp -pr "$OLDPWD/build/src/lib$1.a" $1-$2.$3_framework/$1.framework/$1 || \
38 cp -pr $AUBIO_TMPDIR/dist-$3/usr/local/lib/lib$1.$LIBVERSION.dylib \
39 $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework/$1
40 cp -pr $AUBIO_TMPDIR/dist-$3/usr/local/include/$1 $1-$2.$3_framework/$1.framework/Headers
41 cp -pr "$OLDPWD/scripts/apple/Modules" $1-$2.$3_framework/$1.framework/
45 function create_framework_fat() {
46 rm -rf $AUBIO_TMPDIR/framework-$3
47 mkdir -p $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework
48 cp -pr COPYING README.md $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework
49 pushd $AUBIO_TMPDIR/framework-$3
50 cp -pr $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/Headers $1-$2.$3_framework/$1.framework
51 cp -pr $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/Modules $1-$2.$3_framework/$1.framework
52 lipo $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/$1 \
53 $AUBIO_TMPDIR/framework-iosimulator/$1-$2.iosimulator_framework/$1.framework/$1 \
54 -output $1-$2.$3_framework/$1.framework/$1 -create
58 function create_framework_zip() {
60 pushd $AUBIO_TMPDIR/framework-$3
61 zipfile=$1-$2.$3_framework.zip
62 zip -qr $zipfile $1-$2.$3_framework
64 mv $AUBIO_TMPDIR/framework-$3/$zipfile "$OUTPUTDIR"
72 for PLATFORM in darwin ios iosimulator
74 rm -rf $AUBIO_TMPDIR/dist-$PLATFORM
75 WAF_OPTIONS="--verbose --destdir $AUBIO_TMPDIR/dist-$PLATFORM --with-target-platform $PLATFORM $WAFCONF"
76 for target in distclean configure build install
78 CFLAGS="$CFLAGS" ./waf $target $WAF_OPTIONS
81 create_framework $PACKAGE $VERSION $PLATFORM
82 if [ $PLATFORM == 'darwin' ]
84 # on darwin, build a .tar.bz2 of /usr and a .zip of aubio.framework
85 create_tarballs $PACKAGE $VERSION $PLATFORM
86 create_framework_zip $PACKAGE $VERSION $PLATFORM
88 ./waf uninstall $WAF_OPTIONS
92 # after both ios and iosimulator have been built
94 create_framework_fat $PACKAGE $VERSION $PLATFORM
95 create_framework_zip $PACKAGE $VERSION $PLATFORM