aboutsummaryrefslogtreecommitdiffstats
path: root/community/uutils-coreutils/APKBUILD
blob: 47261a48e84ac13169545405c484aee371ec57c4 (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
# Maintainer: omni <omni+alpine@hack.org>
pkgname=uutils-coreutils
_pkgname=coreutils
pkgver=0.0.23
pkgrel=0
pkgdesc="coreutils rewritten in Rust"
# s390x: some endianness failure
# riscv64: rust broken
arch="all !s390x !riscv64"
url="https://github.com/uutils/coreutils"
license="MIT"
makedepends="cargo help2man oniguruma-dev cargo-auditable"
checkdepends="coreutils" # test_ls.rs incompatible with busybox truncate
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/uutils/coreutils/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check" # package builder file descriptor issues

export RUSTONIG_DYNAMIC_LIBONIG=1

case "$CARCH" in
armhf)
	# various failures
	options="$options !check"
	;;
esac


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen \
		--profile=release-small --features=feat_os_unix_musl

	mkdir bin
	cp target/release-small/"$_pkgname" bin/uutils

	mkdir man1
	help2man --no-info --name=uutils --manual=uutils \
		--version-string="$pkgver" bin/uutils > man1/uutils.1

	# create symlinks and individual man pages
	for uutil in $(./bin/uutils | tail -n +7 | tr -d '\n' | sed -e 's/,//g' -e 's/sha3-\s*512sum/sha3-512sum/'); do
		ln -s uutils bin/uutils-$uutil
		case "$uutil" in
			test) ;; # helpless
			\[) help2man --no-info --name=uutils-test --manual=uutils \
				bin/uutils-"$uutil" > man1/uutils-test.1 ;;
			*) help2man --no-info --name=uutils-"$uutil" --manual=uutils \
				bin/uutils-"$uutil" > man1/uutils-"$uutil".1 ;;
		esac
	done
}

check() {
	ulimit -n 4096 # running out of file descriptors

	cargo test --frozen \
		--profile=release-small --fetures=feat_os_unix_musl
}

package() {
	mkdir -p "$pkgdir"/usr
	mv bin "$pkgdir"/usr

	mkdir -p "$pkgdir"/usr/share/man
	mv man1 "$pkgdir"/usr/share/man
	install -Dm0644 LICENSE -t "$pkgdir"/usr/share/licenses/"$pkgname"
}

sha512sums="
79458ebff1e01668103c300947d487d77e73239983d071ea3a75f7d371b253e0c3048bd4ff117bfa2250b1ddce34fe4770c336ad237420a9ba1e8dd4cc368a56  uutils-coreutils-0.0.23.tar.gz
"