Gentoo Archives: gentoo-commits

From: Jason Zaman <perfinion@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/grpc/files/, net-libs/grpc/
Date: Tue, 12 Jun 2018 06:53:32
Message-Id: 1528785221.5a5cce25d69125ae024db31aa2b8f37689876164.perfinion@gentoo
1 commit: 5a5cce25d69125ae024db31aa2b8f37689876164
2 Author: Georgy Yakovlev <ya <AT> sysdump <DOT> net>
3 AuthorDate: Mon Jun 11 08:33:19 2018 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Tue Jun 12 06:33:41 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a5cce25
7
8 net-libs/grpc: bump to 1.12.1, add python and more
9
10 Add python useflag and module installation.
11 Add tools useflag and grpc_tools installation.
12 Add google-perftools dep.
13 Add systemtap useflag to fix automagic dep.
14 Add doc useflag
15 Add examples useflag
16 Add myself to metadata, as discussed with perfinion
17
18 Closes: https://bugs.gentoo.org/590360
19
20 Package-Manager: Portage-2.3.40, Repoman-2.3.9
21
22 net-libs/grpc/Manifest | 2 +
23 .../0006-grpc-1.12.1-allow-system-openssl.patch | 65 +++++++++
24 .../files/0007-grpc-1.12.1-allow-system-zlib.patch | 52 +++++++
25 .../0008-grpc-1.12.1-allow-system-cares.patch | 52 +++++++
26 net-libs/grpc/grpc-1.12.1.ebuild | 159 +++++++++++++++++++++
27 net-libs/grpc/metadata.xml | 11 ++
28 6 files changed, 341 insertions(+)
29
30 diff --git a/net-libs/grpc/Manifest b/net-libs/grpc/Manifest
31 index 99b7d82abd1..cd8bbcbf7ef 100644
32 --- a/net-libs/grpc/Manifest
33 +++ b/net-libs/grpc/Manifest
34 @@ -1 +1,3 @@
35 DIST grpc-1.12.0.tar.gz 13692310 BLAKE2B 86b9063416140453718c51df4f238bb3d5ac8549ece065c95d3c461c069358badec5a9a77aef694cd11a09f53e060f9ea51f3b40d9a2424837605c4899a21c57 SHA512 68a8c261ea570790974769d6c0ca8138cf4242b79e9ff74a11b10d35a27f98ff24c03f3d05932ac46811c0ba7d1a094388ae8dbeb495fc8e723ad74695994d49
36 +DIST grpc-1.12.1.tar.gz 13692045 BLAKE2B d35706b553917d0f27e4474509f361ec7962b738031f11ca814d7ec33429f848b3b3356cae9a28b9a0cb376df5a6348d312c80ed4eeb51b81e68b317584a2e4a SHA512 9dd6d8c4b4e2713cf27ed55b1e97fdf5ed6d80f43b798b83f08e2f4646387dfd0696b21d4f44dbd99a061d388790dc15da49ac5afb0bb06116cfd6f07b7d6962
37 +DIST protobuf-3.5.2.tar.gz 4584659 BLAKE2B f582212169d802a5844574eb900c9f8cbb343b7e73f2074e5ff0bfc544ebd13f4bc2b78271fb70f4465d78fdc39972ed68339f453c0d3ffe98d8564fbf520544 SHA512 09d10cf0c07a0ba249428bbf20f5dbed840965fa06b3c09682f286a4dee9d84bb96f3b5b50e993d48ef1f20440531255ce7d0e60a648bf3fe536a5f2b0b74181
38
39 diff --git a/net-libs/grpc/files/0006-grpc-1.12.1-allow-system-openssl.patch b/net-libs/grpc/files/0006-grpc-1.12.1-allow-system-openssl.patch
40 new file mode 100644
41 index 00000000000..61fd830d64d
42 --- /dev/null
43 +++ b/net-libs/grpc/files/0006-grpc-1.12.1-allow-system-openssl.patch
44 @@ -0,0 +1,65 @@
45 +From 30ce693621d61efb8596503a0da212077a8c4daa Mon Sep 17 00:00:00 2001
46 +From: Thomas Bechtold <tbechtold@××××.com>
47 +Date: Thu, 24 May 2018 17:12:13 +0200
48 +Subject: [PATCH] Allow building the python module with system openssl
49 +
50 +When building the python module and using the new
51 +GRPC_PYTHON_BUILD_SYSTEM_OPENSSL env variable, the third party
52 +boringssl code is not compiled. Instead, the openssl shared library
53 +installed on the system is used during runtime.
54 +This is useful for distributions who don't want to include code copies
55 +but use shared libraries instead.
56 +---
57 + setup.py | 17 +++++++++++++++--
58 + 1 file changed, 15 insertions(+), 2 deletions(-)
59 +
60 +diff --git a/setup.py b/setup.py
61 +index 99d1a1c504e..3a5ed56c641 100644
62 +--- a/setup.py
63 ++++ b/setup.py
64 +@@ -35,7 +35,7 @@
65 + PY3 = sys.version_info.major == 3
66 + PYTHON_STEM = os.path.join('src', 'python', 'grpcio')
67 + CORE_INCLUDE = ('include', '.',)
68 +-BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
69 ++SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
70 + ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),)
71 + CARES_INCLUDE = (
72 + os.path.join('third_party', 'cares'),
73 +@@ -84,6 +84,12 @@
74 + # present, then it will still attempt to use Cython.
75 + BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False)
76 +
77 ++# Export this variable to use the system installation of openssl. You need to
78 ++# have the header files installed (in /usr/include/openssl) and during
79 ++# runtime, the shared libary must be installed
80 ++BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL',
81 ++ False)
82 ++
83 + # Environment variable to determine whether or not to enable coverage analysis
84 + # in Cython modules.
85 + ENABLE_CYTHON_TRACING = os.environ.get(
86 +@@ -148,8 +154,13 @@
87 + if "win32" in sys.platform:
88 + CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES)
89 +
90 ++if BUILD_WITH_SYSTEM_OPENSSL:
91 ++ CORE_C_FILES = filter(lambda x: 'third_party/boringssl' not in x, CORE_C_FILES)
92 ++ CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES)
93 ++ SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),)
94 ++
95 + EXTENSION_INCLUDE_DIRECTORIES = (
96 +- (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE +
97 ++ (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +
98 + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE)
99 +
100 + EXTENSION_LIBRARIES = ()
101 +@@ -159,6 +170,8 @@
102 + EXTENSION_LIBRARIES += ('m',)
103 + if "win32" in sys.platform:
104 + EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',)
105 ++if BUILD_WITH_SYSTEM_OPENSSL:
106 ++ EXTENSION_LIBRARIES += ('ssl', 'crypto',)
107 +
108 + DEFINE_MACROS = (
109 + ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),
110
111 diff --git a/net-libs/grpc/files/0007-grpc-1.12.1-allow-system-zlib.patch b/net-libs/grpc/files/0007-grpc-1.12.1-allow-system-zlib.patch
112 new file mode 100644
113 index 00000000000..6964642b119
114 --- /dev/null
115 +++ b/net-libs/grpc/files/0007-grpc-1.12.1-allow-system-zlib.patch
116 @@ -0,0 +1,52 @@
117 +From 3823d9048102bce79e165584c62a1a5b91810aeb Mon Sep 17 00:00:00 2001
118 +From: Thomas Bechtold <tbechtold@××××.com>
119 +Date: Fri, 25 May 2018 06:52:23 +0200
120 +Subject: [PATCH] Allow building the python module with system zlib
121 +
122 +When building the python module and using the new
123 +GRPC_PYTHON_BUILD_SYSTEM_ZLIB env variable, the third party zlib code
124 +is not compiled. Instead, the zlib shared library installed on the
125 +system is used during runtime.
126 +This is useful for distributions who don't want to include code copies
127 +but use shared libraries instead.
128 +---
129 + setup.py | 12 ++++++++++++
130 + 1 file changed, 12 insertions(+)
131 +
132 +diff --git a/setup.py b/setup.py
133 +index 3a5ed56c641..483d3ac1682 100644
134 +--- a/setup.py
135 ++++ b/setup.py
136 +@@ -90,6 +90,12 @@
137 + BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL',
138 + False)
139 +
140 ++# Export this variable to use the system installation of zlib. You need to
141 ++# have the header files installed (in /usr/include/) and during
142 ++# runtime, the shared libary must be installed
143 ++BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB',
144 ++ False)
145 ++
146 + # Environment variable to determine whether or not to enable coverage analysis
147 + # in Cython modules.
148 + ENABLE_CYTHON_TRACING = os.environ.get(
149 +@@ -159,6 +165,10 @@
150 + CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES)
151 + SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),)
152 +
153 ++if BUILD_WITH_SYSTEM_ZLIB:
154 ++ CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES)
155 ++ ZLIB_INCLUDE = (os.path.join('/usr', 'include'),)
156 ++
157 + EXTENSION_INCLUDE_DIRECTORIES = (
158 + (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +
159 + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE)
160 +@@ -172,6 +182,8 @@
161 + EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',)
162 + if BUILD_WITH_SYSTEM_OPENSSL:
163 + EXTENSION_LIBRARIES += ('ssl', 'crypto',)
164 ++if BUILD_WITH_SYSTEM_ZLIB:
165 ++ EXTENSION_LIBRARIES += ('z',)
166 +
167 + DEFINE_MACROS = (
168 + ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),
169
170 diff --git a/net-libs/grpc/files/0008-grpc-1.12.1-allow-system-cares.patch b/net-libs/grpc/files/0008-grpc-1.12.1-allow-system-cares.patch
171 new file mode 100644
172 index 00000000000..c2e20f3994f
173 --- /dev/null
174 +++ b/net-libs/grpc/files/0008-grpc-1.12.1-allow-system-cares.patch
175 @@ -0,0 +1,52 @@
176 +From 78a6e04ec1efc2dc839f0329dcff732940e27fd9 Mon Sep 17 00:00:00 2001
177 +From: Thomas Bechtold <tbechtold@××××.com>
178 +Date: Fri, 25 May 2018 07:08:05 +0200
179 +Subject: [PATCH] Allow building the python module with system cares
180 +
181 +When building the python module and using the new
182 +GRPC_PYTHON_BUILD_SYSTEM_CARES env variable, the third party cares code
183 +is not compiled. Instead, the cares shared library installed on the
184 +system is used during runtime.
185 +This is useful for distributions who don't want to include code copies
186 +but use shared libraries instead.
187 +---
188 + setup.py | 12 ++++++++++++
189 + 1 file changed, 12 insertions(+)
190 +
191 +diff --git a/setup.py b/setup.py
192 +index 483d3ac1682..43c25aafeb9 100644
193 +--- a/setup.py
194 ++++ b/setup.py
195 +@@ -96,6 +96,12 @@
196 + BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB',
197 + False)
198 +
199 ++# Export this variable to use the system installation of cares. You need to
200 ++# have the header files installed (in /usr/include/) and during
201 ++# runtime, the shared libary must be installed
202 ++BUILD_WITH_SYSTEM_CARES = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_CARES',
203 ++ False)
204 ++
205 + # Environment variable to determine whether or not to enable coverage analysis
206 + # in Cython modules.
207 + ENABLE_CYTHON_TRACING = os.environ.get(
208 +@@ -169,6 +175,10 @@
209 + CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES)
210 + ZLIB_INCLUDE = (os.path.join('/usr', 'include'),)
211 +
212 ++if BUILD_WITH_SYSTEM_CARES:
213 ++ CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES)
214 ++ CARES_INCLUDE = (os.path.join('/usr', 'include'),)
215 ++
216 + EXTENSION_INCLUDE_DIRECTORIES = (
217 + (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +
218 + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE)
219 +@@ -184,6 +194,8 @@
220 + EXTENSION_LIBRARIES += ('ssl', 'crypto',)
221 + if BUILD_WITH_SYSTEM_ZLIB:
222 + EXTENSION_LIBRARIES += ('z',)
223 ++if BUILD_WITH_SYSTEM_CARES:
224 ++ EXTENSION_LIBRARIES += ('cares',)
225 +
226 + DEFINE_MACROS = (
227 + ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),
228
229 diff --git a/net-libs/grpc/grpc-1.12.1.ebuild b/net-libs/grpc/grpc-1.12.1.ebuild
230 new file mode 100644
231 index 00000000000..774c0518b1d
232 --- /dev/null
233 +++ b/net-libs/grpc/grpc-1.12.1.ebuild
234 @@ -0,0 +1,159 @@
235 +# Copyright 1999-2018 Gentoo Foundation
236 +# Distributed under the terms of the GNU General Public License v2
237 +
238 +EAPI=6
239 +
240 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
241 +DISTUTILS_OPTIONAL=1
242 +
243 +inherit distutils-r1 flag-o-matic toolchain-funcs
244 +
245 +# should match pinned git submodule version of third_party/protobuf
246 +# look it up here https://github.com/grpc/grpc/tree/v"${PV}"/third_party
247 +PROTOBUF_VERSION="3.5.2"
248 +
249 +DESCRIPTION="Modern open source high performance RPC framework"
250 +HOMEPAGE="http://www.grpc.io"
251 +SRC_URI="
252 + https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
253 + tools? ( https://github.com/google/protobuf/archive/v${PROTOBUF_VERSION}.tar.gz -> protobuf-${PROTOBUF_VERSION}.tar.gz )
254 +"
255 +
256 +LICENSE="Apache-2.0"
257 +SLOT="0"
258 +KEYWORDS="~amd64 ~x86"
259 +IUSE="examples doc python systemtap tools"
260 +
261 +REQUIRED_USE="
262 + python? ( ${PYTHON_REQUIRED_USE} )
263 + tools? ( python )
264 +"
265 +
266 +DEPEND="
267 + >=dev-libs/openssl-1.0.2:0=[-bindist]
268 + >=dev-libs/protobuf-3.5:=
269 + dev-util/google-perftools
270 + net-dns/c-ares:=
271 + sys-libs/zlib:=
272 + python? ( ${PYTHON_DEPS}
273 + dev-python/coverage[${PYTHON_USEDEP}]
274 + dev-python/cython[${PYTHON_USEDEP}]
275 + >=dev-python/protobuf-python-3.5.1:=[${PYTHON_USEDEP}]
276 + dev-python/six[${PYTHON_USEDEP}]
277 + dev-python/wheel[${PYTHON_USEDEP}]
278 + virtual/python-enum34[${PYTHON_USEDEP}]
279 + virtual/python-futures[${PYTHON_USEDEP}]
280 + doc? (
281 + dev-python/sphinx[${PYTHON_USEDEP}]
282 + dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
283 + )
284 + )
285 + systemtap? ( dev-util/systemtap )
286 +"
287 +
288 +RDEPEND="${DEPEND}"
289 +
290 +PATCHES=(
291 + "${FILESDIR}/0001-grpc-1.11.0-Fix-cross-compiling.patch"
292 + "${FILESDIR}/0002-grpc-1.3.0-Fix-unsecure-.pc-files.patch"
293 + "${FILESDIR}/0003-grpc-1.3.0-Don-t-run-ldconfig.patch"
294 + "${FILESDIR}/0004-grpc-1.11.0-fix-cpp-so-version.patch"
295 + "${FILESDIR}/0005-grpc-1.11.0-pkgconfig-libdir.patch"
296 + "${FILESDIR}/0006-grpc-1.12.1-allow-system-openssl.patch"
297 + "${FILESDIR}/0007-grpc-1.12.1-allow-system-zlib.patch"
298 + "${FILESDIR}/0008-grpc-1.12.1-allow-system-cares.patch"
299 +)
300 +
301 +src_prepare() {
302 + sed -i 's@$(prefix)/lib@$(prefix)/$(INSTALL_LIBDIR)@g' Makefile || die "fix libdir"
303 + default
304 + use python && distutils-r1_src_prepare
305 +}
306 +
307 +python_prepare() {
308 + if use tools; then
309 + rm -r third_party/protobuf || die "removing empty protobuf dir failed"
310 + ln -s "${S}"/../protobuf-"${PROTOBUF_VERSION}" third_party/protobuf || die
311 + pushd tools/distrib/python/grpcio_tools >/dev/null || die
312 + # absolute symlinks will fail because out-of-source build
313 + # ./src -> ${S}/src
314 + ln -s ../../../../src ./ || die
315 + # ./third_party -> ${S}/third_party
316 + ln -s ../../../../third_party ./ || die
317 + # ./grpc_root -> ${S}
318 + ln -s ../../../../ ./grpc_root || die
319 + popd >/dev/null || die
320 + fi
321 +}
322 +
323 +src_compile() {
324 + tc-export CC CXX PKG_CONFIG
325 + emake \
326 + V=1 \
327 + prefix=/usr \
328 + INSTALL_LIBDIR="$(get_libdir)" \
329 + AR="$(tc-getAR)" \
330 + AROPTS="rcs" \
331 + CFLAGS="${CFLAGS}" \
332 + LD="${CC}" \
333 + LDXX="${CXX}" \
334 + STRIP=true \
335 + HOST_CC="$(tc-getBUILD_CC)" \
336 + HOST_CXX="$(tc-getBUILD_CXX)" \
337 + HOST_LD="$(tc-getBUILD_CC)" \
338 + HOST_LDXX="$(tc-getBUILD_CXX)" \
339 + HOST_AR="$(tc-getBUILD_AR)" \
340 + HAS_SYSTEMTAP="$(usex systemtap true false)"
341 +
342 + use python && distutils-r1_src_compile
343 +}
344 +
345 +python_compile() {
346 + export GRPC_PYTHON_BUILD_SYSTEM_CARES=1
347 + export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
348 + export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
349 + export GRPC_PYTHON_BUILD_WITH_CYTHON=1
350 + distutils-r1_python_compile
351 +
352 + if use tools; then
353 + pushd tools/distrib/python/grpcio_tools >/dev/null || die
354 + distutils-r1_python_compile
355 + popd >/dev/null || die
356 + fi
357 +}
358 +
359 +python_compile_all() {
360 + if use doc; then
361 + esetup.py doc
362 + mv doc/build doc/html || die
363 + fi
364 +}
365 +
366 +src_install() {
367 + emake \
368 + prefix="${D}"/usr \
369 + INSTALL_LIBDIR="$(get_libdir)" \
370 + STRIP=true \
371 + install
372 +
373 + if use examples; then
374 + docinto examples
375 + dodoc -r examples/.
376 + docompress -x /usr/share/doc/${PF}/examples
377 + fi
378 +
379 + use doc && local DOCS=( AUTHORS README.md doc/. )
380 + einstalldocs
381 +
382 + use python && distutils-r1_src_install
383 +}
384 +
385 +python_install() {
386 + distutils-r1_python_install
387 +
388 + if use tools; then
389 + pushd tools/distrib/python/grpcio_tools >/dev/null || die
390 + distutils-r1_python_install
391 + popd >/dev/null || die
392 + fi
393 +}
394
395 diff --git a/net-libs/grpc/metadata.xml b/net-libs/grpc/metadata.xml
396 index 13bfd9fea3d..ccdf17cc01e 100644
397 --- a/net-libs/grpc/metadata.xml
398 +++ b/net-libs/grpc/metadata.xml
399 @@ -4,7 +4,18 @@
400 <maintainer type="person">
401 <email>perfinion@g.o</email>
402 </maintainer>
403 + <maintainer type="person">
404 + <email>ya@×××××××.net</email>
405 + <name>Georgy Yakovlev</name>
406 + </maintainer>
407 <longdescription lang="en">
408 A high performance, open-source universal RPC framework
409 </longdescription>
410 + <use>
411 + <flag name="systemtap">Enable SystemTAP/DTrace tracing</flag>
412 + <flag name="tools">Install gRPC python tools</flag>
413 + </use>
414 + <upstream>
415 + <remote-id type="github">grpc/grpc</remote-id>
416 + </upstream>
417 </pkgmetadata>