All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/5] package/zstd: bump to version 1.5.0
@ 2021-05-25 17:14 Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 2/5] package/zstd: Simplify host-build Norbert Lange
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Norbert Lange @ 2021-05-25 17:14 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/zstd/zstd.hash | 4 ++--
 package/zstd/zstd.mk   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/zstd/zstd.hash b/package/zstd/zstd.hash
index a979501e5f..2d7bf37b2a 100644
--- a/package/zstd/zstd.hash
+++ b/package/zstd/zstd.hash
@@ -1,5 +1,5 @@
-# From https://github.com/facebook/zstd/releases/download/v1.4.9/zstd-1.4.9.tar.gz.sha256
-sha256  29ac74e19ea28659017361976240c4b5c5c24db3b89338731a6feb97c038d293  zstd-1.4.9.tar.gz
+# From https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz.sha256
+sha256  5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94  zstd-1.5.0.tar.gz
 
 # License files (locally computed)
 sha256  2c1a7fa704df8f3a606f6fc010b8b5aaebf403f3aeec339a12048f1ba7331a0b  LICENSE
diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index d741ddba2a..d4b1362820 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-ZSTD_VERSION = 1.4.9
+ZSTD_VERSION = 1.5.0
 ZSTD_SITE = https://github.com/facebook/zstd/releases/download/v$(ZSTD_VERSION)
 ZSTD_INSTALL_STAGING = YES
 ZSTD_LICENSE = BSD-3-Clause or GPL-2.0
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/5] package/zstd: Simplify host-build
  2021-05-25 17:14 [Buildroot] [PATCH 1/5] package/zstd: bump to version 1.5.0 Norbert Lange
@ 2021-05-25 17:14 ` Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 3/5] package/zstd: rework build and install Norbert Lange
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Norbert Lange @ 2021-05-25 17:14 UTC (permalink / raw)
  To: buildroot

1.5.0 uses Threads by default for cli tool and DSO,
should not be necessary to do anything special.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/zstd/zstd.mk | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index d4b1362820..35c45974dc 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -83,21 +83,16 @@ define ZSTD_INSTALL_TARGET_CMDS
 		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
 endef
 
-# note: only limited 'HAVE_...' options for host library build only
-HOST_ZSTD_OPTS = HAVE_THREAD=1
+HOST_ZSTD_OPTS += PREFIX=$(HOST_DIR)
 
 define HOST_ZSTD_BUILD_CMDS
 	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(HOST_ZSTD_OPTS) \
-		-C $(@D)/lib libzstd.a-mt libzstd-mt
-	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(HOST_ZSTD_OPTS) \
-		-C $(@D) zstd
+		-C $(@D) zstd-release lib-release
 endef
 
 define HOST_ZSTD_INSTALL_CMDS
 	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(HOST_ZSTD_OPTS) \
-		DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D)/lib install
-	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(HOST_ZSTD_OPTS) \
-		DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D)/programs install
+		-C $(@D) install
 endef
 
 $(eval $(generic-package))
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 3/5] package/zstd: rework build and install
  2021-05-25 17:14 [Buildroot] [PATCH 1/5] package/zstd: bump to version 1.5.0 Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 2/5] package/zstd: Simplify host-build Norbert Lange
@ 2021-05-25 17:14 ` Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 4/5] package/zstd: Change Build options Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 5/5] package/zstd: Add option for cli binary Norbert Lange
  3 siblings, 0 replies; 5+ messages in thread
From: Norbert Lange @ 2021-05-25 17:14 UTC (permalink / raw)
  To: buildroot

1.5.0 uses Threads by default for cli tool and DSO,
the build now does the same unless:

If only static libraries are build, then build
that library like the DSO is normally built.

This should ensure that programs requsting the DSO
will always get the multithreaded version.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/zstd/zstd.mk | 55 ++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 23 deletions(-)

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index 35c45974dc..a7a5ba4e50 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -12,7 +12,7 @@ ZSTD_LICENSE_FILES = LICENSE COPYING
 ZSTD_CPE_ID_VENDOR = facebook
 ZSTD_CPE_ID_PRODUCT = zstandard
 
-ZSTD_OPTS += ZSTD_LEGACY_SUPPORT=0
+ZSTD_OPTS += PREFIX=/usr
 
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 ZSTD_OPTS += HAVE_THREAD=1
@@ -41,46 +41,55 @@ else
 ZSTD_OPTS += HAVE_LZ4=0
 endif
 
-ifeq ($(BR2_STATIC_LIBS),y)
-ZSTD_BUILD_LIBS = libzstd.a
-ZSTD_INSTALL_LIBS = install-static
-else ifeq ($(BR2_SHARED_LIBS),y)
-ZSTD_BUILD_LIBS = libzstd
-ZSTD_INSTALL_LIBS = install-shared
+ZSTD_BUILD_PROG_TARGET := zstd-release
+
+# Since v1.5.0 the dynamic library is built for
+# multithreading, while the static library is not.
+#
+# Keep those defaults, unless Buildroot is not
+# providing the dynamic library and the
+# static library will be automatically used instead.
+ifeq ($(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
+ZSTD_INSTALL_LIBS += install-static
+ifeq ($(BR2_STATIC_LIBS)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
+# Use the static lib as replacement for the mt dynlib
+ZSTD_BUILD_LIBS += libzstd.a-mt
 else
-ZSTD_BUILD_LIBS = libzstd.a libzstd
-ZSTD_INSTALL_LIBS = install-static install-shared
+ZSTD_BUILD_LIBS += libzstd.a-nomt
+endif
 endif
 
-# The HAVE_THREAD flag is read by the 'programs' makefile but not by  the 'lib'
-# one. Building a multi-threaded binary with a library (which defaults to
-# single-threaded) gives a runtime error when compressing files.
-# The 'lib' makefile provides specific '%-mt' targets for this purpose.
+ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
+ZSTD_INSTALL_LIBS += install-shared
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-ZSTD_BUILD_LIBS := $(addsuffix -mt,$(ZSTD_BUILD_LIBS))
+ZSTD_BUILD_LIBS += libzstd-mt
+else
+ZSTD_BUILD_LIBS += libzstd-nomt
+endif
 endif
 
 define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D)/lib $(ZSTD_BUILD_LIBS)
-	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D) zstd
+		-C $(@D)/lib $(addsuffix -release,$(ZSTD_BUILD_LIBS) libzstd.pc)
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D)/programs zstd-small
+		-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET)
 endef
 
 define ZSTD_INSTALL_STAGING_CMDS
+	[ -e $(@D)/programs/zstd ] && [ -e $(@D)/lib/libzstd.pc ]
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D)/lib DESTDIR=$(STAGING_DIR) $(ZSTD_INSTALL_LIBS) \
+		install-pc install-includes
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib \
-		install-pc install-includes $(ZSTD_INSTALL_LIBS)
+		-C $(@D)/programs DESTDIR=$(STAGING_DIR) install
 endef
 
 define ZSTD_INSTALL_TARGET_CMDS
+	[ -e $(@D)/programs/zstd ]
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
-	install $(@D)/programs/zstd-small $(TARGET_DIR)/usr/bin
+		-C $(@D)/lib DESTDIR=$(TARGET_DIR) $(ZSTD_INSTALL_LIBS)
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
+		-C $(@D)/programs DESTDIR=$(TARGET_DIR) install
 endef
 
 HOST_ZSTD_OPTS += PREFIX=$(HOST_DIR)
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 4/5] package/zstd: Change Build options
  2021-05-25 17:14 [Buildroot] [PATCH 1/5] package/zstd: bump to version 1.5.0 Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 2/5] package/zstd: Simplify host-build Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 3/5] package/zstd: rework build and install Norbert Lange
@ 2021-05-25 17:14 ` Norbert Lange
  2021-05-25 17:14 ` [Buildroot] [PATCH 5/5] package/zstd: Add option for cli binary Norbert Lange
  3 siblings, 0 replies; 5+ messages in thread
From: Norbert Lange @ 2021-05-25 17:14 UTC (permalink / raw)
  To: buildroot

Disable the legacy format, these are just needed for
decompressing files created with pre-release version.

Use Buildroot's setting for optimization, zstd's build system
overrides CFLAGS, but MOREFLAGS can override again.
Quick tests show that using -O2 (like buildroot)
is actually a little faster than -O3 on x86_64 Atoms.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/zstd/zstd.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index a7a5ba4e50..a9499df4d0 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -13,6 +13,10 @@ ZSTD_CPE_ID_VENDOR = facebook
 ZSTD_CPE_ID_PRODUCT = zstandard
 
 ZSTD_OPTS += PREFIX=/usr
+ZSTD_OPTS += ZSTD_LEGACY_SUPPORT=0
+
+# zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
+ZSTD_OPTS_MOREFLAGS += $(TARGET_OPTIMIZATION)
 
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
 ZSTD_OPTS += HAVE_THREAD=1
@@ -41,6 +45,8 @@ else
 ZSTD_OPTS += HAVE_LZ4=0
 endif
 
+ZSTD_OPTS += "MOREFLAGS=$(ZSTD_OPTS_MOREFLAGS)"
+
 ZSTD_BUILD_PROG_TARGET := zstd-release
 
 # Since v1.5.0 the dynamic library is built for
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 5/5] package/zstd: Add option for cli binary
  2021-05-25 17:14 [Buildroot] [PATCH 1/5] package/zstd: bump to version 1.5.0 Norbert Lange
                   ` (2 preceding siblings ...)
  2021-05-25 17:14 ` [Buildroot] [PATCH 4/5] package/zstd: Change Build options Norbert Lange
@ 2021-05-25 17:14 ` Norbert Lange
  3 siblings, 0 replies; 5+ messages in thread
From: Norbert Lange @ 2021-05-25 17:14 UTC (permalink / raw)
  To: buildroot

There are a couple of targets to build the cli tool with less
features (no legacy-support, benchmarking),
or dynamically linked to the library.

Add an option to choose the variant.

To allow the installation step to pick the variant, it
has to be copied to the normal location.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
 package/zstd/Config.in | 21 +++++++++++++++++++++
 package/zstd/zstd.mk   |  9 ++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/package/zstd/Config.in b/package/zstd/Config.in
index 9fa70c65cc..0d2ab84771 100644
--- a/package/zstd/Config.in
+++ b/package/zstd/Config.in
@@ -10,3 +10,24 @@ config BR2_PACKAGE_ZSTD
 	  compression formats
 
 	  https://facebook.github.io/zstd
+
+if BR2_PACKAGE_ZSTD
+
+choice
+	prompt "Executable flavor"
+	help
+	  Pick between variants of the zstd tool.
+
+config BR2_PACKAGE_ZSTD_PROG_DEFAULT
+	bool "Default build (static, full-featured)"
+
+config BR2_PACKAGE_ZSTD_PROG_DYNAMIC
+	bool "Dynamic build (needs library with identical version)"
+	depends on !BR2_STATIC_LIBS
+
+config BR2_PACKAGE_ZSTD_PROG_SMALL
+	bool "Small build (static, less features)"
+
+endchoice
+
+endif
diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index a9499df4d0..ecad26e0df 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -48,6 +48,11 @@ endif
 ZSTD_OPTS += "MOREFLAGS=$(ZSTD_OPTS_MOREFLAGS)"
 
 ZSTD_BUILD_PROG_TARGET := zstd-release
+ifeq ($(BR2_PACKAGE_ZSTD_PROG_DYNAMIC),y)
+ZSTD_BUILD_PROG_TARGET := zstd-dll
+else ifeq ($(BR2_PACKAGE_ZSTD_PROG_SMALL),y)
+ZSTD_BUILD_PROG_TARGET := zstd-small
+endif
 
 # Since v1.5.0 the dynamic library is built for
 # multithreading, while the static library is not.
@@ -78,7 +83,9 @@ define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		-C $(@D)/lib $(addsuffix -release,$(ZSTD_BUILD_LIBS) libzstd.pc)
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET)
+		-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET) && \
+	{ [ ! -e $(@D)/programs/$(ZSTD_BUILD_PROG_TARGET) ] || \
+		ln -f $(@D)/programs/$(ZSTD_BUILD_PROG_TARGET) $(@D)/programs/zstd; }
 endef
 
 define ZSTD_INSTALL_STAGING_CMDS
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-25 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 17:14 [Buildroot] [PATCH 1/5] package/zstd: bump to version 1.5.0 Norbert Lange
2021-05-25 17:14 ` [Buildroot] [PATCH 2/5] package/zstd: Simplify host-build Norbert Lange
2021-05-25 17:14 ` [Buildroot] [PATCH 3/5] package/zstd: rework build and install Norbert Lange
2021-05-25 17:14 ` [Buildroot] [PATCH 4/5] package/zstd: Change Build options Norbert Lange
2021-05-25 17:14 ` [Buildroot] [PATCH 5/5] package/zstd: Add option for cli binary Norbert Lange

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.