# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Contributor: Shinlun Hsieh <yngwiexx@yahoo.com.tw>
# Contributor: Mateusz Herych <heniekk@gmail.com>
# Contributor: Storyteller <spiralsorrow@hotmail.com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - remove wine makedepend, no vst

pkgname=lmms
pkgver=1.1.3
pkgrel=4
pkgdesc='The Linux MultiMedia Studio.'
arch=('i686' 'x86_64')
url='http://lmms.sourceforge.net/'
license=('GPL')
depends=('sdl' 'glib2' 'fluidsynth' 'libpng' 'libvorbis' 'libxft' 'libxinerama' 'qt4' 'sdl_sound'
         'libsamplerate' 'shared-mime-info' 'fltk')
optdepends=('fftw: SpectrumAnalyzer plugin'
            'stk: STK instruments plugins'
            'pulseaudio: PulseAudio output')
makedepends=('cmake' 'ladspa' 'libxft' 'freetype2' 'fftw' 'stk')
makedepends_x86_64=('gcc-multilib')
provides=('lmms-extras')
conflicts=('lmms-extras')
options=('!makeflags')
source=("$pkgname-$pkgver.tar.gz::https://github.com/LMMS/${pkgname}/archive/v${pkgver}.tar.gz"
        'lmms-1.1.3-gcc-6.0-buildfix.patch'
        "make-werrror-optional.patch")
md5sums=('88d9e66d240b711c37315e3c9da644a1'
         'daf525e570f58f9cc5de0af380162e79'
         '2c6e51b665c34fa61dc8b23e129404a9')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  sed -i 's|lib64|lib|g' cmake/modules/DetectMachine.cmake

  patch -Np1 -i ../lmms-1.1.3-gcc-6.0-buildfix.patch
  patch -Np1 -i ../make-werrror-optional.patch
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  cmake . -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  make DESTDIR="${pkgdir}" install
}