1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
9 inherit distutils-r1 flag-o-matic toolchain-funcs
11 # should match pinned git submodule version of third_party/protobuf
12 # look it up here https://github.com/grpc/grpc/tree/v"${PV}"/third_party
13 # also should ~depend on same version of dev-libs/protobuf below
14 PROTOBUF_VERSION="3.5.2"
16 DESCRIPTION="Modern open source high performance RPC framework"
17 HOMEPAGE="http://www.grpc.io"
19 https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
20 tools? ( https://github.com/google/protobuf/archive/v${PROTOBUF_VERSION}.tar.gz -> protobuf-${PROTOBUF_VERSION}.tar.gz )
25 KEYWORDS="~amd64 ~x86"
26 IUSE="examples doc python systemtap static-libs tools"
29 python? ( ${PYTHON_REQUIRED_USE} )
34 >=dev-libs/openssl-1.0.2:0=[-bindist]
35 ~dev-libs/protobuf-${PROTOBUF_VERSION}:=
36 dev-util/google-perftools
39 python? ( ${PYTHON_DEPS}
40 dev-python/coverage[${PYTHON_USEDEP}]
41 dev-python/cython[${PYTHON_USEDEP}]
42 >=dev-python/protobuf-python-3.5.1:=[${PYTHON_USEDEP}]
43 dev-python/six[${PYTHON_USEDEP}]
44 dev-python/wheel[${PYTHON_USEDEP}]
45 virtual/python-enum34[${PYTHON_USEDEP}]
46 virtual/python-futures[${PYTHON_USEDEP}]
48 systemtap? ( dev-util/systemtap )
55 dev-python/sphinx[${PYTHON_USEDEP}]
56 dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
62 "${FILESDIR}/0001-grpc-1.13.0-fix-host-ar-handling.patch"
63 "${FILESDIR}/0002-grpc-1.3.0-Fix-unsecure-.pc-files.patch"
64 "${FILESDIR}/0003-grpc-1.3.0-Don-t-run-ldconfig.patch"
65 "${FILESDIR}/0004-grpc-1.11.0-fix-cpp-so-version.patch"
66 "${FILESDIR}/0005-grpc-1.11.0-pkgconfig-libdir.patch"
67 "${FILESDIR}/0009-grpc-1.12.1-gcc8-fixes.patch"
71 sed -i 's@$(prefix)/lib@$(prefix)/$(INSTALL_LIBDIR)@g' Makefile || die "fix libdir"
73 use python && distutils-r1_src_prepare
78 rm -r third_party/protobuf || die "removing empty protobuf dir failed"
79 ln -s "${S}"/../protobuf-"${PROTOBUF_VERSION}" third_party/protobuf || die
80 pushd tools/distrib/python/grpcio_tools >/dev/null || die
81 # absolute symlinks will fail
83 ln -s ../../../../src ./ || die
84 # ./third_party -> ${S}/third_party
85 ln -s ../../../../third_party ./ || die
87 ln -s ../../../../ ./grpc_root || die
88 popd >/dev/null || die
93 tc-export CC CXX PKG_CONFIG
98 INSTALL_LIBDIR="$(get_libdir)" \
102 CXXFLAGS="${CXXFLAGS}" \
106 HOST_CC="$(tc-getBUILD_CC)" \
107 HOST_CXX="$(tc-getBUILD_CXX)" \
108 HOST_LD="$(tc-getBUILD_CC)" \
109 HOST_LDXX="$(tc-getBUILD_CXX)" \
110 HOST_AR="$(tc-getBUILD_AR)" \
111 HAS_SYSTEMTAP="$(usex systemtap true false)"
113 use python && distutils-r1_src_compile
117 export GRPC_PYTHON_BUILD_SYSTEM_CARES=1
118 export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
119 export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
120 export GRPC_PYTHON_BUILD_WITH_CYTHON=1
121 distutils-r1_python_compile
124 pushd tools/distrib/python/grpcio_tools >/dev/null || die
125 distutils-r1_python_compile
126 popd >/dev/null || die
130 python_compile_all() {
133 mv doc/build doc/html || die
140 INSTALL_LIBDIR="$(get_libdir)" \
144 use static-libs || find "${ED}" -name '*.a' -delete
146 if use examples; then
147 find examples -name '.gitignore' -delete || die
149 docompress -x /usr/share/doc/${PF}/examples
153 find doc -name '.gitignore' -delete || die
154 local DOCS=( AUTHORS README.md doc/. )
159 use python && distutils-r1_src_install
164 distutils-r1_python_install
167 pushd tools/distrib/python/grpcio_tools >/dev/null || die
168 distutils-r1_python_install
169 popd >/dev/null || die