]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/all/release.subr
Fix macOS SDL2 framework permissions
[xonotic/xonotic.git] / misc / tools / all / release.subr
index 3e8fec851e8ea421ee8af8be564bc67f9e4d6a23..54f7c8c5530d5f2760750a499641175b8080f25a 100644 (file)
@@ -2,6 +2,13 @@ release_common()
 {
        export LC_ALL=C
 
+       if [ -z "$MAKEFLAGS" ]; then
+               ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
+               if [ $ncpus -gt 1 ]; then
+                       export MAKEFLAGS=-j$ncpus
+               fi
+       fi
+
        release_args="$cmd $*"
        msg "*** $release_args: start"
        release_starttime=`date +%s`
@@ -29,15 +36,15 @@ release_common()
                # try to create a hardlink
                if ln -f "$release_src/.git/HEAD" "$release_dst/.hardlink-test"; then
                        rm -f "$release_dst/.hardlink-test"
-                       {
-                               verbose cd "$release_src"
-                               git ls-files HEAD -- "$@"
-                       } | {
+                       git -C "$release_src" ls-files HEAD -- "$@" |
                                while IFS= read -r F; do
                                        case "$F" in */*) mkdir -p "$release_dst/${F%/*}" ;; esac
                                        verbose ln -f "$release_src/$F" "$release_dst/$F"
                                done
-                       }
+                       git -C "$release_src" ls-tree -rd --name-only HEAD -- "$@" |
+                               while IFS= read -r D; do
+                                       touch -cr "$release_src/$D" "$release_dst/$D"
+                               done
                else
                        {
                                verbose cd "$release_src"
@@ -53,26 +60,25 @@ release_common()
        {
                archive=$1; shift
 
-               # get rid of this hack once we have done large enough changes
-               # to be no longer rsync compatible (and then enable the below
-               # code)
+               # bones_was_here: 7za still doesn't store symlinks correctly (even with -snl)
+               # but it does now store the executable bit.
+               # compared to advzip, 7za achieves very similar final zip size, is multi threaded,
+               # and avoids https://gitlab.com/xonotic/xonotic/-/issues/371
+
                sevenzipflags=-mx=9
                zipflags=-9
-               find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
+               # git restore-mtime replaces this hack:
+               #find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
                ziplist=`mktemp`
-               find "$@" -xtype f \( -executable -or -type l \) -print | sed 's,\([./][^./]*$\),\1 \1,' | sort -k2 | cut -d\  -f1 > "$ziplist"
+               find "$@" -xtype f \( -type l \) -print | sed 's,\([./][^./]*$\),\1 \1,' | sort -k2 | cut -d\  -f1 > "$ziplist"
                7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
                zip         $zipflags -y   -@<"$ziplist" "$archive"      || true
                rm -f "$ziplist"
-
-               #zipflags=-1r
-               #find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
-               #zip $zipflags -y "$archive" "$@" || true
-               #advzip -4 "$archive"
        }
 
        mkzip()
        {
+               # not using this currently, see above
                archive=$1; shift
                zipflags=-1ry
                zip $zipflags "$archive" "$@" || true
@@ -88,7 +94,7 @@ release_common()
 
        getversion()
        {
-               gv=`grep "^gameversion " "$1/defaultXonotic.cfg" | awk '{ print $2 }'`
+               gv=`grep "^gameversion " "$1/xonotic-common.cfg" | awk '{ print $2 }'`
                major=$(($gv / 10000))
                minor=$((($gv / 100) - ($major * 100)))
                patch=$(($gv - ($major * 10000) - ($minor * 100)))
@@ -130,11 +136,9 @@ case "$cmd" in
                                # - .ssh/config must be configured so the following
                                #   host names are reachable and have a compile
                                #   infrastructure set up:
-                               #   - xonotic-build-linux32 (with gcc on x86)
                                #   - xonotic-build-linux64 (with gcc on x86_64)
-                               #   - xonotic-build-win32 (with i586-mingw32msvc-g++)
-                               #   - xonotic-build-win64 (with amd64-mingw32msvc-g++
-                               #     and amd64-mingw32msvc-g++)
+                               #   - xonotic-build-win32 (with i686-w64-mingw32)
+                               #   - xonotic-build-win64 (with x86_64-w64-mingw32)
                                #   - xonotic-build-osx (with Xcode and SDL.framework)
                                # - AMD Compressonator installed in WINE
                                # - ResEdit installed in WINE
@@ -145,7 +149,7 @@ case "$cmd" in
                                #   (YYYYMMDD)
                                exit 1
                                ;;
-                       release)
+                       release|RC*)
                                msg "Building a FINISHED RELEASE"
                                getversion data/xonotic-data.pk3dir
                                verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
@@ -159,7 +163,7 @@ case "$cmd" in
                if [ -n "$RELEASEDATE" ]; then
                        verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
                        case "$RELEASETYPE" in
-                               release)
+                               release|RC*)
                                        verbose $ECHO "${RELEASEDATE%_*}" > Xonotic/pk3stamp.txt
                                        ;;
                                *)
@@ -170,36 +174,36 @@ case "$cmd" in
                        verbose date +%Y%m%d > Xonotic/stamp.txt
                        verbose date +%Y%m%d > Xonotic/pk3stamp.txt
                fi
-               release_git_extract_dir "." "Xonotic" Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh xonotic-linux-dedicated.sh Makefile misc/buildfiles key_0.d0pk COPYING GPL-2 GPL-3
+               release_git_extract_dir "." "Xonotic" Docs misc/buildfiles/osx misc/logos misc/tools server xonotic-linux-sdl.sh xonotic-linux-dedicated.sh Makefile key_0.d0pk COPYING GPL-2 GPL-3
                (
                        verbose cd Xonotic
-                       verbose mkdir data gmqcc source source/darkplaces source/gmqcc source/d0_blind_id mapping
-                       verbose rm -rf misc/builddeps
-                       verbose mv misc/buildfiles/win32 bin32 || true
-                       verbose mv bin32/SDL.dll . || true
-                       verbose mv misc/buildfiles/win64 bin64 || true
+                       verbose mkdir data source source/darkplaces source/gmqcc source/d0_blind_id mapping
                        verbose mv misc/buildfiles/osx/* . || true
                        verbose rm -rf misc/buildfiles
-                       verbose rm -rf misc/pki
+                       verbose rm -rf misc/tools/all
                )
                release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
                release_git_extract_dir "gmqcc" "Xonotic/source/gmqcc" .
                release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
                release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
-               (
-                       verbose cd Xonotic/source/d0_blind_id
-                       verbose sh autogen.sh
-               )
+# bones_was_here: the main Makefile runs autogen.sh (and configure) when necessary
+#              (
+#                      verbose cd Xonotic/source/d0_blind_id
+#                      verbose sh autogen.sh
+#              )
                rm -f Xonotic/key_15.d0pk
                (
                        verbose cd Xonotic/mapping
-                       verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
-                       verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
-                       for X in *-7z.exe; do
-                               7za x "$X"
-                               rm -f "$X"
-                       done
+                       # bones_was_here: don't ship 10 year old netradiant
+                       # also seems better to update netradiant independently of xonotic versions
+                       #verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
+                       #verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
+                       #for X in *-7z.exe; do
+                       #       7za x "$X"
+                       #       rm -f "$X"
+                       #done
                        # TODO possibly include other tools?
+                       printf "Please find links to NetRadiant builds at https://netradiant.gitlab.io or https://xonotic.org/download\nNetRadiant source available at https://gitlab.com/xonotic/netradiant\n" > NetRadiant\ links.txt
                )
                ./all each git rev-parse HEAD > Xonotic/misc/git-revisions.txt
                ;;
@@ -212,104 +216,203 @@ case "$cmd" in
                srcdir=$5
                depsdir=$6
                targetfiles=$7
+               schroot=
                set -x
-               if [ -n "$targetfiles" ]; then
-                       case " $HOSTS_THAT_ARE_DISABLED " in
-                               *\ $host\ *)
-                                       exit
-                                       ;;
-                       esac
-                       case " $HOSTS_THAT_ARE_MYSELF " in
-                               *\ $host\ *)
-                                       verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
-                                       verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
-                                       verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
-                                       verbose eval make -C "$buildpath" clean $maketargets $makeflags
-                                       for f in $targetfiles; do
-                                               verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
-                                       done
-                                       ;;
-                               *)
-                                       verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
-                                       verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
-                                       verbose ssh "$host" "[ -f /etc/profile ] && . /etc/profile; [ -f ~/.profile ] && . ~/.profile; export LC_ALL=C; ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
-                                       for f in $targetfiles; do
-                                               verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
-                                       done
-                                       ;;
-                       esac
-                       # now rebrand the binaries...
-                       for f in $targetfiles; do
-                               #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
-                               case "${f##*:}" in
-                                       Xonotic/xonotic*.exe)
-                                               verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
-                                               ;;
-                               esac
-                       done
+               if [ -z "$targetfiles" ]; then
+                       exit
                fi
+               case " $HOSTS_THAT_ARE_DISABLED " in
+                       *\ $host\ *)
+                               exit
+                               ;;
+               esac
+               case " $HOSTS_THAT_ARE_SCHROOT " in
+                       *\ $host\ *)
+                               schroot="schroot -c $host --preserve-environment --"
+                               ;;
+               esac
+               case " $HOSTS_THAT_ARE_MYSELF $HOSTS_THAT_ARE_SCHROOT " in
+                       *\ $host\ *)
+                               verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
+                               verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$buildpath"/darkplaces.ico
+                               verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$buildpath.deps/"
+                               verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
+                               verbose eval $schroot make -C "$buildpath" clean $maketargets $makeflags
+                               for f in $targetfiles; do
+                                       verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
+                               done
+                               ;;
+                       *)
+                               verbose rsync --delete -zLvaSHP "$srcdir"/ "$host":"$buildpath/"
+                               verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$host":"$buildpath"/darkplaces.ico
+                               verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$host":"$buildpath.deps/"
+                               verbose ssh "$host" "[ -f /etc/profile ] && . /etc/profile; [ -f ~/.profile ] && . ~/.profile; export LC_ALL=C; ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
+                               for f in $targetfiles; do
+                                       verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
+                               done
+                               ;;
+               esac
                ;;
        release-compile)
                release_common
                suffix=$1
                makeflags=$2
-               gmqcc_maketargets=$3
-               gmqcc_files=$4
-               darkplaces_maketargets=$5
-               darkplaces_files=$6
+               darkplaces_maketargets=$3
+               darkplaces_files=$4
                host=xonotic-build-$suffix
-               verbose "$SELF" release-compile-run "$host" /tmp/gmqcc.build."$suffix" "$gmqcc_maketargets" "$makeflags" "Xonotic/source/gmqcc" "$d0/misc/builddeps/dp.$suffix" "$gmqcc_files"
-               verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
+               verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/$suffix" "$darkplaces_files"
+               ;;
+       release-getbinary)
+               release_common
+               binary=$1
+               basename=${binary##*/}
+               dpname=darkplaces${basename#xonotic}
+               rev=`( cd "$d0/darkplaces" && git rev-parse HEAD )`
+               verbose wget -O "$binary" "http://beta.xonotic.org/autobuild-bin/$rev/$dpname"
+               [ -s "$binary" ] || rm -f "$binary"
+               [ -f "$binary" ]
+               case "$binary" in
+                       Xonotic/*osx*|Xonotic/*linux*)
+                               chmod +x "$binary"
+                               ;;
+               esac
+               ;;
+       release-libs-compile)
+               release_common
+               arch=$1
+               makeflags=$2
+               host=$3
+               (
+                       verbose cd "$d0/d0_blind_id"
+                       verbose ./autogen.sh
+                       verbose ./configure --enable-static --disable-shared \
+                                           --host="$host" \
+                                           --prefix="$d0/misc/builddeps/$arch/d0_blind_id"
+                       verbose make clean
+                       verbose eval make "$makeflags"
+                       verbose make install
+               )
+               ;;
+       release-libs-linux64)
+               release_common
+               # TODO schroot support for libs so we can LTO this
+               verbose "$SELF" release-libs-compile linux64 \
+                       'CC="gcc -m64"' \
+                       x86_64-pc-linux-gnu
+               ;;
+       release-dlls-compile)
+               release_common
+               arch=$1
+               buildpath=$2
+               targetdir=$3
+               verbose mkdir -p "$targetdir"
+               (
+                       cd "$d0/misc/buildsrc"
+                       verbose ./dlls.sh clean "$buildpath"
+                       verbose ./dlls.sh all "$buildpath" "$arch"
+               )
+               verbose cp -v $buildpath/out/$arch/* "$targetdir"
+
+               # SDL2
+               verbose mkdir -p "$d0/misc/builddeps/$arch/"
+               verbose rsync --delete -avP "$buildpath/pkg/$arch/sdl" "$d0/misc/builddeps/$arch/"
+               # PKG_CONFIG HACK: avoids needing to modify sdl2-config
+               verbose printf '#!/bin/sh\nprintf ../../../.deps/lib\n' > "$d0/misc/builddeps/$arch/sdl/libdir_hack.sh"
+               verbose chmod +x "$d0/misc/builddeps/$arch/sdl/libdir_hack.sh"
+               ;;
+       release-dlls-win32)
+               release_common
+               verbose "$SELF" release-dlls-compile win32 /tmp/dlls Xonotic/bin32
+               ;;
+       release-dlls-win64)
+               release_common
+               verbose "$SELF" release-dlls-compile win64 /tmp/dlls Xonotic/bin64
+               ;;
+       release-libs-osx)
+               release_common
+               verbose mkdir -p "$d0/misc/builddeps/osx"
+               (
+                       verbose cd "$d0/misc/builddeps/osx"
+                       verbose rm -rf sdl SDL2
+                       verbose wget https://libsdl.org/release/SDL2-2.28.5.dmg
+                       verbose 7z x *.dmg
+                       # 7z still fails to extract working symlinks from any archive format, hackaround:
+                       verbose ln -sf $(cat SDL2/SDL2.framework/Versions/Current) SDL2/SDL2.framework/Versions/Current
+                       verbose ln -sf $(cat SDL2/SDL2.framework/Headers) SDL2/SDL2.framework/Headers
+                       verbose ln -sf $(cat SDL2/SDL2.framework/Resources) SDL2/SDL2.framework/Resources
+                       verbose ln -sf $(cat SDL2/SDL2.framework/SDL2) SDL2/SDL2.framework/SDL2
+                       # THE HEADERS ARE NOT IN A SUBDIRECTORY CALLED SDL2
+                       # YET SDL2/ WAS ADDED TO ALL THE INCLUDES, WHY?!?
+                       # OLD VERSIONS WITHOUT IT WORKED
+                       verbose sed -i "s/#include <SDL2\//#include </g" SDL2/SDL2.framework/Versions/Current/Headers/*.h
+                       # The dirs are extracted with 700 permissions which breaks the rsync updater
+                       find SDL2 -type d -exec chmod 755 {} \;
+                       # macOS prefers dylibs be marked executable (this one has no file extension)
+                       verbose chmod 755 SDL2/SDL2.framework/Versions/Current/SDL2
+               )
+               cp -R "$d0/misc/builddeps/osx/SDL2/SDL2.framework" Xonotic/Xonotic.app/Contents/Frameworks/
+               ;;
+       release-libs)
+               release_common
+               verbose "$SELF" release-libs-linux64
+               verbose "$SELF" release-dlls-win32
+               verbose "$SELF" release-dlls-win64
+               verbose "$SELF" release-libs-osx
+               verbose rm -rf /tmp/dlls
                ;;
        release-engine-win32)
                release_common
+               #good=true
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-x86.exe || good=false
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false
+               #$good
                verbose "$SELF" release-compile win32 \
-                       'STRIP=: DP_MAKE_TARGET=mingw UNAME=MINGW32 CC="i586-mingw32msvc-gcc -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG="../../../.deps/bin/sdl-config" DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen WIN32RELEASE=1 D3D=1' \
-                       gmqcc.exe 'gmqcc.exe:Xonotic/gmqcc/gmqcc.exe' \
-                       release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
+                       'DP_MAKE_TARGET=mingw WIN32RELEASE=1 CC="i686-w64-mingw32-gcc -static -flto=auto -mstackrealign -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib" WINDRES="i686-w64-mingw32-windres" DP_LINK_SDL=static PKG_CONFIG="../../../.deps/libdir_hack.sh" SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen DP_LINK_XMP=dlopen' \
+                       release 'darkplaces-sdl.exe:Xonotic/xonotic-x86.exe darkplaces-dedicated.exe:Xonotic/xonotic-x86-dedicated.exe'
                ;;
        release-engine-win64)
                release_common
+               #good=true
+               #verbose "$SELF" release-getbinary Xonotic/xonotic.exe || good=false
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-dedicated.exe || good=false
+               #$good
+               # PKG_CONFIG HACK: avoids needing to modify sdl2-config
                verbose "$SELF" release-compile win64 \
-                       'STRIP=: DP_MAKE_TARGET=mingw UNAME=MINGW32 CC="amd64-mingw32msvc-gcc -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG="../../../.deps/bin/sdl-config" DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen WIN64RELEASE=1 D3D=1' \
-                       gmqcc.exe 'gmqcc.exe:Xonotic/gmqcc/gmqcc-x64.exe' \
-                       release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
+                       'DP_MAKE_TARGET=mingw WIN64RELEASE=1 CC="x86_64-w64-mingw32-gcc -static -flto=auto -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib" WINDRES="x86_64-w64-mingw32-windres" DP_LINK_SDL=static PKG_CONFIG="../../../.deps/libdir_hack.sh" SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen DP_LINK_XMP=dlopen' \
+                       release 'darkplaces-sdl.exe:Xonotic/xonotic.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
                ;;
        release-engine-osx)
                release_common
-               # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
+               #good=true
+               #verbose "$SELF" release-getbinary Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin || good=false
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-osx-dedicated || good=false
+               #$good
+               # Note: travis build script also had SDLCONFIG_MACOSX* flags; need to check if they're still needed with osxcross.
+               # Note: Mac bins cannot be stripped by the standard tool.
                verbose "$SELF" release-compile osx \
-                       'STRIP=: CC="gcc -g1 -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I../../../.deps/include -L../../../.deps/lib -fno-reorder-blocks -DSUPPORTIPV6" DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen' \
-                       gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.osx' \
-                       'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
-               ;;
-       release-engine-linux32)
-               release_common
-               verbose "$SELF" release-compile linux32 \
-                       'STRIP=: CC="gcc -m32 -march=i686 -g1 -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" LIB_JPEG=../../../.deps/lib/libjpeg.a LIB_CRYPTO="../../../.deps/lib/libd0_blind_id.a ../../../.deps/lib/libgmp.a" DP_LINK_ODE=dlopen' \
-                       gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.linux32' \
-                       release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
+                       'STRIP=: DP_MAKE_TARGET=macosx PATH="$HOME/osxcross/out/bin:$PATH" CC="$HOME/osxcross/out/bin/o64-clang -flto -arch x86_64 -mmacosx-version-min=10.7 -Wl,-rpath -Wl,@loader_path/../Frameworks -Wl,-rpath -Wl,@loader_path -I../../../.deps/include -L../../../.deps/lib" DP_LINK_SDL=shared SDLCONFIG_MACOSXCFLAGS="-I../../../.deps/SDL2.framework/Headers" SDLCONFIG_MACOSXLIBS="-F../../../.deps -framework SDL2 -framework Cocoa -I../../../.deps/SDL2.framework/Headers" SDLCONFIG_MACOSXSTATICLIBS="-F../../../.deps -framework SDL2 -framework Cocoa -I../../../.deps/SDL2.framework/Headers" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=shared DP_LINK_XMP=dlopen' \
+                       release 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
                ;;
        release-engine-linux64)
                release_common
+               #good=true
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-sdl || good=false
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-glx || good=false
+               #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-dedicated || good=false
+               #$good
                verbose "$SELF" release-compile linux64 \
-                       'STRIP=: CC="gcc -m64 -g1 -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" LIB_JPEG=../../../.deps/lib/libjpeg.a LIB_CRYPTO="../../../.deps/lib/libd0_blind_id.a ../../../.deps/lib/libgmp.a" DP_LINK_ODE=dlopen' \
-                       gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.linux64' \
-                       release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
+                       'CC="gcc -m64 -flto=auto -I../../../.deps/include -L../../../.deps/lib" DP_LINK_SDL=shared DP_LINK_ZLIB=shared DP_LINK_JPEG=static DP_LINK_ODE=dlopen DP_LINK_CRYPTO=static_inc_gmp DP_LINK_CRYPTO_RIJNDAEL=static DP_LINK_XMP=dlopen' \
+                       release 'darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
                ;;
        release-engine)
                release_common
-               verbose "$SELF" release-engine-linux32 &
-               verbose "$SELF" release-engine-linux64 &
-               verbose "$SELF" release-engine-win32 &
-               verbose "$SELF" release-engine-win64 &
-               verbose "$SELF" release-engine-osx &
-               wait %1
-               wait %2
-               wait %3
-               wait %4
-               wait %5
-               wait
+               # TODO report failures here.
+               good=false
+               verbose "$SELF" release-engine-linux64 && good=true
+               verbose "$SELF" release-engine-win32 && good=true
+               verbose "$SELF" release-engine-win64 && good=true
+               verbose "$SELF" release-engine-osx && good=true
+               $good
                ;;
        release-maps)
                release_common
@@ -317,7 +420,8 @@ case "$cmd" in
                ;;
        release-qc)
                release_common
-               verbose env GIT_DIR="$d0/data/xonotic-data.pk3dir/.git" make -C Xonotic/source QCC="$d0/Xonotic/gmqcc/gmqcc.linux64" XON_BUILDSYSTEM=1 clean all
+               verbose make -C "$d0/gmqcc" gmqcc
+               verbose env GIT_DIR="$d0/data/xonotic-data.pk3dir/.git" make -C Xonotic/source QCC="$d0/gmqcc/gmqcc" XON_BUILDSYSTEM=1 QCCFLAGS_WATERMARK='$(shell git describe --tags)' clean qc
                ;;
        release-buildpk3-transform-raw)
                release_common
@@ -354,55 +458,12 @@ case "$cmd" in
                verbose export del_src=true
                find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
                ;;
-       release-buildpk3-transform-low)
-               release_common
-               dir=$1
-               verbose cd "$dir"
-               # texture: convert to jpeg and dds
-               # music: reduce bitrate
-               verbose export do_jpeg=true
-               verbose export jpeg_qual_rgb=80
-               verbose export jpeg_qual_a=97
-               verbose export do_dds=false
-               verbose export do_ogg=true
-               verbose export ogg_qual=1
-               verbose export del_src=true
-               find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
-               ;;
-       release-buildpk3-transform-webp)
-               release_common
-               dir=$1
-               verbose cd "$dir"
-               # texture: convert to jpeg and dds
-               verbose export do_jpeg=false
-               verbose export do_webp=true
-               verbose export do_dds=false
-               verbose export do_ogg=false
-               verbose export ogg_ogg=false
-               verbose export del_src=true
-               find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
-               ;;
-       release-buildpk3-transform-lowdds)
-               release_common
-               dir=$1
-               verbose cd "$dir"
-               # texture: convert to jpeg and dds
-               # music: reduce bitrate
-               verbose export do_jpeg=false
-               verbose export do_jpeg_if_not_dds=true
-               verbose export jpeg_qual_rgb=80
-               verbose export jpeg_qual_a=99
-               verbose export do_dds=true
-               verbose export dds_flags=
-               verbose export do_ogg=true
-               verbose export ogg_qual=1
-               verbose export del_src=true
-               find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
-               ;;
        release-buildpk3-transform-mapping)
                release_common
                dir=$1
                verbose cd "$dir"
+               # don't include levelshots, lightmaps and minimaps from official map builds, as well as other unneeded folders
+               rm -rf gfx maps scripts sound
                # remove stuff radiant has no use for
                verbose find . -name \*_norm.\* -exec rm -f {} \;
                verbose find . -name \*_bump.\* -exec rm -f {} \;
@@ -446,11 +507,18 @@ case "$cmd" in
                        verbose cp ../source/progs.dat .
                        verbose cp ../source/csprogs.dat .
                        verbose cp ../source/menu.dat .
+                       # Include line numbers in qc errors
+                       verbose cp ../source/progs.lno .
+                       verbose cp ../source/csprogs.lno .
+                       verbose cp ../source/menu.lno .
                        verbose rm -rf qcsrc
                        getversion .
                        case "$RELEASETYPE" in
                                release)
                                        ;;
+                               RC*)
+                                       versionstr="$versionstr $RELEASETYPE"
+                                       ;;
                                *)
                                        versionstr="$versionstr$RELEASETYPE"
                                        ;;
@@ -458,24 +526,26 @@ case "$cmd" in
                        if [ $gv -lt 9900 ]; then
                                # pre-1.0: compatible with any other pre-1.0
                                verbose sed "
-                                       s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
-                                       s/^gameversion_min [0-9]*/gameversion_min     0/;
+                                       s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /;
                                        s/^gameversion_max [0-9]*/gameversion_max  9999/;
-                               " < defaultXonotic.cfg > defaultXonotic.cfg.new
+                               " < xonotic-common.cfg > xonotic-common.cfg.new
+                               # Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034
+                               # s/^gameversion_min [0-9]*/gameversion_min     0/;
                        else
                                # >= 1.0
                                verbose sed "
-                                       s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
-                                       s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
+                                       s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /;
                                        s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
-                               " < defaultXonotic.cfg > defaultXonotic.cfg.new
+                               " < xonotic-common.cfg > xonotic-common.cfg.new
+                               # Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034
+                               # s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
                        fi
-                       mv defaultXonotic.cfg.new defaultXonotic.cfg
+                       mv xonotic-common.cfg.new xonotic-common.cfg
                        case "$RELEASETYPE" in
-                               release)
-                                       echo "" >> defaultXonotic.cfg
-                                       echo "// nicer menu" >> defaultXonotic.cfg
-                                       echo "set menu_watermark \"\"" >> defaultXonotic.cfg
+                               release|RC*)
+                                       echo "" >> xonotic-common.cfg
+                                       echo "// nicer menu" >> xonotic-common.cfg
+                                       echo "set menu_watermark \"\"" >> xonotic-common.cfg
                                        ;;
                        esac
                        (
@@ -485,6 +555,7 @@ case "$cmd" in
                                verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
                                verbose rm background_l2.svg
                        )
+                       verbose "$d0"/mediasource/gfx/luma/render-version.sh "$d0/mediasource/gfx/luma" "$PWD" "$versionstr"
                fi
                if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
                        for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
@@ -528,12 +599,13 @@ case "$cmd" in
                ;;
        release-pack)
                release_common
-               verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir  raw ''
+               verbose "$SELF" release-buildpk3s data/font-unifont.pk3dir      raw ''
                verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir     raw ''
-               verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             low '-low' normaldds ''                    webp '-high'
-               verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             low '-low' normaldds '' mapping '-mapping' webp '-high'
-               verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw '' low '-low'
-               verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                   normaldds ''
+               verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             normaldds ''                    normal '-high'
+               verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             normaldds '' mapping '-mapping' normal '-high'
+               verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw ''
+               verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir        normaldds ''                    normal '-high'
+               verbose "$SELF" release-buildpk3s data/xonotic-xoncompat.pk3dir        normaldds ''                    normal '-high'
                ;;
        release-pack-needsx11)
                release_common
@@ -550,23 +622,15 @@ case "$cmd" in
                release_common
                stamp=`cat Xonotic/stamp.txt`
                pk3stamp=`cat Xonotic/pk3stamp.txt`
-               # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
-               chmod a-x Xonotic/*.exe Xonotic/*.dll || true
-               # let's pass crypto import laws of some nasty countries
-               crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
-               if [ -n "$crypto_libs" ]; then
-                       verbose mkzip Xonotic-$stamp-crypto.zip \
-                               $crypto_libs \
-                               Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
-                       rm -f $crypto_libs
-               fi
+               # exe and dll files do not need +x
+               chmod a-x Xonotic/*.exe Xonotic/*.dll Xonotic/bin64/*.dll Xonotic/bin32/*.dll || true
                # build the archives
-               verbose mkzip Xonotic-$stamp-enginesource.zip \
+               verbose mkzipr Xonotic-$stamp-enginesource.zip \
                        Xonotic/Makefile \
                        Xonotic/source/darkplaces/ \
                        Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
                verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
-               verbose mkzip Xonotic-$stamp-engine.zip \
+               verbose mkzipr Xonotic-$stamp-engine.zip \
                        Xonotic/*.dll \
                        Xonotic/bin32/*.dll \
                        Xonotic/bin64/*.dll \
@@ -574,7 +638,7 @@ case "$cmd" in
                        Xonotic/xonotic-* \
                        Xonotic/xonotic.exe
                verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
-               verbose mkzip Xonotic-$stamp-common.zip \
+               verbose mkzipr Xonotic-$stamp-common.zip \
                        Xonotic/source/d0_blind_id/ \
                        Xonotic/source/gmqcc/ \
                        Xonotic/source/qcsrc/ \
@@ -583,10 +647,10 @@ case "$cmd" in
                        Xonotic/gmqcc \
                        Xonotic/server \
                        Xonotic/key_0.d0pk \
-                       Xonotic/data/font-nimbussansl-$pk3stamp.pk3 \
+                       Xonotic/data/font-unifont-$pk3stamp.pk3 \
                        Xonotic/data/font-xolonium-$pk3stamp.pk3
                verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
-               verbose mkzip Xonotic-$stamp-source.zip \
+               verbose mkzipr Xonotic-$stamp-source.zip \
                        Xonotic/source/d0_blind_id/ \
                        Xonotic/source/gmqcc/ \
                        Xonotic/source/qcsrc/ \
@@ -596,22 +660,20 @@ case "$cmd" in
                        Xonotic/data/xonotic-$pk3stamp-data.pk3 \
                        Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
                        Xonotic/data/xonotic-$pk3stamp-music.pk3 \
-                       Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3
-               verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
-               verbose mkzip0 Xonotic-$stamp-low.zip \
-                       Xonotic/data/xonotic-$pk3stamp-data-low.pk3 \
-                       Xonotic/data/xonotic-$pk3stamp-maps-low.pk3 \
-                       Xonotic/data/xonotic-$pk3stamp-music-low.pk3
+                       Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3 \
+                       Xonotic/data/xonotic-$pk3stamp-xoncompat.pk3
                verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
                verbose mkzip0 Xonotic-$stamp-high.zip \
                        Xonotic/data/xonotic-$pk3stamp-data-high.pk3 \
                        Xonotic/data/xonotic-$pk3stamp-maps-high.pk3 \
-                       Xonotic/data/xonotic-$pk3stamp-music.pk3
-               verbose mkzip Xonotic-$stamp-mappingsupport.zip \
+                       Xonotic/data/xonotic-$pk3stamp-music.pk3 \
+                       Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3 \
+                       Xonotic/data/xonotic-$pk3stamp-xoncompat-high.pk3
+               verbose mkzipr Xonotic-$stamp-mappingsupport.zip \
                        Xonotic/mapping
                verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
                        Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
-               verbose mkzip gmqcc-$stamp.zip \
+               verbose mkzipr gmqcc-$stamp.zip \
                        Xonotic/gmqcc \
                        Xonotic/source/gmqcc
                ;;
@@ -619,9 +681,10 @@ case "$cmd" in
                release_common
                verbose "$SELF" release-prepare
                verbose "$SELF" release-maps
+               verbose "$SELF" release-libs
                verbose "$SELF" release-engine
                verbose "$SELF" release-qc
-               verbose "$SELF" release-pack-needsx11
+               verbose "$SELF" release-pack
                verbose "$SELF" release-zip
                ;;
        *)