# Maintainer: David Runge <dave@sleepmap.de>
# Contributor: speps <speps at aur dot archlinux dot org>
# Contributor: Dany Martineau <dany.luc.martineau@gmail.com>

pkgname=drumstick
pkgver=1.1.3
pkgrel=2
pkgdesc="MIDI libraries for Qt5/C++"
arch=('x86_64')
url="http://drumstick.sourceforge.net/"
license=('GPL2')
depends=('desktop-file-utils' 'hicolor-icon-theme' 'alsa-lib' 'qt5-base'
'qt5-svg')
makedepends=('cmake' 'doxygen' 'docbook-xsl' 'libpulse' 'fluidsynth')
optdepends=('fluidsynth: for fluidsynth integration'
            'libpulse: for PulseAudio integration')
provides=('libdrumstick-alsa.so' 'libdrumstick-file.so' 'libdrumstick-rt.so')
source=("https://downloads.sourceforge.net/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2")
sha512sums=('8831578a6422cbf6570fd0ff36836f808d452cd7cc338de82cc852d804c5ef404d97dfd73760b13f16fe33007b35a5fc4591f2c4d719a4cf2b6a34fa6ca81a8b')

prepare() {
  cd "${pkgname}-${pkgver}"
  # removing specific check for fluidsynth == 1.1.11, as fluidsynth > 2.0.0
  # compiles just fine
  sed -E 's|(pkg_check_modules\(FLUIDSYNTH ).+|\1fluidsynth\)|g' \
      -i library/rt-backends/CMakeLists.txt
}

build() {
  cd "${pkgname}-${pkgver}"
  cmake -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_BUILD_TYPE=Release
  make
}

package() {
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}/" install
  install -t "${pkgdir}/usr/share/doc/${pkgname}/" \
    -vDm 644 {AUTHORS,ChangeLog,NEWS,README,TODO}
}
