From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CC8DA158092 for ; Mon, 13 Sep 2021 17:48:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F3D36E086E; Mon, 13 Sep 2021 17:48:11 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C5F78E086E for ; Mon, 13 Sep 2021 17:48:11 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AD113342CB6 for ; Mon, 13 Sep 2021 17:48:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2A827B0 for ; Mon, 13 Sep 2021 17:48:09 +0000 (UTC) From: "Jakov Smolić" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jakov Smolić" Message-ID: <1631555215.0168ad5e060ba894908e88c6b5813e90aa23f877.jsmolic@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftool/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-util/bpftool/Manifest dev-util/bpftool/bpftool-5.12.ebuild dev-util/bpftool/metadata.xml X-VCS-Directories: dev-util/bpftool/ X-VCS-Committer: jsmolic X-VCS-Committer-Name: Jakov Smolić X-VCS-Revision: 0168ad5e060ba894908e88c6b5813e90aa23f877 X-VCS-Branch: master Date: Mon, 13 Sep 2021 17:48:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5e0a9eec-127b-4324-a661-295fdbfcee92 X-Archives-Hash: d6b88db15be86f62e1bc6d08a035eda3 commit: 0168ad5e060ba894908e88c6b5813e90aa23f877 Author: Jakov Smolić gentoo org> AuthorDate: Mon Sep 13 07:03:57 2021 +0000 Commit: Jakov Smolić gentoo org> CommitDate: Mon Sep 13 17:46:55 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0168ad5e dev-util/bpftool: New package - This is a standalone bpftool package built from the Linux kernel sources, in a similar manner as dev-util/perf Signed-off-by: Jakov Smolić gentoo.org> dev-util/bpftool/Manifest | 2 + dev-util/bpftool/bpftool-5.12.ebuild | 119 +++++++++++++++++++++++++++++++++++ dev-util/bpftool/metadata.xml | 11 ++++ 3 files changed, 132 insertions(+) diff --git a/dev-util/bpftool/Manifest b/dev-util/bpftool/Manifest new file mode 100644 index 00000000000..679a5f7a7e4 --- /dev/null +++ b/dev-util/bpftool/Manifest @@ -0,0 +1,2 @@ +DIST linux-5.12.tar.xz 118112412 BLAKE2B 842d921b9a73d2aaade763dbd2ec67bdfe0275baa6d628b775f5c87574ad7dc86f0419afcd48c10c1235f4bffa16084243f2cf4556e6afcd391e975fe8ba530b SHA512 be03b6fee1d1ea8087b09874d27c0a602c0b04fd90ad38b975bd2c8455a07e83c29b56814aaf1389e82305fae0e4c2d1701075a7f0a7295dd28149f967ec5b3d +DIST patch-5.12.xz 6263608 BLAKE2B cc46642f352e579b073695e8ca23ede26ec84c7f8f79b969aa334a49879d2d5838bb1e3411dae7c1c0584193a4b08aed031eda33b6f38fea4c9b36ed236045d5 SHA512 68f4832e07c152e2df097097720c6adb9103b6a56f5056af67ffa9afbca66ab7c1a94968f638de14d4cd93a077c820f58ffc32952a87721004714339b9d18487 diff --git a/dev-util/bpftool/bpftool-5.12.ebuild b/dev-util/bpftool/bpftool-5.12.ebuild new file mode 100644 index 00000000000..a5d21696992 --- /dev/null +++ b/dev-util/bpftool/bpftool-5.12.ebuild @@ -0,0 +1,119 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit estack linux-info optfeature 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} + 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 ../Makefile.helpers || 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 + rm Documentation/bpf-helpers* || die +} + +src_install() { + bpftool_make DESTDIR="${D}" install + bpftool_make mandir="${ED}"/usr/share/man -C Documentation install + + # bpf-helpers man is already provided by sys-apps/man-pages + rm -r "${ED}"/usr/share/man/man7 || die +} + +pkg_postinst() { + optfeature "clang-bpf-co-re support" sys-devel/clang[llvm_targets_BPF] +} diff --git a/dev-util/bpftool/metadata.xml b/dev-util/bpftool/metadata.xml new file mode 100644 index 00000000000..5e14e3b3c65 --- /dev/null +++ b/dev-util/bpftool/metadata.xml @@ -0,0 +1,11 @@ + + + + + jsmolic@gentoo.org + Jakov Smolić + + + Use sys-libs/libcap to enable unprivileged run support + +