diff mbox series

[2/4] Define TAR_CF and TAR_XF variables in Makefile

Message ID 22f8f3e37a18263d890307701903dc18c98aa54b.1596675905.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Fit the building tools to Plan 9 environment | expand

Commit Message

Linus Arver via GitGitGadget Aug. 6, 2020, 1:05 a.m. UTC
From: lufia <lufia@lufia.org>

Plan 9's tar(1) don't support o option.
So I changed Makefiles to replace tar commands if needed.

Signed-off-by: lufia <lufia@lufia.org>
---
 Makefile           | 14 ++++++++------
 templates/Makefile |  6 ++++--
 2 files changed, 12 insertions(+), 8 deletions(-)

Comments

Junio C Hamano Aug. 6, 2020, 5:50 p.m. UTC | #1
"lufia via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: lufia <lufia@lufia.org>

See Documentation/SubmittingPatches[[real-name]].

> Plan 9's tar(1) don't support o option.
> So I changed Makefiles to replace tar commands if needed.

There is a big gap/leap between these two sentences.  The first
sentence might justify TAR_XF but it does not explain why TAR_CF
is needed at all.  Also there is "$(TAR) czf" that is left without
getting turned into $(TAR_CF)z.

Are there still remaining uses of $(TAR) after applying this patch?
If with a different justification, a patch that abstracts our use of
"tar" as an archiving tool into different use cases and give one
Makefile macro to each of them with more meaningful names might be
more palatable.  E.g. instead of TAR_CF that abstracts only the "tar
cf" part, make "take everything in the current directory and send an
archive of it to the standard output", i.e. "tar cf - .", into a
Makefile macro, with matching "take an archive from the standard
input and extract it to the current directory", i.e. "tar xf -", as
a matching Makefile macro, perhaps---that way people without a
working "tar" might be able to use zip, cpio or pax (or a script
written around them) as an alternative "archiving tool", for
example.

	Side note.  The above would probably be a huge undertaking
	and I am not suggesting it as a serious counterproposal.

A more plausible alternative is to just touch "$(TAR) xof -" and
replace it with $(TAR_XOF) or even $(EXTRACT_TARBALL_AS_MYSELF)
while leaving $(TAR_CF) alone.  That _might_ be palatable.

I dunno.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 372139f1f2..e222241509 100644
--- a/Makefile
+++ b/Makefile
@@ -547,6 +547,8 @@  AR = ar
 RM = rm -f
 DIFF = diff
 TAR = tar
+TAR_CF = $(TAR) cf
+TAR_XF = $(TAR) xof
 FIND = find
 INSTALL = install
 TCL_PATH = tclsh
@@ -2926,13 +2928,13 @@  endif
 	$(INSTALL) -m 644 mergetools/* '$(DESTDIR_SQ)$(mergetools_instdir_SQ)'
 ifndef NO_GETTEXT
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(localedir_SQ)'
-	(cd po/build/locale && $(TAR) cf - .) | \
-	(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR) xof -)
+	(cd po/build/locale && $(TAR_CF) - .) | \
+	(cd '$(DESTDIR_SQ)$(localedir_SQ)' && umask 022 && $(TAR_XF) -)
 endif
 ifndef NO_PERL
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perllibdir_SQ)'
-	(cd perl/build/lib && $(TAR) cf - .) | \
-	(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR) xof -)
+	(cd perl/build/lib && $(TAR_CF) - .) | \
+	(cd '$(DESTDIR_SQ)$(perllibdir_SQ)' && umask 022 && $(TAR_XF) -)
 	$(MAKE) -C gitweb install
 endif
 ifndef NO_TCLTK
@@ -2999,8 +3001,8 @@  install-man: install-man-perl
 
 install-man-perl: man-perl
 	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(mandir_SQ)/man3'
-	(cd perl/build/man/man3 && $(TAR) cf - .) | \
-	(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR) xof -)
+	(cd perl/build/man/man3 && $(TAR_CF) - .) | \
+	(cd '$(DESTDIR_SQ)$(mandir_SQ)/man3' && umask 022 && $(TAR_XF) -)
 
 install-html:
 	$(MAKE) -C Documentation install-html
diff --git a/templates/Makefile b/templates/Makefile
index d22a71a399..eddc07effb 100644
--- a/templates/Makefile
+++ b/templates/Makefile
@@ -6,6 +6,8 @@  endif
 
 INSTALL ?= install
 TAR ?= tar
+TAR_CF ?= tar cf
+TAR_XF ?= tar xof
 RM ?= rm -f
 prefix ?= $(HOME)
 template_instdir ?= $(prefix)/share/git-core/templates
@@ -62,5 +64,5 @@  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) xof -)
+	(cd blt && $(TAR_CF) - .) | \
+	(cd '$(DESTDIR_SQ)$(template_instdir_SQ)' && umask 022 && $(TAR_XF) -)