# $Id: PKGBUILD 229477 2015-01-17 08:12:25Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Antonio Rojas
# Contributor: Alexey D. <lq07829icatm at rambler.ru>

pkgname=plasma-workspace
pkgver=5.1.2
pkgrel=3
pkgdesc='KDE Plasma Workspace'
arch=('i686' 'x86_64')
url='https://projects.kde.org/projects/kde/workspace/plasma-workspace'
license=('LGPL')
depends=('knewstuff' 'baloo-frameworks' 'kjsembed' 'knotifyconfig' 'libxcursor'
         'libksysguard' 'libkscreen-frameworks' 'ktexteditor' 'libqalculate'
         'qt5-tools' 'kded' 'kde-cli-tools' 'kio-extras' 'milou' 'breeze'
         'xorg-xrdb' 'xorg-xsetroot' 'xorg-xmessage')
makedepends=('extra-cmake-modules' 'kdoctools' 'kwin' 'gpsd')
optdepends=('plasma-workspace-wallpapers: additional wallpapers'
            'gpsd: GPS support for geolocation')
conflicts=('kdebase-workspace')
groups=('plasma-next')
options=('!buildflags')
source=("http://download.kde.org/stable/plasma/${pkgver}/$pkgname-$pkgver.tar.xz"
        'kde.pam'
        'screenlocker-input.patch' 'screenlocker-network.patch')
md5sums=('8a01835179b25e3a7ff644fd7e52ec96'
         '929b182dec8a096206ad493477c09d2c'
         '7e426d07806d8887879d932791bba869'
         'd67e504422a7e80a91b7adf3f41563f5')

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake ../${pkgname}-${pkgver} \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release \
    -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

  # be sure to use the Qt5 version of qtpaths
  sed 's:qtpaths:qtpaths-qt5:' -i "$pkgdir"/usr/bin/startkde

  install -D "${srcdir}"/kde.pam \
    "${pkgdir}"/etc/pam.d/kde
}
