[e9df1371] | 1 | #! /bin/sh |
---|
[ce49bb5] | 2 | |
---|
| 3 | # cd to aubio directory for consistency |
---|
[8da2732] | 4 | cd `dirname $0`/.. |
---|
[e9df1371] | 5 | |
---|
| 6 | AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX` |
---|
| 7 | PACKAGE=aubio |
---|
| 8 | source VERSION |
---|
| 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 |
---|
| 11 | OUTPUTDIR=$PWD/dist |
---|
[c31b589] | 12 | mkdir -p "$OUTPUTDIR" |
---|
[e9df1371] | 13 | # add git abbreviated commit hash |
---|
| 14 | #VERSION+=+$(git log --pretty=format:"%h" -1) |
---|
| 15 | |
---|
[a280ed1] | 16 | CFLAGS="-Werror -Os" |
---|
[dd9287c] | 17 | WAFCONF="--nodeps --enable-fat" # --disable-memcpy --disable-accelerate" |
---|
[e9df1371] | 18 | |
---|
| 19 | export VERSION |
---|
| 20 | |
---|
| 21 | function cleanup () { |
---|
| 22 | rm -rf $AUBIO_TMPDIR |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | trap cleanup SIGINT SIGTERM |
---|
| 26 | |
---|
| 27 | function create_tarballs() { |
---|
| 28 | # name version platform |
---|
| 29 | # create tarball |
---|
| 30 | tarfile=$OUTPUTDIR/$1-$2.$3_binary.tar.bz2 |
---|
[c31b589] | 31 | tar -C $AUBIO_TMPDIR/dist-$3/ -jcf "$tarfile" . |
---|
[e9df1371] | 32 | #rm -rf $AUBIO_TMPDIR/dist-$3 |
---|
| 33 | } |
---|
| 34 | |
---|
| 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 |
---|
[c31b589] | 40 | cp -pr "$OLDPWD/build/src/lib$1.a" $1-$2.$3_framework/$1.framework/$1 || \ |
---|
[e9df1371] | 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 |
---|
[c31b589] | 44 | cp -pr "$OLDPWD/scripts/apple/Modules" $1-$2.$3_framework/$1.framework/ |
---|
[e9df1371] | 45 | popd |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | function create_framework_zip() { |
---|
| 49 | # create zip |
---|
| 50 | pushd $AUBIO_TMPDIR/framework-$3 |
---|
| 51 | zipfile=$1-$2.$3_framework.zip |
---|
| 52 | zip -qr $zipfile $1-$2.$3_framework |
---|
| 53 | popd |
---|
[c31b589] | 54 | mv $AUBIO_TMPDIR/framework-$3/$zipfile "$OUTPUTDIR" |
---|
[e9df1371] | 55 | } |
---|
| 56 | |
---|
| 57 | set -x |
---|
| 58 | set -e |
---|
| 59 | |
---|
| 60 | #./waf dist --verbose |
---|
| 61 | |
---|
[d100c3d] | 62 | for PLATFORM in darwin ios iosimulator watchos watchsimulator |
---|
[e9df1371] | 63 | do |
---|
| 64 | rm -rf $AUBIO_TMPDIR/dist-$PLATFORM |
---|
| 65 | WAF_OPTIONS="--verbose --destdir $AUBIO_TMPDIR/dist-$PLATFORM --with-target-platform $PLATFORM $WAFCONF" |
---|
| 66 | for target in distclean configure build install |
---|
| 67 | do |
---|
| 68 | CFLAGS="$CFLAGS" ./waf $target $WAF_OPTIONS |
---|
| 69 | done |
---|
| 70 | |
---|
| 71 | create_framework $PACKAGE $VERSION $PLATFORM |
---|
| 72 | if [ $PLATFORM == 'darwin' ] |
---|
| 73 | then |
---|
[eed0199] | 74 | # on darwin, build a .tar.bz2 of /usr |
---|
[e9df1371] | 75 | create_tarballs $PACKAGE $VERSION $PLATFORM |
---|
| 76 | fi |
---|
[eed0199] | 77 | |
---|
| 78 | # build a .zip of aubio.framework |
---|
| 79 | create_framework_zip $PACKAGE $VERSION $PLATFORM |
---|
| 80 | |
---|
| 81 | # clean up |
---|
[e9df1371] | 82 | ./waf uninstall $WAF_OPTIONS |
---|
| 83 | |
---|
| 84 | done |
---|
| 85 | |
---|
| 86 | ./waf clean |
---|
| 87 | ./waf distclean |
---|
| 88 | |
---|
| 89 | cleanup |
---|