diff options
author | Elias Werberich | 2022-07-29 18:47:09 +0200 |
---|---|---|
committer | Elias Werberich | 2022-07-29 18:53:05 +0200 |
commit | fa4f8a270a81e3748c26ae2c26d88e081af9100a (patch) | |
tree | 55a618440fcef0050dfd5dfc6a99cf38617a90c8 | |
parent | 1986082e8a9b863ce8147b66602e59a2a612f8f9 (diff) | |
download | aur-fa4f8a270a81e3748c26ae2c26d88e081af9100a.tar.gz |
Refactor PKGBUILD to match go package guidelines
Uses Arch Linux go package guidelines, adds git as make
dependency and runs provided tests on package build.
-rw-r--r-- | .SRCINFO | 3 | ||||
-rw-r--r-- | PKGBUILD | 42 |
2 files changed, 25 insertions, 20 deletions
@@ -1,12 +1,13 @@ pkgbase = changie pkgdesc = Automated changelog tool for preparing releases with lots of customization options. pkgver = 1.8.0 - pkgrel = 1 + pkgrel = 2 epoch = 0 url = https://github.com/miniscruff/changie arch = x86_64 license = MIT makedepends = go + makedepends = git source = git+https://github.com/miniscruff/changie#tag=v1.8.0 sha256sums = SKIP @@ -2,21 +2,21 @@ pkgname=changie pkgver=1.8.0 -pkgrel=1 +pkgrel=2 epoch=0 pkgdesc="Automated changelog tool for preparing releases with lots of customization options." arch=('x86_64') -url="https://github.com/miniscruff/changie" +url="https://github.com/miniscruff/$pkgname" license=('MIT') depends=() -makedepends=('go') +makedepends=('go' 'git') conflicts=() -source=("git+https://github.com/miniscruff/changie#tag=v$pkgver") +source=("git+https://github.com/miniscruff/$pkgname#tag=v$pkgver") sha256sums=('SKIP') prepare() { - mkdir -p "src/github.com/miniscruff" - mv "changie" "src/github.com/miniscruff/changie" + cd "$pkgname" + mkdir -p "build/" case $CARCH in "x86_64") _GOARCH="amd64" @@ -29,21 +29,25 @@ prepare() { } build() { - cd "$srcdir/src/github.com/miniscruff/changie" - GOOS=linux \ - GOARCH=${_GOARCH} \ - GOARM=${_GOARM} \ - CGO_ENABLED=0 \ - GOPATH="$srcdir" \ - go build \ + cd "$pkgname" + export CGO_CPPFLAGS="${CPPFLAGS}" + export CGO_CFLAGS="${CFLAGS}" + export CGO_CXXFLAGS="${CXXFLAGS}" + export CGO_LDFLAGS="${LDFLAGS}" + go build -o build \ + -buildmode=pie \ + -trimpath -ldflags="-linkmode=external -X main.version=$pkgver" \ + -mod=readonly \ -modcacherw \ - -o "$srcdir/changie" \ - -gcflags "all=-trimpath=$srcdir" \ - -asmflags "all=-trimpath=$srcdir" \ - -ldflags "-extldflags ${LDFLAGS} -X main.version=$pkgver" \ - "github.com/miniscruff/changie" + . +} + +check() { + cd "$pkgname" + go test ./... } package() { - install -Dm0755 "$srcdir/changie" "$pkgdir/usr/bin/changie" + cd "$pkgname" + install -Dm0755 "build/$pkgname" "$pkgdir/usr/bin/$pkgname" } |