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"
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
61 find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
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
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
78 zip $zipflags "$archive" "$@" || true
79 advzip -z -4 "$archive"
86 zip $zipflags "$archive" "$@" || true
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"
101 # release building goes here
104 #"$SELF" each git clean -fxd
105 case "$RELEASETYPE" in
107 $ECHO >&2 -n "$ESC[2J$ESC[H"
114 msg " +---------------------------------------------------------.---+"
116 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. |"
124 msg " | [ I understand ] |"
125 msg " +-------------------------------------------------------------+"
127 # A LOT of build infrastructure is required:
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 i586-mingw32msvc-g++)
135 # - xonotic-build-win64 (with amd64-mingw32msvc-g++
136 # and amd64-mingw32msvc-g++)
137 # - xonotic-build-osx (with Xcode and SDL.framework)
138 # - AMD Compressonator installed in WINE
139 # - ResEdit installed in WINE
140 # - a lot of other requirements you will figure out
141 # while reading the error messages
142 # - environment variable RELEASETYPE set
143 # - optionally, environment variable RELEASEDATE set
148 msg "Building a FINISHED RELEASE"
149 getversion data/xonotic-data.pk3dir
150 verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
153 msg "Building a $RELEASETYPE"
156 verbose rm -rf Xonotic Xonotic*.zip
157 verbose mkdir -p Xonotic
158 if [ -n "$RELEASEDATE" ]; then
159 verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
160 case "$RELEASETYPE" in
162 verbose $ECHO "${RELEASEDATE%_*}" > Xonotic/pk3stamp.txt
165 verbose $ECHO "$RELEASEDATE" > Xonotic/pk3stamp.txt
169 verbose date +%Y%m%d > Xonotic/stamp.txt
170 verbose date +%Y%m%d > Xonotic/pk3stamp.txt
172 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
175 verbose mkdir data source source/darkplaces source/gmqcc source/d0_blind_id mapping
176 verbose rm -rf misc/builddeps
177 verbose mv misc/buildfiles/win32 bin32 || true
178 verbose mv bin32/SDL.dll . || true
179 verbose mv misc/buildfiles/win64 bin64 || true
180 verbose mv misc/buildfiles/osx/* . || true
181 verbose rm -rf misc/buildfiles
182 verbose rm -rf misc/pki
184 release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
185 release_git_extract_dir "gmqcc" "Xonotic/source/gmqcc" .
186 release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
187 release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
189 verbose cd Xonotic/source/d0_blind_id
190 verbose sh autogen.sh
192 rm -f Xonotic/key_15.d0pk
194 verbose cd Xonotic/mapping
195 verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
196 verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
197 for X in *-7z.exe; do
201 # TODO possibly include other tools?
203 ./all each git rev-parse HEAD > Xonotic/misc/git-revisions.txt
215 if [ -z "$targetfiles" ]; then
218 case " $HOSTS_THAT_ARE_DISABLED " in
223 case " $HOSTS_THAT_ARE_MYSELF " in
225 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
226 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$buildpath.deps/"
227 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
228 verbose eval make -C "$buildpath" clean $maketargets $makeflags
229 for f in $targetfiles; do
230 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
234 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host":"$buildpath/"
235 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$host":"$buildpath.deps/"
236 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"
237 for f in $targetfiles; do
238 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
242 # now rebrand the binaries...
243 for f in $targetfiles; do
245 Xonotic/xonotic*.exe)
246 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
255 darkplaces_maketargets=$3
257 host=xonotic-build-$suffix
258 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/$suffix" "$darkplaces_files"
263 basename=${binary##*/}
264 dpname=darkplaces${basename#xonotic}
265 rev=`( cd "$d0/darkplaces" && git rev-parse HEAD )`
266 verbose wget -O "$binary" "http://beta.xonotic.org/autobuild-bin/$rev/$dpname"
267 [ -s "$binary" ] || rm -f "$binary"
270 Xonotic/*osx*|Xonotic/*linux*)
275 release-engine-win32)
278 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86.exe || good=false
279 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false
281 verbose "$SELF" release-compile win32 \
282 '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" DP_LINK_ZLIB=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen WIN32RELEASE=1 D3D=1' \
283 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
285 release-engine-win64)
288 #verbose "$SELF" release-getbinary Xonotic/xonotic.exe || good=false
289 #verbose "$SELF" release-getbinary Xonotic/xonotic-dedicated.exe || good=false
291 verbose "$SELF" release-compile win64 \
292 '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" DP_LINK_ZLIB=dlopen DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen WIN64RELEASE=1 D3D=1' \
293 release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
298 #verbose "$SELF" release-getbinary Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin || good=false
299 #verbose "$SELF" release-getbinary Xonotic/xonotic-osx-dedicated || good=false
301 verbose "$SELF" release-compile osx \
302 '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" DP_LINK_ZLIB=shared DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=dlopen DP_LINK_CRYPTO_RIJNDAEL=dlopen' \
303 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
305 release-engine-linux64)
308 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-sdl || good=false
309 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-glx || good=false
310 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-dedicated || good=false
312 verbose "$SELF" release-compile linux64 \
313 'STRIP=: CC="gcc -m64 -g1 -I../../../.deps/include -L../../../.deps/lib -DSUPPORTIPV6" LIB_JPEG=../../../.deps/lib/libjpeg.a LIB_CRYPTO="../../../.deps/lib/libd0_blind_id.a ../../../.deps/lib/libgmp.a" DP_LINK_ZLIB=shared DP_LINK_JPEG=dlopen DP_LINK_ODE=dlopen DP_LINK_CRYPTO=shared DP_LINK_CRYPTO_RIJNDAEL=dlopen' \
314 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
318 # TODO report failures here.
320 verbose "$SELF" release-engine-linux64 && good=true
321 verbose "$SELF" release-engine-win32 && good=true
322 verbose "$SELF" release-engine-win64 && good=true
323 #verbose "$SELF" release-engine-osx && good=true
328 verbose "$SELF" update-maps
332 verbose make -C "$d0/gmqcc" gmqcc
333 verbose env GIT_DIR="$d0/data/xonotic-data.pk3dir/.git" make -C Xonotic/source QCC="$d0/gmqcc/gmqcc" XON_BUILDSYSTEM=1 clean qc
335 release-buildpk3-transform-raw)
339 release-buildpk3-transform-normal)
343 # texture: convert to jpeg and dds
344 verbose export do_jpeg=true
345 verbose export jpeg_qual_rgb=97
346 verbose export jpeg_qual_a=99
347 verbose export do_dds=false
348 verbose export do_ogg=true
349 verbose export ogg_ogg=false
350 verbose export del_src=true
351 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
353 release-buildpk3-transform-normaldds)
357 # texture: convert to jpeg and dds
358 # music: reduce bitrate
359 verbose export do_jpeg=false
360 verbose export do_jpeg_if_not_dds=true
361 verbose export jpeg_qual_rgb=95
362 verbose export jpeg_qual_a=99
363 verbose export do_dds=true
364 verbose export dds_flags=
365 verbose export do_ogg=true
366 verbose export ogg_ogg=false
367 verbose export del_src=true
368 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
370 release-buildpk3-transform-mapping)
374 # remove stuff radiant has no use for
375 verbose find . -name \*_norm.\* -exec rm -f {} \;
376 verbose find . -name \*_bump.\* -exec rm -f {} \;
377 verbose find . -name \*_glow.\* -exec rm -f {} \;
378 verbose find . -name \*_gloss.\* -exec rm -f {} \;
379 verbose find . -name \*_pants.\* -exec rm -f {} \;
380 verbose find . -name \*_shirt.\* -exec rm -f {} \;
381 verbose find . -name \*_reflect.\* -exec rm -f {} \;
382 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
383 # texture: convert to jpeg and dds
384 # music: reduce bitrate
385 verbose export do_jpeg=true
386 verbose export jpeg_qual_rgb=80
387 verbose export jpeg_qual_a=97
388 verbose export do_dds=false
389 verbose export do_ogg=true
390 verbose export ogg_qual=1
391 verbose export del_src=true
392 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
407 verbose rm -rf Xonotic/temp
408 release_timereport "deleted temp directory"
409 verbose mkdir -p Xonotic/temp
410 release_git_extract_dir "$src" "Xonotic/temp" .
411 release_timereport "extracted data"
412 verbose cd Xonotic/temp
413 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
414 verbose cp ../source/progs.dat .
415 verbose cp ../source/csprogs.dat .
416 verbose cp ../source/menu.dat .
417 # Include line numbers in qc errors
418 verbose cp ../source/progs.lno .
419 verbose cp ../source/csprogs.lno .
420 verbose cp ../source/menu.lno .
423 case "$RELEASETYPE" in
427 versionstr="$versionstr$RELEASETYPE"
430 if [ $gv -lt 9900 ]; then
431 # pre-1.0: compatible with any other pre-1.0
433 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
434 s/^gameversion_min [0-9]*/gameversion_min 0/;
435 s/^gameversion_max [0-9]*/gameversion_max 9999/;
436 " < xonotic-common.cfg > xonotic-common.cfg.new
440 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
441 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
442 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
443 " < xonotic-common.cfg > xonotic-common.cfg.new
445 mv xonotic-common.cfg.new xonotic-common.cfg
446 case "$RELEASETYPE" in
448 echo "" >> xonotic-common.cfg
449 echo "// nicer menu" >> xonotic-common.cfg
450 echo "set menu_watermark \"\"" >> xonotic-common.cfg
454 verbose cd gfx/menu/luminos
455 verbose rm -f background_l2.tga background_ingame_l2.tga
456 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
457 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
458 verbose rm background_l2.svg
460 verbose "$d0"/mediasource/gfx/luma/render-version.sh "$d0/mediasource/gfx/luma" "$PWD" "$versionstr"
462 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
463 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
466 verbose rm -f maps/*.log maps/*.irc maps/*.lin
470 verbose export git_src_repo="$d0/$src" # skip hash-object
471 release_timereport "processed data"
472 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
473 release_timereport "transformed data"
474 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
475 release_timereport "deduplicated data"
476 verbose mkzipr "../../$dst" *
477 release_timereport "zipped data"
479 verbose rm -rf Xonotic/temp
480 release_timereport "deleted temp directory again"
484 pk3stamp=`cat Xonotic/pk3stamp.txt`
490 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
496 while [ "$#" -gt 1 ]; do
497 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
504 verbose "$SELF" release-buildpk3s data/font-unifont.pk3dir raw ''
505 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir raw ''
506 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normaldds '' normal '-high'
507 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normaldds '' mapping '-mapping' normal '-high'
508 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw ''
509 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir normaldds '' normal '-high'
511 release-pack-needsx11)
515 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
518 verbose "$SELF" release-pack
524 stamp=`cat Xonotic/stamp.txt`
525 pk3stamp=`cat Xonotic/pk3stamp.txt`
526 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
527 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
529 verbose mkzip Xonotic-$stamp-enginesource.zip \
531 Xonotic/source/darkplaces/ \
532 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
533 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
534 verbose mkzip Xonotic-$stamp-engine.zip \
536 Xonotic/bin32/*.dll \
537 Xonotic/bin64/*.dll \
541 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
542 verbose mkzip Xonotic-$stamp-common.zip \
543 Xonotic/source/d0_blind_id/ \
544 Xonotic/source/gmqcc/ \
545 Xonotic/source/qcsrc/ \
551 Xonotic/data/font-unifont-$pk3stamp.pk3 \
552 Xonotic/data/font-xolonium-$pk3stamp.pk3
553 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
554 verbose mkzip Xonotic-$stamp-source.zip \
555 Xonotic/source/d0_blind_id/ \
556 Xonotic/source/gmqcc/ \
557 Xonotic/source/qcsrc/ \
559 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
560 verbose mkzip0 Xonotic-$stamp.zip \
561 Xonotic/data/xonotic-$pk3stamp-data.pk3 \
562 Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
563 Xonotic/data/xonotic-$pk3stamp-music.pk3 \
564 Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3
565 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
566 verbose mkzip0 Xonotic-$stamp-high.zip \
567 Xonotic/data/xonotic-$pk3stamp-data-high.pk3 \
568 Xonotic/data/xonotic-$pk3stamp-maps-high.pk3 \
569 Xonotic/data/xonotic-$pk3stamp-music.pk3 \
570 Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3
571 verbose mkzip Xonotic-$stamp-mappingsupport.zip \
573 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
574 Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
575 verbose mkzip gmqcc-$stamp.zip \
581 verbose "$SELF" release-prepare
582 verbose "$SELF" release-maps
583 verbose "$SELF" release-engine
584 verbose "$SELF" release-qc
585 verbose "$SELF" release-pack
586 verbose "$SELF" release-zip