aboutsummaryrefslogtreecommitdiffstats
path: root/community/chezmoi/APKBUILD
blob: 214ca6623c35650b794b38eefcba1cbb29eda24e (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
79
# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=chezmoi
pkgver=1.8.1
pkgrel=0
pkgdesc="Manage your dotfiles across multiple machines, securely."
url="https://www.chezmoi.io/"
arch="all"
license="MIT"
makedepends="go"
options="!check chmod-clean" # no test suite
subpackages="
	$pkgname-doc
	$pkgname-bash-completion:bashcomp:noarch
	$pkgname-zsh-completion:zshcomp:noarch
	$pkgname-fish-completion:fishcomp:noarch
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/twpayne/chezmoi/archive/v$pkgver.tar.gz"

export GOPATH="$srcdir"

build() {
	go build \
		-ldflags "
		-X \"main.version=$pkgver\" \
		-X \"main.date=$(date --utc +%Y-%M-%dT%H:%I:%SZ)\" \
		-X \"github.com/twpayne/chezmoi/cmd.DocsDir=/usr/share/doc/chezmoi/\"
		" \
		-tags noupgrade \
		-tags noembeddocs
	make completions
}

package() {
	install -Dm0755 chezmoi "$pkgdir"/usr/bin/chezmoi
}

doc() {
	default_doc
	mkdir -p "$subpkgdir/usr/share/doc/chezmoi"
	cp "$builddir/docs/"* "$subpkgdir/usr/share/doc/chezmoi"
}

bashcomp() {
	pkgdesc="additional scripts for bash like shell completion"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	cd "$builddir"
	install -Dm0644 completions/chezmoi-completion.bash \
		"$subpkgdir"/usr/share/bash-completion/completions/$pkgname
}

zshcomp() {
	pkgdesc="additional scripts for zsh like shell completion"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel zsh"

	cd "$builddir"
	install -Dm0644 completions/chezmoi.zsh \
		"$subpkgdir"/usr/share/zsh/site-functions/_$pkgname
}

fishcomp() {
	pkgdesc="additional scripts for fish like shell completion"
	depends=""
	install_if="$pkgname=$pkgver-r$pkgrel fish"

	cd "$builddir"
	install -Dm0644 completions/chezmoi.fish \
		"$subpkgdir"/usr/share/fish/site-functions/_$pkgname
}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}

sha512sums="9893c51b75c5aa792595f7edc116670248c3c9c411bb3762577dc5fab1bf67edd9b179119b59fb0dfbd13a8b9c210bd3802facb93b3791f9d17f78d056f91c16  chezmoi-1.8.1.tar.gz"