Ignore:
Timestamp:
Dec 5, 2018, 10:34:39 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/cnn, feature/crepe, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
283a619a
Parents:
5b46bc3 (diff), f19db54 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into feature/pitchshift

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/build_mingw

    r5b46bc3 r633400d  
    11#! /bin/bash
    22
    3 # This script cross compiles aubio for windows using mingw, both for 32 and 64
    4 # bits. Built binaries will be placed in ./dist-win32 and ./dist-win64.
    5 
     3# This script cross compiles aubio for windows using mingw, four times:
     4#
     5#  - 32 and 64 bits with no external dependencies
     6#  - 32 and 64 bits against ffmpeg
     7#
    68# On debian or ubuntu, you will want to 'apt-get install gcc-mingw-w64'
    79
     
    911set -x
    1012
    11 WAFOPTS="-v --disable-avcodec --disable-samplerate --disable-jack --disable-sndfile"
     13python this_version.py -v
     14VERSION=`python $PWD/this_version.py -v`
    1215
    13 [ -d dist-win32 ] && rm -rf dist-win32
    14 [ -d dist-win64 ] && rm -rf dist-win64
     16FFMPEG_BUILDS_URL="https://ffmpeg.zeranoe.com/builds"
     17FFMPEG_DEFAULT="3.3.3"
    1518
    16 CFLAGS="-Os" \
    17   LDFLAGS="" \
    18   CC=x86_64-w64-mingw32-gcc \
    19   ./waf distclean configure build install --destdir=$PWD/dist-win64 \
    20     --testcmd="echo %s" \
    21     $WAFOPTS --with-target-platform=win64
     19# define some default CFLAGS
     20DEF_CFLAGS="-Os -I/usr/share/mingw-w64"
     21DEF_LDFLAGS=""
    2222
    23 CFLAGS="-Os" \
    24   LDFLAGS="" \
    25   CC=i686-w64-mingw32-gcc \
    26   ./waf distclean configure build install --destdir=$PWD/dist-win32 \
    27     --testcmd="echo %s" \
    28     $WAFOPTS --with-target-platform=win32
     23WAFOPTS=""
     24# disable external deps to make sure we don't try to use the host package
     25WAFOPTS+=" --disable-samplerate --disable-jack --disable-sndfile"
     26# enable ffmpeg build
     27WAFOPTS+=" --disable-avcodec"
     28# install without a prefix
     29WAFOPTS+=" --prefix=/"
     30# compile the tests, but fake running them
     31# passing this option WAFOPTS fails (escaping?), added in actual waf call below
     32#WAFOPTS+=" --testcmd='echo %s'"
     33
     34# debugging
     35#WAFOPTS+=" -v"
     36#WAFOPTS+=" -j1"
     37#WAFOPTS+=" --notests"
     38
     39function fetch_ffpmeg() {
     40  ## manually add ffmpeg (no pkg-config .pc files in bins)
     41  [ -n "$FFMPEG_VERSION" ] || FFMPEG_VERSION=$FFMPEG_DEFAULT
     42  FFMPEG_TARBALL="$PWD/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip"
     43  FFMPEG_BINARIES="${FFMPEG_TARBALL%%.zip}"
     44  if [ ! -d "$FFMPEG_BINARIES" ]
     45  then
     46    if [ ! -f "$FFMPEG_TARBALL" ]
     47    then
     48      curl -O $FFMPEG_BUILDS_URL/$TARGET/dev/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip
     49    else
     50      echo "using $FFMPEG_TARBALL"
     51    fi
     52    unzip -x $FFMPEG_TARBALL
     53  else
     54    echo "using $FFMPEG_BINARIES"
     55  fi
     56}
     57
     58function get_cflags() {
     59  CFLAGS="$DEF_CFLAGS"
     60  LDFLAGS="$DEF_LDFLAGS"
     61  if [ -n "$WITH_FFMEG" ]
     62  then
     63    fetch_ffpmeg
     64    CFLAGS+=" -DHAVE_LIBAV=1 -DHAVE_SWRESAMPLE=1"
     65    CFLAGS+=" -I$FFMPEG_BINARIES/include"
     66    LDFLAGS+=" -lavcodec -lavformat -lavutil -lswresample"
     67    LDFLAGS+=" -L$FFMPEG_BINARIES/lib"
     68  fi
     69}
     70
     71function build_mingw() {
     72  DESTDIR="$PWD/aubio-$VERSION-$TARGET"
     73  [ -n "$WITH_FFMEG" ] && DESTDIR+="-ffmpeg"
     74  [ -f $DESTDIR.zip ] && echo "Remove existing $DESTDIR.zip first" && exit 1
     75  [ -d $DESTDIR ] && rm -rf $DESTDIR
     76  WAFOPTS_TGT="$WAFOPTS --destdir=$DESTDIR"
     77  WAFOPTS_TGT+=" --with-target-platform=$TARGET"
     78  get_cflags
     79  CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
     80    ./waf distclean configure build install $WAFOPTS_TGT --testcmd='echo %s'
     81  # fix dll location (see https://github.com/waf-project/waf/issues/1860)
     82  mv $DESTDIR/lib/libaubio-5.dll $DESTDIR/bin
     83  mv $DESTDIR/lib/libaubio-5.def $DESTDIR/bin
     84  zip -r $DESTDIR.zip `basename $DESTDIR`
     85  rm -rf $DESTDIR
     86  sha256sum $DESTDIR.zip > $DESTDIR.zip.sha256
     87}
     88
     89function build_mingw32() {
     90  TARGET=win32
     91  export CC=i686-w64-mingw32-gcc
     92  export NM=i686-w64-mingw32-nm
     93  build_mingw
     94}
     95
     96function build_mingw64() {
     97  TARGET=win64
     98  export CC=x86_64-w64-mingw32-gcc
     99  export NM=x86_64-w64-mingw32-nm
     100  build_mingw
     101}
     102
     103# fetch waf if needed
     104[ -f "waf" ] || make getwaf
     105
     106# first build without ffmpeg
     107build_mingw32
     108build_mingw64
     109
     110# then build against ffmpeg
     111WITH_FFMEG=1
     112build_mingw32
     113build_mingw64
     114
     115set +x
     116echo ""
     117echo "All done! The following files were generated:"
     118echo ""
     119ls -lart aubio*.zip*
Note: See TracChangeset for help on using the changeset viewer.