You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.4 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=zstd
  3. PKG_VERSION:=1.4.4
  4. PKG_RELEASE:=3
  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  6. PKG_SOURCE_URL:=https://codeload.github.com/facebook/zstd/tar.gz/v$(PKG_VERSION)?
  7. PKG_HASH:=a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8
  8. PKG_MAINTAINER:=
  9. PKG_LICENSE:=GPL-2.0-or-later
  10. PKG_LICENSE_FILES:=COPYING
  11. PKG_BUILD_DEPENDS:=meson/host
  12. PKG_INSTALL:=1
  13. include $(INCLUDE_DIR)/package.mk
  14. include ../../devel/meson/meson.mk
  15. MESON_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/build/meson/openwrt-build
  16. define Package/zstd/Default
  17. SUBMENU:=Compression
  18. URL:=https://github.com/facebook/zstd
  19. endef
  20. define Package/libzstd
  21. $(call Package/zstd/Default)
  22. SECTION:=libs
  23. CATEGORY:=Libraries
  24. TITLE:=zstd library.
  25. MENU:=1
  26. endef
  27. define Package/libzstd/description
  28. Zstandard - Fast real-time compression algorithm.
  29. This package provides libzstd library.
  30. endef
  31. define Package/libzstd/config
  32. config ZSTD_OPTIMIZE_O3
  33. bool "Use all optimizations (-O3)"
  34. depends on PACKAGE_libzstd
  35. default y
  36. help
  37. This enables additional optmizations using the -O3 compilation flag.
  38. endef
  39. define Package/zstd
  40. $(call Package/zstd/Default)
  41. SECTION:=utils
  42. CATEGORY:=Utilities
  43. DEPENDS:=+libzstd
  44. TITLE:=Fast real-time compression algorithm.
  45. endef
  46. define Package/zstd/description
  47. Zstandard - Fast real-time compression algorithm.
  48. This package provides the zstd binaries.
  49. endef
  50. ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y)
  51. TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS)) -O3
  52. endif
  53. MESON_ARGS += \
  54. -Dlegacy_level=1 \
  55. -Ddebug_level=0 \
  56. -Dbacktrace=false \
  57. -Dstatic_runtime=false \
  58. -Dbin_programs=true \
  59. -Dbin_tests=false \
  60. -Dbin_control=false \
  61. -Dzlib=disabled \
  62. -Dlzma=disabled \
  63. -Dlz4=disabled
  64. TARGET_CFLAGS += -flto
  65. TARGET_LDFLAGS += -Wl,--as-needed
  66. define Build/InstallDev
  67. $(INSTALL_DIR) $(1)/usr/include
  68. $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
  69. $(INSTALL_DIR) $(1)/usr/lib
  70. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib
  71. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  72. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libzstd.pc $(1)/usr/lib/pkgconfig
  73. endef
  74. define Package/libzstd/install
  75. $(INSTALL_DIR) $(1)/usr/lib
  76. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib
  77. endef
  78. define Package/zstd/install
  79. $(INSTALL_DIR) $(1)/usr/bin
  80. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{unzstd,zstd,zstdcat,zstdgrep,zstdless,zstdmt} $(1)/usr/bin
  81. endef
  82. $(eval $(call BuildPackage,libzstd))
  83. $(eval $(call BuildPackage,zstd))