buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install
@ 2021-08-04 21:56 Norbert Lange
  2021-08-04 21:56 ` [Buildroot] [PATCH v5 2/2] package/zstd: Prefer dynamically linked tool Norbert Lange
  2021-08-05 20:20 ` [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install Arnout Vandecappelle
  0 siblings, 2 replies; 3+ messages in thread
From: Norbert Lange @ 2021-08-04 21:56 UTC (permalink / raw)
  To: buildroot; +Cc: Andrey Smirnov, Norbert Lange

Move PREFIX=/usr to ZSTD_OPTS, even though it is only used by
libzstd.pc for now it should be available in every step.

Create libzstd.pc in the build step instead of triggering a
lazy build during installation when it is missing.

Attach '-release' to the targets, since the default is to
build lib-release and zstd-release.

Signed-off-by: Norbert Lange <nolange79@gmail.com>

---
v4->v5:
*   rebase, remove the parts that are already upstream
*   improve commit message
*   try to keep changes minimal
v3->v4:
*   revert to previous scheme of BR2_TOOLCHAIN_HAS_THREADS
    fixing build options for both static and shared libs.
v2->v3:
*   use normal = for assignment
v1->v2:
*   rebased against upstream/master

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

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index 5a96c11309..d7a0320df4 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -12,6 +12,7 @@ ZSTD_LICENSE_FILES = LICENSE COPYING
 ZSTD_CPE_ID_VENDOR = facebook
 ZSTD_CPE_ID_PRODUCT = zstandard
 
+ZSTD_OPTS += PREFIX=/usr
 ZSTD_OPTS += ZSTD_LEGACY_SUPPORT=0
 ifeq ($(BR2_PACKAGE_ZLIB),y)
 ZSTD_DEPENDENCIES += zlib
@@ -60,12 +61,13 @@ else
 ZSTD_OPTS += HAVE_THREAD=0
 ZSTD_BUILD_LIBS := $(addsuffix -nomt,$(ZSTD_BUILD_LIBS))
 endif
+ZSTD_BUILD_LIBS := $(addsuffix -release,$(ZSTD_BUILD_LIBS))
 
 define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D)/lib $(ZSTD_BUILD_LIBS)
+		-C $(@D)/lib $(ZSTD_BUILD_LIBS) libzstd.pc
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D) zstd
+		-C $(@D) zstd-release
 endef
 
 define ZSTD_INSTALL_STAGING_CMDS
@@ -76,9 +78,9 @@ endef
 
 define ZSTD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
+		DESTDIR=$(TARGET_DIR) -C $(@D)/programs install
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
+		DESTDIR=$(TARGET_DIR) -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
 endef
 
 HOST_ZSTD_OPTS += PREFIX=$(HOST_DIR)
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH v5 2/2] package/zstd: Prefer dynamically linked tool
  2021-08-04 21:56 [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install Norbert Lange
@ 2021-08-04 21:56 ` Norbert Lange
  2021-08-05 20:20 ` [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install Arnout Vandecappelle
  1 sibling, 0 replies; 3+ messages in thread
From: Norbert Lange @ 2021-08-04 21:56 UTC (permalink / raw)
  To: buildroot; +Cc: Andrey Smirnov, Norbert Lange

If the libzstd DSO is available, then link the tool
against it.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
v3->v5:
*   Rebase
v2->v3:
*   Drop config options, just use zstd-dll if possible

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

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index d7a0320df4..58dd0dd9d4 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -49,6 +49,13 @@ ZSTD_BUILD_LIBS = lib
 ZSTD_INSTALL_LIBS = install-static install-shared
 endif
 
+# prefer zstd-dll unless no library is available
+ifeq ($(BR2_STATIC_LIBS),y)
+ZSTD_BUILD_PROG_TARGET = zstd-release
+else
+ZSTD_BUILD_PROG_TARGET = zstd-dll
+endif
+
 # The HAVE_THREAD flag is read by the 'programs' makefile but not by  the 'lib'
 # one. Building a multi-threaded binary with a static library (which defaults
 # to single-threaded) gives a runtime error when compressing files.
@@ -67,7 +74,7 @@ define ZSTD_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		-C $(@D)/lib $(ZSTD_BUILD_LIBS) libzstd.pc
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
-		-C $(@D) zstd-release
+		-C $(@D)/programs $(ZSTD_BUILD_PROG_TARGET)
 endef
 
 define ZSTD_INSTALL_STAGING_CMDS
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install
  2021-08-04 21:56 [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install Norbert Lange
  2021-08-04 21:56 ` [Buildroot] [PATCH v5 2/2] package/zstd: Prefer dynamically linked tool Norbert Lange
@ 2021-08-05 20:20 ` Arnout Vandecappelle
  1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 20:20 UTC (permalink / raw)
  To: Norbert Lange, buildroot; +Cc: Andrey Smirnov



On 04/08/2021 23:56, Norbert Lange wrote:
> Move PREFIX=/usr to ZSTD_OPTS, even though it is only used by
> libzstd.pc for now it should be available in every step.
> 
> Create libzstd.pc in the build step instead of triggering a
> lazy build during installation when it is missing.
> 
> Attach '-release' to the targets, since the default is to
> build lib-release and zstd-release.
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> 
> ---
> v4->v5:
> *   rebase, remove the parts that are already upstream
> *   improve commit message
> *   try to keep changes minimal
> v3->v4:
> *   revert to previous scheme of BR2_TOOLCHAIN_HAS_THREADS
>     fixing build options for both static and shared libs.
> v2->v3:
> *   use normal = for assignment
> v1->v2:
> *   rebased against upstream/master
> 
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
> ---
>  package/zstd/zstd.mk | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
> index 5a96c11309..d7a0320df4 100644
> --- a/package/zstd/zstd.mk
> +++ b/package/zstd/zstd.mk
> @@ -12,6 +12,7 @@ ZSTD_LICENSE_FILES = LICENSE COPYING
>  ZSTD_CPE_ID_VENDOR = facebook
>  ZSTD_CPE_ID_PRODUCT = zstandard
>  
> +ZSTD_OPTS += PREFIX=/usr
>  ZSTD_OPTS += ZSTD_LEGACY_SUPPORT=0
>  ifeq ($(BR2_PACKAGE_ZLIB),y)
>  ZSTD_DEPENDENCIES += zlib
> @@ -60,12 +61,13 @@ else
>  ZSTD_OPTS += HAVE_THREAD=0
>  ZSTD_BUILD_LIBS := $(addsuffix -nomt,$(ZSTD_BUILD_LIBS))
>  endif
> +ZSTD_BUILD_LIBS := $(addsuffix -release,$(ZSTD_BUILD_LIBS))

 check-package complained about this override of the variable, so I added a
check-package disable comment above.

 I also improved the commit message a little (though it was already good - I
just strive for perfection :-) and committed both to next, thanks! This series
can finally be put to rest :-)


 Regards,
 Arnout

>  
>  define ZSTD_BUILD_CMDS
>  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
> -		-C $(@D)/lib $(ZSTD_BUILD_LIBS)
> +		-C $(@D)/lib $(ZSTD_BUILD_LIBS) libzstd.pc
>  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
> -		-C $(@D) zstd
> +		-C $(@D) zstd-release
>  endef
>  
>  define ZSTD_INSTALL_STAGING_CMDS
> @@ -76,9 +78,9 @@ endef
>  
>  define ZSTD_INSTALL_TARGET_CMDS
>  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
> -		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
> +		DESTDIR=$(TARGET_DIR) -C $(@D)/programs install
>  	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
> -		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
> +		DESTDIR=$(TARGET_DIR) -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
>  endef
>  
>  HOST_ZSTD_OPTS += PREFIX=$(HOST_DIR)
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-08-05 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 21:56 [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install Norbert Lange
2021-08-04 21:56 ` [Buildroot] [PATCH v5 2/2] package/zstd: Prefer dynamically linked tool Norbert Lange
2021-08-05 20:20 ` [Buildroot] [PATCH v5 1/2] package/zstd: rework build and install Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).