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"
57 find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
59 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
60 7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
61 zip $zipflags -y -@<"$ziplist" "$archive" || true
71 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
72 7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
73 zip $zipflags -y -@<"$ziplist" "$archive" || true
80 zip -0ry "$archive" "$@"
84 gv=`grep "^gameversion " "$1/defaultXonotic.cfg" | awk '{ print $2 }'`
85 major=$(($gv / 10000))
86 minor=$((($gv / 100) - ($major * 100)))
87 patch=$(($gv - ($major * 10000) - ($minor * 100)))
88 versionstr="$major.$minor.$patch"
94 # release building goes here
97 #"$SELF" each git clean -fxd
98 case "$RELEASETYPE" in
100 $ECHO >&2 -n "$ESC[2J$ESC[H"
107 msg " +---------------------------------------------------------.---+"
109 msg " +---------------------------------------------------------^---+"
111 msg " | / \ This is the official release build system. |"
112 msg " | | | If you are not a member of the Xonotic Core Team, |"
113 msg " | | STOP | you are not supposed to use this script and should |"
114 msg " | | | instead use ./all compile to compile the engine |"
115 msg " | \____/ and game code. |"
117 msg " | [ I understand ] |"
118 msg " +-------------------------------------------------------------+"
120 # A LOT of build infrastructure is required:
123 # - .ssh/config must be configured so the following
124 # host names are reachable and have a compile
125 # infrastructure set up:
126 # - xonotic-build-linux32 (with gcc on x86)
127 # - xonotic-build-linux64 (with gcc on x86_64)
128 # - xonotic-build-win32 (with i586-mingw32msvc-g++)
129 # - xonotic-build-win64 (with amd64-mingw32msvc-g++
130 # and x86_64-w64-mingw32-g++)
131 # - xonotic-build-osx (with Xcode and SDL.framework)
132 # - AMD Compressonator installed in WINE
133 # - ResEdit installed in WINE
134 # - a lot of other requirements you will figure out
135 # while reading the error messages
136 # - environment variable RELEASETYPE set
137 # - optionally, environment variable RELEASEDATE set
142 msg "Building a FINISHED RELEASE"
143 getversion data/xonotic-data.pk3dir
144 verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
147 msg "Building a $RELEASETYPE"
150 verbose rm -rf Xonotic Xonotic*.zip
151 verbose mkdir -p Xonotic
152 if [ -n "$RELEASEDATE" ]; then
153 verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
154 case "$RELEASETYPE" in
156 verbose $ECHO "${RELEASEDATE%_*}" > Xonotic/pk3stamp.txt
159 verbose $ECHO "$RELEASEDATE" > Xonotic/pk3stamp.txt
163 verbose date +%Y%m%d > Xonotic/stamp.txt
164 verbose date +%Y%m%d > Xonotic/pk3stamp.txt
166 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
169 verbose mkdir data fteqcc source source/darkplaces source/fteqcc source/d0_blind_id mapping
170 verbose rm -rf misc/builddeps
171 verbose mv misc/buildfiles/win32 bin32 || true
172 verbose mv bin32/SDL.dll . || true
173 verbose mv misc/buildfiles/win64 bin64 || true
174 verbose mv misc/buildfiles/osx/* . || true
175 verbose rm -rf misc/buildfiles
176 verbose rm -rf misc/pki
178 release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
179 release_git_extract_dir "fteqcc" "Xonotic/source/fteqcc" .
180 release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
181 release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
183 verbose cd Xonotic/source/d0_blind_id
184 verbose sh autogen.sh
186 rm -f Xonotic/key_15.d0pk
188 verbose cd Xonotic/mapping
189 verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
190 verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
191 for X in *-7z.exe; do
195 # TODO possibly include other tools?
208 if [ -n "$targetfiles" ]; then
209 case " $HOSTS_THAT_ARE_DISABLED " in
214 case " $HOSTS_THAT_ARE_MYSELF " in
216 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
217 verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
218 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
219 verbose eval make -C "$buildpath" clean $maketargets $makeflags
220 for f in $targetfiles; do
221 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
225 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
226 verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
227 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"
228 for f in $targetfiles; do
229 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
233 # now rebrand the binaries...
234 for f in $targetfiles; do
235 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
237 Xonotic/xonotic*.exe)
238 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
248 fteqcc_maketargets=$3
250 darkplaces_maketargets=$5
252 host=xonotic-build-$suffix
253 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
254 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
256 release-engine-win32)
258 verbose "$SELF" release-compile win32 \
259 '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' \
260 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
262 verbose "$SELF" release-compile win32 \
263 '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' \
265 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
267 release-engine-win64)
269 verbose "$SELF" release-compile win64 \
270 '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' \
271 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
272 'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
273 verbose "$SELF" release-compile win64 \
274 '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' \
276 cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
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 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
284 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
286 release-engine-linux32)
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' \
290 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
291 release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
293 release-engine-linux64)
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' \
297 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
298 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
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 &
316 verbose "$SELF" update-maps
320 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
321 verbose rm -f Xonotic/source/qcsrc/*/fteqcc.log
323 release-buildpk3-transform-raw)
327 release-buildpk3-transform-normal)
331 # texture: convert to jpeg and dds
332 verbose export do_jpeg=true
333 verbose export jpeg_qual_rgb=97
334 verbose export jpeg_qual_a=99
335 verbose export do_dds=false
336 verbose export do_ogg=true
337 verbose export ogg_ogg=false
338 verbose export del_src=true
339 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
341 release-buildpk3-transform-normaldds)
345 # texture: convert to jpeg and dds
346 # music: reduce bitrate
347 verbose export do_jpeg=false
348 verbose export do_jpeg_if_not_dds=true
349 verbose export jpeg_qual_rgb=95
350 verbose export jpeg_qual_a=99
351 verbose export do_dds=true
352 verbose export dds_flags=
353 verbose export do_ogg=true
354 verbose export ogg_ogg=false
355 verbose export del_src=true
356 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
358 release-buildpk3-transform-low)
362 # texture: convert to jpeg and dds
363 # music: reduce bitrate
364 verbose export do_jpeg=true
365 verbose export jpeg_qual_rgb=80
366 verbose export jpeg_qual_a=97
367 verbose export do_dds=false
368 verbose export do_ogg=true
369 verbose export ogg_qual=1
370 verbose export del_src=true
371 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
373 release-buildpk3-transform-lowdds)
377 # texture: convert to jpeg and dds
378 # music: reduce bitrate
379 verbose export do_jpeg=false
380 verbose export do_jpeg_if_not_dds=true
381 verbose export jpeg_qual_rgb=80
382 verbose export jpeg_qual_a=99
383 verbose export do_dds=true
384 verbose export dds_flags=
385 verbose export do_ogg=true
386 verbose export ogg_qual=1
387 verbose export del_src=true
388 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
390 release-buildpk3-transform-mapping)
394 # remove stuff radiant has no use for
395 verbose find . -name \*_norm.\* -exec rm -f {} \;
396 verbose find . -name \*_bump.\* -exec rm -f {} \;
397 verbose find . -name \*_glow.\* -exec rm -f {} \;
398 verbose find . -name \*_gloss.\* -exec rm -f {} \;
399 verbose find . -name \*_pants.\* -exec rm -f {} \;
400 verbose find . -name \*_shirt.\* -exec rm -f {} \;
401 verbose find . -name \*_reflect.\* -exec rm -f {} \;
402 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
403 # texture: convert to jpeg and dds
404 # music: reduce bitrate
405 verbose export do_jpeg=true
406 verbose export jpeg_qual_rgb=80
407 verbose export jpeg_qual_a=97
408 verbose export do_dds=false
409 verbose export do_ogg=true
410 verbose export ogg_qual=1
411 verbose export del_src=true
412 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
427 verbose rm -rf Xonotic/temp
428 release_timereport "deleted temp directory"
429 verbose mkdir -p Xonotic/temp
430 release_git_extract_dir "$src" "Xonotic/temp" .
431 release_timereport "extracted data"
432 verbose cd Xonotic/temp
433 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
434 verbose cp ../source/progs.dat .
435 verbose cp ../source/csprogs.dat .
436 verbose cp ../source/menu.dat .
439 case "$RELEASETYPE" in
443 versionstr="$versionstr$RELEASETYPE"
446 if [ $gv -lt 9900 ]; then
447 # pre-1.0: compatible with any other pre-1.0
449 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
450 s/^gameversion_min [0-9]*/gameversion_min 0/;
451 s/^gameversion_max [0-9]*/gameversion_max 9999/;
452 " < defaultXonotic.cfg > defaultXonotic.cfg.new
456 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
457 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
458 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
459 " < defaultXonotic.cfg > defaultXonotic.cfg.new
461 mv defaultXonotic.cfg.new defaultXonotic.cfg
462 case "$RELEASETYPE" in
464 echo "" >> defaultXonotic.cfg
465 echo "// nicer menu" >> defaultXonotic.cfg
466 echo "set menu_watermark \"\"" >> defaultXonotic.cfg
470 verbose cd gfx/menu/luminos
471 verbose rm -f background_l2.tga background_ingame_l2.tga
472 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
473 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
474 verbose rm background_l2.svg
477 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
478 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
481 verbose rm -f maps/*.log maps/*.irc maps/*.lin
485 verbose export git_src_repo="$d0/$src" # skip hash-object
486 release_timereport "processed data"
487 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
488 release_timereport "transformed data"
489 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
490 release_timereport "deduplicated data"
491 verbose mkzipr "../../$dst" *
492 release_timereport "zipped data"
494 verbose rm -rf Xonotic/temp
495 release_timereport "deleted temp directory again"
499 pk3stamp=`cat Xonotic/pk3stamp.txt`
505 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
511 while [ "$#" -gt 1 ]; do
512 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
519 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
520 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir raw ''
521 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir low '-low' normaldds ''
522 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir low '-low' normaldds '' mapping '-mapping'
523 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
524 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir normaldds ''
526 release-pack-needsx11)
530 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
533 verbose "$SELF" release-pack
539 stamp=`cat Xonotic/stamp.txt`
540 pk3stamp=`cat Xonotic/pk3stamp.txt`
541 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
542 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
543 # let's pass crypto import laws of some nasty countries
544 crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
545 if [ -n "$crypto_libs" ]; then
546 verbose mkzip Xonotic-$stamp-crypto.zip \
548 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
552 verbose mkzip Xonotic-$stamp-enginesource.zip \
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 \
558 Xonotic/bin32/*.dll \
559 Xonotic/bin64/*.dll \
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/fteqcc/ \
567 Xonotic/source/qcsrc/ \
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/fteqcc/ \
579 Xonotic/source/qcsrc/ \
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 \
594 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
595 Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
599 verbose "$SELF" release-prepare
600 verbose "$SELF" release-maps
601 verbose "$SELF" release-engine
602 verbose "$SELF" release-qc
603 verbose "$SELF" release-pack-needsx11
604 verbose "$SELF" release-zip