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.

101 lines
2.4 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=zstd
  3. PKG_VERSION:=1.4.9
  4. PKG_RELEASE:=1
  5. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.zst
  6. PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION)
  7. PKG_HASH:=61dce0e9a5036d7fb9b5709ee6567c2c8a1b4ba48a8e43afe9ae355cc37bb494
  8. PKG_MAINTAINER:=
  9. PKG_LICENSE:=GPL-2.0-or-later
  10. PKG_LICENSE_FILES:=COPYING
  11. PKG_INSTALL:=1
  12. include $(INCLUDE_DIR)/package.mk
  13. include $(INCLUDE_DIR)/meson.mk
  14. MESON_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/build/meson/openwrt-build
  15. define Package/zstd/Default
  16. SUBMENU:=Compression
  17. URL:=https://github.com/facebook/zstd
  18. endef
  19. define Package/libzstd
  20. $(call Package/zstd/Default)
  21. SECTION:=libs
  22. CATEGORY:=Libraries
  23. TITLE:=zstd library.
  24. MENU:=1
  25. endef
  26. define Package/libzstd/description
  27. Zstandard - Fast real-time compression algorithm.
  28. This package provides libzstd library.
  29. endef
  30. define Package/libzstd/config
  31. config ZSTD_OPTIMIZE_O3
  32. bool "Use all optimizations (-O3)"
  33. depends on PACKAGE_libzstd
  34. default y
  35. help
  36. This enables additional optmizations using the -O3 compilation flag.
  37. endef
  38. define Package/zstd
  39. $(call Package/zstd/Default)
  40. SECTION:=utils
  41. CATEGORY:=Utilities
  42. DEPENDS:=+libzstd
  43. TITLE:=Fast real-time compression algorithm.
  44. endef
  45. define Package/zstd/description
  46. Zstandard - Fast real-time compression algorithm.
  47. This package provides the zstd binaries.
  48. endef
  49. ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y)
  50. TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS)) -O3
  51. endif
  52. TARGET_CFLAGS += $(if $(CONFIG_USE_UCLIBC),-D_BSD_SOURCE)
  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. -Db_lto=true
  65. define Build/InstallDev
  66. $(INSTALL_DIR) $(1)/usr/include
  67. $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
  68. $(INSTALL_DIR) $(1)/usr/lib
  69. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib
  70. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  71. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libzstd.pc $(1)/usr/lib/pkgconfig
  72. endef
  73. define Package/libzstd/install
  74. $(INSTALL_DIR) $(1)/usr/lib
  75. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib
  76. endef
  77. define Package/zstd/install
  78. $(INSTALL_DIR) $(1)/usr/bin
  79. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{unzstd,zstd,zstdcat,zstdgrep,zstdless,zstdmt} $(1)/usr/bin
  80. endef
  81. $(eval $(call BuildPackage,libzstd))
  82. $(eval $(call BuildPackage,zstd))