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