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