]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
dist-xz, dist-bzip2: don't hard-code -9, honor envvar settings
authorJim Meyering <meyering@redhat.com>
Fri, 9 Dec 2011 22:17:18 +0000 (23:17 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 9 Dec 2011 23:25:46 +0000 (00:25 +0100)
Before the present change, automake-generated `dist-xz' rule used
a hard-coded `xz -9'.  That was a problem because on this front,
xz differs from gzip and bzip2.  While the latter two don't incur
any run-time decompression penalty for using a higher compression
level, specifying -9 with xz imposes a potentially fatal virtual
memory requirement on any client that wants to decompress your
tar.xz file.
People have complained that a tarball compressed with -9 cannot
be uncompressed in a low-memory environment (wrt-based embedded).
Hence, instead of defaulting to -9, which is useful only for very
large tarballs, it defaults to -e (equivalent to -6e).  This
limits the default memory requirements imposed on decompressors,
yet still gives very good compression ratios.

* lib/am/distdir.am (dist-xz): Do not hard-code xz's -9: that made
it impossible to override.  Actually don't default to -9, either,
since that induced inordinately large virtual memory usage when
merely decompressing.  Instead, use its XZ_OPT envvar, defaulting
to -e if not defined.  Suggested by Lasse Collin.
(dist, dist-all) [?XZ?]: Likewise
(dist-bzip2): Similarly, do not hard-code -9, but do continue to
use -9 by default.  Honor the BZIP2 envvar.
(dist, dist-all) [?BZIP2?]: Likewise
* NEWS: Update.
* doc/automake.texi (The Types of Distributions): Describe the
newly enabled environment variables.

This is inspired to commit v1.11-389-g6da46f3, with additional
changes to reflect that the xz compression level should default
to -e, not -9.

ChangeLog
Makefile.in
NEWS
doc/automake.texi
lib/am/distdir.am

index e13e833c889fb5062b9cf20da5c5bf5493507f7f..618ab020950e5ec8ac2f80bea39765dfe86043fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2011-12-09  Jim Meyering  <meyering@redhat.com>
+           Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       dist-xz, dist-bzip2: don't hard-code -9, honor envvar settings
+       Before the present change, automake-generated `dist-xz' rule used
+       a hard-coded `xz -9'.  That was a problem because on this front,
+       xz differs from gzip and bzip2.  While the latter two don't incur
+       any run-time decompression penalty for using a higher compression
+       level, specifying -9 with xz imposes a potentially fatal virtual
+       memory requirement on any client that wants to decompress your
+       tar.xz file.
+       People have complained that a tarball compressed with -9 cannot
+       be uncompressed in a low-memory environment (wrt-based embedded).
+       Hence, instead of defaulting to -9, which is useful only for very
+       large tarballs, it defaults to -e (equivalent to -6e).  This
+       limits the default memory requirements imposed on decompressors,
+       yet still gives very good compression ratios.
+       * lib/am/distdir.am (dist-xz): Do not hard-code xz's -9: that made
+       it impossible to override.  Actually don't default to -9, either,
+       since that induced inordinately large virtual memory usage when
+       merely decompressing.  Instead, use its XZ_OPT envvar, defaulting
+       to -e if not defined.  Suggested by Lasse Collin.
+       (dist, dist-all) [?XZ?]: Likewise
+       (dist-bzip2): Similarly, do not hard-code -9, but do continue to
+       use -9 by default.  Honor the BZIP2 envvar.
+       (dist, dist-all) [?BZIP2?]: Likewise
+       * NEWS: Update.
+       * doc/automake.texi (The Types of Distributions): Describe the
+       newly enabled environment variables.
+
 2011-12-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * NEWS: Fix typos, grammaros and suboptimal wording.
index 9a03035999c258ce018552a26c082df0af9269fc..e4756939b836f862443569821b62119145f07914 100644 (file)
@@ -671,7 +671,7 @@ dist-gzip: distdir
        tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
        $(am__remove_distdir)
 dist-bzip2: distdir
-       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
        $(am__remove_distdir)
 
 dist-lzma: distdir
@@ -679,7 +679,7 @@ dist-lzma: distdir
        $(am__remove_distdir)
 
 dist-xz: distdir
-       tardir=$(distdir) && $(am__tar) | xz -9 -c >$(distdir).tar.xz
+       tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
        $(am__remove_distdir)
 
 dist-tarZ: distdir
@@ -697,7 +697,7 @@ dist-zip: distdir
 
 dist dist-all: distdir
        tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
        $(am__remove_distdir)
 
 # This target untars the dist file and tries a VPATH configuration.  Then
diff --git a/NEWS b/NEWS
index d40dc261c7bd7b0469a510571d9b265106864848..790fabf78064c72e051449d91b4a847e106b80bf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,11 @@ New in 1.11.0a:
   - The `lzma' compression scheme and associated automake option `dist-lzma'
     is obsoleted by `xz' and `dist-xz' due to upstream changes.
 
+  - You may adjust the compression options used in dist-xz and dist-bzip2.
+    The default is now merely -e for xz, but still -9 for bzip;  you may
+    specify a different level via the XZ_OPT and BZIP2 envvars respectively.
+    E.g., "make dist-xz XZ_OPT=-7" or "make dist-xz BZIP2=-5"
+
   - The py-compile script now accepts empty arguments passed to the options
     `--destdir' and `--basedir', and complains about unrecognized options.
     Moreover, a non-option argument or a special `--' argument terminates
@@ -69,8 +74,6 @@ Bugs fixed in 1.11.0a:
     not used, `make' output no longer contains spurious backslash-only
     lines, thus once again matching what Automake did before 1.11.
 
-  - The `dist-xz' option now uses `xz -9' for maximum compression.
-
   - The AM_COND_IF macro also works if the shell expression for the conditional
     is no longer valid for the condition.
 
index f6039bb135dfd11393b26a98d434faa73e5c486c..a5f857d7f7d5439bf535918b5294f3a80caf2717 100644 (file)
@@ -8645,9 +8645,13 @@ Automake generates rules to provide archives of the project for
 distributions in various formats.  Their targets are:
 
 @table @asis
+@vindex BZIP2
 @item @code{dist-bzip2}
 Generate a bzip2 tar archive of the distribution.  bzip2 archives are
 frequently smaller than gzipped archives.
+By default, this rule makes @samp{bzip2} use a compression option of
+@option{-9}.  To make it use a different one, set the @env{BZIP2}
+environment variable.  For example, @samp{make dist-bzip2 BZIP2=-7}.
 @trindex dist-bzip2
 
 @item @code{dist-gzip}
@@ -8665,10 +8669,16 @@ instead.
 Generate a shar archive of the distribution.
 @trindex dist-shar
 
+@vindex XZ_OPT
 @item @code{dist-xz}
 Generate an @samp{xz} tar archive of the distribution.  @command{xz}
 archives are frequently smaller than @command{bzip2}-compressed archives.
 The @samp{xz} format displaces the obsolete @samp{lzma} format.
+By default, this rule makes @samp{xz} use a compression option of
+@option{-e}.  To make it use a different one, set the @env{XZ_OPT}
+environment variable.  For example, run this command to use the
+default compression ratio, but with a progress indicator:
+@samp{make dist-xz XZ_OPT=-7e}.
 @trindex dist-xz
 
 @item @code{dist-zip}
index 41ff14afa2d669d24e7086fdc0b7946a00ab1bf6..f685ec1a2977ba23cdb40ff54ba643bc75a93a0e 100644 (file)
@@ -341,7 +341,7 @@ dist-gzip: distdir
 ?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2
 .PHONY: dist-bzip2
 dist-bzip2: distdir
-       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
        $(am__remove_distdir)
 
 ?LZMA?DIST_ARCHIVES += $(distdir).tar.lzma
@@ -353,7 +353,7 @@ dist-lzma: distdir
 ?XZ?DIST_ARCHIVES += $(distdir).tar.xz
 .PHONY: dist-xz
 dist-xz: distdir
-       tardir=$(distdir) && $(am__tar) | xz -9 -c >$(distdir).tar.xz
+       tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
        $(am__remove_distdir)
 
 ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
@@ -395,9 +395,9 @@ endif %?SUBDIRS%
 
 dist dist-all: distdir
 ?GZIP? tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-?BZIP2?        tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+?BZIP2?        tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
 ?LZMA? tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-?XZ?   tardir=$(distdir) && $(am__tar) | xz -9 -c >$(distdir).tar.xz
+?XZ?   tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
 ?COMPRESS?     tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
 ?SHAR? shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
 ?ZIP?  -rm -f $(distdir).zip