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 data/xonotic-maps.pk3dir | | master |
120 mediasource | | master | no
121 fteqcc | http://github.com/Blub/qclib.git | master |
123 # todo: in darkplaces, change repobranch to div0-stable
125 repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
127 base=`git config remote.origin.url`
130 base=${base%xonotic.git}
133 echo "The main repo is not xonotic.git, what have you done?"
137 pushbase=`git config remote.origin.pushurl || true`
140 pushbase=${pushbase%xonotic.git}
145 echo "The main repo is not xonotic.git, what have you done?"
152 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
153 if [ -n "$repo_t" ]; then
163 if [ x"$1" = x"." ]; then
164 echo "$base""xonotic.git"
166 echo "$base${1##*/}.git"
173 [ -n "$pushbase" ] || return 0
174 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
175 if [ -n "$repo_t" ]; then
180 echo "$pushbase$repo_t"
184 if [ x"$1" = x"." ]; then
185 echo "$pushbase""xonotic.git"
187 echo "$pushbase${1##*/}.git"
194 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
195 if [ -n "$repo_t" ]; then
204 echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
212 # if we have the dir, always keep it
214 msg "Repository $d enabled because it already exists"
218 # if .yes file exists, always keep it
219 if [ -f "$d.yes" ]; then
220 msg "Repository $d enabled by a .yes file"
224 # if we have .no file, skip
225 if [ -f "$d.no" ]; then
226 msg "Repository $d disabled by a .no file, delete $p.no to enable"
229 # if we have matching pk3, skip
230 if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
231 msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
234 # if "no" flag is set, skip
237 msg "Repository $d disabled by default, create $d.yes to enable"
242 msg "Repository $d enabled by default"
249 if [ "$#" = 0 ]; then
255 fix_upstream_rebase()
257 if [ -z "$r_me" ] || [ -z "$r_other" ]; then
260 r_base=`git merge-base "$r_me" "$r_other"`
262 # no merge-base? upstream did filter-branch
263 if [ -n "$r_base" ]; then
264 # otherwise, check if the two histories are "similar"
265 r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
266 r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
268 # heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
269 r_lc_me=`echo "$r_l_me" | wc -l`
270 r_lc_other=`echo "$r_l_other" | wc -l`
271 r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l`
272 r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
274 if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
275 if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
276 git reset --hard "$r_me"
286 fix_upstream_rebase_mergeok()
288 r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
289 r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
293 fix_upstream_rebase_mergefail()
295 r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
296 r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
302 verbose git config remote.origin.url "$1"
304 verbose git config remote.origin.pushurl "$2"
306 verbose git config --unset remote.origin.pushurl || true
308 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
309 verbose git config core.autocrlf input
310 if [ -z "`git config push.default`" ]; then
311 verbose git config push.default current # or is tracking better?
320 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
321 7za a -tzip -mx=9 -x@"$ziplist" "$archive" "$@" || true
322 zip -9y -@<"$ziplist" "$archive" || true
334 enter "$d0/$d" verbose
335 verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
341 pushurl=`repopushurl "$d"`
342 branch=`repobranch "$d"`
343 if [ -d "$d0/$d" ]; then
344 enter "$d0/$d" verbose
345 fix_git_config "$url" "$pushurl"
352 if [ x"$1" = x"-N" ]; then
360 pushurl=`repopushurl "$d"`
361 branch=`repobranch "$d"`
362 if [ -d "$d0/$d" ]; then
364 enter "$d0/$d" verbose
365 r=`git symbolic-ref HEAD`
367 if git config branch.$r.remote >/dev/null 2>&1; then
368 if ! verbose git pull; then
369 fix_upstream_rebase_mergefail || true
370 check_mergeconflict "$d"
371 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
374 fix_upstream_rebase_mergeok || true
379 checkself "$cmd" "$@"
381 verbose git remote prune origin
385 verbose git clone "$url" "$d0/$d"
386 enter "$d0/$d" verbose
387 fix_git_config "$url" "$pushurl"
388 if [ "$branch" != "master" ]; then
389 verbose git checkout --track -b "$branch" origin/"$branch"
396 misc/tools/xonotic-map-compiler-autobuild download
400 if [ x"$1" = x"-f" ]; then
406 if [ -z "$branch" ]; then
409 branch=${remote#origin/}
420 enter "$d0/$d" verbose
422 if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
424 verbose git checkout $checkoutflags "$b"
425 elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
427 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
430 if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
432 verbose git checkout $checkoutflags "$b"
433 elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
435 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
437 echo "WTF? Not even branch $b doesn't exist in $d"
442 checkself "$cmd" "$@"
446 echo "The requested branch was not found in any repository."
454 if [ -z "$branch" ]; then
458 if [ -z "$branch" ]; then
461 r=`git symbolic-ref HEAD`
468 dv=`visible_repo_name "$d"`
469 enter "$d0/$d" verbose
470 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
471 echo "Already having this branch in $dv."
473 if yesno "Branch in $dv?"; then
474 if [ -n "$srcbranch" ]; then
477 b=origin/"`repobranch "$d"`"
478 verbose git fetch origin || true
480 # TODO do this without pushing
481 verbose git checkout -b "$branch" "$b"
482 verbose git config "branch.$branch.remote" "$remote"
483 verbose git config "branch.$branch.merge" "refs/heads/$branch"
493 cd "$d0/$d" # am in a pipe, shouldn't use enter
494 git branch -r -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
499 while read -r d BRANCH REV TEXT; do
500 if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
503 if [ x"$REV" = x"->" ]; then
506 BRANCH=${BRANCH#remotes/}
507 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
508 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
509 eval "r=\$branches_repos_$ID"
511 eval "branches_repos_$ID=\$r"
513 echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
514 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
515 eval "r=\$branches_repos_$ID"
516 printf "%-60s %s\n" "$BRANCH" "$r"
523 dv=`visible_repo_name "$d"`
524 enter "$d0/$d" verbose
525 r=`git symbolic-ref HEAD`
527 if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
528 # we have uncommitted changes
529 if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
530 if ! verbose git merge origin/"`repobranch "$d"`"; then
531 check_mergeconflict "$d"
532 exit 1 # this should ALWAYS be fatal
542 dv=`visible_repo_name "$d"`
543 enter "$d0/$d" verbose
544 r=`git symbolic-ref HEAD`
546 diffdata=`git diff --color HEAD`
547 if [ -n "$diffdata" ]; then
548 # we have uncommitted changes
549 if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" 'echo "$diffdata" | less -r'; then
550 verbose git commit -a
553 rem=`git config "branch.$r.remote" || echo origin`
554 bra=`git config "branch.$r.merge" || echo "$r"`
555 upstream="$rem/${bra#refs/heads/}"
556 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
557 upstream="origin/`repobranch "$d"`"
559 logdata=`git log --color "$upstream".."$r"`
560 if [ -n "$logdata" ]; then
561 if yesno "Push \"$r\" in $dv?" 'echo "$logdata" | less -r'; then
562 verbose git push "$rem" HEAD
565 if [ x"$submit" = x"-s" ]; then
568 verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
576 if [ -z "$CC" ]; then
577 export CC="gcc -DSUPPORTIPV6"
579 if [ -n "$WE_HATE_OUR_USERS" ]; then
580 TARGETS="sv-debug cl-debug"
581 elif [ x"`uname`" = x"Darwin" ]; then
584 TARGETS="sv-debug cl-debug sdl-debug"
587 # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
588 TARGETS="sv-debug sdl-debug"
591 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"
593 TARGETS="sv-debug cl-debug sdl-debug"
608 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
609 # if we give the command make the arg "", it will surely fail (invalid filename),
610 # so better handle it as an empty client option
613 elif [ -n "$1" ]; then
615 TARGETS_SAVE=$TARGETS
620 TARGETS="$TARGETS sdl-debug"
623 TARGETS="$TARGETS cl-debug"
626 TARGETS="$TARGETS sv-debug"
629 BAD_TARGETS="$BAD_TARGETS $X"
633 if [ -n "$TARGETS" ]; then # at least a valid client
635 else # no valid client, let's assume this option is not meant to be a client then
636 TARGETS=$TARGETS_SAVE
640 if [ -z "$MAKEFLAGS" ]; then
641 if [ -f /proc/cpuinfo ]; then
642 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
643 if [ $ncpus -gt 1 ]; then
647 if [ -n "$WE_HATE_OUR_USERS" ]; then
648 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
652 enter "$d0/fteqcc" verbose
654 verbose make $MAKEFLAGS clean
656 verbose make $MAKEFLAGS
658 enter "$d0/data/xonotic-data.pk3dir" verbose
660 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
662 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
664 enter "$d0/darkplaces" verbose
665 if [ x"$BAD_TARGETS" = x" " ]; then
666 echo "Warning: invalid empty client, default clients will be used."
669 verbose make $MAKEFLAGS clean
671 for T in $TARGETS; do
672 verbose make $MAKEFLAGS "$@" "$T"
674 for T in $BAD_TARGETS; do
675 echo "Warning: discarded invalid client $T."
678 verbose "$SELF" update-maps
681 if [ -n "$WE_HATE_OUR_USERS" ]; then
683 export PATH="$d0/misc/buildfiles/win32:$PATH"
684 elif [ x"`uname`" = x"Darwin" ]; then
685 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS"
686 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
692 sdl|glx|agl|dedicated)
701 if ! [ -x "darkplaces/darkplaces$client" ]; then
702 if [ -x "darkplaces/darkplaces$client.exe" ]; then
705 echo "Client darkplaces/darkplaces$client not found, aborting"
709 set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
711 # if pulseaudio is running: USE IT
712 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
713 if ps -C pulseaudio >/dev/null; then
714 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
715 export SDL_AUDIODRIVER=pulse
722 if [ -n "$USE_GDB" ]; then
723 set -- gdb --args "$@"
724 elif which gdb >/dev/null 2>&1; then
725 set -- gdb --batch -x savecore.gdb --args "$@"
726 elif which catchsegv >/dev/null 2>&1; then
727 set -- catchsegv "$@"
731 if [ -f xonotic.core ]; then
732 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
733 gdb "$binary" xonotic.core
734 #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
735 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
737 # rm -f xonotic.core.tar.gz
739 echo "The core dump can be examined later by"
740 echo " gdb $binary xonotic.core"
746 if [ x"$1" = x"-k" ]; then
751 if verbose cd "$d0/$d"; then
763 patchdir=`mktemp -d -t save-patches.XXXXXX`
765 enter "$d0/$d" verbose
766 git branch -v -v | cut -c 3- | {
768 while read -r BRANCH REV UPSTREAM TEXT; do
771 UPSTREAM=${UPSTREAM#\[}
772 UPSTREAM=${UPSTREAM%\]}
773 UPSTREAM=${UPSTREAM%:*}
777 UPSTREAM=origin/"`repobranch "$d"`"
781 if [ x"$REV" = x"->" ]; then
784 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
785 echo "$d" > "$patchdir/$i/info.txt"
786 echo "$BRANCH" >> "$patchdir/$i/info.txt"
787 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
788 echo "$TRACK" >> "$patchdir/$i/info.txt"
791 rm -rf "$patchdir/$i"
796 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
801 patchdir=`mktemp -d -t restore-patches.XXXXXX`
802 ( cd "$patchdir" && tar xvzf - ) < "$infile"
804 for P in "$patchdir"/*/info.txt; do
811 verbose git checkout HEAD^0
812 verbose git branch -D "$BRANCH"
813 if [ x"$TRACK" = x"true" ]; then
814 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
816 verbose git branch -b "$BRANCH" "$UPSTREAM"
828 report=$report"$*$LF"
833 report=$report" $*$LF"
838 o=`"$@" | sed 's/^/ /' || true`
842 enter "$d0/$d" verbose
843 base="`repobranch "$d"`"
845 for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
846 case "${ref#refs/remotes/origin/}" in
859 if [ -n "$branch" ]; then
860 if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
869 l0=`git rev-list "$base".."$ref" | wc -l`
870 l1=`git rev-list master.."$ref" | wc -l`
871 if [ $l0 -gt $l1 ]; then
878 reportecho " Branch $ref:"
879 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
880 logdata=`git log --color "$realbase".."$ref"`
881 if [ -z "$logdata" ]; then
882 reportecho4 "--> not merging, no changes vs master"
883 if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
884 git push origin :"${ref#refs/remotes/origin/}"
885 reportecho4 "--> branch deleted"
888 diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
889 if [ -z "$diffdata" ]; then
890 reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
891 if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ echo "$logdata"; } | less -r'; then
892 git push origin :"${ref#refs/remotes/origin/}"
893 reportecho4 "--> branch deleted"
895 elif [ -z "$branch" ] && [ -n "$note" ]; then
896 reportdo4 echo "$note"
897 reportecho4 "--> not merging, already had this one rejected before"
898 elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
899 git checkout "$realbase"
900 org=`git rev-parse HEAD`
901 if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
902 git reset --hard "$org"
903 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
905 reportecho4 "--> merge failed"
906 elif ! "$SELF" compile 2>&1 | tee "$t"; then
907 git reset --hard "$org"
908 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
910 reportecho4 "--> compile failed"
911 elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
912 git reset --hard "$org"
913 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
914 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
915 if [ x"$note" = x"del" ]; then
916 git push origin :"${ref#refs/remotes/origin/}"
917 reportecho4 "--> test failed, branch deleted"
918 elif [ -n "$note" ]; then
919 reportdo4 echo "$note"
920 reportecho4 "--> test failed"
922 reportecho4 "--> test failed, postponed"
926 case ",`repoflags "$d"`," in
928 # we do quite a mess here... luckily we know $org
929 git fetch # svn needs to be current
930 git rebase -i --onto origin/master "$org"
931 git svn dcommit --add-author-from
932 git reset --hard "$org"
938 reportecho4 "--> MERGED"
939 if yesno "Delete original branch \"$ref\"?"; then
940 git push origin :"${ref#refs/remotes/origin/}"
941 reportecho4 "--> branch deleted"
945 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
946 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
947 if [ x"$note" = x"del" ]; then
948 git push origin :"${ref#refs/remotes/origin/}"
949 reportecho4 "--> branch deleted"
950 elif [ -n "$note" ]; then
951 reportdo4 echo "$note"
952 reportecho4 "--> rejected"
954 reportecho4 "--> postponed"
963 echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
975 # ./all clean [-m] [-f | -fu | -fU] [-r] [-D]
976 # ./all clean --reclone
979 if [ x"$1" = x"--reclone" ]; then
986 elif [ x"$1" = x"-f" ]; then
988 elif [ x"$1" = x"-u" ]; then
990 elif [ x"$1" = x"-U" ]; then
993 elif [ x"$1" = x"-fu" ]; then
996 elif [ x"$1" = x"-fU" ]; then
1000 elif [ x"$1" = x"-m" ]; then
1002 elif [ x"$1" = x"-r" ]; then
1004 elif [ x"$1" = x"-D" ]; then
1017 if $gotoupstream; then
1019 msg "Must also use -f (delete local changes) when using -u"
1022 if $gotomaster; then
1023 if $fetchupstream; then
1024 verbose git fetch origin
1025 verbose git remote prune origin
1027 verbose git checkout -f "`repobranch "$d"`"
1028 verbose git reset --hard origin/"`repobranch "$d"`"
1030 r=`git symbolic-ref HEAD`
1032 rem=`git config "branch.$r.remote" || echo origin`
1033 bra=`git config "branch.$r.merge" || echo "$r"`
1034 upstream="$rem/${bra#refs/heads/}"
1035 if $fetchupstream; then
1036 verbose git fetch "$rem"
1037 verbose git remote prune "$rem"
1039 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
1040 upstream="origin/`repobranch "$d"`"
1042 verbose git reset --hard "$upstream"
1044 elif $gotomaster; then
1046 verbose git checkout -f "`repobranch "$d"`"
1047 verbose git reset --hard
1049 verbose git checkout "`repobranch "$d"`"
1052 verbose git reset --hard
1054 if $rmuntracked; then
1057 verbose git clean -df
1060 verbose git clean -xdf
1064 if $killbranches; then
1065 git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do
1066 if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then
1067 verbose git branch -D "${B#refs/heads/}"
1074 # release building goes here
1076 #"$SELF" each git clean -fxd
1077 case "$RELEASETYPE" in
1079 msg "Building a BETA"
1082 msg "Building a RELEASE"
1085 msg "Must either set RELEASETYPE=beta or RELEASETYPE=release"
1089 verbose rm -rf Xonotic Xonotic*.zip
1090 verbose mkdir -p Xonotic
1091 if [ -n "$RELEASEDATE" ]; then
1092 verbose echo "$RELEASEDATE" > Xonotic/stamp.txt
1094 verbose date +%Y%m%d > Xonotic/stamp.txt
1096 verbose git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles | {
1098 verbose mkdir data fteqcc source source/darkplaces source/fteqcc
1100 verbose rm -rf misc/builddeps
1101 verbose mv misc/buildfiles/win32/* . || true
1102 verbose mv misc/buildfiles/win64 bin64 || true
1103 verbose mv misc/buildfiles/osx/* . || true
1104 verbose rm -rf misc/buildfiles
1107 verbose cd darkplaces
1108 verbose git archive --format=tar HEAD
1110 verbose cd Xonotic/source/darkplaces
1115 verbose git archive --format=tar HEAD
1117 verbose cd Xonotic/source/fteqcc
1121 verbose cd data/xonotic-data.pk3dir
1122 verbose git archive --format=tar HEAD -- qcsrc Makefile
1124 verbose cd Xonotic/source
1128 release-compile-run)
1137 if [ -n "$targetfiles" ]; then
1138 case " $HOSTS_THAT_ARE_DISABLED " in
1143 case " $HOSTS_THAT_ARE_MYSELF " in
1145 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
1146 verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
1147 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
1148 verbose eval make -C "$buildpath" clean $maketargets $makeflags
1149 for f in $targetfiles; do
1150 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
1154 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
1155 verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
1156 verbose ssh "$host" "ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
1157 for f in $targetfiles; do
1158 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
1162 # now rebrand the binaries...
1163 for f in $targetfiles; do
1164 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
1167 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "$f"
1169 d=`mktemp -d -t rebrand.XXXXXX`
1171 echo "-mygames" > darkplaces.opt
1172 zip -9r darkplaces.zip darkplaces.opt
1185 fteqcc_maketargets=$3
1187 darkplaces_maketargets=$5
1189 host=xonotic-build-$suffix
1190 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
1191 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
1193 release-engine-win32)
1194 verbose "$SELF" release-compile win32 \
1195 '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' \
1196 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
1198 verbose "$SELF" release-compile win32 \
1199 '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' \
1201 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
1203 release-engine-win64)
1204 verbose "$SELF" release-compile win64 \
1205 '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' \
1206 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
1207 'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
1208 verbose "$SELF" release-compile win64 \
1209 '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' \
1211 cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
1214 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
1215 verbose "$SELF" release-compile osx \
1216 '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"' \
1217 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
1218 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
1219 verbose "$SELF" release-compile osx \
1220 '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"' \
1222 'cl-release' 'darkplaces-agl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-agl-bin'
1224 release-engine-linux32)
1225 verbose "$SELF" release-compile linux32 \
1226 'STRIP=: CC="gcc -m32 -g -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a' \
1227 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
1228 release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
1230 release-engine-linux64)
1231 verbose "$SELF" release-compile linux64 \
1232 'STRIP=: CC="gcc -m64 -g -I.deps/include -L.deps/lib -DSUPPORTIPV6" DP_MODPLUG_STATIC_LIBDIR=.deps/lib LIB_JPEG=.deps/lib/libjpeg.a' \
1233 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
1234 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
1237 verbose "$SELF" release-engine-linux32 &
1238 verbose "$SELF" release-engine-linux64 &
1239 verbose "$SELF" release-engine-win32 &
1240 verbose "$SELF" release-engine-win64 &
1241 verbose "$SELF" release-engine-osx &
1250 verbose "$SELF" update-maps
1253 case "$RELEASETYPE" in
1255 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
1258 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
1261 verbose rm -f Xonotic/source/*/fteqcc.log
1263 release-buildpk3-transform-raw)
1266 release-buildpk3-transform-normal)
1269 # texture: convert to jpeg and dds
1270 verbose export do_jpeg=true
1271 verbose export jpeg_qual_rgb=95
1272 verbose export jpeg_qual_a=99
1273 verbose export do_dds=true
1274 verbose export dds_flags=
1275 verbose export do_ogg=false
1276 verbose export del_src=true
1277 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1279 release-buildpk3-transform-low)
1282 # texture: convert to jpeg and dds
1283 # music: reduce bitrate
1284 verbose export do_jpeg=true
1285 verbose export jpeg_qual_rgb=80
1286 verbose export jpeg_qual_a=95
1287 verbose export do_dds=false
1288 verbose export do_ogg=true
1289 verbose export ogg_qual=1
1290 verbose export del_src=true
1291 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1293 release-buildpk3-transform-lowdds)
1296 # texture: convert to jpeg and dds
1297 # music: reduce bitrate
1298 verbose export do_jpeg=false
1299 verbose export do_jpeg_if_not_dds=true
1300 verbose export jpeg_qual_rgb=80
1301 verbose export jpeg_qual_a=95
1302 verbose export do_dds=true
1303 verbose export dds_flags=
1304 verbose export do_ogg=true
1305 verbose export ogg_qual=1
1306 verbose export del_src=true
1307 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1320 verbose rm -rf Xonotic/temp
1321 verbose mkdir -p Xonotic/temp
1324 verbose git archive --format=tar HEAD
1326 verbose cd Xonotic/temp
1329 verbose cd Xonotic/temp
1330 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
1331 verbose cp ../source/progs.dat .
1332 verbose cp ../source/csprogs.dat .
1333 verbose cp ../source/menu.dat .
1334 verbose rm -rf qcsrc
1335 gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
1336 major=$(($gv / 10000))
1337 minor=$(($gv / 100 - $major * 100))
1338 patch=$(($gv - $major * 10000 - $minor * 100))
1339 versionstr="$major.$minor.$patch"
1340 case "$RELEASETYPE" in
1342 versionstr="$versionstr""beta"
1346 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
1347 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
1348 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
1349 " defaultXonotic.cfg
1351 verbose cd gfx/menu/luminos
1352 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
1353 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
1354 verbose rm background_l2.svg
1357 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
1358 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
1359 if [ -f "$X" ]; then
1361 verbose rm -f maps/*.log maps/*.irc maps/*.lin
1365 verbose export git_src_repo="$d0/$src" # skip hash-object
1366 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
1367 verbose mkzip "../../$dst" *
1369 verbose rm -rf Xonotic/temp
1372 stamp=`cat Xonotic/stamp.txt`
1378 dst="data/xonotic-$stamp-${dst#data/xonotic-}"
1384 while [ "$#" -gt 1 ]; do
1385 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
1391 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
1392 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1393 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1394 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
1395 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir low ''
1397 release-pack-needsx11)
1400 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
1403 verbose "$SELF" release-pack
1408 stamp=`cat Xonotic/stamp.txt`
1409 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
1410 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
1411 # need to use infozip for these (+x bits)
1412 verbose mkzip Xonotic-$stamp-engine.zip \
1414 Xonotic/bin64/*.dll \
1417 Xonotic/xonotic.exe \
1418 Xonotic/source/darkplaces/
1419 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
1420 verbose mkzip Xonotic-$stamp-common.zip \
1421 Xonotic/source/fteqcc/ \
1422 Xonotic/source/qcsrc/ \
1427 Xonotic/data/font-nimbussansl-$stamp.pk3
1428 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
1429 verbose mkzip0 Xonotic-$stamp.zip \
1430 Xonotic/data/xonotic-$stamp-data.pk3 \
1431 Xonotic/data/xonotic-$stamp-maps.pk3 \
1432 Xonotic/data/xonotic-$stamp-music.pk3 \
1433 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1434 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
1435 verbose mkzip0 Xonotic-$stamp-low.zip \
1436 Xonotic/data/xonotic-$stamp-data-low.pk3 \
1437 Xonotic/data/xonotic-$stamp-maps-low.pk3 \
1438 Xonotic/data/xonotic-$stamp-music-low.pk3
1439 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
1440 verbose mkzip0 Xonotic-$stamp-lowdds.zip \
1441 Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
1442 Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
1443 Xonotic/data/xonotic-$stamp-music-low.pk3
1444 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
1445 verbose mkzip0 Xonotic-$stamp-high.zip \
1446 Xonotic/data/xonotic-$stamp-data-raw.pk3 \
1447 Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
1448 Xonotic/data/xonotic-$stamp-music.pk3 \
1449 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1452 verbose "$SELF" release-prepare
1453 verbose "$SELF" release-maps
1454 verbose "$SELF" release-engine
1455 verbose "$SELF" release-qc
1456 verbose "$SELF" release-pack-needsx11
1457 verbose "$SELF" release-zip
1462 echo " $SELF admin-merge [<branch>]"
1463 echo " $SELF branch <branch>"
1464 echo " $SELF branch <remote> <branch> [<srcbranch>]"
1465 echo " $SELF branches"
1466 echo " $SELF checkout|switch <branch>"
1467 echo " $SELF checkout|switch <remote>/<branch>"
1468 echo " $SELF clean [-m] [-f | -fu | -fU] [-r] [-D]"
1469 echo " $SELF clean --reclone"
1470 echo " $SELF compile [-c]"
1471 echo " $SELF each|foreach [-k] command..."
1472 echo " $SELF fix_upstream_rebase"
1474 echo " $SELF push|commit [-s]"
1475 echo " $SELF release"
1476 echo " $SELF restore-patches"
1477 echo " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
1478 echo " $SELF save-patches"
1479 echo " $SELF update-maps"
1480 echo " $SELF update|pull [-N]"