diff options
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 59 |
1 files changed, 44 insertions, 15 deletions
@@ -1,33 +1,62 @@ # Maintainer: George Rawlinson <george@rawlinson.net.nz> pkgname=license-detector -_pkgname="go-$pkgname" -pkgver=4.0.0 +pkgver=4.3.0 pkgrel=1 -pkgdesc="Reliable project licenses detector" +pkgdesc='Reliable project licenses detector' arch=('x86_64') -url="https://github.com/go-enry/go-license-detector" +url='https://github.com/go-enry/go-license-detector' license=('Apache') -makedepends=('go') -source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz") -sha512sums=('bfa05f73958a45efb5760a3a3e74ee46030c3f2bac232b67a6d3b046a3c0840e89880b5b26c4dc0e97985617630745f4a76192dc1bfb527f65419a2eebe0fe25') +depends=('glibc') +makedepends=('git' 'go') +options=('!lto') +_commit='4f2ca6af2ab943d9b5fa3a02782eebc06f79a5f4' +source=("$pkgname::git+$url#commit=$_commit") +b2sums=('SKIP') + +pkgver() { + cd "$pkgname" + + git describe --tags | sed 's/^v//' +} prepare() { - cd "$_pkgname-$pkgver" - go mod vendor - mkdir -p build + cd "$pkgname" + + # create directory for build output + mkdir build + + # download dependencies + go mod download } build() { - cd "$_pkgname-$pkgver" + cd "$pkgname" + + # set Go flags export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" - export CGO_LDFLAGS="${LDFLAGS}" - export GOFLAGS="-buildmode=pie -trimpath -mod=vendor -modcacherw" - go build -o build ./cmd/... + + go build -v \ + -trimpath \ + -buildmode=pie \ + -mod=readonly \ + -modcacherw \ + -ldflags "-linkmode external -extldflags ${LDFLAGS}" \ + -o build \ + ./cmd/... +} + +check() { + cd "$pkgname" + + go test -v ./... } package() { - install -Dm755 -t "$pkgdir/usr/bin" "$_pkgname-$pkgver/build/$pkgname" + cd "$pkgname" + + # binary + install -vDm755 -t "$pkgdir/usr/bin" "build/$pkgname" } |