diff options
author | Ben Morgan | 2020-08-31 21:38:07 +0200 |
---|---|---|
committer | Ben Morgan | 2020-08-31 21:38:07 +0200 |
commit | fb371a8ae3bdae8f909e1ec69f3615b6719a6d6d (patch) | |
tree | cf5002013d638d1a81a30ff408a57a7015047b6e | |
parent | d1d0f0fe131dcea26dbe9c0f72949a5712ffecef (diff) | |
download | aur-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.
-rwxr-xr-x | .SRCINFO | 2 | ||||
-rw-r--r-- | PKGBUILD | 24 |
2 files changed, 20 insertions, 6 deletions
@@ -1,7 +1,7 @@ pkgbase = repoctl pkgdesc = An AUR helper that also simplifies managing local Pacman repositories pkgver = 0.21 - pkgrel = 1 + pkgrel = 2 url = https://github.com/cassava/repoctl arch = i686 arch = x86_64 @@ -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" } + |