Merge branch 'sev/xolonium4_2' into 'master'
[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                 ;;
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                 fteqcc_maketargets=$5
259                 fteqcc_files=$6
260                 darkplaces_maketargets=$7
261                 darkplaces_files=$8
262                 host=xonotic-build-$suffix
263                 verbose "$SELF" release-compile-run "$host" /tmp/gmqcc.build."$suffix" "$gmqcc_maketargets" "$makeflags" "Xonotic/source/gmqcc" "$d0/misc/builddeps/dp.$suffix" "$gmqcc_files"
264                 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
265                 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
266                 ;;
267         release-engine-win32)
268                 release_common
269                 verbose "$SELF" release-compile win32 \
270                         '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' \
271                         gmqcc.exe 'gmqcc.exe:Xonotic/gmqcc/gmqcc.exe' \
272                         win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
273                         release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
274                 ;;
275         release-engine-win64)
276                 release_common
277                 verbose "$SELF" release-compile win64 \
278                         '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' \
279                         gmqcc.exe 'gmqcc.exe:Xonotic/gmqcc/gmqcc-x64.exe' \
280                         win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
281                         release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
282                 ;;
283         release-engine-osx)
284                 release_common
285                 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
286                 verbose "$SELF" release-compile osx \
287                         '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"' \
288                         gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.osx' \
289                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
290                         'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
291                 ;;
292         release-engine-linux32)
293                 release_common
294                 verbose "$SELF" release-compile linux32 \
295                         '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' \
296                         gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.linux32' \
297                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
298                         release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
299                 ;;
300         release-engine-linux64)
301                 release_common
302                 verbose "$SELF" release-compile linux64 \
303                         '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' \
304                         gmqcc 'gmqcc:Xonotic/gmqcc/gmqcc.linux64' \
305                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
306                         release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
307                 ;;
308         release-engine)
309                 release_common
310                 verbose "$SELF" release-engine-linux32 &
311                 verbose "$SELF" release-engine-linux64 &
312                 verbose "$SELF" release-engine-win32 &
313                 verbose "$SELF" release-engine-win64 &
314                 verbose "$SELF" release-engine-osx &
315                 wait %1
316                 wait %2
317                 wait %3
318                 wait %4
319                 wait %5
320                 wait
321                 ;;
322         release-maps)
323                 release_common
324                 verbose "$SELF" update-maps
325                 ;;
326         release-qc)
327                 release_common
328                 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
329                 verbose rm -f Xonotic/source/qcsrc/*/fteqcc.log
330                 ;;
331         release-buildpk3-transform-raw)
332                 release_common
333                 dir=$1
334                 ;;
335         release-buildpk3-transform-normal)
336                 release_common
337                 dir=$1
338                 verbose cd "$dir"
339                 # texture: convert to jpeg and dds
340                 verbose export do_jpeg=true
341                 verbose export jpeg_qual_rgb=97
342                 verbose export jpeg_qual_a=99
343                 verbose export do_dds=false
344                 verbose export do_ogg=true
345                 verbose export ogg_ogg=false
346                 verbose export del_src=true
347                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
348                 ;;
349         release-buildpk3-transform-normaldds)
350                 release_common
351                 dir=$1
352                 verbose cd "$dir"
353                 # texture: convert to jpeg and dds
354                 # music: reduce bitrate
355                 verbose export do_jpeg=false
356                 verbose export do_jpeg_if_not_dds=true
357                 verbose export jpeg_qual_rgb=95
358                 verbose export jpeg_qual_a=99
359                 verbose export do_dds=true
360                 verbose export dds_flags=
361                 verbose export do_ogg=true
362                 verbose export ogg_ogg=false
363                 verbose export del_src=true
364                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
365                 ;;
366         release-buildpk3-transform-low)
367                 release_common
368                 dir=$1
369                 verbose cd "$dir"
370                 # texture: convert to jpeg and dds
371                 # music: reduce bitrate
372                 verbose export do_jpeg=true
373                 verbose export jpeg_qual_rgb=80
374                 verbose export jpeg_qual_a=97
375                 verbose export do_dds=false
376                 verbose export do_ogg=true
377                 verbose export ogg_qual=1
378                 verbose export del_src=true
379                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
380                 ;;
381         release-buildpk3-transform-lowdds)
382                 release_common
383                 dir=$1
384                 verbose cd "$dir"
385                 # texture: convert to jpeg and dds
386                 # music: reduce bitrate
387                 verbose export do_jpeg=false
388                 verbose export do_jpeg_if_not_dds=true
389                 verbose export jpeg_qual_rgb=80
390                 verbose export jpeg_qual_a=99
391                 verbose export do_dds=true
392                 verbose export dds_flags=
393                 verbose export do_ogg=true
394                 verbose export ogg_qual=1
395                 verbose export del_src=true
396                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
397                 ;;
398         release-buildpk3-transform-mapping)
399                 release_common
400                 dir=$1
401                 verbose cd "$dir"
402                 # remove stuff radiant has no use for
403                 verbose find . -name \*_norm.\* -exec rm -f {} \;
404                 verbose find . -name \*_bump.\* -exec rm -f {} \;
405                 verbose find . -name \*_glow.\* -exec rm -f {} \;
406                 verbose find . -name \*_gloss.\* -exec rm -f {} \;
407                 verbose find . -name \*_pants.\* -exec rm -f {} \;
408                 verbose find . -name \*_shirt.\* -exec rm -f {} \;
409                 verbose find . -name \*_reflect.\* -exec rm -f {} \;
410                 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
411                 # texture: convert to jpeg and dds
412                 # music: reduce bitrate
413                 verbose export do_jpeg=true
414                 verbose export jpeg_qual_rgb=80
415                 verbose export jpeg_qual_a=97
416                 verbose export do_dds=false
417                 verbose export do_ogg=true
418                 verbose export ogg_qual=1
419                 verbose export del_src=true
420                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
421                 ;;
422         release-buildpk3)
423                 release_common
424                 src=$1
425                 dst=$2
426                 transform=$3
427                 case "$dst" in
428                         /*)
429                                 ;;
430                         */)
431                                 dst="$PWD/$dst"
432                                 ;;
433                 esac
434                 release_timereport
435                 verbose rm -rf Xonotic/temp
436                 release_timereport "deleted temp directory"
437                 verbose mkdir -p Xonotic/temp
438                 release_git_extract_dir "$src" "Xonotic/temp" .
439                 release_timereport "extracted data"
440                 verbose cd Xonotic/temp
441                 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
442                         verbose cp ../source/progs.dat .
443                         verbose cp ../source/csprogs.dat .
444                         verbose cp ../source/menu.dat .
445                         verbose rm -rf qcsrc
446                         getversion .
447                         case "$RELEASETYPE" in
448                                 release)
449                                         ;;
450                                 *)
451                                         versionstr="$versionstr$RELEASETYPE"
452                                         ;;
453                         esac
454                         if [ $gv -lt 9900 ]; then
455                                 # pre-1.0: compatible with any other pre-1.0
456                                 verbose sed "
457                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
458                                         s/^gameversion_min [0-9]*/gameversion_min     0/;
459                                         s/^gameversion_max [0-9]*/gameversion_max  9999/;
460                                 " < defaultXonotic.cfg > defaultXonotic.cfg.new
461                         else
462                                 # >= 1.0
463                                 verbose sed "
464                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
465                                         s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
466                                         s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
467                                 " < defaultXonotic.cfg > defaultXonotic.cfg.new
468                         fi
469                         mv defaultXonotic.cfg.new defaultXonotic.cfg
470                         case "$RELEASETYPE" in
471                                 release)
472                                         echo "" >> defaultXonotic.cfg
473                                         echo "// nicer menu" >> defaultXonotic.cfg
474                                         echo "set menu_watermark \"\"" >> defaultXonotic.cfg
475                                         ;;
476                         esac
477                         (
478                                 verbose cd gfx/menu/luminos
479                                 verbose rm -f background_l2.tga background_ingame_l2.tga
480                                 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
481                                 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
482                                 verbose rm background_l2.svg
483                         )
484                 fi
485                 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
486                         for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
487                                 if [ -f "$X" ]; then
488                                         verbose unzip "$X"
489                                         verbose rm -f maps/*.log maps/*.irc maps/*.lin
490                                 fi
491                         done
492                 fi
493                 verbose export git_src_repo="$d0/$src" # skip hash-object
494                 release_timereport "processed data"
495                 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
496                 release_timereport "transformed data"
497                 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
498                 release_timereport "deduplicated data"
499                 verbose mkzipr "../../$dst" *
500                 release_timereport "zipped data"
501                 verbose cd ../..
502                 verbose rm -rf Xonotic/temp
503                 release_timereport "deleted temp directory again"
504                 ;;
505         release-buildpk3s)
506                 release_common
507                 pk3stamp=`cat Xonotic/pk3stamp.txt`
508                 src=$1
509                 shift
510                 dst=${src%.pk3dir}
511                 case "$dst" in
512                         data/xonotic-*)
513                                 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
514                                 ;;
515                         *)
516                                 dst="$dst-$pk3stamp"
517                                 ;;
518                 esac
519                 while [ "$#" -gt 1 ]; do
520                         verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
521                         shift
522                         shift
523                 done
524                 ;;
525         release-pack)
526                 release_common
527                 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir  raw ''
528                 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir     raw ''
529                 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             low '-low' normaldds ''
530                 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             low '-low' normaldds '' mapping '-mapping'
531                 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw '' low '-low'
532                 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                   normaldds ''
533                 ;;
534         release-pack-needsx11)
535                 release_common
536                 case "$DISPLAY" in
537                         '')
538                                 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
539                                 ;;
540                         *)
541                                 verbose "$SELF" release-pack
542                                 ;;
543                 esac
544                 ;;
545         release-zip)
546                 release_common
547                 stamp=`cat Xonotic/stamp.txt`
548                 pk3stamp=`cat Xonotic/pk3stamp.txt`
549                 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
550                 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
551                 # let's pass crypto import laws of some nasty countries
552                 crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
553                 if [ -n "$crypto_libs" ]; then
554                         verbose mkzip Xonotic-$stamp-crypto.zip \
555                                 $crypto_libs \
556                                 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
557                         rm -f $crypto_libs
558                 fi
559                 # build the archives
560                 verbose mkzip Xonotic-$stamp-enginesource.zip \
561                         Xonotic/Makefile \
562                         Xonotic/source/darkplaces/ \
563                         Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
564                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
565                 verbose mkzip Xonotic-$stamp-engine.zip \
566                         Xonotic/*.dll \
567                         Xonotic/bin32/*.dll \
568                         Xonotic/bin64/*.dll \
569                         Xonotic/*.app \
570                         Xonotic/xonotic-* \
571                         Xonotic/xonotic.exe
572                 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
573                 verbose mkzip Xonotic-$stamp-common.zip \
574                         Xonotic/source/d0_blind_id/ \
575                         Xonotic/source/fteqcc/ \
576                         Xonotic/source/gmqcc/ \
577                         Xonotic/source/qcsrc/ \
578                         Xonotic/Docs \
579                         Xonotic/misc \
580                         Xonotic/fteqcc \
581                         Xonotic/gmqcc \
582                         Xonotic/server \
583                         Xonotic/key_0.d0pk \
584                         Xonotic/data/font-nimbussansl-$pk3stamp.pk3 \
585                         Xonotic/data/font-xolonium-$pk3stamp.pk3
586                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
587                 verbose mkzip Xonotic-$stamp-source.zip \
588                         Xonotic/source/d0_blind_id/ \
589                         Xonotic/source/fteqcc/ \
590                         Xonotic/source/gmqcc/ \
591                         Xonotic/source/qcsrc/ \
592                         Xonotic/misc/logos
593                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
594                 verbose mkzip0 Xonotic-$stamp.zip \
595                         Xonotic/data/xonotic-$pk3stamp-data.pk3 \
596                         Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
597                         Xonotic/data/xonotic-$pk3stamp-music.pk3 \
598                         Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3
599                 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
600                 verbose mkzip0 Xonotic-$stamp-low.zip \
601                         Xonotic/data/xonotic-$pk3stamp-data-low.pk3 \
602                         Xonotic/data/xonotic-$pk3stamp-maps-low.pk3 \
603                         Xonotic/data/xonotic-$pk3stamp-music-low.pk3
604                 verbose mkzip Xonotic-$stamp-mappingsupport.zip \
605                         Xonotic/mapping
606                 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
607                         Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
608                 verbose mkzip gmqcc-$stamp.zip \
609                         Xonotic/gmqcc \
610                         Xonotic/source/gmqcc
611                 ;;
612         release)
613                 release_common
614                 verbose "$SELF" release-prepare
615                 verbose "$SELF" release-maps
616                 verbose "$SELF" release-engine
617                 verbose "$SELF" release-qc
618                 verbose "$SELF" release-pack-needsx11
619                 verbose "$SELF" release-zip
620                 ;;
621         *)
622                 handled=false
623                 ;;
624 esac