Ignore:
Timestamp:
Mar 17, 2017, 9:39:56 AM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
Children:
4f64069
Parents:
1f170a8
Message:

scripts/build_mingw: also build against ffmpeg

This script now builds aubio for windows 4 times, for 32 and 64 bits,
with and without ffmpeg. Latest ffmpeg binaries are downloaded if not
found in the current directory.

Tarball containing aubio binaries are created once each build completed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/build_mingw

    r1f170a8 r4309424  
    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"
     13source VERSION
     14VERSION="$AUBIO_MAJOR_VERSION.$AUBIO_MINOR_VERSION.$AUBIO_PATCH_VERSION"
     15VERSION+="$AUBIO_VERSION_STATUS"
    1216
    13 [ -d dist-win32 ] && rm -rf dist-win32
    14 [ -d dist-win64 ] && rm -rf dist-win64
     17FFMPEG_BUILDS_URL="https://ffmpeg.zeranoe.com/builds"
     18FFMPEG_DEFAULT="20170315-6c4665d"
    1519
    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
     20# define some default CFLAGS
     21DEF_CFLAGS="-Os -I/usr/share/mingw-w64"
     22DEF_LDFLAGS=""
    2223
    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
     24WAFOPTS=""
     25# disable external deps to make sure we don't try to use the host package
     26WAFOPTS+=" --disable-samplerate --disable-jack --disable-sndfile"
     27# enable ffmpeg build
     28WAFOPTS+=" --disable-avcodec"
     29# install without a prefix
     30WAFOPTS+=" --prefix=/"
     31# compile the tests, but fake running them
     32# passing this option WAFOPTS fails (escaping?), added in actual waf call below
     33#WAFOPTS+=" --testcmd='echo %s'"
     34
     35# debugging
     36#WAFOPTS+=" -v"
     37#WAFOPTS+=" -j1"
     38#WAFOPTS+=" --notests"
     39
     40function fetch_ffpmeg() {
     41  ## manually add ffmpeg (no pkg-config .pc files in bins)
     42  [ -n "$FFMPEG_VERSION" ] || FFMPEG_VERSION=$FFMPEG_DEFAULT
     43  FFMPEG_TARBALL="$PWD/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip"
     44  FFMPEG_BINARIES="${FFMPEG_TARBALL%%.zip}"
     45  if [ ! -d "$FFMPEG_BINARIES" ]
     46  then
     47    if [ ! -f "$FFMPEG_TARBALL" ]
     48    then
     49      curl -O $FFMPEG_BUILDS_URL/$TARGET/dev/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip
     50    else
     51      echo "using $FFMPEG_TARBALL"
     52    fi
     53    unzip -x $FFMPEG_TARBALL
     54  else
     55    echo "using $FFMPEG_BINARIES"
     56  fi
     57}
     58
     59function get_cflags() {
     60  CFLAGS="$DEF_CFLAGS"
     61  LDFLAGS="$DEF_LDFLAGS"
     62  if [ -n "$WITH_FFMEG" ]
     63  then
     64    fetch_ffpmeg
     65    CFLAGS+=" -DHAVE_LIBAV=1 -DHAVE_SWRESAMPLE=1"
     66    CFLAGS+=" -I$FFMPEG_BINARIES/include"
     67    LDFLAGS+=" -lavcodec -lavformat -lavutil -lswresample"
     68    LDFLAGS+=" -L$FFMPEG_BINARIES/lib"
     69  fi
     70}
     71
     72function build_mingw() {
     73  DESTDIR="$PWD/aubio-$VERSION-$TARGET"
     74  [ -n "$WITH_FFMEG" ] && DESTDIR+="-ffmpeg"
     75  [ -d $DESTDIR ] && rm -rf $DESTDIR $DESTDIR.zip
     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  zip -r $DESTDIR.zip `basename $DESTDIR`
     82  rm -rf $DESTDIR
     83  sha256sum $DESTDIR.zip > $DESTDIR.zip.sha256
     84}
     85
     86function build_mingw32() {
     87  TARGET=win32
     88  export CC=i686-w64-mingw32-gcc
     89  build_mingw
     90}
     91
     92function build_mingw64() {
     93  TARGET=win64
     94  export CC=x86_64-w64-mingw32-gcc
     95  build_mingw
     96}
     97
     98# fetch waf if needed
     99[ -f "waf" ] || make getwaf
     100
     101# first build without ffmpeg
     102build_mingw32
     103build_mingw64
     104
     105# then build against ffmpeg
     106WITH_FFMEG=1
     107build_mingw32
     108build_mingw64
Note: See TracChangeset for help on using the changeset viewer.