# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: speps <speps at aur dot archlinux dot org>

pkgname=ams
pkgver=2.2.0
pkgrel=1
pkgdesc="A real-time modular synthesizer and effect processor"
arch=('x86_64')
url="http://alsamodular.sourceforge.net/"
license=('GPL2')
groups=('pro-audio')
depends=('cmt' 'gcc-libs' 'glibc' 'qt5-base' 'mcp-plugins' 'rev-plugins'
'swh-plugins' 'vco-plugins')
makedepends=('alsa-lib' 'fftw' 'gendesk' 'jack' 'liblo' 'ladspa' 'qt5-tools'
'zita-alsa-pcmi')
source=("https://downloads.sourceforge.net/project/alsamodular/alsamodular/$pkgver/$pkgname-$pkgver.tar.bz2")
sha512sums=('f6189ae52fb382706bb769a191079de1186eddf4ead339494148ec164b57516bd433afe8aeffbe55778c85e88befa3b3cad73a6378f404e613b361ce4836ac0f')
b2sums=('fa191b91a3aa8dba7072b7fc5fb8e4de6d54b4c2c53d0af63c4eb90e57daaef35ba8ff755a08265050775f6bbda4e93183423103dee93189cc97f34ec5f1f518')

prepare() {
  cd "${pkgname}-${pkgver}"
  gendesk -n \
          --pkgname "${pkgname}" \
          --name "${pkgname}" \
          --pkgdesc "A real-time modular synthesizer and effect processor" \
          --genericname "Synthesizer" \
          --icon "${pkgname}_32.xpm" \
          --categories "AudioVideo;Audio"
  autoreconf -vfi
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr
  make
}

package() {
  depends+=('libasound.so' 'libfftw3.so' 'libjack.so' 'liblo.so'
  'libzita-alsa-pcmi.so')

  cd "${pkgname}-${pkgver}"
  make DESTDIR="$pkgdir/" install
  # XDG desktop file and icon
  install -vDm 644 "${pkgname}.desktop" \
    -t "${pkgdir}/usr/share/applications/"
  # docs
  install -vDm 644 {AUTHORS,ChangeLog,NEWS,README} \
    -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
