commit: f2544722d27673135af5921683414484a6598b5d Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sun Oct 12 13:53:23 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sun Oct 12 14:14:05 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2544722
dev-util/bpf-linker: Support rust_sysroots_bpf Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> dev-util/bpf-linker/bpf-linker-0.9.15-r1.ebuild | 77 +++++++++++++++++++++++++ profiles/package.mask | 5 ++ 2 files changed, 82 insertions(+) diff --git a/dev-util/bpf-linker/bpf-linker-0.9.15-r1.ebuild b/dev-util/bpf-linker/bpf-linker-0.9.15-r1.ebuild new file mode 100644 index 000000000000..90672bce8be2 --- /dev/null +++ b/dev-util/bpf-linker/bpf-linker-0.9.15-r1.ebuild @@ -0,0 +1,77 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +RUST_MIN_VER=1.90.0 +CRATES=" +" + +declare -A GIT_CRATES=( + [compiletest_rs]='https://github.com/Manishearth/compiletest-rs;0c1418d5cd5177ee9d863a5c2f300c0973cfc4f1;compiletest-rs-%commit%' +) + +# LLVM 19 fails on assertions +LLVM_COMPAT=( {20..21} ) +RUST_REQ_USE="llvm_targets_BPF(+),rust_sysroots_bpf(-)" + +inherit cargo llvm-r2 + +DESCRIPTION="Simple BPF static linker" +HOMEPAGE="https://github.com/aya-rs/bpf-linker/" +SRC_URI=" + https://github.com/aya-rs/bpf-linker/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz + https://github.com/gentoo-crate-dist/bpf-linker/releases/download/v${PV}/${P}-crates.tar.xz + ${CARGO_CRATE_URIS} +" + +LICENSE="|| ( MIT Apache-2.0 )" +# Dependent crate licenses +LICENSE+=" + ISC MIT Unicode-3.0 Unicode-DFS-2016 + || ( Apache-2.0 Boost-1.0 ) +" +SLOT="0" +IUSE="test" +RESTRICT="!test? ( test )" + +DEPEND=" + $(llvm_gen_dep ' + llvm-core/llvm:${LLVM_SLOT}=[llvm_targets_BPF] + ') +" +RDEPEND=" + ${DEPEND} + ${RUST_DEPEND} +" +BDEPEND=" + test? ( + dev-util/btfdump + ) +" + +QA_FLAGS_IGNORED=/usr/bin/bpf-linker + +pkg_setup() { + rust_pkg_setup +} + +src_prepare() { + default + + # replace upstream crate substitution with our crate substitution, sigh + local ct_dep=$(grep ^compiletest_rs "${ECARGO_HOME}"/config.toml || die) + sed -i -e "/compiletest_rs/s;^.*$;${ct_dep};" Cargo.toml || die +} + +src_configure() { + local myfeatures=( + "llvm-${LLVM_SLOT}" + ) + cargo_src_configure --no-default-features + + export "LLVM_SYS_${LLVM_SLOT}1_PREFIX"="$(get_llvm_prefix -d)" + # the package requires BPF target that is only available in nightly + export RUSTC_BOOTSTRAP=1 +} diff --git a/profiles/package.mask b/profiles/package.mask index 0692eb17e584..3a061ae139d8 100644 --- a/profiles/package.mask +++ b/profiles/package.mask @@ -36,6 +36,11 @@ #--- END OF EXAMPLES --- +# Michał Górny <[email protected]> (2025-10-12) +# Requires Rust with RUST_SYSROOTS=bpf, which isn't currently supported +# by dev-lang/rust-bin. Also needs net-proxy/mitmproxy-linux updates. +>=dev-util/bpf-linker-0.9.15-r1 + # Andreas Sturmlechner <[email protected]> (2025-10-11) # Stuck forever in 5.x because in 6.x it was rewritten around proprietary # aqlprofile. A potential future 7.x package would require packaging from
