commit:     bd569b9a6ef8d9e1e34a97116999e2345a16408b
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 29 11:53:31 2021 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Fri Oct 29 11:54:09 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd569b9a

net-libs/xdp-tools: add version 0.0.3

A bit rough around the edges, given the bespoke build system of
xdp-tools is a little bit immature, and there's a bit of weirdness
around installing BPF ELF objects. But hopefully this is a solid start.

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 net-libs/xdp-tools/Manifest               |  1 +
 net-libs/xdp-tools/metadata.xml           | 14 +++++++++
 net-libs/xdp-tools/xdp-tools-0.0.3.ebuild | 52 +++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

diff --git a/net-libs/xdp-tools/Manifest b/net-libs/xdp-tools/Manifest
new file mode 100644
index 00000000000..1ce4a87a70a
--- /dev/null
+++ b/net-libs/xdp-tools/Manifest
@@ -0,0 +1 @@
+DIST xdp-tools-0.0.3.tar.gz 381386 BLAKE2B 
1160d9a7cc2b6cf7b49e7223acdbeba72046c00ec710c21140da0607cac1e8a1231992a8967b2f8f2a964da593dfe0af08b28abbc3b13818ddafebbc2c3961a7
 SHA512 
c2a4278db41af020cf42b1139c93786a49ad2a071b2002177ac39e8d6b74203d251bd7823399d9e156c969d2ae741b0ecd4178edf446fe5c7270e53295458fce

diff --git a/net-libs/xdp-tools/metadata.xml b/net-libs/xdp-tools/metadata.xml
new file mode 100644
index 00000000000..51fa02b96ae
--- /dev/null
+++ b/net-libs/xdp-tools/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="person">
+    <email>ja...@zx2c4.com</email>
+    <name>Jason A. Donenfeld</name>
+  </maintainer>
+  <upstream>
+    <remote-id type="github">xdp-project/xdp-tools</remote-id>
+  </upstream>
+  <use>
+    <flag name="tools">Install various helper tools rather than just 
libxdp.</flag>
+  </use>
+</pkgmetadata>

diff --git a/net-libs/xdp-tools/xdp-tools-0.0.3.ebuild 
b/net-libs/xdp-tools/xdp-tools-0.0.3.ebuild
new file mode 100644
index 00000000000..0966087d398
--- /dev/null
+++ b/net-libs/xdp-tools/xdp-tools-0.0.3.ebuild
@@ -0,0 +1,52 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="The libxdp library and various tools for use with XDP"
+HOMEPAGE="https://github.com/xdp-project/xdp-tools";
+SRC_URI="https://github.com/xdp-project/${PN}/releases/download/v${PV}/${P}.tar.gz";
+
+LICENSE="GPL-2 LGPL-2.1 BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="+doc +tools static-libs"
+
+DEPEND="dev-libs/libbpf
+       sys-libs/zlib
+       net-libs/libpcap
+       virtual/libelf"
+RDEPEND="${DEPEND}"
+BDEPEND=">=sys-devel/clang-10.0.0
+       doc? ( app-editors/emacs )"
+
+# Not prebuilt -- we build them -- but they're not ordinary ELF objects either.
+QA_PREBUILT="usr/lib/bpf/*.o"
+
+MAKEOPTS+=" V=1"
+
+src_prepare() {
+       # A form of this kludge is upstream but hasn't yet been released:
+       sed -i 's/install -m 0755 \$(SHARED_LIBS)/cp -fpR \$(SHARED_LIBS)/' 
lib/libxdp/Makefile || die
+       default
+}
+
+src_configure() {
+       export PRODUCTION=1
+       export DYNAMIC_LIBXDP=1
+       export FORCE_EMACS=$(usex doc 1 0)
+       default
+       {
+               echo "PREFIX := ${EPREFIX}/usr"
+               echo "LIBDIR := \$(PREFIX)/$(get_libdir)"
+               echo "BPF_OBJECT_DIR := \$(PREFIX)/lib/bpf"
+       } >> config.mk
+}
+
+src_install() {
+       default
+       use static-libs || rm -f "${D}/${EPREFIX}/usr/$(get_libdir)/libxdp.a"
+       use tools || rm -f "${D}/${EPREFIX}/usr/"{sbin,bin}/*
+       dostrip -x /usr/lib/bpf
+}

Reply via email to