]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/all/release.subr
Cleaning up release script
[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/xonotic-common.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-linux64 (with gcc on x86_64)
134                                 #   - xonotic-build-win32 (with i686-w64-mingw32)
135                                 #   - xonotic-build-win64 (with x86_64-w64-mingw32)
136                                 #   - xonotic-build-osx (with Xcode and SDL.framework)
137                                 # - AMD Compressonator installed in WINE
138                                 # - ResEdit installed in WINE
139                                 # - a lot of other requirements you will figure out
140                                 #   while reading the error messages
141                                 # - environment variable RELEASETYPE set
142                                 # - optionally, environment variable RELEASEDATE set
143                                 #   (YYYYMMDD)
144                                 exit 1
145                                 ;;
146                         release)
147                                 msg "Building a FINISHED RELEASE"
148                                 getversion data/xonotic-data.pk3dir
149                                 verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
150                                 ;;
151                         *)
152                                 msg "Building a $RELEASETYPE"
153                                 ;;
154                 esac
155                 verbose rm -rf Xonotic Xonotic*.zip
156                 verbose mkdir -p Xonotic
157                 if [ -n "$RELEASEDATE" ]; then
158                         verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
159                         case "$RELEASETYPE" in
160                                 release)
161                                         verbose $ECHO "${RELEASEDATE%_*}" > Xonotic/pk3stamp.txt
162                                         ;;
163                                 *)
164                                         verbose $ECHO "$RELEASEDATE" > Xonotic/pk3stamp.txt
165                                         ;;
166                         esac
167                 else
168                         verbose date +%Y%m%d > Xonotic/stamp.txt
169                         verbose date +%Y%m%d > Xonotic/pk3stamp.txt
170                 fi
171                 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
172                 (
173                         verbose cd Xonotic
174                         verbose mkdir data source source/darkplaces source/gmqcc source/d0_blind_id mapping
175                         verbose rm -rf misc/builddeps
176                         #verbose mv bin32/SDL.dll . || true # Leftover?
177
178                         # We're going to be building these later
179                         #verbose mv misc/buildfiles/win32 bin32 || true
180                         #verbose mv misc/buildfiles/win64 bin64 || true
181
182                         verbose mv misc/buildfiles/osx/* . || true
183                         verbose rm -rf misc/buildfiles
184                         verbose rm -rf misc/pki
185                 )
186                 release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
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 [ -z "$targetfiles" ]; then
218                         exit
219                 fi
220                 case " $HOSTS_THAT_ARE_DISABLED " in
221                         *\ $host\ *)
222                                 exit
223                                 ;;
224                 esac
225                 case " $HOSTS_THAT_ARE_MYSELF " in
226                         *\ $host\ *)
227                                 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
228                                 verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$buildpath"/darkplaces.ico
229                                 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$buildpath.deps/"
230                                 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
231                                 verbose eval make -C "$buildpath" clean $maketargets $makeflags
232                                 for f in $targetfiles; do
233                                         verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
234                                 done
235                                 ;;
236                         *)
237                                 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host":"$buildpath/"
238                                 verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$host":"$buildpath"/darkplaces.ico
239                                 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$host":"$buildpath.deps/"
240                                 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"
241                                 for f in $targetfiles; do
242                                         verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
243                                 done
244                                 ;;
245                 esac
246                 ;;
247         release-compile)
248                 release_common
249                 suffix=$1
250                 makeflags=$2
251                 darkplaces_maketargets=$3
252                 darkplaces_files=$4
253                 host=xonotic-build-$suffix
254                 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/$suffix" "$darkplaces_files"
255                 ;;
256         release-getbinary)
257                 release_common
258                 binary=$1
259                 basename=${binary##*/}
260                 dpname=darkplaces${basename#xonotic}
261                 rev=`( cd "$d0/darkplaces" && git rev-parse HEAD )`
262                 verbose wget -O "$binary" "http://beta.xonotic.org/autobuild-bin/$rev/$dpname"
263                 [ -s "$binary" ] || rm -f "$binary"
264                 [ -f "$binary" ]
265                 case "$binary" in
266                         Xonotic/*osx*|Xonotic/*linux*)
267                                 chmod +x "$binary"
268                                 ;;
269                 esac
270                 ;;
271         release-dlls-compile)
272                 release_common
273                 arch=$1
274                 buildpath=$2
275                 targetdir=$3
276                 mkdir -p "$targetdir"
277                 (
278                         cd "$misc/buildsrc"
279                         verbose ./dlls.sh all "$buildpath" "$arch"
280                 )
281                 verbose cp -v $buildpath/out/$arch/* "$targetdir"
282                 ;;
283         release-dlls-win32)
284                 release_common
285                 verbose "$SELF" release-dlls-compile win32 /tmp/dlls Xonotic/bin32
286                 ;;
287         release-dlls-win64)
288                 release_common
289                 verbose "$SELF" release-dlls-compile win64 /tmp/dlls Xonotic/bin64
290                 ;;
291         release-dlls-clean)
292                 release_common
293                 verbose misc/buildsrc/dlls.sh clean /tmp/dlls
294                 ;;
295         release-dlls)
296                 release_common
297                 good=false
298                 verbose "$SELF" release-dlls-win32
299                 verbose "$SELF" release-dlls-win64
300                 verbose "$SELF" release-dlls-clean
301                 $good
302                 ;;
303         release-engine-win32)
304                 release_common
305                 #good=true
306                 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86.exe || good=false
307                 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false
308                 #$good
309                 verbose "$SELF" release-compile win32 \
310                         'STRIP=: D3D=1 DP_MAKE_TARGET=mingw WIN32RELEASE=1 CC="i686-w64-mingw32-gcc -static -g1 -mstackrealign -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" WINDRES="i686-w64-mingw32-windres" SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen' \
311                         release 'darkplaces.exe:Xonotic/xonotic-x86-wgl.exe darkplaces-sdl.exe:Xonotic/xonotic-x86.exe darkplaces-dedicated.exe:Xonotic/xonotic-x86-dedicated.exe'
312                 ;;
313         release-engine-win64)
314                 release_common
315                 #good=true
316                 #verbose "$SELF" release-getbinary Xonotic/xonotic.exe || good=false
317                 #verbose "$SELF" release-getbinary Xonotic/xonotic-dedicated.exe || good=false
318                 #$good
319                 verbose "$SELF" release-compile win64 \
320                         'STRIP=: D3D=1 DP_MAKE_TARGET=mingw WIN64RELEASE=1 CC="x86_64-w64-mingw32-gcc -static -g1 -Wl,--dynamicbase -Wl,--nxcompat -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG="../../../.deps/bin/sdl2-config" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=dlopen' \
321                         release 'darkplaces.exe:Xonotic/xonotic-wgl.exe darkplaces-sdl.exe:Xonotic/xonotic.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
322                 ;;
323         release-engine-osx)
324                 release_common
325                 #good=true
326                 #verbose "$SELF" release-getbinary Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin || good=false
327                 #verbose "$SELF" release-getbinary Xonotic/xonotic-osx-dedicated || good=false
328                 #$good
329                 # Note: travis build script also had SDLCONFIG_MACOSX* flags; need to check if they're still needed with osxcross.
330                 verbose "$SELF" release-compile osx \
331                         'STRIP=: DP_MAKE_TARGET=macosx CC="$HOME/osxcross/out/bin/o64-clang -g1 -arch x86_64 -mmacosx-version-min=10.6 -Wl,-rpath -Wl,@loader_path/../Frameworks -Wl,-rpath -Wl,@loader_path -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" SDLCONFIG_MACOSXCFLAGS="-I../../../.deps/SDL2.framework/Headers" SDLCONFIG_MACOSXLIBS="-F../../../.deps -framework SDL2 -framework Cocoa -I../../../.deps/SDL2.framework/Headers" SDLCONFIG_MACOSXSTATICLIBS="-F../../../.deps -framework SDL2 -framework Cocoa -I../../../.deps/SDL2.framework/Headers" DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_ZLIB=shared' \
332                         'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
333                 ;;
334         release-engine-linux64)
335                 release_common
336                 #good=true
337                 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-sdl || good=false
338                 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-glx || good=false
339                 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-dedicated || good=false
340                 #$good
341                 verbose "$SELF" release-compile linux64 \
342                         'STRIP=: CC="gcc -m64 -g1 -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" DP_LINK_CRYPTO=shared LIB_CRYPTO="../../../.deps/lib/libd0_blind_id.a ../../../.deps/lib/libgmp.a" DP_LINK_CRYPTO_RIJNDAEL=dlopen DP_LINK_JPEG=shared LIB_JPEG=/usr/lib/x86_64-linux-gnu/libjpeg.a DP_LINK_ODE=shared CFLAGS_ODE="-DUSEODE -DLINK_TO_LIBODE -DdDOUBLE" LIB_ODE="../../../.deps/lib/libode.a -lstdc++ -pthread" DP_LINK_ZLIB=shared' \
343                         release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
344                 ;;
345         release-engine)
346                 release_common
347                 # TODO report failures here.
348                 good=false
349                 verbose "$SELF" release-engine-linux64 && good=true
350                 verbose "$SELF" release-engine-win32 && good=true
351                 verbose "$SELF" release-engine-win64 && good=true
352                 verbose "$SELF" release-engine-osx && good=true
353                 $good
354                 ;;
355         release-maps)
356                 release_common
357                 verbose "$SELF" update-maps
358                 ;;
359         release-qc)
360                 release_common
361                 verbose make -C "$d0/gmqcc" gmqcc
362                 verbose env GIT_DIR="$d0/data/xonotic-data.pk3dir/.git" make -C Xonotic/source QCC="$d0/gmqcc/gmqcc" XON_BUILDSYSTEM=1 QCCFLAGS_WATERMARK='$(shell git describe --tags)' clean qc
363                 ;;
364         release-buildpk3-transform-raw)
365                 release_common
366                 dir=$1
367                 ;;
368         release-buildpk3-transform-normal)
369                 release_common
370                 dir=$1
371                 verbose cd "$dir"
372                 # texture: convert to jpeg and dds
373                 verbose export do_jpeg=true
374                 verbose export jpeg_qual_rgb=97
375                 verbose export jpeg_qual_a=99
376                 verbose export do_dds=false
377                 verbose export do_ogg=true
378                 verbose export ogg_ogg=false
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-normaldds)
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=95
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_ogg=false
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                         # Include line numbers in qc errors
447                         verbose cp ../source/progs.lno .
448                         verbose cp ../source/csprogs.lno .
449                         verbose cp ../source/menu.lno .
450                         verbose rm -rf qcsrc
451                         getversion .
452                         case "$RELEASETYPE" in
453                                 release)
454                                         ;;
455                                 *)
456                                         versionstr="$versionstr$RELEASETYPE"
457                                         ;;
458                         esac
459                         if [ $gv -lt 9900 ]; then
460                                 # pre-1.0: compatible with any other pre-1.0
461                                 verbose sed "
462                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
463                                         s/^gameversion_min [0-9]*/gameversion_min     0/;
464                                         s/^gameversion_max [0-9]*/gameversion_max  9999/;
465                                 " < xonotic-common.cfg > xonotic-common.cfg.new
466                         else
467                                 # >= 1.0
468                                 verbose sed "
469                                         s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
470                                         s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
471                                         s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
472                                 " < xonotic-common.cfg > xonotic-common.cfg.new
473                         fi
474                         mv xonotic-common.cfg.new xonotic-common.cfg
475                         case "$RELEASETYPE" in
476                                 release)
477                                         echo "" >> xonotic-common.cfg
478                                         echo "// nicer menu" >> xonotic-common.cfg
479                                         echo "set menu_watermark \"\"" >> xonotic-common.cfg
480                                         ;;
481                         esac
482                         (
483                                 verbose cd gfx/menu/luminos
484                                 verbose rm -f background_l2.tga background_ingame_l2.tga
485                                 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
486                                 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
487                                 verbose rm background_l2.svg
488                         )
489                         verbose "$d0"/mediasource/gfx/luma/render-version.sh "$d0/mediasource/gfx/luma" "$PWD" "$versionstr"
490                 fi
491                 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
492                         for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
493                                 if [ -f "$X" ]; then
494                                         verbose unzip "$X"
495                                         verbose rm -f maps/*.log maps/*.irc maps/*.lin
496                                 fi
497                         done
498                 fi
499                 verbose export git_src_repo="$d0/$src" # skip hash-object
500                 release_timereport "processed data"
501                 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
502                 release_timereport "transformed data"
503                 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
504                 release_timereport "deduplicated data"
505                 verbose mkzipr "../../$dst" *
506                 release_timereport "zipped data"
507                 verbose cd ../..
508                 verbose rm -rf Xonotic/temp
509                 release_timereport "deleted temp directory again"
510                 ;;
511         release-buildpk3s)
512                 release_common
513                 pk3stamp=`cat Xonotic/pk3stamp.txt`
514                 src=$1
515                 shift
516                 dst=${src%.pk3dir}
517                 case "$dst" in
518                         data/xonotic-*)
519                                 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
520                                 ;;
521                         *)
522                                 dst="$dst-$pk3stamp"
523                                 ;;
524                 esac
525                 while [ "$#" -gt 1 ]; do
526                         verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
527                         shift
528                         shift
529                 done
530                 ;;
531         release-pack)
532                 release_common
533                 verbose "$SELF" release-buildpk3s data/font-unifont.pk3dir      raw ''
534                 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir     raw ''
535                 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir             normaldds ''                    normal '-high'
536                 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir             normaldds '' mapping '-mapping' normal '-high'
537                 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir     raw ''
538                 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir        normaldds ''                    normal '-high'
539                 ;;
540         release-pack-needsx11)
541                 release_common
542                 case "$DISPLAY" in
543                         '')
544                                 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
545                                 ;;
546                         *)
547                                 verbose "$SELF" release-pack
548                                 ;;
549                 esac
550                 ;;
551         release-zip)
552                 release_common
553                 stamp=`cat Xonotic/stamp.txt`
554                 pk3stamp=`cat Xonotic/pk3stamp.txt`
555                 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
556                 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
557                 # build the archives
558                 verbose mkzip Xonotic-$stamp-enginesource.zip \
559                         Xonotic/Makefile \
560                         Xonotic/source/darkplaces/ \
561                         Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
562                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
563                 verbose mkzip Xonotic-$stamp-engine.zip \
564                         Xonotic/*.dll \
565                         Xonotic/bin32/*.dll \
566                         Xonotic/bin64/*.dll \
567                         Xonotic/*.app \
568                         Xonotic/xonotic-* \
569                         Xonotic/xonotic.exe
570                 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
571                 verbose mkzip Xonotic-$stamp-common.zip \
572                         Xonotic/source/d0_blind_id/ \
573                         Xonotic/source/gmqcc/ \
574                         Xonotic/source/qcsrc/ \
575                         Xonotic/Docs \
576                         Xonotic/misc \
577                         Xonotic/gmqcc \
578                         Xonotic/server \
579                         Xonotic/key_0.d0pk \
580                         Xonotic/data/font-unifont-$pk3stamp.pk3 \
581                         Xonotic/data/font-xolonium-$pk3stamp.pk3
582                 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
583                 verbose mkzip Xonotic-$stamp-source.zip \
584                         Xonotic/source/d0_blind_id/ \
585                         Xonotic/source/gmqcc/ \
586                         Xonotic/source/qcsrc/ \
587                         Xonotic/misc/logos
588                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
589                 verbose mkzip0 Xonotic-$stamp.zip \
590                         Xonotic/data/xonotic-$pk3stamp-data.pk3 \
591                         Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
592                         Xonotic/data/xonotic-$pk3stamp-music.pk3 \
593                         Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3
594                 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
595                 verbose mkzip0 Xonotic-$stamp-high.zip \
596                         Xonotic/data/xonotic-$pk3stamp-data-high.pk3 \
597                         Xonotic/data/xonotic-$pk3stamp-maps-high.pk3 \
598                         Xonotic/data/xonotic-$pk3stamp-music.pk3 \
599                         Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3
600                 verbose mkzip Xonotic-$stamp-mappingsupport.zip \
601                         Xonotic/mapping
602                 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
603                         Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
604                 verbose mkzip gmqcc-$stamp.zip \
605                         Xonotic/gmqcc \
606                         Xonotic/source/gmqcc
607                 ;;
608         release)
609                 release_common
610                 verbose "$SELF" release-prepare
611                 verbose "$SELF" release-maps
612                 verbose "$SELF" release-dlls
613                 verbose "$SELF" release-engine
614                 verbose "$SELF" release-qc
615                 verbose "$SELF" release-pack
616                 verbose "$SELF" release-zip
617                 ;;
618         *)
619                 handled=false
620                 ;;
621 esac