+DIST libbpf-0.0.3.tar.gz 127328 BLAKE2B eaa1be54f0a7fcc6fd41eb2adaad2f405f76db3bd7c7466a5484ead1cca5a9fe775e331838cd5645d7399cb5b1a5b2fcb3814fb45643660fd3f7d84b9986bae6 SHA512 ee489d968cd9a20a1f091dcd2696d3807ab0db2a001613684402de2c696391eea033f3bd961eaf1d0df95c1e15f4f0ccfb7003ff98c3f08f24a7e9a8db22cdad
DIST libbpf-0.20190311.tar.gz 110782 BLAKE2B b660b2677abd3068aa37f390e817c755ee06cf683e357cad6a9537d8e509d53f24ac66e472148f5b66cbcdca7849db10fc34ff8e6f85bd54a0570a52846ff933 SHA512 dbac8efce3b4c6d4faf40b22de6f71bee630fc8b71aa96e13692ffff0474ed7aa5f66a3c1f5871ec1c27dc71b87bec3ce5138096590fb9238d4d696a722f358d
DIST libbpf-0.20190404.tar.gz 115495 BLAKE2B a159d75163cee051e7784c20018020e650d88e3b011928b1a748199f88b22de713000d3557d083cbbfc3450b6ded9b891d0afb487611044cf2af93fd5691ff8c SHA512 724fe12c9a028a9b6d5a05ee679a3c7f687a32f403bbee3c90730005dac20e0a5e9e6c21df02780d329a88acf4ec525411e448f537b49ce2767de8eae6012661
--- /dev/null
+diff --git a/Makefile b/src/Makefile
+index 82a650c..549779d 100644
+--- a/Makefile
++++ b/src/Makefile
+@@ -36,7 +36,10 @@ OBJDIR ?= .
+ OBJS := $(addprefix $(OBJDIR)/,bpf.o btf.o libbpf.o libbpf_errno.o netlink.o \
+ nlattr.o str_error.o libbpf_probes.o bpf_prog_linfo.o xsk.o)
+
+-LIBS := $(OBJDIR)/libbpf.a
++ifdef BUILD_STATIC
++ LIBS := $(OBJDIR)/libbpf.a
++endif
++
+ ifndef BUILD_STATIC_ONLY
+ LIBS += $(OBJDIR)/libbpf.so \
+ $(OBJDIR)/libbpf.so.$(VERSION) \
+@@ -63,7 +66,7 @@ endif
+ PREFIX ?= /usr
+ LIBDIR ?= $(PREFIX)/$(LIBSUBDIR)
+ INCLUDEDIR ?= $(PREFIX)/include
+-UAPIDIR ?= $(PREFIX)/include
++UAPIDIR ?= $(PREFIX)/include/bpf/uapi
+
+ all: $(LIBS) $(PC_FILE)
+
+@@ -84,6 +87,7 @@ $(OBJDIR)/libbpf.so.$(LIBBPF_VERSION): $(OBJS)
+ $(OBJDIR)/libbpf.pc:
+ sed -e "s|@PREFIX@|$(PREFIX)|" \
+ -e "s|@LIBDIR@|$(LIBDIR)|" \
++ -e "s|@UAPIDIR@|$(UAPIDIR)|" \
+ -e "s|@VERSION@|$(LIBBPF_VERSION)|" \
+ < libbpf.pc.template > $@
+
+diff --git a/libbpf.pc.template b/src/libbpf.pc.template
+index ac17fce..6d385d9 100644
+--- a/libbpf.pc.template
++++ b/src/libbpf.pc.template
+@@ -3,10 +3,11 @@
+ prefix=@PREFIX@
+ libdir=@LIBDIR@
+ includedir=${prefix}/include
++uapidir=@UAPIDIR@
+
+ Name: libbpf
+ Description: BPF library
+ Version: @VERSION@
+ Libs: -L${libdir} -lbpf
+ Requires.private: libelf
+-Cflags: -I${includedir}
++Cflags: -I${includedir} -I${uapidir}
--- /dev/null
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+HOMEPAGE="https://github.com/libbpf/libbpf"
+DESCRIPTION="Stand-alone build of libbpf from the Linux kernel"
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1 BSD-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="+static-libs"
+
+COMMON_DEPEND="virtual/libelf
+ !<=dev-util/bcc-0.7.0"
+DEPEND="${COMMON_DEPEND}
+ sys-kernel/linux-headers"
+RDEPEND="${COMMON_DEPEND}"
+
+S="${WORKDIR}/${P}/src"
+
+PATCHES=(
+ "${FILESDIR}/libbpf-0.0.3-paths.patch"
+)
+
+src_compile() {
+ emake \
+ BUILD_SHARED=y \
+ LIBSUBDIR="$(get_libdir)" \
+ $(usex static-libs 'BUILD_STATIC=y' '' '' '') \
+ CC="$(tc-getCC)"
+}
+
+src_install() {
+ emake \
+ BUILD_SHARED=y \
+ LIBSUBDIR="$(get_libdir)" \
+ DESTDIR="${D}" \
+ $(usex static-libs 'BUILD_STATIC=y' '' '' '') \
+ install install_uapi_headers
+
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ${PN}.pc
+}