@@ -335,6 +335,13 @@ all::
335335# when hardlinking a file to another name and unlinking the original file right
336336# away (some NTFS drivers seem to zero the contents in that scenario).
337337#
338+ # Define INSTALL_SYMLINKS if you prefer to have everything that can be
339+ # symlinked between bin/ and libexec/ to use relative symlinks between
340+ # the two. This option overrides NO_CROSS_DIRECTORY_HARDLINKS and
341+ # NO_INSTALL_HARDLINKS which will also use symlinking by indirection
342+ # within the same directory in some cases, INSTALL_SYMLINKS will
343+ # always symlink to the final target directly.
344+ #
338345# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
339346# programs as a tar, where bin/ and libexec/ might be on different file systems.
340347#
@@ -499,8 +506,7 @@ ARFLAGS = rcs
499506# This can help installing the suite in a relocatable way.
500507
501508prefix = $(HOME )
502- bindir_relative = bin
503- bindir = $(prefix ) /$(bindir_relative )
509+ bindir = $(prefix ) /bin
504510mandir = $(prefix ) /share/man
505511infodir = $(prefix ) /share/info
506512gitexecdir = libexec/git-core
@@ -517,6 +523,7 @@ lib = lib
517523# DESTDIR =
518524pathsep = :
519525
526+ bindir_relative = $(patsubst $(prefix ) /% ,% ,$(bindir ) )
520527mandir_relative = $(patsubst $(prefix ) /% ,% ,$(mandir ) )
521528infodir_relative = $(patsubst $(prefix ) /% ,% ,$(infodir ) )
522529gitexecdir_relative = $(patsubst $(prefix ) /% ,% ,$(gitexecdir ) )
@@ -1788,6 +1795,7 @@ perllibdir_SQ = $(subst ','\'',$(perllibdir))
17881795localedir_SQ = $(subst ','\'',$(localedir ) )
17891796localedir_relative_SQ = $(subst ','\'',$(localedir_relative ) )
17901797gitexecdir_SQ = $(subst ','\'',$(gitexecdir ) )
1798+ gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative ) )
17911799template_dir_SQ = $(subst ','\'',$(template_dir ) )
17921800htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative ) )
17931801prefix_SQ = $(subst ','\'',$(prefix ) )
@@ -2738,35 +2746,44 @@ endif
27382746
27392747 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
27402748 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
2749+ destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
27412750 { test "$$bindir/" = "$$execdir/" || \
27422751 for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
27432752 $(RM) "$$execdir/$$p" && \
2744- test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
2745- ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
2746- cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
2753+ test -n "$(INSTALL_SYMLINKS)" && \
2754+ ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/$$p" "$$execdir/$$p" || \
2755+ { test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
2756+ ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
2757+ cp "$$bindir/$$p" "$$execdir/$$p" || exit; } \
27472758 done; \
27482759 } && \
27492760 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
27502761 $(RM) "$$bindir/$$p" && \
2751- test -z "$(NO_INSTALL_HARDLINKS)" && \
2752- ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2753- ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2754- cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
2762+ test -n "$(INSTALL_SYMLINKS)" && \
2763+ ln -s "git$X" "$$bindir/$$p" || \
2764+ { test -z "$(NO_INSTALL_HARDLINKS)" && \
2765+ ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
2766+ ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
2767+ cp "$$bindir/git$X" "$$bindir/$$p" || exit; } \
27552768 done && \
27562769 for p in $(BUILT_INS); do \
27572770 $(RM) "$$execdir/$$p" && \
2758- test -z "$(NO_INSTALL_HARDLINKS)" && \
2759- ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2760- ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2761- cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
2771+ test -n "$(INSTALL_SYMLINKS)" && \
2772+ ln -s "$$destdir_from_execdir_SQ/$(bindir_relative_SQ)/git$X" "$$execdir/$$p" || \
2773+ { test -z "$(NO_INSTALL_HARDLINKS)" && \
2774+ ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
2775+ ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
2776+ cp "$$execdir/git$X" "$$execdir/$$p" || exit; } \
27622777 done && \
27632778 remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
27642779 for p in $$remote_curl_aliases; do \
27652780 $(RM) "$$execdir/$$p" && \
2766- test -z "$(NO_INSTALL_HARDLINKS)" && \
2767- ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2768- ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2769- cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
2781+ test -n "$(INSTALL_SYMLINKS)" && \
2782+ ln -s "git-remote-http$X" "$$execdir/$$p" || \
2783+ { test -z "$(NO_INSTALL_HARDLINKS)" && \
2784+ ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2785+ ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
2786+ cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; } \
27702787 done && \
27712788 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
27722789
0 commit comments