# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libkscreen
pkgver=5.8.7
pkgrel=0
pkgdesc="KDE Plasma screen management software"
url="https://www.kde.org/"
arch="all"
license="GPL-2.0"
options="!check"  # Requires dbus-x11 and both of them running
depends=""
depends_dev="qt5-qtbase-dev qt5-qtx11extras-dev kwayland-dev"
makedepends="$depends_dev cmake extra-cmake-modules"
install=""
subpackages="$pkgname-dev"
source="http://download.kde.org/stable/plasma/$pkgver/libkscreen-$pkgver.tar.xz"
builddir="$srcdir/libkscreen-$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" \
		${CMAKE_CROSSOPTS}
	make
}

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

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

sha512sums="194f6b1cb5abb38f5c4fc425546652e31f8b0b0a0ae6e3d657c98095df13f383258f0e16c74b5add0935158c1affd27b21ae76cf7b951801f4250f6dc527006e  libkscreen-5.8.7.tar.xz"