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.

117 lines
3.0 KiB

  1. #
  2. # Copyright (C) 2007-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=protobuf
  9. PKG_VERSION:=3.14.0
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-cpp-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://github.com/google/protobuf/releases/download/v$(PKG_VERSION)
  13. PKG_HASH:=50ec5a07c0c55d4ec536dd49021f2e194a26bfdbc531d03d1e9d4d3e27175659
  14. PKG_MAINTAINER:=Ken Keys <kkeys@caida.org>
  15. PKG_LICENSE:=BSD-3-Clause
  16. PKG_LICENSE_FILES:=LICENSE
  17. PKG_CPE_ID:=cpe:/a:google:protobuf
  18. HOST_BUILD_PARALLEL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. CMAKE_SOURCE_SUBDIR:=cmake
  21. include $(INCLUDE_DIR)/package.mk
  22. include $(INCLUDE_DIR)/host-build.mk
  23. include $(INCLUDE_DIR)/cmake.mk
  24. define Package/protobuf/Default
  25. SECTION:=libs
  26. CATEGORY:=Libraries
  27. TITLE:=A structured data encoding library
  28. URL:=https://github.com/google/protobuf
  29. DEPENDS:=+zlib +libpthread +libatomic +libstdcpp
  30. endef
  31. define Package/protobuf
  32. $(call Package/protobuf/Default)
  33. DEPENDS+=+protobuf-lite
  34. endef
  35. define Package/protobuf-lite
  36. $(call Package/protobuf/Default)
  37. endef
  38. define Package/protobuf/description/Default
  39. Protocol Buffers are a way of encoding structured data in an efficient
  40. yet extensible format. Google uses Protocol Buffers for almost all
  41. of its internal RPC protocols and file formats.
  42. endef
  43. define Package/protobuf/description
  44. $(call Package/protobuf/description/Default)
  45. This package provides the libprotoc, libprotobuf, and libprotobuf-lite
  46. libraries. For a much smaller protobuf package, see "protobuf-lite".
  47. endef
  48. define Package/protobuf-lite/description
  49. $(call Package/protobuf/description/Default)
  50. This package provides the libprotobuf-lite library.
  51. endef
  52. CMAKE_HOST_OPTIONS += \
  53. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  54. -Dprotobuf_BUILD_TESTS=OFF \
  55. -DBUILD_SHARED_LIBS=ON \
  56. -DCMAKE_SKIP_RPATH=OFF \
  57. -DCMAKE_INSTALL_LIBDIR=lib \
  58. -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
  59. CMAKE_OPTIONS += \
  60. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  61. -Dprotobuf_BUILD_TESTS=OFF \
  62. -Dprotobuf_WITH_ZLIB=ON \
  63. -DBUILD_SHARED_LIBS=ON
  64. TARGET_LDFLAGS += -latomic $(if $(CONFIG_USE_GLIBC),-lm)
  65. define Build/InstallDev
  66. $(call Build/InstallDev/cmake,$(1))
  67. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  68. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  69. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  70. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  71. endef
  72. define Package/protobuf-lite/install
  73. $(INSTALL_DIR) \
  74. $(1)/usr/lib
  75. $(CP) \
  76. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
  77. $(1)/usr/lib/
  78. endef
  79. define Package/protobuf/install
  80. $(INSTALL_DIR) \
  81. $(1)/usr/lib
  82. $(CP) \
  83. $(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
  84. $(1)/usr/lib/
  85. $(CP) \
  86. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
  87. $(1)/usr/lib/
  88. endef
  89. $(eval $(call BuildPackage,protobuf))
  90. $(eval $(call BuildPackage,protobuf-lite))
  91. $(eval $(call HostBuild))