# Maintainer: dax
#
# Not a prebuilt of extra/hex (the hex dump tool, which installs /usr/bin/hx):
# this is the Hex voice dictation app, so it neither provides nor conflicts
# with it.
#
# Generated from anomalyco/hex packaging/aur by scripts/release-aur.sh, which
# sets pkgver, the release service's linux-x64 and linux-arm64 file URLs, and
# the checksums for each release.
pkgname=hex-bin
pkgver=@VERSION@
pkgrel=1
pkgdesc='Hex voice dictation app by Anomaly: hold a key, speak, and it types (Linux beta; not the hex dump tool)'
arch=('x86_64' 'aarch64')
url='https://github.com/anomalyco/hex'
license=('MIT')
# Linked: alsa-lib, gcc-libs, glibc, vulkan-icd-loader. Loaded at
# runtime: the X11/Wayland/xkbcommon client libraries and OpenBLAS.
depends=(
  'alsa-lib' 'curl' 'gcc-libs' 'glibc' 'libx11' 'libxcb' 'libxcursor'
  'libxi' 'libxkbcommon' 'libxkbcommon-x11' 'openblas' 'vulkan-icd-loader'
  'wayland'
)
optdepends=(
  'wl-clipboard: paste on Wayland'
  'wtype: paste on Wayland'
  'vulkan-driver: GPU transcription'
  'wireplumber: mute output while dictating (or libpulse for pactl)'
  'xdg-utils: open links from voice commands'
)
options=('!strip' '!debug')
install=hex-bin.install
source=(
  'anomaly.hex.desktop'
  'hex.service'
  'LICENSE'
  'anomaly.hex-16.png' 'anomaly.hex-24.png' 'anomaly.hex-32.png' 'anomaly.hex-48.png'
  'anomaly.hex-64.png' 'anomaly.hex-128.png' 'anomaly.hex-256.png' 'anomaly.hex-512.png'
)
source_x86_64=("hex-${pkgver}-linux-x64::@URL_X64@")
source_aarch64=("hex-${pkgver}-linux-arm64::@URL_ARM64@")
sha256sums=('@DESKTOP_SHA256@'
            '@SERVICE_SHA256@'
            '@LICENSE_SHA256@'
            @ICON_SHA256S@)
sha256sums_x86_64=('@SHA256_X64@')
sha256sums_aarch64=('@SHA256_ARM64@')

package() {
  local target=x64
  [ "$CARCH" = aarch64 ] && target=arm64
  install -Dm755 "hex-${pkgver}-linux-${target}" "$pkgdir/usr/bin/hex"
  install -Dm644 anomaly.hex.desktop "$pkgdir/usr/share/applications/anomaly.hex.desktop"
  local size
  for size in 16 24 32 48 64 128 256 512; do
    install -Dm644 "anomaly.hex-$size.png" \
      "$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/anomaly.hex.png"
  done
  install -Dm644 hex.service "$pkgdir/usr/lib/systemd/user/hex.service"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
