disable fteqcc compilation
[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" LIB_JPEG= CFLAGS_LIBJPEG= 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" LIB_JPEG= CFLAGS_LIBJPEG= 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"' \
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" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib DP_GMP_STATIC_LIBDIR=.deps/lib' \
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" 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.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-lowdds)
373                 release_common
374                 dir=$1
375                 verbose cd "$dir"
376                 # texture: convert to jpeg and dds
377                 # music: reduce bitrate
378                 verbose export do_jpeg=false
379                 verbose export do_jpeg_if_not_dds=true
380                 verbose export jpeg_qual_rgb=80
381                 verbose export jpeg_qual_a=99
382                 verbose export do_dds=true
383                 verbose export dds_flags=
384                 verbose export do_ogg=true
385                 verbose export ogg_qual=1
386                 verbose export del_src=true
387                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
388                 ;;
389         release-buildpk3-transform-mapping)
390                 release_common
391                 dir=$1
392                 verbose cd "$dir"
393                 # remove stuff radiant has no use for
394                 verbose find . -name \*_norm.\* -exec rm -f {} \;
395                 verbose find . -name \*_bump.\* -exec rm -f {} \;
396                 verbose find . -name \*_glow.\* -exec rm -f {} \;
397                 verbose find . -name \*_gloss.\* -exec rm -f {} \;
398                 verbose find . -name \*_pants.\* -exec rm -f {} \;
399                 verbose find . -name \*_shirt.\* -exec rm -f {} \;
400                 verbose find . -name \*_reflect.\* -exec rm -f {} \;
401                 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
402                 # texture: convert to jpeg and dds
403                 # music: reduce bitrate
404                 verbose export do_jpeg=true
405                 verbose export jpeg_qual_rgb=80
406                 verbose export jpeg_qual_a=97
407                 verbose export do_dds=false
408                 verbose export do_ogg=true
409                 verbose export ogg_qual=1
410                 verbose export del_src=true
411                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
412                 ;;
413         release-buildpk3)
414                 release_common
415                 src=$1
416                 dst=$2
417                 transform=$3
418                 case "$dst" in
419                         /*)
420                                 ;;
421                         */)
422                                 dst="$PWD/$dst"
423                                 ;;
424                 esac
425                 release_timereport
426                 verbose rm -rf Xonotic/temp
427                 release_timereport "deleted temp directory"
428                 verbose mkdir -p Xonotic/temp
429                 release_git_extract_dir "$src" "Xonotic/temp" .
430                 release_timereport "extracted data"
431                 verbose cd Xonotic/temp
432                 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
433                         verbose cp ../source/progs.dat .
434                         verbose cp ../source/csprogs.dat .
435                         verbose cp ../source/menu.dat .
436                         verbose rm -rf qcsrc
437                         getversion .
438                         case "$RELEASETYPE" in
439                                 release)
440                                         ;;
441                                 *)
442                                         versionstr="$versionstr$RELEASETYPE"
443                                         ;;
444                         esac
445                         if [ $gv -lt 9900 ]; then
446                                 # pre-1.0: compatible with any other pre-1.0
447                                 verbose sed "
448                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
449                                         s/^gameversion_min [0-9]*/gameversion_min     0/;
450                                         s/^gameversion_max [0-9]*/gameversion_max  9999/;
451                                 " < defaultXonotic.cfg > defaultXonotic.cfg.new
452                         else
453                                 # >= 1.0
454                                 verbose sed "
455                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
456                                         s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
457                                         s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
458                                 " < defaultXonotic.cfg > defaultXonotic.cfg.new
459                         fi
460                         mv defaultXonotic.cfg.new defaultXonotic.cfg
461                         case "$RELEASETYPE" in
462                                 release)
463                                         echo "" >> defaultXonotic.cfg
464                                         echo "// nicer menu" >> defaultXonotic.cfg
465                                         echo "set menu_watermark \"\"" >> defaultXonotic.cfg
466                                         ;;
467                         esac
468                         (
469                                 verbose cd gfx/menu/luminos
470                                 verbose rm -f background_l2.tga background_ingame_l2.tga
471                                 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
472                                 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
473                                 verbose rm background_l2.svg
474                         )
475                 fi
476                 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
477                         for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
478                                 if [ -f "$X" ]; then
479                                         verbose unzip "$X"
480                                         verbose rm -f maps/*.log maps/*.irc maps/*.lin
481                                 fi
482                         done
483                 fi
484                 verbose export git_src_repo="$d0/$src" # skip hash-object
485                 release_timereport "processed data"
486                 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
487                 release_timereport "transformed data"
488                 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
489                 release_timereport "deduplicated data"
490                 verbose mkzipr "../../$dst" *
491                 release_timereport "zipped data"
492                 verbose cd ../..
493                 verbose rm -rf Xonotic/temp
494                 release_timereport "deleted temp directory again"
495                 ;;
496         release-buildpk3s)
497                 release_common
498                 pk3stamp=`cat Xonotic/pk3stamp.txt`
499                 src=$1
500                 shift
501                 dst=${src%.pk3dir}
502                 case "$dst" in
503                         data/xonotic-*)
504                                 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
505                                 ;;
506                         *)
507                                 dst="$dst-$pk3stamp"
508                                 ;;
509                 esac
510                 while [ "$#" -gt 1 ]; do
511                         verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
512                         shift
513                         shift
514                 done
515                 ;;
516         release-pack)
517                 release_common
518                 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir  raw ''
519                 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir     raw ''
520                 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             low '-low' normaldds ''
521                 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             low '-low' normaldds '' mapping '-mapping'
522                 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw '' low '-low'
523                 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                   normaldds ''
524                 ;;
525         release-pack-needsx11)
526                 release_common
527                 case "$DISPLAY" in
528                         '')
529                                 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
530                                 ;;
531                         *)
532                                 verbose "$SELF" release-pack
533                                 ;;
534                 esac
535                 ;;
536         release-zip)
537                 release_common
538                 stamp=`cat Xonotic/stamp.txt`
539                 pk3stamp=`cat Xonotic/pk3stamp.txt`
540                 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
541                 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
542                 # let's pass crypto import laws of some nasty countries
543                 crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
544                 if [ -n "$crypto_libs" ]; then
545                         verbose mkzip Xonotic-$stamp-crypto.zip \
546                                 $crypto_libs \
547                                 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
548                         rm -f $crypto_libs
549                 fi
550                 # build the archives
551                 verbose mkzip Xonotic-$stamp-enginesource.zip \
552                         Xonotic/Makefile \
553                         Xonotic/source/darkplaces/ \
554                         Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
555                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
556                 verbose mkzip Xonotic-$stamp-engine.zip \
557                         Xonotic/*.dll \
558                         Xonotic/bin32/*.dll \
559                         Xonotic/bin64/*.dll \
560                         Xonotic/*.app \
561                         Xonotic/xonotic-* \
562                         Xonotic/xonotic.exe
563                 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
564                 verbose mkzip Xonotic-$stamp-common.zip \
565                         Xonotic/source/d0_blind_id/ \
566                         Xonotic/source/gmqcc/ \
567                         Xonotic/source/qcsrc/ \
568                         Xonotic/Docs \
569                         Xonotic/misc \
570                         Xonotic/gmqcc \
571                         Xonotic/server \
572                         Xonotic/key_0.d0pk \
573                         Xonotic/data/font-nimbussansl-$pk3stamp.pk3 \
574                         Xonotic/data/font-xolonium-$pk3stamp.pk3
575                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
576                 verbose mkzip Xonotic-$stamp-source.zip \
577                         Xonotic/source/d0_blind_id/ \
578                         Xonotic/source/gmqcc/ \
579                         Xonotic/source/qcsrc/ \
580                         Xonotic/misc/logos
581                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
582                 verbose mkzip0 Xonotic-$stamp.zip \
583                         Xonotic/data/xonotic-$pk3stamp-data.pk3 \
584                         Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
585                         Xonotic/data/xonotic-$pk3stamp-music.pk3 \
586                         Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3
587                 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
588                 verbose mkzip0 Xonotic-$stamp-low.zip \
589                         Xonotic/data/xonotic-$pk3stamp-data-low.pk3 \
590                         Xonotic/data/xonotic-$pk3stamp-maps-low.pk3 \
591                         Xonotic/data/xonotic-$pk3stamp-music-low.pk3
592                 verbose mkzip Xonotic-$stamp-mappingsupport.zip \
593                         Xonotic/mapping
594                 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
595                         Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
596                 verbose mkzip gmqcc-$stamp.zip \
597                         Xonotic/gmqcc \
598                         Xonotic/source/gmqcc
599                 ;;
600         release)
601                 release_common
602                 verbose "$SELF" release-prepare
603                 verbose "$SELF" release-maps
604                 verbose "$SELF" release-engine
605                 verbose "$SELF" release-qc
606                 verbose "$SELF" release-pack-needsx11
607                 verbose "$SELF" release-zip
608                 ;;
609         *)
610                 handled=false
611                 ;;
612 esac