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 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 time misc/tools/xonotic-map-compiler-optionsfile "$mapfile"
35 export CC="$CC -DSUPPORTIPV6"
59 case "`$CC -dumpversion`" in
60 [5-9]*|[1-9][0-9]*|4.[3-9]*|4.[1-9][0-9]*)
62 # -march=native is broken < 4.3
63 if $CC -mtune=native -march=native misc/tools/conftest.c -o conftest >/dev/null 2>&1; then
64 export CC="$CC -mtune=native -march=native"
68 if [ -n "$WE_HATE_OUR_USERS" ]; then
69 export CC="$CC -fno-common"
78 if [ -n "$WE_HATE_OUR_USERS" ]; then
79 TARGETS="sv-$debug cl-$debug"
80 elif [ x"`uname`" = x"Darwin" ]; then
83 TARGETS="sv-$debug cl-$debug sdl-$debug"
86 # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
88 TARGETS="sv-$debug sdl-$debug"
91 export CC="$CC -fno-reorder-blocks -I$PWD/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks/SDL.framework/Headers -F$PWD/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
93 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"
111 if $snowleopardhack; then
112 export CC="$CC -arch i386"
116 TARGETS="$TARGETS cl-$debug"
119 TARGETS="$TARGETS sv-$debug"
122 BAD_TARGETS="$BAD_TARGETS $X"
126 if [ -n "$TARGETS" ]; then # at least a valid client
128 else # no valid client, let's assume this option is not meant to be a client then
129 TARGETS=$TARGETS_SAVE
133 if [ -z "$MAKEFLAGS" ]; then
134 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
135 if [ $ncpus -gt 1 ]; then
138 if [ -n "$WE_HATE_OUR_USERS" ]; then
139 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
143 # win32: don't rely on jpeg includes
144 if [ -n "$WE_HATE_OUR_USERS" ]; then
145 MAKEFLAGS="$MAKEFLAGS LIB_JPEG= CFLAGS_LIBJPEG="
148 # workaround ARM issue in DP's makefile.inc
153 MAKEFLAGS="$MAKEFLAGS CFLAGS_SSE= CFLAGS_SSE2="
157 if ! verbose $CC misc/tools/conftest.c -o conftest; then
159 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
160 msg "~~~~~~~~~~ COMPILER ~~~~~~~~~~"
161 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
162 msg "~~~~~~~~~~~~~~_...._~~~~~~~~~~"
163 msg "~~~~~~~~~~~,-' \\\`-._~~~~~~"
164 msg "~~~~~~~~~~/ --. >< \\~~~~~"
165 msg "~~~~~~~~~/ (*)> -<: \\~~~~"
166 msg "~~~~~~~~~( ^~-' (*) )~~~~"
167 msg "~~~~~~~~~\\ ^+-_/ |~~~~"
168 msg "~~~~~~~~~~\\ {vvv} |~~~~"
169 msg "~~~~~~~~~~,\\ , {^^^},/~~~~~"
170 msg "~~~~~~~~,/ \`---.....-'~~W~~~~"
171 msg "~~~~~~,/ \\_____/_\\_W~~/~~~~~"
172 msg "~~~~~/ /~~~\\__/~~~~~~"
173 msg "~~~~/ /~~~~~~~~~~~~~~"
174 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
175 msg "~~~~~~~ Y U NO COMPILE ~~~~~~~"
176 msg "~~~~~~~~~~~~ CODE ~~~~~~~~~~~~"
177 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
183 verbose cd "$d0/d0_blind_id"
184 if ! $compiled0; then
185 # compilation of crypto library failed
186 # use binaries then, if we can...
188 if [ -n "$WE_HATE_OUR_USERS" ]; then
189 verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
190 verbose cp "$d0/misc/buildfiles/win32/libd0_rijndael"-* .libs/
191 verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
197 #verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_blind_id".* .libs/
198 #verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_rijndael".* .libs/
199 #verbose cp "$d0/misc/builddeps/dp.linux64/lib/libgmp".* .libs/
200 # FIXME(whoeverwantsto) get rid of this -I flag, as we just can't do this (the directory has other stuff, e.g. jpeg, inside).
201 # FIXME(whoeverwantsto) maybe use the cp commands from above again, and load via dlopen again? Needs evaluation of whether they work.
202 export CC="$CC -I../../../../misc/builddeps/dp.linux32/include"
203 export CC="$CC -L../../../../misc/builddeps/dp.linux32/lib"
204 export CC="$CC -Wl,-rpath,../../../../misc/builddeps/dp.linux32/lib"
205 MAKEFLAGS="$MAKEFLAGS DP_LINK_CRYPTO=shared DP_LINK_CRYPTO_RIJNDAEL=shared LIB_CRYPTO=../../../../misc/builddeps/dp.linux64/lib/libd0_blind_id.a LIB_CRYPTO+=../../../../misc/builddeps/dp.linux64/lib/libgmp.a LIB_CRYPTO_RIJNDAEL=../../../../misc/builddeps/dp.linux64/lib/libd0_rijndael.a"
208 #verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_blind_id".* .libs/
209 #verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_rijndael".* .libs/
210 #verbose cp "$d0/misc/builddeps/dp.linux32/lib/libgmp".* .libs/
211 # FIXME(whoeverwantsto) get rid of this -I flag, as we just can't do this (the directory has other stuff, e.g. jpeg, inside).
212 # FIXME(whoeverwantsto) maybe use the cp commands from above again, and load via dlopen again? Needs evaluation of whether they work.
213 export CC="$CC -I../../../../misc/builddeps/dp.linux32/include"
214 export CC="$CC -L../../../../misc/builddeps/dp.linux32/lib"
215 export CC="$CC -Wl,-rpath,../../../../misc/builddeps/dp.linux32/lib"
216 MAKEFLAGS="$MAKEFLAGS DP_LINK_CRYPTO=shared DP_LINK_CRYPTO_RIJNDAEL=shared LIB_CRYPTO=../../../../misc/builddeps/dp.linux32/lib/libd0_blind_id.a LIB_CRYPTO+=../../../../misc/builddeps/dp.linux32/lib/libgmp.a LIB_CRYPTO_RIJNDAEL=../../../../misc/builddeps/dp.linux32/lib/libd0_rijndael.a"
224 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
225 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_rijndael".* .libs/
235 if [ -f Makefile ]; then
236 verbose make $MAKEFLAGS distclean
239 if ! [ -f Makefile ]; then
240 verbose sh autogen.sh
243 verbose make $MAKEFLAGS
246 verbose cd "$d0/gmqcc"
248 verbose make $MAKEFLAGS clean
250 if [ -n "$WE_HATE_OUR_USERS" ]; then
251 verbose make $MAKEFLAGS gmqcc.exe
253 verbose make $MAKEFLAGS gmqcc
256 verbose cd "$d0/data/xonotic-data.pk3dir"
258 verbose make QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS clean
260 verbose make QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS
261 # 4 levels up: data, xonotic-data, qcsrc, server
263 verbose cd "$d0/darkplaces"
264 if [ x"$BAD_TARGETS" = x" " ]; then
265 $ECHO "Warning: invalid empty client, default clients will be used."
268 verbose make $MAKEFLAGS clean
270 for T in $TARGETS; do
271 verbose make $MAKEFLAGS STRIP=: "$@" "$T"
273 for T in $BAD_TARGETS; do
274 $ECHO "Warning: discarded invalid client $T."
277 verbose "$SELF" update-maps
280 if [ -n "$WE_HATE_OUR_USERS" ]; then
282 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
283 elif [ x"`uname`" = x"Darwin" ]; then
284 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS:$d0/d0_blind_id/.libs"
285 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
288 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
307 if ! [ -x "darkplaces/darkplaces$client" ]; then
308 if [ -x "darkplaces/darkplaces$client.exe" ]; then
311 $ECHO "Client darkplaces/darkplaces$client not found, aborting"
315 set -- "darkplaces/darkplaces$client" -xonotic "$@"
317 # if pulseaudio is running: USE IT
318 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
319 if ps -C pulseaudio >/dev/null; then
320 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
321 export SDL_AUDIODRIVER=pulse
328 if [ x"$USE_GDB" = x"yes" ]; then
329 set -- gdb --args "$@"
331 elif [ x"$USE_GDB" = x"core" ]; then
332 set -- gdb --batch -x savecore.gdb --args "$@"
334 elif which catchsegv >/dev/null 2>&1; then
335 set -- catchsegv "$@"
337 if [ x"$USE_RLWRAP" != x"no" ] && which rlwrap >/dev/null 2>&1; then
338 set -- rlwrap -A -g '^quit' -q "\"" -r -S ']' -w 100 "$@"
342 if [ -f xonotic.core ]; then
343 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
344 gdb "$binary" xonotic.core
345 #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
346 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
348 # rm -f xonotic.core.tar.gz
350 $ECHO "The core dump can be examined later by"
351 $ECHO " gdb $binary xonotic.core"
357 $ECHO " $SELF compile [-c] [-r|-p] [-0] [sdl|glx|wgl|agl|dedicated]"
358 $ECHO " $SELF update-maps"
359 $ECHO " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
360 $ECHO " $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"