# Maintainer:
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: XazZ <xazz.xazz [AT] googlemail.com>

pkgbase=liblastfm
pkgname=(liblastfm-qt5)
pkgver=1.0.9
pkgrel=5
pkgdesc="A Qt C++ library for the Last.fm webservices"
arch=('x86_64')
url='https://github.com/lastfm/liblastfm/'
license=('GPL3')
depends=('qt5-base' 'fftw' 'libsamplerate')
makedepends=('cmake')
source=(${pkgbase}-${pkgver}.tar.gz::"https://github.com/lastfm/${pkgbase}/tarball/${pkgver}" liblastfm-qt5.11.patch
        liblastfm-include-suffix.patch::"https://github.com/lastfm/liblastfm/commit/480e2ec6.patch")
sha1sums=('cd8c6f160529dbf9e0566973a8f37130c83a78c0'
          '40d84032eaeae32072715732b9fe67295483ffad'
          '8c36936b2259771db4cf6ac55cd2201800a4623e')

prepare() {
  cd lastfm-${pkgbase}-*
  patch -p1 -i ../liblastfm-qt5.11.patch # Fix build with Qt 5.11
  patch -p1 -i ../liblastfm-include-suffix.patch # add suffix to Qt5 include dir
}

build() {
  mkdir build
  cd build
  cmake ../lastfm-${pkgbase}-* \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DBUILD_TESTS=OFF
  make
}

package_liblastfm-qt5() {
  cd build
  make DESTDIR="${pkgdir}" install
} 

