# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=kwin
pkgver=5.12.5
pkgrel=0
pkgdesc="Modern, stylish window manager (requires OpenGL)"
url="https://www.kde.org/"
arch="all"
license="LGPL-2.1"
options="!check"  # Requires accelerated X11 desktop
depends=""
depends_dev="qt5-qtbase-dev qt5-qtdeclarative-dev qt5-qtscript-dev kcrash-dev
	qt5-qtx11extras-dev kconfig-dev kconfigwidgets-dev kcoreaddons-dev
	kglobalaccel-dev ki18n-dev kinit-dev knotifications-dev kpackage-dev
	plasma-framework-dev kwidgetsaddons-dev kwindowsystem-dev kwayland-dev
	kiconthemes-dev kidletime-dev kcompletion-dev kdeclarative-dev kio-dev
	kcmutils-dev ktextwidgets-dev knewstuff-dev kservice-dev kxmlgui-dev
	kdecoration-dev kscreenlocker-dev wayland-dev mesa-dev libepoxy-dev
	eudev-dev libdrm-dev libx11-dev libxcb-dev xcb-util-cursor-dev
	xcb-util-image-dev xcb-util-wm-dev libxkbcommon-dev libinput-dev
	freetype-dev fontconfig-dev qt5-qtmultimedia-dev breeze-dev
	qt5-qtsensors-dev"
makedepends="$depends_dev cmake extra-cmake-modules qt5-qttools-dev python3"
install=""
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
source="http://download.kde.org/stable/plasma/$pkgver/kwin-$pkgver.tar.xz"
builddir="$srcdir/kwin-$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="9a99645455f17b14ede45d656a83eb753fcd02c2ed4cca10045db84a75c610ba0732ffacca780805b3f990ab1ada6861f9036588d45c1bf487dbf1ff5bf9ba22  kwin-5.12.5.tar.xz"