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.x86" ] ; then
12 msg "q3map2 needed! Building netradiant..."
17 for mapfile in $@ ; do
18 mapfile="data/xonotic-maps.pk3dir/maps/$1.map"
19 if [ ! -f "$mapfile" ] ; then
20 msg "ERROR, $mapfile not found!"
22 time misc/tools/xonotic-map-compiler_from_all $mapfile
37 export CC="$CC -DSUPPORTIPV6"
61 case "`$CC -dumpversion`" in
62 [5-9]*|[1-9][0-9]*|4.[3-9]*|4.[1-9][0-9]*)
64 # -march=native is broken < 4.3
65 if $CC -mtune=native -march=native misc/tools/conftest.c -o conftest >/dev/null 2>&1; then
66 export CC="$CC -mtune=native -march=native"
70 if [ -n "$WE_HATE_OUR_USERS" ]; then
71 export CC="$CC -fno-common"
80 if [ -n "$WE_HATE_OUR_USERS" ]; then
81 TARGETS="sv-$debug cl-$debug"
82 elif [ x"`uname`" = x"Darwin" ]; then
85 TARGETS="sv-$debug cl-$debug sdl-$debug"
88 # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
90 TARGETS="sv-$debug sdl-$debug"
93 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"
95 TARGETS="sv-$debug cl-$debug sdl-$debug"
97 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
98 # if we give the command make the arg "", it will surely fail (invalid filename),
99 # so better handle it as an empty client option
102 elif [ -n "$1" ]; then
104 TARGETS_SAVE=$TARGETS
109 TARGETS="$TARGETS sdl-$debug"
112 TARGETS="$TARGETS cl-$debug"
113 if $snowleopardhack; then
114 export CC="$CC -arch i386"
118 TARGETS="$TARGETS cl-$debug"
121 TARGETS="$TARGETS sv-$debug"
124 BAD_TARGETS="$BAD_TARGETS $X"
128 if [ -n "$TARGETS" ]; then # at least a valid client
130 else # no valid client, let's assume this option is not meant to be a client then
131 TARGETS=$TARGETS_SAVE
135 if [ -z "$MAKEFLAGS" ]; then
136 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
137 if [ $ncpus -gt 1 ]; then
140 if [ -n "$WE_HATE_OUR_USERS" ]; then
141 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
145 # workaround ARM issue in DP's makefile.inc
150 MAKEFLAGS="$MAKEFLAGS CFLAGS_SSE= CFLAGS_SSE2="
154 if ! verbose $CC misc/tools/conftest.c -o conftest; then
156 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
157 msg "~~~~~~~~~~ COMPILER ~~~~~~~~~~"
158 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
159 msg "~~~~~~~~~~~~~~_...._~~~~~~~~~~"
160 msg "~~~~~~~~~~~,-' \\\`-._~~~~~~"
161 msg "~~~~~~~~~~/ --. >< \\~~~~~"
162 msg "~~~~~~~~~/ (*)> -<: \\~~~~"
163 msg "~~~~~~~~~( ^~-' (*) )~~~~"
164 msg "~~~~~~~~~\\ ^+-_/ |~~~~"
165 msg "~~~~~~~~~~\\ {vvv} |~~~~"
166 msg "~~~~~~~~~~,\\ , {^^^},/~~~~~"
167 msg "~~~~~~~~,/ \`---.....-'~~W~~~~"
168 msg "~~~~~~,/ \\_____/_\\_W~~/~~~~~"
169 msg "~~~~~/ /~~~\\__/~~~~~~"
170 msg "~~~~/ /~~~~~~~~~~~~~~"
171 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
172 msg "~~~~~~~ Y U NO COMPILE ~~~~~~~"
173 msg "~~~~~~~~~~~~ CODE ~~~~~~~~~~~~"
174 msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
180 verbose cd "$d0/d0_blind_id"
181 if ! $compiled0; then
182 # compilation of crypto library failed
183 # use binaries then, if we can...
185 if [ -n "$WE_HATE_OUR_USERS" ]; then
186 verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
187 verbose cp "$d0/misc/buildfiles/win32/libd0_rijndael"-* .libs/
188 verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
194 #verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_blind_id".* .libs/
195 #verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_rijndael".* .libs/
196 #verbose cp "$d0/misc/builddeps/dp.linux64/lib/libgmp".* .libs/
197 MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/ DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/ DP_GMP_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/"
200 #verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_blind_id".* .libs/
201 #verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_rijndael".* .libs/
202 #verbose cp "$d0/misc/builddeps/dp.linux32/lib/libgmp".* .libs/
203 MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/ DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/ DP_GMP_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/"
211 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
212 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_rijndael".* .libs/
222 if [ -f Makefile ]; then
223 verbose make $MAKEFLAGS distclean
226 if ! [ -f Makefile ]; then
227 verbose sh autogen.sh
230 verbose make $MAKEFLAGS
233 verbose cd "$d0/gmqcc"
235 verbose make $MAKEFLAGS clean
237 if [ -n "$WE_HATE_OUR_USERS" ]; then
238 verbose make $MAKEFLAGS gmqcc.exe
240 verbose make $MAKEFLAGS gmqcc
243 verbose cd "$d0/data/xonotic-data.pk3dir"
245 verbose make QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS clean
247 verbose make QCC="../../../../gmqcc/gmqcc" "$@" $MAKEFLAGS
248 # 4 levels up: data, xonotic-data, qcsrc, server
250 verbose cd "$d0/darkplaces"
251 if [ x"$BAD_TARGETS" = x" " ]; then
252 $ECHO "Warning: invalid empty client, default clients will be used."
255 verbose make $MAKEFLAGS clean
257 for T in $TARGETS; do
258 verbose make $MAKEFLAGS STRIP=: "$@" "$T"
260 for T in $BAD_TARGETS; do
261 $ECHO "Warning: discarded invalid client $T."
264 verbose "$SELF" update-maps
267 if [ -n "$WE_HATE_OUR_USERS" ]; then
269 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
270 elif [ x"`uname`" = x"Darwin" ]; then
271 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS:$d0/d0_blind_id/.libs"
272 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
275 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
294 if ! [ -x "darkplaces/darkplaces$client" ]; then
295 if [ -x "darkplaces/darkplaces$client.exe" ]; then
298 $ECHO "Client darkplaces/darkplaces$client not found, aborting"
302 set -- "darkplaces/darkplaces$client" -xonotic "$@"
304 # if pulseaudio is running: USE IT
305 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
306 if ps -C pulseaudio >/dev/null; then
307 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
308 export SDL_AUDIODRIVER=pulse
315 if [ x"$USE_GDB" = x"yes" ]; then
316 set -- gdb --args "$@"
318 elif [ x"$USE_GDB" = x"core" ]; then
319 set -- gdb --batch -x savecore.gdb --args "$@"
321 elif which catchsegv >/dev/null 2>&1; then
322 set -- catchsegv "$@"
324 if [ x"$USE_RLWRAP" != x"no" ] && which rlwrap >/dev/null 2>&1; then
325 set -- rlwrap -A -g '^quit' -q "\"" -r -S ']' -w 100 "$@"
329 if [ -f xonotic.core ]; then
330 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
331 gdb "$binary" xonotic.core
332 #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
333 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
335 # rm -f xonotic.core.tar.gz
337 $ECHO "The core dump can be examined later by"
338 $ECHO " gdb $binary xonotic.core"
344 $ECHO " $SELF compile [-c] [-r|-p] [-0] [sdl|glx|wgl|agl|dedicated]"
345 $ECHO " $SELF update-maps"
346 $ECHO " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
347 $ECHO " $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"