Gentoo Archives: gentoo-commits

From: Kurt Kanzenbach <kurt@×××××××××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: dev-util/xdp-tools/, dev-util/xdp-tools/files/
Date: Tue, 13 Jul 2021 19:32:44
Message-Id: 1626204583.546e1b2e1a11861bbd110fe589cd80b80180c826.KurtKanzenbach@gentoo
1 commit: 546e1b2e1a11861bbd110fe589cd80b80180c826
2 Author: Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
3 AuthorDate: Tue Jul 13 19:29:43 2021 +0000
4 Commit: Kurt Kanzenbach <kurt <AT> kmk-computers <DOT> de>
5 CommitDate: Tue Jul 13 19:29:43 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=546e1b2e
7
8 dev-util/xdp-tools: Bump to v1.2.0
9
10 Package-Manager: Portage-3.0.20, Repoman-3.0.2
11 Signed-off-by: Kurt Kanzenbach <kurt <AT> kmk-computers.de>
12
13 dev-util/xdp-tools/Manifest | 1 +
14 .../xdp-tools/files/xdp-tools-1.2.0-install.patch | 23 +++++++
15 .../xdp-tools/files/xdp-tools-1.2.0-readelf.patch | 51 ++++++++++++++++
16 dev-util/xdp-tools/xdp-tools-1.2.0.ebuild | 70 ++++++++++++++++++++++
17 4 files changed, 145 insertions(+)
18
19 diff --git a/dev-util/xdp-tools/Manifest b/dev-util/xdp-tools/Manifest
20 index c8dff02a4..7edd421bf 100644
21 --- a/dev-util/xdp-tools/Manifest
22 +++ b/dev-util/xdp-tools/Manifest
23 @@ -1 +1,2 @@
24 DIST xdp-tools-1.1.1.tar.gz 171627 BLAKE2B 5a2009f8b171d23a0f9b91b119e4376aecdddeb6d84c4323f05c03b382d4161c0d0364ef7a34b55771fe76c920b5bb18fe46c12d15c5356db6dc34174c5e5438 SHA512 580e87d7bfa7ee5b48caebceac4928386c3e3157ebb8d5cf1dd11a98187b9d17d027ef99f6598ce9b74eed7eb9b307195c4baa199675233d06c76bc8dc4861e5
25 +DIST xdp-tools-1.2.0.tar.gz 233676 BLAKE2B 488bd24c5b0c25cb90cc434c0d7cecaf0cf2818d949008fabf4a1245f773e1a1e7a6520c4155df5a6364b0cc8ce2ae49b7b428209b762ecd11f9d6adc10cc57b SHA512 484e5aed6d695665e9e7edec8033b6034281fb215c758a8a8600b5b2215c7decb538efbafa4204306497197a329c3ad7c51beb33717fbe0296a345a1aca8c0a9
26
27 diff --git a/dev-util/xdp-tools/files/xdp-tools-1.2.0-install.patch b/dev-util/xdp-tools/files/xdp-tools-1.2.0-install.patch
28 new file mode 100644
29 index 000000000..a02fb50f1
30 --- /dev/null
31 +++ b/dev-util/xdp-tools/files/xdp-tools-1.2.0-install.patch
32 @@ -0,0 +1,23 @@
33 +From 1de19829622cf394a6154834955379e7e45e0cb8 Mon Sep 17 00:00:00 2001
34 +From: Kurt Kanzenbach <kurt@×××××××××××××.de>
35 +Date: Fri, 10 Apr 2020 15:39:13 +0200
36 +Subject: [PATCH] lib: xdp: make: Don't install static libs
37 +
38 +Don't install static libs.
39 +
40 +Signed-off-by: Kurt Kanzenbach <kurt@×××××××××××××.de>
41 +---
42 + lib/libxdp/Makefile | 2 +-
43 + 1 file changed, 1 insertion(+), 1 deletion(-)
44 +
45 +--- a/lib/libxdp/Makefile
46 ++++ b/lib/libxdp/Makefile
47 +@@ -49,7 +49,7 @@ install: all
48 + $(Q)install -d -m 0755 $(DESTDIR)$(BPF_OBJECT_DIR)
49 + $(Q)install -m 0644 $(LIB_HEADERS) $(DESTDIR)$(HDRDIR)/
50 + $(Q)install -m 0644 $(PC_FILE) $(DESTDIR)$(LIBDIR)/pkgconfig/
51 +- $(Q)cp -fpR $(SHARED_LIBS) $(STATIC_LIBS) $(DESTDIR)$(LIBDIR)
52 ++ $(Q)cp -fpR $(SHARED_LIBS) $(DESTDIR)$(LIBDIR)
53 + $(Q)install -m 0755 $(XDP_OBJS) $(DESTDIR)$(BPF_OBJECT_DIR)
54 + $(if $(MAN_FILES),$(Q)install -m 0755 -d $(DESTDIR)$(MANDIR)/man3)
55 + $(if $(MAN_FILES),$(Q)install -m 0644 $(MAN_FILES) $(DESTDIR)$(MANDIR)/man3)
56
57 diff --git a/dev-util/xdp-tools/files/xdp-tools-1.2.0-readelf.patch b/dev-util/xdp-tools/files/xdp-tools-1.2.0-readelf.patch
58 new file mode 100644
59 index 000000000..9566c27b8
60 --- /dev/null
61 +++ b/dev-util/xdp-tools/files/xdp-tools-1.2.0-readelf.patch
62 @@ -0,0 +1,51 @@
63 +From: Kurt Kanzenbach <kurt@×××××××××××××.de>
64 +Subject: lib: xdp: make: Fix hardcoded readelf
65 +
66 +Don't hardcode readelf. Allow to reuse something else.
67 +
68 +Signed-off-by: Kurt Kanzenbach <kurt@×××××××××××××.de>
69 +---
70 + lib/libxdp/Makefile | 10 +++++-----
71 + 1 file changed, 5 insertions(+), 5 deletions(-)
72 +
73 +--- a/lib/libxdp/Makefile
74 ++++ b/lib/libxdp/Makefile
75 +@@ -26,7 +26,7 @@ TEMPLATED_SOURCES := xdp-dispatcher.c
76 +
77 + CFLAGS += -I$(HEADER_DIR) -I$(LIB_DIR)/util
78 + BPF_CFLAGS += -I$(HEADER_DIR)
79 +-
80 ++READELF ?= readelf
81 +
82 + ifndef BUILD_STATIC_ONLY
83 + SHARED_LIBS := $(OBJDIR)/libxdp.so \
84 +@@ -89,12 +89,12 @@ $(SHARED_OBJDIR)/%.o: %.c $(EXTRA_LIB_DE
85 +
86 + XDP_IN_SHARED := $(SHARED_OBJDIR)/libxdp.o $(SHARED_OBJDIR)/xsk.o
87 +
88 +-GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(XDP_IN_SHARED) | \
89 ++GLOBAL_SYM_COUNT = $(shell $(READELF) -s --wide $(XDP_IN_SHARED) | \
90 + cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
91 + sed 's/\[.*\]//' | \
92 + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
93 + sort -u | wc -l)
94 +-VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OBJDIR)/libxdp.so | \
95 ++VERSIONED_SYM_COUNT = $(shell $(READELF) --dyn-syms --wide $(OBJDIR)/libxdp.so | \
96 + grep -Eo '[^ ]+@LIBXDP_' | cut -d@ -f1 | sort -u | wc -l)
97 +
98 + check: check_abi
99 +@@ -106,12 +106,12 @@ check_abi: $(OBJDIR)/libxdp.so
100 + "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \
101 + "Please make sure all symbols are" \
102 + "versioned in $(VERSION_SCRIPT)." >&2; \
103 +- readelf -s --wide $(XDP_IN_SHARED) | \
104 ++ $(READELF) -s --wide $(XDP_IN_SHARED) | \
105 + cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \
106 + sed 's/\[.*\]//' | \
107 + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \
108 + sort -u > $(OUTPUT)libxdp_global_syms.tmp; \
109 +- readelf --dyn-syms --wide $(OUTPUT)libxdp.so | \
110 ++ $(READELF) --dyn-syms --wide $(OUTPUT)libxdp.so | \
111 + grep -Eo '[^ ]+@LIBXDP_' | cut -d@ -f1 | \
112 + sort -u > $(OUTPUT)libxdp_versioned_syms.tmp; \
113 + diff -u $(OUTPUT)libxdp_global_syms.tmp \
114
115 diff --git a/dev-util/xdp-tools/xdp-tools-1.2.0.ebuild b/dev-util/xdp-tools/xdp-tools-1.2.0.ebuild
116 new file mode 100644
117 index 000000000..9c66034a8
118 --- /dev/null
119 +++ b/dev-util/xdp-tools/xdp-tools-1.2.0.ebuild
120 @@ -0,0 +1,70 @@
121 +# Copyright 1999-2021 Gentoo Authors
122 +# Distributed under the terms of the GNU General Public License v2
123 +
124 +EAPI=7
125 +
126 +inherit linux-info llvm multilib toolchain-funcs
127 +
128 +DESCRIPTION="Utilities and example programs for use with XDP"
129 +HOMEPAGE="https://github.com/xdp-project/xdp-tools"
130 +SRC_URI="https://github.com/xdp-project/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
131 +
132 +SLOT="0"
133 +LICENSE="GPL-2"
134 +KEYWORDS="~amd64 ~x86"
135 +
136 +# skip strip for eBPF object files
137 +# tests have to be run as root
138 +RESTRICT="strip test"
139 +
140 +# skip QA check(s) for eBPF samples
141 +QA_EXECSTACK="usr/lib*/bpf/*.o usr/share/xdp-tools/*.o"
142 +QA_PREBUILT="usr/lib*/bpf/*.o usr/share/xdp-tools/*.o"
143 +
144 +# XDP should be enabled
145 +CONFIG_CHECK="~XDP_SOCKETS"
146 +
147 +LLVM_MAX_SLOT=12
148 +
149 +BDEPEND="
150 + virtual/pkgconfig
151 +"
152 +RDEPEND="
153 + >=dev-libs/libbpf-0.0.7
154 + net-libs/libpcap
155 + sys-libs/zlib
156 + virtual/libelf
157 +"
158 +DEPEND="${RDEPEND}
159 + sys-devel/clang
160 + sys-devel/llvm
161 +"
162 +
163 +PATCHES=(
164 + "${FILESDIR}/${P}-install.patch"
165 + "${FILESDIR}/${P}-readelf.patch"
166 +)
167 +
168 +pkg_setup() {
169 + llvm_pkg_setup
170 +}
171 +
172 +src_configure() {
173 + ./configure || die
174 +}
175 +
176 +src_compile() {
177 + emake \
178 + CC="$(tc-getCC)" \
179 + AR="$(tc-getAR)" \
180 + READELF=$(tc-getREADELF) \
181 + PRODUCTION=1 \
182 + DYNAMIC_LIBXDP=1 \
183 + FORCE_SYSTEM_LIBBPF=1 \
184 + PREFIX=/usr \
185 + LIBDIR="/usr/$(get_libdir)" all
186 +}
187 +
188 +src_install() {
189 + emake PREFIX=/usr LIBDIR="/usr/$(get_libdir)" DESTDIR="${D}" install
190 +}