Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH
Some platforms (like SunOS and family) have kept their common binaries at some historical moment in time, and introduced new binaries with modern features in a special location like /usr/xpg4/bin or /usr/ucb. Some of the features provided by these modern binaries are expected and required by git. If the featureful binaries are not in the users path, then git could end up using the less featureful binary and fail. So provide a mechanism to prepend elements to the users PATH at runtime so the modern binaries will be found. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 5, 2009 at 18:36 UTC
0e0aea5a47b675ab2dca9c77180b8fe9bc6bdeec
2 files changed
+16
Makefile
+14
@@ -3,6 +3,11 @@ all::
3
4
# Define V=1 to have a more verbose compile.
5
#
6
+# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.
7
+#
8
+# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend
9
+# to PATH if your tools in /usr/bin are broken.
10
+#
11
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
12
# or vsnprintf() return -1 instead of number of characters which would
13
# have been written to the final string if enough space had been available.
@@ -702,6 +707,7 @@ ifeq ($(uname_S),SunOS)
707
NEEDS_SOCKET = YesPlease
708
NEEDS_NSL = YesPlease
709
SHELL_PATH = /bin/bash
710
+ SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
711
NO_STRCASESTR = YesPlease
712
NO_MEMMEM = YesPlease
713
NO_MKDTEMP = YesPlease
@@ -864,6 +870,13 @@ endif
870
-include config.mak.autogen
871
-include config.mak
872
873
+ifdef SANE_TOOL_PATH
874
+BROKEN_PATH_FIX = s|^. @@PATH@@|PATH=$(SANE_TOOL_PATH)|
875
+PATH := $(SANE_TOOL_PATH):${PATH}
876
+else
877
+BROKEN_PATH_FIX = d
878
+endif
879
+
880
ifeq ($(uname_S),Darwin)
881
ifndef NO_FINK
882
ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -1265,6 +1278,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
1278
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1279
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
1280
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1281
+ -e '/^# @@PATH@@/$(BROKEN_PATH_FIX)' \
1282
$@.sh >$@+ && \
1283
chmod +x $@+ && \
1284
mv $@+ $@
git-sh-setup.sh
+2
@@ -11,6 +11,8 @@
11
# exporting it.
12
unset CDPATH
13
14
+# @@PATH@@:$PATH
15
+
16
die() {
17
echo >&2 "$@"
18
exit 1