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.

118 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.8.0
  10. PKG_RELEASE:=5
  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_LIBDIR=lib \
  59. -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
  60. CMAKE_OPTIONS += \
  61. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  62. -Dprotobuf_BUILD_TESTS=OFF \
  63. -Dprotobuf_WITH_ZLIB=ON \
  64. -DBUILD_SHARED_LIBS=ON
  65. TARGET_LDFLAGS += -latomic $(if $(CONFIG_USE_GLIBC),-lm)
  66. define Build/InstallDev
  67. $(call Build/InstallDev/cmake,$(1))
  68. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  69. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  70. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  71. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  72. endef
  73. define Package/protobuf-lite/install
  74. $(INSTALL_DIR) \
  75. $(1)/usr/lib
  76. $(CP) \
  77. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
  78. $(1)/usr/lib/
  79. endef
  80. define Package/protobuf/install
  81. $(INSTALL_DIR) \
  82. $(1)/usr/lib
  83. $(CP) \
  84. $(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
  85. $(1)/usr/lib/
  86. $(CP) \
  87. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
  88. $(1)/usr/lib/
  89. endef
  90. $(eval $(call BuildPackage,protobuf))
  91. $(eval $(call BuildPackage,protobuf-lite))
  92. $(eval $(call HostBuild))