automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] dist: add dist-zstd option


From: Giuseppe Scrivano
Subject: [PATCH] dist: add dist-zstd option
Date: Fri, 4 Oct 2019 16:39:24 +0200

add support for using the zstd compression algorithm.

* bin/automake.in (handle_dist): add zstd to the list of known dist-
suffixes.
(preprocess_file): transform ZSTD to option dist-zstd.

* doc/automake.texi: document the new option.

* lib/Automake/Options.pm (_is_valid_easy_option): add dist-zstd.

* lib/am/distdir.am (dist-zstd): new rule.
(?ZSTD?DIST_TARGETS): add definition.
(distcheck): test *.tar.zstd*.

* NEWS: Mention the change

Signed-off-by: Giuseppe Scrivano <address@hidden>
---
 NEWS                    | 5 +++++
 bin/automake.in         | 3 ++-
 doc/automake.texi       | 7 +++++++
 lib/Automake/Options.pm | 1 +
 lib/am/distdir.am       | 9 +++++++++
 5 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 8bb57133f..2f5102d53 100644
--- a/NEWS
+++ b/NEWS
@@ -64,6 +64,11 @@
 
 New in ?.?.?:
 
+* New features added
+
+  - the `zstd' compression scheme and associate automake option `dist-zstd'
+    are added.
+
 * Miscellaneous changes
 
   - automake no longer requires a @setfilename in each .texi file
diff --git a/bin/automake.in b/bin/automake.in
index 06f4ee9b2..67a7a9578 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3806,7 +3806,7 @@ sub handle_dist ()
     {
       my $archive_defined = option 'no-dist-gzip' ? 0 : 1;
       $archive_defined ||=
-       grep { option "dist-$_" } qw(shar zip tarZ bzip2 lzip xz);
+       grep { option "dist-$_" } qw(shar zip tarZ bzip2 lzip xz zstd);
       error (option 'no-dist-gzip',
             "no-dist-gzip specified but no dist-* specified,\n"
             . "at least one archive format must be enabled")
@@ -6788,6 +6788,7 @@ sub preprocess_file
                 'GZIP'        =>  ! option 'no-dist-gzip',
                 'SHAR'        => !! option 'dist-shar',
                 'ZIP'         => !! option 'dist-zip',
+                'ZSTD'        => !! option 'dist-zstd',
 
                 'INSTALL-INFO' =>  ! option 'no-installinfo',
                 'INSTALL-MAN'  =>  ! option 'no-installman',
diff --git a/doc/automake.texi b/doc/automake.texi
index 702f76e2e..1552e0e21 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8750,6 +8750,13 @@ It and the corresponding functionality will be removed 
altogether
 in Automake 2.0.
 @trindex dist-shar
 
+@vindex ZSTD_OPT
+@item @code{dist-zstd}
+Generate an @samp{zstd} tar archive of the distribution.  By default, this
+rule makes @samp{zstd} use a compression option of @option{--ultra -22}.  To
+make it use a different one, set the @env{ZSTD_OPT} environment variable.
+@trindex dist-zstd
+
 @end table
 
 The rule @code{dist} (and its historical synonym @code{dist-all})
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 8a1adc9ff..ff4568f14 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -277,6 +277,7 @@ sub _is_valid_easy_option ($)
     dist-lzip
     dist-xz
     dist-zip
+    dist-zstd
     info-in-builddir
     no-define
     no-dependencies
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 47974922f..603b78a74 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -350,6 +350,12 @@ dist-xz: distdir
        tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c 
>$(distdir).tar.xz
        $(am__post_remove_distdir)
 
+?ZSTD?DIST_ARCHIVES += $(distdir).tar.zstd
+.PHONY: dist-zstd
+dist-zstd: distdir
+       tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_OPT---ultra -22} 
>$(distdir).tar.zstd
+       $(am__post_remove_distdir)
+
 ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
 .PHONY: dist-tarZ
 dist-tarZ: distdir
@@ -381,6 +387,7 @@ dist-zip: distdir
 ?BZIP2?DIST_TARGETS += dist-bzip2
 ?GZIP?DIST_TARGETS += dist-gzip
 ?ZIP?DIST_TARGETS += dist-zip
+?ZSTD?DIST_TARGETS += dist-zstd
 ?COMPRESS?DIST_TARGETS += dist-tarZ
 
 endif %?TOPDIR_P%
@@ -438,6 +445,8 @@ distcheck: dist
          eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
        *.zip*) \
          unzip $(distdir).zip ;;\
+       *.tar.zstd*) \
+         zstd -d $(distdir).tar.zstd | $(am__untar) ;;\
        esac
 ## Make the new source tree read-only.  Distributions ought to work in
 ## this case.  However, make the top-level directory writable so we
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]