5 if [ -z "$MAKEFLAGS" ]; then
6 ncpus=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`
7 if [ $ncpus -gt 1 ]; then
8 export MAKEFLAGS=-j$ncpus
12 release_args="$cmd $*"
13 msg "*** $release_args: start"
14 release_starttime=`date +%s`
17 release_endtime=`date +%s`
18 release_deltatime=$(($release_endtime - $release_starttime))
19 msg "*** $release_args: $release_deltatime seconds"
22 release_tempstarttime=$release_starttime
25 release_endtime=`date +%s` # RELEASE NOW!!!
27 release_deltatime=$(($release_endtime - $release_tempstarttime))
28 msg "**** $release_args: $*: $release_deltatime seconds"
30 release_tempstarttime=$release_endtime
32 release_git_extract_dir()
36 # try to create a hardlink
37 if ln -f "$release_src/.git/HEAD" "$release_dst/.hardlink-test"; then
38 rm -f "$release_dst/.hardlink-test"
40 verbose cd "$release_src"
41 git ls-files HEAD -- "$@"
43 while IFS= read -r F; do
44 case "$F" in */*) mkdir -p "$release_dst/${F%/*}" ;; esac
45 verbose ln -f "$release_src/$F" "$release_dst/$F"
50 verbose cd "$release_src"
51 verbose git archive --format=tar HEAD -- "$@"
53 verbose cd "$release_dst"
63 # get rid of this hack once we have done large enough changes
64 # to be no longer rsync compatible (and then enable the below
68 find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
70 find "$@" -xtype f \( -executable -or -type l \) -print | sed 's,\([./][^./]*$\),\1 \1,' | sort -k2 | cut -d\ -f1 > "$ziplist"
71 7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
72 zip $zipflags -y -@<"$ziplist" "$archive" || true
76 #find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
77 #zip $zipflags -y "$archive" "$@" || true
85 zip $zipflags "$archive" "$@" || true
86 advzip -z -4 "$archive"
93 zip $zipflags "$archive" "$@" || true
98 gv=`grep "^gameversion " "$1/xonotic-common.cfg" | awk '{ print $2 }'`
99 major=$(($gv / 10000))
100 minor=$((($gv / 100) - ($major * 100)))
101 patch=$(($gv - ($major * 10000) - ($minor * 100)))
102 versionstr="$major.$minor.$patch"
108 # release building goes here
111 #"$SELF" each git clean -fxd
112 case "$RELEASETYPE" in
114 $ECHO >&2 -n "$ESC[2J$ESC[H"
121 msg " +---------------------------------------------------------.---+"
123 msg " +---------------------------------------------------------^---+"
125 msg " | / \ This is the official release build system. |"
126 msg " | | | If you are not a member of the Xonotic Core Team, |"
127 msg " | | STOP | you are not supposed to use this script and should |"
128 msg " | | | instead use ./all compile to compile the engine |"
129 msg " | \____/ and game code. |"
131 msg " | [ I understand ] |"
132 msg " +-------------------------------------------------------------+"
134 # A LOT of build infrastructure is required:
137 # - .ssh/config must be configured so the following
138 # host names are reachable and have a compile
139 # infrastructure set up:
140 # - xonotic-build-linux64 (with gcc on x86_64)
141 # - xonotic-build-win32 (with i686-w64-mingw32)
142 # - xonotic-build-win64 (with x86_64-w64-mingw32)
143 # - xonotic-build-osx (with Xcode and SDL.framework)
144 # - AMD Compressonator installed in WINE
145 # - ResEdit installed in WINE
146 # - a lot of other requirements you will figure out
147 # while reading the error messages
148 # - environment variable RELEASETYPE set
149 # - optionally, environment variable RELEASEDATE set
154 msg "Building a FINISHED RELEASE"
155 getversion data/xonotic-data.pk3dir
156 verbose "$SELF" each -k git tag -m "TEMP TAG" -f "xonotic-v$versionstr"
159 msg "Building a $RELEASETYPE"
162 verbose rm -rf Xonotic Xonotic*.zip
163 verbose mkdir -p Xonotic
164 if [ -n "$RELEASEDATE" ]; then
165 verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
166 case "$RELEASETYPE" in
168 verbose $ECHO "${RELEASEDATE%_*}" > Xonotic/pk3stamp.txt
171 verbose $ECHO "$RELEASEDATE" > Xonotic/pk3stamp.txt
175 verbose date +%Y%m%d > Xonotic/stamp.txt
176 verbose date +%Y%m%d > Xonotic/pk3stamp.txt
178 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
181 verbose mkdir data source source/darkplaces source/gmqcc source/d0_blind_id mapping
182 verbose rm -rf misc/builddeps
183 #verbose mv bin32/SDL.dll . || true # Leftover?
185 # We're going to be building these later
186 #verbose mv misc/buildfiles/win32 bin32 || true
187 #verbose mv misc/buildfiles/win64 bin64 || true
189 verbose mv misc/buildfiles/osx/* . || true
190 verbose rm -rf misc/buildfiles
191 verbose rm -rf misc/pki
193 release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
194 release_git_extract_dir "gmqcc" "Xonotic/source/gmqcc" .
195 release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
196 release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
198 verbose cd Xonotic/source/d0_blind_id
199 verbose sh autogen.sh
201 rm -f Xonotic/key_15.d0pk
203 verbose cd Xonotic/mapping
204 verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301.tar.bz2
205 verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20120301-win32-7z.exe
206 for X in *-7z.exe; do
210 # TODO possibly include other tools?
212 ./all each git rev-parse HEAD > Xonotic/misc/git-revisions.txt
224 if [ -z "$targetfiles" ]; then
227 case " $HOSTS_THAT_ARE_DISABLED " in
232 case " $HOSTS_THAT_ARE_MYSELF " in
234 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
235 verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$buildpath"/darkplaces.ico
236 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$buildpath.deps/"
237 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
238 verbose eval make -C "$buildpath" clean $maketargets $makeflags
239 for f in $targetfiles; do
240 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
244 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host":"$buildpath/"
245 verbose rsync --delete -zLvaSHP misc/logos/icons_ico/xonotic.ico "$host":"$buildpath"/darkplaces.ico
246 verbose rsync --delete -zLvaSHP "$depsdir"/*/ "$host":"$buildpath.deps/"
247 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"
248 for f in $targetfiles; do
249 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
258 darkplaces_maketargets=$3
260 host=xonotic-build-$suffix
261 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/$suffix" "$darkplaces_files"
266 basename=${binary##*/}
267 dpname=darkplaces${basename#xonotic}
268 rev=`( cd "$d0/darkplaces" && git rev-parse HEAD )`
269 verbose wget -O "$binary" "http://beta.xonotic.org/autobuild-bin/$rev/$dpname"
270 [ -s "$binary" ] || rm -f "$binary"
273 Xonotic/*osx*|Xonotic/*linux*)
278 release-dlls-compile)
283 mkdir -p "$targetdir"
286 verbose ./dlls.sh all "$buildpath" "$arch"
288 verbose cp -v $buildpath/out/$arch/* "$targetdir"
292 verbose "$SELF" release-dlls-compile win32 /tmp/dlls Xonotic/bin32
296 verbose "$SELF" release-dlls-compile win64 /tmp/dlls Xonotic/bin64
300 verbose "$SELF" release-dlls-win32
301 verbose "$SELF" release-dlls-win64
302 verbose rm -rf /tmp/dlls
304 release-engine-win32)
307 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86.exe || good=false
308 #verbose "$SELF" release-getbinary Xonotic/xonotic-x86-dedicated.exe || good=false
310 verbose "$SELF" release-compile win32 \
311 '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' \
312 release 'darkplaces.exe:Xonotic/xonotic-x86-wgl.exe darkplaces-sdl.exe:Xonotic/xonotic-x86.exe darkplaces-dedicated.exe:Xonotic/xonotic-x86-dedicated.exe'
314 release-engine-win64)
317 #verbose "$SELF" release-getbinary Xonotic/xonotic.exe || good=false
318 #verbose "$SELF" release-getbinary Xonotic/xonotic-dedicated.exe || good=false
320 verbose "$SELF" release-compile win64 \
321 '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' \
322 release 'darkplaces.exe:Xonotic/xonotic-wgl.exe darkplaces-sdl.exe:Xonotic/xonotic.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
327 #verbose "$SELF" release-getbinary Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin || good=false
328 #verbose "$SELF" release-getbinary Xonotic/xonotic-osx-dedicated || good=false
330 # Note: travis build script also had SDLCONFIG_MACOSX* flags; need to check if they're still needed with osxcross.
331 verbose "$SELF" release-compile osx \
332 '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' \
333 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
335 release-engine-linux64)
338 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-sdl || good=false
339 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-glx || good=false
340 #verbose "$SELF" release-getbinary Xonotic/xonotic-linux64-dedicated || good=false
342 verbose "$SELF" release-compile linux64 \
343 '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=shared 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' \
344 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
348 # TODO report failures here.
350 verbose "$SELF" release-engine-linux64 && good=true
351 verbose "$SELF" release-engine-win32 && good=true
352 verbose "$SELF" release-engine-win64 && good=true
353 verbose "$SELF" release-engine-osx && good=true
358 verbose "$SELF" update-maps
362 verbose make -C "$d0/gmqcc" gmqcc
363 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
365 release-buildpk3-transform-raw)
369 release-buildpk3-transform-normal)
373 # texture: convert to jpeg and dds
374 verbose export do_jpeg=true
375 verbose export jpeg_qual_rgb=97
376 verbose export jpeg_qual_a=99
377 verbose export do_dds=false
378 verbose export do_ogg=true
379 verbose export ogg_ogg=false
380 verbose export del_src=true
381 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
383 release-buildpk3-transform-normaldds)
387 # texture: convert to jpeg and dds
388 # music: reduce bitrate
389 verbose export do_jpeg=false
390 verbose export do_jpeg_if_not_dds=true
391 verbose export jpeg_qual_rgb=95
392 verbose export jpeg_qual_a=99
393 verbose export do_dds=true
394 verbose export dds_flags=
395 verbose export do_ogg=true
396 verbose export ogg_ogg=false
397 verbose export del_src=true
398 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
400 release-buildpk3-transform-mapping)
404 # remove stuff radiant has no use for
405 verbose find . -name \*_norm.\* -exec rm -f {} \;
406 verbose find . -name \*_bump.\* -exec rm -f {} \;
407 verbose find . -name \*_glow.\* -exec rm -f {} \;
408 verbose find . -name \*_gloss.\* -exec rm -f {} \;
409 verbose find . -name \*_pants.\* -exec rm -f {} \;
410 verbose find . -name \*_shirt.\* -exec rm -f {} \;
411 verbose find . -name \*_reflect.\* -exec rm -f {} \;
412 verbose find . -not \( -name \*.tga -o -name \*.png -o -name \*.jpg \) -exec rm -f {} \;
413 # texture: convert to jpeg and dds
414 # music: reduce bitrate
415 verbose export do_jpeg=true
416 verbose export jpeg_qual_rgb=80
417 verbose export jpeg_qual_a=97
418 verbose export do_dds=false
419 verbose export do_ogg=true
420 verbose export ogg_qual=1
421 verbose export del_src=true
422 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
437 verbose rm -rf Xonotic/temp
438 release_timereport "deleted temp directory"
439 verbose mkdir -p Xonotic/temp
440 release_git_extract_dir "$src" "Xonotic/temp" .
441 release_timereport "extracted data"
442 verbose cd Xonotic/temp
443 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
444 verbose cp ../source/progs.dat .
445 verbose cp ../source/csprogs.dat .
446 verbose cp ../source/menu.dat .
447 # Include line numbers in qc errors
448 verbose cp ../source/progs.lno .
449 verbose cp ../source/csprogs.lno .
450 verbose cp ../source/menu.lno .
453 case "$RELEASETYPE" in
457 versionstr="$versionstr$RELEASETYPE"
460 if [ $gv -lt 9900 ]; then
461 # pre-1.0: compatible with any other pre-1.0
463 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
464 s/^gameversion_min [0-9]*/gameversion_min 0/;
465 s/^gameversion_max [0-9]*/gameversion_max 9999/;
466 " < xonotic-common.cfg > xonotic-common.cfg.new
470 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
471 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
472 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
473 " < xonotic-common.cfg > xonotic-common.cfg.new
475 mv xonotic-common.cfg.new xonotic-common.cfg
476 case "$RELEASETYPE" in
478 echo "" >> xonotic-common.cfg
479 echo "// nicer menu" >> xonotic-common.cfg
480 echo "set menu_watermark \"\"" >> xonotic-common.cfg
484 verbose cd gfx/menu/luminos
485 verbose rm -f background_l2.tga background_ingame_l2.tga
486 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
487 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
488 verbose rm background_l2.svg
490 verbose "$d0"/mediasource/gfx/luma/render-version.sh "$d0/mediasource/gfx/luma" "$PWD" "$versionstr"
492 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
493 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
496 verbose rm -f maps/*.log maps/*.irc maps/*.lin
500 verbose export git_src_repo="$d0/$src" # skip hash-object
501 release_timereport "processed data"
502 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
503 release_timereport "transformed data"
504 find . -type f -size +4k | verbose "$d0"/misc/tools/symlink-deduplicate.sh
505 release_timereport "deduplicated data"
506 verbose mkzipr "../../$dst" *
507 release_timereport "zipped data"
509 verbose rm -rf Xonotic/temp
510 release_timereport "deleted temp directory again"
514 pk3stamp=`cat Xonotic/pk3stamp.txt`
520 dst="data/xonotic-$pk3stamp-${dst#data/xonotic-}"
526 while [ "$#" -gt 1 ]; do
527 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
534 verbose "$SELF" release-buildpk3s data/font-unifont.pk3dir raw ''
535 verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir raw ''
536 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normaldds '' normal '-high'
537 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normaldds '' mapping '-mapping' normal '-high'
538 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw ''
539 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir normaldds '' normal '-high'
541 release-pack-needsx11)
545 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
548 verbose "$SELF" release-pack
554 stamp=`cat Xonotic/stamp.txt`
555 pk3stamp=`cat Xonotic/pk3stamp.txt`
556 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
557 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
559 verbose mkzip Xonotic-$stamp-enginesource.zip \
561 Xonotic/source/darkplaces/ \
562 Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
563 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-engine.zip
564 verbose mkzip Xonotic-$stamp-engine.zip \
566 Xonotic/bin32/*.dll \
567 Xonotic/bin64/*.dll \
571 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
572 verbose mkzip Xonotic-$stamp-common.zip \
573 Xonotic/source/d0_blind_id/ \
574 Xonotic/source/gmqcc/ \
575 Xonotic/source/qcsrc/ \
581 Xonotic/data/font-unifont-$pk3stamp.pk3 \
582 Xonotic/data/font-xolonium-$pk3stamp.pk3
583 verbose cp Xonotic-$stamp-enginesource.zip Xonotic-$stamp-source.zip
584 verbose mkzip Xonotic-$stamp-source.zip \
585 Xonotic/source/d0_blind_id/ \
586 Xonotic/source/gmqcc/ \
587 Xonotic/source/qcsrc/ \
589 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
590 verbose mkzip0 Xonotic-$stamp.zip \
591 Xonotic/data/xonotic-$pk3stamp-data.pk3 \
592 Xonotic/data/xonotic-$pk3stamp-maps.pk3 \
593 Xonotic/data/xonotic-$pk3stamp-music.pk3 \
594 Xonotic/data/xonotic-$pk3stamp-nexcompat.pk3
595 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
596 verbose mkzip0 Xonotic-$stamp-high.zip \
597 Xonotic/data/xonotic-$pk3stamp-data-high.pk3 \
598 Xonotic/data/xonotic-$pk3stamp-maps-high.pk3 \
599 Xonotic/data/xonotic-$pk3stamp-music.pk3 \
600 Xonotic/data/xonotic-$pk3stamp-nexcompat-high.pk3
601 verbose mkzip Xonotic-$stamp-mappingsupport.zip \
603 verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
604 Xonotic/data/xonotic-$pk3stamp-maps-mapping.pk3
605 verbose mkzip gmqcc-$stamp.zip \
611 verbose "$SELF" release-prepare
612 verbose "$SELF" release-maps
613 verbose "$SELF" release-dlls
614 verbose "$SELF" release-engine
615 verbose "$SELF" release-qc
616 verbose "$SELF" release-pack
617 verbose "$SELF" release-zip