# Maintainer (arch): David Runge <dvzrv@archlinux.org>
# Contributor: Rob Til Freedmen <rob.til.freedman@gmail.com>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: tobias <tobias@archlinux.org>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: André Silva <emulatorman@hyperbola.info>

# parabola changes and rationale:
#  - removed drumkits recommendation

pkgname=hydrogen
pkgver=1.0.2
pkgrel=1
pkgrel+=.parabola1
pkgdesc="An advanced drum machine"
pkgdesc+=", without nonfree drumkits recommendation"
arch=('x86_64')
arch+=('i686' 'armv7h')
license=('GPL2')
groups=('pro-audio')
url="http://www.hydrogen-music.org/"
depends=('gcc-libs' 'glibc' 'hicolor-icon-theme' 'qt5-base' 'qt5-xmlpatterns')
makedepends=('alsa-lib' 'cmake' 'jack' 'ladspa' 'libarchive' 'liblo' 'liblrdf'
'libpulse' 'libsndfile' 'portaudio' 'portmidi' 'python' 'qt5-tools')
checkdepends=('cppunit')
optdepends=('new-session-manager: for session management')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/${pkgname}-music/${pkgname}/archive/${pkgver}.tar.gz")
sha512sums=('7466b7ef1da4a078d67e1cab8744b2e0c3c048bb55e1febd22023c591ed9e2bf1cea41adc38a775a2ac60978735517a92df404d5ca8bb13603ea68c8da70daa9')
b2sums=('a4210e666b11e173eb0e02728f601ac9811941b558096ae76f3ad45b91c5db1ff942cddd536a50f8f2f456871d69f3a6c52d53c926f4547f13783ccbb4fc250d')

prepare() {
  # Change to list with free licensed drumkits only
  sed -i -e 's|www[.]hydrogen-music[.]org/feeds/drumkit_list[.]php|repo.parabola.nu/other/hydrogen-libre/feeds/drumkit_list.php|' \
  $(grep -rlI 'www[.]hydrogen-music[.]org/feeds/drumkit_list[.]php')
}

build() {
  cd "${pkgname}-${pkgver}"
  cmake -DCMAKE_INSTALL_PREFIX='/usr' \
        -DCMAKE_BUILD_TYPE='None' \
        -DWANT_DEBUG=OFF \
        -DWANT_CPPUNIT=ON \
        -DWANT_LRDF=ON \
        -DWANT_PORTAUDIO=ON \
        -DWANT_PORTMIDI=ON \
        -DWANT_PULSEAUDIO=ON \
        -Wno-dev \
        -B build \
        -S .
  make VERBOSE=1 -C build
  # update translations
  (
    cd data/i18n
    ./updateTranslations.sh
  )
}

package() {
  depends+=('libarchive.so' 'libasound.so' 'liblo.so' 'libjack.so' 'liblrdf.so'
  'liblo.so' 'libportaudio.so' 'libportmidi.so' 'libpulse.so' 'libsndfile.so')
  cd "${pkgname}-${pkgver}"
  make DESTDIR="$pkgdir" install -C build
  # docs
  install -vDm 644 {ChangeLog,DEVELOPERS,INSTALL.md,README.md} \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim:set ts=2 sw=2 et:
