# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=plasma-workspace
pkgver=5.12.5
pkgrel=0
pkgdesc="KDE Plasma 5 workspace"
url="https://www.kde.org/plasma-desktop"
arch="all"
license="LGPL-2.1"
options="!check"  # Test requires X11 accelration.
# startkde shell script calls
depends="kinit qdbus qtpaths xmessage xprop xset xsetroot"
# font installation stuff
depends="$depends mkfontdir"
# QML deps
depends="$depends qt5-qtgraphicaleffects qt5-qtquickcontrols solid"
# other runtime deps / plugins
depends="$depends libdbusmenu-qt kcmutils kde-cli-tools kded kdesu kio-extras
	ksysguard kwin milou plasma-integration pulseaudio-utils iso-codes xrdb"
depends_dev="qt5-qtbase-dev qt5-qtdeclarative-dev qt5-qtscript-dev kwallet-dev
	plasma-framework-dev krunner-dev knotifyconfig-dev knewstuff-dev
	kcmutils-dev kdeclarative-dev ktextwidgets-dev kdelibs4support-dev
	kcrash-dev kglobalaccel-dev kdbusaddons-dev kitemmodels-dev kdesu-dev
	kidletime-dev kwayland-dev kjsembed-dev kxmlrpcclient-dev kholidays-dev
	libksysguard-dev kpackage-dev baloo-dev kwin-dev libdbusmenu-qt-dev
	ktexteditor-dev prison-dev libxtst-dev"
makedepends="$depends_dev cmake extra-cmake-modules kdoctools-dev"
install=""
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="https://download.kde.org/stable/plasma/$pkgver/plasma-workspace-$pkgver.tar.xz
	"
builddir="$srcdir/plasma-workspace-$pkgver"

build() {
	cd "$builddir"
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DBUILD_TESTING=OFF \
		${CMAKE_CROSSOPTS}
	make
}

check() {
	cd "$builddir"
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="c086b13893ab422b701e31652015618d8e3752e4ee5a8b9721eee7085307d251ea716e72bab52f458655cbf49d9a1a94deb47482fd6ecb030b20d7ea1bb52deb  plasma-workspace-5.12.5.tar.xz"