summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlice Gaudon2020-08-06 13:58:14 +0200
committerAlice Gaudon2020-08-06 13:58:14 +0200
commitee6b5099646ac0d33d599e7c8837d035f40ff3ff (patch)
tree8007e1df42867a697a4805428f965e1425c0b159
parent7ddb703422a91469272a08d6e463c93bb4fad993 (diff)
downloadaur-ee6b5099646ac0d33d599e7c8837d035f40ff3ff.tar.gz
Use go build flags for go commands
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD20
2 files changed, 12 insertions, 10 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d9c02d673d5d..d1668dc7bc26 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = caddy2
pkgdesc = Fast web server with automatic HTTPS
pkgver = 2.1.1
- pkgrel = 5
+ pkgrel = 6
url = https://caddyserver.com
arch = x86_64
license = Apache
diff --git a/PKGBUILD b/PKGBUILD
index 598c87ee61f9..eea85abdcd04 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,7 +7,7 @@ _pkgname=caddy
pkgver=2.1.1
_tag=v2.1.1
_distcommit='a509155e3cff18af793f6af5f930a71c89e05df8'
-pkgrel=5
+pkgrel=6
pkgdesc="Fast web server with automatic HTTPS"
arch=('x86_64')
url="https://caddyserver.com"
@@ -40,14 +40,6 @@ validpgpkeys=(
prepare() {
sed 's|/var/www/html|/srv/http|g' -i "${srcdir}/index-${_distcommit}.html"
-
- # Build instructions as per https://github.com/caddyserver/caddy#with-version-information-andor-plugins
- cd "${_pkgname}/cmd/caddy/"
- if ! test -f go.mod; then
- go mod init caddy
- fi
- go get github.com/caddyserver/caddy/v2@${_tag} # Pin version
- go mod tidy # Update go.sum
}
build() {
@@ -57,6 +49,16 @@ build() {
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
+ export GOFLAGS="-buildmode=pie -trimpath -modcacherw"
+
+ # Build instructions as per https://github.com/caddyserver/caddy#with-version-information-andor-plugins
+ if ! test -f go.mod; then
+ go mod init caddy
+ fi
+ go get github.com/caddyserver/caddy/v2@${_tag} # Pin version
+ go mod tidy # Update go.sum
+
+ # Add -mod=readonly
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
go build .
}