]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/all/release.subr
Merge branch 'Spike29/mappingsupport_cleanup' into 'master'
[xonotic/xonotic.git] / misc / tools / all / release.subr
1 release_common()
2 {
3         export LC_ALL=C
4
5         if [ -z "$MAKEFLAGS" ]; then
6                 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
7                 if [ $ncpus -gt 1 ]; then
8                         export MAKEFLAGS=-j$ncpus
9                 fi
10         fi
11
12         release_args="$cmd $*"
13         msg "*** $release_args: start"
14         release_starttime=`date +%s`
15         release_end()
16         {
17                 release_endtime=`date +%s`
18                 release_deltatime=$(($release_endtime - $release_starttime))
19                 msg "*** $release_args: $release_deltatime seconds"
20         }
21         trap release_end EXIT
22         release_tempstarttime=$release_starttime
23         release_timereport()
24         {
25                 release_endtime=`date +%s` # RELEASE NOW!!!
26                 if [ -n "$*" ]; then
27                         release_deltatime=$(($release_endtime - $release_tempstarttime))
28                         msg "**** $release_args: $*: $release_deltatime seconds"
29                 fi
30                 release_tempstarttime=$release_endtime
31         }
32         release_git_extract_dir()
33         {
34                 release_src=$1; shift
35                 release_dst=$1; shift
36                 # try to create a hardlink
37                 if ln -f "$release_src/.git/HEAD" "$release_dst/.hardlink-test"; then
38                         rm -f "$release_dst/.hardlink-test"
39                         {
40                                 verbose cd "$release_src"
41                                 git ls-files HEAD -- "$@"
42                         } | {
43                                 while IFS= read -r F; do
44                                         case "$F" in */*) mkdir -p "$release_dst/${F%/*}" ;; esac
45                                         verbose ln -f "$release_src/$F" "$release_dst/$F"
46                                 done
47                         }
48                 else
49                         {
50                                 verbose cd "$release_src"
51                                 verbose git archive --format=tar HEAD -- "$@"
52                         } | {
53                                 verbose cd "$release_dst"
54                                 verbose tar xvf -
55                         }
56                 fi
57         }
58
59         mkzipr()
60         {
61                 archive=$1; shift
62
63                 # bones_was_here: 7za still doesn't store symlinks correctly (even with -snl)
64                 # but it does now store the executable bit.
65                 # compared to advzip, 7za achieves very similar final zip size, is multi threaded,
66                 # and avoids https://gitlab.com/xonotic/xonotic/-/issues/371
67
68                 sevenzipflags=-mx=9
69                 zipflags=-9
70                 # git restore-mtime replaces this hack:
71                 #find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
72                 ziplist=`mktemp`
73                 find "$@" -xtype f \( -type l \) -print | sed 's,\([./][^./]*$\),\1 \1,' | sort -k2 | cut -d\  -f1 > "$ziplist"
74                 7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
75                 zip         $zipflags -y   -@<"$ziplist" "$archive"      || true
76                 rm -f "$ziplist"
77         }
78
79         mkzip()
80         {
81                 # not using this currently, see above
82                 archive=$1; shift
83                 zipflags=-1ry
84                 zip $zipflags "$archive" "$@" || true
85                 advzip -z -4 "$archive"
86         }
87
88         mkzip0()
89         {
90                 archive=$1; shift
91                 zipflags=-0ry
92                 zip $zipflags "$archive" "$@" || true
93         }
94
95         getversion()
96         {
97                 gv=`grep "^gameversion " "$1/xonotic-common.cfg" | awk '{ print $2 }'`
98                 major=$(($gv / 10000))
99                 minor=$((($gv / 100) - ($major * 100)))
100                 patch=$(($gv - ($major * 10000) - ($minor * 100)))
101                 versionstr="$major.$minor.$patch"
102         }
103 }
104
105 handled=true
106 case "$cmd" in
107         # release building goes here
108         release-prepare)
109                 release_common
110                 #"$SELF" each git clean -fxd
111                 case "$RELEASETYPE" in
112                         '')
113                                 $ECHO >&2 -n "$ESC[2J$ESC[H"
114                                 msg ""
115                                 msg ""
116                                 msg ""
117                                 msg ""
118                                 msg ""
119                                 msg ""
120                                 msg "        +---------------------------------------------------------.---+"
121                                 msg "        | NOTE                                                    | X |"
122                                 msg "        +---------------------------------------------------------^---+"
123                                 msg "        |   ____                                                      |"
124                                 msg "        |  /    \  This is the official release build system.         |"
125                                 msg "        | |      | If you are not a member of the Xonotic Core Team,  |"
126                                 msg "        | | STOP | you are not supposed to use this script and should |"
127                                 msg "        | |      | instead use ./all compile to compile the engine    |"
128                                 msg "        |  \____/  and game code.                                     |"
129                                 msg "        |                                                             |"
130                                 msg "        |                      [ I understand ]                       |"
131                                 msg "        +-------------------------------------------------------------+"
132                                 sleep 10
133                                 # A LOT of build infrastructure is required:
134                                 # - vorbis-tools
135                                 # - ImageMagick
136                                 # - .ssh/config must be configured so the following
137                                 #   host names are reachable and have a compile
138                                 #   infrastructure set up:
139                                 #   - xonotic-build-linux64 (with gcc on x86_64)
140                                 #   - xonotic-build-win32 (with i686-w64-mingw32)
141                                 #   - xonotic-build-win64 (with x86_64-w64-mingw32)
142                                 #   - xonotic-build-osx (with Xcode and SDL.framework)
143                                 # - AMD Compressonator installed in WINE
144                                 # - ResEdit installed in WINE
145                                 # - a lot of other requirements you will figure out
146                                 #   while reading the error messages
147                                 # - environment variable RELEASETYPE set
148                                 # - optionally, environment variable RELEASEDATE set
149                                 #   (YYYYMMDD)
150                                 exit 1
151                                 ;;
152                         release|RC*)
153                                 msg "Building a FINISHED RELEASE"
154                                 getversion data/xonotic-data.pk3dir
155                                 verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
156                                 ;;
157                         *)
158                                 msg "Building a $RELEASETYPE"
159                                 ;;
160                 esac
161                 verbose rm -rf Xonotic Xonotic*.zip
162                 verbose mkdir -p Xonotic
163                 if [ -n "$RELEASEDATE" ]; then
164                         verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
165                         case "$RELEASETYPE" in
166                                 release|RC*)
167                                         verbose $ECHO "${RELEASEDATE%_*}" > Xonotic/pk3stamp.txt
168                                         ;;
169                                 *)
170                                         verbose $ECHO "$RELEASEDATE" > Xonotic/pk3stamp.txt
171                                         ;;
172                         esac
173                 else
174                         verbose date +%Y%m%d > Xonotic/stamp.txt
175                         verbose date +%Y%m%d > Xonotic/pk3stamp.txt
176                 fi
177                 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
178                 (
179                         verbose cd Xonotic
180                         verbose mkdir data source source/darkplaces source/gmqcc source/d0_blind_id mapping
181                         verbose rm -rf misc/builddeps
182                         #verbose mv bin32/SDL.dll . || true # Leftover?
183
184                         # We're going to be building these later
185                         #verbose mv misc/buildfiles/win32 bin32 || true
186                         #verbose mv misc/buildfiles/win64 bin64 || true
187
188                         verbose mv misc/buildfiles/osx/* . || true
189                         verbose rm -rf misc/buildfiles
190                         verbose rm -rf misc/pki
191                 )
192                 release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
193                 release_git_extract_dir "gmqcc" "Xonotic/source/gmqcc" .
194                 release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
195                 release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
196                 (
197                         verbose cd Xonotic/source/d0_blind_id
198                         verbose sh autogen.sh
199                 )
200                 rm -f Xonotic/key_15.d0pk
201                 (
202                         verbose cd Xonotic/mapping
203                         # bones_was_here: don't ship 10 year old netradiant
204                         # also seems better to update netradiant independently of xonotic versions
205                         #verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
206                         #verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
207                         #for X in *-7z.exe; do
208                         #       7za x "$X"
209                         #       rm -f "$X"
210                         #done
211                         # TODO possibly include other tools?
212                         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
213                 )
214                 ./all each git rev-parse HEAD > Xonotic/misc/git-revisions.txt
215                 ;;
216         release-compile-run)
217                 release_common
218                 host=$1
219                 buildpath=$2
220                 maketargets=$3
221                 makeflags=$4
222                 srcdir=$5
223                 depsdir=$6
224                 targetfiles=$7
225                 set -x
226                 if [ -z "$targetfiles" ]; then
227                         exit
228                 fi
229                 case " $HOSTS_THAT_ARE_DISABLED " in
230                         *\ $host\ *)
231                                 exit
232                                 ;;
233                 esac
234                 case " $HOSTS_THAT_ARE_MYSELF " in
235                         *\ $host\ *)
236                                 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
237                                 verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$buildpath"/darkplaces.ico
238                                 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$buildpath.deps/"
239                                 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
240                                 verbose eval make -C "$buildpath" clean $maketargets $makeflags
241                                 for f in $targetfiles; do
242                                         verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
243                                 done
244                                 ;;
245                         *)
246                                 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host":"$buildpath/"
247                                 verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$host":"$buildpath"/darkplaces.ico
248                                 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$host":"$buildpath.deps/"
249                                 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"
250                                 for f in $targetfiles; do
251                                         verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
252                                 done
253                                 ;;
254                 esac
255                 ;;
256         release-compile)
257                 release_common
258                 suffix=$1
259                 makeflags=$2
260                 darkplaces_maketargets=$3
261                 darkplaces_files=$4
262                 host=xonotic-build-$suffix
263                 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/$suffix" "$darkplaces_files"
264                 ;;
265         release-getbinary)
266                 release_common
267                 binary=$1
268                 basename=${binary##*/}
269                 dpname=darkplaces${basename#xonotic}
270                 rev=`( cd "$d0/darkplaces" && git rev-parse HEAD )`
271                 verbose wget -O "$binary" "http://beta.xonotic.org/autobuild-bin/$rev/$dpname"
272                 [ -s "$binary" ] || rm -f "$binary"
273                 [ -f "$binary" ]
274                 case "$binary" in
275                         Xonotic/*osx*|Xonotic/*linux*)
276                                 chmod +x "$binary"
277                                 ;;
278                 esac
279                 ;;
280         release-dlls-compile)
281                 release_common
282                 arch=$1
283                 buildpath=$2
284                 targetdir=$3
285                 mkdir -p "$targetdir"
286                 (
287                         cd "misc/buildsrc"
288                         verbose ./dlls.sh all "$buildpath" "$arch"
289                 )
290                 verbose cp -v $buildpath/out/$arch/* "$targetdir"
291                 ;;
292         release-dlls-win32)
293                 release_common
294                 verbose "$SELF" release-dlls-compile win32 /tmp/dlls Xonotic/bin32
295                 ;;
296         release-dlls-win64)
297                 release_common
298                 verbose "$SELF" release-dlls-compile win64 /tmp/dlls Xonotic/bin64
299                 ;;
300         release-dlls)
301                 release_common
302                 verbose "$SELF" release-dlls-win32
303                 verbose "$SELF" release-dlls-win64
304                 verbose rm -rf /tmp/dlls
305                 ;;
306         release-engine-win32)
307                 release_common
308                 #good=true
309                 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86.exe || good=false
310                 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false
311                 #$good
312                 verbose "$SELF" release-compile win32 \
313                         'STRIP=: D3D=1 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 -DSUPPORTIPV6" WINDRES="i686-w64-mingw32-windres" 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' \
314                         release 'darkplaces.exe:Xonotic/xonotic-x86-wgl.exe darkplaces-sdl.exe:Xonotic/xonotic-x86.exe darkplaces-dedicated.exe:Xonotic/xonotic-x86-dedicated.exe'
315                 ;;
316         release-engine-win64)
317                 release_common
318                 #good=true
319                 #verbose "$SELF" release-getbinary Xonotic/xonotic.exe || good=false
320                 #verbose "$SELF" release-getbinary Xonotic/xonotic-dedicated.exe || good=false
321                 #$good
322                 verbose "$SELF" release-compile win64 \
323                         'STRIP=: D3D=1 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 -DSUPPORTIPV6" WINDRES="x86_64-w64-mingw32-windres" 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' \
324                         release 'darkplaces.exe:Xonotic/xonotic-wgl.exe darkplaces-sdl.exe:Xonotic/xonotic.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
325                 ;;
326         release-engine-osx)
327                 release_common
328                 #good=true
329                 #verbose "$SELF" release-getbinary Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin || good=false
330                 #verbose "$SELF" release-getbinary Xonotic/xonotic-osx-dedicated || good=false
331                 #$good
332                 # Note: travis build script also had SDLCONFIG_MACOSX* flags; need to check if they're still needed with osxcross.
333                 verbose "$SELF" release-compile osx \
334                         'STRIP=: DP_MAKE_TARGET=macosx 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 -DSUPPORTIPV6" 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' \
335                         'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
336                 ;;
337         release-engine-linux64)
338                 release_common
339                 #good=true
340                 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-sdl || good=false
341                 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-glx || good=false
342                 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-dedicated || good=false
343                 #$good
344                 verbose "$SELF" release-compile linux64 \
345                         'STRIP=: CC="gcc -m64 -flto=auto -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" DP_LINK_CRYPTO=shared LIB_CRYPTO="../../../.deps/lib/libd0_blind_id.a ../../../.deps/lib/libgmp.a" DP_LINK_CRYPTO_RIJNDAEL=shared DP_LINK_JPEG=shared LIB_JPEG=/usr/lib/x86_64-linux-gnu/libjpeg.a DP_LINK_ODE=shared CFLAGS_ODE="-DUSEODE -DLINK_TO_LIBODE -DdDOUBLE" LIB_ODE="../../../.deps/lib/libode.a -lstdc++ -pthread" DP_LINK_ZLIB=shared' \
346                         release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
347                 ;;
348         release-engine)
349                 release_common
350                 # TODO report failures here.
351                 good=false
352                 verbose "$SELF" release-engine-linux64 && good=true
353                 verbose "$SELF" release-engine-win32 && good=true
354                 verbose "$SELF" release-engine-win64 && good=true
355                 verbose "$SELF" release-engine-osx && good=true
356                 $good
357                 ;;
358         release-maps)
359                 release_common
360                 verbose "$SELF" update-maps
361                 ;;
362         release-qc)
363                 release_common
364                 verbose make -C "$d0/gmqcc" gmqcc
365                 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
366                 ;;
367         release-buildpk3-transform-raw)
368                 release_common
369                 dir=$1
370                 ;;
371         release-buildpk3-transform-normal)
372                 release_common
373                 dir=$1
374                 verbose cd "$dir"
375                 # texture: convert to jpeg and dds
376                 verbose export do_jpeg=true
377                 verbose export jpeg_qual_rgb=97
378                 verbose export jpeg_qual_a=99
379                 verbose export do_dds=false
380                 verbose export do_ogg=true
381                 verbose export ogg_ogg=false
382                 verbose export del_src=true
383                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
384                 ;;
385         release-buildpk3-transform-normaldds)
386                 release_common
387                 dir=$1
388                 verbose cd "$dir"
389                 # texture: convert to jpeg and dds
390                 # music: reduce bitrate
391                 verbose export do_jpeg=false
392                 verbose export do_jpeg_if_not_dds=true
393                 verbose export jpeg_qual_rgb=95
394                 verbose export jpeg_qual_a=99
395                 verbose export do_dds=true
396                 verbose export dds_flags=
397                 verbose export do_ogg=true
398                 verbose export ogg_ogg=false
399                 verbose export del_src=true
400                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
401                 ;;
402         release-buildpk3-transform-mapping)
403                 release_common
404                 dir=$1
405                 verbose cd "$dir"
406                 # don't include levelshots, lightmaps and minimaps from official map builds, as well as other unneeded folders
407                 rm -rf gfx maps scripts sound
408                 # remove stuff radiant has no use for
409                 verbose find . -name \*_norm.\* -exec rm -f {} \;
410                 verbose find . -name \*_bump.\* -exec rm -f {} \;
411                 verbose find . -name \*_glow.\* -exec rm -f {} \;
412                 verbose find . -name \*_gloss.\* -exec rm -f {} \;
413                 verbose find . -name \*_pants.\* -exec rm -f {} \;
414                 verbose find . -name \*_shirt.\* -exec rm -f {} \;
415                 verbose find . -name \*_reflect.\* -exec rm -f {} \;
416                 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
417                 # texture: convert to jpeg and dds
418                 # music: reduce bitrate
419                 verbose export do_jpeg=true
420                 verbose export jpeg_qual_rgb=80
421                 verbose export jpeg_qual_a=97
422                 verbose export do_dds=false
423                 verbose export do_ogg=true
424                 verbose export ogg_qual=1
425                 verbose export del_src=true
426                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
427                 ;;
428         release-buildpk3)
429                 release_common
430                 src=$1
431                 dst=$2
432                 transform=$3
433                 case "$dst" in
434                         /*)
435                                 ;;
436                         */)
437                                 dst="$PWD/$dst"
438                                 ;;
439                 esac
440                 release_timereport
441                 verbose rm -rf Xonotic/temp
442                 release_timereport "deleted temp directory"
443                 verbose mkdir -p Xonotic/temp
444                 release_git_extract_dir "$src" "Xonotic/temp" .
445                 release_timereport "extracted data"
446                 verbose cd Xonotic/temp
447                 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
448                         verbose cp ../source/progs.dat .
449                         verbose cp ../source/csprogs.dat .
450                         verbose cp ../source/menu.dat .
451                         # Include line numbers in qc errors
452                         verbose cp ../source/progs.lno .
453                         verbose cp ../source/csprogs.lno .
454                         verbose cp ../source/menu.lno .
455                         verbose rm -rf qcsrc
456                         getversion .
457                         case "$RELEASETYPE" in
458                                 release)
459                                         ;;
460                                 RC*)
461                                         versionstr="$versionstr $RELEASETYPE"
462                                         ;;
463                                 *)
464                                         versionstr="$versionstr$RELEASETYPE"
465                                         ;;
466                         esac
467                         if [ $gv -lt 9900 ]; then
468                                 # pre-1.0: compatible with any other pre-1.0
469                                 verbose sed "
470                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /;
471                                         s/^gameversion_max [0-9]*/gameversion_max  9999/;
472                                 " < xonotic-common.cfg > xonotic-common.cfg.new
473                                 # Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034
474                                 # s/^gameversion_min [0-9]*/gameversion_min     0/;
475                         else
476                                 # >= 1.0
477                                 verbose sed "
478                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion \"$versionstr\" /;
479                                         s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
480                                 " < xonotic-common.cfg > xonotic-common.cfg.new
481                                 # Following line was included in sed above, ref https://gitlab.com/xonotic/xonotic-data.pk3dir/-/merge_requests/1034
482                                 # s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
483                         fi
484                         mv xonotic-common.cfg.new xonotic-common.cfg
485                         case "$RELEASETYPE" in
486                                 release|RC*)
487                                         echo "" >> xonotic-common.cfg
488                                         echo "// nicer menu" >> xonotic-common.cfg
489                                         echo "set menu_watermark \"\"" >> xonotic-common.cfg
490                                         ;;
491                         esac
492                         (
493                                 verbose cd gfx/menu/luminos
494                                 verbose rm -f background_l2.tga background_ingame_l2.tga
495                                 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
496                                 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
497                                 verbose rm background_l2.svg
498                         )
499                         verbose "$d0"/mediasource/gfx/luma/render-version.sh "$d0/mediasource/gfx/luma" "$PWD" "$versionstr"
500                 fi
501                 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
502                         for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
503                                 if [ -f "$X" ]; then
504                                         verbose unzip "$X"
505                                         verbose rm -f maps/*.log maps/*.irc maps/*.lin
506                                 fi
507                         done
508                 fi
509                 verbose export git_src_repo="$d0/$src" # skip hash-object
510                 release_timereport "processed data"
511                 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
512                 release_timereport "transformed data"
513                 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
514                 release_timereport "deduplicated data"
515                 verbose mkzipr "../../$dst" *
516                 release_timereport "zipped data"
517                 verbose cd ../..
518                 verbose rm -rf Xonotic/temp
519                 release_timereport "deleted temp directory again"
520                 ;;
521         release-buildpk3s)
522                 release_common
523                 pk3stamp=`cat Xonotic/pk3stamp.txt`
524                 src=$1
525                 shift
526                 dst=${src%.pk3dir}
527                 case "$dst" in
528                         data/xonotic-*)
529                                 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
530                                 ;;
531                         *)
532                                 dst="$dst-$pk3stamp"
533                                 ;;
534                 esac
535                 while [ "$#" -gt 1 ]; do
536                         verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
537                         shift
538                         shift
539                 done
540                 ;;
541         release-pack)
542                 release_common
543                 verbose "$SELF" release-buildpk3s data/font-unifont.pk3dir      raw ''
544                 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir     raw ''
545                 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             normaldds ''                    normal '-high'
546                 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             normaldds '' mapping '-mapping' normal '-high'
547                 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw ''
548                 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir        normaldds ''                    normal '-high'
549                 verbose "$SELF" release-buildpk3s data/xonotic-xoncompat.pk3dir        normaldds ''                    normal '-high'
550                 ;;
551         release-pack-needsx11)
552                 release_common
553                 case "$DISPLAY" in
554                         '')
555                                 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
556                                 ;;
557                         *)
558                                 verbose "$SELF" release-pack
559                                 ;;
560                 esac
561                 ;;
562         release-zip)
563                 release_common
564                 stamp=`cat Xonotic/stamp.txt`
565                 pk3stamp=`cat Xonotic/pk3stamp.txt`
566                 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
567                 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
568                 # build the archives
569                 verbose mkzipr Xonotic-$stamp-enginesource.zip \
570                         Xonotic/Makefile \
571                         Xonotic/source/darkplaces/ \
572                         Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
573                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
574                 verbose mkzipr Xonotic-$stamp-engine.zip \
575                         Xonotic/*.dll \
576                         Xonotic/bin32/*.dll \
577                         Xonotic/bin64/*.dll \
578                         Xonotic/*.app \
579                         Xonotic/xonotic-* \
580                         Xonotic/xonotic.exe
581                 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
582                 verbose mkzipr Xonotic-$stamp-common.zip \
583                         Xonotic/source/d0_blind_id/ \
584                         Xonotic/source/gmqcc/ \
585                         Xonotic/source/qcsrc/ \
586                         Xonotic/Docs \
587                         Xonotic/misc \
588                         Xonotic/gmqcc \
589                         Xonotic/server \
590                         Xonotic/key_0.d0pk \
591                         Xonotic/data/font-unifont-$pk3stamp.pk3 \
592                         Xonotic/data/font-xolonium-$pk3stamp.pk3
593                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
594                 verbose mkzipr Xonotic-$stamp-source.zip \
595                         Xonotic/source/d0_blind_id/ \
596                         Xonotic/source/gmqcc/ \
597                         Xonotic/source/qcsrc/ \
598                         Xonotic/misc/logos
599                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
600                 verbose mkzip0 Xonotic-$stamp.zip \
601                         Xonotic/data/xonotic-$pk3stamp-data.pk3 \
602                         Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
603                         Xonotic/data/xonotic-$pk3stamp-music.pk3 \
604                         Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3 \
605                         Xonotic/data/xonotic-$pk3stamp-xoncompat.pk3
606                 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
607                 verbose mkzip0 Xonotic-$stamp-high.zip \
608                         Xonotic/data/xonotic-$pk3stamp-data-high.pk3 \
609                         Xonotic/data/xonotic-$pk3stamp-maps-high.pk3 \
610                         Xonotic/data/xonotic-$pk3stamp-music.pk3 \
611                         Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3 \
612                         Xonotic/data/xonotic-$pk3stamp-xoncompat-high.pk3
613                 verbose mkzipr Xonotic-$stamp-mappingsupport.zip \
614                         Xonotic/mapping
615                 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
616                         Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
617                 verbose mkzipr gmqcc-$stamp.zip \
618                         Xonotic/gmqcc \
619                         Xonotic/source/gmqcc
620                 ;;
621         release)
622                 release_common
623                 verbose "$SELF" release-prepare
624                 verbose "$SELF" release-maps
625                 verbose "$SELF" release-dlls
626                 verbose "$SELF" release-engine
627                 verbose "$SELF" release-qc
628                 verbose "$SELF" release-pack
629                 verbose "$SELF" release-zip
630                 ;;
631         *)
632                 handled=false
633                 ;;
634 esac