source: scripts/build_apple_frameworks @ 7e9c67d

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

scripts/build_apple_frameworks: escape PWD and OLDPWD to build from a path with a space (closes #43)

  • Property mode set to 100755
File size: 3.1 KB
Line 
1#! /bin/sh
2
3AUBIO_TMPDIR=`mktemp -d /var/tmp/aubio-build-XXXX`
4PACKAGE=aubio
5source VERSION
6VERSION=$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION$AUBIO_VERSION_STATUS
7LIBVERSION=$LIBAUBIO_LT_CUR.$LIBAUBIO_LT_REV.$LIBAUBIO_LT_AGE
8OUTPUTDIR=$PWD/dist
9mkdir -p "$OUTPUTDIR"
10# add git abbreviated commit hash
11#VERSION+=+$(git log --pretty=format:"%h" -1)
12
13CFLAGS="-Werror -Ofast"
14WAFCONF="--disable-sndfile --disable-avcodec --disable-samplerate --enable-fat" # --disable-memcpy --disable-accelerate"
15
16export VERSION
17
18function cleanup () {
19  rm -rf $AUBIO_TMPDIR
20}
21
22trap cleanup SIGINT SIGTERM
23
24function 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
32function 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
45function 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
58function 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
67set -x
68set -e
69
70#./waf dist --verbose
71
72for PLATFORM in darwin ios iosimulator
73do
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
90done
91
92# after both ios and iosimulator have been built
93PLATFORM=iosuniversal
94create_framework_fat $PACKAGE $VERSION $PLATFORM
95create_framework_zip $PACKAGE $VERSION $PLATFORM
96
97./waf clean
98./waf distclean
99
100cleanup
Note: See TracBrowser for help on using the repository browser.