6 # I use this in EVERY shell script ;)
11 while ! [ -f ./all ]; do
12 if [ x"`pwd`" = x"/" ]; then
13 echo "Cannot find myself."
14 echo "Please run this script with the working directory inside a Xonotic checkout."
22 # If we are on WINDOWS:
27 # Windows hates users. So this script has to copy itself elsewhere first...
28 cp "$SELF" ../all.xonotic.sh
29 export WE_HATE_OUR_USERS=1
30 exec ../all.xonotic.sh "$@"
38 echo >&2 "
\e[1m$*
\e[m"
41 self=`git hash-object "$SELF"`
44 self_new=`git hash-object "$SELF"`
45 if [ x"$self" != x"$self_new" ]; then
46 msg "./all has changed."
47 if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
48 msg "Rerunning the requested operation to make sure."
49 export XONOTIC_FORBID_RERUN_ALL=1
52 msg "Please try $SELF update, and then retry your requested operation."
69 echo "the root directory"
79 if git ls-files -u | grep ' 1 '; then
81 echo "MERGE CONFLICT."
82 echo "change into the \"$1\" project directory, and then:"
83 echo "- edit the files mentioned above with your favorite editor,"
84 echo " and fix the conflicts (marked with <<<<<<< blocks)"
85 echo "- for binary files, you can select the files using"
86 echo " git checkout --ours or git checkout --theirs"
87 echo "- when done with a file, 'git add' the file"
88 echo "- when done, 'git commit'"
97 while [ x"$yesno" != x"y" -a x"$yesno" != x"n" ]; do
108 check_mergeconflict "$1"
113 data/xonotic-data.pk3dir | | master |
114 data/xonotic-music.pk3dir | | master |
115 data/xonotic-nexcompat.pk3dir | | master | no
116 darkplaces | | div0-stable | svn
117 netradiant | | master |
118 div0-gittools | | master | no
119 d0_blind_id | http://github.com/divVerent/d0_blind_id.git | master |
120 data/xonotic-maps.pk3dir | | master |
121 mediasource | | master | no
122 fteqcc | http://github.com/Blub/qclib.git | master |
124 # todo: in darkplaces, change repobranch to div0-stable
126 repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
128 base=`git config remote.origin.url`
131 base=${base%xonotic.git}
134 echo "The main repo is not xonotic.git, what have you done?"
141 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
142 if [ -n "$repo_t" ]; then
152 if [ x"$1" = x"." ]; then
153 echo "$base""xonotic.git"
155 echo "$base${1##*/}.git"
162 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
163 if [ -n "$repo_t" ]; then
172 echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
180 # if we have the dir, always keep it
182 msg "Repository $d enabled because it already exists"
186 # if .yes file exists, always keep it
187 if [ -f "$d.yes" ]; then
188 msg "Repository $d enabled by a .yes file"
192 # if we have .no file, skip
193 if [ -f "$d.no" ]; then
194 msg "Repository $d disabled by a .no file, delete $p.no to enable"
197 # if we have matching pk3, skip
198 if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
199 msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
202 # if "no" flag is set, skip
205 msg "Repository $d disabled by default, create $d.yes to enable"
210 msg "Repository $d enabled by default"
217 if [ "$#" = 0 ]; then
223 fix_upstream_rebase()
225 if [ -z "$r_me" ] || [ -z "$r_other" ]; then
228 r_base=`git merge-base "$r_me" "$r_other"`
230 # no merge-base? upstream did filter-branch
231 if [ -n "$r_base" ]; then
232 # otherwise, check if the two histories are "similar"
233 r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
234 r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
236 # heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
237 r_lc_me=`echo "$r_l_me" | wc -l`
238 r_lc_other=`echo "$r_l_other" | wc -l`
239 r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l`
240 r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
242 if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
243 if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
244 git reset --hard "$r_me"
254 fix_upstream_rebase_mergeok()
256 r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
257 r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
261 fix_upstream_rebase_mergefail()
263 r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
264 r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
270 verbose git config core.autocrlf input
271 if [ -z "`git config push.default`" ]; then
272 verbose git config push.default current # or is tracking better?
281 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
282 7za a -tzip -mx=9 -x@"$ziplist" "$archive" "$@" || true
283 zip -9y -@<"$ziplist" "$archive" || true
295 enter "$d0/$d" verbose
296 verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
301 if [ x"$1" = x"-N" ]; then
306 branch=`repobranch "$d"`
307 if [ -d "$d0/$d" ]; then
309 enter "$d0/$d" verbose
311 verbose git config remote.origin.url "$url"
312 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
313 r=`git symbolic-ref HEAD`
315 if git config branch.$r.remote >/dev/null 2>&1; then
316 if ! verbose git pull; then
317 fix_upstream_rebase_mergefail || true
318 check_mergeconflict "$d"
319 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
322 fix_upstream_rebase_mergeok || true
327 checkself "$cmd" "$@"
329 verbose git remote prune origin
333 verbose git clone "$url" "$d0/$d"
334 enter "$d0/$d" verbose
336 if [ "$branch" != "master" ]; then
337 verbose git checkout --track -b "$branch" origin/"$branch"
344 misc/tools/xonotic-map-compiler-autobuild download
348 if [ x"$1" = x"-f" ]; then
354 if [ -z "$branch" ]; then
357 branch=${remote#origin/}
368 enter "$d0/$d" verbose
370 if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
372 verbose git checkout $checkoutflags "$b"
373 elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
375 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
378 if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
380 verbose git checkout $checkoutflags "$b"
381 elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
383 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
385 echo "WTF? Not even branch $b doesn't exist in $d"
390 checkself "$cmd" "$@"
394 echo "The requested branch was not found in any repository."
402 if [ -z "$branch" ]; then
406 if [ -z "$branch" ]; then
409 r=`git symbolic-ref HEAD`
416 dv=`visible_repo_name "$d"`
417 enter "$d0/$d" verbose
418 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
419 echo "Already having this branch in $dv."
421 if yesno "Branch in $dv?"; then
422 if [ -n "$srcbranch" ]; then
425 b=origin/"`repobranch "$d"`"
426 verbose git fetch origin || true
428 # TODO do this without pushing
429 verbose git checkout -b "$branch" "$b"
430 verbose git config "branch.$branch.remote" "$remote"
431 verbose git config "branch.$branch.merge" "refs/heads/$branch"
441 cd "$d0/$d" # am in a pipe, shouldn't use enter
442 git branch -r -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
447 while read -r d BRANCH REV TEXT; do
448 if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
451 if [ x"$REV" = x"->" ]; then
454 BRANCH=${BRANCH#remotes/}
455 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
456 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
457 eval "r=\$branches_repos_$ID"
459 eval "branches_repos_$ID=\$r"
461 echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
462 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
463 eval "r=\$branches_repos_$ID"
464 printf "%-60s %s\n" "$BRANCH" "$r"
471 dv=`visible_repo_name "$d"`
472 enter "$d0/$d" verbose
473 r=`git symbolic-ref HEAD`
475 if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
476 # we have uncommitted changes
477 if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
478 if ! verbose git merge origin/"`repobranch "$d"`"; then
479 check_mergeconflict "$d"
480 exit 1 # this should ALWAYS be fatal
490 dv=`visible_repo_name "$d"`
491 enter "$d0/$d" verbose
492 r=`git symbolic-ref HEAD`
494 diffdata=`git diff --color HEAD`
495 if [ -n "$diffdata" ]; then
496 # we have uncommitted changes
497 if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" 'echo "$diffdata" | less -r'; then
498 verbose git commit -a
501 rem=`git config "branch.$r.remote" || echo origin`
502 bra=`git config "branch.$r.merge" || echo "$r"`
503 upstream="$rem/${bra#refs/heads/}"
504 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
505 upstream="origin/`repobranch "$d"`"
507 logdata=`git log --color "$upstream".."$r"`
508 if [ -n "$logdata" ]; then
509 if yesno "Push \"$r\" in $dv?" 'echo "$logdata" | less -r'; then
510 verbose git push "$rem" HEAD
513 if [ x"$submit" = x"-s" ]; then
516 verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
524 if [ -z "$CC" ]; then
525 export CC="gcc -DSUPPORT_IPV6"
527 if [ -n "$WE_HATE_OUR_USERS" ]; then
528 TARGETS="sv-debug cl-debug"
529 elif [ x"`uname`" = x"Darwin" ]; then
532 TARGETS="sv-debug cl-debug sdl-debug"
535 # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
536 TARGETS="sv-debug sdl-debug"
539 export CC="$CC -I$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks/SDL.framework/Headers -F$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
541 TARGETS="sv-debug cl-debug sdl-debug"
558 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
559 # if we give the command make the arg "", it will surely fail (invalid filename),
560 # so better handle it as an empty client option
563 elif [ -n "$1" ]; then
565 TARGETS_SAVE=$TARGETS
570 TARGETS="$TARGETS sdl-debug"
573 TARGETS="$TARGETS cl-debug"
576 TARGETS="$TARGETS sv-debug"
579 BAD_TARGETS="$BAD_TARGETS $X"
583 if [ -n "$TARGETS" ]; then # at least a valid client
585 else # no valid client, let's assume this option is not meant to be a client then
586 TARGETS=$TARGETS_SAVE
590 if [ -z "$MAKEFLAGS" ]; then
591 if [ -f /proc/cpuinfo ]; then
592 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
593 if [ $ncpus -gt 1 ]; then
597 if [ -n "$WE_HATE_OUR_USERS" ]; then
598 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
602 enter "$d0/d0_blind_id" verbose
603 if ! [ -f Makefile ]; then
604 verbose sh autogen.sh
608 verbose make $MAKEFLAGS clean
610 verbose make $MAKEFLAGS
612 enter "$d0/fteqcc" verbose
614 verbose make $MAKEFLAGS clean
616 verbose make $MAKEFLAGS
618 enter "$d0/data/xonotic-data.pk3dir" verbose
620 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
622 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
624 enter "$d0/darkplaces" verbose
625 if [ x"$BAD_TARGETS" = x" " ]; then
626 echo "Warning: invalid empty client, default clients will be used."
629 verbose make $MAKEFLAGS clean
631 for T in $TARGETS; do
632 verbose make $MAKEFLAGS "$@" "$T"
634 for T in $BAD_TARGETS; do
635 echo "Warning: discarded invalid client $T."
638 verbose "$SELF" update-maps
641 if [ -n "$WE_HATE_OUR_USERS" ]; then
643 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
644 elif [ x"`uname`" = x"Darwin" ]; then
645 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS:$d0/d0_blind_id/.libs"
646 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
649 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
653 sdl|glx|agl|dedicated)
662 if ! [ -x "darkplaces/darkplaces$client" ]; then
663 if [ -x "darkplaces/darkplaces$client.exe" ]; then
666 echo "Client darkplaces/darkplaces$client not found, aborting"
670 set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
672 # if pulseaudio is running: USE IT
673 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
674 if ps -C pulseaudio >/dev/null; then
675 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
676 export SDL_AUDIODRIVER=pulse
683 if [ -n "$USE_GDB" ]; then
684 set -- gdb --args "$@"
685 elif which gdb >/dev/null 2>&1; then
686 set -- gdb --batch -x savecore.gdb --args "$@"
687 elif which catchsegv >/dev/null 2>&1; then
688 set -- catchsegv "$@"
692 if [ -f xonotic.core ]; then
693 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
694 gdb "$binary" xonotic.core
695 #elif yesno "You did not want to examine the core dump. Do you want to provide it - including your DarkPlaces checkout - to the Xonotic developers?"; then
696 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
698 # rm -f xonotic.core.tar.gz
700 echo "The core dump can be examined later by"
701 echo " gdb $binary xonotic.core"
707 if [ x"$1" = x"-k" ]; then
712 if verbose cd "$d0/$d"; then
724 patchdir=`mktemp -d -t save-patches.XXXXXX`
726 enter "$d0/$d" verbose
727 git branch -v -v | cut -c 3- | {
729 while read -r BRANCH REV UPSTREAM TEXT; do
732 UPSTREAM=${UPSTREAM#\[}
733 UPSTREAM=${UPSTREAM%\]}
734 UPSTREAM=${UPSTREAM%:*}
738 UPSTREAM=origin/"`repobranch "$d"`"
742 if [ x"$REV" = x"->" ]; then
745 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
746 echo "$d" > "$patchdir/$i/info.txt"
747 echo "$BRANCH" >> "$patchdir/$i/info.txt"
748 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
749 echo "$TRACK" >> "$patchdir/$i/info.txt"
752 rm -rf "$patchdir/$i"
757 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
762 patchdir=`mktemp -d -t restore-patches.XXXXXX`
763 ( cd "$patchdir" && tar xvzf - ) < "$infile"
765 for P in "$patchdir"/*/info.txt; do
772 verbose git checkout HEAD^0
773 verbose git branch -D "$BRANCH"
774 if [ x"$TRACK" = x"true" ]; then
775 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
777 verbose git branch -b "$BRANCH" "$UPSTREAM"
789 report=$report"$*$LF"
794 report=$report" $*$LF"
799 o=`"$@" | sed 's/^/ /' || true`
803 enter "$d0/$d" verbose
804 base="`repobranch "$d"`"
806 for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
807 case "${ref#refs/remotes/origin/}" in
820 if [ -n "$branch" ]; then
821 if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
830 l0=`git rev-list "$base".."$ref" | wc -l`
831 l1=`git rev-list master.."$ref" | wc -l`
832 if [ $l0 -gt $l1 ]; then
839 reportecho " Branch $ref:"
840 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
841 logdata=`git log --color "$realbase".."$ref"`
842 if [ -z "$logdata" ]; then
843 reportecho4 "--> not merging, no changes vs master"
844 if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
845 git push origin :"${ref#refs/remotes/origin/}"
846 reportecho4 "--> branch deleted"
849 diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
850 if [ -z "$diffdata" ]; then
851 reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
852 if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ echo "$logdata"; } | less -r'; then
853 git push origin :"${ref#refs/remotes/origin/}"
854 reportecho4 "--> branch deleted"
856 elif [ -z "$branch" ] && [ -n "$note" ]; then
857 reportdo4 echo "$note"
858 reportecho4 "--> not merging, already had this one rejected before"
859 elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
860 git checkout "$realbase"
861 org=`git rev-parse HEAD`
862 if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
863 git reset --hard "$org"
864 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
866 reportecho4 "--> merge failed"
867 elif ! "$SELF" compile 2>&1 | tee "$t"; then
868 git reset --hard "$org"
869 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
871 reportecho4 "--> compile failed"
872 elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
873 git reset --hard "$org"
874 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
875 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
876 if [ x"$note" = x"del" ]; then
877 git push origin :"${ref#refs/remotes/origin/}"
878 reportecho4 "--> test failed, branch deleted"
879 elif [ -n "$note" ]; then
880 reportdo4 echo "$note"
881 reportecho4 "--> test failed"
883 reportecho4 "--> test failed, postponed"
887 case ",`repoflags "$d"`," in
889 # we do quite a mess here... luckily we know $org
890 git fetch # svn needs to be current
891 git rebase -i --onto origin/master "$org"
892 git svn dcommit --add-author-from
893 git reset --hard "$org"
899 reportecho4 "--> MERGED"
900 if yesno "Delete original branch \"$ref\"?"; then
901 git push origin :"${ref#refs/remotes/origin/}"
902 reportecho4 "--> branch deleted"
906 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
907 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
908 if [ x"$note" = x"del" ]; then
909 git push origin :"${ref#refs/remotes/origin/}"
910 reportecho4 "--> branch deleted"
911 elif [ -n "$note" ]; then
912 reportdo4 echo "$note"
913 reportecho4 "--> rejected"
915 reportecho4 "--> postponed"
924 echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
934 # ./all clean [-m] [-f | -fu | -fU] [-r] [-D]
935 # ./all clean --reclone
938 if [ x"$1" = x"--reclone" ]; then
945 elif [ x"$1" = x"-f" ]; then
947 elif [ x"$1" = x"-u" ]; then
949 elif [ x"$1" = x"-U" ]; then
952 elif [ x"$1" = x"-fu" ]; then
955 elif [ x"$1" = x"-fU" ]; then
959 elif [ x"$1" = x"-m" ]; then
961 elif [ x"$1" = x"-r" ]; then
963 elif [ x"$1" = x"-D" ]; then
976 if $gotoupstream; then
978 msg "Must also use -f (delete local changes) when using -u"
982 if $fetchupstream; then
983 verbose git fetch origin
984 verbose git remote prune origin
986 verbose git checkout -f "`repobranch "$d"`"
987 verbose git reset --hard origin/"`repobranch "$d"`"
989 r=`git symbolic-ref HEAD`
991 rem=`git config "branch.$r.remote" || echo origin`
992 bra=`git config "branch.$r.merge" || echo "$r"`
993 upstream="$rem/${bra#refs/heads/}"
994 if $fetchupstream; then
995 verbose git fetch "$rem"
996 verbose git remote prune "$rem"
998 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
999 upstream="origin/`repobranch "$d"`"
1001 verbose git reset --hard "$upstream"
1003 elif $gotomaster; then
1005 verbose git checkout -f "`repobranch "$d"`"
1006 verbose git reset --hard
1008 verbose git checkout "`repobranch "$d"`"
1011 verbose git reset --hard
1013 if $rmuntracked; then
1016 verbose git clean -df
1019 verbose git clean -xdf
1023 if $killbranches; then
1024 git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do
1025 if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then
1026 verbose git branch -D "${B#refs/heads/}"
1033 # release building goes here
1035 #"$SELF" each git clean -fxd
1036 case "$RELEASETYPE" in
1038 msg "Building a BETA"
1041 msg "Building a RELEASE"
1044 msg "Must either set RELEASETYPE=beta or RELEASETYPE=release"
1048 verbose rm -rf Xonotic Xonotic*.zip
1049 verbose mkdir -p Xonotic
1050 if [ -n "$RELEASEDATE" ]; then
1051 verbose echo "$RELEASEDATE" > Xonotic/stamp.txt
1053 verbose date +%Y%m%d > Xonotic/stamp.txt
1055 verbose git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles key_0.d0pk | {
1057 verbose mkdir data fteqcc source source/darkplaces source/fteqcc
1059 verbose rm -rf misc/builddeps
1060 verbose mv misc/buildfiles/win32/* . || true
1061 verbose mv misc/buildfiles/win64 bin64 || true
1062 verbose mv misc/buildfiles/osx/* . || true
1063 verbose rm -rf misc/buildfiles
1064 verbose rm -rf misc/pki
1067 verbose cd darkplaces
1068 verbose git archive --format=tar HEAD
1070 verbose cd Xonotic/source/darkplaces
1075 verbose git archive --format=tar HEAD
1077 verbose cd Xonotic/source/fteqcc
1081 verbose cd data/xonotic-data.pk3dir
1082 verbose git archive --format=tar HEAD -- qcsrc Makefile
1084 verbose cd Xonotic/source
1087 rm -f Xonotic/key_15.d0pk
1089 release-compile-run)
1098 if [ -n "$targetfiles" ]; then
1099 case " $HOSTS_THAT_ARE_DISABLED " in
1104 case " $HOSTS_THAT_ARE_MYSELF " in
1106 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
1107 verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
1108 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
1109 verbose eval make -C "$buildpath" clean $maketargets $makeflags
1110 for f in $targetfiles; do
1111 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
1115 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
1116 verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
1117 verbose ssh "$host" "ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
1118 for f in $targetfiles; do
1119 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
1123 # now rebrand the binaries...
1124 for f in $targetfiles; do
1125 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
1128 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "$f"
1130 d=`mktemp -d -t rebrand.XXXXXX`
1132 echo "-mygames" > darkplaces.opt
1133 zip -9r darkplaces.zip darkplaces.opt
1146 fteqcc_maketargets=$3
1148 darkplaces_maketargets=$5
1150 host=xonotic-build-$suffix
1151 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
1152 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
1154 release-engine-win32)
1155 verbose "$SELF" release-compile win32 \
1156 'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -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' \
1157 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
1159 verbose "$SELF" release-compile win32 \
1160 'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -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' \
1162 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
1164 release-engine-win64)
1165 verbose "$SELF" release-compile win64 \
1166 'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -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' \
1167 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
1168 'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
1169 verbose "$SELF" release-compile win64 \
1170 'STRIP=: DP_MAKE_TARGET=mingw CC="x86_64-w64-mingw32-gcc -g -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=0' \
1172 cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
1175 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
1176 verbose "$SELF" release-compile osx \
1177 'STRIP=: CC="gcc -g -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"' \
1178 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
1179 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
1180 verbose "$SELF" release-compile osx \
1181 'STRIP=: CC="gcc -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I.deps/include -L.deps/lib -fno-reorder-blocks -DSUPPORTIPV6"' \
1183 'cl-release' 'darkplaces-agl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-agl-bin'
1185 release-engine-linux32)
1186 verbose "$SELF" release-compile linux32 \
1187 'STRIP=: CC="gcc -m32 -g -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' \
1188 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
1189 release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
1191 release-engine-linux64)
1192 verbose "$SELF" release-compile linux64 \
1193 'STRIP=: CC="gcc -m64 -g -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' \
1194 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
1195 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
1198 verbose "$SELF" release-engine-linux32 &
1199 verbose "$SELF" release-engine-linux64 &
1200 verbose "$SELF" release-engine-win32 &
1201 verbose "$SELF" release-engine-win64 &
1202 verbose "$SELF" release-engine-osx &
1211 verbose "$SELF" update-maps
1214 case "$RELEASETYPE" in
1216 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
1219 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
1222 verbose rm -f Xonotic/source/*/fteqcc.log
1224 release-buildpk3-transform-raw)
1227 release-buildpk3-transform-normal)
1230 # texture: convert to jpeg and dds
1231 verbose export do_jpeg=true
1232 verbose export jpeg_qual_rgb=95
1233 verbose export jpeg_qual_a=99
1234 verbose export do_dds=true
1235 verbose export dds_flags=
1236 verbose export do_ogg=false
1237 verbose export del_src=true
1238 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1240 release-buildpk3-transform-low)
1243 # texture: convert to jpeg and dds
1244 # music: reduce bitrate
1245 verbose export do_jpeg=true
1246 verbose export jpeg_qual_rgb=80
1247 verbose export jpeg_qual_a=95
1248 verbose export do_dds=false
1249 verbose export do_ogg=true
1250 verbose export ogg_qual=1
1251 verbose export del_src=true
1252 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1254 release-buildpk3-transform-lowdds)
1257 # texture: convert to jpeg and dds
1258 # music: reduce bitrate
1259 verbose export do_jpeg=false
1260 verbose export do_jpeg_if_not_dds=true
1261 verbose export jpeg_qual_rgb=80
1262 verbose export jpeg_qual_a=95
1263 verbose export do_dds=true
1264 verbose export dds_flags=
1265 verbose export do_ogg=true
1266 verbose export ogg_qual=1
1267 verbose export del_src=true
1268 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1281 verbose rm -rf Xonotic/temp
1282 verbose mkdir -p Xonotic/temp
1285 verbose git archive --format=tar HEAD
1287 verbose cd Xonotic/temp
1290 verbose cd Xonotic/temp
1291 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
1292 verbose cp ../source/progs.dat .
1293 verbose cp ../source/csprogs.dat .
1294 verbose cp ../source/menu.dat .
1295 verbose rm -rf qcsrc
1296 gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
1297 major=$(($gv / 10000))
1298 minor=$(($gv / 100 - $major * 100))
1299 patch=$(($gv - $major * 10000 - $minor * 100))
1300 versionstr="$major.$minor.$patch"
1301 case "$RELEASETYPE" in
1303 versionstr="$versionstr""beta"
1307 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
1308 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
1309 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
1310 " defaultXonotic.cfg
1312 verbose cd gfx/menu/luminos
1313 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
1314 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
1315 verbose rm background_l2.svg
1318 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
1319 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
1320 if [ -f "$X" ]; then
1322 verbose rm -f maps/*.log maps/*.irc maps/*.lin
1326 verbose export git_src_repo="$d0/$src" # skip hash-object
1327 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
1328 verbose mkzip "../../$dst" *
1330 verbose rm -rf Xonotic/temp
1333 stamp=`cat Xonotic/stamp.txt`
1339 dst="data/xonotic-$stamp-${dst#data/xonotic-}"
1345 while [ "$#" -gt 1 ]; do
1346 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
1352 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
1353 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1354 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1355 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
1356 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir low ''
1358 release-pack-needsx11)
1361 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
1364 verbose "$SELF" release-pack
1369 stamp=`cat Xonotic/stamp.txt`
1370 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
1371 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
1372 # let's pass crypto import laws of some nasty countries
1373 crypto_libs=`find Xonotic -name \*d0_rijndael\*`
1374 if [ -n "$crypto_libs" ]; then
1375 verbose mkzip Xonotic-$stamp-crypto.zip \
1379 # build the archives
1380 verbose mkzip Xonotic-$stamp-engine.zip \
1382 Xonotic/bin64/*.dll \
1385 Xonotic/xonotic.exe \
1386 Xonotic/source/darkplaces/
1387 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
1388 verbose mkzip Xonotic-$stamp-common.zip \
1389 Xonotic/source/fteqcc/ \
1390 Xonotic/source/qcsrc/ \
1395 Xonotic/key_0.d0pk \
1396 Xonotic/data/font-nimbussansl-$stamp.pk3
1397 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
1398 verbose mkzip0 Xonotic-$stamp.zip \
1399 Xonotic/data/xonotic-$stamp-data.pk3 \
1400 Xonotic/data/xonotic-$stamp-maps.pk3 \
1401 Xonotic/data/xonotic-$stamp-music.pk3 \
1402 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1403 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
1404 verbose mkzip0 Xonotic-$stamp-low.zip \
1405 Xonotic/data/xonotic-$stamp-data-low.pk3 \
1406 Xonotic/data/xonotic-$stamp-maps-low.pk3 \
1407 Xonotic/data/xonotic-$stamp-music-low.pk3
1408 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
1409 verbose mkzip0 Xonotic-$stamp-lowdds.zip \
1410 Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
1411 Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
1412 Xonotic/data/xonotic-$stamp-music-low.pk3
1413 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
1414 verbose mkzip0 Xonotic-$stamp-high.zip \
1415 Xonotic/data/xonotic-$stamp-data-raw.pk3 \
1416 Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
1417 Xonotic/data/xonotic-$stamp-music.pk3 \
1418 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1421 verbose "$SELF" release-prepare
1422 verbose "$SELF" release-maps
1423 verbose "$SELF" release-engine
1424 verbose "$SELF" release-qc
1425 verbose "$SELF" release-pack-needsx11
1426 verbose "$SELF" release-zip
1431 echo " $SELF admin-merge [<branch>]"
1432 echo " $SELF branch <branch>"
1433 echo " $SELF branch <remote> <branch> [<srcbranch>]"
1434 echo " $SELF branches"
1435 echo " $SELF checkout|switch <branch>"
1436 echo " $SELF checkout|switch <remote>/<branch>"
1437 echo " $SELF clean [-m] [-f | -fu | -fU] [-r] [-D]"
1438 echo " $SELF clean --reclone"
1439 echo " $SELF compile [-c]"
1440 echo " $SELF each|foreach [-k] command..."
1441 echo " $SELF fix_upstream_rebase"
1443 echo " $SELF push|commit [-s]"
1444 echo " $SELF release"
1445 echo " $SELF restore-patches"
1446 echo " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
1447 echo " $SELF save-patches"
1448 echo " $SELF update-maps"
1449 echo " $SELF update|pull [-N]"