Skip to content

Commit 0e0aea5

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b213019 commit 0e0aea5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ all::
33

44
# Define V=1 to have a more verbose compile.
55
#
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+
#
611
# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
712
# or vsnprintf() return -1 instead of number of characters which would
813
# have been written to the final string if enough space had been available.
@@ -702,6 +707,7 @@ ifeq ($(uname_S),SunOS)
702707
NEEDS_SOCKET = YesPlease
703708
NEEDS_NSL = YesPlease
704709
SHELL_PATH = /bin/bash
710+
SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
705711
NO_STRCASESTR = YesPlease
706712
NO_MEMMEM = YesPlease
707713
NO_MKDTEMP = YesPlease
@@ -864,6 +870,13 @@ endif
864870
-include config.mak.autogen
865871
-include config.mak
866872

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+
867880
ifeq ($(uname_S),Darwin)
868881
ifndef NO_FINK
869882
ifeq ($(shell test -d /sw/lib && echo y),y)
@@ -1265,6 +1278,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
12651278
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
12661279
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
12671280
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
1281+
-e '/^# @@PATH@@/$(BROKEN_PATH_FIX)' \
12681282
$@.sh >$@+ && \
12691283
chmod +x $@+ && \
12701284
mv $@+ $@

git-sh-setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# exporting it.
1212
unset CDPATH
1313

14+
# @@PATH@@:$PATH
15+
1416
die() {
1517
echo >&2 "$@"
1618
exit 1

0 commit comments

Comments
 (0)