commit:     d8e0412b28f4b7cc54b11809a5528e6d9c8e69a8
Author:     Josip Kelecic <josip.kelecic <AT> sartura <DOT> hr>
AuthorDate: Thu Apr  2 08:50:22 2020 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 17:21:14 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8e0412b

dev-libs/libbpf: add live ebuild

Signed-off-by: Josip Kelecic <josip.kelecic <AT> sartura.hr>
Closes: https://github.com/gentoo/gentoo/pull/15207
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
Closes: https://bugs.gentoo.org/711496
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 dev-libs/libbpf/files/libbpf-9999-paths.patch | 38 ++++++++++++++++++++
 dev-libs/libbpf/libbpf-9999.ebuild            | 52 +++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/dev-libs/libbpf/files/libbpf-9999-paths.patch 
b/dev-libs/libbpf/files/libbpf-9999-paths.patch
new file mode 100644
index 00000000000..cbc267b64a3
--- /dev/null
+++ b/dev-libs/libbpf/files/libbpf-9999-paths.patch
@@ -0,0 +1,38 @@
+diff --git a/Makefile b/Makefile
+index bc25aba..e1db3d6 100644
+--- a/Makefile
++++ b/Makefile
+@@ -66,7 +66,7 @@ endif
+ PREFIX ?= /usr
+ LIBDIR ?= $(PREFIX)/$(LIBSUBDIR)
+ INCLUDEDIR ?= $(PREFIX)/include
+-UAPIDIR ?= $(PREFIX)/include
++UAPIDIR ?= $(PREFIX)/include/bpf/uapi
+ 
+ TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags)
+ 
+@@ -89,6 +89,7 @@ $(OBJDIR)/libbpf.so.$(LIBBPF_VERSION): $(SHARED_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/libbpf.pc.template
+index b45ed53..5ec63c2 100644
+--- a/libbpf.pc.template
++++ b/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 zlib
+-Cflags: -I${includedir}
++Cflags: -I${includedir} -I${uapidir}

diff --git a/dev-libs/libbpf/libbpf-9999.ebuild 
b/dev-libs/libbpf/libbpf-9999.ebuild
new file mode 100644
index 00000000000..08e5746d4bf
--- /dev/null
+++ b/dev-libs/libbpf/libbpf-9999.ebuild
@@ -0,0 +1,52 @@
+# Copyright 2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+if [[ ${PV} =~ [9]{4,} ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/libbpf/libbpf.git";
+else
+       SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+       KEYWORDS="~amd64 ~arm64 ~x86"
+fi
+
+HOMEPAGE="https://www.kernel.org/doc/html/latest/bpf/bpf_devel_QA.html";
+DESCRIPTION="Stand-alone build of libbpf from the Linux kernel"
+
+LICENSE="GPL-2 LGPL-2.1 BSD-2"
+SLOT="0/${PV}"
+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-9999-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
+}

Reply via email to