Merge pull request #14101 from BKPepe/syslog
[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.14.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:=50ec5a07c0c55d4ec536dd49021f2e194a26bfdbc531d03d1e9d4d3e27175659
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_SOURCE_SUBDIR:=cmake
26
27 include $(INCLUDE_DIR)/package.mk
28 include $(INCLUDE_DIR)/host-build.mk
29 include $(INCLUDE_DIR)/cmake.mk
30
31 define Package/protobuf/Default
32 SECTION:=libs
33 CATEGORY:=Libraries
34 TITLE:=A structured data encoding library
35 URL:=https://github.com/google/protobuf
36 DEPENDS:=+zlib +libpthread +libatomic +libstdcpp
37 endef
38
39 define Package/protobuf
40 $(call Package/protobuf/Default)
41 DEPENDS+=+protobuf-lite
42 endef
43
44 define Package/protobuf-lite
45 $(call Package/protobuf/Default)
46 endef
47
48 define Package/protobuf/description/Default
49 Protocol Buffers are a way of encoding structured data in an efficient
50 yet extensible format. Google uses Protocol Buffers for almost all
51 of its internal RPC protocols and file formats.
52 endef
53
54 define Package/protobuf/description
55 $(call Package/protobuf/description/Default)
56
57 This package provides the libprotoc, libprotobuf, and libprotobuf-lite
58 libraries. For a much smaller protobuf package, see "protobuf-lite".
59
60 endef
61
62 define Package/protobuf-lite/description
63 $(call Package/protobuf/description/Default)
64
65 This package provides the libprotobuf-lite library.
66
67 endef
68
69 CMAKE_HOST_OPTIONS += \
70 -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
71 -Dprotobuf_BUILD_TESTS=OFF \
72 -DBUILD_SHARED_LIBS=ON \
73 -DCMAKE_SKIP_RPATH=OFF \
74 -DCMAKE_INSTALL_LIBDIR=lib \
75 -DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOSTPKG}/lib"
76
77 CMAKE_OPTIONS += \
78 -Dprotobuf_BUILD_PROTOC_BINARIES=ON \
79 -Dprotobuf_BUILD_TESTS=OFF \
80 -Dprotobuf_WITH_ZLIB=ON \
81 -DBUILD_SHARED_LIBS=ON
82
83 TARGET_LDFLAGS += -latomic $(if $(CONFIG_USE_GLIBC),-lm)
84
85 define Build/InstallDev
86 $(call Build/InstallDev/cmake,$(1))
87 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf.pc
88 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf.pc
89 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
90 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/protobuf-lite.pc
91 endef
92
93 define Package/protobuf-lite/install
94 $(INSTALL_DIR) \
95 $(1)/usr/lib
96
97 $(CP) \
98 $(PKG_INSTALL_DIR)/usr/lib/libprotobuf-lite.so* \
99 $(1)/usr/lib/
100 endef
101
102 define Package/protobuf/install
103 $(INSTALL_DIR) \
104 $(1)/usr/lib
105
106 $(CP) \
107 $(PKG_INSTALL_DIR)/usr/lib/libprotoc.so* \
108 $(1)/usr/lib/
109
110 $(CP) \
111 $(PKG_INSTALL_DIR)/usr/lib/libprotobuf.so* \
112 $(1)/usr/lib/
113 endef
114
115 $(eval $(call BuildPackage,protobuf))
116 $(eval $(call BuildPackage,protobuf-lite))
117 $(eval $(call HostBuild))