scripts/build_mingw: add script to cross-compile using mingw
[aubio.git] / scripts / build_mingw
1 #! /bin/bash
2
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
6 # On debian or ubuntu, you will want to 'apt-get install gcc-mingw-w64'
7
8 set -e
9 set -x
10
11 WAFOPTS="-v --disable-avcodec --disable-samplerate --disable-jack --disable-sndfile"
12
13 [ -d dist-win32 ] && rm -rf dist-win32
14 [ -d dist-win64 ] && rm -rf dist-win64
15
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
22
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