Merge remote-tracking branch 'github/pr/372'.
[gentoo.git] / dev-libs / libnl / libnl-3.2.9999.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 autotools distutils-r1 eutils git-r3 libtool multilib multilib-minimal
9
10 DESCRIPTION="A collection of libraries providing APIs to netlink protocol based Linux kernel interfaces"
11 HOMEPAGE="http://www.infradead.org/~tgr/libnl/ https://github.com/thom311/libnl"
12 EGIT_REPO_URI="
13         https://github.com/thom311/libnl.git
14 "
15 LICENSE="LGPL-2.1 utils? ( GPL-2 )"
16 SLOT="3"
17 KEYWORDS=""
18 IUSE="static-libs python utils"
19
20 RDEPEND="python? ( ${PYTHON_DEPS} )
21         abi_x86_32? (
22                 !<=app-emulation/emul-linux-x86-baselibs-20140508-r5
23                 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
24         )"
25 DEPEND="${RDEPEND}
26         python? ( dev-lang/swig )
27         sys-devel/flex
28         sys-devel/bison
29 "
30
31 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
32
33 DOCS=( ChangeLog )
34
35 MULTILIB_WRAPPED_HEADERS=(
36         # we do not install CLI stuff for non-native
37         /usr/include/libnl3/netlink/cli/addr.h
38         /usr/include/libnl3/netlink/cli/class.h
39         /usr/include/libnl3/netlink/cli/cls.h
40         /usr/include/libnl3/netlink/cli/ct.h
41         /usr/include/libnl3/netlink/cli/exp.h
42         /usr/include/libnl3/netlink/cli/link.h
43         /usr/include/libnl3/netlink/cli/neigh.h
44         /usr/include/libnl3/netlink/cli/qdisc.h
45         /usr/include/libnl3/netlink/cli/route.h
46         /usr/include/libnl3/netlink/cli/rule.h
47         /usr/include/libnl3/netlink/cli/tc.h
48         /usr/include/libnl3/netlink/cli/utils.h
49 )
50
51 src_prepare() {
52         epatch "${FILESDIR}"/${PN}-1.1-vlan-header.patch
53         epatch "${FILESDIR}"/${PN}-3.2.20-rtnl_tc_get_ops.patch
54         epatch "${FILESDIR}"/${PN}-3.2.20-cache-api.patch
55
56         eautoreconf
57
58         if use python; then
59                 cd "${S}"/python || die
60                 distutils-r1_src_prepare
61         fi
62
63         # out-of-source build broken
64         # https://github.com/thom311/libnl/pull/58
65         multilib_copy_sources
66 }
67
68 multilib_src_configure() {
69         econf \
70                 --disable-silent-rules \
71                 $(use_enable static-libs static) \
72                 $(multilib_native_use_enable utils cli)
73 }
74
75 multilib_src_compile() {
76         default
77
78         if multilib_is_native_abi && use python; then
79                 cd python || die
80                 distutils-r1_src_compile
81         fi
82 }
83
84 multilib_src_install() {
85         emake DESTDIR="${D}" install
86
87         if multilib_is_native_abi && use python; then
88                 # Unset DOCS= since distutils-r1.eclass interferes
89                 local DOCS=()
90                 cd python || die
91                 distutils-r1_src_install
92         fi
93 }
94
95 multilib_src_install_all() {
96         einstalldocs
97         prune_libtool_files --modules
98 }