Merge pull request #13840 from BKPepe/python3-yarl
[feed/packages.git] / libs / protobuf / Makefile
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
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=protobuf
11 PKG_VERSION:=3.13.0
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-cpp-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://github.com/google/protobuf/releases/download/v$(PKG_VERSION)
16 PKG_HASH:=f8a547dfe143a9f61fadafba47fa6573713a33cb80909307c1502e26e1102298
17
18 PKG_MAINTAINER:=Ken Keys <kkeys@caida.org>
19 PKG_LICENSE:=BSD-3-Clause
20 PKG_LICENSE_FILES:=LICENSE
21 PKG_CPE_ID:=cpe:/a:google:protobuf
22
23 HOST_BUILD_PARALLEL:=1
24 PKG_BUILD_PARALLEL:=1
25 CMAKE_INSTALL:=1
26 CMAKE_SOURCE_SUBDIR:=cmake
27
28 include $(INCLUDE_DIR)/package.mk
29 include $(INCLUDE_DIR)/host-build.mk
30 include $(INCLUDE_DIR)/cmake.mk
31
32 define Package/protobuf/Default
33 SECTION:=libs
34 CATEGORY:=Libraries
35 TITLE:=A structured data encoding library
36 URL:=https://github.com/google/protobuf
37 DEPENDS:=+zlib +libpthread +libatomic +libstdcpp
38 endef
39
40 define Package/protobuf
41 $(call Package/protobuf/Default)
42 DEPENDS+=+protobuf-lite
43 endef
44
45 define Package/protobuf-lite
46 $(call Package/protobuf/Default)
47 endef
48
49 define Package/protobuf/description/Default
50 Protocol Buffers are a way of encoding structured data in an efficient
51 yet extensible format. Google uses Protocol Buffers for almost all
52 of its internal RPC protocols and file formats.
53 endef
54
55 define Package/protobuf/description
56 $(call Package/protobuf/description/Default)
57
58 This package provides the libprotoc, libprotobuf, and libprotobuf-lite
59 libraries. For a much smaller protobuf package, see "protobuf-lite".
60
61 endef
62
63 define Package/protobuf-lite/description
64 $(call Package/protobuf/description/Default)
65
66 This package provides the libprotobuf-lite library.
67
68 endef
69
70 CMAKE_HOST_OPTIONS += \
71 -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
72 -Dprotobuf_BUILD_TESTS=OFF \
73 -DBUILD_SHARED_LIBS=ON \
74 -DCMAKE_SKIP_RPATH=OFF \
75 -DCMAKE_INSTALL_LIBDIR=lib \
76 -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
77
78 CMAKE_OPTIONS += \
79 -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
80 -Dprotobuf_BUILD_TESTS=OFF \
81 -Dprotobuf_WITH_ZLIB=ON \
82 -DBUILD_SHARED_LIBS=ON
83
84 TARGET_LDFLAGS += -latomic $(if $(CONFIG_USE_GLIBC),-lm)
85
86 define Build/InstallDev
87 $(call Build/InstallDev/cmake,$(1))
88 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf.pc
89 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf.pc
90 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
91 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
92 endef
93
94 define Package/protobuf-lite/install
95 $(INSTALL_DIR) \
96 $(1)/usr/lib
97
98 $(CP) \
99 $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
100 $(1)/usr/lib/
101 endef
102
103 define Package/protobuf/install
104 $(INSTALL_DIR) \
105 $(1)/usr/lib
106
107 $(CP) \
108 $(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
109 $(1)/usr/lib/
110
111 $(CP) \
112 $(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
113 $(1)/usr/lib/
114 endef
115
116 $(eval $(call BuildPackage,protobuf))
117 $(eval $(call BuildPackage,protobuf-lite))
118 $(eval $(call HostBuild))