119 lines · 3.0 KB · Text
RawDownload
#! /usr/bin/env bash # This script cross compiles aubio for windows using mingw, four times:##  - 32 and 64 bits with no external dependencies#  - 32 and 64 bits against ffmpeg## On debian or ubuntu, you will want to 'apt-get install gcc-mingw-w64' set -eset -x python this_version.py -vVERSION=`python $PWD/this_version.py -v` FFMPEG_BUILDS_URL="https://ffmpeg.zeranoe.com/builds"FFMPEG_DEFAULT="3.3.3" # define some default CFLAGSDEF_CFLAGS="-Os -I/usr/share/mingw-w64"DEF_LDFLAGS="" WAFOPTS=""# disable external deps to make sure we don't try to use the host packageWAFOPTS+=" --disable-samplerate --disable-jack --disable-sndfile"# enable ffmpeg buildWAFOPTS+=" --disable-avcodec"# install without a prefixWAFOPTS+=" --prefix=/"# compile the tests, but fake running them# passing this option WAFOPTS fails (escaping?), added in actual waf call below#WAFOPTS+=" --testcmd='echo %s'" # debugging#WAFOPTS+=" -v"#WAFOPTS+=" -j1"#WAFOPTS+=" --notests" function fetch_ffpmeg() {  ## manually add ffmpeg (no pkg-config .pc files in bins)  [ -n "$FFMPEG_VERSION" ] || FFMPEG_VERSION=$FFMPEG_DEFAULT  FFMPEG_TARBALL="$PWD/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip"  FFMPEG_BINARIES="${FFMPEG_TARBALL%%.zip}"  if [ ! -d "$FFMPEG_BINARIES" ]  then    if [ ! -f "$FFMPEG_TARBALL" ]    then      curl -O $FFMPEG_BUILDS_URL/$TARGET/dev/ffmpeg-$FFMPEG_VERSION-$TARGET-dev.zip    else      echo "using $FFMPEG_TARBALL"    fi    unzip -x $FFMPEG_TARBALL  else    echo "using $FFMPEG_BINARIES"  fi} function get_cflags() {  CFLAGS="$DEF_CFLAGS"  LDFLAGS="$DEF_LDFLAGS"  if [ -n "$WITH_FFMEG" ]  then    fetch_ffpmeg    CFLAGS+=" -DHAVE_LIBAV=1 -DHAVE_SWRESAMPLE=1"    CFLAGS+=" -I$FFMPEG_BINARIES/include"    LDFLAGS+=" -lavcodec -lavformat -lavutil -lswresample"    LDFLAGS+=" -L$FFMPEG_BINARIES/lib"  fi} function build_mingw() {  DESTDIR="$PWD/aubio-$VERSION-$TARGET"  [ -n "$WITH_FFMEG" ] && DESTDIR+="-ffmpeg"  [ -f $DESTDIR.zip ] && echo "Remove existing $DESTDIR.zip first" && exit 1  [ -d $DESTDIR ] && rm -rf $DESTDIR  WAFOPTS_TGT="$WAFOPTS --destdir=$DESTDIR"  WAFOPTS_TGT+=" --with-target-platform=$TARGET"  get_cflags  CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \    ./waf distclean configure build install $WAFOPTS_TGT --testcmd='echo %s'  # fix dll location (see https://github.com/waf-project/waf/issues/1860)  mv $DESTDIR/lib/libaubio-5.dll $DESTDIR/bin  mv $DESTDIR/lib/libaubio-5.def $DESTDIR/bin  zip -r $DESTDIR.zip `basename $DESTDIR`  rm -rf $DESTDIR  sha256sum $DESTDIR.zip > $DESTDIR.zip.sha256} function build_mingw32() {  TARGET=win32  export CC=i686-w64-mingw32-gcc  export NM=i686-w64-mingw32-nm  build_mingw} function build_mingw64() {  TARGET=win64  export CC=x86_64-w64-mingw32-gcc  export NM=x86_64-w64-mingw32-nm  build_mingw} # fetch waf if needed[ -f "waf" ] || make getwaf # first build without ffmpegbuild_mingw32build_mingw64 # then build against ffmpegWITH_FFMEG=1build_mingw32build_mingw64 set +xecho ""echo "All done! The following files were generated:"echo ""ls -lart aubio*.zip*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t