source: scripts/build_apple_frameworks @ 832b6c59

feature/cnnfeature/crepefix/ffmpeg5
Last change on this file since 832b6c59 was a280ed1, checked in by Paul Brossier <piem@piem.org>, 6 years ago

[osx] build frameworks with -Os

The new tests revealed a crash in test-pitchmcomb when compiling with
-Ofast (somewhere in fvec_median, but not reproducible from aubiopitch,
needs more poking).

  • Property mode set to 100755
File size: 3.2 KB
RevLine 
[e9df1371]1#! /bin/sh
[ce49bb5]2
3# cd to aubio directory for consistency
[8da2732]4cd `dirname $0`/..
[e9df1371]5
6AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX`
7PACKAGE=aubio
8source VERSION
9VERSION=$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION$AUBIO_VERSION_STATUS
10LIBVERSION=$LIBAUBIO_LT_CUR.$LIBAUBIO_LT_REV.$LIBAUBIO_LT_AGE
11OUTPUTDIR=$PWD/dist
[c31b589]12mkdir -p "$OUTPUTDIR"
[e9df1371]13# add git abbreviated commit hash
14#VERSION+=+$(git log --pretty=format:"%h" -1)
15
[a280ed1]16CFLAGS="-Werror -Os"
[e9df1371]17WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate"
18
19export VERSION
20
21function cleanup () {
22  rm -rf $AUBIO_TMPDIR
23}
24
25trap cleanup SIGINT SIGTERM
26
27function 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
35function 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
48function 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
58  popd
59}
60
61function create_framework_zip() {
62  # create zip
63  pushd $AUBIO_TMPDIR/framework-$3
64  zipfile=$1-$2.$3_framework.zip
65  zip -qr $zipfile $1-$2.$3_framework
66  popd
[c31b589]67  mv $AUBIO_TMPDIR/framework-$3/$zipfile "$OUTPUTDIR"
[e9df1371]68}
69
70set -x
71set -e
72
73#./waf dist --verbose
74
75for PLATFORM in darwin ios iosimulator
76do
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
80  do
81    CFLAGS="$CFLAGS" ./waf $target $WAF_OPTIONS
82  done
83
84  create_framework $PACKAGE $VERSION $PLATFORM
85  if [ $PLATFORM == 'darwin' ]
86  then
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
90  fi
91  ./waf uninstall $WAF_OPTIONS
92
93done
94
95# after both ios and iosimulator have been built
96PLATFORM=iosuniversal
97create_framework_fat $PACKAGE $VERSION $PLATFORM
98create_framework_zip $PACKAGE $VERSION $PLATFORM
99
100./waf clean
101./waf distclean
102
103cleanup
Note: See TracBrowser for help on using the repository browser.