6 msg "*** $release_args: start"
7 release_starttime=`date +%s`
10 release_endtime=`date +%s`
11 release_deltatime=$(($release_endtime - $release_starttime))
12 msg "*** $release_args: $release_deltatime seconds"
15 release_tempstarttime=$release_starttime
18 release_endtime=`date +%s` # RELEASE NOW!!!
20 release_deltatime=$(($release_endtime - $release_tempstarttime))
21 msg "**** $release_args: $*: $release_deltatime seconds"
23 release_tempstarttime=$release_endtime
25 release_git_extract_dir()
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"
33 verbose cd "$release_src"
34 git ls-files HEAD -- "$@"
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"
43 verbose cd "$release_src"
44 verbose git archive --format=tar HEAD -- "$@"
46 verbose cd "$release_dst"
55 case "$RELEASETYPE" in
65 find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
67 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
68 7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
69 zip $zipflags -y -@<"$ziplist" "$archive" || true
76 case "$RELEASETYPE" in
87 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
88 7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
89 zip $zipflags -y -@<"$ziplist" "$archive" || true
96 zip -0ry "$archive" "$@"
100 gv=`grep "^gameversion " "$1/defaultXonotic.cfg" | awk '{ print $2 }'`
101 major=$(($gv / 10000))
102 minor=$((($gv / 100) - ($major * 100)))
103 patch=$(($gv - ($major * 10000) - ($minor * 100)))
104 versionstr="$major.$minor.$patch"
110 # release building goes here
113 #"$SELF" each git clean -fxd
114 case "$RELEASETYPE" in
116 $ECHO >&2 -n "$ESC[2J$ESC[H"
123 msg " +---------------------------------------------------------.---+"
125 msg " +---------------------------------------------------------^---+"
127 msg " | / \ This is the official release build system. |"
128 msg " | | | If you are not a member of the Xonotic Core Team, |"
129 msg " | | STOP | you are not supposed to use this script and should |"
130 msg " | | | instead use ./all compile to compile the engine |"
131 msg " | \____/ and game code. |"
133 msg " | [ I understand ] |"
134 msg " +-------------------------------------------------------------+"
136 # A LOT of build infrastructure is required:
139 # - .ssh/config must be configured so the following
140 # host names are reachable and have a compile
141 # infrastructure set up:
142 # - xonotic-build-linux32 (with gcc on x86)
143 # - xonotic-build-linux64 (with gcc on x86_64)
144 # - xonotic-build-win32 (with i586-mingw32msvc-g++)
145 # - xonotic-build-win64 (with amd64-mingw32msvc-g++
146 # and x86_64-w64-mingw32-g++)
147 # - xonotic-build-osx (with Xcode and SDL.framework)
148 # - AMD Compressonator installed in WINE
149 # - ResEdit installed in WINE
150 # - a lot of other requirements you will figure out
151 # while reading the error messages
152 # - environment variable RELEASETYPE set
153 # - optionally, environment variable RELEASEDATE set
158 msg "Building a FINISHED RELEASE"
159 getversion data/xonotic-data.pk3dir
160 verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
163 msg "Building a $RELEASETYPE"
166 verbose rm -rf Xonotic Xonotic*.zip
167 verbose mkdir -p Xonotic
168 if [ -n "$RELEASEDATE" ]; then
169 verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
171 verbose date +%Y%m%d > Xonotic/stamp.txt
173 release_git_extract_dir "." "Xonotic" Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles key_0.d0pk COPYING GPL-2 GPL-3
176 verbose mkdir data fteqcc source source/darkplaces source/fteqcc 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
185 release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
186 release_git_extract_dir "fteqcc" "Xonotic/source/fteqcc" .
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" .
190 verbose cd Xonotic/source/d0_blind_id
191 verbose sh autogen.sh
193 rm -f Xonotic/key_15.d0pk
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
202 # TODO possibly include other tools?
215 if [ -n "$targetfiles" ]; then
216 case " $HOSTS_THAT_ARE_DISABLED " in
221 case " $HOSTS_THAT_ARE_MYSELF " in
223 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
224 verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
225 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
226 verbose eval make -C "$buildpath" clean $maketargets $makeflags
227 for f in $targetfiles; do
228 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
232 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
233 verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
234 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"
235 for f in $targetfiles; do
236 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
240 # now rebrand the binaries...
241 for f in $targetfiles; do
242 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
244 Xonotic/xonotic*.exe)
245 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
255 fteqcc_maketargets=$3
257 darkplaces_maketargets=$5
259 host=xonotic-build-$suffix
260 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
261 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
263 release-engine-win32)
265 verbose "$SELF" release-compile win32 \
266 'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -march=i686 -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=0' \
267 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
269 verbose "$SELF" release-compile win32 \
270 'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-g++ -g1 -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DUSE_WSPIAPI_H -DSUPPORTIPV6" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN32RELEASE=1 D3D=1' \
272 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
274 release-engine-win64)
276 verbose "$SELF" release-compile win64 \
277 'STRIP=: DP_MAKE_TARGET=mingw 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=0' \
278 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
279 'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
280 verbose "$SELF" release-compile win64 \
281 'STRIP=: DP_MAKE_TARGET=mingw CC="x86_64-w64-mingw32-g++ -g1 -Wl,--dynamicbase -Wl,--nxcompat -I.deps/include -L.deps/lib -DSUPPORTIPV6" WINDRES="x86_64-w64-mingw32-windres" SDL_CONFIG=".deps/bin/sdl-config" LIB_JPEG= CFLAGS_LIBJPEG= WIN64RELEASE=1 D3D=1' \
283 cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
287 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
288 verbose "$SELF" release-compile osx \
289 '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"' \
290 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
291 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
293 release-engine-linux32)
295 verbose "$SELF" release-compile linux32 \
296 'STRIP=: CC="gcc -m32 -march=i686 -g1 -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a DP_CRYPTO_STATIC_LIBDIR=.deps/lib' \
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'
300 release-engine-linux64)
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' \
304 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
305 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
309 verbose "$SELF" release-engine-linux32 &
310 verbose "$SELF" release-engine-linux64 &
311 verbose "$SELF" release-engine-win32 &
312 verbose "$SELF" release-engine-win64 &
313 verbose "$SELF" release-engine-osx &
323 verbose "$SELF" update-maps
327 verbose env GIT_DIR="$d0/data/xonotic-data.pk3dir/.git" make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
328 verbose rm -f Xonotic/source/qcsrc/*/fteqcc.log
330 release-buildpk3-transform-raw)
334 release-buildpk3-transform-normal)
338 # texture: convert to jpeg and dds
339 verbose export do_jpeg=true
340 verbose export jpeg_qual_rgb=97
341 verbose export jpeg_qual_a=99
342 verbose export do_dds=false
343 verbose export do_ogg=true
344 verbose export ogg_ogg=false
345 verbose export del_src=true
346 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
348 release-buildpk3-transform-normaldds)
352 # texture: convert to jpeg and dds
353 # music: reduce bitrate
354 verbose export do_jpeg=false
355 verbose export do_jpeg_if_not_dds=true
356 verbose export jpeg_qual_rgb=95
357 verbose export jpeg_qual_a=99
358 verbose export do_dds=true
359 verbose export dds_flags=
360 verbose export do_ogg=true
361 verbose export ogg_ogg=false
362 verbose export del_src=true
363 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
365 release-buildpk3-transform-low)
369 # texture: convert to jpeg and dds
370 # music: reduce bitrate
371 verbose export do_jpeg=true
372 verbose export jpeg_qual_rgb=80
373 verbose export jpeg_qual_a=97
374 verbose export do_dds=false
375 verbose export do_ogg=true
376 verbose export ogg_qual=1
377 verbose export del_src=true
378 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
380 release-buildpk3-transform-lowdds)
384 # texture: convert to jpeg and dds
385 # music: reduce bitrate
386 verbose export do_jpeg=false
387 verbose export do_jpeg_if_not_dds=true
388 verbose export jpeg_qual_rgb=80
389 verbose export jpeg_qual_a=99
390 verbose export do_dds=true
391 verbose export dds_flags=
392 verbose export do_ogg=true
393 verbose export ogg_qual=1
394 verbose export del_src=true
395 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
397 release-buildpk3-transform-mapping)
401 # remove stuff radiant has no use for
402 verbose find . -name \*_norm.\* -exec rm -f {} \;
403 verbose find . -name \*_bump.\* -exec rm -f {} \;
404 verbose find . -name \*_glow.\* -exec rm -f {} \;
405 verbose find . -name \*_gloss.\* -exec rm -f {} \;
406 verbose find . -name \*_pants.\* -exec rm -f {} \;
407 verbose find . -name \*_shirt.\* -exec rm -f {} \;
408 verbose find . -name \*_reflect.\* -exec rm -f {} \;
409 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
410 # texture: convert to jpeg and dds
411 # music: reduce bitrate
412 verbose export do_jpeg=true
413 verbose export jpeg_qual_rgb=80
414 verbose export jpeg_qual_a=97
415 verbose export do_dds=false
416 verbose export do_ogg=true
417 verbose export ogg_qual=1
418 verbose export del_src=true
419 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
434 verbose rm -rf Xonotic/temp
435 release_timereport "deleted temp directory"
436 verbose mkdir -p Xonotic/temp
437 release_git_extract_dir "$src" "Xonotic/temp" .
438 release_timereport "extracted data"
439 verbose cd Xonotic/temp
440 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
441 verbose cp ../source/progs.dat .
442 verbose cp ../source/csprogs.dat .
443 verbose cp ../source/menu.dat .
446 case "$RELEASETYPE" in
450 versionstr="$versionstr$RELEASETYPE"
453 if [ $gv -lt 9900 ]; then
454 # pre-1.0: compatible with any other pre-1.0
456 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
457 s/^gameversion_min [0-9]*/gameversion_min 0/;
458 s/^gameversion_max [0-9]*/gameversion_max 9999/;
459 " < defaultXonotic.cfg > defaultXonotic.cfg.new
463 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
464 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
465 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
466 " < defaultXonotic.cfg > defaultXonotic.cfg.new
468 mv defaultXonotic.cfg.new defaultXonotic.cfg
469 case "$RELEASETYPE" in
471 echo "" >> defaultXonotic.cfg
472 echo "// nicer menu" >> defaultXonotic.cfg
473 echo "set menu_watermark \"\"" >> defaultXonotic.cfg
477 verbose cd gfx/menu/luminos
478 verbose rm -f background_l2.tga background_ingame_l2.tga
479 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
480 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
481 verbose rm background_l2.svg
484 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
485 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
488 verbose rm -f maps/*.log maps/*.irc maps/*.lin
492 verbose export git_src_repo="$d0/$src" # skip hash-object
493 release_timereport "processed data"
494 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
495 release_timereport "transformed data"
496 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
497 release_timereport "deduplicated data"
498 verbose mkzipr "../../$dst" *
499 release_timereport "zipped data"
501 verbose rm -rf Xonotic/temp
502 release_timereport "deleted temp directory again"
506 stamp=`cat Xonotic/stamp.txt`
512 dst="data/xonotic-$stamp-${dst#data/xonotic-}"
518 while [ "$#" -gt 1 ]; do
519 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
526 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
527 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir raw ''
528 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '-high' low '-low' normaldds ''
529 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '-high' low '-low' normaldds '' mapping '-mapping'
530 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
531 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir normal '-high' normaldds ''
533 release-pack-needsx11)
537 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
540 verbose "$SELF" release-pack
546 stamp=`cat Xonotic/stamp.txt`
547 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
548 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
549 # let's pass crypto import laws of some nasty countries
550 crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
551 if [ -n "$crypto_libs" ]; then
552 verbose mkzip Xonotic-$stamp-crypto.zip \
554 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
558 verbose mkzip Xonotic-$stamp-enginesource.zip \
559 Xonotic/source/darkplaces/ \
560 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
561 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
562 verbose mkzip Xonotic-$stamp-engine.zip \
564 Xonotic/bin32/*.dll \
565 Xonotic/bin64/*.dll \
569 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
570 verbose mkzip Xonotic-$stamp-common.zip \
571 Xonotic/source/d0_blind_id/ \
572 Xonotic/source/fteqcc/ \
573 Xonotic/source/qcsrc/ \
579 Xonotic/data/font-nimbussansl-$stamp.pk3 \
580 Xonotic/data/font-xolonium-$stamp.pk3
581 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
582 verbose mkzip Xonotic-$stamp-source.zip \
583 Xonotic/source/d0_blind_id/ \
584 Xonotic/source/fteqcc/ \
585 Xonotic/source/qcsrc/ \
587 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
588 verbose mkzip0 Xonotic-$stamp.zip \
589 Xonotic/data/xonotic-$stamp-data.pk3 \
590 Xonotic/data/xonotic-$stamp-maps.pk3 \
591 Xonotic/data/xonotic-$stamp-music.pk3 \
592 Xonotic/data/xonotic-$stamp-nexcompat.pk3
593 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
594 verbose mkzip0 Xonotic-$stamp-low.zip \
595 Xonotic/data/xonotic-$stamp-data-low.pk3 \
596 Xonotic/data/xonotic-$stamp-maps-low.pk3 \
597 Xonotic/data/xonotic-$stamp-music-low.pk3
598 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
599 verbose mkzip Xonotic-$stamp-high.zip \
601 verbose mkzip0 Xonotic-$stamp-high.zip \
602 Xonotic/data/xonotic-$stamp-data-high.pk3 \
603 Xonotic/data/xonotic-$stamp-maps-high.pk3 \
604 Xonotic/data/xonotic-$stamp-music.pk3 \
605 Xonotic/data/xonotic-$stamp-nexcompat-high.pk3
606 verbose mkzip Xonotic-$stamp-mappingsupport.zip \
608 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
609 Xonotic/data/xonotic-$stamp-maps-mapping.pk3
613 verbose "$SELF" release-prepare
614 verbose "$SELF" release-maps
615 verbose "$SELF" release-engine
616 verbose "$SELF" release-qc
617 verbose "$SELF" release-pack-needsx11
618 verbose "$SELF" release-zip