[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] dist-xz, dist-bzip2: don't hard-code -9: honor envvar settings
From: |
Jim Meyering |
Subject: |
[PATCH] dist-xz, dist-bzip2: don't hard-code -9: honor envvar settings |
Date: |
Fri, 09 Dec 2011 22:18:54 +0100 |
Today I noticed that automake-generated Makefile's dist-xz rule
used a hard-coded xz -9. That is a problem because on this front, xz
differs from gzip and bzip2. While the latter two incur no run-time
*decompression* penalty for using a higher compression level, with xz
if you specify -9, that 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.
>From 786d9b3e4ff4831dfea00b1010d24d23b399316e Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 2 Oct 2010 22:30:02 +0200
Subject: [PATCH] dist-xz, dist-bzip2: don't hard-code -9: honor envvar
settings
This is a cherry-pick of commit 6da46f31, with additional changes to
reflect that the xz compression level should default to -e, not -9.
* 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-bzip2): Similarly, do not hard-code -9, but do continue to
use -9 by default. Honor the BZIP2 envvar.
* NEWS (Miscellaneous changes): Mention it.
* doc/automake.texi (The Types of Distributions): Describe the
newly enabled environment variables.
---
ChangeLog | 13 +++++++++++++
NEWS | 5 +++++
doc/automake.texi | 9 +++++++++
lib/am/distdir.am | 4 ++--
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1aba97a..41fa3bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-05 Jim Meyering <address@hidden>
+
+ dist-xz, dist-bzip2: don't hard-code -9: honor envvar settings
+ * lib/am/distdir.am (dist-xz): Do not hard-code xz's -9: that
+ made it impossible to override. Instead, use its XZ_OPT envvar,
+ defaulting to -9 if not defined. Thus no change in behavior
+ when XZ_OPT is not set, and now, this rule honors the setting
+ of that envvar when it is set. Suggested by Lasse Collin.
+ (dist-bzip2): Likewise for it's corresponding envvar: BZIP2.
+ * NEWS (Miscellaneous changes): Mention it.
+ * doc/automake.texi (The Types of Distributions): Describe the
+ newly enabled environment variables.
+
2011-12-07 Stefano Lattarini <address@hidden>
maint: sync auxiliary files from upstream
diff --git a/NEWS b/NEWS
index 6c85e1e..b2b5fb7 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,11 @@ New in 1.11.1a:
- 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 `compile' script now converts some options for MSVC for a better
user experience. Similarly, the new `ar-lib' script wraps Microsoft lib.
diff --git a/doc/automake.texi b/doc/automake.texi
index 783463c..9797d92 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8674,9 +8674,13 @@ The Types of Distributions
distributions in various formats. Their targets are:
@table @asis
address@hidden 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}
@@ -8694,10 +8698,15 @@ The Types of Distributions
Generate a shar archive of the distribution.
@trindex dist-shar
address@hidden 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{-9}.
+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}
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 41ff14a..65cb668 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -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
--
1.7.8.110.g4cb5d1
- [PATCH] dist-xz, dist-bzip2: don't hard-code -9: honor envvar settings,
Jim Meyering <=