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/build/q3map2" ] ; then
12 msg "q3map2 needed! Building q3map2..."
13 cmake -H'netradiant' -B'netradiant/build' -G'Unix Makefiles' -D'CMAKE_BUILD_TYPE=Release' -DBUILD_RADIANT=OFF -DDOWNLOAD_GAMEPACKS=OFF
14 cmake --build 'netradiant/build' -- q3map2
16 for mapfile in "$@"; do
17 mapfile="data/xonotic-maps.pk3dir/maps/$mapfile.map"
18 if [ ! -f "$mapfile" ] ; then
19 msg "ERROR, $mapfile not found!"
21 verbose measure_time misc/tools/xonotic-map-compiler-optionsfile "$mapfile"
31 debug=release # when changing this default, change the description in the zsh autocompletion script
69 case "`$CC -dumpversion`" in
70 [5-9]*|[1-9][0-9]*|4.[3-9]*|4.[1-9][0-9]*)
72 # -march=native is broken < 4.3
73 if $CC -mtune=native -march=native misc/tools/conftest.c -o conftest >/dev/null 2>&1; then
74 export CC="$CC -mtune=native -march=native"
78 if [ -n "$WE_HATE_OUR_USERS" ]; then
79 export CC="$CC -fno-common"
89 TARGETS="sv-$debug sdl-$debug"
90 if [ x"`uname`" = x"Darwin" ]; then
91 export CC="$CC -fno-reorder-blocks"
94 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
95 # if we give the command make the arg "", it will surely fail (invalid filename),
96 # so better handle it as an empty client option
99 elif [ -n "$1" ]; then
101 TARGETS_SAVE=$TARGETS
106 TARGETS="$TARGETS sdl-$debug"
109 TARGETS="$TARGETS sv-$debug"
112 BAD_TARGETS="$BAD_TARGETS $X"
116 if [ -n "$TARGETS" ]; then # at least a valid client
118 else # no valid client, let's assume this option is not meant to be a client then
119 TARGETS=$TARGETS_SAVE
124 if [ -z "$MAKE" ]; then
128 if [ -z "$MAKEFLAGS" ]; then
129 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
130 if [ $ncpus -gt 1 ]; then
133 if [ -n "$WE_HATE_OUR_USERS" ]; then
134 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
136 elif echo $MAKEFLAGS | head -c1 | grep -qv -; then # MAKEFLAGS starts with a single letter option
137 MAKEFLAGS=-$(echo $MAKEFLAGS) # echo here and above will trim whitespaces
140 # workaround ARM issue in DP's makefile.inc
145 MAKEFLAGS="$MAKEFLAGS CFLAGS_SSE= CFLAGS_SSE2="
149 if ! verbose $CC misc/tools/conftest.c -o conftest; then
151 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
152 msg "~~~~~~~~~~ COMPILER ~~~~~~~~~~"
153 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
154 msg "~~~~~~~~~~~~~~_...._~~~~~~~~~~"
155 msg "~~~~~~~~~~~,-' \\\`-._~~~~~~"
156 msg "~~~~~~~~~~/ --. >< \\~~~~~"
157 msg "~~~~~~~~~/ (*)> -<: \\~~~~"
158 msg "~~~~~~~~~( ^~-' (*) )~~~~"
159 msg "~~~~~~~~~\\ ^+-_/ |~~~~"
160 msg "~~~~~~~~~~\\ {vvv} |~~~~"
161 msg "~~~~~~~~~~,\\ , {^^^},/~~~~~"
162 msg "~~~~~~~~,/ \`---.....-'~~W~~~~"
163 msg "~~~~~~,/ \\_____/_\\_W~~/~~~~~"
164 msg "~~~~~/ /~~~\\__/~~~~~~"
165 msg "~~~~/ /~~~~~~~~~~~~~~"
166 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
167 msg "~~~~~~~ Y U NO COMPILE ~~~~~~~"
168 msg "~~~~~~~~~~~~ CODE ~~~~~~~~~~~~"
169 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
175 verbose cd "$d0/d0_blind_id"
176 if [ -z "$compiled0" ]; then
181 if ! [ -f Makefile ]; then
182 verbose sh autogen.sh
186 verbose $MAKE $MAKEFLAGS distclean
187 verbose sh autogen.sh
190 verbose $MAKE $MAKEFLAGS
193 verbose cd "$d0/gmqcc"
195 verbose $MAKE $MAKEFLAGS clean
197 if [ -n "$WE_HATE_OUR_USERS" ]; then
198 verbose $MAKE $MAKEFLAGS gmqcc.exe
200 verbose $MAKE $MAKEFLAGS gmqcc
203 if [ -n "$MSYSTEM" ]; then
204 DATAMAKE=mingw32-make
208 verbose cd "$d0/data/xonotic-data.pk3dir"
210 verbose ${DATAMAKE} QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS clean
212 verbose ${DATAMAKE} QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS
213 # 4 levels up: data, xonotic-data, qcsrc, server
215 verbose cd "$d0/darkplaces"
216 if [ x"$BAD_TARGETS" = x" " ]; then
217 $ECHO "Warning: invalid empty client, default clients will be used."
220 verbose $MAKE $MAKEFLAGS clean
222 for T in $TARGETS; do
223 verbose $MAKE $MAKEFLAGS STRIP=: "$@" "$T"
225 for T in $BAD_TARGETS; do
226 $ECHO "Warning: discarded invalid client $T."
229 verbose "$SELF" update-maps
232 if [ -n "$WE_HATE_OUR_USERS" ]; then
235 export PATH="$d0/misc/buildfiles/win64:$d0/d0_blind_id/.libs:$PATH"
238 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
241 elif [ x"`uname`" = x"Darwin" ]; then
242 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS:$d0/d0_blind_id/.libs"
243 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
245 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
261 if ! [ -x "darkplaces/darkplaces$client" ]; then
262 if [ -x "darkplaces/darkplaces$client.exe" ]; then
265 $ECHO "Client darkplaces/darkplaces$client not found, aborting"
269 set -- "darkplaces/darkplaces$client" -xonotic "$@"
273 if [ x"$USE_GDB" = x"yes" ]; then
274 set -- gdb --args "$@"
276 elif [ x"$USE_GDB" = x"core" ]; then
277 set -- gdb --batch -x savecore.gdb --args "$@"
279 elif which catchsegv >/dev/null 2>&1; then
280 set -- catchsegv "$@"
282 if [ x"$USE_RLWRAP" != x"no" ] && which rlwrap >/dev/null 2>&1; then
283 set -- rlwrap -A -g '^quit' -q "\"" -s 10000 -S ']' -w 100 "$@"
286 verbose measure_time "$@" || true
287 if [ -f xonotic.core ]; then
288 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
289 gdb "$binary" xonotic.core
290 #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
291 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
293 # rm -f xonotic.core.tar.gz
295 $ECHO "The core dump can be examined later by"
296 $ECHO " gdb $binary xonotic.core"
302 $ECHO " $SELF compile [-c] [-qc] [-d|-p|-r] [-0] [-1] [sdl|dedicated]"
303 $ECHO " $SELF update-maps"
304 $ECHO " $SELF run [sdl|dedicated] options..."
305 $ECHO " $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"
309 # TODO(rpolzer): Why does :anticheat: output differ? Total game time differs? Why?
310 trap "rm -rf .serverbench_temp" 0 1 2 3 11 13 15
311 mkdir -p .serverbench_temp
312 verbose "$SELF" run dedicated "$@" -noconfig -userdir .serverbench_temp +exec serverbench.cfg |\
315 grep -v '^:gamestart:' |\
316 grep -v '^:anticheat:' |\