source: scripts/build_apple_frameworks @ 8da2732

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampler
Last change on this file since 8da2732 was 8da2732, checked in by Paul Brossier <piem@piem.org>, 7 years ago

add permanent dir execution for scripts/build_apple_frameworks

Signed-off-by: Paul Brossier <piem@piem.org>

  • Property mode set to 100755
File size: 3.2 KB
Line 
1#! /bin/sh
2cd `dirname $0`/..
3
4AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX`
5PACKAGE=aubio
6source VERSION
7VERSION=$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION$AUBIO_VERSION_STATUS
8LIBVERSION=$LIBAUBIO_LT_CUR.$LIBAUBIO_LT_REV.$LIBAUBIO_LT_AGE
9OUTPUTDIR=$PWD/dist
10mkdir -p "$OUTPUTDIR"
11# add git abbreviated commit hash
12#VERSION+=+$(git log --pretty=format:"%h" -1)
13
14CFLAGS="-Werror -Ofast"
15WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate"
16
17export VERSION
18
19function cleanup () {
20  rm -rf $AUBIO_TMPDIR
21}
22
23trap cleanup SIGINT SIGTERM
24
25function create_tarballs() {
26  # name version platform
27  # create tarball
28  tarfile=$OUTPUTDIR/$1-$2.$3_binary.tar.bz2
29  tar -C $AUBIO_TMPDIR/dist-$3/ -jcf "$tarfile" .
30  #rm -rf $AUBIO_TMPDIR/dist-$3
31}
32
33function create_framework() {
34  rm -rf $AUBIO_TMPDIR/framework-$3
35  mkdir -p $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework
36  cp -pr COPYING README.md $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework
37  pushd $AUBIO_TMPDIR/framework-$3
38  cp -pr "$OLDPWD/build/src/lib$1.a" $1-$2.$3_framework/$1.framework/$1 || \
39    cp -pr $AUBIO_TMPDIR/dist-$3/usr/local/lib/lib$1.$LIBVERSION.dylib \
40    $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework/$1
41  cp -pr $AUBIO_TMPDIR/dist-$3/usr/local/include/$1 $1-$2.$3_framework/$1.framework/Headers
42  cp -pr "$OLDPWD/scripts/apple/Modules" $1-$2.$3_framework/$1.framework/
43  popd
44}
45
46function create_framework_fat() {
47  rm -rf $AUBIO_TMPDIR/framework-$3
48  mkdir -p $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework/$1.framework
49  cp -pr COPYING README.md $AUBIO_TMPDIR/framework-$3/$1-$2.$3_framework
50  pushd $AUBIO_TMPDIR/framework-$3
51  cp -pr $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/Headers $1-$2.$3_framework/$1.framework
52  cp -pr $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/Modules $1-$2.$3_framework/$1.framework
53  lipo $AUBIO_TMPDIR/framework-ios/$1-$2.ios_framework/$1.framework/$1 \
54       $AUBIO_TMPDIR/framework-iosimulator/$1-$2.iosimulator_framework/$1.framework/$1 \
55       -output $1-$2.$3_framework/$1.framework/$1 -create
56  popd
57}
58
59function create_framework_zip() {
60  # create zip
61  pushd $AUBIO_TMPDIR/framework-$3
62  zipfile=$1-$2.$3_framework.zip
63  zip -qr $zipfile $1-$2.$3_framework
64  popd
65  mv $AUBIO_TMPDIR/framework-$3/$zipfile "$OUTPUTDIR"
66}
67
68set -x
69set -e
70
71#./waf dist --verbose
72
73for PLATFORM in darwin ios iosimulator
74do
75  rm -rf $AUBIO_TMPDIR/dist-$PLATFORM
76  WAF_OPTIONS="--verbose --destdir $AUBIO_TMPDIR/dist-$PLATFORM --with-target-platform $PLATFORM $WAFCONF"
77  for target in distclean configure build install
78  do
79    CFLAGS="$CFLAGS" ./waf $target $WAF_OPTIONS
80  done
81
82  create_framework $PACKAGE $VERSION $PLATFORM
83  if [ $PLATFORM == 'darwin' ]
84  then
85    # on darwin, build a .tar.bz2 of /usr and a .zip of aubio.framework
86    create_tarballs $PACKAGE $VERSION $PLATFORM
87    create_framework_zip $PACKAGE $VERSION $PLATFORM
88  fi
89  ./waf uninstall $WAF_OPTIONS
90
91done
92
93# after both ios and iosimulator have been built
94PLATFORM=iosuniversal
95create_framework_fat $PACKAGE $VERSION $PLATFORM
96create_framework_zip $PACKAGE $VERSION $PLATFORM
97
98./waf clean
99./waf distclean
100
101cleanup
Note: See TracBrowser for help on using the repository browser.