summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4c206dffe7692adf4de74152e2d2f0f9ab4b6b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Maintainer: bloominstrong < archlinux at mail dot bloominstrong dot net >
pkgname=hyprkeys
pkgver=1.0.3
pkgrel=1
pkgdesc='A simple, scriptable keybind retrieval utility for Hyprland'
arch=('x86_64')
url='https://github.com/hyprland-community/Hyprkeys'
license=('GPL-3.0-or-later')
depends=('glibc')
makedepends=('go')
options=()
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('90692f3531e51a9fe97ab01e5a6d3c0ba5f991d81c0106bfbea67c52f0eddb57')


_upstreamname=Hyprkeys

build() {
  cd "${_upstreamname}-${pkgver}"

  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"

  go build -o build/${pkgname} -ldflags "-X 'main.version=v${pkgver}'" .

  mkdir -p completions
  ./build/${pkgname} completion zsh > completions/_${pkgname}
  ./build/${pkgname} completion bash > completions/${pkgname}
  ./build/${pkgname} completion fish > completions/${pkgname}.fish

}

check() {
  cd "${_upstreamname}-${pkgver}"

  go test -v ./...
}

package() {
  cd "${_upstreamname}-${pkgver}"

  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
  install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README"
  install -Dm755 "build/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"

  install -Dm644 "completions/_${pkgname}" "${pkgdir}/usr/share/zsh/site-functions/_${pkgname}"
  install -Dm644 "completions/${pkgname}" "${pkgdir}/usr/share/bash-completion/completions/${pkgname}"
  install -Dm644 "completions/${pkgname}.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/${pkgname}.fish"
}