From 2383667ea714d540f89fe9a1ffed5e394aa204ff Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sun, 4 Aug 2019 12:39:28 +0200 Subject: [PATCH] Enable go modules support for build Signed-off-by: Knut Ahlers --- PKGBUILD | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 3be5bd1..d6f0d32 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -12,12 +12,20 @@ source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz") sha512sums=('21c9225ecd829f91f57bba2121f347bd287c37b78d8927b86b9d1b8aef41841d846ba3dee0d254b4994237e085b33e69c9060ca1dbb731c816840ed7a5fbe18d') build() { - mkdir -p "${srcdir}/go/src/github.com/Luzifer" - ln -sf "${srcdir}/${pkgname}-${pkgver}" "${srcdir}/go/src/github.com/Luzifer/${pkgname}" - GOPATH="${srcdir}/go" go install -a -v -ldflags="-X main.version=${pkgver}" "github.com/Luzifer/${pkgname}" + export GO111MODULE=on + export GOPATH="${srcdir}/go" + + cd "${srcdir}/${pkgname}-${pkgver}" + + go build -a -v \ + -ldflags="-X main.version=${pkgver}" \ + -mod=readonly \ + -o "${srcdir}/${pkgname}" + + go clean -modcache } package() { - install -Dm755 "${srcdir}/go/bin/${pkgname}" "${pkgdir}/usr/bin/${pkgname}" + install -Dm755 "${srcdir}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}" install -Dm644 "${srcdir}/${pkgname}-${pkgver}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}" }