X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=templates%2FMakefile;h=d22a71a3999b3dc0e99f5e36053447b33f967bd7;hb=ee459baa5ce0a144e013a4995fd5be96bbecd05e;hp=a12c6e214e65d39136b1ed41a8ff0ea25e28f91b;hpb=77f143bf3e218857ec8e5244d7e862e8e0c1a041;p=git.git diff --git a/templates/Makefile b/templates/Makefile index a12c6e214..d22a71a39 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -11,6 +11,16 @@ prefix ?= $(HOME) template_instdir ?= $(prefix)/share/git-core/templates # DESTDIR= +ifndef SHELL_PATH + SHELL_PATH = /bin/sh +endif +ifndef PERL_PATH + PERL_PATH = perl +endif + +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) +PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) + # Shell quote (do not use $(call) to accommodate ancient setups); DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) template_instdir_SQ = $(subst ','\'',$(template_instdir)) @@ -33,8 +43,11 @@ boilerplates.made : $(bpsrc) case "$$boilerplate" in \ *--) continue;; \ esac && \ - cp $$boilerplate blt/$$dst && \ - if test -x "blt/$$dst"; then rx=rx; else rx=r; fi && \ + sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ + -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \ + blt/$$dst && \ + if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \ chmod a+$$rx "blt/$$dst" || exit; \ done && \ date >$@ @@ -50,4 +63,4 @@ clean: install: all $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(template_instdir_SQ)' (cd blt && $(TAR) cf - .) | \ - (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xfo -) + (cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR) xof -)