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

_name=BChoppr
pkgname=bchoppr
pkgver=1.12.6
pkgrel=2
pkgdesc="An audio stream chopping LV2 plugin"
arch=(x86_64)
url="https://github.com/sjaehn/BChoppr"
license=(GPL3)
groups=(lv2-plugins pro-audio)
depends=(cairo gcc-libs glibc libx11)
makedepends=(lv2)
checkdepends=(lv2lint)
source=($pkgname-$pkgver.tar.gz::$url/releases/download/$pkgver/$_name-$pkgver-source-code.tar.gz)
sha512sums=('252df7b442c4e6bf209d15e8560e5ef3c15a93ecaafb77c2c8dd4d27ce298ddf92116772e8cfaf712b14eaeb08a20ad8aaa9665b34096692057ef6282beb8e49')
b2sums=('d05d08bc522b041f2be64a691ec40f3deeb9ce9646446fc4f9369a11ee64601eb181542673be8233dc8bdc89e46858365898d7181c822e148b85cad278b82a47')

build() {
  make PREFIX=/usr -C $_name-$pkgver
}

check() {
  cd $_name-$pkgver
  # ignore symbols that cause issues with higher versions of gcc: https://github.com/sjaehn/BChoppr/issues/15
  lv2lint -Mpack -t "UI Symbols" -I "$PWD/$_name.lv2/" "https://www.jahnichen.de/plugins/lv2/$_name"
}

package() {
  depends+=(lv2-host)

  make DESTDIR="$pkgdir" PREFIX=/usr install -C $_name-$pkgver
  install -vDm 644 $_name-$pkgver/README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  # remove license file
  find "$pkgdir/usr/lib/" -type f -iname "*LICENSE*" -delete
}
