aboutsummaryrefslogtreecommitdiffstats
path: root/testing/sd/APKBUILD
blob: 93f8cd323f1717dc9dbfb2954d42df1ce8a0b687 (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
# Contributor: Chloe Kudryavtsev <toast@toastin.space>
# Maintainer: Chloe Kudryavtsev <toast@toastin.space>
pkgname=sd
pkgver=0.6.5
pkgrel=0
pkgdesc="An intuitive find & replace CLI"
url="https://github.com/chmln/sd"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le" # limited by rust/cargo
license="MIT"
options="net"
makedepends="cargo"
source="$pkgname-$pkgver.tar.gz::https://github.com/chmln/sd/archive/$pkgver.tar.gz"
subpackages="$pkgname-doc
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch"

export CARGO_HOME="$srcdir"/cargo

build() {
	cargo build \
		--release \
		--verbose
}

check() {
	cargo test --all \
		--release \
		--verbose
}

package() {
	install -Dm755 target/release/"$pkgname" "$pkgdir"/usr/bin/"$pkgname"

	# doc
	find target/release -name "$pkgname.1" \
		-exec install -Dm644 {} "$pkgdir"/usr/share/man/man1/"$pkgname.1" \;

	# comp
	find target/release -name "$pkgname.bash" \
		-exec install -Dm644 {} "$pkgdir"/usr/share/bash-completion/completions/"$pkgname" \;
	find target/release -name "$pkgname.fish" \
		-exec install -Dm644 {} "$pkgdir"/usr/share/fish/completions/"$pkgname.fish" \;
	find target/release -name "_$pkgname" \
		-exec install -Dm644 {} "$pkgdir"/usr/share/zsh/site-functions/"_$pkgname" \;
}

bashcomp() {
	depends=""
	pkgdesk="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/share/bash-completion "$subpkgdir"/usr/share/
}

fishcomp() {
	depends=""
	pkgdesc="Fish completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	mkdir -p "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/share/fish "$subpkgdir"/usr/share/
}

zshcomp() {
	depends=""
	pkgdesc="Zsh completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	mkdir -p "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/share/zsh "$subpkgdir"/usr/share
}

sha512sums="7b4b91e274c4fec5405fc551046fd0db1879f6b6c77ced56d81c83a853e9c10942f80faf2a7aca549b86ed4b57117e8796ef7900d613a809bf34840f218759ac  sd-0.6.5.tar.gz"