Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.17.3
  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:=51cec99f108b83422b7af1170afd7aeb2dd77d2bcbb7b6bad1f92509e9ccf8cb
  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. CMAKE_SOURCE_SUBDIR:=cmake
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/host-build.mk
  21. include $(INCLUDE_DIR)/cmake.mk
  22. define Package/protobuf/Default
  23. SECTION:=libs
  24. CATEGORY:=Libraries
  25. TITLE:=A structured data encoding library
  26. URL:=https://github.com/google/protobuf
  27. DEPENDS:=+zlib +libpthread +libatomic +libstdcpp
  28. endef
  29. define Package/protobuf
  30. $(call Package/protobuf/Default)
  31. DEPENDS+=+protobuf-lite
  32. endef
  33. define Package/protobuf-lite
  34. $(call Package/protobuf/Default)
  35. endef
  36. define Package/protobuf/description/Default
  37. Protocol Buffers are a way of encoding structured data in an efficient
  38. yet extensible format. Google uses Protocol Buffers for almost all
  39. of its internal RPC protocols and file formats.
  40. endef
  41. define Package/protobuf/description
  42. $(call Package/protobuf/description/Default)
  43. This package provides the libprotoc, libprotobuf, and libprotobuf-lite
  44. libraries. For a much smaller protobuf package, see "protobuf-lite".
  45. endef
  46. define Package/protobuf-lite/description
  47. $(call Package/protobuf/description/Default)
  48. This package provides the libprotobuf-lite library.
  49. endef
  50. CMAKE_HOST_OPTIONS += \
  51. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  52. -Dprotobuf_BUILD_TESTS=OFF \
  53. -DBUILD_SHARED_LIBS=ON \
  54. -DCMAKE_SKIP_RPATH=OFF \
  55. -DCMAKE_INSTALL_LIBDIR=lib \
  56. -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
  57. CMAKE_OPTIONS += \
  58. -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
  59. -Dprotobuf_BUILD_TESTS=OFF \
  60. -Dprotobuf_WITH_ZLIB=ON \
  61. -DBUILD_SHARED_LIBS=ON
  62. TARGET_LDFLAGS += -latomic $(if $(CONFIG_USE_GLIBC),-lm)
  63. define Build/InstallDev
  64. $(call Build/InstallDev/cmake,$(1))
  65. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  66. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf.pc
  67. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  68. $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
  69. endef
  70. define Package/protobuf-lite/install
  71. $(INSTALL_DIR) \
  72. $(1)/usr/lib
  73. $(CP) \
  74. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
  75. $(1)/usr/lib/
  76. endef
  77. define Package/protobuf/install
  78. $(INSTALL_DIR) \
  79. $(1)/usr/lib
  80. $(CP) \
  81. $(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
  82. $(1)/usr/lib/
  83. $(CP) \
  84. $(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
  85. $(1)/usr/lib/
  86. endef
  87. $(eval $(call BuildPackage,protobuf))
  88. $(eval $(call BuildPackage,protobuf-lite))
  89. $(eval $(call HostBuild))