summaryrefslogtreecommitdiff
blob: 39c201aba6565670f97815b4fb5103a0985789b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
commit 749468ac63042820bc3da85ece5bed64b0c15d62
Author: Paul Eggert <eggert at>
Date:   Mon Mar 28 19:44:19 2016 -0700

    automake: port better to future gzip
    
    * lib/am/distdir.am (dist-gzip, dist-shar, distcheck):
    Port better to future versions of gzip, which are planned to
    deprecate the GZIP environment variable (Bug#20132).

diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index d4dd8cc9b..87c6730f5 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -309,6 +309,16 @@ endif %?TOPDIR_P%
 ## We order DIST_TARGETS by expected duration of the compressors,
 ## slowest first, for better parallelism in "make dist".  Do not
 ## reorder DIST_ARCHIVES, users may expect gzip to be first.
+##
+## Traditionally, gzip prepended the contents of the GZIP environment
+## variable to its arguments, and the commands below formerly used
+## this by invoking 'GZIP=$(GZIP_ENV) gzip'.  The GZIP environment
+## variable is now considered to be obsolescent, so the commands below
+## now use 'eval GZIP= gzip $(GZIP_ENV)' instead; this should work
+## with both older and newer gzip implementations.  The 'eval' is to
+## support makefile assignments like 'GZIP_ENV = "-9 -n"' that quote
+## the GZIP_ENV right-hand side because that was needed with the
+## former invocation pattern.
 
 if %?TOPDIR_P%
 
@@ -316,7 +326,7 @@ if %?TOPDIR_P%
 GZIP_ENV = --best
 .PHONY: dist-gzip
 dist-gzip: distdir
-	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
 	$(am__post_remove_distdir)
 
 ?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2
@@ -352,7 +362,7 @@ dist-shar: distdir
 	@echo WARNING: "Support for shar distribution archives is" \
 	               "deprecated." >&2
 	@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
-	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
 	$(am__post_remove_distdir)
 
 ?ZIP?DIST_ARCHIVES += $(distdir).zip
@@ -412,7 +422,7 @@ endif %?SUBDIRS%
 distcheck: dist
 	case '$(DIST_ARCHIVES)' in \
 	*.tar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
 	*.tar.bz2*) \
 	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
 	*.tar.lz*) \
@@ -422,7 +432,7 @@ distcheck: dist
 	*.tar.Z*) \
 	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
 	*.shar.gz*) \
-	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	  eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
 	*.zip*) \
 	  unzip $(distdir).zip ;;\
 	esac