# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgname=gendesk
pkgver=1.0.15
pkgrel=1
pkgdesc='Utility for generating desktop files by specifying a minimum of information'
arch=(x86_64 aarch64)
url='https://gendesk.roboticoverlords.org/'
license=(BSD-3-Clause)
depends=(glibc)
makedepends=(go)
options=(!lto)
validpgpkeys=(8A9BC5819C54FEB3DC2A9B48C32217F6F13FF192)
source=('https://gendesk.roboticoverlords.org/default.png'
        "https://roboticoverlords.org/$pkgname/$pkgname-$pkgver.tar.xz"{,.asc})
b2sums=('e52d0e8c871b3cb01838e7d91908b1813f63cd40d1416803b6033327e5b83bf8fc1358e54014e6401dc2f30797de12d1ffd30a83d7d5efbcef2d9d08b6aa370b'
        '1d43107bd009d47d83c9b5e3b420ea86ed937f5a4acfb4e6b742ed4dbf179607c33ce6032e2b34f32a857c547c8ff2b97f9f2960dc0728f410168c63b5e2fd52'
        'SKIP')

build() {
  cd $pkgname-$pkgver
  go build -buildvcs=false -buildmode=pie -trimpath -mod=readonly -modcacherw -ldflags="-s -w -linkmode=external -extldflags '$LDFLAGS'"
}

package() {
  cd $pkgname-$pkgver
  install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm644 $pkgname.1.gz "$pkgdir/usr/share/man/man1/$pkgname.1.gz"
  install -Dm644 "$srcdir/default.png" "$pkgdir/usr/share/pixmaps/gendesk.png"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
