forked from Interrupt/systemshock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_windows.sh
91 lines (72 loc) · 2.03 KB
/
build_windows.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
set -e
SDL_version=2.0.8
SDL_mixer_version=2.0.2
CMAKE_version=3.11.3
#CMAKE_architecture=win64-x64
CMAKE_architecture=win32-x86
# Removing the mwindows linker option lets us get console output
function remove_mwindows {
sed -i -e "s/ \-mwindows//g" Makefile
}
function build_sdl {
curl -O https://www.libsdl.org/release/SDL2-${SDL_version}.tar.gz
tar xvf SDL2-${SDL_version}.tar.gz
pushd SDL2-${SDL_version}
./configure "CFLAGS=-m32" "CXXFLAGS=-m32" --host=i686-w64-mingw32 --prefix=${install_dir}/built_sdl
remove_mwindows
make
make install
popd
}
function build_sdl_mixer {
git clone https://github.com/SDL-mirror/SDL_mixer.git
pushd SDL_mixer
./configure "CFLAGS=-m32" "CXXFLAGS=-m32" --host=i686-w64-mingw32 --disable-sdltest --with-sdl-prefix=${install_dir}/built_sdl --prefix=${install_dir}/built_sdl_mixer
remove_mwindows
make
make install
popd
}
function get_cmake {
curl -O https://cmake.org/files/v3.11/cmake-${CMAKE_version}-${CMAKE_architecture}.zip
unzip cmake-${CMAKE_version}-${CMAKE_architecture}.zip
pushd cmake-${CMAKE_version}-${CMAKE_architecture}/bin
CMAKE_ROOT=`pwd -W`/
popd
}
## Actual building starts here
if [ -d ./build_ext/ ]; then
echo A directory named build_ext already exists.
echo Please remove it if you want to recompile.
exit
fi
rm -rf CMakeFiles/
rm -rf CMakeCache.txt
cp windows/make.exe /usr/bin/
mkdir ./build_ext/
cd ./build_ext/
install_dir=`pwd -W`
build_sdl
build_sdl_mixer
if ! [ -x "$(command -v cmake)" ]; then
echo "Getting CMake"
get_cmake
fi
# Back to the root directory, copy SDL DLL files for the executable
cd ..
cp build_ext/built_sdl/bin/SDL*.dll .
cp build_ext/built_sdl_mixer/bin/SDL*.dll .
# Set up build.bat
if [[ -z "${APPVEYOR}" ]]; then
echo "Normal build"
echo "@echo off
set PATH=%PATH%;${CMAKE_ROOT}
cmake -G \"MinGW Makefiles\" .
mingw32-make systemshock" >build.bat
else
echo "Appveyor"
echo "cmake -G \"Unix Makefiles\" .
make systemshock" >build.bat
fi
echo "Our work here is done. Run BUILD.BAT in a Windows shell to build the actual source."