All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Seiderer <ps.report@gmx.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3 5/6] zstd: add libzstd support
Date: Mon, 16 Apr 2018 21:39:52 +0200	[thread overview]
Message-ID: <20180416193953.19924-5-ps.report@gmx.net> (raw)
In-Reply-To: <20180416193953.19924-1-ps.report@gmx.net>

Add patch to split libzstd install target into pc, static, shared
and includes target. Call only the needed ones for the buildroot
staging/target install steps (respect the static/shared configuration).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
Changes v2 -> v3:
  - split libray install targets for static/shared
    (suggested by Yann E. MORIN)

Changes v1 -> v2:
  - split off target libzstd support (suggested by Yann E. MORIN)
---
 ...ry-install-target-into-pc-static-shared-a.patch | 51 ++++++++++++++++++++++
 package/zstd/zstd.mk                               | 46 +++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 package/zstd/0001-Split-library-install-target-into-pc-static-shared-a.patch

diff --git a/package/zstd/0001-Split-library-install-target-into-pc-static-shared-a.patch b/package/zstd/0001-Split-library-install-target-into-pc-static-shared-a.patch
new file mode 100644
index 0000000000..af9b2bf3f9
--- /dev/null
+++ b/package/zstd/0001-Split-library-install-target-into-pc-static-shared-a.patch
@@ -0,0 +1,51 @@
+From 2623a12bff19049b6ad5bc066e3ef9c6259d415c Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Mon, 16 Apr 2018 20:44:49 +0200
+Subject: [PATCH] Split library install target into pc, static, shared and
+ include only target
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ lib/Makefile | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/lib/Makefile b/lib/Makefile
+index cdfdc5c..b592aa6 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -159,20 +159,29 @@ libzstd.pc: libzstd.pc.in
+              -e 's|@VERSION@|$(VERSION)|' \
+              $< >$@
+ 
+-install: libzstd.a libzstd libzstd.pc
++install: install-pc install-static install-shared install-includes
++	@echo zstd static and shared library installed
++
++install-pc: libzstd.pc
+ 	@$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/ $(DESTDIR)$(INCLUDEDIR)/
+ 	@$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
+-	@echo Installing libraries
++
++install-static: libzstd.a
++	@echo Installing static library
+ 	@$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
++
++install-shared: libzstd
++	@echo Installing shared library
+ 	@$(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
+ 	@ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
+ 	@ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
++
++install-includes:
+ 	@echo Installing includes
+ 	@$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
+ 	@$(INSTALL_DATA) common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
+ 	@$(INSTALL_DATA) deprecated/zbuff.h $(DESTDIR)$(INCLUDEDIR)     # prototypes generate deprecation warnings
+ 	@$(INSTALL_DATA) dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)
+-	@echo zstd static and shared library installed
+ 
+ uninstall:
+ 	@$(RM) $(DESTDIR)$(LIBDIR)/libzstd.a
+-- 
+2.16.3
+
diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index 98f8f779aa..6be36cf398 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -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,15 +37,60 @@ else
 ZSTD_OPTS += HAVE_LZ4=0
 endif
 
+ifeq ($(BR2_STATIC_LIBS),y)
 define ZSTD_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D)/lib libzstd.a
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		-C $(@D) zstd
 endef
+else ifeq ($(BR2_SHARED_LIBS),y)
+define ZSTD_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D)/lib libzstd
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D) zstd
+endef
+else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
+define ZSTD_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		-C $(@D) lib zstd
+endef
+endif
 
+ifeq ($(BR2_STATIC_LIBS),y)
+define ZSTD_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib \
+		install-pc install-static install-includes
+endef
+else ifeq ($(BR2_SHARED_LIBS),y)
+define ZSTD_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib \
+		install-pc install-shared install-includes
+endef
+else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
+define ZSTD_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(STAGING_DIR) PREFIX=/usr -C $(@D)/lib \
+		install
+endef
+endif
+
+ifeq ($(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),y)
+define ZSTD_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib install-shared
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
+		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
+endef
+else
 define ZSTD_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
 		DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
 endef
+endif
 
 # note: no 'HAVE_...' options for host library build only
 define HOST_ZSTD_BUILD_CMDS
-- 
2.16.3

  parent reply	other threads:[~2018-04-16 19:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16 19:39 [Buildroot] [PATCH v3 1/6] squashfs: add license hash Peter Seiderer
2018-04-16 19:39 ` [Buildroot] [PATCH v3 2/6] zstd: add host libzstd support Peter Seiderer
2018-04-23  7:56   ` Yann E. MORIN
2018-04-25 21:37   ` Thomas Petazzoni
2018-04-16 19:39 ` [Buildroot] [PATCH v3 3/6] squashfs: add host zstd support Peter Seiderer
2018-04-23  7:57   ` Yann E. MORIN
2018-04-25 21:38   ` Thomas Petazzoni
2018-04-16 19:39 ` [Buildroot] [PATCH v3 4/6] fs/squashfs: add " Peter Seiderer
2018-04-25 21:40   ` Thomas Petazzoni
2018-04-16 19:39 ` Peter Seiderer [this message]
2018-04-23  8:08   ` [Buildroot] [PATCH v3 5/6] zstd: add libzstd support Yann E. MORIN
2018-04-25 21:48   ` Thomas Petazzoni
2018-04-30 18:48     ` Peter Seiderer
2018-04-16 19:39 ` [Buildroot] [PATCH v3 6/6] squashfs: add zstd support Peter Seiderer
2018-04-23  8:18   ` Yann E. MORIN
2018-04-25 21:49   ` Thomas Petazzoni
2018-04-25 21:34 ` [Buildroot] [PATCH v3 1/6] squashfs: add license hash Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180416193953.19924-5-ps.report@gmx.net \
    --to=ps.report@gmx.net \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.