# Maintainer: David Heinemeier Hansson <david@hey.com>
pkgname=omarchy-audio-tuner
pkgver=0.1.0
pkgrel=1
pkgdesc="Tools for authoring Omarchy laptop speaker tunings"
arch=('any')
url="https://github.com/omacom-io/omarchy-audio-tuner"
license=('MIT')
options=('!debug')
# pactl comes from libpulse; mpv plays the probe, ffmpeg captures and analyses it,
# and lsp-plugins-lv2 supplies the lookahead limiter a generated chain ends in, so
# it is needed to audition the result and not only to author it.
depends=('bash' 'python' 'ffmpeg' 'mpv' 'libpulse' 'lsp-plugins-lv2')
makedepends=('git')
source=("git+https://github.com/omacom-io/omarchy-audio-tuner.git#tag=v$pkgver")
sha256sums=('SKIP')

package() {
  cd "$srcdir/$pkgname"

  # The tools call each other by relative path, so the tree is installed intact
  # and a single symlink puts one command on PATH. Generated files (the probe
  # signal and its tone list) go to ~/.cache/omarchy-audio-tuner, so nothing is
  # written back into this read-only tree.
  install -dm755 "$pkgdir/usr/share/$pkgname"
  cp -a measure fit generate compare "$pkgdir/usr/share/$pkgname/"
  install -Dm755 omarchy-audio-tuner "$pkgdir/usr/share/$pkgname/omarchy-audio-tuner"

  install -dm755 "$pkgdir/usr/bin"
  ln -s "/usr/share/$pkgname/omarchy-audio-tuner" "$pkgdir/usr/bin/$pkgname"

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