2017-07-25 18:56:03 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# zstd
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2021-03-20 10:05:25 +01:00
|
|
|
ZSTD_VERSION = 1.4.9
|
2020-07-14 22:28:50 +02:00
|
|
|
ZSTD_SITE = https://github.com/facebook/zstd/releases/download/v$(ZSTD_VERSION)
|
2018-04-16 21:39:52 +02:00
|
|
|
ZSTD_INSTALL_STAGING = YES
|
2018-03-30 21:32:08 +02:00
|
|
|
ZSTD_LICENSE = BSD-3-Clause or GPL-2.0
|
2017-09-15 14:39:59 +02:00
|
|
|
ZSTD_LICENSE_FILES = LICENSE COPYING
|
2021-01-23 23:11:10 +01:00
|
|
|
ZSTD_CPE_ID_VENDOR = facebook
|
|
|
|
ZSTD_CPE_ID_PRODUCT = zstandard
|
2017-07-25 18:56:03 +02:00
|
|
|
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
|
|
|
|
ZSTD_OPTS += HAVE_THREAD=1
|
|
|
|
else
|
|
|
|
ZSTD_OPTS += HAVE_THREAD=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_ZLIB),y)
|
|
|
|
ZSTD_DEPENDENCIES += zlib
|
|
|
|
ZSTD_OPTS += HAVE_ZLIB=1
|
|
|
|
else
|
|
|
|
ZSTD_OPTS += HAVE_ZLIB=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_XZ),y)
|
|
|
|
ZSTD_DEPENDENCIES += xz
|
|
|
|
ZSTD_OPTS += HAVE_LZMA=1
|
|
|
|
else
|
|
|
|
ZSTD_OPTS += HAVE_LZMA=0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_LZ4),y)
|
|
|
|
ZSTD_DEPENDENCIES += lz4
|
|
|
|
ZSTD_OPTS += HAVE_LZ4=1
|
|
|
|
else
|
|
|
|
ZSTD_OPTS += HAVE_LZ4=0
|
|
|
|
endif
|
|
|
|
|
2018-04-16 21:39:52 +02:00
|
|
|
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
|
|
|
|
else
|
|
|
|
ZSTD_BUILD_LIBS = libzstd.a libzstd
|
|
|
|
ZSTD_INSTALL_LIBS = install-static install-shared
|
|
|
|
endif
|
|
|
|
|
2020-12-04 10:57:01 +01:00
|
|
|
# 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_TOOLCHAIN_HAS_THREADS),y)
|
|
|
|
ZSTD_BUILD_LIBS := $(addsuffix -mt,$(ZSTD_BUILD_LIBS))
|
|
|
|
endif
|
|
|
|
|
2017-07-25 18:56:03 +02:00
|
|
|
define ZSTD_BUILD_CMDS
|
2018-04-16 21:39:52 +02:00
|
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
|
|
|
|
-C $(@D)/lib $(ZSTD_BUILD_LIBS)
|
2017-07-25 18:56:03 +02:00
|
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
|
|
|
|
-C $(@D) zstd
|
|
|
|
endef
|
|
|
|
|
2018-04-16 21:39:52 +02:00
|
|
|
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-includes $(ZSTD_INSTALL_LIBS)
|
|
|
|
endef
|
|
|
|
|
2017-07-25 18:56:03 +02:00
|
|
|
define ZSTD_INSTALL_TARGET_CMDS
|
|
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
|
2017-09-16 02:27:12 +02:00
|
|
|
DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/programs install
|
2018-04-16 21:39:52 +02:00
|
|
|
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) $(ZSTD_OPTS) \
|
|
|
|
DESTDIR=$(TARGET_DIR) PREFIX=/usr -C $(@D)/lib $(ZSTD_INSTALL_LIBS)
|
2017-07-25 18:56:03 +02:00
|
|
|
endef
|
|
|
|
|
2021-01-18 21:37:52 +01:00
|
|
|
# note: only limited 'HAVE_...' options for host library build only
|
|
|
|
HOST_ZSTD_OPTS = HAVE_THREAD=1
|
|
|
|
|
2018-04-16 21:39:49 +02:00
|
|
|
define HOST_ZSTD_BUILD_CMDS
|
2021-01-18 21:37:52 +01:00
|
|
|
$(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) \
|
2018-07-04 09:07:37 +02:00
|
|
|
-C $(@D) zstd
|
2018-04-16 21:39:49 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define HOST_ZSTD_INSTALL_CMDS
|
2021-01-18 21:37:52 +01:00
|
|
|
$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(HOST_ZSTD_OPTS) \
|
2018-04-16 21:39:49 +02:00
|
|
|
DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D)/lib install
|
2021-01-18 21:37:52 +01:00
|
|
|
$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) $(HOST_ZSTD_OPTS) \
|
2018-07-04 09:07:37 +02:00
|
|
|
DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D)/programs install
|
2018-04-16 21:39:49 +02:00
|
|
|
endef
|
|
|
|
|
2017-07-25 18:56:03 +02:00
|
|
|
$(eval $(generic-package))
|
2018-04-16 21:39:49 +02:00
|
|
|
$(eval $(host-generic-package))
|