blob: 6d920a62e4e067fcd059cc0de0b609b4481ff25b (
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
|
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Terin Stock <terinjokes@gmail.com>
pkgname=gojq
pkgver=0.12.17
pkgrel=1
pkgdesc='Pure go implementation of jq'
url="https://github.com/itchyny/$pkgname"
arch=(x86_64)
license=(MIT)
makedepends=(go
git)
depends=(glibc)
_archive="$pkgname-$pkgver"
source=("$url/archive/v$pkgver/$_archive.tar.gz")
sha256sums=('86b8393d04cb40db09a8de96199f358c1e49bbd7d1ace5c95496cc7cc4102b3b')
prepare(){
cd "$_archive"
mkdir -p build/
}
build() {
local _commit=$(zcat ${source[0]##*/} | git get-tar-commit-id)
cd "$_archive"
export CGO_LDFLAGS="$LDFLAGS"
export CGO_CFLAGS="$CFLAGS"
export CGO_CPPFLAGS="$CPPFLAGS"
export CGO_CXXFLAGS="$CXXFLAGS"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
go build -o build \
-ldflags="-X ${url#*//}/cli.revision=${_commit:0:7}" \
"./cmd/$pkgname"
}
check() {
cd "$_archive"
go test ./...
}
package() {
cd "$_archive"
install -Dm0755 -t "$pkgdir/usr/bin/" "build/$pkgname"
install -Dm0755 -t "$pkgdir/usr/share/zsh/site-functions/" _gojq
install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
|