# $Id: PKGBUILD 226875 2014-11-24 07:16:07Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=kdebase-runtime
pkgver=4.14.3
pkgrel=1
pkgdesc="Plugins and applications necessary for the running of KDE applications"
arch=('i686' 'x86_64')
url='https://projects.kde.org/projects/kde/kde-runtime'
license=('GPL' 'LGPL')
depends=("kdelibs>=${pkgver}" 'kactivities' 'libkactivities4' 'smbclient' 'libssh' 'libcanberra'
         'oxygen-icons' 'xorg-xauth' 'libwebp')
makedepends=('pkg-config' 'cmake' 'automoc4' 'kdepimlibs' 'openslp' 'doxygen'
             'networkmanager' 'boost')
optdepends=('kdepimlibs: needed by DrKonqi to send crash reports to KDE.org'
            'gdb: needed by DrKonqi to generate backtrace'
            'htdig: to build the search index in the KHelpCenter'
            'rarian: needed by KHelpCenter')
provides=('khelpcenter' 'notification-daemon')
install="${pkgname}.install"
source=("http://download.kde.org/stable/${pkgver}/src/kde-runtime-${pkgver}.tar.xz"
        CVE-2014-8600.patch)
sha1sums=('d25357bf7e5d3922ce0c9b60921fb2fd738b7251'
          '63588c9843c68c9b59e5b5e24dbc62c690ce68ce')

prepare() {
  mkdir build

  cd kde-runtime-${pkgver}
  patch -p1 -i ../CVE-2014-8600.patch
}

build() {
  cd build
  cmake ../kde-runtime-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DKDE4_BUILD_TESTS=OFF \
    -DCMAKE_SKIP_RPATH=ON \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DWITH_QNtrack=OFF \
    -DSAMBA_INCLUDE_DIR=/usr/include/samba-4.0 \
    -DWITH_NepomukCore=OFF
  make
}

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

  rm "${pkgdir}"/usr/share/icons/hicolor/index.theme

  ln -sf /usr/lib/kde4/libexec/kdesu "${pkgdir}/usr/bin/"

  # FS#36668
  chown :nobody "${pkgdir}"/usr/lib/kde4/libexec/kdesud
  chmod g+s "${pkgdir}"/usr/lib/kde4/libexec/kdesud
}
