4 misc/tools/xonotic-map-compiler-autobuild download
8 msg "Usage: ./all compile-map mapname1 mapname2 mapname3"
9 msg "For example: ./all compile-map dance xoylent"
11 if ! [ -f "netradiant/install/q3map2" ] ; then
12 msg "q3map2 needed! Building netradiant..."
13 make -C netradiant BUILD=native install/q3map2
15 for mapfile in "$@"; do
16 mapfile="data/xonotic-maps.pk3dir/maps/$mapfile.map"
17 if [ ! -f "$mapfile" ] ; then
18 msg "ERROR, $mapfile not found!"
20 verbose measure_time misc/tools/xonotic-map-compiler-optionsfile "$mapfile"
34 export CC="$CC -DSUPPORTIPV6"
66 case "`$CC -dumpversion`" in
67 [5-9]*|[1-9][0-9]*|4.[3-9]*|4.[1-9][0-9]*)
69 # -march=native is broken < 4.3
70 if $CC -mtune=native -march=native misc/tools/conftest.c -o conftest >/dev/null 2>&1; then
71 export CC="$CC -mtune=native -march=native"
75 if [ -n "$WE_HATE_OUR_USERS" ]; then
76 export CC="$CC -fno-common"
86 if [ x"`uname`" = x"Darwin" ]; then
87 TARGETS="sv-$debug sdl-$debug"
88 export CC="$CC -fno-reorder-blocks"
90 TARGETS="sv-$debug cl-$debug sdl-$debug"
93 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
94 # if we give the command make the arg "", it will surely fail (invalid filename),
95 # so better handle it as an empty client option
98 elif [ -n "$1" ]; then
100 TARGETS_SAVE=$TARGETS
105 TARGETS="$TARGETS sdl-$debug"
108 TARGETS="$TARGETS cl-$debug"
111 TARGETS="$TARGETS sv-$debug"
114 BAD_TARGETS="$BAD_TARGETS $X"
118 if [ -n "$TARGETS" ]; then # at least a valid client
120 else # no valid client, let's assume this option is not meant to be a client then
121 TARGETS=$TARGETS_SAVE
126 if [ -z "$MAKE" ]; then
130 if [ -z "$MAKEFLAGS" ]; then
131 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
132 if [ $ncpus -gt 1 ]; then
135 if [ -n "$WE_HATE_OUR_USERS" ]; then
136 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
140 if [ -n "$WE_HATE_OUR_USERS" ]; then
144 MAKEFLAGS="$MAKEFLAGS SDL_CONFIG=$d0/misc/builddeps/win64/sdl/bin/sdl2-config"
147 MAKEFLAGS="$MAKEFLAGS SDL_CONFIG=$d0/misc/builddeps/win32/sdl/bin/sdl2-config"
151 # win32: don't rely on jpeg includes
152 MAKEFLAGS="$MAKEFLAGS LIB_JPEG= CFLAGS_LIBJPEG="
155 if [ x"`uname`" = x"Darwin" ]; then
157 f=$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks
158 MAKEFLAGS="$MAKEFLAGS SDLCONFIG_MACOSXCFLAGS=-I$f/SDL2.framework/Headers SDLCONFIG_MACOSXLIBS=-F$f SDLCONFIG_MACOSXLIBS+=-framework SDLCONFIG_MACOSXLIBS+=SDL2 SDLCONFIG_MACOSXLIBS+=-framework SDLCONFIG_MACOSXLIBS+=Cocoa SDLCONFIG_MACOSXLIBS+=-I$f/SDL2.framework/Headers SDLCONFIG_MACOSXSTATICLIBS=-F$f SDLCONFIG_MACOSXSTATICLIBS+=-framework SDLCONFIG_MACOSXSTATICLIBS+=SDL2 SDLCONFIG_MACOSXSTATICLIBS+=-framework SDLCONFIG_MACOSXSTATICLIBS+=Cocoa SDLCONFIG_MACOSXSTATICLIBS+=-I$f/SDL2.framework/Headers"
161 # workaround ARM issue in DP's makefile.inc
166 MAKEFLAGS="$MAKEFLAGS CFLAGS_SSE= CFLAGS_SSE2="
170 if ! verbose $CC misc/tools/conftest.c -o conftest; then
172 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
173 msg "~~~~~~~~~~ COMPILER ~~~~~~~~~~"
174 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
175 msg "~~~~~~~~~~~~~~_...._~~~~~~~~~~"
176 msg "~~~~~~~~~~~,-' \\\`-._~~~~~~"
177 msg "~~~~~~~~~~/ --. >< \\~~~~~"
178 msg "~~~~~~~~~/ (*)> -<: \\~~~~"
179 msg "~~~~~~~~~( ^~-' (*) )~~~~"
180 msg "~~~~~~~~~\\ ^+-_/ |~~~~"
181 msg "~~~~~~~~~~\\ {vvv} |~~~~"
182 msg "~~~~~~~~~~,\\ , {^^^},/~~~~~"
183 msg "~~~~~~~~,/ \`---.....-'~~W~~~~"
184 msg "~~~~~~,/ \\_____/_\\_W~~/~~~~~"
185 msg "~~~~~/ /~~~\\__/~~~~~~"
186 msg "~~~~/ /~~~~~~~~~~~~~~"
187 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
188 msg "~~~~~~~ Y U NO COMPILE ~~~~~~~"
189 msg "~~~~~~~~~~~~ CODE ~~~~~~~~~~~~"
190 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
196 verbose cd "$d0/d0_blind_id"
197 if [ -z "$compiled0" ]; then
201 # compilation of crypto library failed
202 # use binaries then, if we can...
204 if [ -n "$WE_HATE_OUR_USERS" ]; then
207 verbose cp "$d0/misc/buildfiles/win64/libd0_blind_id"-* .libs/
208 verbose cp "$d0/misc/buildfiles/win64/libd0_rijndael"-* .libs/
209 verbose cp "$d0/misc/buildfiles/win64/libgmp"-* .libs/
213 verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
214 verbose cp "$d0/misc/buildfiles/win32/libd0_rijndael"-* .libs/
215 verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
224 # No cp commands, we want to use static linking instead.
225 export CC="$CC -I../../../../misc/builddeps/linux32/d0_blind_id/include"
226 export CC="$CC -L../../../../misc/builddeps/linux32/d0_blind_id/lib"
227 export CC="$CC -Wl,-rpath,../../../../misc/builddeps/linux32/d0_blind_id/lib"
228 export CC="$CC -I../../../../misc/builddeps/linux32/gmp/include"
229 export CC="$CC -L../../../../misc/builddeps/linux32/gmp/lib"
230 export CC="$CC -Wl,-rpath,../../../../misc/builddeps/linux32/gmp/lib"
231 MAKEFLAGS="$MAKEFLAGS DP_LINK_CRYPTO=shared DP_LINK_CRYPTO_RIJNDAEL=shared LIB_CRYPTO=../../../../misc/builddeps/linux32/d0_blind_id/lib/libd0_blind_id.a LIB_CRYPTO+=../../../../misc/builddeps/linux32/gmp/lib/libgmp.a LIB_CRYPTO_RIJNDAEL=../../../../misc/builddeps/linux32/d0_blind_id/lib/libd0_rijndael.a"
235 msg "Always need to compile libd0_blind_id on Linux `uname -m`."
240 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
241 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_rijndael".* .libs/
245 msg "Always need to compile libd0_blind_id on `uname`."
252 if [ -f Makefile ]; then
253 verbose $MAKE $MAKEFLAGS distclean
256 if ! [ -f Makefile ]; then
257 verbose sh autogen.sh
260 verbose $MAKE $MAKEFLAGS
263 verbose cd "$d0/gmqcc"
265 verbose $MAKE $MAKEFLAGS clean
267 if [ -n "$WE_HATE_OUR_USERS" ]; then
268 verbose $MAKE $MAKEFLAGS gmqcc.exe
270 verbose $MAKE $MAKEFLAGS gmqcc
273 if [ -n "$MSYSTEM" ]; then
274 DATAMAKE=mingw32-make
278 verbose cd "$d0/data/xonotic-data.pk3dir"
280 verbose ${DATAMAKE} QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS clean
282 verbose ${DATAMAKE} QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS
283 # 4 levels up: data, xonotic-data, qcsrc, server
285 verbose cd "$d0/darkplaces"
286 if [ x"$BAD_TARGETS" = x" " ]; then
287 $ECHO "Warning: invalid empty client, default clients will be used."
290 verbose $MAKE $MAKEFLAGS clean
292 for T in $TARGETS; do
293 verbose $MAKE $MAKEFLAGS STRIP=: "$@" "$T"
295 for T in $BAD_TARGETS; do
296 $ECHO "Warning: discarded invalid client $T."
299 verbose "$SELF" update-maps
302 if [ -n "$WE_HATE_OUR_USERS" ]; then
306 export PATH="$d0/misc/buildfiles/win64:$d0/d0_blind_id/.libs:$PATH"
309 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
312 elif [ x"`uname`" = x"Darwin" ]; then
313 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS:$d0/d0_blind_id/.libs"
314 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
317 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
336 if ! [ -x "darkplaces/darkplaces$client" ]; then
337 if [ -x "darkplaces/darkplaces$client.exe" ]; then
340 $ECHO "Client darkplaces/darkplaces$client not found, aborting"
344 set -- "darkplaces/darkplaces$client" -xonotic "$@"
346 # if pulseaudio is running: USE IT
347 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
348 if ps -C pulseaudio >/dev/null; then
349 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
350 export SDL_AUDIODRIVER=pulse
357 if [ x"$USE_GDB" = x"yes" ]; then
358 set -- gdb --args "$@"
360 elif [ x"$USE_GDB" = x"core" ]; then
361 set -- gdb --batch -x savecore.gdb --args "$@"
363 elif which catchsegv >/dev/null 2>&1; then
364 set -- catchsegv "$@"
366 if [ x"$USE_RLWRAP" != x"no" ] && which rlwrap >/dev/null 2>&1; then
367 set -- rlwrap -A -g '^quit' -q "\"" -s 10000 -S ']' -w 100 "$@"
370 verbose measure_time "$@" || true
371 if [ -f xonotic.core ]; then
372 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
373 gdb "$binary" xonotic.core
374 #elif yesno "You did not want to examine the core dump. Do you want to provide it - including your DarkPlaces checkout - to the Xonotic developers?"; then
375 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
377 # rm -f xonotic.core.tar.gz
379 $ECHO "The core dump can be examined later by"
380 $ECHO " gdb $binary xonotic.core"
386 $ECHO " $SELF compile [-c] [-qc] [-r|-p] [-0] [sdl|glx|wgl|dedicated]"
387 $ECHO " $SELF update-maps"
388 $ECHO " $SELF run [sdl|glx|wgl|dedicated] options..."
389 $ECHO " $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"
393 # TODO(rpolzer): Why does :anticheat: output differ? Total game time differs? Why?
394 verbose "$SELF" run "$@" -noconfig -nohome +exec serverbench.cfg |\
397 grep -v '^:gamestart:' |\
398 grep -v '^:anticheat:' |\