summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wagie2022-02-19 11:11:26 -0700
committerMark Wagie2022-02-19 11:11:26 -0700
commit733e4b06307f0f9c1013bd17de59fb60a2723ceb (patch)
treee4e2eb7a299ab187e8ef9054c9ffa1e27644a32f
parent61b71deda8df1858e6b413da0612e632b35bf6ef (diff)
downloadaur-733e4b06307f0f9c1013bd17de59fb60a2723ceb.tar.gz
use build folder, download deps in prepare() for offline building
-rw-r--r--.SRCINFO3
-rw-r--r--PKGBUILD21
2 files changed, 11 insertions, 13 deletions
diff --git a/.SRCINFO b/.SRCINFO
index efefd75dc2fe..70277459854e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,12 +1,11 @@
pkgbase = cod
pkgdesc = A completion daemon for bash/zsh
pkgver = 0.1.0
- pkgrel = 2
+ pkgrel = 3
url = https://github.com/dim-an/cod
arch = any
license = Apache
makedepends = go
- optdepends = bash-completion
source = cod-0.1.0.tar.gz::https://github.com/dim-an/cod/archive/v0.1.0.tar.gz
sha256sums = 3d8ed6f284afcf4c86a2164e234ab7ff40c50aa6ab0bd892e59f8dc8aef02541
diff --git a/PKGBUILD b/PKGBUILD
index e10bf4b60a75..1d6e982bc77f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,22 +1,24 @@
# Maintainer: Mark Wagie <mark dot wagie at tutanota dot com>
pkgname=cod
pkgver=0.1.0
-pkgrel=2
+pkgrel=3
pkgdesc="A completion daemon for bash/zsh"
arch=('any')
url="https://github.com/dim-an/cod"
license=('Apache')
makedepends=('go')
-optdepends=('bash-completion')
source=("$pkgname-$pkgver.tar.gz::https://github.com/dim-an/cod/archive/v$pkgver.tar.gz")
sha256sums=('3d8ed6f284afcf4c86a2164e234ab7ff40c50aa6ab0bd892e59f8dc8aef02541')
prepare() {
- # Prevent creation of a `go` directory in one's home.
- # Sometimes this directory cannot be removed with even `rm -rf` unless
- # one becomes root or changes the write permissions.
+ cd "$pkgname-$pkgver"
export GOPATH="$srcdir/gopath"
- go clean -modcache
+
+ # create directory for build output
+ mkdir -p build
+
+ # download dependencies
+ go mod download -x
}
build() {
@@ -27,13 +29,10 @@ build() {
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
- go build -v -o "${pkgname%-git}" .
-
- # Clean now to ensure makepkg --clean works
- go clean -modcache
+ go build -v -o build .
}
package() {
cd "$pkgname-$pkgver"
- install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
+ install -Dm755 "build/$pkgname" "$pkgdir/usr/bin/$pkgname"
}