archrelease: copy trunk to community-any
[ArchLinux/community.git] / chezmoi / trunk / PKGBUILD
blob7d03814c6b879a746ce25222c328d5fe2d8169ee
1 # Maintainer: Daurnimator <daurnimator@archlinux.org>
2 # Maintainer: Caleb Maclennan <caleb@alerque.com>
3 # Contributor: Tom Payne <twpayne@gmail.com>
4 # Contributor:  <godeater@gmail.com>
6 pkgname=chezmoi
7 pkgver=2.33.6
8 pkgrel=1
9 pkgdesc="Manage your dotfiles across multiple machines"
10 arch=('x86_64')
11 url='https://www.chezmoi.io/'
12 license=('MIT')
13 makedepends=('go' 'git')
14 depends=('glibc')
15 checkdepends=('zip')
16 options=('!lto')
17 source=("${pkgname}-${pkgver}.tar.gz::https://github.com/twpayne/chezmoi/archive/v${pkgver}.tar.gz")
18 sha512sums=('97a6a76d8e42a44f72dc1954dcec3446148f2433b87cde3d09cb6e02af45beda59a4f1fc21aa2d5c2d5952bae345a77432953072e1b0117b0266dc5fc3e973dc')
20 prepare() {
21   cd "$pkgname-$pkgver"
23   go mod download
26 build() {
27   cd "$pkgname-$pkgver"
29   export CGO_LDFLAGS="${LDFLAGS}"
30   export CGO_CFLAGS="${CFLAGS}"
31   export CGO_CPPFLAGS="${CPPFLAGS}"
32   export CGO_CXXFLAGS="${CXXFLAGS}"
33   export GOPROXY=off
34   go build \
35     -buildmode=pie \
36     -mod=readonly \
37     -tags noupgrade \
38     -ldflags "-compressdwarf=false \
39               -X github.com/twpayne/chezmoi/cmd.DocsDir=/usr/share/doc/$pkgname \
40               -X main.version=$pkgver \
41               -X main.date=$(date -u +'%Y-%m-%dT%H:%M:%SZ' --date=@${SOURCE_DATE_EPOCH}) \
42               -extldflags ${LDFLAGS}" \
43     .
46 check() {
47   cd "$pkgname-$pkgver"
49   go test -v ./...
52 package() {
53   cd "$pkgname-$pkgver"
55   install -D "$pkgname" "$pkgdir/usr/bin/$pkgname"
57   install -Dm644 completions/chezmoi-completion.bash "$pkgdir/usr/share/bash-completion/completions/chezmoi"
58   install -Dm644 completions/chezmoi.fish "$pkgdir/usr/share/fish/vendor_completions.d/chezmoi.fish"
59   install -Dm644 completions/chezmoi.zsh "$pkgdir/usr/share/zsh/site-functions/_chezmoi"
61   install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"