Skip to contentSkip to conversation

zstd: enable host/taget libzstd support

PATCH New Peter Seiderer 2 participants 6 messages Apr 7, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 zstd: enable host/taget libzstd support

---
 package/zstd/zstd.mk | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
package/zstd/zstd.mk +20 -1
index c0fa88026c..0c489014be 100644
@@ -6,6 +6,7 @@
 
 ZSTD_VERSION = v1.3.3
 ZSTD_SITE = $(call github,facebook,zstd,$(ZSTD_VERSION))
+ZSTD_INSTALL_STAGING = YES
 ZSTD_LICENSE = BSD-3-Clause or GPL-2.0
 ZSTD_LICENSE_FILES = LICENSE COPYING
 
@@ -36,14 +37,32 @@ else
 ZSTD_OPTS += HAVE_LZ4=0
 endif
 
+define HOST_ZSTD_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D) lib
+endef
+
 define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D) zstd
+		-C $(@D) lib zstd
+endef
+
+define HOST_ZSTD_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D)/lib install
+endef
+
+define ZSTD_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib install
 endef
 
 define ZSTD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib install
 endef
 
 $(eval $(generic-package))
+$(eval $(host-generic-package))
Signature · 1 line
2.16.3
#1 lore raw

PATCH 2/3 squashfs: bump version to e38956b92f738518c29734399629e7cdb33072d3

- delete patch 0001-musl.patch (superseeded by upstream commit [1])
- add zstd support

[1] https://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git/commit/?id=a81678d6a698b8a016f9abac9f3d981281cc52eb

---
 package/squashfs/0001-musl.patch | 71 ----------------------------------------
 package/squashfs/Config.in       |  6 ++++
 package/squashfs/squashfs.hash   |  2 +-
 package/squashfs/squashfs.mk     | 14 ++++++--
 4 files changed, 18 insertions(+), 75 deletions(-)
 delete mode 100644 package/squashfs/0001-musl.patch
package/squashfs/0001-musl.patch deleted +0 -71
deleted file mode 100644
index 891b1717a2..0000000000
@@ -1,71 +0,0 @@
-Fix musl build
-
-Downloaded from
-http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
-and adjusted paths.
-
-Signed-off-by: Bernd Kuhls <[email protected]>
-
-Define FNM_EXTMATCH if not defined its glibc specific define
-include missing sys/stat.h for stat* function declarations
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <[email protected]>
-
-Index: squashfs-tools/action.c
-===================================================================
---- a/squashfs-tools.orig/action.c
-+++ b/squashfs-tools/action.c
-@@ -44,6 +44,10 @@
- #include "action.h"
- #include "error.h"
- 
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- /*
-  * code to parse actions
-  */
-Index: squashfs-tools/mksquashfs.c
-===================================================================
---- a/squashfs-tools.orig/mksquashfs.c
-+++ b/squashfs-tools/mksquashfs.c
-@@ -1286,6 +1286,10 @@ void write_dir(squashfs_inode *inode, st
- 		dir_size + 3, directory_block, directory_offset, NULL, NULL,
- 		dir, 0);
- 
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- #ifdef SQUASHFS_TRACE
- 	{
- 		unsigned char *dirp;
-Index: squashfs-tools/pseudo.c
-===================================================================
---- a/squashfs-tools.orig/pseudo.c
-+++ b/squashfs-tools/pseudo.c
-@@ -32,6 +32,7 @@
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/wait.h>
-+#include <sys/stat.h>
- #include <ctype.h>
- 
- #include "pseudo.h"
-Index: squashfs-tools/unsquashfs.c
-===================================================================
---- a/squashfs-tools.orig/unsquashfs.c
-+++ b/squashfs-tools/unsquashfs.c
-@@ -38,6 +38,10 @@
- #include <limits.h>
- #include <ctype.h>
- 
-+#ifndef FNM_EXTMATCH
-+#define FNM_EXTMATCH 0
-+#endif
-+
- struct cache *fragment_cache, *data_cache;
- struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
- pthread_t *thread, *inflator_thread;
package/squashfs/Config.in +6 -0
index 70c0fc9808..c16ebbf27f 100644
@@ -41,6 +41,12 @@ config BR2_PACKAGE_SQUASHFS_XZ
 	help
 	  Support XZ compression algorithm
 
+config BR2_PACKAGE_SQUASHFS_ZSTD
+	bool "zstd support"
+	select BR2_PACKAGE_ZSTD
+	help
+	  Support ZSTD compression algorithm
+
 endif
 
 comment "squashfs needs a toolchain w/ threads"
package/squashfs/squashfs.hash +1 -1
index 74fdb44354..82a650022c 100644
@@ -1,2 +1,2 @@
 # Locally computed
-sha256	2c49392816615b73bf5d6cdce9776cb66a01f5a1494b1d9af580667e32bab001  squashfs-3de1687d7432ea9b302c2db9521996f506c140a3.tar.gz
+sha256 bd0aa3011320b8ebee68aa406060de277bef16daf81bad5b9f70cbea6db1a779 squashfs-e38956b92f738518c29734399629e7cdb33072d3.tar.gz
package/squashfs/squashfs.mk +11 -3
index 9599d892b2..bec867d676 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SQUASHFS_VERSION = 3de1687d7432ea9b302c2db9521996f506c140a3
+SQUASHFS_VERSION = e38956b92f738518c29734399629e7cdb33072d3
 SQUASHFS_SITE = https://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git
 SQUASHFS_SITE_METHOD = git
 SQUASHFS_LICENSE = GPL-2.0+
@@ -46,7 +46,14 @@ else
 SQUASHFS_MAKE_ARGS += GZIP_SUPPORT=0
 endif
 
-HOST_SQUASHFS_DEPENDENCIES = host-zlib host-lz4 host-lzo host-xz
+ifeq ($(BR2_PACKAGE_SQUASHFS_ZSTD),y)
+SQUASHFS_DEPENDENCIES += zstd
+SQUASHFS_MAKE_ARGS += ZSTD_SUPPORT=1 COMP_DEFAULT=zstd
+else
+SQUASHFS_MAKE_ARGS += ZSTD_SUPPORT=0
+endif
+
+HOST_SQUASHFS_DEPENDENCIES = host-zlib host-lz4 host-lzo host-xz host-zstd
 
 HOST_SQUASHFS_MAKE_ARGS = \
 	XATTR_SUPPORT=1 \
@@ -54,7 +61,8 @@ HOST_SQUASHFS_MAKE_ARGS = \
 	GZIP_SUPPORT=1 \
 	LZ4_SUPPORT=1 \
 	LZO_SUPPORT=1 \
-	LZMA_XZ_SUPPORT=1
+	LZMA_XZ_SUPPORT=1 \
+	ZSTD_SUPPORT=1
 
 define SQUASHFS_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) \
Signature · 1 line
2.16.3
#2 lore raw

PATCH 2/3 squashfs: bump version to e38956b92f738518c29734399629e7cdb33072d3

Peter, All,

On 2018-04-07 20:19 +0200, Peter Seiderer spake thusly:

Quoted 2 lines

- delete patch 0001-musl.patch (superseeded by upstream commit [1])
- add zstd support

Again, this patch does two things;

- bump the version

- add zstd support

I believe that this should again be done with two patches, the first doing the bump (and forcibly disabling zstd in both host and target), and the second adding zstd support in both host and target.

Regards,
Yann E. MORIN.

Quoted 155 lines

[1] https://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git/commit/?id=a81678d6a698b8a016f9abac9f3d981281cc52eb

---
 package/squashfs/0001-musl.patch | 71 ----------------------------------------
 package/squashfs/Config.in       |  6 ++++
 package/squashfs/squashfs.hash   |  2 +-
 package/squashfs/squashfs.mk     | 14 ++++++--
 4 files changed, 18 insertions(+), 75 deletions(-)
 delete mode 100644 package/squashfs/0001-musl.patch
package/squashfs/0001-musl.patch deleted +0 -71
deleted file mode 100644
index 891b1717a2..0000000000
@@ -1,71 +0,0 @@
-Fix musl build
-
-Downloaded from
-http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-devtools/squashfs-tools/squashfs-tools/fix-compat.patch
-and adjusted paths.
-
-Signed-off-by: Bernd Kuhls <[email protected]>
-
-Define FNM_EXTMATCH if not defined its glibc specific define
-include missing sys/stat.h for stat* function declarations
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <[email protected]>
-
-Index: squashfs-tools/action.c
-===================================================================
---- a/squashfs-tools.orig/action.c
-+++ b/squashfs-tools/action.c
-@@ -44,6 +44,10 @@
- #include "action.h"
- #include "error.h"
- 
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- /*
-  * code to parse actions
-  */
-Index: squashfs-tools/mksquashfs.c
-===================================================================
---- a/squashfs-tools.orig/mksquashfs.c
-+++ b/squashfs-tools/mksquashfs.c
-@@ -1286,6 +1286,10 @@ void write_dir(squashfs_inode *inode, st
- 		dir_size + 3, directory_block, directory_offset, NULL, NULL,
- 		dir, 0);
- 
-+#if !defined(FNM_EXTMATCH)
-+#define FNM_EXTMATCH 0
-+#endif
-+
- #ifdef SQUASHFS_TRACE
- 	{
- 		unsigned char *dirp;
-Index: squashfs-tools/pseudo.c
-===================================================================
---- a/squashfs-tools.orig/pseudo.c
-+++ b/squashfs-tools/pseudo.c
-@@ -32,6 +32,7 @@
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/wait.h>
-+#include <sys/stat.h>
- #include <ctype.h>
- 
- #include "pseudo.h"
-Index: squashfs-tools/unsquashfs.c
-===================================================================
---- a/squashfs-tools.orig/unsquashfs.c
-+++ b/squashfs-tools/unsquashfs.c
-@@ -38,6 +38,10 @@
- #include <limits.h>
- #include <ctype.h>
- 
-+#ifndef FNM_EXTMATCH
-+#define FNM_EXTMATCH 0
-+#endif
-+
- struct cache *fragment_cache, *data_cache;
- struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
- pthread_t *thread, *inflator_thread;
package/squashfs/Config.in +6 -0
index 70c0fc9808..c16ebbf27f 100644
@@ -41,6 +41,12 @@ config BR2_PACKAGE_SQUASHFS_XZ
 	help
 	  Support XZ compression algorithm
 
+config BR2_PACKAGE_SQUASHFS_ZSTD
+	bool "zstd support"
+	select BR2_PACKAGE_ZSTD
+	help
+	  Support ZSTD compression algorithm
+
 endif
 
 comment "squashfs needs a toolchain w/ threads"
package/squashfs/squashfs.hash +1 -1
index 74fdb44354..82a650022c 100644
@@ -1,2 +1,2 @@
 # Locally computed
-sha256	2c49392816615b73bf5d6cdce9776cb66a01f5a1494b1d9af580667e32bab001  squashfs-3de1687d7432ea9b302c2db9521996f506c140a3.tar.gz
+sha256 bd0aa3011320b8ebee68aa406060de277bef16daf81bad5b9f70cbea6db1a779 squashfs-e38956b92f738518c29734399629e7cdb33072d3.tar.gz
package/squashfs/squashfs.mk +11 -3
index 9599d892b2..bec867d676 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-SQUASHFS_VERSION = 3de1687d7432ea9b302c2db9521996f506c140a3
+SQUASHFS_VERSION = e38956b92f738518c29734399629e7cdb33072d3
 SQUASHFS_SITE = https://git.kernel.org/pub/scm/fs/squashfs/squashfs-tools.git
 SQUASHFS_SITE_METHOD = git
 SQUASHFS_LICENSE = GPL-2.0+
@@ -46,7 +46,14 @@ else
 SQUASHFS_MAKE_ARGS += GZIP_SUPPORT=0
 endif
 
-HOST_SQUASHFS_DEPENDENCIES = host-zlib host-lz4 host-lzo host-xz
+ifeq ($(BR2_PACKAGE_SQUASHFS_ZSTD),y)
+SQUASHFS_DEPENDENCIES += zstd
+SQUASHFS_MAKE_ARGS += ZSTD_SUPPORT=1 COMP_DEFAULT=zstd
+else
+SQUASHFS_MAKE_ARGS += ZSTD_SUPPORT=0
+endif
+
+HOST_SQUASHFS_DEPENDENCIES = host-zlib host-lz4 host-lzo host-xz host-zstd
 
 HOST_SQUASHFS_MAKE_ARGS = \
 	XATTR_SUPPORT=1 \
@@ -54,7 +61,8 @@ HOST_SQUASHFS_MAKE_ARGS = \
 	GZIP_SUPPORT=1 \
 	LZ4_SUPPORT=1 \
 	LZO_SUPPORT=1 \
-	LZMA_XZ_SUPPORT=1
+	LZMA_XZ_SUPPORT=1 \
+	ZSTD_SUPPORT=1
 
 define SQUASHFS_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) \
Signature · 1 line
2.16.3
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 3/3 fs/squashfs: add zstd support

In reply to Peter Seiderer
---
 fs/squashfs/Config.in   | 3 +++
 fs/squashfs/squashfs.mk | 2 ++
 2 files changed, 5 insertions(+)
fs/squashfs/Config.in +3 -0
index ca9ddb2218..dde2097cb7 100644
@@ -27,5 +27,8 @@ config BR2_TARGET_ROOTFS_SQUASHFS4_LZO
 config BR2_TARGET_ROOTFS_SQUASHFS4_XZ
 	bool "xz"
 
+config BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD
+	bool "zstd"
+
 endchoice
 endif
fs/squashfs/squashfs.mk +2 -0
index 51abd5d7d0..34ab048603 100644
@@ -16,6 +16,8 @@ else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZMA),y)
 ROOTFS_SQUASHFS_ARGS += -comp lzma
 else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_XZ),y)
 ROOTFS_SQUASHFS_ARGS += -comp xz
+else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD),y)
+ROOTFS_SQUASHFS_ARGS += -comp zstd
 else
 ROOTFS_SQUASHFS_ARGS += -comp gzip
 endif
Signature · 1 line
2.16.3
#4 lore raw

PATCH 3/3 fs/squashfs: add zstd support

Peter, All,

On 2018-04-07 20:19 +0200, Peter Seiderer spake thusly:

Quoted 1 line

Regards,
Yann E. MORIN.

Quoted 34 lines
---
 fs/squashfs/Config.in   | 3 +++
 fs/squashfs/squashfs.mk | 2 ++
 2 files changed, 5 insertions(+)
fs/squashfs/Config.in +3 -0
index ca9ddb2218..dde2097cb7 100644
@@ -27,5 +27,8 @@ config BR2_TARGET_ROOTFS_SQUASHFS4_LZO
 config BR2_TARGET_ROOTFS_SQUASHFS4_XZ
 	bool "xz"
 
+config BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD
+	bool "zstd"
+
 endchoice
 endif
fs/squashfs/squashfs.mk +2 -0
index 51abd5d7d0..34ab048603 100644
@@ -16,6 +16,8 @@ else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_LZMA),y)
 ROOTFS_SQUASHFS_ARGS += -comp lzma
 else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_XZ),y)
 ROOTFS_SQUASHFS_ARGS += -comp xz
+else ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD),y)
+ROOTFS_SQUASHFS_ARGS += -comp zstd
 else
 ROOTFS_SQUASHFS_ARGS += -comp gzip
 endif
Signature · 1 line
2.16.3
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/3 zstd: enable host/taget libzstd support

In reply to Peter Seiderer

Peter, All,

This patch does two things:

- install the target library

- enable the host build

Thus, it should be two separate patches.

Regards,
Yann E. MORIN.

On 2018-04-07 20:19 +0200, Peter Seiderer spake thusly:

Quoted 54 lines
---
 package/zstd/zstd.mk | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
package/zstd/zstd.mk +20 -1
index c0fa88026c..0c489014be 100644
@@ -6,6 +6,7 @@
 
 ZSTD_VERSION = v1.3.3
 ZSTD_SITE = $(call github,facebook,zstd,$(ZSTD_VERSION))
+ZSTD_INSTALL_STAGING = YES
 ZSTD_LICENSE = BSD-3-Clause or GPL-2.0
 ZSTD_LICENSE_FILES = LICENSE COPYING
 
@@ -36,14 +37,32 @@ else
 ZSTD_OPTS += HAVE_LZ4=0
 endif
 
+define HOST_ZSTD_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D) lib
+endef
+
 define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D) zstd
+		-C $(@D) lib zstd
+endef
+
+define HOST_ZSTD_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D)/lib install
+endef
+
+define ZSTD_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib install
 endef
 
 define ZSTD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib install
 endef
 
 $(eval $(generic-package))
+$(eval $(host-generic-package))
Signature · 1 line
2.16.3
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'