2025-01-01 19:41:28 +00:00

79 lines
1.9 KiB
Plaintext

# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=onefetch
pkgver=2.23.1
pkgrel=0
pkgdesc="Git repository summary on your terminal"
url="https://github.com/o2sh/onefetch"
# s390x: build failure
arch="all !s390x"
license="MIT"
makedepends="
cargo
cargo-auditable
zlib-dev
zlib-ng-dev
zstd-dev
"
checkdepends="bash"
subpackages="
$pkgname-doc
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
source="$pkgname-$pkgver.tar.gz::https://crates.io/api/v1/crates/onefetch/$pkgver/download"
options="net"
case "$CARCH" in
riscv64)
options="$options !check"
# didn't manage to disable the test with
# cargo test --frozen -- --skip test_repo
# maybe some other test is failing?
;;
esac
# Reduce binary size
export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"
prepare() {
default_prepare
# Rust target triple.
local target=$(rustc -vV | sed -n 's/host: //p')
# Build against system-provided libzstd.
mkdir -p .cargo
cat >> .cargo/config.toml <<-EOF
[target.$target]
z-ng = { rustc-link-lib = ["z-ng"], rustc-cfg = ["zng"] }
zstd = { rustc-link-lib = ["zstd"] }
EOF
cargo fetch --target="$CTARGET" --locked
}
build() {
cargo auditable build --frozen --release
for shellcomp in bash fish zsh; do
./target/release/onefetch --generate "$shellcomp" > onefetch."$shellcomp"
done
}
check() {
cargo test --frozen
}
package() {
install -Dm0755 target/release/onefetch "$pkgdir"/usr/bin/onefetch
install -Dm0644 docs/onefetch.1 "$pkgdir"/usr/share/man/man1/onefetch.1
install -Dm0644 onefetch.bash "$pkgdir"/usr/share/bash-completion/completions/onefetch
install -Dm0644 onefetch.fish "$pkgdir"/usr/share/fish/vendor_completions.d/onefetch.fish
install -Dm0644 onefetch.zsh "$pkgdir"/usr/share/zsh/site-functions/_onefetch
}
sha512sums="
7fbc3c4ea9f37cf0d0e07f020788232f3a75d1053f7c34e98e0f5c129d871e3d416ad82aea090f0627c47995919f3fbfb26f27263ae39c1db4f8dc7f3a8cf34a onefetch-2.23.1.tar.gz
"