net-libs/serf: inherit python-any-r1 for scons, bump EAPI
[gentoo.git] / net-libs / serf / serf-1.3.9-r1.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 PYTHON_COMPAT=( python3_6 )
7
8 inherit python-any-r1 scons-utils toolchain-funcs flag-o-matic
9
10 DESCRIPTION="HTTP client library"
11 HOMEPAGE="https://serf.apache.org/"
12 SRC_URI="mirror://apache/${PN}/${P}.tar.bz2"
13
14 LICENSE="Apache-2.0"
15 SLOT="1"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris"
17 IUSE="kerberos static-libs libressl"
18 RESTRICT="test"
19
20 RDEPEND="dev-libs/apr:1=
21         dev-libs/apr-util:1=
22         !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl:0= )
23         sys-libs/zlib:0=
24         kerberos? ( virtual/krb5 )"
25 DEPEND="${RDEPEND}
26         >=dev-util/scons-2.3.0"
27
28 PATCHES=( "${FILESDIR}"/${PN}-1.3.8-static-lib.patch
29         "${FILESDIR}"/${PN}-1.3.8-openssl.patch
30         "${FILESDIR}"/${PN}-1.3.9-python3.patch
31         "${FILESDIR}"/${PN}-1.3.9-python3_byte.patch )
32
33 src_prepare() {
34         default
35
36         # https://code.google.com/p/serf/issues/detail?id=133
37         sed -e "/env.Append(CCFLAGS=\['-O2'\])/d" -i SConstruct
38
39         # need limits.h for PATH_MAX (only when EXTENSIONS is enabled)
40         [[ ${CHOST} == *-solaris* ]] && append-cppflags -D__EXTENSIONS__
41 }
42
43 src_compile() {
44         myesconsargs=(
45                 PREFIX="${EPREFIX}/usr"
46                 LIBDIR="${EPREFIX}/usr/$(get_libdir)"
47                 # These config scripts are sent through a shell with an empty env
48                 # which breaks the SYSROOT usage in them.  Set the vars inline to
49                 # avoid that.
50                 APR="SYSROOT='${SYSROOT}' ${SYSROOT}${EPREFIX}/usr/bin/apr-1-config"
51                 APU="SYSROOT='${SYSROOT}' ${SYSROOT}${EPREFIX}/usr/bin/apu-1-config"
52                 BUILD_STATIC=$(usex static-libs)
53                 AR="$(tc-getAR)"
54                 RANLIB="$(tc-getRANLIB)"
55                 CC="$(tc-getCC)"
56                 CPPFLAGS="${CPPFLAGS}"
57                 CFLAGS="${CFLAGS}"
58                 LINKFLAGS="${LDFLAGS}"
59         )
60
61         if use kerberos; then
62                 myesconsargs+=( GSSAPI="${SYSROOT}${EPREFIX}/usr/bin/krb5-config" )
63         fi
64
65         escons "${myesconsargs[@]}"
66 }
67
68 src_test() {
69         escons check
70 }
71
72 src_install() {
73         escons install --install-sandbox="${D}"
74 }