commit:     5a5cce25d69125ae024db31aa2b8f37689876164
Author:     Georgy Yakovlev <ya <AT> sysdump <DOT> net>
AuthorDate: Mon Jun 11 08:33:19 2018 +0000
Commit:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
CommitDate: Tue Jun 12 06:33:41 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a5cce25

net-libs/grpc: bump to 1.12.1, add python and more

Add python useflag and module installation.
Add tools useflag and grpc_tools installation.
Add google-perftools dep.
Add systemtap useflag to fix automagic dep.
Add doc useflag
Add examples useflag
Add myself to metadata, as discussed with perfinion

Closes: https://bugs.gentoo.org/590360

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 net-libs/grpc/Manifest                             |   2 +
 .../0006-grpc-1.12.1-allow-system-openssl.patch    |  65 +++++++++
 .../files/0007-grpc-1.12.1-allow-system-zlib.patch |  52 +++++++
 .../0008-grpc-1.12.1-allow-system-cares.patch      |  52 +++++++
 net-libs/grpc/grpc-1.12.1.ebuild                   | 159 +++++++++++++++++++++
 net-libs/grpc/metadata.xml                         |  11 ++
 6 files changed, 341 insertions(+)

diff --git a/net-libs/grpc/Manifest b/net-libs/grpc/Manifest
index 99b7d82abd1..cd8bbcbf7ef 100644
--- a/net-libs/grpc/Manifest
+++ b/net-libs/grpc/Manifest
@@ -1 +1,3 @@
 DIST grpc-1.12.0.tar.gz 13692310 BLAKE2B 
86b9063416140453718c51df4f238bb3d5ac8549ece065c95d3c461c069358badec5a9a77aef694cd11a09f53e060f9ea51f3b40d9a2424837605c4899a21c57
 SHA512 
68a8c261ea570790974769d6c0ca8138cf4242b79e9ff74a11b10d35a27f98ff24c03f3d05932ac46811c0ba7d1a094388ae8dbeb495fc8e723ad74695994d49
+DIST grpc-1.12.1.tar.gz 13692045 BLAKE2B 
d35706b553917d0f27e4474509f361ec7962b738031f11ca814d7ec33429f848b3b3356cae9a28b9a0cb376df5a6348d312c80ed4eeb51b81e68b317584a2e4a
 SHA512 
9dd6d8c4b4e2713cf27ed55b1e97fdf5ed6d80f43b798b83f08e2f4646387dfd0696b21d4f44dbd99a061d388790dc15da49ac5afb0bb06116cfd6f07b7d6962
+DIST protobuf-3.5.2.tar.gz 4584659 BLAKE2B 
f582212169d802a5844574eb900c9f8cbb343b7e73f2074e5ff0bfc544ebd13f4bc2b78271fb70f4465d78fdc39972ed68339f453c0d3ffe98d8564fbf520544
 SHA512 
09d10cf0c07a0ba249428bbf20f5dbed840965fa06b3c09682f286a4dee9d84bb96f3b5b50e993d48ef1f20440531255ce7d0e60a648bf3fe536a5f2b0b74181

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
new file mode 100644
index 00000000000..61fd830d64d
--- /dev/null
+++ b/net-libs/grpc/files/0006-grpc-1.12.1-allow-system-openssl.patch
@@ -0,0 +1,65 @@
+From 30ce693621d61efb8596503a0da212077a8c4daa Mon Sep 17 00:00:00 2001
+From: Thomas Bechtold <tbecht...@suse.com>
+Date: Thu, 24 May 2018 17:12:13 +0200
+Subject: [PATCH] Allow building the python module with system openssl
+
+When building the python module and using the new
+GRPC_PYTHON_BUILD_SYSTEM_OPENSSL env variable, the third party
+boringssl code is not compiled. Instead, the openssl shared library
+installed on the system is used during runtime.
+This is useful for distributions who don't want to include code copies
+but use shared libraries instead.
+---
+ setup.py | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 99d1a1c504e..3a5ed56c641 100644
+--- a/setup.py
++++ b/setup.py
+@@ -35,7 +35,7 @@
+ PY3 = sys.version_info.major == 3
+ PYTHON_STEM = os.path.join('src', 'python', 'grpcio')
+ CORE_INCLUDE = ('include', '.',)
+-BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
++SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
+ ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),)
+ CARES_INCLUDE = (
+     os.path.join('third_party', 'cares'),
+@@ -84,6 +84,12 @@
+ # present, then it will still attempt to use Cython.
+ BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False)
+ 
++# Export this variable to use the system installation of openssl. You need to
++# have the header files installed (in /usr/include/openssl) and during
++# runtime, the shared libary must be installed
++BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL',
++                                           False)
++
+ # Environment variable to determine whether or not to enable coverage analysis
+ # in Cython modules.
+ ENABLE_CYTHON_TRACING = os.environ.get(
+@@ -148,8 +154,13 @@
+ if "win32" in sys.platform:
+   CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES)
+ 
++if BUILD_WITH_SYSTEM_OPENSSL:
++  CORE_C_FILES = filter(lambda x: 'third_party/boringssl' not in x, 
CORE_C_FILES)
++  CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES)
++  SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),)
++
+ EXTENSION_INCLUDE_DIRECTORIES = (
+-    (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE +
++    (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +
+     CARES_INCLUDE + ADDRESS_SORTING_INCLUDE)
+ 
+ EXTENSION_LIBRARIES = ()
+@@ -159,6 +170,8 @@
+   EXTENSION_LIBRARIES += ('m',)
+ if "win32" in sys.platform:
+   EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',)
++if BUILD_WITH_SYSTEM_OPENSSL:
++  EXTENSION_LIBRARIES += ('ssl', 'crypto',)
+ 
+ DEFINE_MACROS = (
+     ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),

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
new file mode 100644
index 00000000000..6964642b119
--- /dev/null
+++ b/net-libs/grpc/files/0007-grpc-1.12.1-allow-system-zlib.patch
@@ -0,0 +1,52 @@
+From 3823d9048102bce79e165584c62a1a5b91810aeb Mon Sep 17 00:00:00 2001
+From: Thomas Bechtold <tbecht...@suse.com>
+Date: Fri, 25 May 2018 06:52:23 +0200
+Subject: [PATCH] Allow building the python module with system zlib
+
+When building the python module and using the new
+GRPC_PYTHON_BUILD_SYSTEM_ZLIB env variable, the third party zlib code
+is not compiled. Instead, the zlib shared library installed on the
+system is used during runtime.
+This is useful for distributions who don't want to include code copies
+but use shared libraries instead.
+---
+ setup.py | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/setup.py b/setup.py
+index 3a5ed56c641..483d3ac1682 100644
+--- a/setup.py
++++ b/setup.py
+@@ -90,6 +90,12 @@
+ BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL',
+                                            False)
+ 
++# Export this variable to use the system installation of zlib. You need to
++# have the header files installed (in /usr/include/) and during
++# runtime, the shared libary must be installed
++BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB',
++                                        False)
++
+ # Environment variable to determine whether or not to enable coverage analysis
+ # in Cython modules.
+ ENABLE_CYTHON_TRACING = os.environ.get(
+@@ -159,6 +165,10 @@
+   CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES)
+   SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),)
+ 
++if BUILD_WITH_SYSTEM_ZLIB:
++  CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES)
++  ZLIB_INCLUDE = (os.path.join('/usr', 'include'),)
++
+ EXTENSION_INCLUDE_DIRECTORIES = (
+     (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +
+     CARES_INCLUDE + ADDRESS_SORTING_INCLUDE)
+@@ -172,6 +182,8 @@
+   EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',)
+ if BUILD_WITH_SYSTEM_OPENSSL:
+   EXTENSION_LIBRARIES += ('ssl', 'crypto',)
++if BUILD_WITH_SYSTEM_ZLIB:
++  EXTENSION_LIBRARIES += ('z',)
+ 
+ DEFINE_MACROS = (
+     ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),

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
new file mode 100644
index 00000000000..c2e20f3994f
--- /dev/null
+++ b/net-libs/grpc/files/0008-grpc-1.12.1-allow-system-cares.patch
@@ -0,0 +1,52 @@
+From 78a6e04ec1efc2dc839f0329dcff732940e27fd9 Mon Sep 17 00:00:00 2001
+From: Thomas Bechtold <tbecht...@suse.com>
+Date: Fri, 25 May 2018 07:08:05 +0200
+Subject: [PATCH] Allow building the python module with system cares
+
+When building the python module and using the new
+GRPC_PYTHON_BUILD_SYSTEM_CARES env variable, the third party cares code
+is not compiled. Instead, the cares shared library installed on the
+system is used during runtime.
+This is useful for distributions who don't want to include code copies
+but use shared libraries instead.
+---
+ setup.py | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/setup.py b/setup.py
+index 483d3ac1682..43c25aafeb9 100644
+--- a/setup.py
++++ b/setup.py
+@@ -96,6 +96,12 @@
+ BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB',
+                                         False)
+ 
++# Export this variable to use the system installation of cares. You need to
++# have the header files installed (in /usr/include/) and during
++# runtime, the shared libary must be installed
++BUILD_WITH_SYSTEM_CARES = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_CARES',
++                                         False)
++
+ # Environment variable to determine whether or not to enable coverage analysis
+ # in Cython modules.
+ ENABLE_CYTHON_TRACING = os.environ.get(
+@@ -169,6 +175,10 @@
+   CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES)
+   ZLIB_INCLUDE = (os.path.join('/usr', 'include'),)
+ 
++if BUILD_WITH_SYSTEM_CARES:
++  CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES)
++  CARES_INCLUDE = (os.path.join('/usr', 'include'),)
++
+ EXTENSION_INCLUDE_DIRECTORIES = (
+     (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE +
+     CARES_INCLUDE + ADDRESS_SORTING_INCLUDE)
+@@ -184,6 +194,8 @@
+   EXTENSION_LIBRARIES += ('ssl', 'crypto',)
+ if BUILD_WITH_SYSTEM_ZLIB:
+   EXTENSION_LIBRARIES += ('z',)
++if BUILD_WITH_SYSTEM_CARES:
++  EXTENSION_LIBRARIES += ('cares',)
+ 
+ DEFINE_MACROS = (
+     ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),

diff --git a/net-libs/grpc/grpc-1.12.1.ebuild b/net-libs/grpc/grpc-1.12.1.ebuild
new file mode 100644
index 00000000000..774c0518b1d
--- /dev/null
+++ b/net-libs/grpc/grpc-1.12.1.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
+DISTUTILS_OPTIONAL=1
+
+inherit distutils-r1 flag-o-matic toolchain-funcs
+
+# should match pinned git submodule version of third_party/protobuf
+# look it up here https://github.com/grpc/grpc/tree/v"${PV}"/third_party
+PROTOBUF_VERSION="3.5.2"
+
+DESCRIPTION="Modern open source high performance RPC framework"
+HOMEPAGE="http://www.grpc.io";
+SRC_URI="
+       https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
+       tools? ( 
https://github.com/google/protobuf/archive/v${PROTOBUF_VERSION}.tar.gz -> 
protobuf-${PROTOBUF_VERSION}.tar.gz )
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples doc python systemtap tools"
+
+REQUIRED_USE="
+       python? ( ${PYTHON_REQUIRED_USE} )
+       tools? ( python )
+"
+
+DEPEND="
+       >=dev-libs/openssl-1.0.2:0=[-bindist]
+       >=dev-libs/protobuf-3.5:=
+       dev-util/google-perftools
+       net-dns/c-ares:=
+       sys-libs/zlib:=
+       python? ( ${PYTHON_DEPS}
+               dev-python/coverage[${PYTHON_USEDEP}]
+               dev-python/cython[${PYTHON_USEDEP}]
+               >=dev-python/protobuf-python-3.5.1:=[${PYTHON_USEDEP}]
+               dev-python/six[${PYTHON_USEDEP}]
+               dev-python/wheel[${PYTHON_USEDEP}]
+               virtual/python-enum34[${PYTHON_USEDEP}]
+               virtual/python-futures[${PYTHON_USEDEP}]
+               doc? (
+                       dev-python/sphinx[${PYTHON_USEDEP}]
+                       dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
+               )
+       )
+       systemtap? ( dev-util/systemtap )
+"
+
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/0001-grpc-1.11.0-Fix-cross-compiling.patch"
+       "${FILESDIR}/0002-grpc-1.3.0-Fix-unsecure-.pc-files.patch"
+       "${FILESDIR}/0003-grpc-1.3.0-Don-t-run-ldconfig.patch"
+       "${FILESDIR}/0004-grpc-1.11.0-fix-cpp-so-version.patch"
+       "${FILESDIR}/0005-grpc-1.11.0-pkgconfig-libdir.patch"
+       "${FILESDIR}/0006-grpc-1.12.1-allow-system-openssl.patch"
+       "${FILESDIR}/0007-grpc-1.12.1-allow-system-zlib.patch"
+       "${FILESDIR}/0008-grpc-1.12.1-allow-system-cares.patch"
+)
+
+src_prepare() {
+       sed -i 's@$(prefix)/lib@$(prefix)/$(INSTALL_LIBDIR)@g' Makefile || die 
"fix libdir"
+       default
+       use python && distutils-r1_src_prepare
+}
+
+python_prepare() {
+       if use tools; then
+               rm -r third_party/protobuf || die "removing empty protobuf dir 
failed"
+               ln -s "${S}"/../protobuf-"${PROTOBUF_VERSION}" 
third_party/protobuf || die
+               pushd tools/distrib/python/grpcio_tools >/dev/null || die
+               # absolute symlinks will fail because out-of-source build
+               # ./src -> ${S}/src
+               ln -s ../../../../src ./ || die
+               # ./third_party -> ${S}/third_party
+               ln -s ../../../../third_party ./ || die
+               # ./grpc_root -> ${S}
+               ln -s ../../../../ ./grpc_root || die
+               popd >/dev/null || die
+       fi
+}
+
+src_compile() {
+       tc-export CC CXX PKG_CONFIG
+       emake \
+               V=1 \
+               prefix=/usr \
+               INSTALL_LIBDIR="$(get_libdir)" \
+               AR="$(tc-getAR)" \
+               AROPTS="rcs" \
+               CFLAGS="${CFLAGS}" \
+               LD="${CC}" \
+               LDXX="${CXX}" \
+               STRIP=true \
+               HOST_CC="$(tc-getBUILD_CC)" \
+               HOST_CXX="$(tc-getBUILD_CXX)" \
+               HOST_LD="$(tc-getBUILD_CC)" \
+               HOST_LDXX="$(tc-getBUILD_CXX)" \
+               HOST_AR="$(tc-getBUILD_AR)" \
+               HAS_SYSTEMTAP="$(usex systemtap true false)"
+
+       use python && distutils-r1_src_compile
+}
+
+python_compile() {
+       export GRPC_PYTHON_BUILD_SYSTEM_CARES=1
+       export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
+       export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
+       export GRPC_PYTHON_BUILD_WITH_CYTHON=1
+       distutils-r1_python_compile
+
+       if use tools; then
+               pushd tools/distrib/python/grpcio_tools >/dev/null || die
+               distutils-r1_python_compile
+               popd >/dev/null || die
+       fi
+}
+
+python_compile_all() {
+       if use doc; then
+               esetup.py doc
+               mv doc/build doc/html || die
+       fi
+}
+
+src_install() {
+       emake \
+               prefix="${D}"/usr \
+               INSTALL_LIBDIR="$(get_libdir)" \
+               STRIP=true \
+               install
+
+       if use examples; then
+               docinto examples
+               dodoc -r examples/.
+               docompress -x /usr/share/doc/${PF}/examples
+       fi
+
+       use doc && local DOCS=( AUTHORS README.md doc/. )
+       einstalldocs
+
+       use python && distutils-r1_src_install
+}
+
+python_install() {
+       distutils-r1_python_install
+
+       if use tools; then
+               pushd tools/distrib/python/grpcio_tools >/dev/null || die
+               distutils-r1_python_install
+               popd >/dev/null || die
+       fi
+}

diff --git a/net-libs/grpc/metadata.xml b/net-libs/grpc/metadata.xml
index 13bfd9fea3d..ccdf17cc01e 100644
--- a/net-libs/grpc/metadata.xml
+++ b/net-libs/grpc/metadata.xml
@@ -4,7 +4,18 @@
        <maintainer type="person">
                <email>perfin...@gentoo.org</email>
        </maintainer>
+       <maintainer type="person">
+               <email>y...@sysdump.net</email>
+               <name>Georgy Yakovlev</name>
+       </maintainer>
        <longdescription lang="en">
                A high performance, open-source universal RPC framework
        </longdescription>
+       <use>
+               <flag name="systemtap">Enable SystemTAP/DTrace tracing</flag>
+               <flag name="tools">Install gRPC python tools</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">grpc/grpc</remote-id>
+       </upstream>
 </pkgmetadata>

Reply via email to