[OpenWrt-Devel] [PATCH v2 2/4] build: add zstd support to pack/unpack functions

Matthias Schiffer mschiffer at universe-factory.net
Sun May 17 07:51:41 EDT 2020


Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 include/download.mk | 1 +
 include/unpack.mk   | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/include/download.mk b/include/download.mk
index 14d68bf8f5e9..9c8ada052b04 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -50,6 +50,7 @@ endef
 dl_pack/bz2=bzip2 -c > $(1)
 dl_pack/gz=gzip -nc > $(1)
 dl_pack/xz=xz -zc -7e > $(1)
+dl_pack/zst=zstd -T0 --ultra -20 -c > $(1)
 dl_pack/unknown=$(error ERROR: Unknown pack format for file $(1))
 define dl_pack
 	$(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown))
diff --git a/include/unpack.mk b/include/unpack.mk
index 6141b1c7225d..5bb27d41c9a9 100644
--- a/include/unpack.mk
+++ b/include/unpack.mk
@@ -31,6 +31,10 @@ ifeq ($(strip $(UNPACK_CMD)),)
       EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
       DECOMPRESS_CMD:=xzcat $(DL_DIR)/$(PKG_SOURCE) |
     endif
+    ifeq (zst,$(EXT))
+      EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=))
+      DECOMPRESS_CMD:=zstdcat $(DL_DIR)/$(PKG_SOURCE) |
+    endif
     ifeq ($(filter tgz tbz tbz2 txz,$(EXT1)),$(EXT1))
       EXT:=tar
     endif
-- 
2.26.2


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list