blob: f85bc0e141088690520439861a0f1deddbb3a619 (
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
|
# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=opa
pkgver=0.58.0
pkgrel=0
pkgdesc="Open source, general-purpose policy engine"
url="https://www.openpolicyagent.org/"
# only platforms with full +wasm support, as upstream does
arch="aarch64 x86_64"
license="Apache-2.0"
makedepends="go wasmtime-dev"
checkdepends="tzdata"
subpackages="
$pkgname-doc
$pkgname-bash-completion
$pkgname-fish-completion
$pkgname-zsh-completion
"
source="
$pkgname-$pkgver.tar.gz::https://github.com/open-policy-agent/opa/archive/refs/tags/v$pkgver.tar.gz
"
export CGO_ENABLED=1
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
build() {
# report.ExternalServiceURL is left blank to disable telemetry
# - "opa version -c" errors out
# - "opa run" fails the version check process silently in the background
# this is intended :)
local goldflags="
-X github.com/open-policy-agent/opa/version.Version=$pkgver
-X github.com/open-policy-agent/opa/version.Hostname=AlpineLinux
-X github.com/open-policy-agent/opa/version.Vcs=0000000000000000000000000000000000000000
-X github.com/open-policy-agent/opa/version.Timestamp=$(date -u "+%Y-%m-%dT%H:%M:%SZ" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
-X github.com/open-policy-agent/opa/internal/report.ExternalServiceURL=
"
export CGO_CFLAGS="$CFLAGS"
export CGO_LDFLAGS="$LDFLAGS -L/usr/lib -lwasmtime"
go build -v -ldflags "$goldflags" -tags opa_wasm
mkdir -p man/
go run build/generate-man/generate.go man/
for shell in bash fish zsh; do
./opa completion $shell > opa.$shell
done
}
check() {
# tests are not ran with opa_wasm tag so tests that use wasm engine fail
go test -skip TestRegoTargetWasmAndTargetPluginDisablesIndexingTopdownStages ./...
}
package() {
install -Dm755 opa -t "$pkgdir"/usr/bin/
install -Dm644 man/*.1 -t "$pkgdir"/usr/share/man/man1/
install -Dm644 opa.bash \
"$pkgdir"/usr/share/bash-completion/completions/opa
install -Dm644 opa.fish \
"$pkgdir"/usr/share/fish/vendor_completions.d/opa.fish
install -Dm644 opa.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_opa
}
sha512sums="
eca889d76a26955015d6a1e5a6dd93c7db38ce82b3421a4391a16357b1738ee306ec3462aa3fda811f55fffcc47c237e5f8015440a76def3c4676b3a022a3e35 opa-0.58.0.tar.gz
"
|