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.

113 lines
2.8 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:=2
  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. HOST_BUILD_PARALLEL:=1
  18. PKG_BUILD_PARALLEL:=1
  19. CMAKE_INSTALL:=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. CMAKE_OPTIONS += \
  56. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  57. -Dprotobuf_BUILD_TESTS=OFF \
  58. -Dprotobuf_WITH_ZLIB=ON \
  59. -DBUILD_SHARED_LIBS=ON
  60. TARGET_LDFLAGS += -latomic
  61. define Build/InstallDev
  62. $(call Build/InstallDev/cmake,$(1))
  63. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  64. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  65. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  66. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  67. endef
  68. define Package/protobuf-lite/install
  69. $(INSTALL_DIR) \
  70. $(1)/usr/lib
  71. $(CP) \
  72. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
  73. $(1)/usr/lib/
  74. endef
  75. define Package/protobuf/install
  76. $(INSTALL_DIR) \
  77. $(1)/usr/lib
  78. $(CP) \
  79. $(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
  80. $(1)/usr/lib/
  81. $(CP) \
  82. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
  83. $(1)/usr/lib/
  84. endef
  85. $(eval $(call BuildPackage,protobuf))
  86. $(eval $(call BuildPackage,protobuf-lite))
  87. $(eval $(call HostBuild))