#Maintainer: David Runge <dave@sleepmap.de>
#Contributor: Damir Perisa <damir.perisa@bluewin.ch>
#Contributor: Robert Emil Berge <robert@rebi.no>

pkgname=cmt
pkgver=1.17
pkgrel=1
pkgdesc="LADSPA plugins for use with software synthesis and recording packages on Linux"
arch=('x86_64')
license=('GPL2')
url="https://www.ladspa.org/cmt/overview.html"
depends=('gcc-libs')
makedepends=('ladspa')
groups=('ladspa-plugins' 'pro-audio')
source=("https://www.ladspa.org/download/${pkgname}_${pkgver}.tgz")
sha512sums=('7df31a44c41622785b569ef79bef91cba098fed89ca65dcb31b9fdd751caff863cf42eb7ca2ffab08e883fbcd040ab1c7290a96abf58e908be44ab803d672e26')

prepare(){
  mv -v ${pkgname}_${pkgver} ${pkgname}-${pkgver}
  cd ${pkgname}-${pkgver}
  # inserting CFLAGS and LDFLAGS for full RELRO
  sed -e "s|-O2|${CFLAGS} ${LDFLAGS}|" -i src/Makefile
}

build() {
  cd ${pkgname}-${pkgver}/src
  make
}

package() {
  cd ${pkgname}-${pkgver}
  install -vDm 755 plugins/cmt.so -t "${pkgdir}/usr/lib/ladspa/"
  # docs
  install -vDm 644 {README,doc/*.html} \
    -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
