# $Id$
# Maintainer: Tom Gundersen <teg@jklm.no>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname=bluedevil
pkgver=2.0
pkgrel=1
epoch=1
pkgdesc='A Qt4 wrapper for bluez used in the new KDE bluetooth stack'
arch=('i686' 'x86_64')
url="https://projects.kde.org/projects/extragear/base/bluedevil/"
license=('GPL')
depends=('qt4' 'bluez')
makedepends=('cmake')
source=("http://download.kde.org/stable/${pkgname}/${pkgver}/src/${pkgname}-${pkgver}.tar.xz"
        "save-and-restore-adapters-state-in-kded-module.patch")
md5sums=('c318b94d6de3d516598208e32cbccad6' 
	 '8633e5068bb47056443c0874b1ca5f4b')

prepare() {
  mkdir build
  cd "${srcdir}/bluedevil-2.0/src/daemon/kded/"
  # BUG 341546 patch - Bluetooth devices are disabled by default patch FIX
  patch -p1 -i "${srcdir}/save-and-restore-adapters-state-in-kded-module.patch"
}

build() {
  cd build
  cmake ../${pkgname}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4
  make
}

package() {
  cd build
  make DESTDIR="${pkgdir}" install
}