summaryrefslogtreecommitdiff
path: root/dev-util/bpftool
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-11-12 03:02:41 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-11-12 03:02:41 +0000
commit51be8f45b17e3da3ac48eca6b16b703bb58fda76 (patch)
treebc6f18bc4913276cff3f8c2f2ec357f9026c602c /dev-util/bpftool
parent0ab98a20dbfb8c64ab93e02280abb4ff18652ae0 (diff)
gentoo auto-resync : 12:11:2024 - 03:02:41
Diffstat (limited to 'dev-util/bpftool')
-rw-r--r--dev-util/bpftool/Manifest8
-rw-r--r--dev-util/bpftool/bpftool-7.4.0.ebuild2
-rw-r--r--dev-util/bpftool/bpftool-7.5.0.ebuild137
-rw-r--r--dev-util/bpftool/bpftool-9999.ebuild26
-rw-r--r--dev-util/bpftool/metadata.xml1
5 files changed, 166 insertions, 8 deletions
diff --git a/dev-util/bpftool/Manifest b/dev-util/bpftool/Manifest
index f4b60f2c7acb..cc72b6071b52 100644
--- a/dev-util/bpftool/Manifest
+++ b/dev-util/bpftool/Manifest
@@ -7,6 +7,7 @@ AUX 7.4-006-fix-undefined-behavior-in-qsort.patch 1922 BLAKE2B 52aab0ee6878c29bd
AUX 7.4-007-define-PACKAGE-at-build-time-when-trying-to-detect-libbfd.patch 2268 BLAKE2B a537c0356ca2da4bdaf39a5dc77a0f5f0ef004a081c7620230edc55c407887a56f1a3bfcfb3036f24dd8b5a46ca7ee303c87332dc094556694ea8a201ba29ae4 SHA512 e96b0ce37ca5306dcd093ebbd185417d6f7830c5abb4ebadcc9c117066ebc43328752e6819bea211e92f4f4d6ce7d023b60db4c1ca11ce4f2e41877feb08c48a
AUX 7.4-008-always-disable-unused-CLI-arguments-warning-for-feature-probe.patch 1481 BLAKE2B 74e618cb84c3f62553b50b351b495993aa608508cbb54fefca667369c9f49a127742f27b2514a3bb7dae6bc09145068641f548710e9b9299fb14b0783bff4ba2 SHA512 dbeb9e5e2e0750220b69c07b15110c6af19e2ab049d484d73f676d14d321289d5c6bfc96bed6bd0fe717af09b2f75aff2ecee7e084985026a2f30c5fcbd57958
DIST bpftool-7.4.0.tar.gz 472915 BLAKE2B ae7b6bc6cb742712981ba8972bcecccc63d440b2a77c5a14f91ba5106c013774313d65fd3f42b843ba4027ab17cf9d44d256270f7f8ad11907714f16f3149078 SHA512 08a3095b37a9b897400f2be7dbb9de10d129ae4eef193d03955fdf84017cd3a5d7419e856aa68a425e609419868e8b1dd5409b4f218cc24feeb059c1898cdff4
+DIST bpftool-libbpf-v7.5.0-sources.tar.gz 1510032 BLAKE2B cc9beac4034317f89ae3c1088d1b1a1948778bcdb51d7ed7f566e4e5ab720c1128ca467d51d0bc3ffe7b1f69800249362baef5dfaf858275050f96b744fdbca6 SHA512 db12c305b77fea3689dbc1ce94527f0f21fa9de21fcdb36385e3fe492137335bb393f90e456c06601495ccc984230a531c432709db6514b545e0aeeda7ca3c99
DIST libbpf-1.4.7.tar.gz 1016441 BLAKE2B 10be52c7e97b2f08edd33cb263c4737bb52edfd2226f0c5b86d4f95b584b81f8f6b1ede469e9ad6c231e55b6d6b9a038160662606c3f30dc79b1336aaaa90e74 SHA512 f09ff28ac75b0d0c1bfe7d233aee6a00e5c21f185646b2afe11b7bd048d74962f893237437dd81a762768f9235b9f2a2a33cb297201b2aa3e98f7c6f58e5b365
DIST linux-6.10.tar.xz 145142812 BLAKE2B bb243ea7493b9d63aa2df2050a3f1ae2b89ee84a20015239cf157e3f4f51c7ac5efedc8a51132b2d7482f9276ac418de6624831c8a3b806130d9c2d2124c539b SHA512 baa2487954044f991d2ae254d77d14a1f0185dd62c9f0fcaff69f586c9f906823017b8db1c4588f27b076dfa3ebb606929fec859f60ea419e7974330b9289cc2
DIST linux-6.11.tar.xz 146900704 BLAKE2B e7750c0878d71a56a0ce52d4c4c912199dad5bf5e2e8f872585a6494afbb37cbd852e612a6858936d2dc9b7776a3933818f540db408d57e90d18ea5249bba7ab SHA512 329c1f94008742e3f0c2ce7e591a16316d1b2cb9ea4596d4f45604097e07b7aa2f64afa40630a07f321a858455c77aa32ba57b271932ddcf4dc27863f9081cea
@@ -18,8 +19,9 @@ DIST patch-6.8.2.xz 247244 BLAKE2B a85078230548543c38550a5546689d0b44a54208cdad5
DIST patch-6.9.2.xz 16184 BLAKE2B 8a37e96c253b55b57c86f1654f2ea8bf65af96b1b38213e90032cb918bb8eea992d6ddbfa6a6774a229ab2e2288ab57bdb6cbad6e7e393c123f24850e06847c9 SHA512 a27af24f0caaa5de3811b6db5acc2d72b96df9ebb5c44bad99a949d871fb06c6ffd2be10cfc35b246d430c7be2291701f802aed47eaa8818ad12b8818a60f3ec
EBUILD bpftool-6.8.2.ebuild 3101 BLAKE2B b032c5133f13d0a2f789a08fa054bd5d88cc729026974189d20b9d91f6295fdbad39056acc1223e78923b6201d91799c8cb833948135bccf25b84b4c25f00d5d SHA512 1efcf7572c1aa378394f38d2b939752aaf3215f92ffa227c493d0e3e9c8f945bcca82f759487386cd62e9c5996400395a944962f61af20fc62f8a206b57740d5
EBUILD bpftool-6.9.2.ebuild 3125 BLAKE2B a8395a94a01d8fe758246cc158713ca30f928aa4051380f6fbb4a285f7a16a223db02b199b422242adca3df4032d79daa20b9420f3a4543aeefca128e41ddfad SHA512 3931abd489a3cbb7aaaf4ea8fd004a45c4a27c8a645fb7eb5088fab3186ebc59b61d58e4b0704dd1c264eee50a95288ad1824af0aff482da306c282465d3013b
-EBUILD bpftool-7.4.0.ebuild 4001 BLAKE2B b39b9047ab6c666241c4e3ea080844ec1ecbcd6fe4dceed861872895fbb2e3a03ddb5c3c138122a7d94fa147c84b874806d32f8bd350ba621467117be9019ab1 SHA512 c8f8262dfda5265bed0c0a4d15eb7d52bb4e1986910efa93b204f0b57f42860a8e112dc307427e18bb1fc9cb80b580b6f8c22f9347adde676cd64db22a09d946
+EBUILD bpftool-7.4.0.ebuild 3990 BLAKE2B 1c04497a5db8e30039f40be14e79ba7b475ca846e892fbda5e03fea5c5f66606b7d59ff7fcc453d50846bcb8ed436905bd1809c3c41d0637e69eeb98a176ed33 SHA512 2a48bbc95cfb04ec934d0e0d73ce21923bdec52061b4632c8a0c651ed28c5377b4beccf2509794fa78128ce320442186afbb9dc86e348c6fb96885954f019a7e
EBUILD bpftool-7.5.0-r1.ebuild 3405 BLAKE2B 74da665bc8e3ddd5ea372590455345ea6e75348500eefe7117926d313d8d4c75579e31635b8b67761ffe1ad3284788dfd19f524709f2a951b1f9790a41ea3b1e SHA512 a228790899d82206d7378d24aaf02257b6fb540983ea83157eb7a0ef4c09d420c57257849830c8352df4a1f55f482fad9490813d8657e6b512bbe28b46958429
EBUILD bpftool-7.5.0-r2.ebuild 3692 BLAKE2B 96f5e8a3d432141f2222e84bb7855e99dcfbec79dae69730fc59c43844dce96c0b062a0a5795148309f3da3fbe794c0ce4e58037a2d5d715708d60a4b16ad86f SHA512 e8238e2c69c00a0f398e31b22cb0433f424246725c3f5be779ba52abf0b838540cbf54c8b52ab545ce462d71294e11ec085a36ccc614efaab776a4a0c04d2421
-EBUILD bpftool-9999.ebuild 3401 BLAKE2B 2214ec6149d3fea446d0eee5522e5109ff9787199840f80ad465fc9ab0c9fee6166e6e636bf1303b0c53419f7d3e206c11953f2cd9df0f9ebc321ea46b0e4948 SHA512 7cf4b171dbf48d1f824149684eb06a03490d9cc4410bffcbc14e4344ba3b3af2f9f67eabe4ebab7a5c170cef6c704de9dcb67e437c1abb67785b38cb0a7b34ab
-MISC metadata.xml 729 BLAKE2B 7a30c956e2e563b5a22b9301afa77f1025d93464c4f33f31aba6ec727b85857393318bc2941b2165fcf6c4258c318e48e66b1f1147f30e80a4ebcb63cb6f4b3f SHA512 799fcd5cf2da7c6dc67adb6766f73aa350f412444f1a2e8a911d2db6e6c7f228cf0863a09bd32a07fc8ef8d7fce68036239e779e78454285c36a2b95935afef6
+EBUILD bpftool-7.5.0.ebuild 3945 BLAKE2B 6870891e5cfaf22dfddf5620f1b7b622bb7941934660d58c29925bef697784ba32bcbd1ae8f77971077cbd93d882997bd5d462e387c513eac73b723d4bfb8712 SHA512 6ca7a8fe3ac636cce31c6ac0e85025c8ad4796fb1e280bcac7f07304b9e5c51bd134b3caf82a455c72a85312c56791112486b5466e496d44d4b7444a1ff1286b
+EBUILD bpftool-9999.ebuild 3945 BLAKE2B 6870891e5cfaf22dfddf5620f1b7b622bb7941934660d58c29925bef697784ba32bcbd1ae8f77971077cbd93d882997bd5d462e387c513eac73b723d4bfb8712 SHA512 6ca7a8fe3ac636cce31c6ac0e85025c8ad4796fb1e280bcac7f07304b9e5c51bd134b3caf82a455c72a85312c56791112486b5466e496d44d4b7444a1ff1286b
+MISC metadata.xml 856 BLAKE2B aa5413aa7645457d3d11552042225a3c4e6672c1dcb3dc24740228664b505ddf6deb37fc692fe1fe23d052a4222b92db4cc5d6930a2adbb036f3fc4f4143e74b SHA512 48418c805ae145ef025d5811342b503563121b8f44a97215a9f3f0eed7824bf54e5e5d1918a277826f60f23e74d6d07da70dd924a69cbd6c7f1505191c592010
diff --git a/dev-util/bpftool/bpftool-7.4.0.ebuild b/dev-util/bpftool/bpftool-7.4.0.ebuild
index b1481b3e2cbe..5cf187db53d8 100644
--- a/dev-util/bpftool/bpftool-7.4.0.ebuild
+++ b/dev-util/bpftool/bpftool-7.4.0.ebuild
@@ -7,7 +7,7 @@ LLVM_COMPAT=( {15..19} )
LLVM_OPTIONAL=1
PYTHON_COMPAT=( python3_{10..13} )
-inherit bash-completion-r1 linux-info llvm-r1 optfeature python-any-r1 toolchain-funcs
+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"
diff --git a/dev-util/bpftool/bpftool-7.5.0.ebuild b/dev-util/bpftool/bpftool-7.5.0.ebuild
new file mode 100644
index 000000000000..484a512181cf
--- /dev/null
+++ b/dev-util/bpftool/bpftool-7.5.0.ebuild
@@ -0,0 +1,137 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_COMPAT=( {15..19} )
+LLVM_OPTIONAL=1
+PYTHON_COMPAT=( python3_{10..13} )
+
+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 'sys-devel/llvm:${LLVM_SLOT}') )
+ !llvm? ( sys-libs/binutils-libs:= )
+ sys-libs/zlib:=
+ virtual/libelf:=
+"
+DEPEND="
+ ${RDEPEND}
+ >=sys-kernel/linux-headers-5.8
+"
+BDEPEND="
+ ${PYTHON_DEPS}
+ app-arch/tar
+ dev-python/docutils
+ clang? ( $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]') )
+ !clang? ( sys-devel/bpf-toolchain )
+"
+
+CONFIG_CHECK="~DEBUG_INFO_BTF"
+
+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 -i -e '/CFLAGS += -O2/d' -e 's/-W //g' -e 's/-Wextra //g' src/Makefile || die
+
+ if ! use clang; then
+ # 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-9999.ebuild b/dev-util/bpftool/bpftool-9999.ebuild
index 4c6ef01a02a4..484a512181cf 100644
--- a/dev-util/bpftool/bpftool-9999.ebuild
+++ b/dev-util/bpftool/bpftool-9999.ebuild
@@ -7,7 +7,7 @@ LLVM_COMPAT=( {15..19} )
LLVM_OPTIONAL=1
PYTHON_COMPAT=( python3_{10..13} )
-inherit bash-completion-r1 linux-info llvm-r1 optfeature python-any-r1 toolchain-funcs
+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"
@@ -41,7 +41,7 @@ fi
LICENSE="|| ( GPL-2 BSD-2 )"
SLOT="0"
-IUSE="caps llvm"
+IUSE="caps +clang llvm"
REQUIRED_USE="llvm? ( ${LLVM_REQUIRED_USE} )"
RDEPEND="
@@ -59,7 +59,8 @@ BDEPEND="
${PYTHON_DEPS}
app-arch/tar
dev-python/docutils
- $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]')
+ clang? ( $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}[llvm_targets_BPF]') )
+ !clang? ( sys-devel/bpf-toolchain )
"
CONFIG_CHECK="~DEBUG_INFO_BTF"
@@ -87,16 +88,33 @@ src_prepare() {
# remove hardcoded/unhelpful flags from bpftool
sed -i -e '/CFLAGS += -O2/d' -e 's/-W //g' -e 's/-Wextra //g' src/Makefile || die
+ if ! use clang; then
+ # 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)" \
- CLANG="$(get_llvm_prefix -b)/bin/clang" \
HOSTAR="$(tc-getBUILD_AR)" \
HOSTCC="$(tc-getBUILD_CC)" \
HOSTLD="$(tc-getBUILD_LD)" \
diff --git a/dev-util/bpftool/metadata.xml b/dev-util/bpftool/metadata.xml
index 1e8c354ad0e2..9f8d8d0dc0a8 100644
--- a/dev-util/bpftool/metadata.xml
+++ b/dev-util/bpftool/metadata.xml
@@ -11,6 +11,7 @@
</maintainer>
<use>
<flag name="caps">Use <pkg>sys-libs/libcap</pkg> to enable unprivileged run support</flag>
+ <flag name="clang">Use <pkg>sys-devel/clang</pkg> instead of <pkg>sys-devel/bpf-toolchain</pkg> for BPF CO-RE support</flag>
<flag name="llvm">Use <pkg>sys-devel/llvm</pkg> instead of libbfd (<pkg>sys-libs/binutils-libs</pkg>) for JIT disassembly</flag>
</use>
<upstream>