#!/bin/sh if test -z "$GIT" then case "$(git version 2>/dev/null)" in "git version"*) GIT=git ;; *) echo >&2 "No git to bootstrap" exit 1 ;; esac fi 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} for cv in PYTHON_PATH=python TCL_PATH=tclsh TCLTKPATH=wish do cmd=${cv#*=} var=${cv%=*} eval $( if test -f "/usr/bin/$cmd" then break fi for p in /usr/bin /usr/local/bin do if test -f "$p/$cmd" then echo "$var=$p/$cmd; export $var" break fi found=$(find "$p/$cmd"* -type f 2>/dev/null | head -n 1) if test -f "$found" then echo "$var=$found; export $var" break fi done ) done Wall='-Wall -Wdeclaration-after-statement' tests= jobs= skip= oldtest= case `uname` in OpenBSD) O="-fgnu89-inline" skip="t9402" ;; NetBSD) OLD_ICONV=YesPlease; export OLD_ICONV skip="t5000 t9402" ;; FreeBSD) OLD_ICONV=YesPlease; export OLD_ICONV skip="t5560" ;; SunOS) NEEDS_CRYPTO_WITH_SSL=YesPlease ; export NEEDS_CRYPTO_WITH_SSL NO_PEDANTIC=CannotDo Wall= ;; esac old_style_def_fix () { rev=$($GIT rev-parse HEAD 2>/dev/null) && case "$($GIT merge-base "$old_style_def_fix" "$rev")" in $old_style_def_fix) printf "%s\n" "-Wold-style-definition" ;; esac } determine_branch () { expr "$($GIT symbolic-ref HEAD 2>/dev/null)" : 'refs/heads/\(.*\)' || echo detached } determine_version () { 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 } echo "$v" } determine_long_version () { $GIT describe HEAD 2>/dev/null || echo unknown-g00000000 | sed -e 's/-/./g' } while case $# in 0) break ;; esac do case "$1" in -pedantic | --pedantic) case "$NO_PEDANTIC" in ?*) ;; '') O="$O -Werror $(old_style_def_fix) -std=c99" O="$O -Wno-pointer-to-int-cast" O="$O -Wpointer-arith -Woverflow -Wunused" ;; esac # -Wvla # O="$O -fwrapv -fno-strict-overflow" ;; -j*) case "$NO_JOBS" in ?*) jobs= ;; '') jobs=$1 ;; esac ;; -noprove | --noprove) oldtest=t ;; -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 if test -z "$tests" && test -n "$skip" then GIT_SKIP_TESTS="${GIT_SKIP_TESTS:-$skip}" export GIT_SKIP_TESTS fi if test -z "$oldtest" && sh -c 'prove --version >/dev/null 2>&1' && sh -c 'prove --exec : >/dev/null 2>&1' then DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$jobs" export DEFAULT_TEST_TARGET GIT_PROVE_OPTS fi LC_ALL=$LANG export LANG LC_ALL branch=$(determine_branch) case "$branch" in next | maint | master | pu | jch) prefix="$inst_prefix/git-$branch" ;; snap) v=$(determine_version) prefix="$inst_prefix/git-snap-$v" ;; *) prefix="$inst_prefix/git-test" ;; esac d="prefix=$prefix" determine_long_version >version d="$d "' MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/" ASCIIDOC_NO_ROFF=YesPlease ASCIIDOC8=YesPlease BLK_SHA1=YesPlease GNU_ROFF=YesPlease' # Platform hack if test -z "${make:+set}" && { test -x /usr/local/bin/gmake || test -x /usr/pkg/bin/gmake || test -x /usr/bin/gmake } then make=gmake fi if test -f /bin/ginstall then set INSTALL=ginstall "$@" 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"} \ $jobs \ "$@" status=$? rm -f version exit $status