# Contributor: Sheila Aman <sheila@vulpine.house>
# Maintainer: Sheila Aman <sheila@vulpine.house>
pkgname=lxqt-session
pkgver=0.17.0
_lxqt=0.9.0
pkgrel=0
pkgdesc="Session management utilities for LXQt"
url="https://lxqt.github.io/"
arch="all"
options="!check"  # No test suite.
license="LGPL-2.1+"
depends="xdg-user-dirs"
makedepends="cmake extra-cmake-modules lxqt-build-tools>=$_lxqt eudev-dev
	liblxqt-dev>=${pkgver%.*}.0 procps-dev qt5-qttools-dev kwindowsystem-dev"
subpackages="$pkgname-doc"
source="https://github.com/lxde/lxqt-session/releases/download/$pkgver/lxqt-session-$pkgver.tar.xz
	fix-chrono.patch"

build() {
	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} -Bbuild
	make -C build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE make -C build test
}

package() {
	make DESTDIR="$pkgdir" -C build install
	rm "$pkgdir"/usr/bin/startlxqt
	rm "$pkgdir"/usr/share/man/man1/start*
}

sha512sums="e3573ee76e5fcf285b0ddd177ae7324f6fee038ea110c950d7054da622bf6615d9ac8715cc0cde6db9034d710933a80c80f14470197d2cc275d48695f74ba7b6  lxqt-session-0.17.0.tar.xz
b74d5c27de6920ed9a714213903d2a16cc3d36ed6528f387491b82290aa5ec5d3c6a4886d1c4943fd8d1c2bf99394aaea38d39b4763aad803276f4b853af94a4  fix-chrono.patch"