544902fc620eb70d6bb74e2b53c56264a4bd9f8e
[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 fteqcc source source/darkplaces source/fteqcc 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 "fteqcc" "Xonotic/source/fteqcc" .
187                 release_git_extract_dir "gmqcc" "Xonotic/source/gmqcc" .
188                 release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
189                 release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
190                 (
191                         verbose cd Xonotic/source/d0_blind_id
192                         verbose sh autogen.sh
193                 )
194                 rm -f Xonotic/key_15.d0pk
195                 (
196                         verbose cd Xonotic/mapping
197                         verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
198                         verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
199                         for X in *-7z.exe; do
200                                 7za x "$X"
201                                 rm -f "$X"
202                         done
203                         # TODO possibly include other tools?
204                 )
205                 ./all each git rev-parse HEAD > Xonotic/misc/git-revisions.txt
206                 ;;
207         release-compile-run)
208                 release_common
209                 host=$1
210                 buildpath=$2
211                 maketargets=$3
212                 makeflags=$4
213                 srcdir=$5
214                 depsdir=$6
215                 targetfiles=$7
216                 set -x
217                 if [ -n "$targetfiles" ]; then
218                         case " $HOSTS_THAT_ARE_DISABLED " in
219                                 *\ $host\ *)
220                                         exit
221                                         ;;
222                         esac
223                         case " $HOSTS_THAT_ARE_MYSELF " in
224                                 *\ $host\ *)
225                                         verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
226                                         verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
227                                         verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
228                                         verbose eval make -C "$buildpath" clean $maketargets $makeflags
229                                         for f in $targetfiles; do
230                                                 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
231                                         done
232                                         ;;
233                                 *)
234                                         verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
235                                         verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
236                                         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"
237                                         for f in $targetfiles; do
238                                                 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
239                                         done
240                                         ;;
241                         esac
242                         # now rebrand the binaries...
243                         for f in $targetfiles; do
244                                 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
245                                 case "${f##*:}" in
246                                         Xonotic/xonotic*.exe)
247                                                 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
248                                                 ;;
249                                 esac
250                         done
251                 fi
252                 ;;
253         release-compile)
254                 release_common
255                 suffix=$1
256                 makeflags=$2
257                 gmqcc_maketargets=$3
258                 gmqcc_files=$4
259                 fteqcc_maketargets=$5
260                 fteqcc_files=$6
261                 darkplaces_maketargets=$7
262                 darkplaces_files=$8
263                 host=xonotic-build-$suffix
264                 verbose "$SELF" release-compile-run "$host" /tmp/gmqcc.build."$suffix" "$gmqcc_maketargets" "$makeflags" "Xonotic/source/gmqcc" "$d0/misc/builddeps/dp.$suffix" "$gmqcc_files"
265                 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
266                 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
267                 ;;
268         release-engine-win32)
269                 release_common
270                 verbose "$SELF" release-compile win32 \
271                         '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" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=1' \
272                         gmqcc.exe 'gmqcc.exe:Xonotic/gmqcc/gmqcc.exe' \
273                         win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
274                         release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
275                 ;;
276         release-engine-win64)
277                 release_common
278                 verbose "$SELF" release-compile win64 \
279                         '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" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=1' \
280                         gmqcc.exe 'gmqcc.exe:Xonotic/gmqcc/gmqcc-x64.exe' \
281                         win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
282                         release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
283                 ;;
284         release-engine-osx)
285                 release_common
286                 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
287                 verbose "$SELF" release-compile osx \
288                         '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"' \
289                         gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.osx' \
290                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
291                         'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
292                 ;;
293         release-engine-linux32)
294                 release_common
295                 verbose "$SELF" release-compile linux32 \
296                         'STRIP=: CC="gcc -m32 -march=i686 -g1 -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib DP_GMP_STATIC_LIBDIR=.deps/lib' \
297                         gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.linux32' \
298                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
299                         release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
300                 ;;
301         release-engine-linux64)
302                 release_common
303                 verbose "$SELF" release-compile linux64 \
304                         'STRIP=: CC="gcc -m64 -g1 -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib DP_GMP_STATIC_LIBDIR=.deps/lib' \
305                         gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.linux64' \
306                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
307                         release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
308                 ;;
309         release-engine)
310                 release_common
311                 verbose "$SELF" release-engine-linux32 &
312                 verbose "$SELF" release-engine-linux64 &
313                 verbose "$SELF" release-engine-win32 &
314                 verbose "$SELF" release-engine-win64 &
315                 verbose "$SELF" release-engine-osx &
316                 wait %1
317                 wait %2
318                 wait %3
319                 wait %4
320                 wait %5
321                 wait
322                 ;;
323         release-maps)
324                 release_common
325                 verbose "$SELF" update-maps
326                 ;;
327         release-qc)
328                 release_common
329                 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
330                 verbose rm -f Xonotic/source/qcsrc/*/fteqcc.log
331                 ;;
332         release-buildpk3-transform-raw)
333                 release_common
334                 dir=$1
335                 ;;
336         release-buildpk3-transform-normal)
337                 release_common
338                 dir=$1
339                 verbose cd "$dir"
340                 # texture: convert to jpeg and dds
341                 verbose export do_jpeg=true
342                 verbose export jpeg_qual_rgb=97
343                 verbose export jpeg_qual_a=99
344                 verbose export do_dds=false
345                 verbose export do_ogg=true
346                 verbose export ogg_ogg=false
347                 verbose export del_src=true
348                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
349                 ;;
350         release-buildpk3-transform-normaldds)
351                 release_common
352                 dir=$1
353                 verbose cd "$dir"
354                 # texture: convert to jpeg and dds
355                 # music: reduce bitrate
356                 verbose export do_jpeg=false
357                 verbose export do_jpeg_if_not_dds=true
358                 verbose export jpeg_qual_rgb=95
359                 verbose export jpeg_qual_a=99
360                 verbose export do_dds=true
361                 verbose export dds_flags=
362                 verbose export do_ogg=true
363                 verbose export ogg_ogg=false
364                 verbose export del_src=true
365                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
366                 ;;
367         release-buildpk3-transform-low)
368                 release_common
369                 dir=$1
370                 verbose cd "$dir"
371                 # texture: convert to jpeg and dds
372                 # music: reduce bitrate
373                 verbose export do_jpeg=true
374                 verbose export jpeg_qual_rgb=80
375                 verbose export jpeg_qual_a=97
376                 verbose export do_dds=false
377                 verbose export do_ogg=true
378                 verbose export ogg_qual=1
379                 verbose export del_src=true
380                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
381                 ;;
382         release-buildpk3-transform-lowdds)
383                 release_common
384                 dir=$1
385                 verbose cd "$dir"
386                 # texture: convert to jpeg and dds
387                 # music: reduce bitrate
388                 verbose export do_jpeg=false
389                 verbose export do_jpeg_if_not_dds=true
390                 verbose export jpeg_qual_rgb=80
391                 verbose export jpeg_qual_a=99
392                 verbose export do_dds=true
393                 verbose export dds_flags=
394                 verbose export do_ogg=true
395                 verbose export ogg_qual=1
396                 verbose export del_src=true
397                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
398                 ;;
399         release-buildpk3-transform-mapping)
400                 release_common
401                 dir=$1
402                 verbose cd "$dir"
403                 # remove stuff radiant has no use for
404                 verbose find . -name \*_norm.\* -exec rm -f {} \;
405                 verbose find . -name \*_bump.\* -exec rm -f {} \;
406                 verbose find . -name \*_glow.\* -exec rm -f {} \;
407                 verbose find . -name \*_gloss.\* -exec rm -f {} \;
408                 verbose find . -name \*_pants.\* -exec rm -f {} \;
409                 verbose find . -name \*_shirt.\* -exec rm -f {} \;
410                 verbose find . -name \*_reflect.\* -exec rm -f {} \;
411                 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
412                 # texture: convert to jpeg and dds
413                 # music: reduce bitrate
414                 verbose export do_jpeg=true
415                 verbose export jpeg_qual_rgb=80
416                 verbose export jpeg_qual_a=97
417                 verbose export do_dds=false
418                 verbose export do_ogg=true
419                 verbose export ogg_qual=1
420                 verbose export del_src=true
421                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
422                 ;;
423         release-buildpk3)
424                 release_common
425                 src=$1
426                 dst=$2
427                 transform=$3
428                 case "$dst" in
429                         /*)
430                                 ;;
431                         */)
432                                 dst="$PWD/$dst"
433                                 ;;
434                 esac
435                 release_timereport
436                 verbose rm -rf Xonotic/temp
437                 release_timereport "deleted temp directory"
438                 verbose mkdir -p Xonotic/temp
439                 release_git_extract_dir "$src" "Xonotic/temp" .
440                 release_timereport "extracted data"
441                 verbose cd Xonotic/temp
442                 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
443                         verbose cp ../source/progs.dat .
444                         verbose cp ../source/csprogs.dat .
445                         verbose cp ../source/menu.dat .
446                         verbose rm -rf qcsrc
447                         getversion .
448                         case "$RELEASETYPE" in
449                                 release)
450                                         ;;
451                                 *)
452                                         versionstr="$versionstr$RELEASETYPE"
453                                         ;;
454                         esac
455                         if [ $gv -lt 9900 ]; then
456                                 # pre-1.0: compatible with any other pre-1.0
457                                 verbose sed "
458                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
459                                         s/^gameversion_min [0-9]*/gameversion_min     0/;
460                                         s/^gameversion_max [0-9]*/gameversion_max  9999/;
461                                 " < defaultXonotic.cfg > defaultXonotic.cfg.new
462                         else
463                                 # >= 1.0
464                                 verbose sed "
465                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
466                                         s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
467                                         s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
468                                 " < defaultXonotic.cfg > defaultXonotic.cfg.new
469                         fi
470                         mv defaultXonotic.cfg.new defaultXonotic.cfg
471                         case "$RELEASETYPE" in
472                                 release)
473                                         echo "" >> defaultXonotic.cfg
474                                         echo "// nicer menu" >> defaultXonotic.cfg
475                                         echo "set menu_watermark \"\"" >> defaultXonotic.cfg
476                                         ;;
477                         esac
478                         (
479                                 verbose cd gfx/menu/luminos
480                                 verbose rm -f background_l2.tga background_ingame_l2.tga
481                                 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
482                                 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
483                                 verbose rm background_l2.svg
484                         )
485                 fi
486                 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
487                         for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
488                                 if [ -f "$X" ]; then
489                                         verbose unzip "$X"
490                                         verbose rm -f maps/*.log maps/*.irc maps/*.lin
491                                 fi
492                         done
493                 fi
494                 verbose export git_src_repo="$d0/$src" # skip hash-object
495                 release_timereport "processed data"
496                 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
497                 release_timereport "transformed data"
498                 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
499                 release_timereport "deduplicated data"
500                 verbose mkzipr "../../$dst" *
501                 release_timereport "zipped data"
502                 verbose cd ../..
503                 verbose rm -rf Xonotic/temp
504                 release_timereport "deleted temp directory again"
505                 ;;
506         release-buildpk3s)
507                 release_common
508                 pk3stamp=`cat Xonotic/pk3stamp.txt`
509                 src=$1
510                 shift
511                 dst=${src%.pk3dir}
512                 case "$dst" in
513                         data/xonotic-*)
514                                 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
515                                 ;;
516                         *)
517                                 dst="$dst-$pk3stamp"
518                                 ;;
519                 esac
520                 while [ "$#" -gt 1 ]; do
521                         verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
522                         shift
523                         shift
524                 done
525                 ;;
526         release-pack)
527                 release_common
528                 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir  raw ''
529                 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir     raw ''
530                 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             low '-low' normaldds ''
531                 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             low '-low' normaldds '' mapping '-mapping'
532                 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw '' low '-low'
533                 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                   normaldds ''
534                 ;;
535         release-pack-needsx11)
536                 release_common
537                 case "$DISPLAY" in
538                         '')
539                                 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
540                                 ;;
541                         *)
542                                 verbose "$SELF" release-pack
543                                 ;;
544                 esac
545                 ;;
546         release-zip)
547                 release_common
548                 stamp=`cat Xonotic/stamp.txt`
549                 pk3stamp=`cat Xonotic/pk3stamp.txt`
550                 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
551                 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
552                 # let's pass crypto import laws of some nasty countries
553                 crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
554                 if [ -n "$crypto_libs" ]; then
555                         verbose mkzip Xonotic-$stamp-crypto.zip \
556                                 $crypto_libs \
557                                 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
558                         rm -f $crypto_libs
559                 fi
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/fteqcc/ \
577                         Xonotic/source/gmqcc/ \
578                         Xonotic/source/qcsrc/ \
579                         Xonotic/Docs \
580                         Xonotic/misc \
581                         Xonotic/fteqcc \
582                         Xonotic/gmqcc \
583                         Xonotic/server \
584                         Xonotic/key_0.d0pk \
585                         Xonotic/data/font-nimbussansl-$pk3stamp.pk3 \
586                         Xonotic/data/font-xolonium-$pk3stamp.pk3
587                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
588                 verbose mkzip Xonotic-$stamp-source.zip \
589                         Xonotic/source/d0_blind_id/ \
590                         Xonotic/source/fteqcc/ \
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 mv 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 mkzip Xonotic-$stamp-mappingsupport.zip \
606                         Xonotic/mapping
607                 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
608                         Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
609                 verbose mkzip gmqcc-$stamp.zip \
610                         Xonotic/gmqcc \
611                         Xonotic/source/gmqcc
612                 ;;
613         release)
614                 release_common
615                 verbose "$SELF" release-prepare
616                 verbose "$SELF" release-maps
617                 verbose "$SELF" release-engine
618                 verbose "$SELF" release-qc
619                 verbose "$SELF" release-pack-needsx11
620                 verbose "$SELF" release-zip
621                 ;;
622         *)
623                 handled=false
624                 ;;
625 esac