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