remove win64 DLLs from PATH, as this does not work
[xonotic/xonotic.git] / all
1 #!/bin/sh
2 # vim: filetype=zsh
3
4 set -e
5
6 # I use this in EVERY shell script ;)
7 LF="
8 "
9
10 d00=`pwd`
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."
15                 exit 1
16         fi
17         cd ..
18 done
19 export d0=`pwd`
20 SELF="$d0/all"
21
22 # If we are on WINDOWS:
23 case "$0" in
24         all|*/all)
25                 case "`uname`" in
26                         MINGW*|Win*)
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 "$@"
31                                 ;;
32                 esac
33                 ;;
34 esac
35
36 msg()
37 {
38         echo >&2 "\e[1m$*\e[m"
39 }
40
41 self=`git hash-object "$SELF"`
42 checkself()
43 {
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
50                         exec "$SELF" "$@"
51                 else
52                         msg "Please try $SELF update, and then retry your requested operation."
53                         exit 1
54                 fi
55         fi
56         return 0
57 }
58
59 verbose()
60 {
61         msg "+ $*"
62         "$@"
63 }
64
65 visible_repo_name()
66 {
67         case "$1" in
68                 .)
69                         echo "the root directory"
70                         ;;
71                 *)
72                         echo "\"$1\""
73                         ;;
74         esac
75 }
76
77 check_mergeconflict()
78 {
79         if git ls-files -u | grep ' 1   '; then
80                 echo
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'"
89                 echo
90                 exit 1
91         fi
92 }
93
94 yesno()
95 {
96         yesno=
97         while [ x"$yesno" != x"y" -a x"$yesno" != x"n" ]; do
98                 eval "$2"
99                 echo "$1"
100                 IFS= read -r yesno
101         done
102         [ x"$yesno" = x"y" ]
103 }
104
105 enter()
106 {
107         $2 cd "$1" || exit 1
108         check_mergeconflict "$1"
109 }
110
111 repos_urls="
112 .                             |                                                   | master      |
113 data/xonotic-data.pk3dir      |                                                   | master      |
114 data/xonotic-maps.pk3dir      |                                                   | master      |
115 data/xonotic-music.pk3dir     |                                                   | master      |
116 data/xonotic-nexcompat.pk3dir |                                                   | master      |
117 mediasource                   |                                                   | master      |
118 darkplaces                    |                                                   | div0-stable | svn
119 fteqcc                        | git://github.com/Blub/qclib.git                   | master      |
120 div0-gittools                 |                                                   | master      |
121 netradiant                    |                                                   | master      |
122 "
123 # todo: in darkplaces, change repobranch to div0-stable
124
125 repos=`echo "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
126
127 base=`git config remote.origin.url`
128 case "$base" in
129         */xonotic.git)
130                 base=${base%xonotic.git}
131                 ;;
132         *)
133                 echo "The main repo is not xonotic.git, what have you done?"
134                 exit 1
135                 ;;
136 esac
137
138 repourl()
139 {
140         repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
141         if [ -n "$repo_t" ]; then
142                 case "$repo_t" in
143                         *://*)
144                                 echo "$repo_t"
145                                 ;;
146                         *)
147                                 echo "$base$repo_t"
148                                 ;;
149                 esac
150         else
151                 if [ x"$1" = x"." ]; then
152                         echo "$base""xonotic.git"
153                 else
154                         echo "$base${1##*/}.git"
155                 fi
156         fi
157 }
158
159 repobranch()
160 {
161         repo_t=`echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
162         if [ -n "$repo_t" ]; then
163                 echo "$repo_t"
164         else
165                 echo "master"
166         fi
167 }
168
169 repoflags()
170 {
171         echo "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
172 }
173
174 repos=`for d in $repos; do
175         p="${d%dir}"
176         if [ x"$p" = x"$d" ] || [ -d "$d" ] || ! { [ -f "$d.no" ] || [ -f "$p" ]; }; then
177                 echo "$d"
178         fi
179 done`
180
181 if [ "$#" = 0 ]; then
182         set -- help
183 fi
184 cmd=$1
185 shift
186
187 fix_upstream_rebase()
188 {
189         if [ -z "$r_me" ] || [ -z "$r_other" ]; then
190                 return
191         fi
192         r_base=`git merge-base "$r_me" "$r_other"`
193
194         # no merge-base? upstream did filter-branch
195         if [ -n "$r_base" ]; then
196                 # otherwise, check if the two histories are "similar"
197                 r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
198                 r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
199
200                 # heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
201                 r_lc_me=`echo "$r_l_me" | wc -l`
202                 r_lc_other=`echo "$r_l_other" | wc -l`
203                 r_lc_together=`{ echo "$r_l_me"; echo "$r_l_other"; } | sort -u | wc -l`
204                 r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
205
206                 if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
207                         if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
208                                 git reset --hard "$r_me"
209                                 git pull --rebase
210                                 return 1
211                         fi
212                 fi
213         fi
214
215         return 0
216 }
217
218 fix_upstream_rebase_mergeok()
219 {
220         r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
221         r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
222         fix_upstream_rebase
223 }
224
225 fix_upstream_rebase_mergefail()
226 {
227         r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
228         r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
229         fix_upstream_rebase
230 }
231
232 case "$cmd" in
233         fix_upstream_rebase)
234                 for d in $repos; do
235                         enter "$d0/$d" verbose
236                         verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
237                 done
238                 ;;
239         update|pull)
240                 allow_pull=true
241                 if [ x"$1" = x"-N" ]; then
242                         allow_pull=false
243                 fi
244                 for d in $repos; do
245                         url=`repourl "$d"`
246                         branch=`repobranch "$d"`
247                         if [ -d "$d0/$d" ]; then
248                                 if $allow_pull; then
249                                         enter "$d0/$d" verbose
250                                         verbose git config remote.origin.url "$url"
251                                         verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
252
253                                         verbose git config core.autocrlf input
254
255                                         r=`git symbolic-ref HEAD`
256                                         r=${r#refs/heads/}
257                                         if git config branch.$r.remote >/dev/null 2>&1; then
258                                                 if ! verbose git pull; then
259                                                         fix_upstream_rebase_mergefail || true
260                                                         check_mergeconflict "$d"
261                                                         echo "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
262                                                         read -r DUMMY
263                                                 else
264                                                         fix_upstream_rebase_mergeok || true
265                                                 fi
266                                         fi
267
268                                         cd "$d00"
269                                         checkself "$cmd" "$@"
270                                         cd "$d0/$d"
271                                         verbose git remote prune origin
272                                         cd "$d0"
273                                 fi
274                         else
275                                 verbose git clone "$url" "$d0/$d"
276                                 enter "$d0/$d" verbose
277                                 if [ "$branch" != "master" ]; then
278                                         verbose git checkout --track -b "$branch" origin/"$branch"
279                                 fi
280                                 cd "$d0"
281                         fi
282                 done
283                 ;;
284         update-maps)
285                 misc/tools/xonotic-map-compiler-autobuild download
286                 ;;
287         checkout|switch)
288                 checkoutflags=
289                 if [ x"$1" = x"-f" ]; then
290                         checkoutflags=-f
291                         shift
292                 fi
293                 remote=$1
294                 branch=$2
295                 if [ -z "$branch" ]; then
296                         case "$remote" in
297                                 origin/*)
298                                         branch=${remote#origin/}
299                                         remote=origin
300                                         ;;
301                                 *)
302                                         branch=$remote
303                                         remote=origin
304                                         ;;
305                         esac
306                 fi
307                 exists=false
308                 for d in $repos; do
309                         enter "$d0/$d" verbose
310                         b=$branch
311                         if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
312                                 exists=true
313                                 verbose git checkout $checkoutflags "$b"
314                         elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
315                                 exists=true
316                                 verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
317                         else
318                                 b=`repobranch "$d"`
319                                 if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
320                                         exists=true
321                                         verbose git checkout $checkoutflags "$b"
322                                 elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
323                                         exists=true
324                                         verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
325                                 else
326                                         echo "WTF? Not even branch $b doesn't exist in $d"
327                                         exit 1
328                                 fi
329                         fi
330                         cd "$d00"
331                         checkself "$cmd" "$@"
332                         cd "$d0"
333                 done
334                 if ! $exists; then
335                         echo "The requested branch was not found in any repository."
336                 fi
337                 exec "$SELF" branch
338                 ;;
339         branch)
340                 remote=$1
341                 branch=$2
342                 srcbranch=$3
343                 if [ -z "$branch" ]; then
344                         branch=$remote
345                         remote=origin
346                 fi
347                 if [ -z "$branch" ]; then
348                         for d in $repos; do
349                                 enter "$d0/$d"
350                                 r=`git symbolic-ref HEAD`
351                                 r=${r#refs/heads/}
352                                 echo "$d is at $r"
353                                 cd "$d0"
354                         done
355                 else
356                         for d in $repos; do
357                                 dv=`visible_repo_name "$d"`
358                                 enter "$d0/$d" verbose
359                                 if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
360                                         echo "Already having this branch in $dv."
361                                 else
362                                         if yesno "Branch in $dv?"; then
363                                                 if [ -n "$srcbranch" ]; then
364                                                         b=$srcbranch
365                                                 else
366                                                         b=origin/"`repobranch "$d"`"
367                                                         verbose git fetch origin || true
368                                                 fi
369                                                 # TODO do this without pushing
370                                                 verbose git checkout -b "$branch" "$b"
371                                                 verbose git config "branch.$branch.remote" "$remote"
372                                                 verbose git config "branch.$branch.merge" "refs/heads/$branch"
373                                         fi
374                                 fi
375                                 cd "$d0"
376                         done
377                         "$SELF" branch
378                 fi
379                 ;;
380         branches)
381                 for d in $repos; do
382                         cd "$d0/$d" # am in a pipe, shouldn't use enter
383                         git branch -a -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
384                         cd "$d0"
385                 done | {
386                         branches_list=
387                         # branches_repos_*=
388                         while read -r d BRANCH REV UPSTREAM TEXT; do
389                                 if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
390                                         continue
391                                 fi
392                                 case "$UPSTREAM" in
393                                         \[*)
394                                                 UPSTREAM=${UPSTREAM#\[}
395                                                 UPSTREAM=${UPSTREAM%\]}
396                                                 UPSTREAM=${UPSTREAM%:*}
397                                                 ;;
398                                         *)
399                                                 TEXT="$UPSTREAM $TEXT"
400                                                 UPSTREAM=
401                                                 ;;
402                                 esac
403                                 if [ x"$REV" = x"->" ]; then
404                                         continue
405                                 fi
406                                 BRANCH=${BRANCH#remotes/}
407                                 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
408                                 branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
409                                 eval "r=\$branches_repos_$ID"
410                                 case "$UPSTREAM" in
411                                         '')
412                                                 r="$r $d"
413                                                 ;;
414                                         *)
415                                                 r="$r $d:$UPSTREAM"
416                                                 ;;
417                                 esac
418                                 eval "branches_repos_$ID=\$r"
419                         done
420                         echo -n "$branches_list" | xargs -n 1 echo | sort -u | while IFS= read -r BRANCH; do
421                                 ID=`echo "$BRANCH" | tr -c "A-Za-z0-9." "_"`
422                                 eval "r=\$branches_repos_$ID"
423                                 printf "%-60s %s\n" "$BRANCH" "$r"
424                                 #echo "$BRANCH: $r"
425                         done
426                 }
427                 ;;
428         merge)
429                 for d in $repos; do
430                         dv=`visible_repo_name "$d"`
431                         enter "$d0/$d" verbose
432                         r=`git symbolic-ref HEAD`
433                         r=${r#refs/heads/}
434                         if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
435                                 # we have uncommitted changes
436                                 if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
437                                         if ! verbose git merge origin/"`repobranch "$d"`"; then
438                                                 check_mergeconflict "$d"
439                                                 exit 1 # this should ALWAYS be fatal
440                                         fi
441                                 fi
442                         fi
443                         cd "$d0"
444                 done
445                 ;;
446         push|commit)
447                 submit=$1
448                 for d in $repos; do
449                         dv=`visible_repo_name "$d"`
450                         enter "$d0/$d" verbose
451                         r=`git symbolic-ref HEAD`
452                         r=${r#refs/heads/}
453                         diffdata=`git diff --color HEAD`
454                         if [ -n "$diffdata" ]; then
455                                 # we have uncommitted changes
456                                 if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" 'echo "$diffdata" | less -r'; then
457                                         verbose git commit -a
458                                 fi
459                         fi
460                         rem=`git config "branch.$r.remote" || echo origin`
461                         bra=`git config "branch.$r.merge" || echo "$r"`
462                         upstream="$rem/${bra#refs/heads/}"
463                         if ! git rev-parse "$upstream" >/dev/null 2>&1; then
464                                 upstream="origin/`repobranch "$d"`"
465                         fi
466                         logdata=`git log --color "$upstream".."$r"`
467                         if [ -n "$logdata" ]; then
468                                 if yesno "Push \"$r\" in $dv?" 'echo "$logdata" | less -r'; then
469                                         verbose git push "$rem" HEAD
470                                 fi
471                         fi
472                         if [ x"$submit" = x"-s" ]; then
473                                 case "$r" in
474                                         */*)
475                                                 verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
476                                                 ;;
477                                 esac
478                         fi
479                         cd "$d0"
480                 done
481                 ;;
482         compile)
483                 if [ -n "$WE_HATE_OUR_USERS" ]; then
484                         TARGETS="sv-debug cl-debug"
485                         if [ -z "$CC" ]; then
486                                 export CC=gcc
487                         fi
488                 elif [ x"`uname`" = x"Darwin" ]; then
489                         case "`uname -r`" in
490                                 ?.*)
491                                         TARGETS="sv-debug cl-debug sdl-debug"
492                                         ;;
493                                 *)
494                                         # AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
495                                         TARGETS="sv-debug sdl-debug"
496                                         ;;
497                         esac
498                         export CC="gcc -I$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks/SDL.framework/Headers -F$PWD/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
499                 else
500                         TARGETS="sv-debug cl-debug sdl-debug"
501                 fi
502                 case "$1" in
503                         -c)
504                                 cleandp=true
505                                 cleanqcc=true
506                                 cleanqc=true
507                                 shift
508                                 ;;
509                         -n)
510                                 cleandp=false
511                                 cleanqcc=false
512                                 cleanqc=false
513                                 shift
514                                 ;;
515                         *)
516                                 cleandp=false
517                                 cleanqcc=false
518                                 cleanqc=true # version info
519                                 ;;
520                 esac
521                 if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
522                         # if we give the command make the arg "", it will surely fail (invalid filename),
523                         # so better handle it as an empty client option
524                         BAD_TARGETS=" "
525                         shift
526                 elif [ -n "$1" ]; then
527                         BAD_TARGETS=
528                         TARGETS_SAVE=$TARGETS
529                         TARGETS=
530                         for X in $1; do
531                                 case "$X" in
532                                         sdl)
533                                                 TARGETS="$TARGETS sdl-debug"
534                                                 ;;
535                                         glx|agl|wgl)
536                                                 TARGETS="$TARGETS cl-debug"
537                                                 ;;
538                                         dedicated)
539                                                 TARGETS="$TARGETS sv-debug"
540                                                 ;;
541                                         *)
542                                                 BAD_TARGETS="$BAD_TARGETS $X"
543                                                 ;;
544                                 esac
545                         done
546                         if [ -n "$TARGETS" ]; then # at least a valid client
547                                 shift
548                         else # no valid client, let's assume this option is not meant to be a client then
549                                 TARGETS=$TARGETS_SAVE
550                                 BAD_TARGETS=
551                         fi
552                 fi
553                 if [ -z "$MAKEFLAGS" ]; then
554                         if [ -f /proc/cpuinfo ]; then
555                                 ncpus=$((`grep -c '^processor   :' /proc/cpuinfo`+0))
556                                 if [ $ncpus -gt 1 ]; then
557                                         MAKEFLAGS=-j$ncpus
558                                 fi
559                         fi
560                         case "`uname`" in
561                                 Linux|*BSD)
562                                         MAKEFLAGS="$MAKEFLAGS DP_LINK_TO_LIBJPEG=1"
563                                         ;;
564                         esac
565                         if [ -n "$WE_HATE_OUR_USERS" ]; then
566                                 MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw"
567                         fi
568                 fi
569
570                 enter "$d0/fteqcc" verbose
571                 if $cleanqcc; then
572                         verbose make $MAKEFLAGS clean
573                 fi
574                 verbose make $MAKEFLAGS
575
576                 enter "$d0/data/xonotic-data.pk3dir" verbose
577                 if $cleanqc; then
578                         verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
579                 fi
580                 verbose make FTEQCC="$d0/fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
581
582                 enter "$d0/darkplaces" verbose
583                 if [ x"$BAD_TARGETS" = x" " ]; then
584                         echo "Warning: invalid empty client, default clients will be used."
585                 fi
586                 if $cleandp; then
587                         verbose make $MAKEFLAGS clean
588                 fi
589                 for T in $TARGETS; do
590                         verbose make $MAKEFLAGS "$@" "$T"
591                 done
592                 for T in $BAD_TARGETS; do
593                         echo "Warning: discarded invalid client $T."
594                 done
595
596                 verbose "$SELF" update-maps
597                 ;;
598         run)
599                 if [ -n "$WE_HATE_OUR_USERS" ]; then
600                         client=
601                         export PATH="$d0/misc/buildfiles/win32:$PATH"
602                 elif [ x"`uname`" = x"Darwin" ]; then
603                         export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS"
604                         export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
605                         client=-sdl
606                 else
607                         client=-sdl
608                 fi
609                 case "$1" in
610                         sdl|glx|agl|dedicated)
611                                 client=-$1
612                                 shift
613                                 ;;
614                         wgl)
615                                 client=
616                                 shift
617                                 ;;
618                 esac
619                 if ! [ -x "darkplaces/darkplaces$client" ]; then
620                         if [ -x "darkplaces/darkplaces$client.exe" ]; then
621                                 client=$client.exe
622                         else
623                                 echo "Client darkplaces/darkplaces$client not found, aborting"
624                                 exit 1
625                         fi
626                 fi
627                 set -- "darkplaces/darkplaces$client" -nexuiz -customgamename Xonotic -customgamedirname1 data -customgamedirname2 "" -customgamescreenshotname xonotic -customgameuserdirname xonotic -mygames "$@"
628
629                 # if pulseaudio is running: USE IT
630                 if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
631                         if ps -C pulseaudio >/dev/null; then
632                                 if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
633                                         export SDL_AUDIODRIVER=pulse
634                                 fi
635                         fi
636                 fi
637
638                 if [ -n "$USE_GDB" ]; then
639                         set -- gdb --args "$@"
640                 fi
641                 "$@"
642                 ;;
643         each|foreach)
644                 keep_going=false
645                 if [ x"$1" = x"-k" ]; then
646                         keep_going=true
647                         shift
648                 fi
649                 for d in $repos; do
650                         if verbose cd "$d0/$d"; then
651                                 if $keep_going; then
652                                         verbose "$@" || true
653                                 else
654                                         verbose "$@"
655                                 fi
656                                 cd "$d0"
657                         fi
658                 done
659                 ;;
660         save-patches)
661                 outfile=$1
662                 patchdir=`mktemp -d -t save-patches.XXXXXX`
663                 for d in $repos; do
664                         enter "$d0/$d" verbose
665                         git branch -v -v | cut -c 3- | {
666                                 i=0
667                                 while read -r BRANCH REV UPSTREAM TEXT; do
668                                         case "$UPSTREAM" in
669                                                 \[*)
670                                                         UPSTREAM=${UPSTREAM#\[}
671                                                         UPSTREAM=${UPSTREAM%\]}
672                                                         UPSTREAM=${UPSTREAM%:*}
673                                                         TRACK=true
674                                                         ;;
675                                                 *)
676                                                         UPSTREAM=origin/"`repobranch "$d"`"
677                                                         TRACK=false
678                                                         ;;
679                                         esac
680                                         if [ x"$REV" = x"->" ]; then
681                                                 continue
682                                         fi
683                                         if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
684                                                 echo "$d" > "$patchdir/$i/info.txt"
685                                                 echo "$BRANCH" >> "$patchdir/$i/info.txt"
686                                                 echo "$UPSTREAM" >> "$patchdir/$i/info.txt"
687                                                 echo "$TRACK" >> "$patchdir/$i/info.txt"
688                                                 i=$(($i+1))
689                                         else
690                                                 rm -rf "$patchdir/$i"
691                                         fi
692                                 done
693                         }
694                 done
695                 ( cd "$patchdir" && tar cvzf - . ) > "$outfile"
696                 rm -rf "$patchdir"
697                 ;;
698         restore-patches)
699                 infile=$1
700                 patchdir=`mktemp -d -t restore-patches.XXXXXX`
701                 ( cd "$patchdir" && tar xvzf - ) < "$infile"
702                 # detach the head
703                 for P in "$patchdir"/*/info.txt; do
704                         D=${P%/info.txt}
705                         exec 3<"$P"
706                         read -r d <&3
707                         read -r BRANCH <&3
708                         read -r UPSTREAM <&3
709                         read -r TRACK <&3
710                         verbose git checkout HEAD^0
711                         verbose git branch -D "$BRANCH"
712                         if [ x"$TRACK" = x"true" ]; then
713                                 verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
714                         else
715                                 verbose git branch -b "$BRANCH" "$UPSTREAM"
716                         fi
717                         verbose git am "$D"
718                 done
719                 rm -rf "$patchdir"
720                 ;;
721         admin-merge)
722                 branch=$1
723                 t=`mktemp`
724                 report=""
725                 reportecho()
726                 {
727                         report=$report"$*$LF"
728                         echo "$*"
729                 }
730                 reportecho4()
731                 {
732                         report=$report"    $*$LF"
733                         echo "    $*"
734                 }
735                 reportdo4()
736                 {
737                         o=`"$@" | sed 's/^/    /' || true`
738                         reportecho "$o"
739                 }
740                 for d in $repos; do
741                         enter "$d0/$d" verbose
742                         base="`repobranch "$d"`"
743                         reportecho "In $d:"
744                         for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
745                                 case "${ref#refs/remotes/origin/}" in
746                                         "$base")
747                                                 continue
748                                                 ;;
749                                         HEAD|master)
750                                                 continue
751                                                 ;;
752                                         */*)
753                                                 ;;
754                                         *)
755                                                 continue
756                                                 ;;
757                                 esac
758                                 if [ -n "$branch" ]; then
759                                         if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
760                                                 continue
761                                         fi
762                                 fi
763                                 case "$base" in
764                                         master)
765                                                 realbase=$base
766                                                 ;;
767                                         *)
768                                                 l0=`git rev-list "$base".."$ref" | wc -l`
769                                                 l1=`git rev-list master.."$ref" | wc -l`
770                                                 if [ $l0 -gt $l1 ]; then
771                                                         realbase=master
772                                                 else
773                                                         realbase=$base
774                                                 fi
775                                                 ;;
776                                 esac
777                                 reportecho "  Branch $ref:"
778                                 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
779                                 logdata=`git log --color "$realbase".."$ref"`
780                                 if [ -z "$logdata" ]; then
781                                         reportecho4 "--> not merging, no changes vs master"
782                                         if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
783                                                 git push origin :"${ref#refs/remotes/origin/}"
784                                                 reportecho4 "--> branch deleted"
785                                         fi
786                                 else
787                                         diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
788                                         if [ -z "$diffdata" ]; then
789                                                 reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
790                                                 if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ echo "$logdata"; } | less -r'; then
791                                                         git push origin :"${ref#refs/remotes/origin/}"
792                                                         reportecho4 "--> branch deleted"
793                                                 fi
794                                         elif [ -z "$branch" ] && [ -n "$note" ]; then
795                                                 reportdo4 echo "$note"
796                                                 reportecho4 "--> not merging, already had this one rejected before"
797                                         elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ echo "$logdata"; echo "$diffdata"; } | less -r'; then
798                                                 git checkout "$realbase"
799                                                 org=`git rev-parse HEAD`
800                                                 if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1   ' >/dev/null; }; then
801                                                         git reset --hard "$org"
802                                                         GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
803                                                         reportdo4 cat "$t"
804                                                         reportecho4 "--> merge failed"
805                                                 elif ! "$SELF" compile -n 2>&1 | tee "$t"; then
806                                                         git reset --hard "$org"
807                                                         GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
808                                                         reportdo4 cat "$t"
809                                                         reportecho4 "--> compile failed"
810                                                 elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
811                                                         git reset --hard "$org"
812                                                         GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
813                                                         note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
814                                                         if [ x"$note" = x"del" ]; then
815                                                                 git push origin :"${ref#refs/remotes/origin/}"
816                                                                 reportecho4 "--> test failed, branch deleted"
817                                                         elif [ -n "$note" ]; then
818                                                                 reportdo4 echo "$note"
819                                                                 reportecho4 "--> test failed"
820                                                         else
821                                                                 reportecho4 "--> test failed, postponed"
822                                                         fi
823                                                 else
824                                                         echo "MERGING"
825                                                         case ",`repoflags "$d"`," in
826                                                                 *,svn,*)
827                                                                         # we do quite a mess here... luckily we know $org
828                                                                         git fetch # svn needs to be current
829                                                                         git rebase -i --onto origin/master "$org"
830                                                                         git svn dcommit --add-author-from
831                                                                         git reset --hard "$org"
832                                                                         ;;
833                                                                 *)
834                                                                         git push origin HEAD
835                                                                         ;;
836                                                         esac
837                                                         reportecho4 "--> MERGED"
838                                                         if yesno "Delete original branch \"$ref\"?"; then
839                                                                 git push origin :"${ref#refs/remotes/origin/}"
840                                                                 reportecho4 "--> branch deleted"
841                                                         fi
842                                                 fi
843                                         else
844                                                 GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
845                                                 note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
846                                                 if [ x"$note" = x"del" ]; then
847                                                         git push origin :"${ref#refs/remotes/origin/}"
848                                                         reportecho4 "--> branch deleted"
849                                                 elif [ -n "$note" ]; then
850                                                         reportdo4 echo "$note"
851                                                         reportecho4 "--> rejected"
852                                                 else
853                                                         reportecho4 "--> postponed"
854                                                 fi
855                                         fi
856                                 fi
857                                 reportecho ""
858                         done
859                         reportecho ""
860                 done
861                 rm -f "$t"
862                 echo "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
863                 ;;
864         clean)
865                 force=false
866                 if [ x"$1" = x"-f" ]; then
867                         force=true
868                 fi
869                 for d in $repos; do
870                         enter "$d0/$d" verbose
871                         if $force; then
872                                 verbose git checkout-index -fa
873                         fi
874                         case "$d" in
875                                 .)
876                                         verbose git clean -df
877                                         ;;
878                                 *)
879                                         verbose git clean -xdf
880                                         ;;
881                         esac
882                 done
883                 ;;
884
885         # release building goes here
886         release-prepare)
887                 #"$SELF" each git clean -fxd
888                 case "$RELEASETYPE" in
889                         beta)
890                                 msg "Building a BETA"
891                                 ;;
892                         release)
893                                 msg "Building a RELEASE"
894                                 ;;
895                         *)
896                                 msg "Must either set RELEASETYPE=beta or RELEASETYPE=release"
897                                 exit 1
898                                 ;;
899                 esac
900                 verbose rm -rf Xonotic Xonotic*.zip
901                 verbose mkdir -p Xonotic
902                 verbose date +%Y%m%d > Xonotic/stamp.txt
903                 verbose git archive --format=tar HEAD -- Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles | {
904                         verbose cd Xonotic
905                         verbose mkdir data fteqcc source source/darkplaces source/fteqcc
906                         verbose tar xvf -
907                         verbose rm -rf misc/builddeps
908                         verbose mv misc/buildfiles/win32/* . || true
909                         verbose mv misc/buildfiles/win64 bin64 || true
910                         verbose mv misc/buildfiles/osx/* . || true
911                         verbose rm -rf misc/buildfiles
912                 }
913                 {
914                         verbose cd darkplaces
915                         verbose git archive --format=tar HEAD
916                 } | {
917                         verbose cd Xonotic/source/darkplaces
918                         verbose tar xvf -
919                 }
920                 {
921                         verbose cd fteqcc
922                         verbose git archive --format=tar HEAD
923                 } | {
924                         verbose cd Xonotic/source/fteqcc
925                         verbose tar xvf -
926                 }
927                 {
928                         verbose cd data/xonotic-data.pk3dir
929                         verbose git archive --format=tar HEAD -- qcsrc Makefile
930                 } | {
931                         verbose cd Xonotic/source
932                         verbose tar xvf -
933                 }
934                 ;;
935         release-compile-run)
936                 host=$1
937                 buildpath=$2
938                 maketargets=$3
939                 makeflags=$4
940                 srcdir=$5
941                 targetfiles=$6
942                 case " $HOSTS_THAT_ARE_MYSELF " in
943                         *\ $host\ *)
944                                 verbose rsync --delete -zvaSHP "$srcdir"/ "$buildpath/"
945                                 verbose eval make -C "$buildpath" clean $maketargets $makeflags
946                                 for f in $targetfiles; do
947                                         verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
948                                 done
949                                 ;;
950                         *)
951                                 verbose rsync --delete -zvaSHP "$srcdir"/ "$host:$buildpath/"
952                                 verbose ssh "$host" ". ~/.profile && cd $buildpath && make clean $maketargets $makeflags"
953                                 for f in $targetfiles; do
954                                         verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
955                                 done
956                                 ;;
957                 esac
958                 # now rebrand the binaries...
959                 for f in $targetfiles; do
960                         verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "$d0/misc/tools/xonotic.brand" "${f##*:}" || true
961                 done
962                 ;;
963         release-compile)
964                 suffix=$1
965                 makeflags=$2
966                 fteqcc_maketargets=$3
967                 fteqcc_files=$4
968                 darkplaces_maketargets=$5
969                 darkplaces_files=$6
970                 verbose "$SELF" release-compile-run "xonotic-build-$suffix" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$fteqcc_files"
971                 verbose "$SELF" release-compile-run "xonotic-build-$suffix" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$darkplaces_files"
972                 ;;
973         release-engine-win32)
974                 verbose "$SELF" release-compile win32 \
975                         'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -DSUPPORTDIRECTX -DUSE_WSPIAPI_H -I$HOME/dp.win32/include -L$HOME/dp.win32/lib" WINDRES="i586-mingw32msvc-windres" SDL_CONFIG="$HOME/dp.win32/bin/sdl-config"' \
976                         win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
977                         release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
978                 ;;
979         release-engine-win64)
980                 verbose "$SELF" release-compile win64 \
981                         'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g -Wl,--dynamicbase -Wl,--nxcompat -DSUPPORTDIRECTX -I$HOME/dp.win64/include -L$HOME/dp.win64/lib" WINDRES="amd64-mingw32msvc-windres" SDL_CONFIG="$HOME/dp.win64/bin/sdl-config" LDFLAGS_WINCOMMON=""' \
982                         win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
983                         'sv-release cl-release' 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated-x64.exe'
984                         # release 'darkplaces.exe:Xonotic/xonotic-x64.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl-x64.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated-x64.exe'
985                 ;;
986         release-engine-osx)
987                 # gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
988                 verbose "$SELF" release-compile osx \
989                         'STRIP=: CC="gcc -g -arch i386 -arch ppc -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -I$HOME/dp.osx/include -L$HOME/dp.osx/lib -fno-reorder-blocks"' \
990                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
991                         'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic-SDL.app/Contents/MacOS/xonotic-osx-sdl-bin' 'darkplaces-dedicated:xonotic-osx-dedicated'
992                 ;;
993         release-engine-linux32)
994                 verbose "$SELF" release-compile linux32 \
995                         'STRIP=: CC="gcc -m32 -g -Wl,--hash-style=sysv -I$HOME/dp.linux32/include -L$HOME/dp.linux32/lib" DP_MODPLUG_STATIC_LIBDIR=$HOME/dp.linux32/lib DP_LINK_TO_LIBJPEG=1' \
996                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
997                         release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
998                 ;;
999         release-engine-linux64)
1000                 verbose "$SELF" release-compile linux64 \
1001                         'STRIP=: CC="gcc -m64 -g -Wl,--hash-style=sysv -I$HOME/dp.linux64/include -L$HOME/dp.linux64/lib" DP_MODPLUG_STATIC_LIBDIR=$HOME/dp.linux64/lib DP_LINK_TO_LIBJPEG=1' \
1002                         all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
1003                         release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
1004                 ;;
1005         release-engine)
1006                 verbose "$SELF" release-engine-win64
1007                 verbose "$SELF" release-engine-osx
1008                 verbose "$SELF" release-engine-win32
1009                 verbose "$SELF" release-engine-linux32
1010                 verbose "$SELF" release-engine-linux64
1011                 ;;
1012         release-maps)
1013                 verbose "$SELF" update-maps
1014                 ;;
1015         release-qc)
1016                 case "$RELEASETYPE" in
1017                         beta)
1018                                 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
1019                                 ;;
1020                         release)
1021                                 verbose make -C Xonotic/source FTEQCC="$d0/Xonotic/fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 FTEQCCFLAGS_WATERMARK= clean all
1022                                 ;;
1023                 esac
1024                 verbose rm -f Xonotic/source/*/fteqcc.log
1025                 ;;
1026         release-buildpk3-transform-raw)
1027                 dir=$1
1028                 ;;
1029         release-buildpk3-transform-normal)
1030                 dir=$1
1031                 verbose cd "$dir"
1032                 # texture: convert to jpeg and dds
1033                 verbose export do_jpeg=true
1034                 verbose export jpeg_qual_rgb=95
1035                 verbose export jpeg_qual_a=99
1036                 verbose export do_dds=true
1037                 verbose export dds_flags=
1038                 verbose export do_ogg=false
1039                 verbose export del_src=true
1040                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1041                 ;;
1042         release-buildpk3-transform-low)
1043                 dir=$1
1044                 verbose cd "$dir"
1045                 # texture: convert to jpeg and dds
1046                 # music: reduce bitrate
1047                 verbose export do_jpeg=true
1048                 verbose export jpeg_qual_rgb=80
1049                 verbose export jpeg_qual_a=95
1050                 verbose export do_dds=false
1051                 verbose export do_ogg=true
1052                 verbose export ogg_qual=1
1053                 verbose export del_src=true
1054                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1055                 ;;
1056         release-buildpk3-transform-lowdds)
1057                 dir=$1
1058                 verbose cd "$dir"
1059                 # texture: convert to jpeg and dds
1060                 # music: reduce bitrate
1061                 verbose export do_jpeg=false
1062                 verbose export do_jpeg_if_not_dds=true
1063                 verbose export jpeg_qual_rgb=80
1064                 verbose export jpeg_qual_a=95
1065                 verbose export do_dds=true
1066                 verbose export dds_flags=
1067                 verbose export do_ogg=true
1068                 verbose export ogg_qual=1
1069                 verbose export del_src=true
1070                 find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
1071                 ;;
1072         release-buildpk3)
1073                 src=$1
1074                 dst=$2
1075                 transform=$3
1076                 case "$dst" in
1077                         /*)
1078                                 ;;
1079                         */)
1080                                 dst="$PWD/$dst"
1081                                 ;;
1082                 esac
1083                 verbose rm -rf Xonotic/temp
1084                 verbose mkdir -p Xonotic/temp
1085                 {
1086                         verbose cd "$src"
1087                         verbose git archive --format=tar HEAD
1088                 } | {
1089                         verbose cd Xonotic/temp
1090                         verbose tar xvf -
1091                 }
1092                 verbose cd Xonotic/temp
1093                 if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
1094                         verbose cp ../source/progs.dat .
1095                         verbose cp ../source/csprogs.dat .
1096                         verbose cp ../source/menu.dat .
1097                         verbose rm -rf qcsrc
1098                         gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
1099                         major=$(($gv / 10000))
1100                         minor=$(($gv / 100 - $major * 100))
1101                         patch=$(($gv - $major * 10000 - $minor * 100))
1102                         verbose sed -i "
1103                                 s/^set g_xonoticversion [^ ]* /set g_xonoticversion $major.$minor.$patch /;
1104                                 s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
1105                                 s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
1106                         " defaultXonotic.cfg
1107                 fi
1108                 if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
1109                         for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
1110                                 if [ -f "$X" ]; then
1111                                         verbose unzip "$X"
1112                                 fi
1113                         done
1114                 fi
1115                 verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
1116                 verbose zip -9yr "../../$dst" .
1117                 verbose cd ../..
1118                 verbose rm -rf Xonotic/temp
1119                 ;;
1120         release-buildpk3s)
1121                 stamp=`cat Xonotic/stamp.txt`
1122                 src=$1
1123                 shift
1124                 dst=${src%.pk3dir}
1125                 case "$dst" in
1126                         data/xonotic-*)
1127                                 dst="data/xonotic-$stamp-${dst#data/xonotic-}"
1128                                 ;;
1129                         *)
1130                                 dst="$dst-$stamp"
1131                                 ;;
1132                 esac
1133                 while [ "$#" -gt 1 ]; do
1134                         verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
1135                         shift
1136                         shift
1137                 done
1138                 ;;
1139         release-pack)
1140                 verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir             raw ''
1141                 verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir       normal '' raw '-raw' low '-low' lowdds '-lowdds'
1142                 verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir       normal '' raw '-raw' low '-low' lowdds '-lowdds'
1143                 verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir                raw ''     low '-low'
1144                 verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir                       low ''
1145                 ;;
1146         release-pack-needsx11)
1147                 case "$DISPLAY" in
1148                         '')
1149                                 verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
1150                                 ;;
1151                         *)
1152                                 verbose "$SELF" release-pack
1153                                 ;;
1154                 esac
1155                 ;;
1156         release-zip)
1157                 stamp=`cat Xonotic/stamp.txt`
1158                 verbose zip -9yr Xonotic-$stamp-common.zip \
1159                         Xonotic/*.dll \
1160                         Xonotic/source/*/ \
1161                         Xonotic/Docs \
1162                         Xonotic/misc \
1163                         Xonotic/fteqcc \
1164                         Xonotic/server \
1165                         Xonotic/*.app \
1166                         Xonotic/xonotic-* \
1167                         Xonotic/xonotic.exe \
1168                         Xonotic/data/font-nimbussansl-$stamp.pk3
1169                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
1170                 verbose zip -0yr Xonotic-$stamp.zip \
1171                         Xonotic/data/xonotic-$stamp-data.pk3 \
1172                         Xonotic/data/xonotic-$stamp-maps.pk3 \
1173                         Xonotic/data/xonotic-$stamp-music.pk3 \
1174                         Xonotic/data/xonotic-$stamp-nexcompat.pk3
1175                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
1176                 verbose zip -0yr Xonotic-$stamp-low.zip \
1177                         Xonotic/data/xonotic-$stamp-data-low.pk3 \
1178                         Xonotic/data/xonotic-$stamp-maps-low.pk3 \
1179                         Xonotic/data/xonotic-$stamp-music-low.pk3
1180                 verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-lowdds.zip
1181                 verbose zip -0yr Xonotic-$stamp-lowdds.zip \
1182                         Xonotic/data/xonotic-$stamp-data-lowdds.pk3 \
1183                         Xonotic/data/xonotic-$stamp-maps-lowdds.pk3 \
1184                         Xonotic/data/xonotic-$stamp-music-low.pk3
1185                 verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
1186                 verbose zip -0yr Xonotic-$stamp-high.zip \
1187                         Xonotic/data/xonotic-$stamp-data-raw.pk3 \
1188                         Xonotic/data/xonotic-$stamp-maps-raw.pk3 \
1189                         Xonotic/data/xonotic-$stamp-music.pk3 \
1190                         Xonotic/data/xonotic-$stamp-nexcompat.pk3
1191                 ;;
1192         release)
1193                 verbose "$SELF" release-prepare
1194                 verbose "$SELF" release-maps
1195                 verbose "$SELF" release-engine
1196                 verbose "$SELF" release-qc
1197                 verbose "$SELF" release-pack-needsx11
1198                 verbose "$SELF" release-zip
1199                 ;;
1200
1201         *)
1202                 echo "Usage:"
1203                 echo "  $SELF pull"
1204                 echo "  $SELF merge"
1205                 echo "  $SELF push [-s]"
1206                 echo "  $SELF branches"
1207                 echo "  $SELF branch [<remote>] <branchname>"
1208                 echo "  $SELF branch <remote> <branchname> <srcbranchname>"
1209                 echo "  $SELF checkout [<remote>] <branchname>"
1210                 echo "  $SELF compile [-c|-n] [<client>] <options>"
1211                 echo "  $SELF run [<client>] <options>"
1212                 echo "  $SELF each <command>"
1213                 ;;
1214 esac