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