7e265723db967965eaf85881d9d4fdd6f97cc5f4
[gentoo.git] / dev-libs / libbpf / libbpf-0.0.5.ebuild
1 # Copyright 2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit toolchain-funcs
7
8 HOMEPAGE="https://github.com/libbpf/libbpf"
9 DESCRIPTION="Stand-alone build of libbpf from the Linux kernel"
10 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="GPL-2 LGPL-2.1 BSD-2"
13 SLOT="0/${PV}"
14 KEYWORDS="~amd64 ~arm64 ~x86"
15 IUSE="+static-libs"
16
17 COMMON_DEPEND="virtual/libelf
18         !<=dev-util/bcc-0.7.0"
19 DEPEND="${COMMON_DEPEND}
20         sys-kernel/linux-headers"
21 RDEPEND="${COMMON_DEPEND}"
22
23 S="${WORKDIR}/${P}/src"
24
25 PATCHES=(
26         "${FILESDIR}/libbpf-0.0.5-paths.patch"
27 )
28
29 src_compile() {
30         emake \
31                 BUILD_SHARED=y \
32                 LIBSUBDIR="$(get_libdir)" \
33                 $(usex static-libs 'BUILD_STATIC=y' '' '' '') \
34                 CC="$(tc-getCC)"
35 }
36
37 src_install() {
38         emake \
39                 BUILD_SHARED=y \
40                 LIBSUBDIR="$(get_libdir)" \
41                 DESTDIR="${D}" \
42                 $(usex static-libs 'BUILD_STATIC=y' '' '' '') \
43                 install install_uapi_headers
44
45         insinto /usr/$(get_libdir)/pkgconfig
46         doins ${PN}.pc
47 }