7 while ! [ -f ./all ]; do
8 if [ x"`pwd`" = x"/" ]; then
9 echo "Cannot find myself."
10 echo "Please run this script with the working directory inside a Xonotic checkout."
18 # If we are on WINDOWS:
23 # Windows hates users. So this script has to copy itself elsewhere first...
25 cp "$SELF" ../all.xonotic.sh
26 export WE_HATE_OUR_USERS=1
27 exec ../all.xonotic.sh "$@"
40 if [ -x /usr/bin/md5sum ]; then
42 elif [ -x /bin/md5sum ]; then
44 elif [ -x /usr/bin/cksum ]; then
51 self=`checksum "$SELF"`
54 self_new=`checksum "$SELF"`
55 if [ x"$self" != x"$self_new" ]; then
56 msg "./all has changed."
57 if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
58 msg "Rerunning the requested operation to make sure."
59 export XONOTIC_FORBID_RERUN_ALL=1
62 msg "Please try $SELF update, and then retry your requested operation."
79 echo "the root directory"
89 if git ls-files -u | grep ' 1 '; then
91 echo "MERGE CONFLICT."
92 echo "change into the \"$1\" project directory, and then:"
93 echo "- edit the files mentioned above with your favorite editor,"
94 echo " and fix the conflicts (marked with <<<<<<< blocks)"
95 echo "- for binary files, you can select the files using"
96 echo " git checkout --ours or git checkout --theirs"
97 echo "- when done with a file, 'git add' the file"
98 echo "- when done, 'git commit'"
107 check_mergeconflict "$1"
112 data/xonotic-data.pk3dir | | master
113 data/xonotic-maps.pk3dir | | master
114 data/xonotic-music.pk3dir | | master
115 data/xonotic-nexcompat.pk3dir | | master
116 mediasource | | master
117 darkplaces | | div0-stable
118 fteqcc | git://github.com/Blub/qclib.git | master
119 div0-gittools | git://git.icculus.org/divverent/div0-gittools.git | master
120 netradiant | | master
122 # todo: in darkplaces, change repobranch to div0-stable
124 repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
126 base=`git config remote.origin.url`
127 base=${base%xonotic.git}
131 t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
142 if [ x"$1" = x"." ]; then
143 echo "$base""xonotic.git"
145 echo "$base${1##*/}.git"
152 t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
160 repos=`for d in $repos; do
162 if [ x"$p" = x"$d" ] || [ -d "$d" ] || ! [ -f "$p" ]; then
167 if [ "$#" = 0 ]; then
177 branch=`repobranch "$d"`
178 if [ -d "$d0/$d" ]; then
179 enter "$d0/$d" verbose
180 verbose git config remote.origin.url "$url"
181 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
182 # TODO remove this line later
184 verbose git config core.autocrlf false
185 verbose git config core.safecrlf false # we don't NEED that...
187 r=`git symbolic-ref HEAD`
189 if git config branch.$r.remote >/dev/null 2>&1; then
190 if ! verbose git pull; then
191 check_mergeconflict "$d"
192 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
198 checkself "$cmd" "$@"
200 verbose git remote prune origin
203 verbose git clone "$url" "$d0/$d"
204 enter "$d0/$d" verbose
205 verbose git checkout "$branch"
213 if [ -z "$branch" ]; then
219 enter "$d0/$d" verbose
220 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
222 verbose git checkout "$branch"
223 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
225 verbose git checkout --track -b "$branch" "$remote/$branch"
227 verbose git checkout "`repobranch "$d"`"
230 checkself "$cmd" "$@"
234 echo "The requested branch was not found in any repository."
242 if [ -z "$branch" ]; then
246 if [ -z "$branch" ]; then
249 r=`git symbolic-ref HEAD`
256 dv=`visible_repo_name "$d"`
257 enter "$d0/$d" verbose
259 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
260 echo "Already having this branch in $dv."
262 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
263 echo "Branch in $dv?"
266 if [ x"$a" = x"y" ]; then
267 if [ -n "$srcbranch" ]; then
270 b="`repobranch "$d"`"
272 # TODO do this without pushing
273 verbose git push "$remote" "$b":"$branch"
274 verbose git checkout --track -b "$branch" "$remote/$branch"
286 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
289 UPSTREAM=${UPSTREAM#\[}
290 UPSTREAM=${UPSTREAM%\]}
291 UPSTREAM=${UPSTREAM%:*}
294 TEXT="$UPSTREAM $TEXT"
298 if [ x"$REV" = x"->" ]; then
301 BRANCH=${BRANCH#remotes/}
303 if [ -n "$UPSTREAM" ]; then
304 echo -n " (tracking $UPSTREAM)"
313 cd "$d0/$d" # am in a pipe, shouldn't use enter
314 git branch -a -v -v | cut -c 3- | sed "s,^,$d ,"
319 while read -r d BRANCH REV UPSTREAM TEXT; do
322 UPSTREAM=${UPSTREAM#\[}
323 UPSTREAM=${UPSTREAM%\]}
324 UPSTREAM=${UPSTREAM%:*}
327 TEXT="$UPSTREAM $TEXT"
331 if [ x"$REV" = x"->" ]; then
334 BRANCH=${BRANCH#remotes/}
335 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
336 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
337 eval "r=\$branches_repos_$ID"
339 eval "branches_repos_$ID=\$r"
341 echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
342 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
343 eval "r=\$branches_repos_$ID"
350 dv=`visible_repo_name "$d"`
351 enter "$d0/$d" verbose
352 r=`git symbolic-ref HEAD`
354 if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
355 # we have uncommitted changes
357 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
358 echo "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"
361 if [ x"$a" = x"y" ]; then
362 if ! verbose git merge origin/"`repobranch "$d"`"; then
363 check_mergeconflict "$d"
364 exit 1 # this should ALWAYS be fatal
374 dv=`visible_repo_name "$d"`
375 enter "$d0/$d" verbose
376 r=`git symbolic-ref HEAD`
378 if git diff HEAD | grep .; then
379 # we have uncommitted changes
381 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
382 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
385 if [ x"$a" = x"y" ]; then
386 verbose git commit -a
389 rem=`git config "branch.$r.remote" || echo origin`
390 if { git log "$rem/$r".."$r" || git log origin/"`repobranch "$d"`".."$r"; } | grep .; then
392 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
393 echo "Push \"$r\" in $dv?"
396 if [ x"$a" = x"y" ]; then
397 verbose git push "$rem" HEAD
400 if [ x"$submit" = x"-s" ]; then
403 verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
411 if [ -n "$WE_HATE_OUR_USERS" ]; then
412 TARGETS="sv-debug cl-debug"
414 TARGETS="sv-debug cl-debug sdl-debug"
439 if [ -z "$MAKEFLAGS" ]; then
440 if [ -f /proc/cpuinfo ]; then
441 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
442 if [ $ncpus -gt 1 ]; then
448 MAKEFLAGS="$MAKEFLAGS DP_LINK_TO_LIBJPEG=1"
451 if [ -n "$WE_HATE_OUR_USERS" ]; then
452 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
455 enter "$d0/fteqcc" verbose
457 verbose make $MAKEFLAGS clean
459 verbose make $MAKEFLAGS
460 enter "$d0/data/xonotic-data.pk3dir" verbose
462 verbose make $MAKEFLAGS clean
464 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
465 enter "$d0/darkplaces" verbose
467 verbose make $MAKEFLAGS clean
469 for T in $TARGETS; do
470 verbose make $MAKEFLAGS "$@" "$T"
474 if [ -n "$WE_HATE_OUR_USERS" ]; then
476 export PATH="$d0/misc/buildfiles/w32:$PATH"
477 elif [ x"`uname`" = x"Darwin" ]; then
478 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Nexuiz.app/Contents/MacOS"
484 sdl|glx|agl|dedicated)
493 if ! [ -x "darkplaces/darkplaces$client" ]; then
494 if [ -x "darkplaces/darkplaces$client.exe" ]; then
497 echo "Client darkplaces/darkplaces$client not found, aborting"
501 set -- "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
502 if [ -n "$USE_GDB" ]; then
503 set -- gdb --args "$@"
509 enter "$d0/$d" verbose
516 patchdir=`mktemp -d -t save-patches.XXXXXX`
518 enter "$d0/$d" verbose
519 git branch -v -v | cut -c 3- | {
521 while read -r BRANCH REV UPSTREAM TEXT; do
524 UPSTREAM=${UPSTREAM#\[}
525 UPSTREAM=${UPSTREAM%\]}
526 UPSTREAM=${UPSTREAM%:*}
530 UPSTREAM=origin/"`repobranch "$d"`"
534 if [ x"$REV" = x"->" ]; then
537 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
538 echo "$d" > "$patchdir/$i/info.txt"
539 echo "$BRANCH" >> "$patchdir/$i/info.txt"
540 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
541 echo "$TRACK" >> "$patchdir/$i/info.txt"
544 rm -rf "$patchdir/$i"
549 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
554 patchdir=`mktemp -d -t restore-patches.XXXXXX`
555 ( cd "$patchdir" && tar xvzf - ) < "$infile"
557 for P in "$patchdir"/*/info.txt; do
564 verbose git checkout HEAD^0
565 verbose git branch -D "$BRANCH"
566 if [ x"$TRACK" = x"true" ]; then
567 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
569 verbose git branch -b "$BRANCH" "$UPSTREAM"
576 if [ "$#" = 1 ]; then
577 set -- "${1%%/*}" "${1#*/}"
580 enter "$d0/$d" verbose
581 git rev-parse "$1/$2" || continue
584 git log HEAD.."$1/$2"
585 git diff HEAD..."$1/$2"
588 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
589 echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
592 if [ x"$a" = x"y" ]; then
596 if ! "$SELF" compile; then
600 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
601 echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
604 if [ x"$a" = x"y" ]; then
608 git reset --hard HEAD@{1}
617 echo " $SELF push [-s]"
618 echo " $SELF branches"
619 echo " $SELF branch [<remote>] <branchname>"
620 echo " $SELF branch <remote> <branchname> <srcbranchname>"
621 echo " $SELF checkout [<remote>] <branchname>"
622 echo " $SELF compile [-c] [<client>] <options>"
623 echo " $SELF run [<client>] <options>"
624 echo " $SELF each <command>"