@@ -335,6 +335,13 @@ all::
335
335
# when hardlinking a file to another name and unlinking the original file right
336
336
# away (some NTFS drivers seem to zero the contents in that scenario).
337
337
#
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
+ #
338
345
# Define NO_CROSS_DIRECTORY_HARDLINKS if you plan to distribute the installed
339
346
# programs as a tar, where bin/ and libexec/ might be on different file systems.
340
347
#
@@ -499,8 +506,7 @@ ARFLAGS = rcs
499
506
# This can help installing the suite in a relocatable way.
500
507
501
508
prefix = $(HOME )
502
- bindir_relative = bin
503
- bindir = $(prefix ) /$(bindir_relative )
509
+ bindir = $(prefix ) /bin
504
510
mandir = $(prefix ) /share/man
505
511
infodir = $(prefix ) /share/info
506
512
gitexecdir = libexec/git-core
@@ -517,6 +523,7 @@ lib = lib
517
523
# DESTDIR =
518
524
pathsep = :
519
525
526
+ bindir_relative = $(patsubst $(prefix ) /% ,% ,$(bindir ) )
520
527
mandir_relative = $(patsubst $(prefix ) /% ,% ,$(mandir ) )
521
528
infodir_relative = $(patsubst $(prefix ) /% ,% ,$(infodir ) )
522
529
gitexecdir_relative = $(patsubst $(prefix ) /% ,% ,$(gitexecdir ) )
@@ -1788,6 +1795,7 @@ perllibdir_SQ = $(subst ','\'',$(perllibdir))
1788
1795
localedir_SQ = $(subst ','\'',$(localedir ) )
1789
1796
localedir_relative_SQ = $(subst ','\'',$(localedir_relative ) )
1790
1797
gitexecdir_SQ = $(subst ','\'',$(gitexecdir ) )
1798
+ gitexecdir_relative_SQ = $(subst ','\'',$(gitexecdir_relative ) )
1791
1799
template_dir_SQ = $(subst ','\'',$(template_dir ) )
1792
1800
htmldir_relative_SQ = $(subst ','\'',$(htmldir_relative ) )
1793
1801
prefix_SQ = $(subst ','\'',$(prefix ) )
@@ -2738,35 +2746,44 @@ endif
2738
2746
2739
2747
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
2740
2748
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
2749
+ destdir_from_execdir_SQ=$$(echo '$(gitexecdir_relative_SQ)' | sed -e 's|[^/][^/]*|..|g') && \
2741
2750
{ test "$$bindir/" = "$$execdir/" || \
2742
2751
for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
2743
2752
$(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; } \
2747
2758
done; \
2748
2759
} && \
2749
2760
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
2750
2761
$(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; } \
2755
2768
done && \
2756
2769
for p in $(BUILT_INS); do \
2757
2770
$(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; } \
2762
2777
done && \
2763
2778
remote_curl_aliases="$(REMOTE_CURL_ALIASES)" && \
2764
2779
for p in $$remote_curl_aliases; do \
2765
2780
$(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; } \
2770
2787
done && \
2771
2788
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
2772
2789
0 commit comments