X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=misc%2Ftools%2Fall%2Frelease.subr;h=b15141dc860a2949329e101ccde89f60232c8de1;hb=HEAD;hp=161dec265129f2ec18e97ca18903bfc10dbee12f;hpb=ed19d6fdc6a4de2b663a95fcd399fe0d335d68d8;p=xonotic%2Fxonotic.git diff --git a/misc/tools/all/release.subr b/misc/tools/all/release.subr index 161dec26..54f7c8c5 100644 --- a/misc/tools/all/release.subr +++ b/misc/tools/all/release.subr @@ -36,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" @@ -60,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 @@ -175,29 +174,23 @@ 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 source source/darkplaces source/gmqcc source/d0_blind_id mapping - verbose rm -rf misc/builddeps - #verbose mv bin32/SDL.dll . || true # Leftover? - - # We're going to be building these later - #verbose mv misc/buildfiles/win32 bin32 || true - #verbose mv misc/buildfiles/win64 bin64 || true - 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 @@ -223,6 +216,7 @@ case "$cmd" in srcdir=$5 depsdir=$6 targetfiles=$7 + schroot= set -x if [ -z "$targetfiles" ]; then exit @@ -232,13 +226,18 @@ case "$cmd" in exit ;; esac - case " $HOSTS_THAT_ARE_MYSELF " in + 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 make -C "$buildpath" clean $maketargets $makeflags + verbose eval $schroot make -C "$buildpath" clean $maketargets $makeflags for f in $targetfiles; do verbose mv "$buildpath/${f%:*}" "${f##*:}" || true done @@ -278,17 +277,48 @@ case "$cmd" in ;; 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 - mkdir -p "$targetdir" + 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 @@ -298,10 +328,36 @@ case "$cmd" in release_common verbose "$SELF" release-dlls-compile win64 /tmp/dlls Xonotic/bin64 ;; - release-dlls) + 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 xonotic-common.cfg.new # Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034 @@ -474,7 +534,7 @@ case "$cmd" in else # >= 1.0 verbose sed " - s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /; + s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /; s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/; " < 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 @@ -562,15 +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 + # 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 \ @@ -578,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/ \ @@ -590,7 +650,7 @@ case "$cmd" in 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/ \ @@ -609,11 +669,11 @@ case "$cmd" in Xonotic/data/xonotic-$pk3stamp-music.pk3 \ Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3 \ Xonotic/data/xonotic-$pk3stamp-xoncompat-high.pk3 - verbose mkzip Xonotic-$stamp-mappingsupport.zip \ + 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 ;; @@ -621,7 +681,7 @@ case "$cmd" in release_common verbose "$SELF" release-prepare verbose "$SELF" release-maps - verbose "$SELF" release-dlls + verbose "$SELF" release-libs verbose "$SELF" release-engine verbose "$SELF" release-qc verbose "$SELF" release-pack