You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
2.1 KiB
125 lines
2.1 KiB
#!/bin/sh |
|
|
|
case "$(git version 2>/dev/null)" in |
|
"git version"*) |
|
GIT=git ;; |
|
*) |
|
echo >&2 "No git to bootstrap" |
|
exit 1 ;; |
|
esac |
|
|
|
inst_prefix=$( |
|
IFS=: |
|
for p in $PATH |
|
do |
|
probed=${p%/git-active/bin} |
|
if test "$probed" != "$p" |
|
then |
|
echo "$probed" |
|
exit |
|
fi |
|
done |
|
echo $HOME |
|
) |
|
|
|
LANG=C |
|
old_style_def_fix=b79d18c92d9f4841a6a1a29b7b2373a8ff9871e1 |
|
|
|
: ${O=-O2} |
|
Wall='-Wall -Wdeclaration-after-statement' tests= |
|
while case $# in 0) break ;; esac |
|
do |
|
case "$1" in |
|
-pedantic | --pedantic) |
|
o= && |
|
rev=$($GIT rev-parse HEAD) && |
|
case "$($GIT merge-base "$old_style_def_fix" "$rev")" in |
|
$old_style_def_fix) |
|
o=-Wold-style-definition ;; |
|
esac |
|
O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast" |
|
# O="$O -fwrapv -fno-strict-overflow" |
|
;; |
|
-loose | --loose) |
|
Wall= |
|
;; |
|
--locale=*) |
|
LANG=${1#*=} |
|
;; |
|
--test=*) |
|
tests=$( |
|
cd t && |
|
for t in ${1#*=} |
|
do |
|
eval echo "t$t-*.sh" |
|
done | tr '\012' ' ' |
|
) |
|
;; |
|
--) |
|
shift |
|
break |
|
;; |
|
-*) |
|
echo >&2 "Eh $1?" |
|
exit 1 |
|
;; |
|
*) |
|
break |
|
;; |
|
esac |
|
shift |
|
done |
|
|
|
LC_ALL=$LANG |
|
export LANG LC_ALL |
|
|
|
head=`$GIT symbolic-ref HEAD 2>/dev/null` && |
|
branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached |
|
|
|
case "$branch" in |
|
next | maint | master | pu | jch) |
|
prefix="$inst_prefix/git-$branch" |
|
;; |
|
snap) |
|
v=`$GIT describe HEAD` |
|
expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && { |
|
echo >&2 "You are on 'snap' but $v is not an official version." |
|
exit 1 |
|
} |
|
prefix="$inst_prefix/git-snap-$v" |
|
;; |
|
*) |
|
prefix="$inst_prefix/git-test" ;; |
|
esac |
|
d="prefix=$prefix" |
|
|
|
sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || { |
|
$GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version |
|
} |
|
|
|
d="$d ASCIIDOC_NO_ROFF=YesPlease ASCIIDOC8=YesPlease" |
|
|
|
# Platform hack |
|
if test -z "${make:+set}" && { |
|
test -x /usr/local/bin/gmake || |
|
test -x /usr/bin/gmake |
|
} |
|
then |
|
make=gmake |
|
fi |
|
|
|
CFLAGS="$O $Wall -g" |
|
OK_TO_USE_CFLAGS=Yes |
|
if test -n "${NO_CFLAGS+set}" |
|
then |
|
unset OK_TO_USE_CFLAGS |
|
fi |
|
|
|
${make-make} $d \ |
|
ETC_GITCONFIG=$prefix/etc/gitconfig \ |
|
${OK_TO_USE_CFLAGS+"CFLAGS=$CFLAGS"} \ |
|
${tests:+"T=$tests"} \ |
|
"$@" |
|
status=$? |
|
rm -f version |
|
exit $status
|
|
|