summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakov Smolić <jsmolic@gentoo.org>2021-09-23 11:33:10 +0200
committerJakov Smolić <jsmolic@gentoo.org>2021-09-23 11:33:10 +0200
commit117b54d987da140725f7aac3b43607f3dfb4b91a (patch)
tree510884ab2dbc0c284a796607c5f919d716e5cf71 /dev-util/bpftool
parentapp-text/txt2tags: add github upstream metadata (diff)
downloadgentoo-117b54d987da140725f7aac3b43607f3dfb4b91a.tar.gz
gentoo-117b54d987da140725f7aac3b43607f3dfb4b91a.tar.bz2
gentoo-117b54d987da140725f7aac3b43607f3dfb4b91a.zip
dev-util/bpftool: Version bump to 5.14.5
Signed-off-by: Jakov Smolić <jsmolic@gentoo.org>
Diffstat (limited to 'dev-util/bpftool')
-rw-r--r--dev-util/bpftool/Manifest1
-rw-r--r--dev-util/bpftool/bpftool-5.14.5.ebuild117
2 files changed, 118 insertions, 0 deletions
diff --git a/dev-util/bpftool/Manifest b/dev-util/bpftool/Manifest
index 6f8e745483f0..7fa8d65917ae 100644
--- a/dev-util/bpftool/Manifest
+++ b/dev-util/bpftool/Manifest
@@ -1,2 +1,3 @@
DIST linux-5.14.tar.xz 120669872 BLAKE2B 0047f5aaa3940dff97f4055ef544faafbbb5282128e6afe21d2f47d8dc8c395806a17016febfa050117d16f59e74b882cb8b9c5011d68f119c230d0a4d120524 SHA512 8e4f3ec3d36f774280f75dc7b004a43e09417af58f12e9c9f8348976659d4cfda7ad905f306f43fed66a27922e5c45db22e46bbfa7a0b9f365012380de3b6f64
DIST patch-5.14.2.xz 8376 BLAKE2B 0fd1b718801661f5fe70866b0301bdcdaa4c2c0ca75aefcc20d4edb7439326cbc2aa1a0f78dd105bc7939f52107aca032f0e6e43d39c077e4f784220d0a8f752 SHA512 b8f181cf5d19e5206e4e0524a1bef5639346b71d002523bfd65e3a2fc2b914fa979c381c8a613c062503160510f31c003f712773cb6945497aa3eba71595c697
+DIST patch-5.14.5.xz 121948 BLAKE2B 1f1c503e9d56384250f0e3bc36d698a3fbd07e45dab8b01cb8046d660d32630f3f26daead931b5adc8d7ff26af3d819325d4af2c6ec0a37cb4ead637244dfe80 SHA512 496859c954a700704f5f4aca64ed134c183638d270155e5456fcc871c917a82f41ab4d70a0f503c9f1a7c63426f99a25545f4a930753e6afeb23dbd4be92e6b2
diff --git a/dev-util/bpftool/bpftool-5.14.5.ebuild b/dev-util/bpftool/bpftool-5.14.5.ebuild
new file mode 100644
index 000000000000..e3fa3487cfe7
--- /dev/null
+++ b/dev-util/bpftool/bpftool-5.14.5.ebuild
@@ -0,0 +1,117 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit estack linux-info optfeature python-any-r1 toolchain-funcs
+
+MY_PV="${PV/_/-}"
+MY_PV="${MY_PV/-pre/-git}"
+
+DESCRIPTION="Tool for inspection and simple manipulation of eBPF programs and maps"
+HOMEPAGE="https://kernel.org/"
+
+LINUX_V="${PV:0:1}.x"
+LINUX_VER=$(ver_cut 1-2)
+LINUX_PATCH=patch-${PV}.xz
+SRC_URI="https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_PATCH}"
+
+LINUX_SOURCES="linux-${LINUX_VER}.tar.xz"
+SRC_URI+=" https://www.kernel.org/pub/linux/kernel/v${LINUX_V}/${LINUX_SOURCES}"
+
+S_K="${WORKDIR}/linux-${LINUX_VER}"
+S="${S_K}/tools/bpf/bpftool"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="caps"
+
+RDEPEND="
+ sys-libs/binutils-libs:=
+ sys-libs/zlib:=
+ virtual/libelf:=
+ caps? ( sys-libs/libcap:= )
+"
+DEPEND="
+ ${RDEPEND}
+ >=sys-kernel/linux-headers-5.8
+"
+BDEPEND="
+ ${LINUX_PATCH+dev-util/patchutils}
+ ${PYTHON_DEPS}
+ dev-python/docutils
+"
+
+CONFIG_CHECK="~DEBUG_INFO_BTF"
+
+# src_unpack and src_prepare are copied from dev-util/perf since
+# it's building from the same tarball, please keep it in sync with perf
+src_unpack() {
+ local paths=(
+ tools/bpf kernel/bpf
+ tools/{arch,build,include,lib,perf,scripts} {scripts,include,lib} "arch/*/lib"
+ )
+
+ # We expect the tar implementation to support the -j option (both
+ # GNU tar and libarchive's tar support that).
+ echo ">>> Unpacking ${LINUX_SOURCES} (${paths[*]}) to ${PWD}"
+ tar --wildcards -xpf "${DISTDIR}"/${LINUX_SOURCES} \
+ "${paths[@]/#/linux-${LINUX_VER}/}" || die
+
+ if [[ -n ${LINUX_PATCH} ]] ; then
+ eshopts_push -o noglob
+ ebegin "Filtering partial source patch"
+ filterdiff -p1 ${paths[@]/#/-i } -z "${DISTDIR}"/${LINUX_PATCH} \
+ > ${P}.patch
+ eend $? || die "filterdiff failed"
+ eshopts_pop
+ fi
+
+ local a
+ for a in ${A}; do
+ [[ ${a} == ${LINUX_SOURCES} ]] && continue
+ [[ ${a} == ${LINUX_PATCH} ]] && continue
+ unpack ${a}
+ done
+}
+
+src_prepare() {
+ default
+
+ if [[ -n ${LINUX_PATCH} ]] ; then
+ pushd "${S_K}" >/dev/null || die
+ eapply "${WORKDIR}"/${P}.patch
+ popd || die
+ fi
+
+ # dev-python/docutils installs rst2man.py, not rst2man
+ sed -i -e 's/rst2man/rst2man.py/g' Documentation/Makefile || die
+}
+
+bpftool_make() {
+ local arch=$(tc-arch-kernel)
+ tc-export AR CC LD
+
+ emake V=1 VF=1 \
+ HOSTCC="$(tc-getBUILD_CC)" HOSTLD="$(tc-getBUILD_LD)" \
+ EXTRA_CFLAGS="${CFLAGS}" ARCH="${arch}" BPFTOOL_VERSION="${MY_PV}" \
+ prefix="${EPREFIX}"/usr \
+ feature-libcap="$(usex caps 1 0)" \
+ "$@"
+}
+
+src_compile() {
+ bpftool_make
+ bpftool_make -C Documentation
+}
+
+src_install() {
+ bpftool_make DESTDIR="${D}" install
+ bpftool_make mandir="${ED}"/usr/share/man -C Documentation install
+}
+
+pkg_postinst() {
+ optfeature "clang-bpf-co-re support" sys-devel/clang[llvm_targets_BPF]
+}