# $Id: PKGBUILD 235531 2015-04-06 06:40:01Z arojas $
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Antonio Rojas

pkgname=plasma-desktop
pkgver=5.2.2
pkgrel=3
pkgdesc='KDE Plasma Desktop'
arch=('i686' 'x86_64')
url='https://www.kde.org/workspaces/plasmadesktop/'
license=('LGPL')
depends=('qt5-graphicaleffects' 'powerdevil' 'polkit-kde-frameworks'
         'libcanberra' 'kwin' 'libusb-compat' 'libxkbfile' 'kmenuedit'
         'systemsettings' 'ksysguard' 'breeze')
makedepends=('extra-cmake-modules' 'kdoctools' 'boost' 'baloo-frameworks')
optdepends=('baloo-frameworks: system indexing'
           'plasma-nm: Network manager applet')
conflicts=('kdebase-workspace')
install="${pkgname}.install"
groups=('plasma')
source=("http://download.kde.org/stable/plasma/${pkgver}/$pkgname-$pkgver.tar.xz"
        aa08cd42a470af7a10f34cc9dbe7aefd0057bb35.patch
        9ba1ef4777aae9a2492f9960d5fc46b3a6415d85.patch)
md5sums=('dc5e656b26d31bda9d0504b3df2a5b18'
         '9c169d282f6a96fbde0fe510de20a603'
         'beba1fbf46da6463dea6565b63370175')

prepare() {
  mkdir build

  cd $pkgname-$pkgver
  patch -p1 -i ../aa08cd42a470af7a10f34cc9dbe7aefd0057bb35.patch
  patch -p1 -i ../9ba1ef4777aae9a2492f9960d5fc46b3a6415d85.patch
}

build() {
  cd build
  cmake ../${pkgname}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIB_INSTALL_DIR=lib \
    -DLIBEXEC_INSTALL_DIR=lib \
    -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
    -DBUILD_TESTING=OFF
  make
}

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

# Rename kcfg files to avoid conflicting with kdebase-kdepasswd
  mv "$pkgdir"/usr/share/config.kcfg/kcm_useraccount{,5}.kcfg
  mv "$pkgdir"/usr/share/config.kcfg/kcm_useraccount_pass{,5}.kcfg
}
