From 9a15f26a29e770cb4d997d692ed9313d5f0791c8 Mon Sep 17 00:00:00 2001 From: TheK0tYaRa Date: Tue, 4 Feb 2025 03:22:56 +0200 Subject: [PATCH] xdp-tools had broken tests that always failed because of version tags in global. --- net-libs/xdp-tools/Manifest | 1 + net-libs/xdp-tools/metadata.xml | 22 ++++ net-libs/xdp-tools/xdp-tools-1.5.0-r1.ebuild | 102 +++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 net-libs/xdp-tools/Manifest create mode 100644 net-libs/xdp-tools/metadata.xml create mode 100644 net-libs/xdp-tools/xdp-tools-1.5.0-r1.ebuild diff --git a/net-libs/xdp-tools/Manifest b/net-libs/xdp-tools/Manifest new file mode 100644 index 0000000..8060948 --- /dev/null +++ b/net-libs/xdp-tools/Manifest @@ -0,0 +1 @@ +DIST xdp-tools-1.5.0.tar.gz 353321 BLAKE2B 41ef06c544af743a8542306af93b1d2a671e53118aa9c4230521c755868245d854ef4ed38ac47102869c18104d67808e8ede8baef45dde8811b074501fc34520 SHA512 9713280fc5d58c19f972cced614f0acdb21de0f467439af2364217ae5381963f90c9e4aba9b6de1a8fdb7fa36c1f645c42b9cd1c86a2cd60168a3b974f14c0dd diff --git a/net-libs/xdp-tools/metadata.xml b/net-libs/xdp-tools/metadata.xml new file mode 100644 index 0000000..790067f --- /dev/null +++ b/net-libs/xdp-tools/metadata.xml @@ -0,0 +1,22 @@ + + + + + holger@applied-asynchrony.com + Holger Hoffstätte + + + proxy-maint@gentoo.org + Proxy Maintainers + + + zx2c4@gentoo.org + Jason A. Donenfeld + + + xdp-project/xdp-tools + + + Install various helper tools rather than just libxdp. + + diff --git a/net-libs/xdp-tools/xdp-tools-1.5.0-r1.ebuild b/net-libs/xdp-tools/xdp-tools-1.5.0-r1.ebuild new file mode 100644 index 0000000..8f375b2 --- /dev/null +++ b/net-libs/xdp-tools/xdp-tools-1.5.0-r1.ebuild @@ -0,0 +1,102 @@ +# Copyright 2021-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic linux-info toolchain-funcs + +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}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2 LGPL-2.1 BSD-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86" +IUSE="+tools test" + +DEPEND=" + dev-libs/libbpf:= + net-libs/libpcap + sys-libs/zlib + virtual/libelf +" +RDEPEND="${DEPEND}" +BDEPEND=" + dev-util/bpftool + sys-apps/grep[pcre] + llvm-core/clang:*[llvm_targets_BPF] + sys-devel/m4 +" + +# Not prebuilt -- we build them -- but they're not ordinary ELF objects either. +QA_PREBUILT="usr/lib/bpf/*.o" + +MAKEOPTS+=" V=1" + +CONFIG_CHECK="~BPF ~BPF_JIT ~BPF_SYSCALL ~HAVE_EBPF_JIT ~XDP_SOCKETS ~XDP_SOCKETS_DIAG" + +src_prepare() { + # remove -Werror: #899744 + sed -i 's/-Werror//g' lib/Makefile lib/defines.mk || die + sed -i '/-Werror/d' lib/common.mk lib/libxdp/Makefile \ + lib/libxdp/tests/Makefile lib/util/Makefile || die + if ! use test; then + sed -i 's/check man/man/g' lib/libxdp/Makefile || die + fi + + default +} + +src_configure() { + # filter LTO: #861587 + filter-lto + + # filter LDFLAGS some more: #916591 + filter-ldflags -Wl,--{icf,lto}* + + # force ld.bfd: #916591 + tc-ld-force-bfd + + export CC="$(tc-getCC)" + export PREFIX="${EPREFIX}/usr" + export LIBDIR="${PREFIX}/$(get_libdir)" + export BPF_OBJECT_DIR="${PREFIX}/lib/bpf" + export PRODUCTION=1 + export DYNAMIC_LIBXDP=1 + export FORCE_SYSTEM_LIBBPF=1 + + default +} + +src_test() { :; } + +src_install() { + default + + # To remove the scripts/testing files that are installed. + rm -r "${ED}/usr/share/xdp-tools" || die + # We can't control static archive generation yet. + rm "${ED}/usr/$(get_libdir)/libxdp.a" || die + + use tools || { rm "${ED}/usr/sbin"/* || die; } + + # These are ELF objects but BPF ones. + dostrip -x /usr/lib/bpf +} + +pkg_postinst() { + elog + elog "Many BPF utilities need access to a mounted bpffs virtual file system." + elog "Either mount it manually like this:" + elog + elog " mount bpffs /sys/fs/bpf -t bpf -o nosuid,nodev,noexec,relatime,mode=700" + elog + elog "or add the following line to your /etc/fstab to always mount it at boot time:" + elog + elog " bpffs /sys/fs/bpf bpf nosuid,nodev,noexec,relatime,mode=700 0 0" + elog + elog "You can verify that bpffs is mounted with:" + elog + elog " mount | grep /sys/fs/bpf" + elog +}