diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-12 19:09:37 -0500 |
| commit | b590c8d7572b727d565cc0b8ff660d43569845de (patch) | |
| tree | 06f7a4102ea4e845df8b66660f252920d52952f9 /dev-util/bpftool | |
| parent | 24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff) | |
| download | baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip | |
Adding metadata
Diffstat (limited to 'dev-util/bpftool')
| -rw-r--r-- | dev-util/bpftool/Manifest | 2 | ||||
| -rw-r--r-- | dev-util/bpftool/bpftool-7.6.0-r1.ebuild | 154 | ||||
| -rw-r--r-- | dev-util/bpftool/bpftool-7.7.0-r1.ebuild | 166 | ||||
| -rw-r--r-- | dev-util/bpftool/bpftool-9999.ebuild | 166 | ||||
| -rw-r--r-- | dev-util/bpftool/metadata.xml | 18 |
5 files changed, 506 insertions, 0 deletions
diff --git a/dev-util/bpftool/Manifest b/dev-util/bpftool/Manifest new file mode 100644 index 000000000000..a639c1b28c1f --- /dev/null +++ b/dev-util/bpftool/Manifest @@ -0,0 +1,2 @@ +DIST bpftool-libbpf-v7.6.0-sources.tar.gz 1527883 BLAKE2B 5918519009b1ee258c33506cb52d216b08fbcd6365083a71d74b11e2c788fd4c6f7cfd78c84bb85074eb463dfa8d087b8e35c79d00f3a0810979640af6b334e6 SHA512 d443601227acd9a0db15896da186b0a47d426c44f2b6eaa822391594aa23d617a94ee94f284abb841529d41ef7c585a1087dd5ab1708ce068cc02b3c08b0a51b +DIST bpftool-libbpf-v7.7.0-sources.tar.gz 1553943 BLAKE2B db13d16f12af61d97312dd821088e81062d3bbc6d954e0d463026bb99e6acdca4a232db26a1b735d70bd91cd954fd628e0a699517d4b1b38838ad3ac5aa82721 SHA512 d74b3ace03981791e08ac50d6b977a27de67bfd5e088e0ecb424eaebb58c30b85ef306f51d0e9244666511b430606b1ed52382d360348da40787c0045b6c8f43 diff --git a/dev-util/bpftool/bpftool-7.6.0-r1.ebuild b/dev-util/bpftool/bpftool-7.6.0-r1.ebuild new file mode 100644 index 000000000000..b49f33df5649 --- /dev/null +++ b/dev-util/bpftool/bpftool-7.6.0-r1.ebuild @@ -0,0 +1,154 @@ +# Copyright 2021-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {15..22} ) +LLVM_OPTIONAL=1 +PYTHON_COMPAT=( python3_{13..14} ) + +inherit bash-completion-r1 linux-info llvm-r1 python-any-r1 toolchain-funcs + +DESCRIPTION="Tool for inspection and simple manipulation of eBPF programs and maps" +HOMEPAGE="https://github.com/libbpf/bpftool" + +if [[ ${PV} == *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/libbpf/bpftool.git" + EGIT_SUBMODULES=(libbpf) +else + # bpftool typically vendors whatever libbpf is current at the time + # of a release, while libbpf publishes minor updates more frequently. + # Uncomment the following to bundle an updated libbpf e.g. in case of + # security or crasher bugs in libbpf and to keep the two synchronized. + # This allows us to quickly update the vendored lib with a revbump. + # Currently bpftool-x.y vendors libbpf-1.y; DO NOT mix different y versions. + # See the libbpf repo (https://github.com/libbpf/libbpf) for possible updates. + # LIBBPF_VERSION=1.5.0 + + if [[ ! -z ${LIBBPF_VERSION} ]] ; then + SRC_URI="https://github.com/libbpf/bpftool/archive/refs/tags/v${PV}.tar.gz -> bpftool-${PV}.tar.gz + https://github.com/libbpf/libbpf/archive/refs/tags/v${LIBBPF_VERSION}.tar.gz + -> libbpf-${LIBBPF_VERSION}.tar.gz" + else + # use tarball with bundled libbpf + SRC_URI="https://github.com/libbpf/bpftool/releases/download/v${PV}/bpftool-libbpf-v${PV}-sources.tar.gz" + S="${WORKDIR}/bpftool-libbpf-v${PV}-sources" + fi + + KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv x86" +fi + +LICENSE="|| ( GPL-2 BSD-2 )" +SLOT="0" +IUSE="caps +clang llvm" +REQUIRED_USE="llvm? ( ${LLVM_REQUIRED_USE} )" + +RDEPEND=" + caps? ( sys-libs/libcap:= ) + llvm? ( $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}') ) + !llvm? ( sys-libs/binutils-libs:= ) + virtual/zlib:= + virtual/libelf:= +" +DEPEND=" + ${RDEPEND} + >=sys-kernel/linux-headers-5.8 +" +BDEPEND=" + ${PYTHON_DEPS} + app-arch/tar + dev-python/docutils + clang? ( $(llvm_gen_dep 'llvm-core/clang:${LLVM_SLOT}[llvm_targets_BPF]') ) + !clang? ( sys-devel/bpf-toolchain ) +" + +CONFIG_CHECK="~DEBUG_INFO_BTF" + +pkg_setup() { + linux-info_pkg_setup + python-any-r1_pkg_setup + use llvm && llvm-r1_pkg_setup +} + +src_prepare() { + default + + # prepare libbpf if necessary + if [[ ! -z ${LIBBPF_VERSION} ]] ; then + rm -rf libbpf || die + ln -s "${WORKDIR}/libbpf-${LIBBPF_VERSION}" libbpf || die + fi + + # remove -Werror from libbpf (bug 887981) + sed -i -e 's/\-Werror//g' libbpf/src/Makefile || die + + # remove -Werror from bpftool feature detection + sed -i -e 's/-Werror//g' src/Makefile.feature || die + + # remove hardcoded/unhelpful flags from bpftool + sed -e '/CFLAGS += -O2$/d' \ + -e '/CFLAGS += -W$/d' \ + -e '/CFLAGS += -Wextra$/d' \ + -i src/Makefile || die + + # always build bpf bits with std=gnu11 for kernel compatibility (bug 955156) + sed -i 's/-fno-stack-protector/& -std=gnu11/g' src/Makefile || die + + if ! use clang; then + # make people aware of what they are doing + ewarn "Using bpf-toolchain instead of clang due to USE=-clang." + ewarn "Please report any odd behaviours you observe, since using gcc for BPF" + ewarn "is still under development in both the Linux kernel and gcc itself." + + # prevent attribute warning about preserve_access_index + # since gcc does not support '#pragma clang attribute push': + # https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=675b4e2 + sed -i 's/std=gnu11/& -DBPF_NO_PRESERVE_ACCESS_INDEX/g' src/Makefile || die + + # remove bpf target & add assembly annotations to fix CO-RE feature detection + sed -i -e 's/-target bpf/-dA/' src/Makefile.feature || die + + # remove bpf target from skeleton build + sed -i -e 's/--target=bpf//g' src/Makefile || die + fi + + # Use rst2man or rst2man.py depending on which one exists (#930076) + type -P rst2man >/dev/null || sed -i -e 's/rst2man/rst2man.py/g' docs/Makefile || die +} + +bpftool_make() { + # which BPF compiler should we use? + if use clang; then + export CLANG="$(get_llvm_prefix -b)/bin/clang" + export LLVM_STRIP="$(get_llvm_prefix -b)/bin/llvm-strip" + else + # use bpf-toolchain + export CLANG="bpf-unknown-none-gcc" + export LLVM_STRIP="bpf-unknown-none-strip" + fi + + tc-export AR CC LD + + emake \ + ARCH="$(tc-arch-kernel)" \ + HOSTAR="$(tc-getBUILD_AR)" \ + HOSTCC="$(tc-getBUILD_CC)" \ + HOSTLD="$(tc-getBUILD_LD)" \ + bash_compdir="$(get_bashcompdir)" \ + feature-libcap="$(usex caps 1 0)" \ + feature-llvm="$(usex llvm 1 0)" \ + prefix="${EPREFIX}"/usr \ + V=1 \ + "$@" +} + +src_compile() { + bpftool_make -C src + bpftool_make -C docs +} + +src_install() { + bpftool_make DESTDIR="${D}" -C src install + bpftool_make mandir="${ED}"/usr/share/man -C docs install +} diff --git a/dev-util/bpftool/bpftool-7.7.0-r1.ebuild b/dev-util/bpftool/bpftool-7.7.0-r1.ebuild new file mode 100644 index 000000000000..51bbc6ded36c --- /dev/null +++ b/dev-util/bpftool/bpftool-7.7.0-r1.ebuild @@ -0,0 +1,166 @@ +# Copyright 2021-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {15..22} ) +LLVM_OPTIONAL=1 +PYTHON_COMPAT=( python3_{13..14} ) + +inherit bash-completion-r1 flag-o-matic linux-info llvm-r1 python-any-r1 toolchain-funcs + +DESCRIPTION="Tool for inspection and simple manipulation of eBPF programs and maps" +HOMEPAGE="https://github.com/libbpf/bpftool" + +if [[ ${PV} == *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/libbpf/bpftool.git" + EGIT_SUBMODULES=(libbpf) +else + # bpftool typically vendors whatever libbpf is current at the time + # of a release, while libbpf publishes minor updates more frequently. + # Uncomment the following to bundle an updated libbpf e.g. in case of + # security or crasher bugs in libbpf and to keep the two synchronized. + # This allows us to quickly update the vendored lib with a revbump. + # Currently bpftool-x.y vendors libbpf-1.y; DO NOT mix different y versions. + # See the libbpf repo (https://github.com/libbpf/libbpf) for possible updates. + # LIBBPF_VERSION=1.7.0 + + if [[ ! -z ${LIBBPF_VERSION} ]] ; then + SRC_URI="https://github.com/libbpf/bpftool/archive/refs/tags/v${PV}.tar.gz -> bpftool-${PV}.tar.gz + https://github.com/libbpf/libbpf/archive/refs/tags/v${LIBBPF_VERSION}.tar.gz + -> libbpf-${LIBBPF_VERSION}.tar.gz" + else + # use tarball with bundled libbpf + SRC_URI="https://github.com/libbpf/bpftool/releases/download/v${PV}/bpftool-libbpf-v${PV}-sources.tar.gz" + S="${WORKDIR}/bpftool-libbpf-v${PV}-sources" + fi + + KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv x86" +fi + +LICENSE="|| ( GPL-2 BSD-2 )" +SLOT="0" +IUSE="caps +clang llvm" +REQUIRED_USE="llvm? ( ${LLVM_REQUIRED_USE} )" + +RDEPEND=" + caps? ( sys-libs/libcap:= ) + llvm? ( $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}') ) + !llvm? ( sys-libs/binutils-libs:= ) + virtual/zlib:= + virtual/libelf:= +" +DEPEND=" + ${RDEPEND} + >=sys-kernel/linux-headers-5.8 +" +BDEPEND=" + ${PYTHON_DEPS} + app-arch/tar + dev-python/docutils + clang? ( $(llvm_gen_dep 'llvm-core/clang:${LLVM_SLOT}[llvm_targets_BPF]') ) + !clang? ( sys-devel/bpf-toolchain ) +" + +CONFIG_CHECK="~DEBUG_INFO_BTF" + +pkg_setup() { + linux-info_pkg_setup + python-any-r1_pkg_setup + use llvm && llvm-r1_pkg_setup +} + +src_prepare() { + default + + # prepare libbpf if necessary + if [[ ! -z ${LIBBPF_VERSION} ]] ; then + rm -rf libbpf || die + ln -s "${WORKDIR}/libbpf-${LIBBPF_VERSION}" libbpf || die + fi + + # remove -Werror from libbpf (bug 887981) + sed -i -e 's/\-Werror//g' libbpf/src/Makefile || die + + # remove -Werror from bpftool feature detection + sed -i -e 's/-Werror//g' src/Makefile.feature || die + + # remove hardcoded/unhelpful flags from bpftool + sed -e '/CFLAGS += -O2$/d' \ + -e '/CFLAGS += -W$/d' \ + -e '/CFLAGS += -Wextra$/d' \ + -i src/Makefile || die + + # always build bpf bits with std=gnu11 for kernel compatibility (bug 955156) + sed -i 's/-fno-stack-protector/& -std=gnu11/g' src/Makefile || die + + if ! use clang; then + # make people aware of what they are doing + ewarn "Using bpf-toolchain instead of clang due to USE=-clang." + ewarn "Please report any odd behaviours you observe, since using gcc for BPF" + ewarn "is still under development in both the Linux kernel and gcc itself." + + # prevent attribute warning about preserve_access_index + # since gcc does not support '#pragma clang attribute push': + # https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=675b4e2 + sed -i 's/std=gnu11/& -DBPF_NO_PRESERVE_ACCESS_INDEX/g' src/Makefile || die + + # remove bpf target & add assembly annotations to fix CO-RE feature detection + sed -i -e 's/-target bpf/-dA/' src/Makefile.feature || die + + # remove bpf target from skeleton build + sed -i -e 's/--target=bpf//g' src/Makefile || die + fi + + # Use rst2man or rst2man.py depending on which one exists (#930076) + type -P rst2man >/dev/null || sed -i -e 's/rst2man/rst2man.py/g' docs/Makefile || die +} + +src_configure() { + # filter LTO after discussion about UB in libbpf: + # https://lore.kernel.org/bpf/20260321024446.692008-1-irogers@google.com/ + filter-lto + + default +} + +bpftool_make() { + # which BPF compiler should we use? + if use clang; then + export CLANG="$(get_llvm_prefix -b)/bin/clang" + export LLVM_STRIP="$(get_llvm_prefix -b)/bin/llvm-strip" + else + # use bpf-toolchain + export CLANG="bpf-unknown-none-gcc" + export LLVM_STRIP="bpf-unknown-none-strip" + fi + + tc-export AR CC LD + + # add EXTRA_CFLAGS to be consistent with our libbpf ebuild + local extra_cflags="-fno-strict-aliasing" + + emake \ + ARCH="$(tc-arch-kernel)" \ + EXTRA_CFLAGS="${extra_cflags}" \ + HOSTAR="$(tc-getBUILD_AR)" \ + HOSTCC="$(tc-getBUILD_CC)" \ + HOSTLD="$(tc-getBUILD_LD)" \ + bash_compdir="$(get_bashcompdir)" \ + feature-libcap="$(usex caps 1 0)" \ + feature-llvm="$(usex llvm 1 0)" \ + prefix="${EPREFIX}"/usr \ + V=1 \ + "$@" +} + +src_compile() { + bpftool_make -C src + bpftool_make -C docs +} + +src_install() { + bpftool_make DESTDIR="${D}" -C src install + bpftool_make mandir="${ED}"/usr/share/man -C docs install +} diff --git a/dev-util/bpftool/bpftool-9999.ebuild b/dev-util/bpftool/bpftool-9999.ebuild new file mode 100644 index 000000000000..e292d799c621 --- /dev/null +++ b/dev-util/bpftool/bpftool-9999.ebuild @@ -0,0 +1,166 @@ +# Copyright 2021-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( {15..22} ) +LLVM_OPTIONAL=1 +PYTHON_COMPAT=( python3_{13..14} ) + +inherit bash-completion-r1 flag-o-matic linux-info llvm-r1 python-any-r1 toolchain-funcs + +DESCRIPTION="Tool for inspection and simple manipulation of eBPF programs and maps" +HOMEPAGE="https://github.com/libbpf/bpftool" + +if [[ ${PV} == *9999* ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/libbpf/bpftool.git" + EGIT_SUBMODULES=(libbpf) +else + # bpftool typically vendors whatever libbpf is current at the time + # of a release, while libbpf publishes minor updates more frequently. + # Uncomment the following to bundle an updated libbpf e.g. in case of + # security or crasher bugs in libbpf and to keep the two synchronized. + # This allows us to quickly update the vendored lib with a revbump. + # Currently bpftool-x.y vendors libbpf-1.y; DO NOT mix different y versions. + # See the libbpf repo (https://github.com/libbpf/libbpf) for possible updates. + # LIBBPF_VERSION=1.7.0 + + if [[ ! -z ${LIBBPF_VERSION} ]] ; then + SRC_URI="https://github.com/libbpf/bpftool/archive/refs/tags/v${PV}.tar.gz -> bpftool-${PV}.tar.gz + https://github.com/libbpf/libbpf/archive/refs/tags/v${LIBBPF_VERSION}.tar.gz + -> libbpf-${LIBBPF_VERSION}.tar.gz" + else + # use tarball with bundled libbpf + SRC_URI="https://github.com/libbpf/bpftool/releases/download/v${PV}/bpftool-libbpf-v${PV}-sources.tar.gz" + S="${WORKDIR}/bpftool-libbpf-v${PV}-sources" + fi + + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86" +fi + +LICENSE="|| ( GPL-2 BSD-2 )" +SLOT="0" +IUSE="caps +clang llvm" +REQUIRED_USE="llvm? ( ${LLVM_REQUIRED_USE} )" + +RDEPEND=" + caps? ( sys-libs/libcap:= ) + llvm? ( $(llvm_gen_dep 'llvm-core/llvm:${LLVM_SLOT}') ) + !llvm? ( sys-libs/binutils-libs:= ) + virtual/zlib:= + virtual/libelf:= +" +DEPEND=" + ${RDEPEND} + >=sys-kernel/linux-headers-5.8 +" +BDEPEND=" + ${PYTHON_DEPS} + app-arch/tar + dev-python/docutils + clang? ( $(llvm_gen_dep 'llvm-core/clang:${LLVM_SLOT}[llvm_targets_BPF]') ) + !clang? ( sys-devel/bpf-toolchain ) +" + +CONFIG_CHECK="~DEBUG_INFO_BTF" + +pkg_setup() { + linux-info_pkg_setup + python-any-r1_pkg_setup + use llvm && llvm-r1_pkg_setup +} + +src_prepare() { + default + + # prepare libbpf if necessary + if [[ ! -z ${LIBBPF_VERSION} ]] ; then + rm -rf libbpf || die + ln -s "${WORKDIR}/libbpf-${LIBBPF_VERSION}" libbpf || die + fi + + # remove -Werror from libbpf (bug 887981) + sed -i -e 's/\-Werror//g' libbpf/src/Makefile || die + + # remove -Werror from bpftool feature detection + sed -i -e 's/-Werror//g' src/Makefile.feature || die + + # remove hardcoded/unhelpful flags from bpftool + sed -e '/CFLAGS += -O2$/d' \ + -e '/CFLAGS += -W$/d' \ + -e '/CFLAGS += -Wextra$/d' \ + -i src/Makefile || die + + # always build bpf bits with std=gnu11 for kernel compatibility (bug 955156) + sed -i 's/-fno-stack-protector/& -std=gnu11/g' src/Makefile || die + + if ! use clang; then + # make people aware of what they are doing + ewarn "Using bpf-toolchain instead of clang due to USE=-clang." + ewarn "Please report any odd behaviours you observe, since using gcc for BPF" + ewarn "is still under development in both the Linux kernel and gcc itself." + + # prevent attribute warning about preserve_access_index + # since gcc does not support '#pragma clang attribute push': + # https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=675b4e2 + sed -i 's/std=gnu11/& -DBPF_NO_PRESERVE_ACCESS_INDEX/g' src/Makefile || die + + # remove bpf target & add assembly annotations to fix CO-RE feature detection + sed -i -e 's/-target bpf/-dA/' src/Makefile.feature || die + + # remove bpf target from skeleton build + sed -i -e 's/--target=bpf//g' src/Makefile || die + fi + + # Use rst2man or rst2man.py depending on which one exists (#930076) + type -P rst2man >/dev/null || sed -i -e 's/rst2man/rst2man.py/g' docs/Makefile || die +} + +src_configure() { + # filter LTO after discussion about UB in libbpf: + # https://lore.kernel.org/bpf/20260321024446.692008-1-irogers@google.com/ + filter-lto + + default +} + +bpftool_make() { + # which BPF compiler should we use? + if use clang; then + export CLANG="$(get_llvm_prefix -b)/bin/clang" + export LLVM_STRIP="$(get_llvm_prefix -b)/bin/llvm-strip" + else + # use bpf-toolchain + export CLANG="bpf-unknown-none-gcc" + export LLVM_STRIP="bpf-unknown-none-strip" + fi + + tc-export AR CC LD + + # add EXTRA_CFLAGS to be consistent with our libbpf ebuild + local extra_cflags="-fno-strict-aliasing" + + emake \ + ARCH="$(tc-arch-kernel)" \ + EXTRA_CFLAGS="${extra_cflags}" \ + HOSTAR="$(tc-getBUILD_AR)" \ + HOSTCC="$(tc-getBUILD_CC)" \ + HOSTLD="$(tc-getBUILD_LD)" \ + bash_compdir="$(get_bashcompdir)" \ + feature-libcap="$(usex caps 1 0)" \ + feature-llvm="$(usex llvm 1 0)" \ + prefix="${EPREFIX}"/usr \ + V=1 \ + "$@" +} + +src_compile() { + bpftool_make -C src + bpftool_make -C docs +} + +src_install() { + bpftool_make DESTDIR="${D}" -C src install + bpftool_make mandir="${ED}"/usr/share/man -C docs install +} diff --git a/dev-util/bpftool/metadata.xml b/dev-util/bpftool/metadata.xml new file mode 100644 index 000000000000..aeb244207989 --- /dev/null +++ b/dev-util/bpftool/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person" proxied="yes"> + <email>holger@applied-asynchrony.com</email> + <name>Holger Hoffstätte</name> + </maintainer> + <maintainer type="project" proxied="proxy"> + <email>proxy-maint@gentoo.org</email> + <name>Proxy Maintainers</name> + </maintainer> + <use> + <flag name="caps">Use <pkg>sys-libs/libcap</pkg> to enable unprivileged run support</flag> + <flag name="clang">Use <pkg>llvm-core/clang</pkg> instead of <pkg>sys-devel/bpf-toolchain</pkg> for BPF CO-RE support</flag> + <flag name="llvm">Use <pkg>llvm-core/llvm</pkg> instead of libbfd (<pkg>sys-libs/binutils-libs</pkg>) for JIT disassembly</flag> + </use> + <origin>baldeagleos-repo</origin> +</pkgmetadata> |
