Gentoo Archives: gentoo-commits

From: "Jakov Smolić" <jsmolic@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftool/
Date: Mon, 28 Feb 2022 10:00:43
Message-Id: 1646042406.a3b68ef896bc8b6dd0e3a0ce0dd037f22a3cdde3.jsmolic@gentoo
1 commit: a3b68ef896bc8b6dd0e3a0ce0dd037f22a3cdde3
2 Author: Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 28 09:58:16 2022 +0000
4 Commit: Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 28 10:00:06 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3b68ef8
7
8 dev-util/bpftool: add 5.16.11
9
10 Signed-off-by: Jakov Smolić <jsmolic <AT> gentoo.org>
11
12 dev-util/bpftool/Manifest | 1 +
13 dev-util/bpftool/bpftool-5.16.11.ebuild | 117 ++++++++++++++++++++++++++++++++
14 2 files changed, 118 insertions(+)
15
16 diff --git a/dev-util/bpftool/Manifest b/dev-util/bpftool/Manifest
17 index 6359d98a6f85..8146ca1bff8d 100644
18 --- a/dev-util/bpftool/Manifest
19 +++ b/dev-util/bpftool/Manifest
20 @@ -2,4 +2,5 @@ DIST linux-5.15.tar.xz 121913744 BLAKE2B 3921274b23f7938abdf3ed9334534b4581e13d7
21 DIST linux-5.16.tar.xz 123114100 BLAKE2B 07a90cc640ff89e1359c06cee8c38abd33e51f9b9a89833e31a1d2750526fda4a59e8884db3c1ea63df0a37f0d3de6b5a922b014b7313d8abce20d90ac08adcb SHA512 7a257dd576bc8493595ec7d6f3c9cb6e22c772a8b2dbe735d2485c4f5c56e26a08695546e7e0f1f1cd04a533f25e829361958d4da0b98bf0ba8094dd57a85aaf
22 DIST patch-5.15.8.xz 537596 BLAKE2B 0f431804d406c4bbb09c44826fe1018b0bca94018337b73387d44ff3e25e6b90e2ec10cf9935847786e4dac6e1523e8e7daeaedb4f854d20a155bd13b29a0c72 SHA512 ef6d0841033fecba7c4aa25f5249a1e532a0d95f4b7e7048357ff00277d9abc11897f92d05d4a2cb90372da9cec8aa6664ce1058f71a6cae6bc647649787667d
23 DIST patch-5.16.10.xz 501568 BLAKE2B 9b3b86590d3b86b398c7ee2118df6944fe94dc872141706aca2e886ed7edf33d3e339847985208836f99c40858d1fe1efc6b6ef853854c9edfdb69b49d868798 SHA512 2e9917689f036b5b28ef9bb8d372148ed9dc0dd4460749d0e27aaa871adeb8e67aaeb557f0d891837be2ccb7f64c346e4f52fc23421917409f46d250fc793f53
24 +DIST patch-5.16.11.xz 571384 BLAKE2B 233f45175ec71c69b7893caccf8bc05a67d38d83b2f86db429e48b91f6d014f5a8646a5ded7a411b4d15205dbc9efd797dd07eeba4089cde5ebac004e204f96a SHA512 df457cb78a2b9e5ee350d3f817a0663fdc09efff42c2c514faeb30252381701404ceefa10d15845f2a00b2f3c28211fbc5b0d46bfdf564b2c1cfd3dc36a6a06a
25 DIST patch-5.16.2.xz 20432 BLAKE2B 9c9f697e4dd0a78a94ac0bd361ec69683c6904d9af02da55c3001394e6a6efcc1fccd5d44747fff6ea47271b7655bd7866d161a90196cecaddde1c630ef5c425 SHA512 50d3c386e391603fbfe86780bbfa69c3a7caa83a7eea6c239af133dde3a7aa4746f4a3f1483589018d5ac27caa7ee69d869f8f64f4b5121ddab52224f5302222
26
27 diff --git a/dev-util/bpftool/bpftool-5.16.11.ebuild b/dev-util/bpftool/bpftool-5.16.11.ebuild
28 new file mode 100644
29 index 000000000000..d4a6b8926868
30 --- /dev/null
31 +++ b/dev-util/bpftool/bpftool-5.16.11.ebuild
32 @@ -0,0 +1,117 @@
33 +# Copyright 2021-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +PYTHON_COMPAT=( python3_{8..10} )
39 +inherit estack linux-info optfeature python-any-r1 toolchain-funcs
40 +
41 +MY_PV="${PV/_/-}"
42 +MY_PV="${MY_PV/-pre/-git}"
43 +
44 +DESCRIPTION="Tool for inspection and simple manipulation of eBPF programs and maps"
45 +HOMEPAGE="https://kernel.org/"
46 +
47 +LINUX_V="${PV:0:1}.x"
48 +LINUX_VER=$(ver_cut 1-2)
49 +LINUX_PATCH=patch-${PV}.xz
50 +SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
51 +
52 +LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
53 +SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
54 +
55 +S_K="${WORKDIR}/linux-${LINUX_VER}"
56 +S="${S_K}/tools/bpf/bpftool"
57 +
58 +LICENSE="GPL-2"
59 +SLOT="0"
60 +KEYWORDS="~amd64 ~x86"
61 +IUSE="caps"
62 +
63 +RDEPEND="
64 + sys-libs/binutils-libs:=
65 + sys-libs/zlib:=
66 + virtual/libelf:=
67 + caps? ( sys-libs/libcap:= )
68 +"
69 +DEPEND="
70 + ${RDEPEND}
71 + >=sys-kernel/linux-headers-5.8
72 +"
73 +BDEPEND="
74 + ${LINUX_PATCH+dev-util/patchutils}
75 + ${PYTHON_DEPS}
76 + dev-python/docutils
77 +"
78 +
79 +CONFIG_CHECK="~DEBUG_INFO_BTF"
80 +
81 +# src_unpack and src_prepare are copied from dev-util/perf since
82 +# it's building from the same tarball, please keep it in sync with perf
83 +src_unpack() {
84 + local paths=(
85 + tools/bpf kernel/bpf
86 + tools/{arch,build,include,lib,perf,scripts} {scripts,include,lib} "arch/*/lib"
87 + )
88 +
89 + # We expect the tar implementation to support the -j option (both
90 + # GNU tar and libarchive's tar support that).
91 + echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
92 + tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
93 + "${paths[@]/#/linux-${LINUX_VER}/}" || die
94 +
95 + if [[ -n ${LINUX_PATCH} ]] ; then
96 + eshopts_push -o noglob
97 + ebegin "Filtering partial source patch"
98 + filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
99 + > ${P}.patch
100 + eend $? || die "filterdiff failed"
101 + eshopts_pop
102 + fi
103 +
104 + local a
105 + for a in ${A}; do
106 + [[ ${a} == ${LINUX_SOURCES} ]] && continue
107 + [[ ${a} == ${LINUX_PATCH} ]] && continue
108 + unpack ${a}
109 + done
110 +}
111 +
112 +src_prepare() {
113 + default
114 +
115 + if [[ -n ${LINUX_PATCH} ]] ; then
116 + pushd "${S_K}" >/dev/null || die
117 + eapply "${WORKDIR}"/${P}.patch
118 + popd || die
119 + fi
120 +
121 + # dev-python/docutils installs rst2man.py, not rst2man
122 + sed -i -e 's/rst2man/rst2man.py/g' Documentation/Makefile || die
123 +}
124 +
125 +bpftool_make() {
126 + local arch=$(tc-arch-kernel)
127 + tc-export AR CC LD
128 +
129 + emake V=1 VF=1 \
130 + HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
131 + EXTRA_CFLAGS="${CFLAGS}" ARCH="${arch}" BPFTOOL_VERSION="${MY_PV}" \
132 + prefix="${EPREFIX}"/usr \
133 + feature-libcap="$(usex caps 1 0)" \
134 + "$@"
135 +}
136 +
137 +src_compile() {
138 + bpftool_make
139 + bpftool_make -C Documentation
140 +}
141 +
142 +src_install() {
143 + bpftool_make DESTDIR="${D}" install
144 + bpftool_make mandir="${ED}"/usr/share/man -C Documentation install
145 +}
146 +
147 +pkg_postinst() {
148 + optfeature "clang-bpf-co-re support" sys-devel/clang[llvm_targets_BPF]
149 +}