commit:     79fd37fcaf670fdcc399fa7e7ce2d6dc1b353b09
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Sat Oct 21 08:54:26 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 02:53:15 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79fd37fc

net-libs/xdp-tools: add 1.4.1

Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Closes: https://github.com/gentoo/gentoo/pull/33439
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-libs/xdp-tools/Manifest                    |  1 +
 net-libs/xdp-tools/files/1.4.1-no-Werror.patch | 75 ++++++++++++++++++++++
 net-libs/xdp-tools/xdp-tools-1.4.1.ebuild      | 86 ++++++++++++++++++++++++++
 3 files changed, 162 insertions(+)

diff --git a/net-libs/xdp-tools/Manifest b/net-libs/xdp-tools/Manifest
index 766e3e9c5f3c..5f1d1649aacb 100644
--- a/net-libs/xdp-tools/Manifest
+++ b/net-libs/xdp-tools/Manifest
@@ -1 +1,2 @@
 DIST xdp-tools-1.4.0.tar.gz 337221 BLAKE2B 
008dda0fcfd403e47ab2b8c801fc0a5c4e103fb3b9869f1d1bf5af258fc646dd5a0285d3126c012c9b81805408b9669da886b9fcf2fdf33b256f74bbf898222a
 SHA512 
c17bd6e9e6e4cf59c33f4b9ae4e3e0434863d147abf80f87b425215261b96d4574898fa09cc2b201a427a5e9d49ad64d0c70e50e3f72e3a18c6fbdf7f4cd4a3a
+DIST xdp-tools-1.4.1.tar.gz 339878 BLAKE2B 
30ed245dd0da8404cf67313ea4d5f9a148507d14bd7330bdac3b03c07d1cc0b38eb1a376636551cb8ea14c8a2e77d02527da363733a1059e1c2ebaee9ac90392
 SHA512 
9d2ad42713aa53c10ccbde2c344bf2696524e317544f3693114b343ab74240187699c3802cfc6efa05b3e9f9bfec80fd2537799aa3ae050717bb1f6aab435996

diff --git a/net-libs/xdp-tools/files/1.4.1-no-Werror.patch 
b/net-libs/xdp-tools/files/1.4.1-no-Werror.patch
new file mode 100644
index 000000000000..52c50261f5d8
--- /dev/null
+++ b/net-libs/xdp-tools/files/1.4.1-no-Werror.patch
@@ -0,0 +1,75 @@
+
+Bug: https://bugs.gentoo.org/899744
+
+diff --git a/lib/Makefile b/lib/Makefile
+index 5ee035d..5342ab3 100644
+--- a/lib/Makefile
++++ b/lib/Makefile
+@@ -1,5 +1,5 @@
+ 
+-LIBBPF_CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-g -O2 -Werror -Wall) -fPIC
++LIBBPF_CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-g -O2 -Wall) -fPIC
+ 
+ LIB_DIR = .
+ include defines.mk
+diff --git a/lib/common.mk b/lib/common.mk
+index b680a75..8dbcb39 100644
+--- a/lib/common.mk
++++ b/lib/common.mk
+@@ -116,7 +116,6 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EXTRA_DEPS) 
$(BPF_HEADERS) $(LIBMK)
+           -Wno-unused-value \
+           -Wno-pointer-sign \
+           -Wno-compare-distinct-pointer-types \
+-          -Werror \
+           -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
+       $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
+ 
+diff --git a/lib/defines.mk b/lib/defines.mk
+index 54b259f..ed246c0 100644
+--- a/lib/defines.mk
++++ b/lib/defines.mk
+@@ -40,7 +40,7 @@ endif
+ 
+ DEFINES += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+ 
+-CFLAGS += -std=gnu11 -Wextra -Werror $(DEFINES) $(ARCH_INCLUDES)
++CFLAGS += -std=gnu11 -Wextra $(DEFINES) $(ARCH_INCLUDES)
+ BPF_CFLAGS += $(DEFINES) $(filter -ffile-prefix-map=%,$(CFLAGS)) 
$(ARCH_INCLUDES)
+ 
+ CONFIGMK := $(LIB_DIR)/../config.mk
+diff --git a/lib/libxdp/Makefile b/lib/libxdp/Makefile
+index 431932a..a0c625d 100644
+--- a/lib/libxdp/Makefile
++++ b/lib/libxdp/Makefile
+@@ -142,7 +142,6 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK)
+           -Wno-unused-value \
+           -Wno-pointer-sign \
+           -Wno-compare-distinct-pointer-types \
+-          -Werror \
+           -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
+       $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
+ 
+diff --git a/lib/libxdp/tests/Makefile b/lib/libxdp/tests/Makefile
+index 3c22901..a4463f3 100644
+--- a/lib/libxdp/tests/Makefile
++++ b/lib/libxdp/tests/Makefile
+@@ -72,7 +72,6 @@ $(BPF_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK) $(EXTRA_DEPS)
+           -Wno-unused-value \
+           -Wno-pointer-sign \
+           -Wno-compare-distinct-pointer-types \
+-          -Werror \
+           -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
+       $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
+ 
+diff --git a/lib/util/Makefile b/lib/util/Makefile
+index 24070f0..37485b3 100644
+--- a/lib/util/Makefile
++++ b/lib/util/Makefile
+@@ -26,7 +26,6 @@ $(UTIL_BPF_OBJS): %.o: %.c $(KERN_USER_H) $(BPF_HEADERS) 
$(LIBMK)
+           -Wno-unused-value \
+           -Wno-pointer-sign \
+           -Wno-compare-distinct-pointer-types \
+-          -Werror \
+           -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
+       $(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
+ 

diff --git a/net-libs/xdp-tools/xdp-tools-1.4.1.ebuild 
b/net-libs/xdp-tools/xdp-tools-1.4.1.ebuild
new file mode 100644
index 000000000000..53974f63d493
--- /dev/null
+++ b/net-libs/xdp-tools/xdp-tools-1.4.1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 2021-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic
+
+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 ~riscv ~x86"
+IUSE="+tools"
+
+DEPEND="
+       dev-libs/libbpf:=
+       dev-util/bpftool
+       net-libs/libpcap
+       sys-libs/zlib
+       virtual/libelf
+"
+RDEPEND="${DEPEND}"
+BDEPEND="
+       sys-apps/grep[pcre]
+       >=sys-devel/clang-11.0.0
+"
+
+# Not prebuilt -- we build them -- but they're not ordinary ELF objects either.
+QA_PREBUILT="usr/lib/bpf/*.o"
+
+MAKEOPTS+=" V=1"
+
+PATCHES=(
+       "${FILESDIR}"/1.4.1-no-Werror.patch
+)
+
+src_configure() {
+       export CC="$(tc-getCC)"
+       export LD="$(tc-getLD)"
+       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
+
+       # bug 861587
+       filter-lto
+
+       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
+}

Reply via email to