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"
89 elif [ -n "$WE_HATE_OUR_USERS" ]; then
90 TARGETS="sv-$debug sdl-$debug"
92 TARGETS="sv-$debug cl-$debug sdl-$debug"
95 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
96 # if we give the command make the arg "", it will surely fail (invalid filename),
97 # so better handle it as an empty client option
100 elif [ -n "$1" ]; then
102 TARGETS_SAVE=$TARGETS
107 TARGETS="$TARGETS sdl-$debug"
110 TARGETS="$TARGETS cl-$debug"
113 TARGETS="$TARGETS sv-$debug"
116 BAD_TARGETS="$BAD_TARGETS $X"
120 if [ -n "$TARGETS" ]; then # at least a valid client
122 else # no valid client, let's assume this option is not meant to be a client then
123 TARGETS=$TARGETS_SAVE
128 if [ -z "$MAKE" ]; then
132 if [ -z "$MAKEFLAGS" ]; then
133 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
134 if [ $ncpus -gt 1 ]; then
137 if [ -n "$WE_HATE_OUR_USERS" ]; then
138 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
142 if [ -n "$WE_HATE_OUR_USERS" ]; then
146 MAKEFLAGS="$MAKEFLAGS SDL_CONFIG=$d0/misc/builddeps/win64/sdl/bin/sdl2-config"
149 MAKEFLAGS="$MAKEFLAGS SDL_CONFIG=$d0/misc/builddeps/win32/sdl/bin/sdl2-config"
153 # win32: don't rely on jpeg includes
154 MAKEFLAGS="$MAKEFLAGS LIB_JPEG= CFLAGS_LIBJPEG="
157 if [ x"`uname`" = x"Darwin" ]; then
159 f=$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks
160 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"
163 # workaround ARM issue in DP's makefile.inc
168 MAKEFLAGS="$MAKEFLAGS CFLAGS_SSE= CFLAGS_SSE2="
172 if ! verbose $CC misc/tools/conftest.c -o conftest; then
174 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
175 msg "~~~~~~~~~~ COMPILER ~~~~~~~~~~"
176 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
177 msg "~~~~~~~~~~~~~~_...._~~~~~~~~~~"
178 msg "~~~~~~~~~~~,-' \\\`-._~~~~~~"
179 msg "~~~~~~~~~~/ --. >< \\~~~~~"
180 msg "~~~~~~~~~/ (*)> -<: \\~~~~"
181 msg "~~~~~~~~~( ^~-' (*) )~~~~"
182 msg "~~~~~~~~~\\ ^+-_/ |~~~~"
183 msg "~~~~~~~~~~\\ {vvv} |~~~~"
184 msg "~~~~~~~~~~,\\ , {^^^},/~~~~~"
185 msg "~~~~~~~~,/ \`---.....-'~~W~~~~"
186 msg "~~~~~~,/ \\_____/_\\_W~~/~~~~~"
187 msg "~~~~~/ /~~~\\__/~~~~~~"
188 msg "~~~~/ /~~~~~~~~~~~~~~"
189 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
190 msg "~~~~~~~ Y U NO COMPILE ~~~~~~~"
191 msg "~~~~~~~~~~~~ CODE ~~~~~~~~~~~~"
192 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
198 verbose cd "$d0/d0_blind_id"
199 if [ -z "$compiled0" ]; then
203 # compilation of crypto library failed
204 # use binaries then, if we can...
206 if [ -n "$WE_HATE_OUR_USERS" ]; then
209 verbose cp "$d0/misc/buildfiles/win64/libd0_blind_id"-* .libs/
210 verbose cp "$d0/misc/buildfiles/win64/libd0_rijndael"-* .libs/
211 verbose cp "$d0/misc/buildfiles/win64/libgmp"-* .libs/
215 verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
216 verbose cp "$d0/misc/buildfiles/win32/libd0_rijndael"-* .libs/
217 verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
226 # No cp commands, we want to use static linking instead.
227 export CC="$CC -I../../../../misc/builddeps/linux32/d0_blind_id/include"
228 export CC="$CC -L../../../../misc/builddeps/linux32/d0_blind_id/lib"
229 export CC="$CC -Wl,-rpath,../../../../misc/builddeps/linux32/d0_blind_id/lib"
230 export CC="$CC -I../../../../misc/builddeps/linux32/gmp/include"
231 export CC="$CC -L../../../../misc/builddeps/linux32/gmp/lib"
232 export CC="$CC -Wl,-rpath,../../../../misc/builddeps/linux32/gmp/lib"
233 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"
237 msg "Always need to compile libd0_blind_id on Linux `uname -m`."
242 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
243 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_rijndael".* .libs/
247 msg "Always need to compile libd0_blind_id on `uname`."
254 if [ -f Makefile ]; then
255 verbose $MAKE $MAKEFLAGS distclean
258 if ! [ -f Makefile ]; then
259 verbose sh autogen.sh
262 verbose $MAKE $MAKEFLAGS
265 verbose cd "$d0/gmqcc"
267 verbose $MAKE $MAKEFLAGS clean
269 if [ -n "$WE_HATE_OUR_USERS" ]; then
270 verbose $MAKE $MAKEFLAGS gmqcc.exe
272 verbose $MAKE $MAKEFLAGS gmqcc
275 if [ -n "$MSYSTEM" ]; then
276 DATAMAKE=mingw32-make
280 verbose cd "$d0/data/xonotic-data.pk3dir"
282 verbose ${DATAMAKE} QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS clean
284 verbose ${DATAMAKE} QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS
285 # 4 levels up: data, xonotic-data, qcsrc, server
287 verbose cd "$d0/darkplaces"
288 if [ x"$BAD_TARGETS" = x" " ]; then
289 $ECHO "Warning: invalid empty client, default clients will be used."
292 verbose $MAKE $MAKEFLAGS clean
294 for T in $TARGETS; do
295 verbose $MAKE $MAKEFLAGS STRIP=: "$@" "$T"
297 for T in $BAD_TARGETS; do
298 $ECHO "Warning: discarded invalid client $T."
301 verbose "$SELF" update-maps
304 if [ -n "$WE_HATE_OUR_USERS" ]; then
307 export PATH="$d0/misc/buildfiles/win64:$d0/d0_blind_id/.libs:$PATH"
310 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
313 elif [ x"`uname`" = x"Darwin" ]; then
314 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS:$d0/d0_blind_id/.libs"
315 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}"
337 if ! [ -x "darkplaces/darkplaces$client" ]; then
338 if [ -x "darkplaces/darkplaces$client.exe" ]; then
341 $ECHO "Client darkplaces/darkplaces$client not found, aborting"
345 set -- "darkplaces/darkplaces$client" -xonotic "$@"
347 # if pulseaudio is running: USE IT
348 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
349 if ps -C pulseaudio >/dev/null; then
350 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
351 export SDL_AUDIODRIVER=pulse
358 if [ x"$USE_GDB" = x"yes" ]; then
359 set -- gdb --args "$@"
361 elif [ x"$USE_GDB" = x"core" ]; then
362 set -- gdb --batch -x savecore.gdb --args "$@"
364 elif which catchsegv >/dev/null 2>&1; then
365 set -- catchsegv "$@"
367 if [ x"$USE_RLWRAP" != x"no" ] && which rlwrap >/dev/null 2>&1; then
368 set -- rlwrap -A -g '^quit' -q "\"" -s 10000 -S ']' -w 100 "$@"
371 verbose measure_time "$@" || true
372 if [ -f xonotic.core ]; then
373 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
374 gdb "$binary" xonotic.core
375 #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
376 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
378 # rm -f xonotic.core.tar.gz
380 $ECHO "The core dump can be examined later by"
381 $ECHO " gdb $binary xonotic.core"
387 $ECHO " $SELF compile [-c] [-qc] [-r|-p] [-0] [-1] [sdl|glx|dedicated]"
388 $ECHO " $SELF update-maps"
389 $ECHO " $SELF run [sdl|glx|dedicated] options..."
390 $ECHO " $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"
394 # TODO(rpolzer): Why does :anticheat: output differ? Total game time differs? Why?
395 verbose "$SELF" run "$@" -noconfig -nohome +exec serverbench.cfg |\
398 grep -v '^:gamestart:' |\
399 grep -v '^:anticheat:' |\