[e9df1371] | 1 | #! /bin/sh |
---|
| 2 | |
---|
| 3 | AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX` |
---|
| 4 | PACKAGE=aubio |
---|
| 5 | source VERSION |
---|
| 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 |
---|
| 8 | OUTPUTDIR=$PWD/dist |
---|
| 9 | mkdir -p $OUTPUTDIR |
---|
| 10 | # add git abbreviated commit hash |
---|
| 11 | #VERSION+=+$(git log --pretty=format:"%h" -1) |
---|
| 12 | |
---|
| 13 | CFLAGS="-Werror -Ofast" |
---|
| 14 | WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate" |
---|
| 15 | |
---|
| 16 | export VERSION |
---|
| 17 | |
---|
| 18 | function cleanup () { |
---|
| 19 | rm -rf $AUBIO_TMPDIR |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | trap cleanup SIGINT SIGTERM |
---|
| 23 | |
---|
| 24 | function create_tarballs() { |
---|
| 25 | # name version platform |
---|
| 26 | # create tarball |
---|
| 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 |
---|
| 30 | } |
---|
| 31 | |
---|
| 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/ |
---|
| 42 | popd |
---|
| 43 | } |
---|
| 44 | |
---|
| 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 |
---|
| 55 | popd |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | function create_framework_zip() { |
---|
| 59 | # create zip |
---|
| 60 | pushd $AUBIO_TMPDIR/framework-$3 |
---|
| 61 | zipfile=$1-$2.$3_framework.zip |
---|
| 62 | zip -qr $zipfile $1-$2.$3_framework |
---|
| 63 | popd |
---|
| 64 | mv $AUBIO_TMPDIR/framework-$3/$zipfile $OUTPUTDIR |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | set -x |
---|
| 68 | set -e |
---|
| 69 | |
---|
| 70 | #./waf dist --verbose |
---|
| 71 | |
---|
| 72 | for PLATFORM in darwin ios iosimulator |
---|
| 73 | do |
---|
| 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 |
---|
| 77 | do |
---|
| 78 | CFLAGS="$CFLAGS" ./waf $target $WAF_OPTIONS |
---|
| 79 | done |
---|
| 80 | |
---|
| 81 | create_framework $PACKAGE $VERSION $PLATFORM |
---|
| 82 | if [ $PLATFORM == 'darwin' ] |
---|
| 83 | then |
---|
| 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 |
---|
| 87 | fi |
---|
| 88 | ./waf uninstall $WAF_OPTIONS |
---|
| 89 | |
---|
| 90 | done |
---|
| 91 | |
---|
| 92 | # after both ios and iosimulator have been built |
---|
| 93 | PLATFORM=iosuniversal |
---|
| 94 | create_framework_fat $PACKAGE $VERSION $PLATFORM |
---|
| 95 | create_framework_zip $PACKAGE $VERSION $PLATFORM |
---|
| 96 | |
---|
| 97 | ./waf clean |
---|
| 98 | ./waf distclean |
---|
| 99 | |
---|
| 100 | cleanup |
---|