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 darkplaces | | div0-stable
117 fteqcc | git://github.com/Blub/qclib.git | master
118 div0-gittools | git://git.icculus.org/divverent/div0-gittools.git | master
119 netradiant | | master
121 # todo: in darkplaces, change repobranch to div0-stable
123 repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
125 base=`git config remote.origin.url`
126 base=${base%xonotic.git}
130 t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
134 if [ x"$1" = x"." ]; then
135 echo "$base""xonotic.git"
137 echo "$base${1##*/}.git"
144 t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
152 repos=`for d in $repos; do
154 if [ x"$p" = x"$d" ] || [ -d "$d" ] || ! [ -f "$p" ]; then
159 if [ "$#" = 0 ]; then
169 branch=`repobranch "$d"`
170 if [ -d "$d0/$d" ]; then
171 enter "$d0/$d" verbose
172 verbose git config remote.origin.url "$url"
173 verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
174 # TODO remove this line later
176 verbose git config core.autocrlf false
177 verbose git config core.safecrlf false # we don't NEED that...
179 r=`git symbolic-ref HEAD`
181 if git config branch.$r.remote >/dev/null 2>&1; then
182 if ! verbose git pull; then
183 check_mergeconflict "$d"
184 echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
190 checkself "$cmd" "$@"
192 verbose git remote prune origin
195 verbose git clone "$url" "$d0/$d"
196 enter "$d0/$d" verbose
197 verbose git checkout "$branch"
205 if [ -z "$branch" ]; then
211 enter "$d0/$d" verbose
212 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
214 verbose git checkout "$branch"
215 elif git rev-parse "refs/remotes/$remote/$branch" >/dev/null 2>&1; then
217 verbose git checkout --track -b "$branch" "$remote/$branch"
219 verbose git checkout "`repobranch "$d"`"
222 checkself "$cmd" "$@"
226 echo "The requested branch was not found in any repository."
234 if [ -z "$branch" ]; then
238 if [ -z "$branch" ]; then
241 r=`git symbolic-ref HEAD`
248 dv=`visible_repo_name "$d"`
249 enter "$d0/$d" verbose
251 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
252 echo "Already having this branch in $dv."
254 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
255 echo "Branch in $dv?"
258 if [ x"$a" = x"y" ]; then
259 if [ -n "$srcbranch" ]; then
262 b="`repobranch "$d"`"
264 # TODO do this without pushing
265 verbose git push "$remote" "$b":"$branch"
266 verbose git checkout --track -b "$branch" "$remote/$branch"
278 git branch -a -v -v | cut -c 3- | while read -r BRANCH REV UPSTREAM TEXT; do
281 UPSTREAM=${UPSTREAM#\[}
282 UPSTREAM=${UPSTREAM%\]}
283 UPSTREAM=${UPSTREAM%:*}
286 TEXT="$UPSTREAM $TEXT"
290 if [ x"$REV" = x"->" ]; then
293 BRANCH=${BRANCH#remotes/}
295 if [ -n "$UPSTREAM" ]; then
296 echo -n " (tracking $UPSTREAM)"
305 cd "$d0/$d" # am in a pipe, shouldn't use enter
306 git branch -a -v -v | cut -c 3- | sed "s,^,$d ,"
311 while read -r d BRANCH REV UPSTREAM TEXT; do
314 UPSTREAM=${UPSTREAM#\[}
315 UPSTREAM=${UPSTREAM%\]}
316 UPSTREAM=${UPSTREAM%:*}
319 TEXT="$UPSTREAM $TEXT"
323 if [ x"$REV" = x"->" ]; then
326 BRANCH=${BRANCH#remotes/}
327 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
328 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
329 eval "r=\$branches_repos_$ID"
331 eval "branches_repos_$ID=\$r"
333 echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
334 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
335 eval "r=\$branches_repos_$ID"
342 dv=`visible_repo_name "$d"`
343 enter "$d0/$d" verbose
344 r=`git symbolic-ref HEAD`
346 if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
347 # we have uncommitted changes
349 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
350 echo "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"
353 if [ x"$a" = x"y" ]; then
354 if ! verbose git merge origin/"`repobranch "$d"`"; then
355 check_mergeconflict "$d"
356 exit 1 # this should ALWAYS be fatal
366 dv=`visible_repo_name "$d"`
367 enter "$d0/$d" verbose
368 r=`git symbolic-ref HEAD`
370 if git diff HEAD | grep .; then
371 # we have uncommitted changes
373 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
374 echo "Uncommitted changes in \"$r\" in $dv. Commit?"
377 if [ x"$a" = x"y" ]; then
378 verbose git commit -a
381 rem=`git config "branch.$r.remote" || echo origin`
382 if { git log "$rem/$r".."$r" || git log origin/"`repobranch "$d"`".."$r"; } | grep .; then
384 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
385 echo "Push \"$r\" in $dv?"
388 if [ x"$a" = x"y" ]; then
389 verbose git push "$rem" HEAD
392 if [ x"$submit" = x"-s" ]; then
395 verbose git push "$rem" HEAD:"${r%%/*}/finished/${r#*/}"
403 if [ -n "$WE_HATE_OUR_USERS" ]; then
404 TARGETS="sv-debug cl-debug"
406 TARGETS="sv-debug cl-debug sdl-debug"
431 if [ -z "$MAKEFLAGS" ]; then
432 if [ -f /proc/cpuinfo ]; then
433 ncpus=$((`grep -c '^processor :' /proc/cpuinfo`+0))
434 if [ $ncpus -gt 1 ]; then
440 MAKEFLAGS="$MAKEFLAGS DP_LINK_TO_LIBJPEG=1"
444 enter "$d0/fteqcc" verbose
446 verbose make $MAKEFLAGS clean
448 verbose make $MAKEFLAGS
449 enter "$d0/data/xonotic-data.pk3dir" verbose
451 verbose make $MAKEFLAGS clean
453 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
454 enter "$d0/darkplaces" verbose
456 verbose make $MAKEFLAGS clean
458 for T in $TARGETS; do
459 verbose make $MAKEFLAGS "$@" "$T"
463 if [ -n "$WE_HATE_OUR_USERS" ]; then
465 export PATH="$d0/misc/buildfiles/w32:$PATH"
466 elif [ x"`uname`" = x"Darwin" ]; then
467 export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Nexuiz.app/Contents/MacOS"
473 sdl|glx|agl|dedicated)
482 if ! [ -x "darkplaces/darkplaces$client" ]; then
483 if [ -x "darkplaces/darkplaces$client.exe" ]; then
486 echo "Client darkplaces/darkplaces$client not found, aborting"
490 set -- "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic "$@"
491 if [ -n "$USE_GDB" ]; then
492 set -- gdb --args "$@"
498 enter "$d0/$d" verbose
505 patchdir=`mktemp -d -t save-patches.XXXXXX`
507 enter "$d0/$d" verbose
508 git branch -v -v | cut -c 3- | {
510 while read -r BRANCH REV UPSTREAM TEXT; do
513 UPSTREAM=${UPSTREAM#\[}
514 UPSTREAM=${UPSTREAM%\]}
515 UPSTREAM=${UPSTREAM%:*}
519 UPSTREAM=origin/"`repobranch "$d"`"
523 if [ x"$REV" = x"->" ]; then
526 if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
527 echo "$d" > "$patchdir/$i/info.txt"
528 echo "$BRANCH" >> "$patchdir/$i/info.txt"
529 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
530 echo "$TRACK" >> "$patchdir/$i/info.txt"
533 rm -rf "$patchdir/$i"
538 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
543 patchdir=`mktemp -d -t restore-patches.XXXXXX`
544 ( cd "$patchdir" && tar xvzf - ) < "$infile"
546 for P in "$patchdir"/*/info.txt; do
553 verbose git checkout HEAD^0
554 verbose git branch -D "$BRANCH"
555 if [ x"$TRACK" = x"true" ]; then
556 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
558 verbose git branch -b "$BRANCH" "$UPSTREAM"
566 enter "$d0/$d" verbose
567 git rev-parse "$1/$2" || continue
570 git log HEAD.."$1/$2"
571 git diff HEAD..."$1/$2"
574 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
575 echo "Merge \"$1/$2\" into `git symbolic-ref HEAD` of $d?"
578 if [ x"$a" = x"y" ]; then
582 if ! "$SELF" compile; then
586 while [ x"$a" != x"y" -a x"$a" != x"n" ]; do
587 echo "Still merge \"$1/$2\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."
590 if [ x"$a" = x"y" ]; then
594 git reset --hard HEAD@{1}
603 echo " $SELF push [-s]"
604 echo " $SELF branches"
605 echo " $SELF branch [<remote>] <branchname>"
606 echo " $SELF branch <remote> <branchname> <srcbranchname>"
607 echo " $SELF checkout [<remote>] <branchname>"
608 echo " $SELF compile [-c] [<client>] <options>"
609 echo " $SELF run [<client>] <options>"
610 echo " $SELF each <command>"