aports/community/starship/APKBUILD

96 lines
2.9 KiB
Plaintext

# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=starship
pkgver=1.19.0
pkgrel=0
pkgdesc="Minimal, blazing-fast and infinitely customizable prompt for any shell"
url="https://starship.rs"
# s390x: fails to build nix crate
arch="all !s390x"
license="ISC"
makedepends="
cargo
cargo-auditable
dbus-dev
openssl-dev>3
zlib-ng-dev
"
subpackages="
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
$pkgname-zsh-plugin:_zsh_plugin:noarch
"
source="https://github.com/starship/starship/archive/v$pkgver/starship-$pkgver.tar.gz
use-libdbus.patch
starship.plugin.zsh
bump-libc.patch
bump-time.patch
"
options="net" # fetching dependencies
# test process exits with SIGTRAP on the riscv64 CI
[ "$CARCH" = "riscv64" ] && options="$options !check"
prepare() {
cargo fetch --target="$CTARGET" --locked
default_prepare
# Rust target triple.
local target=$(rustc -vV | sed -n 's/host: //p')
# Build against system-provided libz-ng.
mkdir -p .cargo
cat >> .cargo/config.toml <<-EOF
[target.$target]
z-ng = { rustc-link-lib = ["z-ng"], rustc-cfg = ["zng"] }
EOF
# Update after patching Cargo.toml.
cargo fetch --target="$CTARGET"
}
build() {
cargo auditable build --frozen --release
local i; for i in bash fish zsh; do
./target/release/starship completions $i > target/starship.$i
done
}
check() {
# tests fail with this
unset GIT_CEILING_DIRECTORIES
# Some tests sporadically fail, try to repeat 3 times before failing.
local i; for i in $(seq 0 3); do
[ $i -eq 0 ] || msg "Retrying ($i/3)..."
cargo test --frozen && return 0
sleep 1
done
return 1
}
package() {
install -D -m755 target/release/starship -t "$pkgdir"/usr/bin/
install -D -m644 target/starship.bash "$pkgdir"/usr/share/bash-completion/completions/starship
install -D -m644 target/starship.fish "$pkgdir"/usr/share/fish/vendor_completions.d/starship.fish
install -D -m644 target/starship.zsh "$pkgdir"/usr/share/zsh/site-functions/_starship
}
_zsh_plugin() {
pkgdesc="$pkgdesc (Zsh plugin)"
depends="$pkgname=$pkgver-r$pkgrel"
install -D -m644 "$srcdir"/starship.plugin.zsh \
-t "$subpkgdir"/usr/share/zsh/plugins/starship/
}
sha512sums="
12347b7db82425ea6656eaccb2c1e9f3c62416b1c4d1c2937cdea2aae724dfc1d6a5a93319178c9844d3f1cc2d6ae15d3e34adbe3ead7df695df87efe5d1b827 starship-1.19.0.tar.gz
bf959be577037f9b68925ed3e1640edc87ccbf9a487a61d667d05baab8e726e8337e1d816a0ff40cb8cc4ab2593db9f363147554d1e79aace839ed7eec4b632a use-libdbus.patch
384a3b84b103005d347ef76c9a61f8c5e21cc97f17f195cff157f71f42dbd76fd6f54f93715cbebbee2eab70a275e39917334721fa21d130bd715a7b6334418b starship.plugin.zsh
715bb5e811e4aaa2c0289d1cbcef10d54ddd7767810b8f5fcd90380e370b0ef7d845cfbcdb2f42e95769eba81e449d07e4fc180973f28fd0d22da3ff1e868f85 bump-libc.patch
d3670a2b1a2a7d8e08e106f99cbb1b92244e5dac05492fd2a85d9182ed271d2d425d4f5b96703d38bda4c37b7da6a1934a1f866caac0bf238cdc76cfb4b629d5 bump-time.patch
"