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.5 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_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. TARGET_CFLAGS += $(if $(CONFIG_USE_UCLIBC),-D_BSD_SOURCE)
  54. MESON_ARGS += \
  55. -Dlegacy_level=1 \
  56. -Ddebug_level=0 \
  57. -Dbacktrace=false \
  58. -Dstatic_runtime=false \
  59. -Dbin_programs=true \
  60. -Dbin_tests=false \
  61. -Dbin_control=false \
  62. -Dzlib=disabled \
  63. -Dlzma=disabled \
  64. -Dlz4=disabled \
  65. -Db_lto=true
  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))