summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Atkinson2021-08-29 11:08:45 -0700
committerBrian Atkinson2021-08-29 11:08:45 -0700
commitaef2aceba8882f92de2b1d28e2b0b081a4998410 (patch)
treeb214b691e67ef6e07102530c643e78294895d7b0
parent310d95a8955f3e5c27e1187ef05e4f47ecfeca13 (diff)
downloadaur-aef2aceba8882f92de2b1d28e2b0b081a4998410.tar.gz
Update to follow go packaging guidelines.
Following the documentation at https://wiki.archlinux.org/title/Go_package_guidelines this adds a number of CGO related environment variables as well as making the suggested change to have the mod cache remain read-write. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch master # Your branch is up to date with 'origin/master'. # # Changes to be committed: # modified: PKGBUILD #
-rw-r--r--PKGBUILD11
1 files changed, 8 insertions, 3 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 7dc3baac47ce..4c25f98393a8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -13,11 +13,16 @@ source=("$pkgname-$pkgver.tar.gz::https://github.com/open-policy-agent/opa/archi
sha256sums=('b2faf2b4bdf011569c27774167e8910d94dbb041f42456b5f1c5ce060958065b')
build() {
- cd $pkgname-$pkgver
+ cd "$pkgname-$pkgver"
+
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+ export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -modcacherw"
go build \
- --trimpath \
- --ldflags "-X github.com/open-policy-agent/opa/version.Version=$pkgver" \
+ -ldflags "-X github.com/open-policy-agent/opa/version.Version=$pkgver" \
-o opa \
.
}