aports/community/rust-analyzer/APKBUILD
2025-06-04 21:20:27 +00:00

58 lines
1.4 KiB
Text

# Contributor: S.M Mukarram Nainar <theone@sm2n.ca>
# Maintainer: team/rust <alpine@ptrcnull.me>
pkgname=rust-analyzer
pkgver=2025.06.02
_pkgver=${pkgver//./-}
pkgrel=0
pkgdesc="Rust compiler front-end for IDEs"
url="https://github.com/rust-lang/rust-analyzer"
arch="all"
license="MIT OR Apache-2.0"
depends="rust-src"
makedepends="cargo mimalloc2-dev cargo-auditable"
checkdepends="rustfmt"
source="https://github.com/rust-lang/rust-analyzer/archive/$_pkgver/rust-analyzer-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$_pkgver"
# requires rustup toolchain to run rustup rustfmt for sourcegen
options="net !check"
# crashes otherwise
export CARGO_PROFILE_RELEASE_PANIC="unwind"
prepare() {
default_prepare
# rust target triple.
local target=$(rustc -vV | sed -n 's/host: //p')
# build against system-provided mimalloc.
# newline because file doesn't end in newline..
cat >> .cargo/config.toml <<-EOF
[target.$target]
mimalloc = { rustc-link-lib = ["mimalloc"] }
EOF
cargo fetch --target="$CTARGET" --locked
}
build() {
CFG_RELEASE="$pkgver" \
cargo auditable build \
--frozen \
--release \
--features="mimalloc"
}
check() {
cargo test --frozen
}
package() {
install -Dm755 target/release/rust-analyzer -t "$pkgdir"/usr/bin/
}
sha512sums="
149c52a12e920ec2ef218f93ae247182129048b855f6da11132c4c243886dbe9ad2fe3c7c9f90ae0d8c60a535b7603894597e95b1d784db72cdcc79a3707e45f rust-analyzer-2025.06.02.tar.gz
"