2010-03-18 15:46:07 +00:00
#!/bin/sh
2010-04-16 17:41:05 +00:00
# vim: filetype=zsh
2010-03-18 15:46:07 +00:00
set -e
2010-11-08 20:16:50 +00:00
if [ -n "$ZSH_VERSION" ]; then
setopt SH_WORD_SPLIT
fi
2010-11-12 14:42:48 +00:00
if [ -z "$ECHO" ]; then
if echo "\\\\" | grep .. >/dev/null; then
ECHO=echo
else
ECHO=`which echo`
fi
fi
2010-03-18 15:46:07 +00:00
2010-05-15 20:53:45 +00:00
# I use this in EVERY shell script ;)
LF="
"
2010-10-15 10:49:37 +00:00
ESC=" "
2010-05-15 20:53:45 +00:00
2010-04-02 18:34:05 +00:00
d00=`pwd`
while ! [ -f ./all ]; do
if [ x"`pwd`" = x"/" ]; then
2010-11-12 14:42:48 +00:00
$ECHO "Cannot find myself."
$ECHO "Please run this script with the working directory inside a Xonotic checkout."
2010-04-02 18:34:05 +00:00
exit 1
fi
cd ..
done
2010-08-05 04:11:40 +00:00
export d0=`pwd`
2010-04-02 18:34:05 +00:00
SELF="$d0/all"
# If we are on WINDOWS:
case "$0" in
all|*/all)
case "`uname`" in
2010-04-11 10:23:32 +00:00
MINGW*|Win*)
2010-04-02 18:34:05 +00:00
# Windows hates users. So this script has to copy itself elsewhere first...
2010-04-02 18:35:19 +00:00
cp "$SELF" ../all.xonotic.sh
2010-04-25 18:21:54 +00:00
export WE_HATE_OUR_USERS=1
2010-04-02 18:34:05 +00:00
exec ../all.xonotic.sh "$@"
;;
esac
;;
esac
2010-03-29 13:21:24 +00:00
msg()
{
2010-11-12 14:42:48 +00:00
$ECHO >&2 "$ESC""[1m$*$ESC""[m"
2010-03-29 13:21:24 +00:00
}
2010-06-22 15:05:06 +00:00
self=`git hash-object "$SELF"`
2010-03-29 13:21:24 +00:00
checkself()
{
2010-06-22 15:05:06 +00:00
self_new=`git hash-object "$SELF"`
2010-03-29 13:21:24 +00:00
if [ x"$self" != x"$self_new" ]; then
msg "./all has changed."
if [ -z "$XONOTIC_FORBID_RERUN_ALL" ]; then
msg "Rerunning the requested operation to make sure."
export XONOTIC_FORBID_RERUN_ALL=1
2010-04-02 18:34:05 +00:00
exec "$SELF" "$@"
2010-03-29 13:21:24 +00:00
else
2010-04-02 18:34:05 +00:00
msg "Please try $SELF update, and then retry your requested operation."
2010-03-29 13:21:24 +00:00
exit 1
fi
fi
2010-03-29 13:24:49 +00:00
return 0
2010-03-29 13:21:24 +00:00
}
2010-03-29 13:17:50 +00:00
2010-03-26 08:18:04 +00:00
verbose()
{
2010-03-29 13:21:24 +00:00
msg "+ $*"
2010-03-26 08:18:04 +00:00
"$@"
}
2010-04-02 19:25:08 +00:00
visible_repo_name()
{
case "$1" in
.)
2010-11-12 14:42:48 +00:00
$ECHO "the root directory"
2010-04-02 19:25:08 +00:00
;;
*)
2010-11-12 14:42:48 +00:00
$ECHO "\"$1\""
2010-04-02 19:25:08 +00:00
;;
esac
}
2010-04-02 19:11:17 +00:00
check_mergeconflict()
{
if git ls-files -u | grep ' 1 '; then
2010-11-12 14:42:48 +00:00
$ECHO
$ECHO "MERGE CONFLICT."
$ECHO "change into the \"$1\" project directory, and then:"
$ECHO "- edit the files mentioned above with your favorite editor,"
$ECHO " and fix the conflicts (marked with <<<<<<< blocks)"
$ECHO "- for binary files, you can select the files using"
$ECHO " git checkout --ours or git checkout --theirs"
$ECHO "- when done with a file, 'git add' the file"
$ECHO "- when done, 'git commit'"
$ECHO
2010-04-02 19:11:17 +00:00
exit 1
fi
}
2010-05-09 17:40:25 +00:00
yesno()
{
yesno=
while [ x"$yesno" != x"y" -a x"$yesno" != x"n" ]; do
2010-05-15 18:11:23 +00:00
eval "$2"
2010-11-12 14:42:48 +00:00
$ECHO "$1"
2011-03-09 17:47:38 +00:00
if ! IFS= read -r yesno; then
yesno=n
break
fi
2010-05-09 17:40:25 +00:00
done
[ x"$yesno" = x"y" ]
}
2010-04-02 19:11:17 +00:00
enter()
{
2010-07-18 15:18:15 +00:00
$2 cd "$1" || exit 1
2010-04-02 19:11:17 +00:00
check_mergeconflict "$1"
}
2010-03-26 07:59:06 +00:00
repos_urls="
2010-10-31 16:41:42 +00:00
. | | master |
data/xonotic-data.pk3dir | | master |
data/xonotic-music.pk3dir | | master |
data/xonotic-nexcompat.pk3dir | | master | no
darkplaces | | div0-stable | svn
netradiant | | master |
div0-gittools | | master | no
d0_blind_id | | master |
data/xonotic-maps.pk3dir | | master |
mediasource | | master | no
2010-11-01 15:51:18 +00:00
fteqcc | | xonotic-stable | noautocrlf
2010-03-18 15:46:07 +00:00
"
2010-05-02 11:06:36 +00:00
# todo: in darkplaces, change repobranch to div0-stable
2010-03-18 15:46:07 +00:00
2010-11-12 14:42:48 +00:00
repos=`$ECHO "$repos_urls" | grep . | cut -d '|' -f 1 | tr -d ' '`
2010-05-02 11:06:36 +00:00
base=`git config remote.origin.url`
2010-05-10 06:39:45 +00:00
case "$base" in
*/xonotic.git)
base=${base%xonotic.git}
;;
*)
2010-11-12 14:42:48 +00:00
$ECHO "The main repo is not xonotic.git, what have you done?"
2010-05-10 06:39:45 +00:00
exit 1
;;
esac
2010-10-04 10:13:01 +00:00
pushbase=`git config remote.origin.pushurl || true`
case "$pushbase" in
*/xonotic.git)
pushbase=${pushbase%xonotic.git}
;;
'')
;;
*)
2010-11-12 14:42:48 +00:00
$ECHO "The main repo is not xonotic.git, what have you done?"
2010-10-04 10:13:01 +00:00
exit 1
;;
esac
2010-05-02 11:06:36 +00:00
repourl()
{
2010-11-12 14:42:48 +00:00
repo_t=`$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
2010-07-04 19:37:09 +00:00
if [ -n "$repo_t" ]; then
case "$repo_t" in
2010-05-08 16:45:50 +00:00
*://*)
2010-11-12 14:42:48 +00:00
$ECHO "$repo_t"
2010-05-08 16:45:50 +00:00
;;
*)
2010-11-12 14:42:48 +00:00
$ECHO "$base$repo_t"
2010-05-08 16:45:50 +00:00
;;
esac
2010-05-02 11:06:36 +00:00
else
if [ x"$1" = x"." ]; then
2010-11-12 14:42:48 +00:00
$ECHO "$base""xonotic.git"
2010-05-02 11:06:36 +00:00
else
2010-11-12 14:42:48 +00:00
$ECHO "$base${1##*/}.git"
2010-04-26 12:10:54 +00:00
fi
2010-05-02 11:06:36 +00:00
fi
}
2010-04-26 12:10:54 +00:00
2010-10-04 10:13:01 +00:00
repopushurl()
{
[ -n "$pushbase" ] || return 0
2010-11-12 14:42:48 +00:00
repo_t=`$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 2 | tr -d ' '`
2010-10-04 10:13:01 +00:00
if [ -n "$repo_t" ]; then
case "$repo_t" in
*://*)
;;
*)
2010-11-12 14:42:48 +00:00
$ECHO "$pushbase$repo_t"
2010-10-04 10:13:01 +00:00
;;
esac
else
if [ x"$1" = x"." ]; then
2010-11-12 14:42:48 +00:00
$ECHO "$pushbase""xonotic.git"
2010-10-04 10:13:01 +00:00
else
2010-11-12 14:42:48 +00:00
$ECHO "$pushbase${1##*/}.git"
2010-10-04 10:13:01 +00:00
fi
fi
}
2010-05-02 11:06:36 +00:00
repobranch()
{
2010-11-12 14:42:48 +00:00
repo_t=`$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 3 | tr -d ' '`
2010-07-04 19:37:09 +00:00
if [ -n "$repo_t" ]; then
2010-11-12 14:42:48 +00:00
$ECHO "$repo_t"
2010-05-02 11:06:36 +00:00
else
2010-11-12 14:42:48 +00:00
$ECHO "master"
2010-05-02 11:06:36 +00:00
fi
}
2010-05-15 20:24:38 +00:00
repoflags()
{
2010-11-12 14:42:48 +00:00
$ECHO "$repos_urls" | grep "^$1 " | cut -d '|' -f 4 | tr -d ' '
2010-05-15 20:24:38 +00:00
}
2010-08-25 04:59:52 +00:00
listrepos()
{
for d in $repos; do
p="${d%dir}"
f="`repoflags "$d"`"
# if we have the dir, always keep it
if [ -d "$d" ]; then
msg "Repository $d enabled because it already exists"
2010-11-12 14:42:48 +00:00
$ECHO "$d"
2010-08-25 04:59:52 +00:00
continue
fi
# if .yes file exists, always keep it
if [ -f "$d.yes" ]; then
msg "Repository $d enabled by a .yes file"
2010-11-12 14:42:48 +00:00
$ECHO "$d"
2010-08-25 04:59:52 +00:00
continue
fi
# if we have .no file, skip
if [ -f "$d.no" ]; then
2011-03-09 17:06:08 +00:00
msg "Repository $d disabled by a .no file, delete $d.no to enable"
2010-08-25 04:59:52 +00:00
continue
fi
# if we have matching pk3, skip
if [ x"$p" != x"$d" ] && [ -f "$p" ]; then
msg "Repository $d disabled by matching .pk3 file, delete $p or create $d.yes to enable"
continue
fi
# if "no" flag is set, skip
case ",$f," in
*,no,*)
msg "Repository $d disabled by default, create $d.yes to enable"
continue
;;
esac
2010-08-25 05:56:00 +00:00
# default: enable
msg "Repository $d enabled by default"
2010-11-12 14:42:48 +00:00
$ECHO "$d"
2010-08-25 04:59:52 +00:00
done
}
repos=`listrepos`
2010-03-26 07:59:06 +00:00
2010-03-18 15:57:21 +00:00
if [ "$#" = 0 ]; then
set -- help
fi
2010-03-18 15:46:07 +00:00
cmd=$1
shift
2011-04-18 16:39:48 +00:00
case "$cmd" in
2011-05-24 11:31:52 +00:00
release|release-*)
2011-04-18 16:39:48 +00:00
export LC_ALL=C
2011-05-24 11:31:52 +00:00
2011-05-24 14:29:06 +00:00
release_args="$cmd $*"
2011-05-24 11:34:58 +00:00
msg "*** $release_args: start"
2011-05-24 11:31:52 +00:00
release_starttime=`date +%s`
release_end()
{
release_endtime=`date +%s`
release_deltatime=$(($release_endtime - $release_starttime))
2011-05-24 11:34:58 +00:00
msg "*** $release_args: $release_deltatime seconds"
2011-05-24 11:31:52 +00:00
}
trap release_end EXIT
2011-05-25 14:15:14 +00:00
release_tempstarttime=$release_starttime
release_timereport()
{
2011-05-25 14:26:58 +00:00
release_endtime=`date +%s` # RELEASE NOW!!!
2011-05-25 14:15:14 +00:00
if [ -n "$*" ]; then
2011-05-25 14:26:58 +00:00
release_deltatime=$(($release_endtime - $release_tempstarttime))
2011-05-25 14:15:14 +00:00
msg "**** $release_args: $*: $release_deltatime seconds"
fi
2011-05-25 14:26:58 +00:00
release_tempstarttime=$release_endtime
2011-05-25 14:15:14 +00:00
}
2011-05-27 07:39:09 +00:00
release_git_extract_dir()
{
release_src=$1; shift
release_dst=$1; shift
2011-05-27 07:51:52 +00:00
# try to create a hardlink
if ln -f "$release_src/.git/HEAD" "$release_dst/.hardlink-test"; then
rm -f "$release_dst/.hardlink-test"
{
verbose cd "$release_src"
git ls-files HEAD -- "$@"
} | {
while IFS= read -r F; do
2011-05-27 08:27:24 +00:00
case "$F" in */*) mkdir -p "$release_dst/${F%/*}" ;; esac
2011-05-27 07:51:52 +00:00
verbose ln -f "$release_src/$F" "$release_dst/$F"
done
}
else
{
verbose cd "$release_src"
verbose git archive --format=tar HEAD -- "$@"
} | {
verbose cd "$release_dst"
verbose tar xvf -
}
fi
2011-05-27 07:39:09 +00:00
}
2011-04-18 16:39:48 +00:00
;;
esac
2010-08-04 10:26:57 +00:00
fix_upstream_rebase()
{
if [ -z "$r_me" ] || [ -z "$r_other" ]; then
return
fi
2010-11-21 14:59:58 +00:00
# one of the two sides of the merge should be remote upstream, or all is fine
r_r=`git symbolic-ref HEAD`
2010-11-21 15:16:19 +00:00
r_r=${r_r#refs/heads/}
2010-11-21 14:59:58 +00:00
r_rem=`git config "branch.$r_rem.remote" || $ECHO origin`
r_bra=`git config "branch.$r_bra.merge" || $ECHO "$r_r"`
2010-11-23 09:24:23 +00:00
r_bra=${r_bra#refs/heads/}
2010-11-21 14:59:58 +00:00
if [ x"$r_me" != x"`git rev-parse "$r_rem/$r_bra"`" ]; then
if [ x"$r_other" != x"`git rev-parse "$r_rem/$r_bra"`" ]; then
return
fi
fi
2010-08-04 10:26:57 +00:00
r_base=`git merge-base "$r_me" "$r_other"`
# no merge-base? upstream did filter-branch
if [ -n "$r_base" ]; then
# otherwise, check if the two histories are "similar"
2010-08-04 10:40:57 +00:00
r_l_me=`git log --pretty="format:%s" "$r_other".."$r_me" | grep -v "^Merge" | sort -u`
r_l_other=`git log --pretty="format:%s" "$r_me".."$r_other" | grep -v "^Merge" | sort -u`
2010-08-04 10:26:57 +00:00
# heuristics: upstream rebase/filter-branch if more than 50% of the commits of one of the sides are in the other too
2010-11-12 14:42:48 +00:00
r_lc_me=`$ECHO "$r_l_me" | wc -l`
r_lc_other=`$ECHO "$r_l_other" | wc -l`
r_lc_together=`{ $ECHO "$r_l_me"; $ECHO "$r_l_other"; } | sort -u | wc -l`
2010-08-04 10:26:57 +00:00
r_lc_same=$(($r_lc_me + $r_lc_other - $r_lc_together))
2010-08-04 10:39:44 +00:00
if [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_me )) ] || [ $(( $r_lc_same * 2 )) -gt $(( $r_lc_other )) ]; then
if yesno "Probable upstream rebase detected, automatically fix?" 'git log --oneline --graph --date-order --left-right "$r_other"..."$r_me"'; then
2010-08-04 10:26:57 +00:00
git reset --hard "$r_me"
git pull --rebase
return 1
fi
fi
fi
return 0
}
fix_upstream_rebase_mergeok()
{
r_me=`git rev-parse --revs-only HEAD^1 2>/dev/null || true`
r_other=`git rev-parse --revs-only HEAD^2 2>/dev/null || true`
fix_upstream_rebase
}
fix_upstream_rebase_mergefail()
{
r_me=`git rev-parse --revs-only HEAD 2>/dev/null || true`
r_other=`git rev-parse --revs-only MERGE_HEAD 2>/dev/null || true`
fix_upstream_rebase
}
2010-08-25 05:02:39 +00:00
fix_git_config()
{
2011-07-27 17:53:34 +00:00
if ! [ -f ".git/config" ]; then
2011-07-27 17:50:16 +00:00
$ECHO "Not a git repository. Bailing out to not cause damage."
exit 1
fi
2010-10-04 13:05:47 +00:00
verbose git config remote.origin.url "$1"
if [ -n "$2" ]; then
verbose git config remote.origin.pushurl "$2"
else
verbose git config --unset remote.origin.pushurl || true
fi
verbose git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
2010-11-01 15:51:18 +00:00
case ",`repoflags "$d"`," in
*,noautocrlf,*)
2010-11-01 18:27:02 +00:00
verbose git config --unset core.autocrlf || true
2010-11-01 15:51:18 +00:00
;;
*)
verbose git config core.autocrlf input
;;
esac
2010-10-21 18:22:10 +00:00
if [ -z "`git config push.default || true`" ]; then
2010-08-25 05:02:39 +00:00
verbose git config push.default current # or is tracking better?
fi
2010-10-23 15:34:37 +00:00
verbose git config filter.mapclean.clean "tr -d '\r' | grep '^[^/]'"
2010-10-21 18:22:35 +00:00
verbose git config filter.mapclean.smudge "cat"
2010-08-25 05:02:39 +00:00
}
2011-05-06 19:59:40 +00:00
mkzipr()
{
archive=$1; shift
2011-05-24 08:50:37 +00:00
case "$RELEASETYPE" in
release)
sevenzipflags=-mx=9
zipflags=-9
;;
*)
sevenzipflags=-mx=1
zipflags=-1
;;
esac
2011-05-09 12:45:14 +00:00
find "$@" -exec touch -d "2001-01-01 01:01:01 +0000" {} \+ # ugly hack to make the pk3 files rsync-friendly
2011-05-06 19:59:40 +00:00
ziplist=`mktemp`
find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
2011-05-24 08:50:37 +00:00
7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
zip $zipflags -y -@<"$ziplist" "$archive" || true
2011-05-06 19:59:40 +00:00
rm -f "$ziplist"
}
2010-09-16 06:41:57 +00:00
mkzip()
{
2011-05-06 19:59:40 +00:00
archive=$1; shift
2011-05-24 08:50:37 +00:00
case "$RELEASETYPE" in
release)
sevenzipflags=-mx=9
zipflags=-9
;;
*)
sevenzipflags=-mx=1
zipflags=-1
;;
esac
2010-09-16 06:41:57 +00:00
ziplist=`mktemp`
2010-09-16 07:04:52 +00:00
find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
2011-05-24 08:50:37 +00:00
7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
zip $zipflags -y -@<"$ziplist" "$archive" || true
2010-09-16 06:41:57 +00:00
rm -f "$ziplist"
}
mkzip0()
{
2011-05-06 19:59:40 +00:00
archive=$1; shift
zip -0ry "$archive" "$@"
2010-09-16 06:41:57 +00:00
}
2010-11-07 18:20:42 +00:00
mirrorspeed()
{
# first result is to be ignored, but we use it to check status
git ls-remote "$1" refs/heads/master >/dev/null 2>&1 || return 1
2010-11-07 18:41:27 +00:00
{ time -p git ls-remote "$1" refs/heads/master; } 2>&1 >/dev/null | head -n 1 | cut -d ' ' -f 2 | tr -d . | sed 's,^0*,,'
2010-11-07 18:20:42 +00:00
# unit: clock ticks (depends on what "time" returns
}
bestmirror()
{
pre=$1; shift
suf=$1; shift
2010-11-07 19:06:07 +00:00
if ! { time -p true; } >/dev/null 2>&1; then
2011-04-02 11:02:16 +00:00
msg "Cannot do timing in this shell"
2010-11-07 19:06:07 +00:00
return 1
fi
2010-11-07 18:20:42 +00:00
bestin=
bestt=
2010-11-20 21:40:17 +00:00
for mir in "$@"; do
case "$mir" in
*:*)
in=${mir%%:*}
op=${mir#*:}
;;
*)
in=$mir
op=
;;
esac
2010-11-07 18:20:42 +00:00
m=$pre$in$suf
if t=`mirrorspeed "$m"`; then
if [ -n "$t" ]; then
2010-11-21 15:22:42 +00:00
tt=$(($t$op)) # fudge factor
2010-11-21 15:28:33 +00:00
msg "$m -> $t$op = $tt ticks"
2010-11-21 15:22:42 +00:00
if [ -z "$bestt" ] || [ "$tt" -lt "$bestt" ]; then
2010-11-07 18:20:42 +00:00
bestin=$in
2010-11-21 15:22:42 +00:00
bestt=$tt
2010-11-07 18:20:42 +00:00
fi
2010-11-20 21:40:17 +00:00
else
msg "$m -> error"
2010-11-07 18:20:42 +00:00
fi
else
msg "$m -> FAIL"
fi
done
2010-11-07 19:06:07 +00:00
if [ -n "$bestin" ]; then
msg "Best mirror seems to be $pre$bestin$suf"
2010-11-12 14:42:48 +00:00
$ECHO "$bestin"
2010-11-07 19:06:07 +00:00
else
return 1
fi
2010-11-07 18:20:42 +00:00
}
2010-03-18 15:46:07 +00:00
case "$cmd" in
2010-08-04 10:26:57 +00:00
fix_upstream_rebase)
for d in $repos; do
2010-08-04 10:34:36 +00:00
enter "$d0/$d" verbose
verbose fix_upstream_rebase_mergefail && verbose fix_upstream_rebase_mergeok
2010-08-04 10:26:57 +00:00
done
;;
2010-10-04 13:30:03 +00:00
fix_config)
for d in $repos; do
url=`repourl "$d"`
pushurl=`repopushurl "$d"`
branch=`repobranch "$d"`
2011-07-27 17:58:55 +00:00
if [ -f "$d0/$d/.git/config" ]; then
2010-10-06 10:10:42 +00:00
verbose cd "$d0/$d"
2010-10-04 13:30:03 +00:00
fix_git_config "$url" "$pushurl"
cd "$d0"
fi
done
;;
2010-10-16 09:27:14 +00:00
keygen)
# enable the ssh URL for pushing
"$SELF" update -N -p
if [ -f ~/.ssh/id_rsa.pub ]; then
msg ""
msg "A key already exists and no new one will be generated. If you"
msg "already have done the procedure for getting your key approved, you"
msg "can skip the following paragraph and already use the repository."
msg ""
msg "To get access, your key has to be approved first. For that, visit"
msg "http://dev.xonotic.org/, then log in, create a \"New Issue\" on"
msg "the \"Support\" tracker in the \"Repository\" category where you"
2010-10-16 09:29:42 +00:00
msg "apply for access and paste the following output into the issue:"
2010-10-16 09:27:14 +00:00
msg ""
msg "`cat ~/.ssh/id_rsa.pub`"
2010-10-16 09:27:59 +00:00
msg ""
msg "Note that you will only have write access to branches that start"
msg "with your user name."
2010-10-16 09:27:14 +00:00
elif [ -f ~/.ssh/id_dsa.pub ]; then
msg ""
msg "A key already exists and no new one will be generated. If you"
msg "already have done the procedure for getting your key approved, you"
msg "can skip the following paragraph and already use the repository."
msg ""
msg "To get access, your key has to be approved first. For that, visit"
msg "http://dev.xonotic.org/, then log in, create a \"New Issue\" on"
msg "the \"Support\" tracker in the \"Repository\" category where you"
2010-10-16 09:29:42 +00:00
msg "apply for access and paste the following output into the issue:"
2010-10-16 09:27:14 +00:00
msg ""
msg "`cat ~/.ssh/id_dsa.pub`"
2010-10-16 09:27:59 +00:00
msg ""
msg "Note that you will only have write access to branches that start"
msg "with your user name."
2010-10-16 09:27:14 +00:00
else
msg ""
msg "No key has been generated yet. One will be generated now."
msg "If other people are using your computer, it is recommended"
2010-10-16 09:28:41 +00:00
msg "to specify a passphrase. Otherwise you can simply hit ENTER"
msg "when asked for a passphrase."
2010-10-16 09:27:14 +00:00
msg ""
2010-10-16 09:31:28 +00:00
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa
2010-10-16 09:27:14 +00:00
msg ""
msg "To get access, your key has to be approved first. For that, visit"
msg "http://dev.xonotic.org/, then log in, create a \"New Issue\" on"
msg "the \"Support\" tracker in the \"Repository\" category where you"
2010-10-16 09:29:42 +00:00
msg "apply for access and paste the following output into the issue:"
2010-10-16 09:27:14 +00:00
msg ""
msg "`cat ~/.ssh/id_rsa.pub`"
2010-10-16 09:27:59 +00:00
msg ""
msg "Note that you will only have write access to branches that start"
msg "with your user name."
2010-10-16 09:27:14 +00:00
fi
;;
2010-03-20 13:20:07 +00:00
update|pull)
2010-05-09 13:46:17 +00:00
allow_pull=true
2010-10-16 09:14:35 +00:00
fix_config=false
2010-10-18 15:48:50 +00:00
location=current
2010-10-16 09:14:35 +00:00
while :; do
if [ x"$1" = x"-N" ]; then
allow_pull=false
elif [ x"$1" = x"-p" ]; then
fix_config=true
2011-01-14 20:04:38 +00:00
pushbase=ssh://xonotic@git.xonotic.org/
elif [ x"$1" = x"-ps" ]; then
fix_config=true
pushbase=ssh://xonotic@git.xonotic.org/
elif [ x"$1" = x"-ph" ]; then
fix_config=true
2011-01-14 20:07:49 +00:00
pushbase=http://git.xonotic.org/login/xonotic/
2010-10-16 09:14:35 +00:00
elif [ x"$1" = x"-s" ]; then
fix_config=true
base=ssh://xonotic@git.xonotic.org/
elif [ x"$1" = x"-g" ]; then
fix_config=true
base=git://git.xonotic.org/xonotic/
elif [ x"$1" = x"-h" ]; then
fix_config=true
base=http://git.xonotic.org/xonotic/
2010-10-18 15:48:50 +00:00
elif [ x"$1" = x"-l" ]; then
case "$2" in
nl) ;;
2010-10-18 16:11:00 +00:00
de) ;;
2010-11-20 20:09:12 +00:00
us) ;;
2010-11-07 18:20:42 +00:00
best) ;;
2010-10-18 16:11:00 +00:00
default) ;;
2010-10-18 15:48:50 +00:00
*)
msg "Invalid location!"
msg "Possible locations for the -l option:"
msg " nl (Netherlands, run by merlijn)"
2010-10-18 16:11:00 +00:00
msg " de (Germany, run by divVerent)"
2010-11-20 20:09:12 +00:00
msg " us (United States of America, run by detrate)"
2010-11-07 18:20:42 +00:00
msg " best (find automatically)"
2010-10-18 16:11:00 +00:00
msg " default (currently nl)"
2010-10-18 15:48:50 +00:00
exit 1
;;
esac
fix_config=true
location=$2
shift
2010-10-16 09:14:35 +00:00
else
break
fi
shift
done
2010-11-21 15:28:33 +00:00
case "$location" in
current)
if [ x"`git config xonotic.all.mirrorselection 2>/dev/null || true`" != x"done" ]; then
location=best
fi
;;
esac
2010-11-07 19:08:10 +00:00
case "$location" in
best)
2010-11-21 15:34:12 +00:00
# if we fetched via ssh://, switch to git:// for fetching and keep using ssh:// for pushing
case "$base" in
2011-01-14 20:04:38 +00:00
ssh://*|*/login/*)
2010-11-21 15:34:12 +00:00
pushbase=$base
2010-11-21 15:35:41 +00:00
base=git://git.xonotic.org/xonotic/
2010-11-21 15:34:12 +00:00
;;
esac
2010-11-12 14:42:48 +00:00
newbase=`$ECHO "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,:// .git.xonotic.org/,"`
2010-11-07 19:08:10 +00:00
case "$newbase" in
*\ *)
2010-11-21 15:21:51 +00:00
if location=`bestmirror $newbase"xonotic.git" de us nl:'*6/5'`; then # 20% malus to the NL server to not overload it too much
2011-04-02 11:02:16 +00:00
git config xonotic.all.mirrorselection done
2010-11-07 19:08:10 +00:00
else
location=current
fi
;;
*)
location=current
;;
esac
;;
esac
2010-10-18 15:48:50 +00:00
case "$location" in
2010-10-18 16:11:00 +00:00
default)
2010-10-18 15:48:50 +00:00
location=
;;
current)
case "$base" in
*://*.git.xonotic.org/*)
location=${base%%.git.xonotic.org/*}
location=${location##*://}
;;
*)
location=
;;
esac
;;
esac
if [ -n "$location" ]; then
2010-11-12 14:42:48 +00:00
base=`$ECHO "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,://$location.git.xonotic.org/,"`
pushbase=`$ECHO "$pushbase" | sed "s,://\(.*\.\)\?git.xonotic.org/,://$location.git.xonotic.org/,"`
2010-10-18 15:48:50 +00:00
else
2010-11-12 14:42:48 +00:00
base=`$ECHO "$base" | sed "s,://\(.*\.\)\?git.xonotic.org/,://git.xonotic.org/,"`
pushbase=`$ECHO "$pushbase" | sed "s,://\(.*\.\)\?git.xonotic.org/,://git.xonotic.org/,"`
2010-10-18 15:48:50 +00:00
fi
2010-10-16 09:14:35 +00:00
if $fix_config; then
url=`repourl .`
pushurl=`repopushurl .`
fix_git_config "$url" "$pushurl"
2010-05-09 13:46:17 +00:00
fi
2010-10-16 09:14:35 +00:00
if $allow_pull || $fix_config; then
2010-10-04 13:30:03 +00:00
"$SELF" fix_config
fi
2010-05-02 11:06:36 +00:00
for d in $repos; do
url=`repourl "$d"`
2010-10-04 10:13:01 +00:00
pushurl=`repopushurl "$d"`
2010-05-02 11:06:36 +00:00
branch=`repobranch "$d"`
2011-07-27 17:53:34 +00:00
if [ -f "$d0/$d/.git/config" ]; then
2011-03-09 17:06:08 +00:00
# if we have .no file, skip
if [ -f "$d0/$d.no" ]; then
msg "Repository $d disabled by a .no file, delete $d.no to enable; thus, not updated"
continue
fi
2010-05-09 13:46:17 +00:00
if $allow_pull; then
enter "$d0/$d" verbose
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
if git config branch.$r.remote >/dev/null 2>&1; then
if ! verbose git pull; then
2010-08-04 19:33:55 +00:00
fix_upstream_rebase_mergefail || true
2010-05-09 13:46:17 +00:00
check_mergeconflict "$d"
2010-11-12 14:42:48 +00:00
$ECHO "Pulling failed. Press ENTER to continue, or Ctrl-C to abort."
2010-05-09 13:46:17 +00:00
read -r DUMMY
2010-08-04 10:26:57 +00:00
else
fix_upstream_rebase_mergeok || true
2010-05-09 13:46:17 +00:00
fi
2010-04-10 16:05:46 +00:00
fi
2010-05-09 13:46:17 +00:00
cd "$d00"
checkself "$cmd" "$@"
cd "$d0/$d"
verbose git remote prune origin
cd "$d0"
fi
2010-03-18 15:46:07 +00:00
else
2011-07-27 17:53:34 +00:00
if [ -d "$d0/$d" ]; then
2011-07-27 17:58:55 +00:00
if yesno "$d0/$d is in the way, get rid of it and reclone?"; then
2011-07-27 17:53:34 +00:00
verbose rm -rf "$d0/$d"
else
echo "Note: $d0/$d will stay broken."
continue
fi
fi
2010-03-26 08:18:04 +00:00
verbose git clone "$url" "$d0/$d"
2010-05-02 11:06:36 +00:00
enter "$d0/$d" verbose
2010-10-04 13:05:47 +00:00
fix_git_config "$url" "$pushurl"
2010-06-05 13:08:10 +00:00
if [ "$branch" != "master" ]; then
verbose git checkout --track -b "$branch" origin/"$branch"
fi
2010-05-02 11:06:36 +00:00
cd "$d0"
2010-03-18 15:46:07 +00:00
fi
done
;;
2010-06-17 12:08:38 +00:00
update-maps)
misc/tools/xonotic-map-compiler-autobuild download
;;
2010-03-24 14:09:55 +00:00
checkout|switch)
2010-08-14 00:46:07 +00:00
checkoutflags=
if [ x"$1" = x"-f" ]; then
checkoutflags=-f
shift
fi
2010-03-18 15:46:07 +00:00
remote=$1
branch=$2
if [ -z "$branch" ]; then
2010-06-17 12:26:24 +00:00
case "$remote" in
origin/*)
branch=${remote#origin/}
remote=origin
;;
*)
branch=$remote
remote=origin
;;
esac
2010-03-18 15:46:07 +00:00
fi
2011-03-02 09:37:22 +00:00
if [ -n "$checkoutflags" ]; then
set -- -f "$@" # to make checkself work again
fi
2010-03-18 15:46:07 +00:00
exists=false
for d in $repos; do
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-06-17 07:20:26 +00:00
b=$branch
if [ -n "$b" ] && git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
2010-03-18 15:46:07 +00:00
exists=true
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags "$b"
2010-06-17 07:20:26 +00:00
elif [ -n "$b" ] && git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
2010-03-18 15:46:07 +00:00
exists=true
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
2010-03-18 15:46:07 +00:00
else
2010-06-17 07:20:26 +00:00
b=`repobranch "$d"`
if git rev-parse "refs/heads/$b" >/dev/null 2>&1; then
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags "$b"
2010-06-17 07:20:26 +00:00
elif git rev-parse "refs/remotes/$remote/$b" >/dev/null 2>&1; then
2010-08-14 00:46:07 +00:00
verbose git checkout $checkoutflags --track -b "$b" "$remote/$b"
2010-06-17 07:20:26 +00:00
else
2010-11-12 14:42:48 +00:00
$ECHO "WTF? Not even branch $b doesn't exist in $d"
2010-06-17 07:20:26 +00:00
exit 1
fi
2010-03-18 15:46:07 +00:00
fi
2010-04-02 18:14:19 +00:00
cd "$d00"
2010-04-02 21:14:58 +00:00
checkself "$cmd" "$@"
2010-04-02 18:14:19 +00:00
cd "$d0"
2010-03-18 15:46:07 +00:00
done
2010-03-26 08:18:04 +00:00
if ! $exists; then
2010-11-12 14:42:48 +00:00
$ECHO "The requested branch was not found in any repository."
2010-03-26 08:18:04 +00:00
fi
2010-04-02 18:34:05 +00:00
exec "$SELF" branch
2010-03-18 15:46:07 +00:00
;;
branch)
2010-03-20 13:23:39 +00:00
remote=$1
branch=$2
2010-04-05 11:48:23 +00:00
srcbranch=$3
2010-03-20 13:23:39 +00:00
if [ -z "$branch" ]; then
branch=$remote
remote=origin
fi
if [ -z "$branch" ]; then
2010-03-20 13:14:50 +00:00
for d in $repos; do
2010-04-02 19:11:17 +00:00
enter "$d0/$d"
2010-03-20 13:14:50 +00:00
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
2010-11-12 14:42:48 +00:00
$ECHO "$d is at $r"
2010-03-20 13:14:50 +00:00
cd "$d0"
done
else
for d in $repos; do
2010-04-02 19:25:08 +00:00
dv=`visible_repo_name "$d"`
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-04-26 09:10:04 +00:00
if git rev-parse "refs/heads/$branch" >/dev/null 2>&1; then
2010-11-12 14:42:48 +00:00
$ECHO "Already having this branch in $dv."
2010-04-26 09:10:04 +00:00
else
2010-05-09 17:40:25 +00:00
if yesno "Branch in $dv?"; then
2010-05-02 11:06:36 +00:00
if [ -n "$srcbranch" ]; then
b=$srcbranch
else
2010-05-23 12:12:54 +00:00
b=origin/"`repobranch "$d"`"
verbose git fetch origin || true
2010-05-02 11:06:36 +00:00
fi
2010-05-04 05:31:37 +00:00
# TODO do this without pushing
2010-05-23 12:51:44 +00:00
verbose git checkout -b "$branch" "$b"
verbose git config "branch.$branch.remote" "$remote"
2010-05-25 11:01:32 +00:00
verbose git config "branch.$branch.merge" "refs/heads/$branch"
2010-04-26 09:10:04 +00:00
fi
2010-03-20 13:14:50 +00:00
fi
cd "$d0"
done
2010-04-02 18:34:05 +00:00
"$SELF" branch
2010-03-20 13:14:50 +00:00
fi
2010-03-18 15:46:07 +00:00
;;
branches)
2010-05-04 05:31:37 +00:00
for d in $repos; do
cd "$d0/$d" # am in a pipe, shouldn't use enter
2010-09-18 11:03:28 +00:00
git branch -r -v -v | cut -c 3- | sed "s/^(no branch)/(no_branch)/" | sed "s,^,$d ,"
2010-05-04 05:31:37 +00:00
cd "$d0"
done | {
branches_list=
# branches_repos_*=
2010-09-18 11:03:28 +00:00
while read -r d BRANCH REV TEXT; do
2010-06-17 12:26:24 +00:00
if [ x"$BRANCH" = x"`repobranch "$d"`" ]; then
continue
fi
2010-05-04 05:31:37 +00:00
if [ x"$REV" = x"->" ]; then
continue
fi
BRANCH=${BRANCH#remotes/}
2010-11-12 14:42:48 +00:00
ID=`$ECHO "$BRANCH" | tr -c "A-Za-z0-9." "_"`
2010-05-04 05:31:37 +00:00
branches_list="$branches_list $BRANCH" # TEH SORT MAKEZ IT UNIEQ
eval "r=\$branches_repos_$ID"
2010-09-18 11:03:28 +00:00
r="$r $d"
2010-05-04 05:31:37 +00:00
eval "branches_repos_$ID=\$r"
done
2010-11-12 14:42:48 +00:00
$ECHO -n "$branches_list" | xargs -n 1 $ECHO | sort -u | while IFS= read -r BRANCH; do
ID=`$ECHO "$BRANCH" | tr -c "A-Za-z0-9." "_"`
2010-05-04 05:31:37 +00:00
eval "r=\$branches_repos_$ID"
2010-06-17 12:26:24 +00:00
printf "%-60s %s\n" "$BRANCH" "$r"
2010-11-12 14:42:48 +00:00
#$ECHO "$BRANCH: $r"
2010-05-04 05:31:37 +00:00
done
}
;;
2010-04-02 18:49:48 +00:00
merge)
for d in $repos; do
2010-04-02 19:25:08 +00:00
dv=`visible_repo_name "$d"`
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-04-02 18:49:48 +00:00
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
2010-05-02 11:06:36 +00:00
if git log HEAD..origin/"`repobranch "$d"`" | grep .; then
2010-04-02 18:49:48 +00:00
# we have uncommitted changes
2010-05-09 17:40:25 +00:00
if yesno "Could merge from \"`repobranch "$d"`\" into \"$r\" in $dv. Do it?"; then
2010-05-02 11:06:36 +00:00
if ! verbose git merge origin/"`repobranch "$d"`"; then
2010-04-02 19:11:17 +00:00
check_mergeconflict "$d"
exit 1 # this should ALWAYS be fatal
2010-04-02 18:49:48 +00:00
fi
fi
fi
cd "$d0"
done
;;
2010-04-11 19:09:32 +00:00
push|commit)
2010-04-16 17:41:05 +00:00
submit=$1
2010-03-20 13:20:07 +00:00
for d in $repos; do
2010-04-02 19:25:08 +00:00
dv=`visible_repo_name "$d"`
2010-04-15 09:38:55 +00:00
enter "$d0/$d" verbose
2010-03-20 13:20:07 +00:00
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
2010-06-22 15:32:43 +00:00
diffdata=`git diff --color HEAD`
if [ -n "$diffdata" ]; then
2010-04-02 18:09:03 +00:00
# we have uncommitted changes
2010-11-12 14:42:48 +00:00
if yesno "Uncommitted changes in \"$r\" in $dv. Commit?" '$ECHO "$diffdata" | less -r'; then
2010-04-02 18:09:03 +00:00
verbose git commit -a
fi
fi
2010-11-12 14:42:48 +00:00
rem=`git config "branch.$r.remote" || $ECHO origin`
bra=`git config "branch.$r.merge" || $ECHO "$r"`
2010-07-09 20:54:58 +00:00
upstream="$rem/${bra#refs/heads/}"
2010-06-22 15:28:25 +00:00
if ! git rev-parse "$upstream" >/dev/null 2>&1; then
2010-06-22 15:34:51 +00:00
upstream="origin/`repobranch "$d"`"
2010-05-25 14:28:12 +00:00
fi
2010-06-22 15:35:05 +00:00
logdata=`git log --color "$upstream".."$r"`
2010-06-22 15:33:56 +00:00
if [ -n "$logdata" ]; then
2010-11-12 14:42:48 +00:00
if yesno "Push \"$r\" in $dv?" '$ECHO "$logdata" | less -r'; then
2010-06-22 15:33:56 +00:00
verbose git push "$rem" HEAD
fi
2010-03-20 13:20:07 +00:00
fi
2010-04-16 17:41:05 +00:00
if [ x"$submit" = x"-s" ]; then
case "$r" in
*/*)
2010-05-25 14:28:12 +00:00
verbose git push "$rem" HEAD:"${bra%%/*}/finished/${bra#*/}"
2010-04-16 17:41:05 +00:00
;;
esac
fi
2010-03-20 13:20:07 +00:00
cd "$d0"
done
;;
2010-03-24 12:11:30 +00:00
compile)
2010-10-08 19:45:54 +00:00
cleand0=false
2010-10-07 12:16:55 +00:00
cleandp=false
cleanqcc=false
cleanqc=false
2010-10-15 14:07:03 +00:00
compiled0=false
2010-10-07 12:16:55 +00:00
debug=debug
2010-10-31 13:20:55 +00:00
snowleopardhack=false
2010-10-13 19:42:31 +00:00
if [ -z "$CC" ]; then
export CC="gcc -DSUPPORTIPV6"
fi
2010-10-07 12:16:55 +00:00
while :; do
case "$1" in
2010-10-15 14:07:03 +00:00
-0)
compiled0=true
2010-10-30 06:37:03 +00:00
shift
2010-10-15 14:07:03 +00:00
;;
2010-10-07 12:16:55 +00:00
-c)
2010-10-08 19:45:54 +00:00
cleand0=true
2010-10-07 12:16:55 +00:00
cleandp=true
cleanqcc=true
cleanqc=true
shift
;;
2011-03-25 20:04:33 +00:00
-r|-p)
case "$1" in
-p)
2011-03-28 09:16:55 +00:00
debug=profile
2011-03-25 20:04:33 +00:00
;;
-r)
2011-03-28 09:16:55 +00:00
debug=release
2011-03-25 20:04:33 +00:00
;;
esac
2010-11-14 16:00:23 +00:00
export CC="$CC -g"
case "`$CC -dumpversion`" in
[5-9]*|[1-9][0-9]*|4.[3-9]*|4.[1-9][0-9]*)
# gcc 4.3 or higher
# -march=native is broken < 4.3
2011-07-31 19:25:27 +00:00
if $CC -mtune=native -march=native misc/tools/conftest.c -o conftest >/dev/null 2>&1; then
export CC="$CC -mtune=native -march=native"
fi
2010-11-14 16:00:23 +00:00
;;
esac
2010-11-13 21:58:26 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
export CC="$CC -fno-common"
fi
2010-10-07 12:16:55 +00:00
shift
;;
*)
break
;;
esac
done
2010-04-26 20:48:14 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug cl-$debug"
2010-07-09 20:48:47 +00:00
elif [ x"`uname`" = x"Darwin" ]; then
case "`uname -r`" in
?.*)
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug cl-$debug sdl-$debug"
2010-07-09 20:48:47 +00:00
;;
*)
# AGL cannot be compiled on systems with a kernel > 10.x (Snow Leopard)
2010-10-31 13:20:55 +00:00
snowleopardhack=true
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug sdl-$debug"
2010-07-09 20:48:47 +00:00
;;
esac
2011-05-09 19:42:39 +00:00
export CC="$CC -fno-reorder-blocks -I$PWD/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks/SDL.framework/Headers -F$PWD/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
2010-04-26 20:48:14 +00:00
else
2010-10-07 12:16:55 +00:00
TARGETS="sv-$debug cl-$debug sdl-$debug"
2010-04-26 20:48:14 +00:00
fi
2010-07-17 15:02:06 +00:00
if [ $# -gt 0 ] && [ x"$1" = x"" ]; then
# if we give the command make the arg "", it will surely fail (invalid filename),
# so better handle it as an empty client option
BAD_TARGETS=" "
shift
elif [ -n "$1" ]; then
BAD_TARGETS=
TARGETS_SAVE=$TARGETS
2010-07-04 16:28:02 +00:00
TARGETS=
for X in $1; do
case "$X" in
sdl)
2010-07-17 15:02:06 +00:00
TARGETS="$TARGETS sdl-debug"
2010-07-04 16:28:02 +00:00
;;
2010-10-31 13:20:55 +00:00
agl)
TARGETS="$TARGETS cl-debug"
if $snowleopardhack; then
export CC="$CC -arch i386"
fi
;;
glx|wgl)
2010-07-17 15:02:06 +00:00
TARGETS="$TARGETS cl-debug"
2010-07-04 16:28:02 +00:00
;;
dedicated)
2010-07-17 15:02:06 +00:00
TARGETS="$TARGETS sv-debug"
;;
*)
BAD_TARGETS="$BAD_TARGETS $X"
2010-07-04 16:28:02 +00:00
;;
esac
done
2010-07-21 18:01:32 +00:00
if [ -n "$TARGETS" ]; then # at least a valid client
2010-07-17 15:02:06 +00:00
shift
else # no valid client, let's assume this option is not meant to be a client then
TARGETS=$TARGETS_SAVE
BAD_TARGETS=
fi
2010-07-04 16:28:02 +00:00
fi
2010-03-26 08:18:04 +00:00
if [ -z "$MAKEFLAGS" ]; then
if [ -f /proc/cpuinfo ]; then
2011-07-31 20:02:46 +00:00
ncpus=$((`grep -c '^processor :' /proc/cpuinfo || true`+0))
2010-03-26 08:18:04 +00:00
if [ $ncpus -gt 1 ]; then
MAKEFLAGS=-j$ncpus
2010-03-25 08:18:19 +00:00
fi
fi
2010-05-08 18:54:22 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
2010-08-20 12:22:56 +00:00
MAKEFLAGS="$MAKEFLAGS DP_MAKE_TARGET=mingw LIB_JPEG= CFLAGS_LIBJPEG="
2010-05-08 18:54:22 +00:00
fi
2010-03-26 08:18:04 +00:00
fi
2010-07-02 12:01:07 +00:00
2011-07-31 19:25:27 +00:00
if ! verbose $CC misc/tools/conftest.c -o conftest; then
msg ""
2011-07-31 19:47:11 +00:00
msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
msg "~~~~~~~~~~ COMPILER ~~~~~~~~~~"
msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
msg "~~~~~~~~~~~~~~_...._~~~~~~~~~~"
2011-07-31 19:50:15 +00:00
msg "~~~~~~~~~~~,-' \\\`-._~~~~~~"
2011-07-31 19:47:11 +00:00
msg "~~~~~~~~~~/ --. >< \\~~~~~"
msg "~~~~~~~~~/ (*)> -<: \\~~~~"
msg "~~~~~~~~~( ^~-' (*) )~~~~"
2011-07-31 19:50:15 +00:00
msg "~~~~~~~~~\\ ^+-_/ |~~~~"
msg "~~~~~~~~~~\\ {vvv} |~~~~"
msg "~~~~~~~~~~,\\ , {^^^},/~~~~~"
2011-07-31 19:47:11 +00:00
msg "~~~~~~~~,/ \`---.....-'~~W~~~~"
msg "~~~~~~,/ \\_____/_\\_W~~/~~~~~"
msg "~~~~~/ /~~~\\__/~~~~~~"
msg "~~~~/ /~~~~~~~~~~~~~~"
msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
msg "~~~~~~~ Y U NO COMPILE ~~~~~~~"
msg "~~~~~~~~~~~~ CODE ~~~~~~~~~~~~"
msg "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
2011-07-31 19:25:27 +00:00
msg ""
exit 1
fi
rm -f conftest
2011-03-09 17:25:37 +00:00
verbose cd "$d0/d0_blind_id"
2010-10-15 14:07:03 +00:00
if ! $compiled0; then
2010-10-15 13:59:05 +00:00
# compilation of crypto library failed
# use binaries then, if we can...
mkdir -p .libs
if [ -n "$WE_HATE_OUR_USERS" ]; then
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/buildfiles/win32/libd0_blind_id"-* .libs/
2010-11-14 20:36:57 +00:00
verbose cp "$d0/misc/buildfiles/win32/libd0_rijndael"-* .libs/
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/buildfiles/win32/libgmp"-* .libs/
2010-10-15 13:59:05 +00:00
else
case "`uname`" in
Linux)
case `uname -m` in
x86_64)
2010-11-14 20:36:57 +00:00
#verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_blind_id".* .libs/
#verbose cp "$d0/misc/builddeps/dp.linux64/lib/libd0_rijndael".* .libs/
#verbose cp "$d0/misc/builddeps/dp.linux64/lib/libgmp".* .libs/
MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/ DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR=../misc/builddeps/dp.linux64/lib/"
2010-10-15 13:59:05 +00:00
;;
*86)
2010-11-14 20:36:57 +00:00
#verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_blind_id".* .libs/
#verbose cp "$d0/misc/builddeps/dp.linux32/lib/libd0_rijndael".* .libs/
#verbose cp "$d0/misc/builddeps/dp.linux32/lib/libgmp".* .libs/
2010-11-14 20:38:18 +00:00
MAKEFLAGS="$MAKEFLAGS DP_CRYPTO_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/ DP_CRYPTO_RIJNDAEL_STATIC_LIBDIR=../misc/builddeps/dp.linux32/lib/"
2010-10-15 13:59:05 +00:00
;;
*)
2010-10-15 14:07:03 +00:00
compiled0=true
2010-10-15 13:59:05 +00:00
;;
esac
;;
Darwin)
2010-10-15 14:07:03 +00:00
verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_blind_id".* .libs/
2010-11-14 20:36:57 +00:00
verbose cp "$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS/libd0_rijndael".* .libs/
2010-10-15 13:59:05 +00:00
;;
*)
2010-10-15 14:07:03 +00:00
compiled0=true
2010-10-15 13:59:05 +00:00
;;
esac
fi
2010-07-14 07:08:52 +00:00
fi
2010-10-15 14:07:03 +00:00
if $compiled0; then
if $cleand0; then
if [ -f Makefile ]; then
verbose make $MAKEFLAGS distclean
fi
fi
if ! [ -f Makefile ]; then
verbose sh autogen.sh
verbose ./configure
fi
verbose make $MAKEFLAGS
fi
2010-07-14 07:08:52 +00:00
2011-03-09 17:25:37 +00:00
verbose cd "$d0/fteqcc"
2010-07-02 12:01:07 +00:00
if $cleanqcc; then
2010-05-06 18:16:46 +00:00
verbose make $MAKEFLAGS clean
fi
2010-03-26 08:18:04 +00:00
verbose make $MAKEFLAGS
2010-07-02 12:01:07 +00:00
2011-03-09 17:25:37 +00:00
verbose cd "$d0/data/xonotic-data.pk3dir"
2010-07-02 12:01:07 +00:00
if $cleanqc; then
2010-10-18 14:33:53 +00:00
verbose make FTEQCC="../../../../fteqcc/fteqcc.bin" "$@" $MAKEFLAGS clean
2010-05-06 18:16:46 +00:00
fi
2010-10-18 14:33:53 +00:00
verbose make FTEQCC="../../../../fteqcc/fteqcc.bin" "$@" $MAKEFLAGS
# 4 levels up: data, xonotic-data, qcsrc, server
2010-07-02 12:01:07 +00:00
2011-03-09 17:25:37 +00:00
verbose cd "$d0/darkplaces"
2010-07-17 15:02:06 +00:00
if [ x"$BAD_TARGETS" = x" " ]; then
2010-11-12 14:42:48 +00:00
$ECHO "Warning: invalid empty client, default clients will be used."
2010-07-17 15:02:06 +00:00
fi
2010-07-02 12:01:07 +00:00
if $cleandp; then
2010-05-06 18:16:46 +00:00
verbose make $MAKEFLAGS clean
fi
2010-04-26 20:48:14 +00:00
for T in $TARGETS; do
2010-10-14 16:18:34 +00:00
verbose make $MAKEFLAGS STRIP=: "$@" "$T"
2010-04-26 20:48:14 +00:00
done
2010-07-17 15:02:06 +00:00
for T in $BAD_TARGETS; do
2010-11-12 14:42:48 +00:00
$ECHO "Warning: discarded invalid client $T."
2010-04-26 20:48:14 +00:00
done
2010-07-02 12:01:07 +00:00
2010-06-17 12:08:38 +00:00
verbose "$SELF" update-maps
2010-03-25 08:18:19 +00:00
;;
run)
2010-04-25 18:21:54 +00:00
if [ -n "$WE_HATE_OUR_USERS" ]; then
client=
2010-08-20 12:23:54 +00:00
export PATH="$d0/misc/buildfiles/win32:$d0/d0_blind_id/.libs:$PATH"
2010-05-07 07:40:03 +00:00
elif [ x"`uname`" = x"Darwin" ]; then
2011-05-09 19:42:39 +00:00
export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/MacOS:$d0/d0_blind_id/.libs"
export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic.app/Contents/Frameworks"
2010-05-07 07:40:03 +00:00
client=-sdl
2010-04-25 18:21:54 +00:00
else
2010-07-14 07:08:52 +00:00
export LD_LIBRARY_PATH="$d0/d0_blind_id/.libs"
2010-04-25 18:21:54 +00:00
client=-sdl
fi
2010-03-25 08:18:19 +00:00
case "$1" in
sdl|glx|agl|dedicated)
client=-$1
shift
;;
wgl)
client=
shift
;;
esac
if ! [ -x "darkplaces/darkplaces$client" ]; then
if [ -x "darkplaces/darkplaces$client.exe" ]; then
client=$client.exe
else
2010-11-12 14:42:48 +00:00
$ECHO "Client darkplaces/darkplaces$client not found, aborting"
2010-03-25 08:18:19 +00:00
exit 1
fi
fi
2011-05-08 20:48:54 +00:00
set -- "darkplaces/darkplaces$client" -xonotic "$@"
2010-05-10 19:12:07 +00:00
# if pulseaudio is running: USE IT
2010-06-06 14:07:50 +00:00
if [ -z "$SDL_AUDIODRIVER" ] && ! [ -n "$WE_HATE_OUR_USERS" ] && ! [ x"`uname`" = x"Darwin" ]; then
2010-05-20 07:30:32 +00:00
if ps -C pulseaudio >/dev/null; then
if ldd /usr/lib/libSDL.so 2>/dev/null | grep pulse >/dev/null; then
export SDL_AUDIODRIVER=pulse
fi
2010-05-10 19:12:07 +00:00
fi
fi
2010-10-01 05:16:04 +00:00
binary=$1
2010-11-19 12:49:13 +00:00
if [ x"$USE_GDB" = x"yes" ]; then
2010-05-02 11:06:36 +00:00
set -- gdb --args "$@"
2010-11-29 11:18:12 +00:00
elif [ x"$USE_GDB" != x"no" ] && which gdb >/dev/null 2>&1; then
2010-10-01 05:16:04 +00:00
set -- gdb --batch -x savecore.gdb --args "$@"
2010-09-26 11:52:57 +00:00
elif which catchsegv >/dev/null 2>&1; then
2010-09-26 06:51:27 +00:00
set -- catchsegv "$@"
2010-05-02 11:06:36 +00:00
fi
2010-10-01 05:16:04 +00:00
rm -f xonotic.core
2010-10-01 21:36:03 +00:00
"$@" || true
2010-10-01 05:16:04 +00:00
if [ -f xonotic.core ]; then
2010-10-01 05:23:11 +00:00
if yesno "The program has CRASHED. Do you want to examine the core dump?"; then
gdb "$binary" xonotic.core
#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
# tar cvzf xonotic.core.tar.gz xonotic.core darkplaces/*.c darkplaces/*.h
# # somehow send it
# rm -f xonotic.core.tar.gz
else
2010-11-12 14:42:48 +00:00
$ECHO "The core dump can be examined later by"
$ECHO " gdb $binary xonotic.core"
2010-10-01 05:23:11 +00:00
fi
2010-11-14 17:21:54 +00:00
exit 1
2010-05-02 11:06:36 +00:00
fi
2010-03-24 12:11:30 +00:00
;;
2010-03-25 14:40:42 +00:00
each|foreach)
2010-06-17 12:28:54 +00:00
keep_going=false
if [ x"$1" = x"-k" ]; then
keep_going=true
shift
fi
2010-03-25 14:37:47 +00:00
for d in $repos; do
2010-05-09 13:46:17 +00:00
if verbose cd "$d0/$d"; then
2010-06-17 12:28:54 +00:00
if $keep_going; then
verbose "$@" || true
else
verbose "$@"
fi
2010-05-09 13:46:17 +00:00
cd "$d0"
fi
2010-03-25 14:37:47 +00:00
done
;;
2010-04-15 09:38:55 +00:00
save-patches)
outfile=$1
patchdir=`mktemp -d -t save-patches.XXXXXX`
for d in $repos; do
enter "$d0/$d" verbose
git branch -v -v | cut -c 3- | {
i=0
while read -r BRANCH REV UPSTREAM TEXT; do
case "$UPSTREAM" in
\[*)
UPSTREAM=${UPSTREAM#\[}
UPSTREAM=${UPSTREAM%\]}
UPSTREAM=${UPSTREAM%:*}
TRACK=true
;;
*)
2010-05-02 11:06:36 +00:00
UPSTREAM=origin/"`repobranch "$d"`"
2010-04-15 09:38:55 +00:00
TRACK=false
;;
esac
if [ x"$REV" = x"->" ]; then
continue
fi
2010-04-15 09:43:03 +00:00
if git format-patch -o "$patchdir/$i" "$UPSTREAM".."$BRANCH"; then
2010-11-12 14:42:48 +00:00
$ECHO "$d" > "$patchdir/$i/info.txt"
$ECHO "$BRANCH" >> "$patchdir/$i/info.txt"
$ECHO "$UPSTREAM" >> "$patchdir/$i/info.txt"
$ECHO "$TRACK" >> "$patchdir/$i/info.txt"
2010-04-15 09:38:55 +00:00
i=$(($i+1))
else
rm -rf "$patchdir/$i"
fi
done
}
done
( cd "$patchdir" && tar cvzf - . ) > "$outfile"
rm -rf "$patchdir"
;;
restore-patches)
infile=$1
patchdir=`mktemp -d -t restore-patches.XXXXXX`
( cd "$patchdir" && tar xvzf - ) < "$infile"
# detach the head
for P in "$patchdir"/*/info.txt; do
D=${P%/info.txt}
exec 3<"$P"
read -r d <&3
read -r BRANCH <&3
read -r UPSTREAM <&3
read -r TRACK <&3
verbose git checkout HEAD^0
verbose git branch -D "$BRANCH"
if [ x"$TRACK" = x"true" ]; then
verbose git checkout --track -b "$BRANCH" "$UPSTREAM"
else
verbose git branch -b "$BRANCH" "$UPSTREAM"
fi
verbose git am "$D"
done
rm -rf "$patchdir"
;;
2010-04-22 13:56:16 +00:00
admin-merge)
2010-06-23 19:27:43 +00:00
branch=$1
2010-12-28 14:58:21 +00:00
only_delete=false
case "$branch" in
-d)
branch=
only_delete=true
;;
esac
2010-05-09 17:40:25 +00:00
t=`mktemp`
2010-05-15 20:53:45 +00:00
report=""
reportecho()
{
report=$report"$*$LF"
2010-11-12 14:42:48 +00:00
$ECHO "$*"
2010-05-15 20:53:45 +00:00
}
reportecho4()
{
report=$report" $*$LF"
2010-11-12 14:42:48 +00:00
$ECHO " $*"
2010-05-15 20:53:45 +00:00
}
reportdo4()
{
o=`"$@" | sed 's/^/ /' || true`
reportecho "$o"
}
2010-05-09 17:40:25 +00:00
for d in $repos; do
2010-11-03 09:26:14 +00:00
case "$d" in
fteqcc)
# sorry, fteqcc repo is managed manually
continue
;;
esac
2010-05-09 17:40:25 +00:00
enter "$d0/$d" verbose
2010-05-25 14:28:12 +00:00
base="`repobranch "$d"`"
2010-05-15 20:53:45 +00:00
reportecho "In $d:"
2010-05-09 17:40:25 +00:00
for ref in `git for-each-ref --format='%(refname)' refs/remotes/origin/`; do
case "${ref#refs/remotes/origin/}" in
2010-05-25 14:28:12 +00:00
"$base")
2010-05-09 17:40:25 +00:00
continue
;;
HEAD|master)
continue
;;
2010-06-24 08:12:48 +00:00
*/*)
2010-07-02 12:01:07 +00:00
;;
2010-06-24 08:12:48 +00:00
*)
continue
;;
2010-05-09 17:40:25 +00:00
esac
2010-06-23 19:27:43 +00:00
if [ -n "$branch" ]; then
if [ x"$branch" != x"${ref#refs/remotes/origin/}" ]; then
continue
fi
fi
2010-07-02 12:01:07 +00:00
case "$base" in
master)
realbase=$base
;;
*)
2010-07-02 12:04:00 +00:00
l0=`git rev-list "$base".."$ref" | wc -l`
l1=`git rev-list master.."$ref" | wc -l`
2010-07-02 12:01:07 +00:00
if [ $l0 -gt $l1 ]; then
realbase=master
else
realbase=$base
fi
;;
esac
2010-05-15 20:53:45 +00:00
reportecho " Branch $ref:"
2010-06-15 07:04:29 +00:00
note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
2010-07-02 12:01:07 +00:00
logdata=`git log --color "$realbase".."$ref"`
2010-06-15 07:15:50 +00:00
if [ -z "$logdata" ]; then
reportecho4 "--> not merging, no changes vs master"
2010-06-24 08:12:48 +00:00
if yesno "Branch \"$ref\" probably should get deleted. Do it?" ''; then
2010-06-15 07:15:50 +00:00
git push origin :"${ref#refs/remotes/origin/}"
reportecho4 "--> branch deleted"
fi
2010-06-24 08:12:48 +00:00
else
2010-07-02 12:01:07 +00:00
diffdata=`git diff --color --find-copies-harder --ignore-space-change "$realbase"..."$ref"`
2010-06-24 08:12:48 +00:00
if [ -z "$diffdata" ]; then
reportecho4 "--> not merging, no changes vs master, branch contains redundant history"
2010-11-12 14:42:48 +00:00
if yesno "Branch \"$ref\" probably should get deleted. Do it?" '{ $ECHO "$logdata"; } | less -r'; then
2010-05-15 18:11:23 +00:00
git push origin :"${ref#refs/remotes/origin/}"
2010-05-15 20:53:45 +00:00
reportecho4 "--> branch deleted"
2010-05-15 18:11:23 +00:00
fi
2010-12-28 14:58:21 +00:00
elif $only_delete; then
reportecho4 "--> skipped in delete-only run"
2010-07-17 13:18:14 +00:00
elif [ -z "$branch" ] && [ -n "$note" ]; then
2010-11-12 14:42:48 +00:00
reportdo4 $ECHO "$note"
2010-06-24 08:12:48 +00:00
reportecho4 "--> not merging, already had this one rejected before"
2010-11-12 14:42:48 +00:00
elif yesno "Branch \"$ref\" may want to get merged. Do it?" '{ $ECHO "$logdata"; $ECHO "$diffdata"; } | less -r'; then
2010-07-02 12:01:07 +00:00
git checkout "$realbase"
2010-06-24 08:12:48 +00:00
org=`git rev-parse HEAD`
2010-08-19 04:17:10 +00:00
if ! git merge --no-ff "$ref" 2>&1 | tee "$t" && ! { git ls-files -u | grep ' 1 ' >/dev/null; }; then
2010-06-24 08:12:48 +00:00
git reset --hard "$org"
GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Merge failed:$LF`cat "$t"`" "$ref"
reportdo4 cat "$t"
reportecho4 "--> merge failed"
2010-09-25 08:23:10 +00:00
elif ! "$SELF" compile 2>&1 | tee "$t"; then
2010-06-24 08:12:48 +00:00
git reset --hard "$org"
GIT_NOTES_REF=refs/notes/admin-merge git notes edit -m "Compile failed:$LF`cat "$t"`" "$ref"
reportdo4 cat "$t"
reportecho4 "--> compile failed"
elif ! yesno "Still merge \"$ref\" into `git symbolic-ref HEAD` of $d? Maybe you want to test first."; then
git reset --hard "$org"
2010-07-21 18:13:54 +00:00
GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
2010-06-24 08:12:48 +00:00
note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
if [ x"$note" = x"del" ]; then
git push origin :"${ref#refs/remotes/origin/}"
reportecho4 "--> test failed, branch deleted"
elif [ -n "$note" ]; then
2010-11-12 14:42:48 +00:00
reportdo4 $ECHO "$note"
2010-06-24 08:12:48 +00:00
reportecho4 "--> test failed"
else
reportecho4 "--> test failed, postponed"
fi
else
2010-11-03 09:03:07 +00:00
# apply crlf, or other cleanup filters (non-behavioural changes)
git reset --hard
find . -type f -exec touch {} \;
2010-11-03 09:42:43 +00:00
git commit -a --amend -C HEAD || true # don't fail if nothing to commit
2010-11-03 09:03:07 +00:00
2010-11-12 14:42:48 +00:00
$ECHO "MERGING"
2010-06-24 08:12:48 +00:00
case ",`repoflags "$d"`," in
*,svn,*)
# we do quite a mess here... luckily we know $org
git fetch # svn needs to be current
git rebase -i --onto origin/master "$org"
git svn dcommit --add-author-from
git reset --hard "$org"
;;
*)
git push origin HEAD
;;
esac
reportecho4 "--> MERGED"
if yesno "Delete original branch \"$ref\"?"; then
git push origin :"${ref#refs/remotes/origin/}"
reportecho4 "--> branch deleted"
fi
fi
2010-05-15 20:53:45 +00:00
else
2010-06-24 08:12:48 +00:00
GIT_NOTES_REF=refs/notes/admin-merge git notes edit "$ref"
note=`GIT_NOTES_REF=refs/notes/admin-merge git notes show "$ref" 2>/dev/null || true`
if [ x"$note" = x"del" ]; then
git push origin :"${ref#refs/remotes/origin/}"
reportecho4 "--> branch deleted"
elif [ -n "$note" ]; then
2010-11-12 14:42:48 +00:00
reportdo4 $ECHO "$note"
2010-06-24 08:12:48 +00:00
reportecho4 "--> rejected"
else
reportecho4 "--> postponed"
fi
2010-05-15 20:53:45 +00:00
fi
2010-05-09 17:40:25 +00:00
fi
2010-05-15 20:53:45 +00:00
reportecho ""
2010-05-09 17:40:25 +00:00
done
2010-05-15 20:53:45 +00:00
reportecho ""
2010-05-09 17:40:25 +00:00
done
rm -f "$t"
2010-11-12 14:42:48 +00:00
$ECHO "$report" | ssh nexuiz@rm.endoftheinternet.org cat '>>' public_html/xonotic-merge-notes.txt
2010-05-09 17:40:25 +00:00
;;
2010-08-09 11:59:42 +00:00
clean)
2010-10-04 13:30:03 +00:00
"$SELF" fix_config
"$SELF" update -N
2010-08-09 12:01:18 +00:00
force=false
2010-09-18 11:03:28 +00:00
gotoupstream=false
2010-09-18 11:13:43 +00:00
fetchupstream=false
2010-09-18 11:03:28 +00:00
gotomaster=false
rmuntracked=false
killbranches=false
# usage:
2010-09-18 11:13:43 +00:00
# ./all clean [-m] [-f | -fu | -fU] [-r] [-D]
2010-09-18 11:09:46 +00:00
# ./all clean --reclone
2010-09-18 11:17:46 +00:00
found=false
2010-10-22 06:51:11 +00:00
for X in "$@"; do
if [ x"$X" = x"--reclone" ]; then
2010-09-18 11:09:46 +00:00
force=true
2010-09-18 11:13:43 +00:00
fetchupstream=true
2010-09-18 11:09:46 +00:00
gotoupstream=true
gotomaster=true
rmuntracked=true
killbranches=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-f" ]; then
2010-09-18 11:03:28 +00:00
force=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-u" ]; then
2010-09-18 11:03:28 +00:00
gotoupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-U" ]; then
2010-09-18 11:13:43 +00:00
gotoupstream=true
fetchupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-fu" ]; then
2010-09-18 11:03:28 +00:00
force=true
gotoupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-fU" ]; then
2010-09-18 11:13:43 +00:00
force=true
gotoupstream=true
fetchupstream=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-m" ]; then
2010-09-18 11:03:28 +00:00
gotomaster=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-r" ]; then
2010-09-18 11:03:28 +00:00
rmuntracked=true
2010-10-22 06:51:11 +00:00
elif [ x"$X" = x"-D" ]; then
2010-09-18 11:03:28 +00:00
killbranches=true
2010-11-12 14:42:48 +00:00
elif $ECHO "$X" | grep '^-FFFF*UUUU*$' >/dev/null; then
2010-11-04 11:40:18 +00:00
msg ''
2010-11-12 14:39:52 +00:00
msg " _____"
msg " ,--'-\\P/\`\\ FFFFFFF"
msg " __/_ B/,-.\\ FFFFFFF"
msg " / _\\ (// O\\\\ FFFFFF"
msg "| (O \`) _\\._ _)\\ FFFUU"
msg "| |___/.^d0~~\"\\ \\ UUUU"
msg "| |\`~' \\ | UUUU"
msg "| | __,C>|| UUUU"
msg "\\ /_ ,-/,-' | UUUU"
msg " \\\\_ \\_>~' / UUUU-"
2010-11-04 11:40:18 +00:00
msg ''
2010-09-18 11:03:28 +00:00
else
2010-11-04 11:42:34 +00:00
msg "Unknown arg: $X"
2010-09-18 11:03:28 +00:00
fi
2010-09-18 11:17:46 +00:00
found=true
2010-09-18 11:03:28 +00:00
done
2010-09-18 11:17:46 +00:00
if ! $found; then
rmuntracked=true
2010-08-09 12:01:18 +00:00
fi
2010-08-09 11:59:42 +00:00
for d in $repos; do
2010-08-27 07:44:58 +00:00
verbose cd "$d0/$d"
2010-09-18 11:03:28 +00:00
if $gotoupstream; then
if ! $force; then
msg "Must also use -f (delete local changes) when using -u"
exit 1
fi
if $gotomaster; then
2010-09-18 11:13:43 +00:00
if $fetchupstream; then
verbose git fetch origin
2010-09-25 09:06:44 +00:00
verbose git remote prune origin
2010-09-18 11:13:43 +00:00
fi
2010-09-18 11:03:28 +00:00
verbose git checkout -f "`repobranch "$d"`"
2010-09-18 11:07:46 +00:00
verbose git reset --hard origin/"`repobranch "$d"`"
2010-09-18 11:03:28 +00:00
else
r=`git symbolic-ref HEAD`
r=${r#refs/heads/}
2010-11-12 14:42:48 +00:00
rem=`git config "branch.$r.remote" || $ECHO origin`
bra=`git config "branch.$r.merge" || $ECHO "$r"`
2010-09-18 11:03:28 +00:00
upstream="$rem/${bra#refs/heads/}"
2010-09-18 11:13:43 +00:00
if $fetchupstream; then
verbose git fetch "$rem"
2010-09-25 09:06:44 +00:00
verbose git remote prune "$rem"
2010-09-18 11:13:43 +00:00
fi
2010-09-18 11:03:28 +00:00
if ! git rev-parse "$upstream" >/dev/null 2>&1; then
upstream="origin/`repobranch "$d"`"
fi
verbose git reset --hard "$upstream"
fi
elif $gotomaster; then
if $force; then
verbose git checkout -f "`repobranch "$d"`"
2010-09-18 14:58:48 +00:00
verbose git reset --hard
2010-09-18 11:03:28 +00:00
else
verbose git checkout "`repobranch "$d"`"
fi
elif $force; then
2010-08-27 07:44:58 +00:00
verbose git reset --hard
2010-08-09 12:01:18 +00:00
fi
2010-09-18 11:03:28 +00:00
if $rmuntracked; then
case "$d" in
.)
2010-11-14 17:03:11 +00:00
verbose git clean -df || true
2010-09-18 11:03:28 +00:00
;;
*)
2010-11-14 17:03:11 +00:00
verbose git clean -xdf || true
2010-09-18 11:03:28 +00:00
;;
esac
fi
if $killbranches; then
git for-each-ref --format='%(refname)' refs/heads/ | while IFS= read -r B; do
2010-09-18 11:07:46 +00:00
if [ x"$B" != x"`git symbolic-ref HEAD`" ]; then
verbose git branch -D "${B#refs/heads/}"
fi
2010-09-18 11:03:28 +00:00
done
2010-11-14 17:40:54 +00:00
git rev-parse refs/heads/master >/dev/null 2>&1 || verbose git branch --track master origin/master || true
git rev-parse "refs/heads/`repobranch "$d"`" >/dev/null 2>&1 || verbose git branch --track "`repobranch "$d"`" origin/"`repobranch "$d"`" || true
2010-09-18 11:03:28 +00:00
fi
2010-10-22 06:51:11 +00:00
checkself "$cmd" "$@"
2010-08-09 11:59:42 +00:00
done
;;
2010-06-17 12:53:28 +00:00
# release building goes here
release-prepare)
2010-08-02 14:01:58 +00:00
#"$SELF" each git clean -fxd
2010-08-06 09:49:18 +00:00
case "$RELEASETYPE" in
2010-12-14 19:43:47 +00:00
'')
2010-11-12 14:42:48 +00:00
$ECHO >&2 -n "$ESC[2J$ESC[H"
2010-10-15 10:49:37 +00:00
msg ""
msg ""
msg ""
msg ""
msg ""
msg ""
msg " +---------------------------------------------------------.---+"
msg " | NOTE | X |"
msg " +---------------------------------------------------------^---+"
msg " | ____ |"
msg " | / \ This is the official release build system. |"
2010-10-15 10:58:41 +00:00
msg " | | | If you are not a member of the Xonotic Core Team, |"
2010-10-15 10:49:37 +00:00
msg " | | STOP | you are not supposed to use this script and should |"
msg " | | | instead use ./all compile to compile the engine |"
msg " | \____/ and game code. |"
msg " | |"
msg " | [ I understand ] |"
msg " +-------------------------------------------------------------+"
sleep 10
# A LOT of build infrastructure is required:
# - vorbis-tools
# - ImageMagick
# - .ssh/config must be configured so the following
# host names are reachable and have a compile
# infrastructure set up:
# - xonotic-build-linux32 (with gcc on x86)
# - xonotic-build-linux64 (with gcc on x86_64)
# - xonotic-build-win32 (with i586-mingw32msvc-g++)
# - xonotic-build-win64 (with amd64-mingw32msvc-g++
# and x86_64-w64-mingw32-g++)
# - xonotic-build-osx (with Xcode and SDL.framework)
# - AMD Compressonator installed in WINE
# - ResEdit installed in WINE
# - a lot of other requirements you will figure out
# while reading the error messages
# - environment variable RELEASETYPE set
# - optionally, environment variable RELEASEDATE set
# (YYYYMMDD)
2010-08-06 09:49:18 +00:00
exit 1
;;
2010-12-14 19:43:47 +00:00
release)
msg "Building a FINISHED RELEASE"
;;
*)
msg "Building a $RELEASETYPE"
;;
2010-08-06 09:49:18 +00:00
esac
2010-08-06 09:48:00 +00:00
verbose rm -rf Xonotic Xonotic*.zip
verbose mkdir -p Xonotic
2010-09-03 07:07:26 +00:00
if [ -n "$RELEASEDATE" ]; then
2010-11-12 14:42:48 +00:00
verbose $ECHO "$RELEASEDATE" > Xonotic/stamp.txt
2010-09-03 07:07:26 +00:00
else
verbose date +%Y%m%d > Xonotic/stamp.txt
fi
2011-06-17 19:33:11 +00:00
release_git_extract_dir "." "Xonotic" Docs misc server xonotic-linux-glx.sh xonotic-linux-sdl.sh misc/buildfiles key_0.d0pk COPYING GPL-2 GPL-3
2011-05-27 07:39:09 +00:00
(
2010-08-06 09:48:00 +00:00
verbose cd Xonotic
2011-02-23 13:16:13 +00:00
verbose mkdir data fteqcc source source/darkplaces source/fteqcc source/d0_blind_id mapping
2010-08-06 09:48:00 +00:00
verbose rm -rf misc/builddeps
2011-05-27 16:37:17 +00:00
verbose mv misc/buildfiles/win32 bin32 || true
2011-06-01 04:47:39 +00:00
verbose mv bin32/SDL.dll . || true
2010-08-11 04:36:32 +00:00
verbose mv misc/buildfiles/win64 bin64 || true
2010-08-06 09:48:00 +00:00
verbose mv misc/buildfiles/osx/* . || true
verbose rm -rf misc/buildfiles
2010-08-12 14:22:53 +00:00
verbose rm -rf misc/pki
2011-05-27 07:39:09 +00:00
)
2011-05-27 08:34:55 +00:00
release_git_extract_dir "darkplaces" "Xonotic/source/darkplaces" .
release_git_extract_dir "fteqcc" "Xonotic/source/fteqcc" .
2011-05-27 07:39:09 +00:00
release_git_extract_dir "data/xonotic-data.pk3dir" "Xonotic/source" qcsrc Makefile
2011-05-27 08:34:55 +00:00
release_git_extract_dir "d0_blind_id" "Xonotic/source/d0_blind_id" .
2011-05-27 07:39:09 +00:00
(
2010-12-15 20:58:53 +00:00
verbose cd Xonotic/source/d0_blind_id
verbose sh autogen.sh
2011-05-27 07:39:09 +00:00
)
2010-08-12 14:22:53 +00:00
rm -f Xonotic/key_15.d0pk
2011-02-23 13:16:13 +00:00
{
2011-03-05 21:32:43 +00:00
verbose cd Xonotic/mapping
2011-08-19 14:29:25 +00:00
verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20110819.tar.bz2
verbose wget http://www.icculus.org/netradiant/files/netradiant-1.5.0-20110819-win32-7z.exe
2011-02-23 13:17:51 +00:00
for X in *-7z.exe; do
7za x "$X"
rm -f "$X"
done
2011-02-23 13:16:13 +00:00
# TODO possibly include other tools?
}
2010-06-17 12:53:28 +00:00
;;
2010-06-17 14:19:01 +00:00
release-compile-run)
host=$1
buildpath=$2
maketargets=$3
makeflags=$4
srcdir=$5
2010-09-13 07:59:12 +00:00
depsdir=$6
targetfiles=$7
2010-09-15 11:21:13 +00:00
set -x
2010-08-21 11:57:53 +00:00
if [ -n "$targetfiles" ]; then
2010-09-15 11:14:23 +00:00
case " $HOSTS_THAT_ARE_DISABLED " in
*\ $host\ *)
2010-09-15 11:19:50 +00:00
exit
2010-09-15 11:14:23 +00:00
;;
esac
2010-08-21 11:57:53 +00:00
case " $HOSTS_THAT_ARE_MYSELF " in
*\ $host\ *)
2010-09-13 07:59:12 +00:00
verbose rsync --delete -zLvaSHP "$srcdir"/ "$buildpath/"
verbose rsync --delete -zLvaSHP "$depsdir"/ "$buildpath.deps/"
verbose ln -snf "$buildpath.deps" "$buildpath/.deps"
2010-08-21 11:57:53 +00:00
verbose eval make -C "$buildpath" clean $maketargets $makeflags
for f in $targetfiles; do
verbose mv "$buildpath/${f%:*}" "${f##*:}" || true
done
;;
*)
2010-09-13 07:59:12 +00:00
verbose rsync --delete -zLvaSHP "$srcdir"/ "$host:$buildpath/"
verbose rsync --delete -zLvaSHP "$depsdir"/ "$host:$buildpath.deps/"
2011-05-20 12:44:25 +00:00
verbose ssh "$host" "[ -f /etc/profile ] && . /etc/profile; [ -f ~/.profile ] && . ~/.profile; export LC_ALL=C; ln -snf $buildpath.deps $buildpath/.deps && cd $buildpath && nice -`nice` make clean $maketargets $makeflags"
2010-08-21 11:57:53 +00:00
for f in $targetfiles; do
verbose rsync -zvaSHP "$host:$buildpath/${f%:*}" "${f##*:}" || true
done
;;
esac
# now rebrand the binaries...
for f in $targetfiles; do
2010-09-04 14:56:33 +00:00
#verbose "$d0/misc/tools/rebrand-darkplaces-engine.sh" "${XONOTIC_BRAND:-$d0/misc/tools/xonotic.brand}" "${f##*:}" || true
2010-10-25 07:02:03 +00:00
case "${f##*:}" in
2010-12-17 14:41:14 +00:00
Xonotic/xonotic*.exe)
2010-10-25 07:02:03 +00:00
verbose "$d0/misc/tools/change-icon-of-exe.sh" "$d0/misc/logos/icons_ico/xonotic.ico" "${f##*:}"
2010-09-04 14:56:33 +00:00
;;
esac
2010-08-21 11:57:53 +00:00
done
fi
2010-06-17 14:19:01 +00:00
;;
release-compile)
suffix=$1
makeflags=$2
fteqcc_maketargets=$3
fteqcc_files=$4
darkplaces_maketargets=$5
darkplaces_files=$6
2010-09-13 07:59:12 +00:00
host=xonotic-build-$suffix
verbose "$SELF" release-compile-run "$host" /tmp/fteqcc.build."$suffix" "$fteqcc_maketargets" "$makeflags" "Xonotic/source/fteqcc" "$d0/misc/builddeps/dp.$suffix" "$fteqcc_files"
verbose "$SELF" release-compile-run "$host" /tmp/Darkplaces.build."$suffix" "$darkplaces_maketargets" "$makeflags" "Xonotic/source/darkplaces" "$d0/misc/builddeps/dp.$suffix" "$darkplaces_files"
2010-06-17 14:19:01 +00:00
;;
2010-06-17 13:20:57 +00:00
release-engine-win32)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile win32 \
2011-05-09 18:01:00 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-gcc -march=i686 -g1 -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' \
2010-06-17 14:19:01 +00:00
win 'fteqcc.exe:Xonotic/fteqcc/fteqcc.exe' \
2010-09-24 10:41:18 +00:00
'' ''
verbose "$SELF" release-compile win32 \
2011-05-09 18:01:00 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="i586-mingw32msvc-g++ -g1 -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=1' \
2010-09-24 10:41:18 +00:00
'' '' \
2010-08-11 04:36:32 +00:00
release 'darkplaces.exe:Xonotic/xonotic.exe darkplaces-sdl.exe:Xonotic/xonotic-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-dedicated.exe'
2010-06-17 12:53:28 +00:00
;;
2010-07-02 12:44:22 +00:00
release-engine-win64)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile win64 \
2011-05-09 18:01:00 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="amd64-mingw32msvc-gcc -g1 -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' \
2010-08-09 13:23:19 +00:00
win 'fteqcc.exe:Xonotic/fteqcc/fteqcc-x64.exe' \
2010-09-24 11:05:32 +00:00
'sv-release sdl-release' 'darkplaces-sdl.exe:Xonotic/xonotic-x64-sdl.exe darkplaces-dedicated.exe:Xonotic/xonotic-x64-dedicated.exe'
2010-09-24 10:41:18 +00:00
verbose "$SELF" release-compile win64 \
2011-05-09 18:01:00 +00:00
'STRIP=: DP_MAKE_TARGET=mingw CC="x86_64-w64-mingw32-g++ -g1 -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=1' \
2010-09-24 10:41:18 +00:00
'' '' \
2010-09-24 11:05:32 +00:00
cl-release 'darkplaces.exe:Xonotic/xonotic-x64.exe'
2010-07-02 12:44:22 +00:00
;;
2010-09-24 11:05:32 +00:00
release-engine-osx)
2010-08-11 05:42:23 +00:00
# gcc on OSX is buggy, needs -fno-reorder-blocks for a release build to succeed
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile osx \
2011-05-09 18:01:00 +00:00
'STRIP=: CC="gcc -g1 -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"' \
2010-06-17 14:19:01 +00:00
all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.osx' \
2011-05-09 19:42:39 +00:00
'sv-release sdl-release' 'darkplaces-sdl:Xonotic/Xonotic.app/Contents/MacOS/xonotic-osx-sdl-bin darkplaces-dedicated:Xonotic/xonotic-osx-dedicated'
2010-08-21 11:57:53 +00:00
;;
2010-06-17 13:20:57 +00:00
release-engine-linux32)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile linux32 \
2011-05-09 18:01:00 +00:00
'STRIP=: CC="gcc -m32 -march=i686 -g1 -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' \
2010-06-17 14:19:01 +00:00
all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux32' \
2010-08-11 04:36:32 +00:00
release 'darkplaces-glx:Xonotic/xonotic-linux32-glx darkplaces-sdl:Xonotic/xonotic-linux32-sdl darkplaces-dedicated:Xonotic/xonotic-linux32-dedicated'
2010-06-17 13:20:57 +00:00
;;
release-engine-linux64)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-compile linux64 \
2011-05-09 18:01:00 +00:00
'STRIP=: CC="gcc -m64 -g1 -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' \
2010-06-17 14:19:01 +00:00
all 'fteqcc.bin:Xonotic/fteqcc/fteqcc.linux64' \
2010-08-11 04:36:32 +00:00
release 'darkplaces-glx:Xonotic/xonotic-linux64-glx darkplaces-sdl:Xonotic/xonotic-linux64-sdl darkplaces-dedicated:Xonotic/xonotic-linux64-dedicated'
2010-06-17 13:20:57 +00:00
;;
release-engine)
2010-09-06 09:45:39 +00:00
verbose "$SELF" release-engine-linux32 &
verbose "$SELF" release-engine-linux64 &
verbose "$SELF" release-engine-win32 &
verbose "$SELF" release-engine-win64 &
verbose "$SELF" release-engine-osx &
wait %1
wait %2
wait %3
wait %4
wait %5
wait
2010-06-17 12:53:28 +00:00
;;
release-maps)
2010-08-06 09:48:00 +00:00
verbose "$SELF" update-maps
2010-06-17 13:20:57 +00:00
;;
2010-06-28 12:27:27 +00:00
release-qc)
2010-12-14 19:43:47 +00:00
verbose make -C Xonotic/source FTEQCC="../../../fteqcc/fteqcc.linux32" XON_BUILDSYSTEM=1 clean all
2011-01-07 19:54:42 +00:00
verbose rm -f Xonotic/source/qcsrc/*/fteqcc.log
2010-06-28 12:27:27 +00:00
;;
2010-06-17 13:20:57 +00:00
release-buildpk3-transform-raw)
2010-06-21 14:04:51 +00:00
dir=$1
2010-06-17 13:20:57 +00:00
;;
release-buildpk3-transform-normal)
2010-06-21 14:04:51 +00:00
dir=$1
2010-08-06 09:48:00 +00:00
verbose cd "$dir"
2010-06-21 14:04:51 +00:00
# texture: convert to jpeg and dds
2010-08-06 09:48:00 +00:00
verbose export do_jpeg=true
2011-01-20 09:49:11 +00:00
verbose export jpeg_qual_rgb=97
2010-11-07 13:52:35 +00:00
verbose export jpeg_qual_a=99
2011-01-20 09:49:11 +00:00
verbose export do_dds=false
2010-08-06 09:48:00 +00:00
verbose export do_ogg=false
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
2010-06-17 13:20:57 +00:00
;;
2010-12-25 11:42:18 +00:00
release-buildpk3-transform-normaldds)
dir=$1
verbose cd "$dir"
# texture: convert to jpeg and dds
# music: reduce bitrate
verbose export do_jpeg=false
verbose export do_jpeg_if_not_dds=true
verbose export jpeg_qual_rgb=95
verbose export jpeg_qual_a=99
verbose export do_dds=true
verbose export dds_flags=
verbose export do_ogg=true
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
;;
2010-06-17 13:20:57 +00:00
release-buildpk3-transform-low)
2010-06-21 14:04:51 +00:00
dir=$1
2010-08-06 09:48:00 +00:00
verbose cd "$dir"
2010-06-21 14:04:51 +00:00
# texture: convert to jpeg and dds
2010-06-17 13:20:57 +00:00
# music: reduce bitrate
2010-08-06 09:48:00 +00:00
verbose export do_jpeg=true
verbose export jpeg_qual_rgb=80
2010-11-07 13:52:35 +00:00
verbose export jpeg_qual_a=97
2010-08-06 09:48:00 +00:00
verbose export do_dds=false
verbose export do_ogg=true
verbose export ogg_qual=1
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
2010-06-17 13:20:57 +00:00
;;
2010-08-05 13:16:29 +00:00
release-buildpk3-transform-lowdds)
dir=$1
2010-08-06 09:48:00 +00:00
verbose cd "$dir"
2010-08-05 13:16:29 +00:00
# texture: convert to jpeg and dds
# music: reduce bitrate
2010-08-06 09:48:00 +00:00
verbose export do_jpeg=false
verbose export do_jpeg_if_not_dds=true
verbose export jpeg_qual_rgb=80
2010-10-26 19:05:31 +00:00
verbose export jpeg_qual_a=99
2010-08-06 09:48:00 +00:00
verbose export do_dds=true
verbose export dds_flags=
verbose export do_ogg=true
verbose export ogg_qual=1
verbose export del_src=true
find . -type f -print0 | verbose xargs -0 "$d0"/misc/tools/cached-converter.sh
2010-06-17 13:20:57 +00:00
;;
release-buildpk3)
src=$1
dst=$2
transform=$3
case "$dst" in
/*)
;;
2010-06-17 13:23:22 +00:00
*/)
2010-06-17 13:20:57 +00:00
dst="$PWD/$dst"
;;
esac
2011-05-25 14:15:14 +00:00
release_timereport
2010-08-06 09:48:00 +00:00
verbose rm -rf Xonotic/temp
2011-05-25 14:15:14 +00:00
release_timereport "deleted temp directory"
2010-08-06 09:48:00 +00:00
verbose mkdir -p Xonotic/temp
2011-05-27 08:34:55 +00:00
release_git_extract_dir "$src" "Xonotic/temp" .
2011-05-25 14:15:14 +00:00
release_timereport "extracted data"
2010-08-06 09:48:00 +00:00
verbose cd Xonotic/temp
2010-08-02 14:01:58 +00:00
if [ x"$src" = x"data/xonotic-data.pk3dir" ]; then
2010-08-06 10:19:30 +00:00
verbose cp ../source/progs.dat .
verbose cp ../source/csprogs.dat .
verbose cp ../source/menu.dat .
2010-08-06 09:48:00 +00:00
verbose rm -rf qcsrc
2010-08-05 18:12:49 +00:00
gv=`grep "^gameversion " "defaultXonotic.cfg" | awk '{ print $2 }'`
major=$(($gv / 10000))
2010-12-22 20:44:10 +00:00
minor=$((($gv / 100) - ($major * 100)))
patch=$(($gv - ($major * 10000) - ($minor * 100)))
2010-09-14 03:59:21 +00:00
versionstr="$major.$minor.$patch"
case "$RELEASETYPE" in
2010-12-14 19:43:47 +00:00
release)
;;
*)
versionstr="$versionstr$RELEASETYPE"
2010-09-14 03:59:21 +00:00
;;
esac
2011-06-04 20:30:57 +00:00
if [ $gv -lt 900 ]; then
# pre-1.0: compatible with any other pre-1.0
verbose sed "
s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
s/^gameversion_min [0-9]*/gameversion_min 0/;
s/^gameversion_max [0-9]*/gameversion_max 9999/;
" < defaultXonotic.cfg > defaultXonotic.cfg.new
else
# >= 1.0
verbose sed "
s/^set g_xonoticversion [^ ]* /set g_xonoticversion $versionstr /;
s/^gameversion_min [0-9]*/gameversion_min $(( ($gv / 100) * 100 - 100 ))/;
s/^gameversion_max [0-9]*/gameversion_max $(( ($gv / 100) * 100 + 199 ))/;
" < defaultXonotic.cfg > defaultXonotic.cfg.new
fi
2011-05-27 07:45:43 +00:00
mv defaultXonotic.cfg.new defaultXonotic.cfg
2010-12-12 19:50:38 +00:00
case "$RELEASETYPE" in
release)
echo "" >> defaultXonotic.cfg
echo "// nicer menu" >> defaultXonotic.cfg
echo "set menu_watermark \"\"" >> defaultXonotic.cfg
;;
esac
2010-09-14 03:59:21 +00:00
(
verbose cd gfx/menu/luminos
2011-05-27 07:45:43 +00:00
verbose rm -f background_l2.tga background_ingame_l2.tga
2010-09-14 03:59:21 +00:00
verbose cp "$d0"/mediasource/gfx/menu/luminos_versionbuilder/background_l2.svg .
verbose "$d0"/mediasource/gfx/menu/luminos_versionbuilder/versionbuilder "$versionstr"
verbose rm background_l2.svg
)
2010-08-02 14:01:58 +00:00
fi
2010-08-06 07:27:05 +00:00
if [ x"$src" = x"data/xonotic-maps.pk3dir" ]; then
2010-08-06 07:31:38 +00:00
for X in ../../data/*-????????????????????????????????????????-????????????????????????????????????????.pk3; do
2010-08-06 07:27:05 +00:00
if [ -f "$X" ]; then
2010-08-06 09:48:00 +00:00
verbose unzip "$X"
2010-09-14 03:59:21 +00:00
verbose rm -f maps/*.log maps/*.irc maps/*.lin
2010-08-06 07:27:05 +00:00
fi
done
fi
2010-09-06 07:11:34 +00:00
verbose export git_src_repo="$d0/$src" # skip hash-object
2011-05-25 14:15:14 +00:00
release_timereport "processed data"
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-buildpk3-transform-$transform "Xonotic/temp"
2011-05-25 14:15:14 +00:00
release_timereport "transformed data"
2011-05-06 19:59:40 +00:00
verbose mkzipr "../../$dst" *
2011-05-25 14:15:14 +00:00
release_timereport "zipped data"
2010-08-06 09:48:00 +00:00
verbose cd ../..
verbose rm -rf Xonotic/temp
2011-05-25 14:15:14 +00:00
release_timereport "deleted temp directory again"
2010-06-17 13:20:57 +00:00
;;
release-buildpk3s)
2010-08-05 18:01:27 +00:00
stamp=`cat Xonotic/stamp.txt`
2010-06-17 13:20:57 +00:00
src=$1
shift
2010-08-05 18:01:27 +00:00
dst=${src%.pk3dir}
case "$dst" in
data/xonotic-*)
2010-08-05 18:54:32 +00:00
dst="data/xonotic-$stamp-${dst#data/xonotic-}"
2010-08-05 18:01:27 +00:00
;;
*)
dst="$dst-$stamp"
;;
esac
2010-06-17 13:20:57 +00:00
while [ "$#" -gt 1 ]; do
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-buildpk3 "$src" "Xonotic/$dst$2.pk3" "$1"
2010-06-21 14:04:51 +00:00
shift
shift
2010-06-17 13:20:57 +00:00
done
;;
release-pack)
2010-12-25 16:27:40 +00:00
verbose "$SELF" release-buildpk3s data/font-nimbussansl.pk3dir raw ''
2011-01-20 09:49:11 +00:00
verbose "$SELF" release-buildpk3s data/font-xolonium.pk3dir raw ''
2010-12-25 18:00:06 +00:00
verbose "$SELF" release-buildpk3s data/xonotic-data.pk3dir normal '-high' low '-low' normaldds ''
verbose "$SELF" release-buildpk3s data/xonotic-maps.pk3dir normal '-high' low '-low' normaldds ''
verbose "$SELF" release-buildpk3s data/xonotic-music.pk3dir raw '' low '-low'
2011-01-20 09:49:11 +00:00
verbose "$SELF" release-buildpk3s data/xonotic-nexcompat.pk3dir normal '-high' normaldds ''
2010-06-17 12:53:28 +00:00
;;
2010-08-05 08:59:22 +00:00
release-pack-needsx11)
case "$DISPLAY" in
'')
2010-08-06 09:48:00 +00:00
verbose startx "$SELF" release-pack -- /usr/bin/Xvfb :7
2010-08-05 08:59:22 +00:00
;;
*)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-pack
2010-08-05 08:59:22 +00:00
;;
esac
;;
2010-08-05 18:01:27 +00:00
release-zip)
2010-08-06 04:30:26 +00:00
stamp=`cat Xonotic/stamp.txt`
2010-09-16 09:42:48 +00:00
# exe and dll files do not need +x, so this makes them eligible for 7zip compression too
2010-09-17 04:54:31 +00:00
chmod a-x Xonotic/*.exe Xonotic/*.dll || true
2010-09-17 22:01:51 +00:00
# let's pass crypto import laws of some nasty countries
2010-12-15 20:58:53 +00:00
crypto_libs=`find Xonotic -name \*d0_rijndael\*.so -o -name \*d0_rijndael\*.dylib -o -name \*d0_rijndael\*.dll -o -name \*d0_rijndael\*.c`
2010-09-17 22:01:51 +00:00
if [ -n "$crypto_libs" ]; then
verbose mkzip Xonotic-$stamp-crypto.zip \
2011-06-13 18:55:52 +00:00
$crypto_libs \
2011-06-17 19:33:11 +00:00
Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
2010-09-17 22:01:51 +00:00
rm -f $crypto_libs
fi
# build the archives
2010-09-16 06:41:57 +00:00
verbose mkzip Xonotic-$stamp-engine.zip \
2011-06-23 07:29:35 +00:00
Xonotic/*.dll \
2011-05-27 17:38:45 +00:00
Xonotic/bin32/*.dll \
2010-09-04 16:01:13 +00:00
Xonotic/bin64/*.dll \
Xonotic/*.app \
Xonotic/xonotic-* \
2010-09-24 04:50:10 +00:00
Xonotic/xonotic.exe \
2011-06-13 18:55:52 +00:00
Xonotic/source/darkplaces/ \
2011-06-17 19:33:11 +00:00
Xonotic/COPYING Xonotic/GPL-2 Xonotic/GPL-3
2010-09-04 16:01:13 +00:00
verbose cp Xonotic-$stamp-engine.zip Xonotic-$stamp-common.zip
2010-09-16 06:41:57 +00:00
verbose mkzip Xonotic-$stamp-common.zip \
2010-09-24 04:50:10 +00:00
Xonotic/source/fteqcc/ \
Xonotic/source/qcsrc/ \
2010-08-05 18:01:27 +00:00
Xonotic/Docs \
Xonotic/misc \
Xonotic/fteqcc \
Xonotic/server \
2010-09-03 07:06:50 +00:00
Xonotic/key_0.d0pk \
2011-02-12 19:16:49 +00:00
Xonotic/data/font-nimbussansl-$stamp.pk3 \
2011-02-12 19:16:28 +00:00
Xonotic/data/font-xolonium-$stamp.pk3
2010-08-09 08:10:25 +00:00
verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp.zip
2010-09-16 06:41:57 +00:00
verbose mkzip0 Xonotic-$stamp.zip \
2010-08-06 04:30:26 +00:00
Xonotic/data/xonotic-$stamp-data.pk3 \
Xonotic/data/xonotic-$stamp-maps.pk3 \
Xonotic/data/xonotic-$stamp-music.pk3 \
Xonotic/data/xonotic-$stamp-nexcompat.pk3
2010-08-09 08:10:25 +00:00
verbose cp Xonotic-$stamp-common.zip Xonotic-$stamp-low.zip
2010-09-16 06:41:57 +00:00
verbose mkzip0 Xonotic-$stamp-low.zip \
2010-08-06 04:30:26 +00:00
Xonotic/data/xonotic-$stamp-data-low.pk3 \
Xonotic/data/xonotic-$stamp-maps-low.pk3 \
2010-08-14 19:54:59 +00:00
Xonotic/data/xonotic-$stamp-music-low.pk3
2010-12-25 18:00:06 +00:00
verbose mv Xonotic-$stamp-common.zip Xonotic-$stamp-high.zip
2011-06-30 11:10:45 +00:00
verbose mkzip Xonotic-$stamp-high.zip \
Xonotic/mapping
2010-12-25 16:27:40 +00:00
verbose mkzip0 Xonotic-$stamp-high.zip \
Xonotic/data/xonotic-$stamp-data-high.pk3 \
Xonotic/data/xonotic-$stamp-maps-high.pk3 \
2010-12-25 11:42:18 +00:00
Xonotic/data/xonotic-$stamp-music.pk3 \
2011-01-20 09:49:11 +00:00
Xonotic/data/xonotic-$stamp-nexcompat-high.pk3
2011-03-07 13:53:58 +00:00
verbose mkzip Xonotic-$stamp-mappingsupport.zip \
Xonotic/mapping
2011-03-07 13:42:30 +00:00
verbose mkzip0 Xonotic-$stamp-mappingsupport.zip \
2011-06-30 11:10:45 +00:00
Xonotic/data/xonotic-$stamp-maps-low.pk3
2010-06-17 12:53:28 +00:00
;;
release)
2010-08-06 09:48:00 +00:00
verbose "$SELF" release-prepare
verbose "$SELF" release-maps
verbose "$SELF" release-engine
verbose "$SELF" release-qc
verbose "$SELF" release-pack-needsx11
verbose "$SELF" release-zip
2010-06-17 12:53:28 +00:00
;;
2010-08-02 14:04:48 +00:00
2010-03-18 15:46:07 +00:00
*)
2010-11-12 14:42:48 +00:00
$ECHO "Usage:"
$ECHO " $SELF admin-merge [<branch>]"
$ECHO " $SELF branch <branch>"
$ECHO " $SELF branch <remote> <branch> [<srcbranch>]"
$ECHO " $SELF branches"
$ECHO " $SELF checkout|switch <branch>"
$ECHO " $SELF checkout|switch <remote>/<branch>"
$ECHO " $SELF clean [-m] [-f | -fu | -fU] [-r] [-D]"
$ECHO " $SELF clean --reclone"
2011-07-01 07:26:41 +00:00
$ECHO " $SELF compile [-c] [-r|-p] [-0] [sdl|glx|wgl|agl|dedicated]"
2010-11-12 14:42:48 +00:00
$ECHO " $SELF each|foreach [-k] command..."
$ECHO " $SELF fix_upstream_rebase"
$ECHO " $SELF keygen"
$ECHO " $SELF merge"
$ECHO " $SELF push|commit [-s]"
$ECHO " $SELF restore-patches"
$ECHO " $SELF run [sdl|glx|wgl|agl|dedicated] options..."
$ECHO " $SELF save-patches"
$ECHO " $SELF update-maps"
$ECHO " $SELF update|pull [-N] [-s | -h [-p] | -g [-p]] [-l de|nl|default]"
2010-03-18 15:46:07 +00:00
;;
esac