-
Notifications
You must be signed in to change notification settings - Fork 6
/
mk-xmingw
executable file
·33 lines (28 loc) · 1.14 KB
/
mk-xmingw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# Cross-compile from Linux to Win32 using mingw32 cross-compiler as
# provided by Debian. For Ogg and MP3 support, you need to compile
# those libraries separately and put them in libs/. If the libraries
# are absent, sbagen is compiled without Ogg/MP3 support.
#
# Compiling these libraries is not the easiest thing to do, and doing
# it the way I did it requires a MinGW and MSYS setup running on
# Windows (or under emulation), under which you can use the
# 'mk-libmad-mingw' and 'mk-tremor-mingw' scripts to build the
# libraries in a rather improvised manner. You only have to do this
# once, after which you can copy them to libs/ and rebuild endlessly
# on Linux without trouble.
COPT="-O6 -s -Wall"
OPT="$COPT -DT_MINGW -I /usr/i586-mingw32msvc/include -I./libs"
GCC=i586-mingw32msvc-gcc
LIBDIR=/usr/i586-mingw32msvc/lib
LIBS=''
[ -f libs/xmingw-libmad.a ] && {
OPT="-DMP3_DECODE $OPT"
LIBS="$LIBS libs/xmingw-libmad.a"
}
[ -f libs/xmingw-libvorbisidec.a ] && {
OPT="-DOGG_DECODE $OPT"
LIBS="$LIBS libs/xmingw-libvorbisidec.a"
}
$GCC $OPT sbagen.c $LIBS -L$LIBDIR -lmingw32 -lwinmm -o sbagen.exe ||
{ echo "FAILED"; exit 1; }