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.

89 lines
2.1 KiB

  1. include $(TOPDIR)/rules.mk
  2. PKG_NAME:=zstd
  3. PKG_VERSION:=1.4.3
  4. PKG_RELEASE:=1
  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:=5eda3502ecc285c3c92ee0cc8cd002234dee39d539b3f692997a0e80de1d33de
  8. PKG_MAINTAINER:=Amol Bhave <ambhave@fb.com>
  9. PKG_LICENSE:=GPL-2.0-or-later
  10. PKG_LICENSE_FILES:=COPYING
  11. PKG_BUILD_PARALLEL:=1
  12. HOST_BUILD_PARALLEL:=1
  13. CMAKE_SOURCE_SUBDIR:=build/cmake
  14. CMAKE_INSTALL:=1
  15. include $(INCLUDE_DIR)/package.mk
  16. include $(INCLUDE_DIR)/host-build.mk
  17. include $(INCLUDE_DIR)/cmake.mk
  18. define Package/zstd/Default
  19. SUBMENU:=Compression
  20. URL:=https://github.com/facebook/zstd
  21. endef
  22. define Package/libzstd
  23. $(call Package/zstd/Default)
  24. SECTION:=libs
  25. CATEGORY:=Libraries
  26. TITLE:=zstd library.
  27. MENU:=1
  28. endef
  29. define Package/libzstd/description
  30. Zstandard - Fast real-time compression algorithm.
  31. This package provides libzstd library.
  32. endef
  33. define Package/libzstd/config
  34. config ZSTD_OPTIMIZE_O3
  35. bool "Use all optimizations (-O3)"
  36. depends on PACKAGE_libzstd
  37. default y
  38. help
  39. This enables additional optmizations using the -O3 compilation flag.
  40. endef
  41. define Package/zstd
  42. $(call Package/zstd/Default)
  43. SECTION:=utils
  44. CATEGORY:=Utilities
  45. DEPENDS:=+libzstd
  46. TITLE:=Fast real-time compression algorithm.
  47. endef
  48. define Package/zstd/description
  49. Zstandard - Fast real-time compression algorithm.
  50. This package provides the zstd binaries.
  51. endef
  52. ifeq ($(CONFIG_ZSTD_OPTIMIZE_O3),y)
  53. TARGET_CFLAGS:= $(filter-out -O%,$(TARGET_CFLAGS)) -O3
  54. endif
  55. TARGET_CFLAGS += -flto
  56. TARGET_LDFLAGS += -Wl,--as-needed
  57. define Build/InstallDev
  58. $(call Build/InstallDev/cmake,$(1))
  59. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libzstd.pc
  60. $(SED) 's,/usr/lib,$$$${prefix}/lib,g' $(1)/usr/lib/pkgconfig/libzstd.pc
  61. endef
  62. define Package/libzstd/install
  63. $(INSTALL_DIR) $(1)/usr/lib
  64. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzstd.so* $(1)/usr/lib/
  65. endef
  66. define Package/zstd/install
  67. $(INSTALL_DIR) $(1)/usr/bin
  68. $(CP) $(PKG_INSTALL_DIR)/usr/bin/{unzstd,zstd,zstdcat,zstdmt} $(1)/usr/bin/
  69. endef
  70. $(eval $(call BuildPackage,libzstd))
  71. $(eval $(call BuildPackage,zstd))
  72. $(eval $(call HostBuild))