75 lines
1.9 KiB
Plaintext

# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=onefetch
pkgver=2.18.1
pkgrel=2
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
libgit2-dev
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"
# 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]
git2 = { rustc-link-lib = ["git2"] }
z-ng = { rustc-link-lib = ["z-ng"], rustc-cfg = ["zng"] }
zstd = { rustc-link-lib = ["zstd"] }
EOF
# open64
cargo update -p getrandom --precise 0.2.10
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="
8febc2b7ae0e78857acc6b18fee8768c3569f3f7eaf791669e0c86907be7acb2114b4a5ded13dee9e3388e09b78ae5f5b51ca64a42406e1ffe8f47a113d27902 onefetch-2.18.1.tar.gz
"