aboutsummaryrefslogtreecommitdiffstats
path: root/community/onefetch/APKBUILD
blob: 2ca420e56c410639a6bbba9214585a1d4fd526a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=onefetch
pkgver=2.20.0
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="
f6639058dca7b1222b5e0f3695847b3d82642e2f4857cd7f656e4cbb80eb1688ffc0894a45f71eae8f919f9bb79d8717d68596cb639060266821b1bd89fed41a  onefetch-2.20.0.tar.gz
"