# Maintainer: David Runge <dave@sleepmap.de>
pkgname=lsp-plugins
pkgver=1.1.10
pkgrel=1
pkgdesc="Collection of free plugins compatible with LADSPA, LV2 and LinuxVST"
arch=('x86_64')
url="https://lsp-plug.in"
license=('LGPL3')
groups=('ladspa-plugins' 'lv2-plugins' 'pro-audio' 'vst-plugins')
depends=('cairo' 'jack' 'libglvnd')
makedepends=('ladspa' 'lv2' 'php')
source=("https://github.com/sadko4u/${pkgname}/archive/${pkgname}-${pkgver}.tar.gz")
sha512sums=('aedc6a6a421bfb1ad964f6963793cdb2616456044736745a1c3dc27e947b1d6395de1942c2525bc983e654df5335d35466eed16b8f31612119284b024bdce6c2')

prepare() {
  mv -v "$pkgname-$pkgname-$pkgver" "$pkgname-$pkgver"
  cd "$pkgname-$pkgver"
  # removing /usr/local/lib from RPATH
  sed -e '/LD_PATH/ s|:/usr/local/lib||g' \
      -i scripts/make/configure.mk
}

build() {
  local _test_path="$(pwd)/.build-test"
  cd "$pkgname-$pkgver"
  make
  make OBJDIR=${_test_path} clean
  make OBJDIR=${_test_path} test
}

check() {
  local _test_path="$(pwd)/.build-test"
  cd "$pkgname-$pkgver"
  ${_test_path}/lsp-plugins-test utest \
    --nofork \
    --debug \
    --verbose || warning "Known flaky test: https://github.com/sadko4u/lsp-plugins/issues/19"
}

package() {
  cd "$pkgname-$pkgver"
  make BIN_PATH=/usr/bin \
       LIB_PATH=/usr/lib \
       DOC_PATH=/usr/share/doc \
       DESTDIR="$pkgdir/" \
       install
}
