# Maintainer: David Runge <dave@sleepmap.de>
# Contributor: Lieven Moors <lievenmoors@gmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - export OPTIMIZATIONS to override Makefiles without x86isms

pkgname=x42-plugins
pkgver=20181103
pkgrel=1
pkgdesc="Collection of LV2 plugins"
arch=('x86_64')
url="https://github.com/x42/x42-plugins"
license=('GPL')
depends=('ftgl' 'jack' 'liblo' 'libltc' 'pango' 'zita-convolver')
makedepends=('gendesk' 'gtk2' 'ttf-dejavu' 'lv2')
groups=('lv2-plugins' 'pro-audio')
source=("http://gareus.org/misc/${pkgname}/${pkgname}-${pkgver}.tar.xz")
sha512sums=('3d30d3197832593fa972c729b32c20a53800d5d0356c94938fd0b7bfb9358fa8be4fe40162ef05b89458b08a1ed1715822c67389cff1a37209e56da7c0975044')

prepare() {
  declare -A descriptions=(
    ["dpl1"]="Look-ahead digital peak limiter intended but not limited to the final step of mastering or mixing"
    ["fat1"]="Auto-tuner based on Fons Adriaensen's zita-at1"
    ["fil4"]="4 band parametric equalizer with additional low+high shelf filters, Low and High-pass"
    ["meter"]="Collection of audio-level meters"
    ["mixtri"]="Matrix mixer and trigger processor"
    ["scope"]="Simple audio oscilloscope with variable time scale, triggering, cursors and numeric readout"
    ["stepseq"]="Simple step sequencer for moddevices.com"
    ["tuna"]="A musical instrument tuner with strobe characteristics"
  )
  cd "${pkgname}-${pkgver}"
  # replace ttf-freefont with ttf-liberation
  export FONTFILE=/usr/share/fonts/TTF/DejaVuSans-Bold.ttf
  # XDG desktop files
  for name in dpl1 fat1 fil4 meter mixtri scope stepseq tuna; do
    gendesk -n \
            --pkgname x42-${name} \
            --pkgdesc "${descriptions[$name]}" \
            --name x42-${name} \
            --categories "AudioVideo;Audio"
  done
}

build() {
  cd "${pkgname}-${pkgver}"
  export OPTIMIZATIONS="-ffast-math -fomit-frame-pointer -O3 -fno-finite-math-only"
  make
}

package() {
  cd "${pkgname}-${pkgver}"
  make install DESTDIR="$pkgdir/" PREFIX=/usr
  install -vDm 644 *.desktop -t "${pkgdir}/usr/share/applications/"
}

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