*/*: Switch proxy-maint to cmake.eclass
[gentoo.git] / net-libs / grpc / grpc-1.22.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit flag-o-matic toolchain-funcs
7
8 MY_PV="${PV//_pre/-pre}"
9
10 DESCRIPTION="Modern open source high performance RPC framework"
11 HOMEPAGE="https://www.grpc.io"
12 SRC_URI="https://github.com/${PN}/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
13
14 LICENSE="Apache-2.0"
15 SLOT="0"
16 KEYWORDS="~amd64 ~ppc64 ~x86"
17 IUSE="examples doc perftools systemtap static-libs"
18
19 DEPEND="
20         >=dev-libs/openssl-1.0.2:0=[-bindist]
21         >=dev-libs/protobuf-3.7.0:=
22         >=net-dns/c-ares-1.15.0:=
23         sys-libs/zlib:=
24         perftools? ( dev-util/google-perftools:= )
25         systemtap? ( dev-util/systemtap )
26 "
27
28 RDEPEND="${DEPEND}"
29 BDEPEND="virtual/pkgconfig"
30
31 # requires network
32 RESTRICT="test"
33
34 PATCHES=(
35         "${FILESDIR}/grpc-1.21.0-fix-host-ar-handling.patch"
36         "${FILESDIR}/grpc-1.3.0-Don-t-run-ldconfig.patch"
37         "${FILESDIR}/grpc-1.11.0-pkgconfig-libdir.patch"
38         "${FILESDIR}/grpc-1.22.0-cxx_arg_list_too_long_forloop.patch" # https://github.com/grpc/grpc/issues/14844
39         "${FILESDIR}/grpc-1.22.1-glibc-2.30-compat.patch" # https://github.com/grpc/grpc/pull/18950
40 )
41
42 S="${WORKDIR}/${PN}-${MY_PV}"
43
44 src_prepare() {
45         rm -r third_party/cares || die
46         sed -i 's:-Werror::g' Makefile || die
47         sed -i 's@$(prefix)/lib@$(prefix)/$(INSTALL_LIBDIR)@g' Makefile || die "fix libdir"
48
49         default
50 }
51
52 src_compile() {
53         tc-export CC CXX PKG_CONFIG
54
55         local myemakeargs=(
56                 V=1
57                 prefix=/usr
58                 INSTALL_LIBDIR="$(get_libdir)"
59                 AR="$(tc-getAR)"
60                 AROPTS="rcs"
61                 CFLAGS="${CFLAGS}"
62                 CXXFLAGS="${CXXFLAGS}"
63                 LD="${CC}"
64                 LDXX="${CXX}"
65                 STRIP=/bin/true
66                 HOST_AR="$(tc-getBUILD_AR)"
67                 HOST_CC="$(tc-getBUILD_CC)"
68                 HOST_CXX="$(tc-getBUILD_CXX)"
69                 HOST_LD="$(tc-getBUILD_CC)"
70                 HOST_LDXX="$(tc-getBUILD_CXX)"
71                 HAS_SYSTEM_PERFTOOLS="$(usex perftools true false)"
72                 HAS_SYSTEMTAP="$(usex systemtap true false)"
73         )
74
75         emake "${myemakeargs[@]}"
76 }
77
78 src_install() {
79         local myemakeargs=(
80                 V=1
81                 prefix="${ED}"/usr
82                 INSTALL_LIBDIR="$(get_libdir)"
83                 STRIP=/bin/true
84         )
85
86         emake "${myemakeargs[@]}" install
87
88         use static-libs || find "${ED}" -name '*.a' -delete
89
90         if use examples; then
91                 find examples -name '.gitignore' -delete || die
92                 dodoc -r examples
93                 docompress -x /usr/share/doc/${PF}/examples
94         fi
95
96         if use doc; then
97                 find doc -name '.gitignore' -delete || die
98                 local DOCS=( AUTHORS CONCEPTS.md README.md TROUBLESHOOTING.md doc/. )
99         fi
100
101         einstalldocs
102 }
103
104 pkg_postinst() {
105         local v
106         for v in ${REPLACING_VERSIONS}; do
107                 if ver_test "${v}" -lt 1.16.0; then
108                         ewarn "python bindings and tools moved to separate independent packages"
109                         ewarn "check dev-python/grpcio and dev-python/grpcio-tools"
110                 fi
111         done
112
113 }