-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-mingw.sh
executable file
·64 lines (57 loc) · 1.67 KB
/
build-mingw.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh
BITS=32
if [[ $# -ge 1 ]]; then
case "$1" in
--help|-h)
echo "Usage: <script> [options]"
echo -e "\nAvailable options:"
echo -e "\t--help, -h\tThis usage explanation."
echo -e "\t--builddeps\tInstall build dependencies (dnf)."
echo -e "\t--32\t\tBuild 32-bit binary with MinGW-w64."
echo -e "\t--64\t\tBuild 64-bit binary with MinGW-w64."
echo -e "\t--clean, -c\tClean build artifacts."
echo ""
exit 0
;;
--builddeps)
sudo dnf install -y mingw32-bzip2 mingw32-flac mingw32-gcc mingw32-libmodplug mingw32-libogg mingw32-libvorbis \
mingw32-winpthreads mingw32-SDL2 mingw32-SDL2_mixer mingw32-SDL2_net mingw32-zlib
sudo dnf install -y mingw64-bzip2 mingw64-flac mingw64-gcc mingw64-libmodplug mingw64-libogg mingw64-libvorbis \
mingw64-winpthreads mingw64-SDL2 mingw64-SDL2_mixer mingw64-SDL2_net mingw64-zlib
exit 0
;;
--32)
BITS=32
;;
--64)
BITS=64
;;
--clean|-c)
make clean
rm -f *.dll
exit 0
;;
*)
echo "Unknown option, use --help for usage instructions."
;;
esac
shift
fi
if [ "${BITS}" == "32" ]; then
MINGW=i686-w64-mingw32
LIBS="libgcc_s_sjlj-1 "
else
MINGW=x86_64-w64-mingw32
LIBS="libgcc_s_seh-1 "
fi
MINGW_PATH=/usr/${MINGW}
PATH=${MINGW_PATH}/bin:${MINGW_PATH}/sys-root/mingw/bin:${PATH}; echo ${PATH}
CC=${MINGW}-gcc
# Clean previous build artifacts
make clean
rm -f *.dll
make CC=${CC} EXEC=wine EXE=.exe $@
LIBS+="libbz2-1 libFLAC-8 libmodplug-1 libogg-0 libstdc++-6 libvorbis-0 libvorbisfile-3 libwinpthread-1 SDL2 SDL2_mixer SDL2_net zlib1"
for lib in ${LIBS}; do
cp -f ${MINGW_PATH}/sys-root/mingw/bin/${lib}.dll .
done