archrelease: copy trunk to community-any
[ArchLinux/community.git] / gron / trunk / PKGBUILD
blob990ff897be8c72564403a4b8127ebd34bb4b789a
1 # Maintainer: George Rawlinson <grawlinson@archlinux.org>
2 # Contributor: Stefan Tatschner <stefan@rumpelsepp.org>
4 pkgname=gron
5 pkgver=0.7.1
6 pkgrel=2
7 pkgdesc='Makes JSON greppable'
8 arch=('x86_64')
9 url='https://github.com/tomnomnom/gron'
10 license=('MIT')
11 depends=('glibc')
12 makedepends=('git' 'go')
13 options=('!lto')
14 _commit='badf401da553eb41b7ffde4be6a64809ed0ed846'
15 source=("$pkgname::git+https://github.com/tomnomnom/gron.git#commit=$_commit")
16 b2sums=('SKIP')
18 pkgver() {
19   cd "$pkgname"
21   git describe --tags | sed 's/^v//'
24 prepare() {
25   cd "$pkgname"
27   # create directory for build output
28   mkdir build
30   # download dependencies
31   go mod download
34 build() {
35   cd "$pkgname"
37   # set Go flags
38   export CGO_CPPFLAGS="${CPPFLAGS}"
39   export CGO_CFLAGS="${CFLAGS}"
40   export CGO_CXXFLAGS="${CXXFLAGS}"
42   go build -v \
43     -trimpath \
44     -buildmode=pie \
45     -mod=readonly \
46     -modcacherw \
47     -ldflags "-linkmode external -extldflags $LDFLAGS" \
48     -o build \
49     .
52 check() {
53   cd "$pkgname"
55   go test -v ./...
58 package() {
59   cd "$pkgname"
61   # binary
62   install -vDm755 -t "$pkgdir/usr/bin" build/gron
64   # shell completion
65   install -vDm644 -t "$pkgdir/usr/share/fish/vendor_completions.d" completions/gron.fish
67   # documentation
68   install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" {README,ADVANCED}.mkd
70   # license
71   install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE