3 # cd to aubio directory for consistency
6 AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX`
9 VERSION=$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION$AUBIO_VERSION_STATUS
10 LIBVERSION=$LIBAUBIO_LT_CUR.$LIBAUBIO_LT_REV.$LIBAUBIO_LT_AGE
13 # add git abbreviated commit hash
14 #VERSION+=+$(git log --pretty=format:"%h" -1)
17 WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate"
25 trap cleanup SIGINT SIGTERM
27 function create_tarballs() {
28 # name version platform
30 tarfile=$OUTPUTDIR/$1-$2.$3_binary.tar.bz2
31 tar -C $AUBIO_TMPDIR/dist-$3/ -jcf "$tarfile" .
32 #rm -rf $AUBIO_TMPDIR/dist-$3
35 function create_framework() {
36 rm -rf $AUBIO_TMPDIR/framework-$3
37 mkdir -p $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework
38 cp -pr COPYING README.md $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework
39 pushd $AUBIO_TMPDIR/framework-$3
40 cp -pr "$OLDPWD/build/src/lib$1.a" $1-$2.$3_framework/$1.framework/$1 || \
41 cp -pr $AUBIO_TMPDIR/dist-$3/usr/local/lib/lib$1.$LIBVERSION.dylib \
42 $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework/$1
43 cp -pr $AUBIO_TMPDIR/dist-$3/usr/local/include/$1 $1-$2.$3_framework/$1.framework/Headers
44 cp -pr "$OLDPWD/scripts/apple/Modules" $1-$2.$3_framework/$1.framework/
48 function create_framework_fat() {
49 rm -rf $AUBIO_TMPDIR/framework-$3
50 mkdir -p $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework
51 cp -pr COPYING README.md $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework
52 pushd $AUBIO_TMPDIR/framework-$3
53 cp -pr $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/Headers $1-$2.$3_framework/$1.framework
54 cp -pr $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/Modules $1-$2.$3_framework/$1.framework
55 lipo $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/$1 \
56 $AUBIO_TMPDIR/framework-iosimulator/$1-$2.iosimulator_framework/$1.framework/$1 \
57 -output $1-$2.$3_framework/$1.framework/$1 -create
61 function create_framework_zip() {
63 pushd $AUBIO_TMPDIR/framework-$3
64 zipfile=$1-$2.$3_framework.zip
65 zip -qr $zipfile $1-$2.$3_framework
67 mv $AUBIO_TMPDIR/framework-$3/$zipfile "$OUTPUTDIR"
75 for PLATFORM in darwin ios iosimulator
77 rm -rf $AUBIO_TMPDIR/dist-$PLATFORM
78 WAF_OPTIONS="--verbose --destdir $AUBIO_TMPDIR/dist-$PLATFORM --with-target-platform $PLATFORM $WAFCONF"
79 for target in distclean configure build install
81 CFLAGS="$CFLAGS" ./waf $target $WAF_OPTIONS
84 create_framework $PACKAGE $VERSION $PLATFORM
85 if [ $PLATFORM == 'darwin' ]
87 # on darwin, build a .tar.bz2 of /usr and a .zip of aubio.framework
88 create_tarballs $PACKAGE $VERSION $PLATFORM
89 create_framework_zip $PACKAGE $VERSION $PLATFORM
91 ./waf uninstall $WAF_OPTIONS
95 # after both ios and iosimulator have been built
97 create_framework_fat $PACKAGE $VERSION $PLATFORM
98 create_framework_zip $PACKAGE $VERSION $PLATFORM