Makefile: allow extra tweaking of distribution tarball
The maintainer's dist rules are used to produce distribution tarballs. They use "$(TAR) cf" and "$(TAR) rf" to produce archives out of a freshly created local installation area, which means that the built product can be affected by maintainer's umask and other local environment. Implementations of "tar" have ways (implementation specific, unfortunately) to force permission bits and other stuff to allow the user to hide these effects coming from the local environment. Teach our Makefile to allow the maintainer to tweak the invocation of the $(TAR) commands by setting TAR_DIST_EXTRA_OPTS. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 9, 2020 at 11:53 UTC
eec6ab5423ea288bf9f75f021aeb27905337a089
1 file changed
+7
-4
Makefile
+7
-4
@@ -2992,6 +2992,9 @@ quick-install-html:
2992
2993
### Maintainer's dist rules
2994
2995
+# Allow tweaking to hide local environment effects, like perm bits.
2996
+# With GNU tar, "--mode=u+rwX,og+rX,og-w" would be a good idea, for example.
2997
+TAR_DIST_EXTRA_OPTS =
2998
GIT_TARNAME = git-$(GIT_VERSION)
2999
dist: git-archive$(X) configure
3000
./git-archive --format=tar \
@@ -3000,7 +3003,7 @@ dist: git-archive$(X) configure
3003
@cp configure $(GIT_TARNAME)
3004
@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
3005
@$(MAKE) -C git-gui TARDIR=../$(GIT_TARNAME)/git-gui dist-version
3003
- $(TAR) rf $(GIT_TARNAME).tar \
3006
+ $(TAR) rf $(GIT_TARNAME).tar $(TAR_DIST_EXTRA_OPTS) \
3007
$(GIT_TARNAME)/configure \
3008
$(GIT_TARNAME)/version \
3009
$(GIT_TARNAME)/git-gui/version
@@ -3014,7 +3017,7 @@ ifdef DC_SHA1_SUBMODULE
3017
$(GIT_TARNAME)/sha1collisiondetection/lib/
3018
@cp sha1collisiondetection/lib/ubc_check.[ch] \
3019
$(GIT_TARNAME)/sha1collisiondetection/lib/
3017
- $(TAR) rf $(GIT_TARNAME).tar \
3020
+ $(TAR) rf $(GIT_TARNAME).tar $(TAR_DIST_EXTRA_OPTS) \
3021
$(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
3022
$(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
3023
$(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
@@ -3048,7 +3051,7 @@ dist-doc:
3051
$(RM) -r .doc-tmp-dir
3052
mkdir .doc-tmp-dir
3053
$(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc
3051
- cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar .
3054
+ cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar $(TAR_DIST_EXTRA_OPTS) .
3055
gzip -n -9 -f $(htmldocs).tar
3056
:
3057
$(RM) -r .doc-tmp-dir
@@ -3058,7 +3061,7 @@ dist-doc:
3061
man5dir=../.doc-tmp-dir/man5 \
3062
man7dir=../.doc-tmp-dir/man7 \
3063
install
3061
- cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
3064
+ cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar $(TAR_DIST_EXTRA_OPTS) .
3065
gzip -n -9 -f $(manpages).tar
3066
$(RM) -r .doc-tmp-dir
3067