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?"
138 pushbase=`git config remote.origin.pushurl || true`
141 pushbase=${pushbase%xonotic.git}
146 echo "The main repo is not xonotic.git, what have you done?"
153 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
154 if [ -n "$repo_t" ]; then
164 if [ x"$1" = x"." ]; then
165 echo "$base""xonotic.git"
167 echo "$base${1##*/}.git"
174 [ -n "$pushbase" ] || return 0
175 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
176 if [ -n "$repo_t" ]; then
181 echo "$pushbase$repo_t"
185 if [ x"$1" = x"." ]; then
186 echo "$pushbase""xonotic.git"
188 echo "$pushbase${1##*/}.git"
195 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
196 if [ -n "$repo_t" ]; then
205 echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
213 # if we have the dir, always keep it
215 msg "Repository $d enabled because it already exists"
219 # if .yes file exists, always keep it
220 if [ -f "$d.yes" ]; then
221 msg "Repository $d enabled by a .yes file"
225 # if we have .no file, skip
226 if [ -f "$d.no" ]; then
227 msg "Repository $d disabled by a .no file, delete $p.no to enable"
230 # if we have matching pk3, skip
231 if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
232 msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
235 # if "no" flag is set, skip
238 msg "Repository $d disabled by default, create $d.yes to enable"
243 msg "Repository $d enabled by default"
250 if [ "$#" = 0 ]; then
256 fix_upstream_rebase()
258 if [ -z "$r_me" ] || [ -z "$r_other" ]; then
261 r_base=`git merge-base "$r_me" "$r_other"`
263 # no merge-base? upstream did filter-branch
264 if [ -n "$r_base" ]; then
265 # otherwise, check if the two histories are "similar"
266 r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
267 r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
269 # heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
270 r_lc_me=`echo "$r_l_me" | wc -l`
271 r_lc_other=`echo "$r_l_other" | wc -l`
272 r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l`
273 r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
275 if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
276 if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
277 git reset --hard "$r_me"
287 fix_upstream_rebase_mergeok()
289 r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
290 r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
294 fix_upstream_rebase_mergefail()
296 r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
297 r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
303 verbose git config remote.origin.url "$1"
305 verbose git config remote.origin.pushurl "$2"
307 verbose git config --unset remote.origin.pushurl || true
309 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
310 verbose git config core.autocrlf input
311 if [ -z "`git config push.default`" ]; then
312 verbose git config push.default current # or is tracking better?
321 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
322 7za a -tzip -mx=9 -x@"$ziplist" "$archive" "$@" || true
323 zip -9y -@<"$ziplist" "$archive" || true
335 enter "$d0/$d" verbose
336 verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
342 pushurl=`repopushurl "$d"`
343 branch=`repobranch "$d"`
344 if [ -d "$d0/$d" ]; then
346 fix_git_config "$url" "$pushurl"
353 if [ x"$1" = x"-N" ]; then
361 pushurl=`repopushurl "$d"`
362 branch=`repobranch "$d"`
363 if [ -d "$d0/$d" ]; then
365 enter "$d0/$d" verbose
366 r=`git symbolic-ref HEAD`
368 if git config branch.$r.remote >/dev/null 2>&1; then
369 if ! verbose git pull; then
370 fix_upstream_rebase_mergefail || true
371 check_mergeconflict "$d"
372 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
375 fix_upstream_rebase_mergeok || true
380 checkself "$cmd" "$@"
382 verbose git remote prune origin
386 verbose git clone "$url" "$d0/$d"
387 enter "$d0/$d" verbose
388 fix_git_config "$url" "$pushurl"
389 if [ "$branch" != "master" ]; then
390 verbose git checkout --track -b "$branch" origin/"$branch"
397 misc/tools/xonotic-map-compiler-autobuild download
401 if [ x"$1" = x"-f" ]; then
407 if [ -z "$branch" ]; then
410 branch=${remote#origin/}
421 enter "$d0/$d" verbose
423 if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
425 verbose git checkout $checkoutflags "$b"
426 elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
428 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
431 if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
433 verbose git checkout $checkoutflags "$b"
434 elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
436 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
438 echo "WTF? Not even branch $b doesn't exist in $d"
443 checkself "$cmd" "$@"
447 echo "The requested branch was not found in any repository."
455 if [ -z "$branch" ]; then
459 if [ -z "$branch" ]; then
462 r=`git symbolic-ref HEAD`
469 dv=`visible_repo_name "$d"`
470 enter "$d0/$d" verbose
471 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
472 echo "Already having this branch in $dv."
474 if yesno "Branch in $dv?"; then
475 if [ -n "$srcbranch" ]; then
478 b=origin/"`repobranch "$d"`"
479 verbose git fetch origin || true
481 # TODO do this without pushing
482 verbose git checkout -b "$branch" "$b"
483 verbose git config "branch.$branch.remote" "$remote"
484 verbose git config "branch.$branch.merge" "refs/heads/$branch"
494 cd "$d0/$d" # am in a pipe, shouldn't use enter
495 git branch -r -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
500 while read -r d BRANCH REV TEXT; do
501 if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
504 if [ x"$REV" = x"->" ]; then
507 BRANCH=${BRANCH#remotes/}
508 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
509 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
510 eval "r=\$branches_repos_$ID"
512 eval "branches_repos_$ID=\$r"
514 echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
515 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
516 eval "r=\$branches_repos_$ID"
517 printf "%-60s %s\n" "$BRANCH" "$r"
524 dv=`visible_repo_name "$d"`
525 enter "$d0/$d" verbose
526 r=`git symbolic-ref HEAD`
528 if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
529 # we have uncommitted changes
530 if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
531 if ! verbose git merge origin/"`repobranch "$d"`"; then
532 check_mergeconflict "$d"
533 exit 1 # this should ALWAYS be fatal
543 dv=`visible_repo_name "$d"`
544 enter "$d0/$d" verbose
545 r=`git symbolic-ref HEAD`
547 diffdata=`git diff --color HEAD`
548 if [ -n "$diffdata" ]; then
549 # we have uncommitted changes
550 if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" 'echo "$diffdata" | less -r'; then
551 verbose git commit -a
554 rem=`git config "branch.$r.remote" || echo origin`
555 bra=`git config "branch.$r.merge" || echo "$r"`
556 upstream="$rem/${bra#refs/heads/}"
557 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
558 upstream="origin/`repobranch "$d"`"
560 logdata=`git log --color "$upstream".."$r"`
561 if [ -n "$logdata" ]; then
562 if yesno "Push \"$r\" in $dv?" 'echo "$logdata" | less -r'; then
563 verbose git push "$rem" HEAD
566 if [ x"$submit" = x"-s" ]; then
569 verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
600 if [ -z "$CC" ]; then
601 export CC="gcc -DSUPPORTIPV6"
603 if [ -n "$WE_HATE_OUR_USERS" ]; then
604 TARGETS="sv-$debug cl-$debug"
605 elif [ x"`uname`" = x"Darwin" ]; then
608 TARGETS="sv-$debug cl-$debug sdl-$debug"
611 # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
612 TARGETS="sv-$debug sdl-$debug"
615 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"
617 TARGETS="sv-$debug cl-$debug sdl-$debug"
619 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
620 # if we give the command make the arg "", it will surely fail (invalid filename),
621 # so better handle it as an empty client option
624 elif [ -n "$1" ]; then
626 TARGETS_SAVE=$TARGETS
631 TARGETS="$TARGETS sdl-debug"
634 TARGETS="$TARGETS cl-debug"
637 TARGETS="$TARGETS sv-debug"
640 BAD_TARGETS="$BAD_TARGETS $X"
644 if [ -n "$TARGETS" ]; then # at least a valid client
646 else # no valid client, let's assume this option is not meant to be a client then
647 TARGETS=$TARGETS_SAVE
651 if [ -z "$MAKEFLAGS" ]; then
652 if [ -f /proc/cpuinfo ]; then
653 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
654 if [ $ncpus -gt 1 ]; then
658 if [ -n "$WE_HATE_OUR_USERS" ]; then
659 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
663 enter "$d0/d0_blind_id" verbose
664 if ! [ -f Makefile ]; then
665 verbose sh autogen.sh
669 verbose make $MAKEFLAGS clean
671 verbose make $MAKEFLAGS
673 enter "$d0/fteqcc" verbose
675 verbose make $MAKEFLAGS clean
677 verbose make $MAKEFLAGS
679 enter "$d0/data/xonotic-data.pk3dir" verbose
681 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
683 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
685 enter "$d0/darkplaces" verbose
686 if [ x"$BAD_TARGETS" = x" " ]; then
687 echo "Warning: invalid empty client, default clients will be used."
690 verbose make $MAKEFLAGS clean
692 for T in $TARGETS; do
693 verbose make $MAKEFLAGS "$@" "$T"
695 for T in $BAD_TARGETS; do
696 echo "Warning: discarded invalid client $T."
699 verbose "$SELF" update-maps
702 if [ -n "$WE_HATE_OUR_USERS" ]; then
704 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
705 elif [ x"`uname`" = x"Darwin" ]; then
706 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS:$d0/d0_blind_id/.libs"
707 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
710 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
714 sdl|glx|agl|dedicated)
723 if ! [ -x "darkplaces/darkplaces$client" ]; then
724 if [ -x "darkplaces/darkplaces$client.exe" ]; then
727 echo "Client darkplaces/darkplaces$client not found, aborting"
731 set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
733 # if pulseaudio is running: USE IT
734 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
735 if ps -C pulseaudio >/dev/null; then
736 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
737 export SDL_AUDIODRIVER=pulse
744 if [ -n "$USE_GDB" ]; then
745 set -- gdb --args "$@"
746 elif which gdb >/dev/null 2>&1; then
747 set -- gdb --batch -x savecore.gdb --args "$@"
748 elif which catchsegv >/dev/null 2>&1; then
749 set -- catchsegv "$@"
753 if [ -f xonotic.core ]; then
754 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
755 gdb "$binary" xonotic.core
756 #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
757 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
759 # rm -f xonotic.core.tar.gz
761 echo "The core dump can be examined later by"
762 echo " gdb $binary xonotic.core"
768 if [ x"$1" = x"-k" ]; then
773 if verbose cd "$d0/$d"; then
785 patchdir=`mktemp -d -t save-patches.XXXXXX`
787 enter "$d0/$d" verbose
788 git branch -v -v | cut -c 3- | {
790 while read -r BRANCH REV UPSTREAM TEXT; do
793 UPSTREAM=${UPSTREAM#\[}
794 UPSTREAM=${UPSTREAM%\]}
795 UPSTREAM=${UPSTREAM%:*}
799 UPSTREAM=origin/"`repobranch "$d"`"
803 if [ x"$REV" = x"->" ]; then
806 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
807 echo "$d" > "$patchdir/$i/info.txt"
808 echo "$BRANCH" >> "$patchdir/$i/info.txt"
809 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
810 echo "$TRACK" >> "$patchdir/$i/info.txt"
813 rm -rf "$patchdir/$i"
818 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
823 patchdir=`mktemp -d -t restore-patches.XXXXXX`
824 ( cd "$patchdir" && tar xvzf - ) < "$infile"
826 for P in "$patchdir"/*/info.txt; do
833 verbose git checkout HEAD^0
834 verbose git branch -D "$BRANCH"
835 if [ x"$TRACK" = x"true" ]; then
836 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
838 verbose git branch -b "$BRANCH" "$UPSTREAM"
850 report=$report"$*$LF"
855 report=$report" $*$LF"
860 o=`"$@" | sed 's/^/ /' || true`
864 enter "$d0/$d" verbose
865 base="`repobranch "$d"`"
867 for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
868 case "${ref#refs/remotes/origin/}" in
881 if [ -n "$branch" ]; then
882 if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
891 l0=`git rev-list "$base".."$ref" | wc -l`
892 l1=`git rev-list master.."$ref" | wc -l`
893 if [ $l0 -gt $l1 ]; then
900 reportecho " Branch $ref:"
901 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
902 logdata=`git log --color "$realbase".."$ref"`
903 if [ -z "$logdata" ]; then
904 reportecho4 "--> not merging, no changes vs master"
905 if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
906 git push origin :"${ref#refs/remotes/origin/}"
907 reportecho4 "--> branch deleted"
910 diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
911 if [ -z "$diffdata" ]; then
912 reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
913 if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ echo "$logdata"; } | less -r'; then
914 git push origin :"${ref#refs/remotes/origin/}"
915 reportecho4 "--> branch deleted"
917 elif [ -z "$branch" ] && [ -n "$note" ]; then
918 reportdo4 echo "$note"
919 reportecho4 "--> not merging, already had this one rejected before"
920 elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
921 git checkout "$realbase"
922 org=`git rev-parse HEAD`
923 if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
924 git reset --hard "$org"
925 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
927 reportecho4 "--> merge failed"
928 elif ! "$SELF" compile 2>&1 | tee "$t"; then
929 git reset --hard "$org"
930 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
932 reportecho4 "--> compile failed"
933 elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
934 git reset --hard "$org"
935 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
936 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
937 if [ x"$note" = x"del" ]; then
938 git push origin :"${ref#refs/remotes/origin/}"
939 reportecho4 "--> test failed, branch deleted"
940 elif [ -n "$note" ]; then
941 reportdo4 echo "$note"
942 reportecho4 "--> test failed"
944 reportecho4 "--> test failed, postponed"
948 case ",`repoflags "$d"`," in
950 # we do quite a mess here... luckily we know $org
951 git fetch # svn needs to be current
952 git rebase -i --onto origin/master "$org"
953 git svn dcommit --add-author-from
954 git reset --hard "$org"
960 reportecho4 "--> MERGED"
961 if yesno "Delete original branch \"$ref\"?"; then
962 git push origin :"${ref#refs/remotes/origin/}"
963 reportecho4 "--> branch deleted"
967 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
968 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
969 if [ x"$note" = x"del" ]; then
970 git push origin :"${ref#refs/remotes/origin/}"
971 reportecho4 "--> branch deleted"
972 elif [ -n "$note" ]; then
973 reportdo4 echo "$note"
974 reportecho4 "--> rejected"
976 reportecho4 "--> postponed"
985 echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
997 # ./all clean [-m] [-f | -fu | -fU] [-r] [-D]
998 # ./all clean --reclone
1001 if [ x"$1" = x"--reclone" ]; then
1008 elif [ x"$1" = x"-f" ]; then
1010 elif [ x"$1" = x"-u" ]; then
1012 elif [ x"$1" = x"-U" ]; then
1015 elif [ x"$1" = x"-fu" ]; then
1018 elif [ x"$1" = x"-fU" ]; then
1022 elif [ x"$1" = x"-m" ]; then
1024 elif [ x"$1" = x"-r" ]; then
1026 elif [ x"$1" = x"-D" ]; then
1039 if $gotoupstream; then
1041 msg "Must also use -f (delete local changes) when using -u"
1044 if $gotomaster; then
1045 if $fetchupstream; then
1046 verbose git fetch origin
1047 verbose git remote prune origin
1049 verbose git checkout -f "`repobranch "$d"`"
1050 verbose git reset --hard origin/"`repobranch "$d"`"
1052 r=`git symbolic-ref HEAD`
1054 rem=`git config "branch.$r.remote" || echo origin`
1055 bra=`git config "branch.$r.merge" || echo "$r"`
1056 upstream="$rem/${bra#refs/heads/}"
1057 if $fetchupstream; then
1058 verbose git fetch "$rem"
1059 verbose git remote prune "$rem"
1061 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
1062 upstream="origin/`repobranch "$d"`"
1064 verbose git reset --hard "$upstream"
1066 elif $gotomaster; then
1068 verbose git checkout -f "`repobranch "$d"`"
1069 verbose git reset --hard
1071 verbose git checkout "`repobranch "$d"`"
1074 verbose git reset --hard
1076 if $rmuntracked; then
1079 verbose git clean -df
1082 verbose git clean -xdf
1086 if $killbranches; then
1087 git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do
1088 if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then
1089 verbose git branch -D "${B#refs/heads/}"
1096 # release building goes here
1098 #"$SELF" each git clean -fxd
1099 case "$RELEASETYPE" in
1101 msg "Building a BETA"
1104 msg "Building a RELEASE"
1107 msg "Must either set RELEASETYPE=beta or RELEASETYPE=release"
1111 verbose rm -rf Xonotic Xonotic*.zip
1112 verbose mkdir -p Xonotic
1113 if [ -n "$RELEASEDATE" ]; then
1114 verbose echo "$RELEASEDATE" > Xonotic/stamp.txt
1116 verbose date +%Y%m%d > Xonotic/stamp.txt
1118 verbose git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles key_0.d0pk | {
1120 verbose mkdir data fteqcc source source/darkplaces source/fteqcc
1122 verbose rm -rf misc/builddeps
1123 verbose mv misc/buildfiles/win32/* . || true
1124 verbose mv misc/buildfiles/win64 bin64 || true
1125 verbose mv misc/buildfiles/osx/* . || true
1126 verbose rm -rf misc/buildfiles
1127 verbose rm -rf misc/pki
1130 verbose cd darkplaces
1131 verbose git archive --format=tar HEAD
1133 verbose cd Xonotic/source/darkplaces
1138 verbose git archive --format=tar HEAD
1140 verbose cd Xonotic/source/fteqcc
1144 verbose cd data/xonotic-data.pk3dir
1145 verbose git archive --format=tar HEAD -- qcsrc Makefile
1147 verbose cd Xonotic/source
1150 rm -f Xonotic/key_15.d0pk
1152 release-compile-run)
1161 if [ -n "$targetfiles" ]; then
1162 case " $HOSTS_THAT_ARE_DISABLED " in
1167 case " $HOSTS_THAT_ARE_MYSELF " in
1169 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
1170 verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
1171 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
1172 verbose eval make -C "$buildpath" clean $maketargets $makeflags
1173 for f in $targetfiles; do
1174 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
1178 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
1179 verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
1180 verbose ssh "$host" "ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
1181 for f in $targetfiles; do
1182 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
1186 # now rebrand the binaries...
1187 for f in $targetfiles; do
1188 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
1191 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "$f"
1193 d=`mktemp -d -t rebrand.XXXXXX`
1195 echo "-mygames" > darkplaces.opt
1196 zip -9r darkplaces.zip darkplaces.opt
1209 fteqcc_maketargets=$3
1211 darkplaces_maketargets=$5
1213 host=xonotic-build-$suffix
1214 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
1215 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
1217 release-engine-win32)
1218 verbose "$SELF" release-compile win32 \
1219 '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' \
1220 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
1222 verbose "$SELF" release-compile win32 \
1223 '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' \
1225 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
1227 release-engine-win64)
1228 verbose "$SELF" release-compile win64 \
1229 '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' \
1230 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
1231 'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
1232 verbose "$SELF" release-compile win64 \
1233 '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' \
1235 cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
1238 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
1239 verbose "$SELF" release-compile osx \
1240 '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"' \
1241 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
1242 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
1243 verbose "$SELF" release-compile osx \
1244 '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"' \
1246 'cl-release' 'darkplaces-agl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-agl-bin'
1248 release-engine-linux32)
1249 verbose "$SELF" release-compile linux32 \
1250 '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' \
1251 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
1252 release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
1254 release-engine-linux64)
1255 verbose "$SELF" release-compile linux64 \
1256 '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' \
1257 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
1258 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
1261 verbose "$SELF" release-engine-linux32 &
1262 verbose "$SELF" release-engine-linux64 &
1263 verbose "$SELF" release-engine-win32 &
1264 verbose "$SELF" release-engine-win64 &
1265 verbose "$SELF" release-engine-osx &
1274 verbose "$SELF" update-maps
1277 case "$RELEASETYPE" in
1279 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
1282 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
1285 verbose rm -f Xonotic/source/*/fteqcc.log
1287 release-buildpk3-transform-raw)
1290 release-buildpk3-transform-normal)
1293 # texture: convert to jpeg and dds
1294 verbose export do_jpeg=true
1295 verbose export jpeg_qual_rgb=95
1296 verbose export jpeg_qual_a=99
1297 verbose export do_dds=true
1298 verbose export dds_flags=
1299 verbose export do_ogg=false
1300 verbose export del_src=true
1301 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1303 release-buildpk3-transform-low)
1306 # texture: convert to jpeg and dds
1307 # music: reduce bitrate
1308 verbose export do_jpeg=true
1309 verbose export jpeg_qual_rgb=80
1310 verbose export jpeg_qual_a=95
1311 verbose export do_dds=false
1312 verbose export do_ogg=true
1313 verbose export ogg_qual=1
1314 verbose export del_src=true
1315 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1317 release-buildpk3-transform-lowdds)
1320 # texture: convert to jpeg and dds
1321 # music: reduce bitrate
1322 verbose export do_jpeg=false
1323 verbose export do_jpeg_if_not_dds=true
1324 verbose export jpeg_qual_rgb=80
1325 verbose export jpeg_qual_a=95
1326 verbose export do_dds=true
1327 verbose export dds_flags=
1328 verbose export do_ogg=true
1329 verbose export ogg_qual=1
1330 verbose export del_src=true
1331 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1344 verbose rm -rf Xonotic/temp
1345 verbose mkdir -p Xonotic/temp
1348 verbose git archive --format=tar HEAD
1350 verbose cd Xonotic/temp
1353 verbose cd Xonotic/temp
1354 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
1355 verbose cp ../source/progs.dat .
1356 verbose cp ../source/csprogs.dat .
1357 verbose cp ../source/menu.dat .
1358 verbose rm -rf qcsrc
1359 gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
1360 major=$(($gv / 10000))
1361 minor=$(($gv / 100 - $major * 100))
1362 patch=$(($gv - $major * 10000 - $minor * 100))
1363 versionstr="$major.$minor.$patch"
1364 case "$RELEASETYPE" in
1366 versionstr="$versionstr""beta"
1370 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
1371 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
1372 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
1373 " defaultXonotic.cfg
1375 verbose cd gfx/menu/luminos
1376 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
1377 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
1378 verbose rm background_l2.svg
1381 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
1382 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
1383 if [ -f "$X" ]; then
1385 verbose rm -f maps/*.log maps/*.irc maps/*.lin
1389 verbose export git_src_repo="$d0/$src" # skip hash-object
1390 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
1391 verbose mkzip "../../$dst" *
1393 verbose rm -rf Xonotic/temp
1396 stamp=`cat Xonotic/stamp.txt`
1402 dst="data/xonotic-$stamp-${dst#data/xonotic-}"
1408 while [ "$#" -gt 1 ]; do
1409 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
1415 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
1416 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1417 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1418 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
1419 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir low ''
1421 release-pack-needsx11)
1424 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
1427 verbose "$SELF" release-pack
1432 stamp=`cat Xonotic/stamp.txt`
1433 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
1434 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
1435 # let's pass crypto import laws of some nasty countries
1436 crypto_libs=`find Xonotic -name \*d0_rijndael\*`
1437 if [ -n "$crypto_libs" ]; then
1438 verbose mkzip Xonotic-$stamp-crypto.zip \
1442 # build the archives
1443 verbose mkzip Xonotic-$stamp-engine.zip \
1445 Xonotic/bin64/*.dll \
1448 Xonotic/xonotic.exe \
1449 Xonotic/source/darkplaces/
1450 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
1451 verbose mkzip Xonotic-$stamp-common.zip \
1452 Xonotic/source/fteqcc/ \
1453 Xonotic/source/qcsrc/ \
1458 Xonotic/key_0.d0pk \
1459 Xonotic/data/font-nimbussansl-$stamp.pk3
1460 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
1461 verbose mkzip0 Xonotic-$stamp.zip \
1462 Xonotic/data/xonotic-$stamp-data.pk3 \
1463 Xonotic/data/xonotic-$stamp-maps.pk3 \
1464 Xonotic/data/xonotic-$stamp-music.pk3 \
1465 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1466 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
1467 verbose mkzip0 Xonotic-$stamp-low.zip \
1468 Xonotic/data/xonotic-$stamp-data-low.pk3 \
1469 Xonotic/data/xonotic-$stamp-maps-low.pk3 \
1470 Xonotic/data/xonotic-$stamp-music-low.pk3
1471 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
1472 verbose mkzip0 Xonotic-$stamp-lowdds.zip \
1473 Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
1474 Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
1475 Xonotic/data/xonotic-$stamp-music-low.pk3
1476 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
1477 verbose mkzip0 Xonotic-$stamp-high.zip \
1478 Xonotic/data/xonotic-$stamp-data-raw.pk3 \
1479 Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
1480 Xonotic/data/xonotic-$stamp-music.pk3 \
1481 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1484 verbose "$SELF" release-prepare
1485 verbose "$SELF" release-maps
1486 verbose "$SELF" release-engine
1487 verbose "$SELF" release-qc
1488 verbose "$SELF" release-pack-needsx11
1489 verbose "$SELF" release-zip
1494 echo " $SELF admin-merge [<branch>]"
1495 echo " $SELF branch <branch>"
1496 echo " $SELF branch <remote> <branch> [<srcbranch>]"
1497 echo " $SELF branches"
1498 echo " $SELF checkout|switch <branch>"
1499 echo " $SELF checkout|switch <remote>/<branch>"
1500 echo " $SELF clean [-m] [-f | -fu | -fU] [-r] [-D]"
1501 echo " $SELF clean --reclone"
1502 echo " $SELF compile [-c]"
1503 echo " $SELF each|foreach [-k] command..."
1504 echo " $SELF fix_upstream_rebase"
1506 echo " $SELF push|commit [-s]"
1507 echo " $SELF release"
1508 echo " $SELF restore-patches"
1509 echo " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
1510 echo " $SELF save-patches"
1511 echo " $SELF update-maps"
1512 echo " $SELF update|pull [-N]"