zstd: convert to meson

Allows faster build with ninja. Unfortunately, the LTO stage slows it
massively.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-04-18 00:00:23 -07:00
parent e21a063ecb
commit 779a4dca67
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
1 changed files with 41 additions and 28 deletions

View File

@ -2,41 +2,40 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=zstd PKG_NAME:=zstd
PKG_VERSION:=1.4.4 PKG_VERSION:=1.4.4
PKG_RELEASE:=2 PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/facebook/zstd/tar.gz/v$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/facebook/zstd/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8 PKG_HASH:=a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8
PKG_MAINTAINER:=Amol Bhave <ambhave@fb.com> PKG_MAINTAINER:=
PKG_LICENSE:=GPL-2.0-or-later PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING PKG_LICENSE_FILES:=COPYING
PKG_BUILD_PARALLEL:=1 PKG_BUILD_DEPENDS:=meson/host
HOST_BUILD_PARALLEL:=1 PKG_INSTALL:=1
CMAKE_SOURCE_SUBDIR:=build/cmake
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk include ../../devel/meson/meson.mk
include $(INCLUDE_DIR)/cmake.mk
MESON_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/build/meson/openwrt-build
define Package/zstd/Default define Package/zstd/Default
SUBMENU:=Compression SUBMENU:=Compression
URL:=https://github.com/facebook/zstd URL:=https://github.com/facebook/zstd
endef endef
define Package/libzstd define Package/libzstd
$(call Package/zstd/Default) $(call Package/zstd/Default)
SECTION:=libs SECTION:=libs
CATEGORY:=Libraries CATEGORY:=Libraries
TITLE:=zstd library. TITLE:=zstd library.
MENU:=1 MENU:=1
endef endef
define Package/libzstd/description define Package/libzstd/description
Zstandard - Fast real-time compression algorithm. Zstandard - Fast real-time compression algorithm.
This package provides libzstd library. This package provides libzstd library.
endef endef
define Package/libzstd/config define Package/libzstd/config
@ -50,40 +49,54 @@ endef
define Package/zstd define Package/zstd
$(call Package/zstd/Default) $(call Package/zstd/Default)
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
DEPENDS:=+libzstd DEPENDS:=+libzstd
TITLE:=Fast real-time compression algorithm. TITLE:=Fast real-time compression algorithm.
endef endef
define Package/zstd/description define Package/zstd/description
Zstandard - Fast real-time compression algorithm. Zstandard - Fast real-time compression algorithm.
This package provides the zstd binaries. This package provides the zstd binaries.
endef endef
ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y) ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y)
TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS)) -O3 TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS)) -O3
endif endif
MESON_ARGS += \
-Dlegacy_level=1 \
-Ddebug_level=0 \
-Dbacktrace=false \
-Dstatic_runtime=false \
-Dbin_programs=true \
-Dbin_tests=false \
-Dbin_control=false \
-Dzlib=disabled \
-Dlzma=disabled \
-Dlz4=disabled
TARGET_CFLAGS += -flto TARGET_CFLAGS += -flto
TARGET_LDFLAGS += -Wl,--as-needed TARGET_LDFLAGS += -Wl,--as-needed
define Build/InstallDev define Build/InstallDev
$(call Build/InstallDev/cmake,$(1)) $(INSTALL_DIR) $(1)/usr/include
$(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libzstd.pc $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
$(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/libzstd.pc $(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libzstd.pc $(1)/usr/lib/pkgconfig
endef endef
define Package/libzstd/install define Package/libzstd/install
$(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib
endef endef
define Package/zstd/install define Package/zstd/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/{unzstd,zstd,zstdcat,zstdmt} $(1)/usr/bin/ $(CP) $(PKG_INSTALL_DIR)/usr/bin/{unzstd,zstd,zstdcat,zstdgrep,zstdless,zstdmt} $(1)/usr/bin
endef endef
$(eval $(call BuildPackage,libzstd)) $(eval $(call BuildPackage,libzstd))
$(eval $(call BuildPackage,zstd)) $(eval $(call BuildPackage,zstd))
$(eval $(call HostBuild))