]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/all/release.subr
demotc-race-record-extractor.sh: remove useless rc case (gametype name is always...
[xonotic/xonotic.git] / misc / tools / all / release.subr
index 6d762e33100c67a33de85a93d3f0951d38d1d057..54f7c8c5530d5f2760750a499641175b8080f25a 100644 (file)
@@ -228,7 +228,7 @@ case "$cmd" in
                esac
                case " $HOSTS_THAT_ARE_SCHROOT " in
                        *\ $host\ *)
-                               schroot="schroot -c $host --"
+                               schroot="schroot -c $host --preserve-environment --"
                                ;;
                esac
                case " $HOSTS_THAT_ARE_MYSELF $HOSTS_THAT_ARE_SCHROOT " in
@@ -289,14 +289,15 @@ case "$cmd" in
                                            --host="$host" \
                                            --prefix="$d0/misc/builddeps/$arch/d0_blind_id"
                        verbose make clean
-                       verbose make "$makeflags"
+                       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 -flto=auto"' \
+                       'CC="gcc -m64"' \
                        x86_64-pc-linux-gnu
                ;;
        release-dlls-compile)
@@ -306,13 +307,18 @@ case "$cmd" in
                targetdir=$3
                verbose mkdir -p "$targetdir"
                (
-                       cd "misc/buildsrc"
+                       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
@@ -322,11 +328,36 @@ case "$cmd" in
                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)
@@ -336,7 +367,7 @@ case "$cmd" in
                #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false
                #$good
                verbose "$SELF" release-compile win32 \
-                       '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 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_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)
@@ -345,8 +376,9 @@ case "$cmd" in
                #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 \
-                       '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 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_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)
@@ -358,7 +390,7 @@ case "$cmd" in
                # 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=: 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.6 -Wl,-rpath -Wl,@loader_path/../Frameworks -Wl,-rpath -Wl,@loader_path -I../../../.deps/include -L../../../.deps/lib" 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' \
+                       '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)
@@ -369,7 +401,7 @@ case "$cmd" in
                #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-dedicated || good=false
                #$good
                verbose "$SELF" release-compile linux64 \
-                       'CC="gcc -m64 -flto=auto -I../../../.deps/include -L../../../.deps/lib" DP_LINK_CRYPTO=static DP_LINK_CRYPTO_RIJNDAEL=static DP_LINK_JPEG=shared LIB_JPEG=/usr/lib/x86_64-linux-gnu/libjpeg.a DP_LINK_ODE=dlopen DP_LINK_ZLIB=shared' \
+                       '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)