# Template file for 'kde-workspace'
_kdeversion=4.14.3
_kappversion=15.08.0

pkgname=kde-workspace
version=4.11.22
revision=3
short_desc="Provides the interface and basic tools for the KDE workspace"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2, LGPL-2.1, FDL"
homepage="http://www.kde.org"
distfiles="http://download.kde.org/Attic/applications/${_kappversion}/src/${pkgname}-${version}.tar.xz"
checksum=f035334e843d67ee88551ae9e6c5f64bf7b1edfe311b12501575fe74be0b03b7

build_style=cmake
configure_args="-Wno-dev -DKDE4_BUILD_TESTS=OFF -DSYSCONF_INSTALL_DIR=/etc
 -DWITH_Xmms=OFF -DWITH_libgps=OFF -DWITH_NepomukCore=OFF -DWITH_Soprano=OFF
 -DWITH_CkConnector=ON"

# XXX prison.
hostmakedepends="automoc4 pkg-config"
makedepends="libressl-devel qt-devel phonon-devel libdbusmenu-qt-devel strigi-devel
 qt-webkit-devel kdelibs-devel kactivities-devel xcb-util-keysyms-devel
 qimageblitz-devel xcb-util-image-devel xcb-util-renderutil-devel boost-devel
 libjpeg-turbo-devel libpng-devel libXcursor-devel libXi-devel libxkbfile-devel
 libXrandr-devel libXfixes-devel libSM-devel libXcomposite-devel libXdamage-devel
 libXtst-devel libXft-devel glib-devel fontconfig-devel kdepimlibs-devel
 libsensors-devel wayland-devel MesaLib-devel pam-devel libusb-compat-devel
 NetworkManager-devel pciutils-devel libraw1394-devel python-devel libqalculate-devel
 akonadi-devel qjson-devel ConsoleKit2-devel"
depends="kde-wallpapers>=${_kdeversion} kde-base-artwork>=${_kdeversion}"
conf_files="
	/etc/kdm/kdmrc
	/etc/ksysguarddrc
	/etc/pam.d/kde-np
	/etc/pam.d/kde
	/etc/pam.d/kscreensaver"
system_accounts="kdm"
kdm_homedir="/var/lib/kdm"
make_dirs="
	/etc/kde/env 0755 root root
	/etc/kde/shutdown 0755 root root
	/var/lib/kdm 0755 kdm kdm"

CXXFLAGS="-std=gnu++98"

pre_configure() {
	sed -e "s,@PKG_SYSCONFDIR@,/etc,g" -i kdm/kcm/main.cpp
}

post_install() {
	vmkdir etc/pam.d
	for f in kde kde-np kscreensaver; do
		install -m644 ${FILESDIR}/${f}.pam ${DESTDIR}/etc/pam.d/${f}
	done
	vsv kdm
	vmkdir usr/share/xsessions
	ln -sf /usr/share/apps/kdm/sessions/kde-plasma{,-safe}.desktop \
		${DESTDIR}/usr/share/xsessions

	install -Dm644 ${DESTDIR}/usr/share/config/kdm/kdmrc \
		${DESTDIR}/etc/kdm/kdmrc
}

kde-workspace-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}-${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/cmake
		vmove usr/share/apps/cmake
	}
}
kde-python_package() {
	short_desc+=" - Python 2 bindings"
	pycompile_module="PyKDE4"
	pycompile_dirs="usr/share/apps/plasma_scriptengine_python"
	pkg_install() {
		vmove usr/lib/python2.7
		vmove usr/share/apps/plasma_scriptengine_python
		vmove "/usr/share/kde4/services/plasma-scriptengine*"
	}
}
