diff options
author | schmonz <schmonz@pkgsrc.org> | 2022-01-06 10:19:11 +0000 |
---|---|---|
committer | schmonz <schmonz@pkgsrc.org> | 2022-01-06 10:19:11 +0000 |
commit | 5e7a6db7d42d2941936c89d1fa5888b858e46ee1 (patch) | |
tree | b899bcecdbf0574689311c3d8e8031c436e5ca8b /mk | |
parent | fa159e72a4858b5f1ff0813359ef07085a8f5b59 (diff) | |
download | pkgsrc-5e7a6db7d42d2941936c89d1fa5888b858e46ee1.tar.gz |
Extract .zst distfiles using archivers/zstd.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/extract/bsd.extract-vars.mk | 5 | ||||
-rwxr-xr-x | mk/extract/extract | 13 | ||||
-rw-r--r-- | mk/extract/extract.mk | 4 | ||||
-rw-r--r-- | mk/tools/defaults.mk | 3 | ||||
-rw-r--r-- | mk/tools/replace.mk | 12 |
5 files changed, 31 insertions, 6 deletions
diff --git a/mk/extract/bsd.extract-vars.mk b/mk/extract/bsd.extract-vars.mk index 99e14473f7a..2181d97dcff 100644 --- a/mk/extract/bsd.extract-vars.mk +++ b/mk/extract/bsd.extract-vars.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.extract-vars.mk,v 1.20 2020/03/20 17:16:34 rillig Exp $ +# $NetBSD: bsd.extract-vars.mk,v 1.21 2022/01/06 10:19:11 schmonz Exp $ # # This file configures how a package extracts its distfiles after # downloading them. @@ -107,4 +107,7 @@ USE_TOOLS+= gem .if !empty(EXTRACT_ONLY:M*.7z) USE_TOOLS+= 7za .endif +.if !empty(EXTRACT_ONLY:M*.zst) +USE_TOOLS+= zstd +.endif diff --git a/mk/extract/extract b/mk/extract/extract index 77e9e31e755..98f3954a26c 100755 --- a/mk/extract/extract +++ b/mk/extract/extract @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: extract,v 1.19 2019/08/02 11:48:17 nia Exp $ +# $NetBSD: extract,v 1.20 2022/01/06 10:19:11 schmonz Exp $ # # Copyright (c) 2006 The NetBSD Foundation, Inc. # All rights reserved. @@ -84,6 +84,7 @@ # EXTRACT_OPTS_RPM # EXTRACT_OPTS_TAR # EXTRACT_OPTS_ZIP +# EXTRACT_OPTS_ZSTD # EXTRACT_OPTS_ZOO # These variables set additional arguments passed to the # underlying extraction tool to unpack their respective @@ -114,6 +115,7 @@ set -u # treat undefined variables as errors : ${UNZOO:=unzoo} : ${P7ZA:="7za x"} : ${P7ZA_SO:="7za x -so"} +: ${ZSTD:="zstd"} : ${TMPDIR:=/tmp} @@ -202,7 +204,7 @@ esac # Derive the format of the archive based on the file extension. case "$distfile" in -*.tar.gz|*.tgz|*-tar.gz|*_tar.gz|*.tar.bz2|*.txz|*.tbz|*.tbz2|*.tar.lz|*.tar.lzma|*.tar.xz|*.tar.Z|*.tar.z|*.tar|*.tar.bz|*.tar.7z|*.crate) +*.tar.gz|*.tgz|*-tar.gz|*_tar.gz|*.tar.bz2|*.txz|*.tbz|*.tbz2|*.tar.lz|*.tar.lzma|*.tar.xz|*.tar.Z|*.tar.z|*.tar|*.tar.bz|*.tar.7z|*.tar.zst|*.crate) _format=tar ;; *.cpio|*.cpio.gz|*.cpio.bz2) _format=cpio ;; @@ -218,6 +220,7 @@ case "$distfile" in *.bin|*.sh) _format=jre-bin ;; *.gem) _format=gem ;; *.7z) _format=7z ;; +*.zst) _format=zstd ;; *) _format=none ;; esac ${TEST} -n "$format" || format="$_format" @@ -345,6 +348,12 @@ gem) ${P7ZA} "$distfile" ;; +zst) + ${ECHO} 1>&2 "$self: SCHMONZ: looks like $format is .zst" + : ${EXTRACT_OPTS_ZSTD=} + ${ZSTD} -d ${EXTRACT_OPTS_ZSTD} "$distfile" ${1+"$@"} + ;; + none) # By default, copy the distfile over to the current working directory. ${CP} "$distfile" . diff --git a/mk/extract/extract.mk b/mk/extract/extract.mk index f263efb2ff7..74f669814f6 100644 --- a/mk/extract/extract.mk +++ b/mk/extract/extract.mk @@ -1,4 +1,4 @@ -# $NetBSD: extract.mk,v 1.42 2021/03/30 16:47:03 ryoon Exp $ +# $NetBSD: extract.mk,v 1.43 2022/01/06 10:19:11 schmonz Exp $ # # The following variables may be set by the package Makefile and # specify how extraction happens: @@ -166,6 +166,7 @@ _EXTRACT_ENV+= ${EXTRACT_OPTS_RAR:D EXTRACT_OPTS_RAR=${EXTRACT_OPTS_RAR:Q}} _EXTRACT_ENV+= ${EXTRACT_OPTS_RPM:D EXTRACT_OPTS_LHA=${EXTRACT_OPTS_RPM:Q}} _EXTRACT_ENV+= ${EXTRACT_OPTS_TAR:D EXTRACT_OPTS_TAR=${EXTRACT_OPTS_TAR:Q}} _EXTRACT_ENV+= ${EXTRACT_OPTS_ZIP:D EXTRACT_OPTS_ZIP=${EXTRACT_OPTS_ZIP:Q}} +_EXTRACT_ENV+= ${EXTRACT_OPTS_ZSTD:D EXTRACT_OPTS_ZSTD=${EXTRACT_OPTS_ZSTD:Q}} _EXTRACT_ENV+= ${EXTRACT_OPTS_ZOO:D EXTRACT_OPTS_ZOO=${EXTRACT_OPTS_ZOO:Q}} _EXTRACT_ENV+= ${TOOLS_CMDLINE_BZCAT:D BZCAT=${TOOLS_CMDLINE_BZCAT:Q}} _EXTRACT_ENV+= ${TOOLS_CAT:D CAT=${TOOLS_CAT:Q}} @@ -185,6 +186,7 @@ _EXTRACT_ENV+= ${TOOLS_UNZIP_CMD:D UNZIP_CMD=${TOOLS_UNZIP_CMD:Q}} _EXTRACT_ENV+= ${TOOLS_UNZOO:D UNZOO=${TOOLS_UNZOO:Q}} _EXTRACT_ENV+= ${TOOLS_XZCAT:D XZCAT=${TOOLS_XZCAT:Q}} _EXTRACT_ENV+= ${TOOLS_7ZA:D P7ZA=${TOOLS_7ZA:Q}} +_EXTRACT_ENV+= ${TOOLS_ZSTD:D ZSTD=${TOOLS_ZSTD:Q}} _EXTRACT_ENV+= ${EXTRACT_ENV} .if !empty(EXTRACT_USING:Mbsdtar) diff --git a/mk/tools/defaults.mk b/mk/tools/defaults.mk index ab9e1136a18..201aa8fe38e 100644 --- a/mk/tools/defaults.mk +++ b/mk/tools/defaults.mk @@ -1,4 +1,4 @@ -# $NetBSD: defaults.mk,v 1.62 2018/08/22 20:48:37 maya Exp $ +# $NetBSD: defaults.mk,v 1.63 2022/01/06 10:19:11 schmonz Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -143,6 +143,7 @@ _TOOLS_VARNAME.xmkmf= XMKMF_CMD _TOOLS_VARNAME.xz= XZ _TOOLS_VARNAME.xzcat= XZCAT _TOOLS_VARNAME.yacc= YACC +_TOOLS_VARNAME.zstd= ZSTD ###################################################################### diff --git a/mk/tools/replace.mk b/mk/tools/replace.mk index 51f3e12697d..5c2ab7c61c2 100644 --- a/mk/tools/replace.mk +++ b/mk/tools/replace.mk @@ -1,4 +1,4 @@ -# $NetBSD: replace.mk,v 1.292 2021/07/19 09:55:04 triaxx Exp $ +# $NetBSD: replace.mk,v 1.293 2022/01/06 10:19:11 schmonz Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -203,6 +203,16 @@ _TOOLS_USE_PKGSRC.${_t_}?= yes # command, e.g., TOOLS_TBL, TOOLS_YACC, etc., provided that "TOOL" has # been associated with <tool>. # +.if !defined(TOOLS_IGNORE.zstd) && !empty(_USE_TOOLS:Mzstd) +. if !empty(PKGPATH:Marchivers/zstd) +MAKEFLAGS+= TOOLS_IGNORE.zstd= +. elif !empty(_TOOLS_USE_PKGSRC.zstd:M[yY][eE][sS]) +TOOLS_DEPENDS.zstd?= zstd>=1.5.0:../../archivers/zstd +TOOLS_CREATE+= zstd +TOOLS_PATH.zstd= ${LOCALBASE}/bin/zstd +. endif +.endif + .if !defined(TOOLS_IGNORE.7za) && !empty(_USE_TOOLS:M7za) . if !empty(PKGPATH:Marchivers/p7zip) MAKEFLAGS+= TOOLS_IGNORE.7za= |