6 # I use this in EVERY shell script ;)
12 while ! [ -f ./all ]; do
13 if [ x"`pwd`" = x"/" ]; then
14 echo "Cannot find myself."
15 echo "Please run this script with the working directory inside a Xonotic checkout."
23 # If we are on WINDOWS:
28 # Windows hates users. So this script has to copy itself elsewhere first...
29 cp "$SELF" ../all.xonotic.sh
30 export WE_HATE_OUR_USERS=1
31 exec ../all.xonotic.sh "$@"
39 echo >&2 "$ESC[1m$*$ESC[m"
42 self=`git hash-object "$SELF"`
45 self_new=`git hash-object "$SELF"`
46 if [ x"$self" != x"$self_new" ]; then
47 msg "./all has changed."
48 if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
49 msg "Rerunning the requested operation to make sure."
50 export XONOTIC_FORBID_RERUN_ALL=1
53 msg "Please try $SELF update, and then retry your requested operation."
70 echo "the root directory"
80 if git ls-files -u | grep ' 1 '; then
82 echo "MERGE CONFLICT."
83 echo "change into the \"$1\" project directory, and then:"
84 echo "- edit the files mentioned above with your favorite editor,"
85 echo " and fix the conflicts (marked with <<<<<<< blocks)"
86 echo "- for binary files, you can select the files using"
87 echo " git checkout --ours or git checkout --theirs"
88 echo "- when done with a file, 'git add' the file"
89 echo "- when done, 'git commit'"
98 while [ x"$yesno" != x"y" -a x"$yesno" != x"n" ]; do
109 check_mergeconflict "$1"
114 data/xonotic-data.pk3dir | | master |
115 data/xonotic-music.pk3dir | | master |
116 data/xonotic-nexcompat.pk3dir | | master | no
117 darkplaces | | div0-stable | svn
118 netradiant | | master |
119 div0-gittools | | master | no
120 d0_blind_id | git://github.com/divVerent/d0_blind_id.git | master |
121 data/xonotic-maps.pk3dir | | master |
122 mediasource | | master | no
123 fteqcc | git://github.com/Blub/qclib.git | master |
125 # todo: in darkplaces, change repobranch to div0-stable
127 repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
129 base=`git config remote.origin.url`
132 base=${base%xonotic.git}
135 echo "The main repo is not xonotic.git, what have you done?"
139 pushbase=`git config remote.origin.pushurl || true`
142 pushbase=${pushbase%xonotic.git}
147 echo "The main repo is not xonotic.git, what have you done?"
154 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
155 if [ -n "$repo_t" ]; then
165 if [ x"$1" = x"." ]; then
166 echo "$base""xonotic.git"
168 echo "$base${1##*/}.git"
175 [ -n "$pushbase" ] || return 0
176 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
177 if [ -n "$repo_t" ]; then
182 echo "$pushbase$repo_t"
186 if [ x"$1" = x"." ]; then
187 echo "$pushbase""xonotic.git"
189 echo "$pushbase${1##*/}.git"
196 repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
197 if [ -n "$repo_t" ]; then
206 echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
214 # if we have the dir, always keep it
216 msg "Repository $d enabled because it already exists"
220 # if .yes file exists, always keep it
221 if [ -f "$d.yes" ]; then
222 msg "Repository $d enabled by a .yes file"
226 # if we have .no file, skip
227 if [ -f "$d.no" ]; then
228 msg "Repository $d disabled by a .no file, delete $p.no to enable"
231 # if we have matching pk3, skip
232 if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
233 msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
236 # if "no" flag is set, skip
239 msg "Repository $d disabled by default, create $d.yes to enable"
244 msg "Repository $d enabled by default"
251 if [ "$#" = 0 ]; then
257 fix_upstream_rebase()
259 if [ -z "$r_me" ] || [ -z "$r_other" ]; then
262 r_base=`git merge-base "$r_me" "$r_other"`
264 # no merge-base? upstream did filter-branch
265 if [ -n "$r_base" ]; then
266 # otherwise, check if the two histories are "similar"
267 r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
268 r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
270 # heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
271 r_lc_me=`echo "$r_l_me" | wc -l`
272 r_lc_other=`echo "$r_l_other" | wc -l`
273 r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l`
274 r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
276 if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
277 if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
278 git reset --hard "$r_me"
288 fix_upstream_rebase_mergeok()
290 r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
291 r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
295 fix_upstream_rebase_mergefail()
297 r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
298 r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
304 verbose git config remote.origin.url "$1"
306 verbose git config remote.origin.pushurl "$2"
308 verbose git config --unset remote.origin.pushurl || true
310 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
311 verbose git config core.autocrlf input
312 if [ -z "`git config push.default`" ]; then
313 verbose git config push.default current # or is tracking better?
322 find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
323 7za a -tzip -mx=9 -x@"$ziplist" "$archive" "$@" || true
324 zip -9y -@<"$ziplist" "$archive" || true
336 enter "$d0/$d" verbose
337 verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
343 pushurl=`repopushurl "$d"`
344 branch=`repobranch "$d"`
345 if [ -d "$d0/$d" ]; then
347 fix_git_config "$url" "$pushurl"
356 if [ x"$1" = x"-N" ]; then
358 elif [ x"$1" = x"-p" ]; then
360 pushbase=ssh://xonotic@git.xonotic.org/
361 elif [ x"$1" = x"-s" ]; then
363 base=ssh://xonotic@git.xonotic.org/
365 elif [ x"$1" = x"-g" ]; then
367 base=git://git.xonotic.org/xonotic/
368 elif [ x"$1" = x"-h" ]; then
370 base=http://git.xonotic.org/xonotic/
378 pushurl=`repopushurl .`
379 fix_git_config "$url" "$pushurl"
381 if $allow_pull || $fix_config; then
386 pushurl=`repopushurl "$d"`
387 branch=`repobranch "$d"`
388 if [ -d "$d0/$d" ]; then
390 enter "$d0/$d" verbose
391 r=`git symbolic-ref HEAD`
393 if git config branch.$r.remote >/dev/null 2>&1; then
394 if ! verbose git pull; then
395 fix_upstream_rebase_mergefail || true
396 check_mergeconflict "$d"
397 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
400 fix_upstream_rebase_mergeok || true
405 checkself "$cmd" "$@"
407 verbose git remote prune origin
411 verbose git clone "$url" "$d0/$d"
412 enter "$d0/$d" verbose
413 fix_git_config "$url" "$pushurl"
414 if [ "$branch" != "master" ]; then
415 verbose git checkout --track -b "$branch" origin/"$branch"
422 misc/tools/xonotic-map-compiler-autobuild download
426 if [ x"$1" = x"-f" ]; then
432 if [ -z "$branch" ]; then
435 branch=${remote#origin/}
446 enter "$d0/$d" verbose
448 if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
450 verbose git checkout $checkoutflags "$b"
451 elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
453 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
456 if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
458 verbose git checkout $checkoutflags "$b"
459 elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
461 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
463 echo "WTF? Not even branch $b doesn't exist in $d"
468 checkself "$cmd" "$@"
472 echo "The requested branch was not found in any repository."
480 if [ -z "$branch" ]; then
484 if [ -z "$branch" ]; then
487 r=`git symbolic-ref HEAD`
494 dv=`visible_repo_name "$d"`
495 enter "$d0/$d" verbose
496 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
497 echo "Already having this branch in $dv."
499 if yesno "Branch in $dv?"; then
500 if [ -n "$srcbranch" ]; then
503 b=origin/"`repobranch "$d"`"
504 verbose git fetch origin || true
506 # TODO do this without pushing
507 verbose git checkout -b "$branch" "$b"
508 verbose git config "branch.$branch.remote" "$remote"
509 verbose git config "branch.$branch.merge" "refs/heads/$branch"
519 cd "$d0/$d" # am in a pipe, shouldn't use enter
520 git branch -r -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
525 while read -r d BRANCH REV TEXT; do
526 if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
529 if [ x"$REV" = x"->" ]; then
532 BRANCH=${BRANCH#remotes/}
533 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
534 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
535 eval "r=\$branches_repos_$ID"
537 eval "branches_repos_$ID=\$r"
539 echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
540 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
541 eval "r=\$branches_repos_$ID"
542 printf "%-60s %s\n" "$BRANCH" "$r"
549 dv=`visible_repo_name "$d"`
550 enter "$d0/$d" verbose
551 r=`git symbolic-ref HEAD`
553 if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
554 # we have uncommitted changes
555 if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
556 if ! verbose git merge origin/"`repobranch "$d"`"; then
557 check_mergeconflict "$d"
558 exit 1 # this should ALWAYS be fatal
568 dv=`visible_repo_name "$d"`
569 enter "$d0/$d" verbose
570 r=`git symbolic-ref HEAD`
572 diffdata=`git diff --color HEAD`
573 if [ -n "$diffdata" ]; then
574 # we have uncommitted changes
575 if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" 'echo "$diffdata" | less -r'; then
576 verbose git commit -a
579 rem=`git config "branch.$r.remote" || echo origin`
580 bra=`git config "branch.$r.merge" || echo "$r"`
581 upstream="$rem/${bra#refs/heads/}"
582 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
583 upstream="origin/`repobranch "$d"`"
585 logdata=`git log --color "$upstream".."$r"`
586 if [ -n "$logdata" ]; then
587 if yesno "Push \"$r\" in $dv?" 'echo "$logdata" | less -r'; then
588 verbose git push "$rem" HEAD
591 if [ x"$submit" = x"-s" ]; then
594 verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
608 if [ -z "$CC" ]; then
609 export CC="gcc -DSUPPORTIPV6"
625 export CC="$CC -g -mtune=native -march=native"
633 if [ -n "$WE_HATE_OUR_USERS" ]; then
634 TARGETS="sv-$debug cl-$debug"
635 elif [ x"`uname`" = x"Darwin" ]; then
638 TARGETS="sv-$debug cl-$debug sdl-$debug"
641 # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
642 TARGETS="sv-$debug sdl-$debug"
645 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"
647 TARGETS="sv-$debug cl-$debug sdl-$debug"
649 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
650 # if we give the command make the arg "", it will surely fail (invalid filename),
651 # so better handle it as an empty client option
654 elif [ -n "$1" ]; then
656 TARGETS_SAVE=$TARGETS
661 TARGETS="$TARGETS sdl-debug"
664 TARGETS="$TARGETS cl-debug"
667 TARGETS="$TARGETS sv-debug"
670 BAD_TARGETS="$BAD_TARGETS $X"
674 if [ -n "$TARGETS" ]; then # at least a valid client
676 else # no valid client, let's assume this option is not meant to be a client then
677 TARGETS=$TARGETS_SAVE
681 if [ -z "$MAKEFLAGS" ]; then
682 if [ -f /proc/cpuinfo ]; then
683 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
684 if [ $ncpus -gt 1 ]; then
688 if [ -n "$WE_HATE_OUR_USERS" ]; then
689 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
693 enter "$d0/d0_blind_id" verbose
694 if ! $compiled0; then
695 # compilation of crypto library failed
696 # use binaries then, if we can...
698 if [ -n "$WE_HATE_OUR_USERS" ]; then
699 verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
700 verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
706 verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_blind_id".* .libs/
707 verbose cp "$d0/misc/builddeps/dp.linux64/lib/libgmp".* .libs/
708 MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/"
711 verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_blind_id".* .libs/
712 verbose cp "$d0/misc/builddeps/dp.linux32/lib/libgmp".* .libs/
713 MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/"
721 verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
731 if [ -f Makefile ]; then
732 verbose make $MAKEFLAGS distclean
735 if ! [ -f Makefile ]; then
736 verbose sh autogen.sh
739 verbose make $MAKEFLAGS
742 enter "$d0/fteqcc" verbose
744 verbose make $MAKEFLAGS clean
746 verbose make $MAKEFLAGS
748 enter "$d0/data/xonotic-data.pk3dir" verbose
750 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
752 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
754 enter "$d0/darkplaces" verbose
755 if [ x"$BAD_TARGETS" = x" " ]; then
756 echo "Warning: invalid empty client, default clients will be used."
759 verbose make $MAKEFLAGS clean
761 for T in $TARGETS; do
762 verbose make $MAKEFLAGS STRIP=: "$@" "$T"
764 for T in $BAD_TARGETS; do
765 echo "Warning: discarded invalid client $T."
768 verbose "$SELF" update-maps
771 if [ -n "$WE_HATE_OUR_USERS" ]; then
773 export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
774 elif [ x"`uname`" = x"Darwin" ]; then
775 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS:$d0/d0_blind_id/.libs"
776 export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
779 export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
783 sdl|glx|agl|dedicated)
792 if ! [ -x "darkplaces/darkplaces$client" ]; then
793 if [ -x "darkplaces/darkplaces$client.exe" ]; then
796 echo "Client darkplaces/darkplaces$client not found, aborting"
800 set -- "darkplaces/darkplaces$client" -xonotic -mygames "$@"
802 # if pulseaudio is running: USE IT
803 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
804 if ps -C pulseaudio >/dev/null; then
805 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
806 export SDL_AUDIODRIVER=pulse
813 if [ -n "$USE_GDB" ]; then
814 set -- gdb --args "$@"
815 elif which gdb >/dev/null 2>&1; then
816 set -- gdb --batch -x savecore.gdb --args "$@"
817 elif which catchsegv >/dev/null 2>&1; then
818 set -- catchsegv "$@"
822 if [ -f xonotic.core ]; then
823 if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
824 gdb "$binary" xonotic.core
825 #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
826 # tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
828 # rm -f xonotic.core.tar.gz
830 echo "The core dump can be examined later by"
831 echo " gdb $binary xonotic.core"
837 if [ x"$1" = x"-k" ]; then
842 if verbose cd "$d0/$d"; then
854 patchdir=`mktemp -d -t save-patches.XXXXXX`
856 enter "$d0/$d" verbose
857 git branch -v -v | cut -c 3- | {
859 while read -r BRANCH REV UPSTREAM TEXT; do
862 UPSTREAM=${UPSTREAM#\[}
863 UPSTREAM=${UPSTREAM%\]}
864 UPSTREAM=${UPSTREAM%:*}
868 UPSTREAM=origin/"`repobranch "$d"`"
872 if [ x"$REV" = x"->" ]; then
875 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
876 echo "$d" > "$patchdir/$i/info.txt"
877 echo "$BRANCH" >> "$patchdir/$i/info.txt"
878 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
879 echo "$TRACK" >> "$patchdir/$i/info.txt"
882 rm -rf "$patchdir/$i"
887 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
892 patchdir=`mktemp -d -t restore-patches.XXXXXX`
893 ( cd "$patchdir" && tar xvzf - ) < "$infile"
895 for P in "$patchdir"/*/info.txt; do
902 verbose git checkout HEAD^0
903 verbose git branch -D "$BRANCH"
904 if [ x"$TRACK" = x"true" ]; then
905 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
907 verbose git branch -b "$BRANCH" "$UPSTREAM"
919 report=$report"$*$LF"
924 report=$report" $*$LF"
929 o=`"$@" | sed 's/^/ /' || true`
933 enter "$d0/$d" verbose
934 base="`repobranch "$d"`"
936 for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
937 case "${ref#refs/remotes/origin/}" in
950 if [ -n "$branch" ]; then
951 if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
960 l0=`git rev-list "$base".."$ref" | wc -l`
961 l1=`git rev-list master.."$ref" | wc -l`
962 if [ $l0 -gt $l1 ]; then
969 reportecho " Branch $ref:"
970 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
971 logdata=`git log --color "$realbase".."$ref"`
972 if [ -z "$logdata" ]; then
973 reportecho4 "--> not merging, no changes vs master"
974 if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
975 git push origin :"${ref#refs/remotes/origin/}"
976 reportecho4 "--> branch deleted"
979 diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
980 if [ -z "$diffdata" ]; then
981 reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
982 if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ echo "$logdata"; } | less -r'; then
983 git push origin :"${ref#refs/remotes/origin/}"
984 reportecho4 "--> branch deleted"
986 elif [ -z "$branch" ] && [ -n "$note" ]; then
987 reportdo4 echo "$note"
988 reportecho4 "--> not merging, already had this one rejected before"
989 elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
990 git checkout "$realbase"
991 org=`git rev-parse HEAD`
992 if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
993 git reset --hard "$org"
994 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
996 reportecho4 "--> merge failed"
997 elif ! "$SELF" compile 2>&1 | tee "$t"; then
998 git reset --hard "$org"
999 GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
1001 reportecho4 "--> compile failed"
1002 elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
1003 git reset --hard "$org"
1004 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
1005 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
1006 if [ x"$note" = x"del" ]; then
1007 git push origin :"${ref#refs/remotes/origin/}"
1008 reportecho4 "--> test failed, branch deleted"
1009 elif [ -n "$note" ]; then
1010 reportdo4 echo "$note"
1011 reportecho4 "--> test failed"
1013 reportecho4 "--> test failed, postponed"
1017 case ",`repoflags "$d"`," in
1019 # we do quite a mess here... luckily we know $org
1020 git fetch # svn needs to be current
1021 git rebase -i --onto origin/master "$org"
1022 git svn dcommit --add-author-from
1023 git reset --hard "$org"
1026 git push origin HEAD
1029 reportecho4 "--> MERGED"
1030 if yesno "Delete original branch \"$ref\"?"; then
1031 git push origin :"${ref#refs/remotes/origin/}"
1032 reportecho4 "--> branch deleted"
1036 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
1037 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
1038 if [ x"$note" = x"del" ]; then
1039 git push origin :"${ref#refs/remotes/origin/}"
1040 reportecho4 "--> branch deleted"
1041 elif [ -n "$note" ]; then
1042 reportdo4 echo "$note"
1043 reportecho4 "--> rejected"
1045 reportecho4 "--> postponed"
1054 echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
1066 # ./all clean [-m] [-f | -fu | -fU] [-r] [-D]
1067 # ./all clean --reclone
1070 if [ x"$1" = x"--reclone" ]; then
1077 elif [ x"$1" = x"-f" ]; then
1079 elif [ x"$1" = x"-u" ]; then
1081 elif [ x"$1" = x"-U" ]; then
1084 elif [ x"$1" = x"-fu" ]; then
1087 elif [ x"$1" = x"-fU" ]; then
1091 elif [ x"$1" = x"-m" ]; then
1093 elif [ x"$1" = x"-r" ]; then
1095 elif [ x"$1" = x"-D" ]; then
1108 if $gotoupstream; then
1110 msg "Must also use -f (delete local changes) when using -u"
1113 if $gotomaster; then
1114 if $fetchupstream; then
1115 verbose git fetch origin
1116 verbose git remote prune origin
1118 verbose git checkout -f "`repobranch "$d"`"
1119 verbose git reset --hard origin/"`repobranch "$d"`"
1121 r=`git symbolic-ref HEAD`
1123 rem=`git config "branch.$r.remote" || echo origin`
1124 bra=`git config "branch.$r.merge" || echo "$r"`
1125 upstream="$rem/${bra#refs/heads/}"
1126 if $fetchupstream; then
1127 verbose git fetch "$rem"
1128 verbose git remote prune "$rem"
1130 if ! git rev-parse "$upstream" >/dev/null 2>&1; then
1131 upstream="origin/`repobranch "$d"`"
1133 verbose git reset --hard "$upstream"
1135 elif $gotomaster; then
1137 verbose git checkout -f "`repobranch "$d"`"
1138 verbose git reset --hard
1140 verbose git checkout "`repobranch "$d"`"
1143 verbose git reset --hard
1145 if $rmuntracked; then
1148 verbose git clean -df
1151 verbose git clean -xdf
1155 if $killbranches; then
1156 git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do
1157 if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then
1158 verbose git branch -D "${B#refs/heads/}"
1161 git rev-parse refs/heads/master >/dev/null 2>&1 || verbose git branch -t master origin/master || true
1162 git rev-parse "refs/heads/`repobranch "$d"`" >/dev/null 2>&1 || verbose git branch -t "`repobranch "$d"`" origin/"`repobranch "$d"`" || true
1167 # release building goes here
1169 #"$SELF" each git clean -fxd
1170 case "$RELEASETYPE" in
1172 msg "Building a BETA"
1175 msg "Building a RELEASE"
1178 echo >&2 -n "$ESC[2J$ESC[H"
1185 msg " +---------------------------------------------------------.---+"
1187 msg " +---------------------------------------------------------^---+"
1189 msg " | / \ This is the official release build system. |"
1190 msg " | | | If you are not a member of the Xonotic Core Team, |"
1191 msg " | | STOP | you are not supposed to use this script and should |"
1192 msg " | | | instead use ./all compile to compile the engine |"
1193 msg " | \____/ and game code. |"
1195 msg " | [ I understand ] |"
1196 msg " +-------------------------------------------------------------+"
1198 # A LOT of build infrastructure is required:
1201 # - .ssh/config must be configured so the following
1202 # host names are reachable and have a compile
1203 # infrastructure set up:
1204 # - xonotic-build-linux32 (with gcc on x86)
1205 # - xonotic-build-linux64 (with gcc on x86_64)
1206 # - xonotic-build-win32 (with i586-mingw32msvc-g++)
1207 # - xonotic-build-win64 (with amd64-mingw32msvc-g++
1208 # and x86_64-w64-mingw32-g++)
1209 # - xonotic-build-osx (with Xcode and SDL.framework)
1210 # - AMD Compressonator installed in WINE
1211 # - ResEdit installed in WINE
1212 # - a lot of other requirements you will figure out
1213 # while reading the error messages
1214 # - environment variable RELEASETYPE set
1215 # - optionally, environment variable RELEASEDATE set
1220 verbose rm -rf Xonotic Xonotic*.zip
1221 verbose mkdir -p Xonotic
1222 if [ -n "$RELEASEDATE" ]; then
1223 verbose echo "$RELEASEDATE" > Xonotic/stamp.txt
1225 verbose date +%Y%m%d > Xonotic/stamp.txt
1227 verbose git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles key_0.d0pk | {
1229 verbose mkdir data fteqcc source source/darkplaces source/fteqcc
1231 verbose rm -rf misc/builddeps
1232 verbose mv misc/buildfiles/win32/* . || true
1233 verbose mv misc/buildfiles/win64 bin64 || true
1234 verbose mv misc/buildfiles/osx/* . || true
1235 verbose rm -rf misc/buildfiles
1236 verbose rm -rf misc/pki
1239 verbose cd darkplaces
1240 verbose git archive --format=tar HEAD
1242 verbose cd Xonotic/source/darkplaces
1247 verbose git archive --format=tar HEAD
1249 verbose cd Xonotic/source/fteqcc
1253 verbose cd data/xonotic-data.pk3dir
1254 verbose git archive --format=tar HEAD -- qcsrc Makefile
1256 verbose cd Xonotic/source
1259 rm -f Xonotic/key_15.d0pk
1261 release-compile-run)
1270 if [ -n "$targetfiles" ]; then
1271 case " $HOSTS_THAT_ARE_DISABLED " in
1276 case " $HOSTS_THAT_ARE_MYSELF " in
1278 verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
1279 verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
1280 verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
1281 verbose eval make -C "$buildpath" clean $maketargets $makeflags
1282 for f in $targetfiles; do
1283 verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
1287 verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
1288 verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
1289 verbose ssh "$host" "ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
1290 for f in $targetfiles; do
1291 verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
1295 # now rebrand the binaries...
1296 for f in $targetfiles; do
1297 #verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
1300 verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "$f"
1302 d=`mktemp -d -t rebrand.XXXXXX`
1304 echo "-mygames" > darkplaces.opt
1305 zip -9r darkplaces.zip darkplaces.opt
1318 fteqcc_maketargets=$3
1320 darkplaces_maketargets=$5
1322 host=xonotic-build-$suffix
1323 verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
1324 verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
1326 release-engine-win32)
1327 verbose "$SELF" release-compile win32 \
1328 'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -march=i686 -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' \
1329 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
1331 verbose "$SELF" release-compile win32 \
1332 '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' \
1334 release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
1336 release-engine-win64)
1337 verbose "$SELF" release-compile win64 \
1338 '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' \
1339 win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
1340 'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
1341 verbose "$SELF" release-compile win64 \
1342 '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' \
1344 cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
1347 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
1348 verbose "$SELF" release-compile osx \
1349 '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"' \
1350 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
1351 'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
1352 verbose "$SELF" release-compile osx \
1353 '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"' \
1355 'cl-release' 'darkplaces-agl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-agl-bin'
1357 release-engine-linux32)
1358 verbose "$SELF" release-compile linux32 \
1359 'STRIP=: CC="gcc -m32 -march=i686 -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' \
1360 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
1361 release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
1363 release-engine-linux64)
1364 verbose "$SELF" release-compile linux64 \
1365 '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' \
1366 all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
1367 release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
1370 verbose "$SELF" release-engine-linux32 &
1371 verbose "$SELF" release-engine-linux64 &
1372 verbose "$SELF" release-engine-win32 &
1373 verbose "$SELF" release-engine-win64 &
1374 verbose "$SELF" release-engine-osx &
1383 verbose "$SELF" update-maps
1386 case "$RELEASETYPE" in
1388 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
1391 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
1394 verbose rm -f Xonotic/source/*/fteqcc.log
1396 release-buildpk3-transform-raw)
1399 release-buildpk3-transform-normal)
1402 # texture: convert to jpeg and dds
1403 verbose export do_jpeg=true
1404 verbose export jpeg_qual_rgb=95
1405 verbose export jpeg_qual_a=99
1406 verbose export do_dds=true
1407 verbose export dds_flags=
1408 verbose export do_ogg=false
1409 verbose export del_src=true
1410 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1412 release-buildpk3-transform-low)
1415 # texture: convert to jpeg and dds
1416 # music: reduce bitrate
1417 verbose export do_jpeg=true
1418 verbose export jpeg_qual_rgb=80
1419 verbose export jpeg_qual_a=95
1420 verbose export do_dds=false
1421 verbose export do_ogg=true
1422 verbose export ogg_qual=1
1423 verbose export del_src=true
1424 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1426 release-buildpk3-transform-lowdds)
1429 # texture: convert to jpeg and dds
1430 # music: reduce bitrate
1431 verbose export do_jpeg=false
1432 verbose export do_jpeg_if_not_dds=true
1433 verbose export jpeg_qual_rgb=80
1434 verbose export jpeg_qual_a=95
1435 verbose export do_dds=true
1436 verbose export dds_flags=
1437 verbose export do_ogg=true
1438 verbose export ogg_qual=1
1439 verbose export del_src=true
1440 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1453 verbose rm -rf Xonotic/temp
1454 verbose mkdir -p Xonotic/temp
1457 verbose git archive --format=tar HEAD
1459 verbose cd Xonotic/temp
1462 verbose cd Xonotic/temp
1463 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
1464 verbose cp ../source/progs.dat .
1465 verbose cp ../source/csprogs.dat .
1466 verbose cp ../source/menu.dat .
1467 verbose rm -rf qcsrc
1468 gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
1469 major=$(($gv / 10000))
1470 minor=$(($gv / 100 - $major * 100))
1471 patch=$(($gv - $major * 10000 - $minor * 100))
1472 versionstr="$major.$minor.$patch"
1473 case "$RELEASETYPE" in
1475 versionstr="$versionstr""beta"
1479 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
1480 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
1481 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
1482 " defaultXonotic.cfg
1484 verbose cd gfx/menu/luminos
1485 verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
1486 verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
1487 verbose rm background_l2.svg
1490 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
1491 for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
1492 if [ -f "$X" ]; then
1494 verbose rm -f maps/*.log maps/*.irc maps/*.lin
1498 verbose export git_src_repo="$d0/$src" # skip hash-object
1499 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
1500 verbose mkzip "../../$dst" *
1502 verbose rm -rf Xonotic/temp
1505 stamp=`cat Xonotic/stamp.txt`
1511 dst="data/xonotic-$stamp-${dst#data/xonotic-}"
1517 while [ "$#" -gt 1 ]; do
1518 verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
1524 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
1525 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1526 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '' raw '-raw' low '-low' lowdds '-lowdds'
1527 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
1528 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir low ''
1530 release-pack-needsx11)
1533 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
1536 verbose "$SELF" release-pack
1541 stamp=`cat Xonotic/stamp.txt`
1542 # exe and dll files do not need +x, so this makes them eligible for 7zip compression too
1543 chmod a-x Xonotic/*.exe Xonotic/*.dll || true
1544 # let's pass crypto import laws of some nasty countries
1545 crypto_libs=`find Xonotic -name \*d0_rijndael\*`
1546 if [ -n "$crypto_libs" ]; then
1547 verbose mkzip Xonotic-$stamp-crypto.zip \
1551 # build the archives
1552 verbose mkzip Xonotic-$stamp-engine.zip \
1554 Xonotic/bin64/*.dll \
1557 Xonotic/xonotic.exe \
1558 Xonotic/source/darkplaces/
1559 verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
1560 verbose mkzip Xonotic-$stamp-common.zip \
1561 Xonotic/source/fteqcc/ \
1562 Xonotic/source/qcsrc/ \
1567 Xonotic/key_0.d0pk \
1568 Xonotic/data/font-nimbussansl-$stamp.pk3
1569 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
1570 verbose mkzip0 Xonotic-$stamp.zip \
1571 Xonotic/data/xonotic-$stamp-data.pk3 \
1572 Xonotic/data/xonotic-$stamp-maps.pk3 \
1573 Xonotic/data/xonotic-$stamp-music.pk3 \
1574 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1575 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
1576 verbose mkzip0 Xonotic-$stamp-low.zip \
1577 Xonotic/data/xonotic-$stamp-data-low.pk3 \
1578 Xonotic/data/xonotic-$stamp-maps-low.pk3 \
1579 Xonotic/data/xonotic-$stamp-music-low.pk3
1580 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
1581 verbose mkzip0 Xonotic-$stamp-lowdds.zip \
1582 Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
1583 Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
1584 Xonotic/data/xonotic-$stamp-music-low.pk3
1585 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
1586 verbose mkzip0 Xonotic-$stamp-high.zip \
1587 Xonotic/data/xonotic-$stamp-data-raw.pk3 \
1588 Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
1589 Xonotic/data/xonotic-$stamp-music.pk3 \
1590 Xonotic/data/xonotic-$stamp-nexcompat.pk3
1593 verbose "$SELF" release-prepare
1594 verbose "$SELF" release-maps
1595 verbose "$SELF" release-engine
1596 verbose "$SELF" release-qc
1597 verbose "$SELF" release-pack-needsx11
1598 verbose "$SELF" release-zip
1603 echo " $SELF admin-merge [<branch>]"
1604 echo " $SELF branch <branch>"
1605 echo " $SELF branch <remote> <branch> [<srcbranch>]"
1606 echo " $SELF branches"
1607 echo " $SELF checkout|switch <branch>"
1608 echo " $SELF checkout|switch <remote>/<branch>"
1609 echo " $SELF clean [-m] [-f | -fu | -fU] [-r] [-D]"
1610 echo " $SELF clean --reclone"
1611 echo " $SELF compile [-c]"
1612 echo " $SELF each|foreach [-k] command..."
1613 echo " $SELF fix_upstream_rebase"
1615 echo " $SELF push|commit [-s]"
1616 echo " $SELF release"
1617 echo " $SELF restore-patches"
1618 echo " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
1619 echo " $SELF save-patches"
1620 echo " $SELF update-maps"
1621 echo " $SELF update|pull [-N]"