summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick McLean <patrick.mclean@sony.com>2019-03-11 17:25:43 -0700
committerPatrick McLean <chutzpah@gentoo.org>2019-03-11 17:25:43 -0700
commitae04e432802ec32e6d759582ce04116630fb92fe (patch)
tree7975084bb119d3e8fae34a80b390e23b22b6749d /dev-libs/libbpf
parentapp-text/calibre: remove old versions (diff)
downloadgentoo-ae04e432802ec32e6d759582ce04116630fb92fe.tar.gz
gentoo-ae04e432802ec32e6d759582ce04116630fb92fe.tar.bz2
gentoo-ae04e432802ec32e6d759582ce04116630fb92fe.zip
dev-libs/libbpf: New package
Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
Diffstat (limited to 'dev-libs/libbpf')
-rw-r--r--dev-libs/libbpf/Manifest1
-rw-r--r--dev-libs/libbpf/files/libbpf-makefile.patch24
-rw-r--r--dev-libs/libbpf/libbpf-0.20190311.ebuild67
-rw-r--r--dev-libs/libbpf/metadata.xml10
4 files changed, 102 insertions, 0 deletions
diff --git a/dev-libs/libbpf/Manifest b/dev-libs/libbpf/Manifest
new file mode 100644
index 000000000000..27e7e9bf4c98
--- /dev/null
+++ b/dev-libs/libbpf/Manifest
@@ -0,0 +1 @@
+DIST libbpf-0.20190311.tar.gz 110782 BLAKE2B b660b2677abd3068aa37f390e817c755ee06cf683e357cad6a9537d8e509d53f24ac66e472148f5b66cbcdca7849db10fc34ff8e6f85bd54a0570a52846ff933 SHA512 dbac8efce3b4c6d4faf40b22de6f71bee630fc8b71aa96e13692ffff0474ed7aa5f66a3c1f5871ec1c27dc71b87bec3ce5138096590fb9238d4d696a722f358d
diff --git a/dev-libs/libbpf/files/libbpf-makefile.patch b/dev-libs/libbpf/files/libbpf-makefile.patch
new file mode 100644
index 000000000000..a98cbb8762b2
--- /dev/null
+++ b/dev-libs/libbpf/files/libbpf-makefile.patch
@@ -0,0 +1,24 @@
+diff --git a/Makefile b/Makefile
+index 7ea1ff1..75ca998 100644
+--- a/Makefile
++++ b/Makefile
+@@ -22,7 +22,9 @@ 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
+ ifdef BUILD_SHARED
+ LIBS += $(OBJDIR)/libbpf.so
+ endif
+@@ -52,7 +54,7 @@ $(OBJDIR)/libbpf.a: $(OBJS)
+ $(AR) rcs $@ $^
+
+ $(OBJDIR)/libbpf.so: $(OBJS)
+- $(CC) -shared $(LDFLAGS) $^ -o $@
++ $(CC) -shared $(LDFLAGS) $^ -Wl,-soname,libbpf.so -o $@
+
+ $(OBJDIR)/%.o: %.c
+ $(CC) $(ALL_CFLAGS) -c $< -o $@
diff --git a/dev-libs/libbpf/libbpf-0.20190311.ebuild b/dev-libs/libbpf/libbpf-0.20190311.ebuild
new file mode 100644
index 000000000000..fdbc1a516456
--- /dev/null
+++ b/dev-libs/libbpf/libbpf-0.20190311.ebuild
@@ -0,0 +1,67 @@
+# Copyright 2019 Sony Interactive Entertainment Inc.
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+EGIT_COMMIT="cb658e9724e3c34973eee913b1ff0cb9c50b8e53"
+
+HOMEPAGE="https://github.com/libbpf/libbpf"
+DESCRIPTION="Stand-alone build of libbpf from the Linux kernel"
+SRC_URI="https://github.com/${PN}/${PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1 BSD-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="static-libs"
+
+COMMON_DEPEND="virtual/libelf"
+DEPEND="${COMMON_DEPEND}
+ sys-kernel/linux-headers"
+RDEPEND="${COMMON_DEPEND}"
+
+S="${WORKDIR}/${PN}-${EGIT_COMMIT}/src"
+
+PATCHES=(
+ "${FILESDIR}/libbpf-makefile.patch"
+)
+
+src_prepare() {
+ # upstream doesn't provide a pkgconfig file, so
+ # let's make one
+ printf 'prefix=/usr\nexec_prefix=${prefix}\nlibdir=%s\n' \
+ "/usr/$(get_libdir)" \
+ > ${PN}.pc
+ printf 'includedir=${prefix}/include\n\n' \
+ >> ${PN}.pc
+
+ printf 'Name: %s\nDescription: %s\nVersion: %s\nLibs: -lbpf %s\n' \
+ "${PN}" \
+ "${DESCRIPTION}" \
+ "${PV}" \
+ "$($(tc-getPKG_CONFIG) --libs libelf)" \
+ >> ${PN}.pc
+
+ default
+}
+
+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
+
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ${PN}.pc
+}
diff --git a/dev-libs/libbpf/metadata.xml b/dev-libs/libbpf/metadata.xml
new file mode 100644
index 000000000000..401d77a76ee2
--- /dev/null
+++ b/dev-libs/libbpf/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>chutzpah@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">libbpf/libbpf</remote-id>
+ </upstream>
+</pkgmetadata>