# Maintainer: David Runge <dvzrv@archlinux.org>

_name=mda-lv2
pkgname=mda.lv2
pkgver=1.2.10
pkgrel=2
pkgdesc="A port of the MDA VST plugins to LV2"
arch=(x86_64)
url="https://gitlab.com/drobilla/mda-lv2"
license=(GPL3)
groups=(lv2-plugins pro-audio)
depends=(gcc-libs glibc lv2-host)
checkdepends=(lv2lint)
makedepends=(lv2 meson)
source=(https://download.drobilla.net/$_name-$pkgver.tar.xz{,.sig})
sha512sums=('be490887be25b2578a4f0a0f7d571aaa1bad37a640094ffde7bdca21a285ddf7d7650f96f735cb0ec01e262bddb945ab9e8923a2d8b94afb5dc6940cf4e2b054'
            'SKIP')
b2sums=('f201cff828fcef037795935bbeb56b0c2067a2f66666f99d8f90507333249c128d5d6202bc38a96dafa9f9aab28f5c9b571f9e8d88f7a77fd1b23f5fca1376d4'
        'SKIP')
validpgpkeys=('907D226E7E13FA337F014A083672782A9BF368F3') # David Robillard <d@drobilla.net>

build() {
  # NOTE: disable tests because some weird internal tooling is required otherwise
  arch-meson $_name-$pkgver build -D tests=disabled
  meson compile -C build
}

check() {
  local _plugins _plugin
  _plugins=(Ambience Bandisto BeatBox Combo DX10 DeEss Degrade Delay Detune
  Dither DubDelay Dynamics EPiano Image JX10 Leslie Limiter Loudness MultiBand
  Overdrive Piano RePsycho RezFilter RingMod RoundPan Shepard Splitter Stereo
  SubSynth TalkBox TestTone ThruZero Tracker Transient VocInput Vocoder)

  for _plugin in "${_plugins[@]}"; do
    # NOTE: whitelist globally visible library: https://gitlab.com/drobilla/mda-lv2/-/issues/2
    lv2lint -Mpack -s lvz_new_audioeffectx -I "build/$pkgname/" "http://drobilla.net/plugins/mda/$_plugin"
  done
}

package() {
  meson install -C build --destdir "$pkgdir"
  install -vDm 644 $_name-$pkgver/{NEWS,README.md} -t "$pkgdir/usr/share/doc/$pkgname/"
}
