# Maintainer: Stephan Wilkens
pkgname=hoerwerk
pkgver=0.1.2
pkgrel=1
pkgdesc='Lokaler Hörbuch-Player für die eigene Audible-Bibliothek (Tauri 2 + Svelte)'
arch=('x86_64')
url='https://git.wlkns.org/wlkns-dev/hoerwerk'
license=('MIT')
depends=('gtk3' 'webkit2gtk-4.1' 'libayatana-appindicator' 'mpv' 'ffmpeg' 'openssl')
makedepends=('git' 'nodejs' 'npm' 'rust')
source=("git+https://git.wlkns.org/wlkns-dev/hoerwerk.git#tag=v$pkgver")
sha256sums=('SKIP')

build() {
  cd "$srcdir/hoerwerk"
  npm install
  npm run build
  cd src-tauri
  cargo build --release
}

package() {
  cd "$srcdir/hoerwerk"
  install -Dm755 src-tauri/target/release/hoerwerk "$pkgdir/usr/bin/hoerwerk"
  install -Dm644 src-tauri/icons/128x128.png "$pkgdir/usr/share/icons/hicolor/128x128/apps/hoerwerk.png"
  install -Dm644 src-tauri/icons/32x32.png "$pkgdir/usr/share/icons/hicolor/32x32/apps/hoerwerk.png"
  install -Dm644 src-tauri/icons/icon.png "$pkgdir/usr/share/icons/hicolor/512x512/apps/hoerwerk.png"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/hoerwerk/LICENSE"
  install -Dm644 packaging/arch/hoerwerk.desktop "$pkgdir/usr/share/applications/hoerwerk.desktop"
  install -d "$pkgdir/usr/share/hoerwerk"
}
