Skip to content

Commit eec6ab5

Browse files
committed
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 <[email protected]>
1 parent 3a238e5 commit eec6ab5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,9 @@ quick-install-html:
29922992

29932993
### Maintainer's dist rules
29942994

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 =
29952998
GIT_TARNAME = git-$(GIT_VERSION)
29962999
dist: git-archive$(X) configure
29973000
./git-archive --format=tar \
@@ -3000,7 +3003,7 @@ dist: git-archive$(X) configure
30003003
@cp configure $(GIT_TARNAME)
30013004
@echo $(GIT_VERSION) > $(GIT_TARNAME)/version
30023005
@$(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) \
30043007
$(GIT_TARNAME)/configure \
30053008
$(GIT_TARNAME)/version \
30063009
$(GIT_TARNAME)/git-gui/version
@@ -3014,7 +3017,7 @@ ifdef DC_SHA1_SUBMODULE
30143017
$(GIT_TARNAME)/sha1collisiondetection/lib/
30153018
@cp sha1collisiondetection/lib/ubc_check.[ch] \
30163019
$(GIT_TARNAME)/sha1collisiondetection/lib/
3017-
$(TAR) rf $(GIT_TARNAME).tar \
3020+
$(TAR) rf $(GIT_TARNAME).tar $(TAR_DIST_EXTRA_OPTS) \
30183021
$(GIT_TARNAME)/sha1collisiondetection/LICENSE.txt \
30193022
$(GIT_TARNAME)/sha1collisiondetection/lib/sha1.[ch] \
30203023
$(GIT_TARNAME)/sha1collisiondetection/lib/ubc_check.[ch]
@@ -3048,7 +3051,7 @@ dist-doc:
30483051
$(RM) -r .doc-tmp-dir
30493052
mkdir .doc-tmp-dir
30503053
$(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) .
30523055
gzip -n -9 -f $(htmldocs).tar
30533056
:
30543057
$(RM) -r .doc-tmp-dir
@@ -3058,7 +3061,7 @@ dist-doc:
30583061
man5dir=../.doc-tmp-dir/man5 \
30593062
man7dir=../.doc-tmp-dir/man7 \
30603063
install
3061-
cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar .
3064+
cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar $(TAR_DIST_EXTRA_OPTS) .
30623065
gzip -n -9 -f $(manpages).tar
30633066
$(RM) -r .doc-tmp-dir
30643067

0 commit comments

Comments
 (0)