summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorBen Morgan2020-08-31 21:38:07 +0200
committerBen Morgan2020-08-31 21:38:07 +0200
commitfb371a8ae3bdae8f909e1ec69f3615b6719a6d6d (patch)
treecf5002013d638d1a81a30ff408a57a7015047b6e /PKGBUILD
parentd1d0f0fe131dcea26dbe9c0f72949a5712ffecef (diff)
downloadaur-fb371a8ae3bdae8f909e1ec69f3615b6719a6d6d.tar.gz
Follow Go packaging guidelines
As described here: https://wiki.archlinux.org/index.php/Go_package_guidelines One deviation is that I use -mod=vendor instead of -mod=readonly, because -mod=readonly will cause the vendored dependencies to be ignored, which makes this less reproducable in the long run. It also speeds up compilation.
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD24
1 files changed, 19 insertions, 5 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 6c9d49cb607e..f8d4c13aac04 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
# vim: set ts=2 sw=2:
pkgname=repoctl
pkgver=0.21
-pkgrel=1
+pkgrel=2
pkgdesc="An AUR helper that also simplifies managing local Pacman repositories"
arch=('i686' 'x86_64' 'armv7h' 'aarch64')
url="https://github.com/cassava/repoctl"
@@ -14,10 +14,18 @@ source=(https://github.com/cassava/repoctl/releases/download/v${pkgver}/repoctl-
md5sums=('99e172a3734a0269435710adaf449f3e')
build() {
- cd "${srcdir}/${pkgname}-${pkgver}"
+ cd "${pkgname}-${pkgver}"
- # Build repoctl binary
- go build -o repoctl
+ # Respect system build options
+ export GOPATH="${srcdir}/gopath"
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+ export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=vendor -modcacherw"
+
+ # Build the binary
+ go build -v -o "${pkgname}"
# Generate the completion files
./repoctl completion zsh > completion.zsh
@@ -25,8 +33,13 @@ build() {
./repoctl completion fish > completion.fish
}
+check() {
+ cd "$pkgname-$pkgver"
+ go test ./...
+}
+
package() {
- cd "${srcdir}/${pkgname}-${pkgver}"
+ cd "${pkgname}-${pkgver}"
# Install repoctl program
install -Dm755 repoctl "${pkgdir}/usr/bin/repoctl"
@@ -41,3 +54,4 @@ package() {
install -Dm644 completion.bash "${pkgdir}/usr/share/bash-completion/completions/repoctl"
install -Dm644 completion.fish "${pkgdir}/usr/share/fish/vendor_completions.d/repoctl.fish"
}
+