]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/all/xonotic.subr
Explicitly specify linking of all autobuild engine libs
[xonotic/xonotic.git] / misc / tools / all / xonotic.subr
index 2be0bdff438c6bfa084afbc99324ea40184748db..ed69868601535f7b482f3cbe6e78f28235227c3e 100644 (file)
@@ -28,11 +28,10 @@ case "$cmd" in
                cleanqcc=false
                cleanqc=false
                compiled0=
-               debug=debug
+               debug=release  # when changing this default, change the description in the zsh autocompletion script
                if [ -z "$CC" ]; then
                        export CC="gcc"
                fi
-               export CC="$CC -DSUPPORTIPV6"
                while :; do
                        case "$1" in
                                -0)
@@ -54,8 +53,11 @@ case "$cmd" in
                                        cleanqc=true
                                        shift
                                        ;;
-                               -r|-p)
+                               -d|-p|-r)
                                        case "$1" in
+                                               -d)
+                                                       debug=debug
+                                                       ;;
                                                -p)
                                                        debug=profile
                                                        ;;
@@ -131,19 +133,11 @@ case "$cmd" in
                        if [ -n "$WE_HATE_OUR_USERS" ]; then
                                MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
                        fi
+               elif echo $MAKEFLAGS | head -c1 | grep -qv -; then # MAKEFLAGS starts with a single letter option
+                       MAKEFLAGS=-$(echo $MAKEFLAGS)                  # echo here and above will trim whitespaces
                fi
 
                if [ -n "$WE_HATE_OUR_USERS" ]; then
-                       # win32: use SDL2
-                       case `uname -m` in
-                               x86_64)
-                                       MAKEFLAGS="$MAKEFLAGS SDL_CONFIG=$d0/misc/builddeps/win64/sdl/bin/sdl2-config"
-                                       ;;
-                               *)
-                                       MAKEFLAGS="$MAKEFLAGS SDL_CONFIG=$d0/misc/builddeps/win32/sdl/bin/sdl2-config"
-                                       ;;
-                       esac
-
                        # win32: don't rely on jpeg includes
                        MAKEFLAGS="$MAKEFLAGS LIB_JPEG= CFLAGS_LIBJPEG="
                fi
@@ -193,65 +187,12 @@ case "$cmd" in
                if [ -z "$compiled0" ]; then
                        # In doubt, compile.
                        compiled0=true
-
-                       # compilation of crypto library failed
-                       # use binaries then, if we can...
-                       mkdir -p .libs
-                       if [ -n "$WE_HATE_OUR_USERS" ]; then
-                               case `uname -m` in
-                                       x86_64)
-                                               verbose cp "$d0/misc/buildfiles/win64/libd0_blind_id"-* .libs/
-                                               verbose cp "$d0/misc/buildfiles/win64/libd0_rijndael"-* .libs/
-                                               verbose cp "$d0/misc/buildfiles/win64/libgmp"-* .libs/
-                                               compiled0=false
-                                               ;;
-                                       *)
-                                               verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
-                                               verbose cp "$d0/misc/buildfiles/win32/libd0_rijndael"-* .libs/
-                                               verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
-                                               compiled0=false
-                                               ;;
-                               esac
-                       else
-                               case "`uname`" in
-                                       Linux)
-                                               case `uname -m` in
-                                                       *86)
-                                                               # No cp commands, we want to use static linking instead.
-                                                               export CC="$CC -I../../../../misc/builddeps/linux32/d0_blind_id/include"
-                                                               export CC="$CC -L../../../../misc/builddeps/linux32/d0_blind_id/lib"
-                                                               export CC="$CC -Wl,-rpath,../../../../misc/builddeps/linux32/d0_blind_id/lib"
-                                                               export CC="$CC -I../../../../misc/builddeps/linux32/gmp/include"
-                                                               export CC="$CC -L../../../../misc/builddeps/linux32/gmp/lib"
-                                                               export CC="$CC -Wl,-rpath,../../../../misc/builddeps/linux32/gmp/lib"
-                                                               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"
-                                                               compiled0=false
-                                                               ;;
-                                                       *)
-                                                               msg "Always need to compile libd0_blind_id on Linux `uname -m`."
-                                                               ;;
-                                               esac
-                                               ;;
-                                       Darwin)
-                                               verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
-                                               verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_rijndael".* .libs/
-                                               compiled0=false
-                                               ;;
-                                       *)
-                                               msg "Always need to compile libd0_blind_id on `uname`."
-                                               ;;
-                               esac
-                       fi
                fi
                if $compiled0; then
+                       verbose sh autogen.sh
+                       verbose ./configure
                        if $cleand0; then
-                               if [ -f Makefile ]; then
-                                       verbose $MAKE $MAKEFLAGS distclean
-                               fi
-                       fi
-                       if ! [ -f Makefile ]; then
-                               verbose sh autogen.sh
-                               verbose ./configure
+                               verbose $MAKE $MAKEFLAGS distclean
                        fi
                        verbose $MAKE $MAKEFLAGS
                fi
@@ -334,15 +275,6 @@ case "$cmd" in
                fi
                set -- "darkplaces/darkplaces$client" -xonotic "$@"
 
-               # if pulseaudio is running: USE IT
-               if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
-                       if ps -C pulseaudio >/dev/null; then
-                               if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
-                                       export SDL_AUDIODRIVER=pulse
-                               fi
-                       fi
-               fi
-
                binary=$1
 
                if [ x"$USE_GDB" = x"yes" ]; then
@@ -374,7 +306,7 @@ case "$cmd" in
                fi
                ;;
        help)
-               $ECHO "  $SELF compile [-c] [-qc] [-r|-p] [-0] [-1] [sdl|dedicated]"
+               $ECHO "  $SELF compile [-c] [-qc] [-d|-p|-r] [-0] [-1] [sdl|dedicated]"
                $ECHO "  $SELF update-maps"
                $ECHO "  $SELF run [sdl|dedicated] options..."
                $ECHO "  $SELF compile-map mapname1 mapname2... (e.g. \"./all compile-map dance drain fuse\")"
@@ -382,7 +314,9 @@ case "$cmd" in
                ;;
        serverbench)
                # TODO(rpolzer): Why does :anticheat: output differ? Total game time differs? Why?
-               verbose "$SELF" run "$@" -noconfig -nohome +exec serverbench.cfg |\
+               trap "rm -rf .serverbench_temp" 0 1 2 3 11 13 15
+               mkdir -p .serverbench_temp
+               verbose "$SELF" run dedicated "$@" -noconfig -userdir .serverbench_temp +exec serverbench.cfg |\
                        tee /dev/stderr |\
                        grep '^:' |\
                        grep -v '^:gamestart:' |\