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
2.9 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.8.0
  10. PKG_RELEASE:=4
  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:=ddc96d83f3b7417da53bce2510b94ad2796465ef8763f7a4e82089157efe97aa
  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_INSTALL:=1
  21. CMAKE_SOURCE_SUBDIR:=cmake
  22. include $(INCLUDE_DIR)/package.mk
  23. include $(INCLUDE_DIR)/host-build.mk
  24. include $(INCLUDE_DIR)/cmake.mk
  25. define Package/protobuf/Default
  26. SECTION:=libs
  27. CATEGORY:=Libraries
  28. TITLE:=A structured data encoding library
  29. URL:=https://github.com/google/protobuf
  30. DEPENDS:=+zlib +libpthread +libatomic +libstdcpp
  31. endef
  32. define Package/protobuf
  33. $(call Package/protobuf/Default)
  34. DEPENDS+=+protobuf-lite
  35. endef
  36. define Package/protobuf-lite
  37. $(call Package/protobuf/Default)
  38. endef
  39. define Package/protobuf/description/Default
  40. Protocol Buffers are a way of encoding structured data in an efficient
  41. yet extensible format. Google uses Protocol Buffers for almost all
  42. of its internal RPC protocols and file formats.
  43. endef
  44. define Package/protobuf/description
  45. $(call Package/protobuf/description/Default)
  46. This package provides the libprotoc, libprotobuf, and libprotobuf-lite
  47. libraries. For a much smaller protobuf package, see "protobuf-lite".
  48. endef
  49. define Package/protobuf-lite/description
  50. $(call Package/protobuf/description/Default)
  51. This package provides the libprotobuf-lite library.
  52. endef
  53. CMAKE_HOST_OPTIONS += \
  54. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  55. -Dprotobuf_BUILD_TESTS=OFF \
  56. -DBUILD_SHARED_LIBS=ON \
  57. -DCMAKE_SKIP_RPATH=OFF \
  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
  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))