net-misc/iputils: Merge GitHub PR #2289
[gentoo.git] / dev-libs / libnl / libnl-3.2.27.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6 PYTHON_COMPAT=( python2_7 python3_{3,4} )
7 DISTUTILS_OPTIONAL=1
8 inherit distutils-r1 eutils libtool multilib multilib-minimal
9
10 LIBNL_P=${P/_/-}
11 LIBNL_DIR=${PV/_/}
12 LIBNL_DIR=${LIBNL_DIR//./_}
13
14 DESCRIPTION="A collection of libraries providing APIs to netlink protocol based Linux kernel interfaces"
15 HOMEPAGE="http://www.infradead.org/~tgr/libnl/ https://github.com/thom311/libnl"
16 SRC_URI="
17         https://github.com/thom311/${PN}/releases/download/${PN}${LIBNL_DIR}/${P/_rc/-rc}.tar.gz
18 "
19 LICENSE="LGPL-2.1 utils? ( GPL-2 )"
20 SLOT="3"
21 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~ia64-linux ~x86-linux"
22 IUSE="static-libs python utils"
23
24 RDEPEND="python? ( ${PYTHON_DEPS} )
25         abi_x86_32? (
26                 !<=app-emulation/emul-linux-x86-baselibs-20140508-r5
27                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
28         )"
29 DEPEND="${RDEPEND}
30         python? ( dev-lang/swig )
31         sys-devel/flex
32         sys-devel/bison
33 "
34
35 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
36
37 DOCS=( ChangeLog )
38
39 S=${WORKDIR}/${LIBNL_P}
40
41 MULTILIB_WRAPPED_HEADERS=(
42         # we do not install CLI stuff for non-native
43         /usr/include/libnl3/netlink/cli/addr.h
44         /usr/include/libnl3/netlink/cli/class.h
45         /usr/include/libnl3/netlink/cli/cls.h
46         /usr/include/libnl3/netlink/cli/ct.h
47         /usr/include/libnl3/netlink/cli/exp.h
48         /usr/include/libnl3/netlink/cli/link.h
49         /usr/include/libnl3/netlink/cli/neigh.h
50         /usr/include/libnl3/netlink/cli/qdisc.h
51         /usr/include/libnl3/netlink/cli/route.h
52         /usr/include/libnl3/netlink/cli/rule.h
53         /usr/include/libnl3/netlink/cli/tc.h
54         /usr/include/libnl3/netlink/cli/utils.h
55 )
56
57 src_prepare() {
58         epatch "${FILESDIR}"/${PN}-1.1-vlan-header.patch
59         epatch "${FILESDIR}"/${PN}-3.2.20-rtnl_tc_get_ops.patch
60         epatch "${FILESDIR}"/${PN}-3.2.20-cache-api.patch
61
62         elibtoolize
63
64         if use python; then
65                 cd "${S}"/python || die
66                 distutils-r1_src_prepare
67         fi
68
69         # out-of-source build broken
70         # https://github.com/thom311/libnl/pull/58
71         multilib_copy_sources
72 }
73
74 multilib_src_configure() {
75         econf \
76                 --disable-silent-rules \
77                 $(use_enable static-libs static) \
78                 $(multilib_native_use_enable utils cli)
79 }
80
81 multilib_src_compile() {
82         default
83
84         if multilib_is_native_abi && use python; then
85                 cd python || die
86                 distutils-r1_src_compile
87         fi
88 }
89
90 multilib_src_install() {
91         emake DESTDIR="${D}" install
92
93         if multilib_is_native_abi && use python; then
94                 # Unset DOCS= since distutils-r1.eclass interferes
95                 local DOCS=()
96                 cd python || die
97                 distutils-r1_src_install
98         fi
99 }
100
101 multilib_src_install_all() {
102         einstalldocs
103         prune_libtool_files --modules
104 }