b951ff4985de779b872af6db6da2551651d83fa9
[oweals/minetest.git] / util / buildbot / buildwin64.sh
1 #!/bin/bash
2 set -e
3
4 dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5 if [ $# -ne 1 ]; then
6         echo "Usage: $0 <build directory>"
7         exit 1
8 fi
9 builddir=$1
10 mkdir -p $builddir
11 builddir="$( cd "$builddir" && pwd )"
12 packagedir=$builddir/packages
13 libdir=$builddir/libs
14
15 toolchain_file=$dir/toolchain_mingw64.cmake
16 irrlicht_version=1.8.1
17 ogg_version=1.3.1
18 vorbis_version=1.3.4
19 curl_version=7.38.0
20 gettext_version=0.18.2
21 freetype_version=2.5.3
22 luajit_version=2.0.3
23 leveldb_version=1.15
24 zlib_version=1.2.8
25
26 mkdir -p $packagedir
27 mkdir -p $libdir
28
29 cd $builddir
30
31 # Get stuff
32 [ -e $packagedir/irrlicht-$irrlicht_version.zip ] || wget http://sfan5.pf-control.de/irrlicht-$irrlicht_version-win64.zip \
33         -c -O $packagedir/irrlicht-$irrlicht_version.zip
34 [ -e $packagedir/zlib-$zlib_version.zip ] || wget http://sfan5.pf-control.de/zlib-$zlib_version-win64.zip \
35         -c -O $packagedir/zlib-$zlib_version.zip
36 [ -e $packagedir/libogg-$ogg_version.zip ] || wget http://sfan5.pf-control.de/libogg-$ogg_version-win64.zip \
37         -c -O $packagedir/libogg-$ogg_version.zip
38 [ -e $packagedir/libvorbis-$vorbis_version.zip ] || wget http://sfan5.pf-control.de/libvorbis-$vorbis_version-win64.zip \
39         -c -O $packagedir/libvorbis-$vorbis_version.zip
40 [ -e $packagedir/libcurl-$curl_version.zip ] || wget http://sfan5.pf-control.de/libcurl-$curl_version-win64.zip \
41         -c -O $packagedir/libcurl-$curl_version.zip
42 [ -e $packagedir/gettext-$gettext_version.zip ] || wget http://sfan5.pf-control.de/gettext-$gettext_version-win64.zip \
43         -c -O $packagedir/gettext-$gettext_version.zip
44 [ -e $packagedir/freetype-$freetype_version.zip ] || wget http://sfan5.pf-control.de/libfreetype-$freetype_version-win64.zip \
45     -c -O $packagedir/freetype-$freetype_version.zip
46 [ -e $packagedir/luajit-$luajit_version.zip ] || wget http://sfan5.pf-control.de/luajit-$luajit_version-static-win64.zip \
47         -c -O $packagedir/luajit-$luajit_version.zip
48 [ -e $packagedir/libleveldb-$leveldb_version.zip ] || wget http://sfan5.pf-control.de/libleveldb-$leveldb_version-win64.zip \
49         -c -O $packagedir/libleveldb-$leveldb_version.zip
50 [ -e $packagedir/openal_stripped.zip ] || wget http://sfan5.pf-control.de/openal_stripped64.zip \
51         -c -O $packagedir/openal_stripped.zip
52
53
54 # Extract stuff
55 cd $libdir
56 [ -d irrlicht-$irrlicht_version ] || unzip -o $packagedir/irrlicht-$irrlicht_version.zip
57 [ -d zlib ] || unzip -o $packagedir/zlib-$zlib_version.zip -d zlib
58 [ -d libogg ] || unzip -o $packagedir/libogg-$ogg_version.zip -d libogg
59 [ -d libvorbis ] || unzip -o $packagedir/libvorbis-$vorbis_version.zip -d libvorbis
60 [ -d libcurl ] || unzip -o $packagedir/libcurl-$curl_version.zip -d libcurl
61 [ -d gettext ] || unzip -o $packagedir/gettext-$gettext_version.zip -d gettext
62 [ -d freetype ] || unzip -o $packagedir/freetype-$freetype_version.zip -d freetype
63 [ -d openal_stripped ] || unzip -o $packagedir/openal_stripped.zip
64 [ -d luajit ] || unzip -o $packagedir/luajit-$luajit_version.zip -d luajit
65 [ -d leveldb ] || unzip -o $packagedir/libleveldb-$leveldb_version.zip -d leveldb
66
67 # Get minetest
68 cd $builddir
69 if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
70         ln -s $EXISTING_MINETEST_DIR minetest
71 else
72         [ -d minetest ] && (cd minetest && git pull) || (git clone https://github.com/minetest/minetest)
73 fi
74 cd minetest
75 git_hash=`git show | head -c14 | tail -c7`
76
77 # Get minetest_game
78 cd games
79 if [ "x$NO_MINETEST_GAME" = "x" ]; then
80         [ -d minetest_game ] && (cd minetest_game && git pull) || (git clone https://github.com/minetest/minetest_game)
81 fi
82 cd ../..
83
84 # Build the thing
85 cd minetest
86 [ -d _build ] && rm -Rf _build/
87 mkdir _build
88 cd _build
89 cmake .. \
90         -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
91         -DCMAKE_INSTALL_PREFIX=/tmp \
92         -DVERSION_EXTRA=$git_hash \
93         -DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
94         \
95         -DENABLE_SOUND=1 \
96         -DENABLE_CURL=1 \
97         -DENABLE_GETTEXT=1 \
98         -DENABLE_FREETYPE=1 \
99         -DENABLE_LEVELDB=1 \
100         \
101         -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht-$irrlicht_version/include \
102         -DIRRLICHT_LIBRARY=$libdir/irrlicht-$irrlicht_version/lib/Win64-gcc/libIrrlicht.dll.a \
103         -DIRRLICHT_DLL=$libdir/irrlicht-$irrlicht_version/bin/Win64-gcc/Irrlicht.dll \
104         \
105         -DZLIB_INCLUDE_DIR=$libdir/zlib/include \
106         -DZLIB_LIBRARIES=$libdir/zlib/lib/libz.dll.a \
107         -DZLIB_DLL=$libdir/zlib/bin/zlib1.dll \
108         \
109         -DLUA_INCLUDE_DIR=$libdir/luajit/include \
110         -DLUA_LIBRARY=$libdir/luajit/libluajit.a \
111         \
112         -DOGG_INCLUDE_DIR=$libdir/libogg/include \
113         -DOGG_LIBRARY=$libdir/libogg/lib/libogg.dll.a \
114         -DOGG_DLL=$libdir/libogg/bin/libogg-0.dll \
115         \
116         -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
117         -DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \
118         -DVORBIS_DLL=$libdir/libvorbis/bin/libvorbis-0.dll \
119         -DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
120         -DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \
121         \
122         -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \
123         -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \
124         -DOPENAL_DLL=$libdir/openal_stripped/bin/OpenAL32.dll \
125         \
126         -DCURL_DLL=$libdir/libcurl/bin/libcurl-4.dll \
127         -DCURL_INCLUDE_DIR=$libdir/libcurl/include \
128         -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \
129         \
130         -DFREETYPE_INCLUDE_DIR_freetype2=$libdir/freetype/include/freetype2 \
131         -DFREETYPE_INCLUDE_DIR_ft2build=$libdir/freetype/include/freetype2 \
132         -DFREETYPE_LIBRARY=$libdir/freetype/lib/libfreetype.dll.a \
133         -DFREETYPE_DLL=$libdir/freetype/bin/libfreetype-6.dll \
134         \
135         -DLEVELDB_INCLUDE_DIR=$libdir/leveldb/include \
136         -DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
137         -DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll \
138         \
139         -DCUSTOM_GETTEXT_PATH=$libdir/gettext \
140         -DGETTEXT_MSGFMT=`which msgfmt` \
141         -DGETTEXT_DLL=$libdir/gettext/bin/libintl-8.dll \
142         -DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv-2.dll \
143         -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
144         -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a
145
146 make package -j2
147
148 # EOF