# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=maliit-framework
pkgver=2.3.0
pkgrel=5
pkgdesc="Core libraries of Maliit and server"
# armhf blocked by qt5-qtdeclarative
arch="all !armhf"
url="https://github.com/maliit/framework"
license="LGPL-2.1-only"
depends_dev="
	eudev-dev
	gtk+3.0-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtwayland-dev
	wayland-dev
	"
makedepends="$depends_dev
	cmake
	doxygen
	graphviz
	wayland-protocols
	"
checkdepends="xvfb-run"
source="$pkgname-$pkgver.tar.gz::https://github.com/maliit/framework/archive/$pkgver/framework-$pkgver.tar.gz
	0001-ut_mimserveroptions-Move-the-operator-definition-to-.patch
	0002-connection-Move-dbus-socket-to-well-known-path-in-XD.patch
	"
subpackages="$pkgname-dev $pkgname-doc"
builddir="$srcdir/framework-$pkgver"

prepare() {
	default_prepare

	# Hack to make CMake find qtwaylandscanner
	export PATH="$PATH:/usr/lib/qt5/bin"
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-Denable-dbus-activation=ON \
		-Denable-wayland-gtk=ON
	cmake --build build
}

check() {
	cd build

	# ut_minputmethodquickplugin requires working OpenGL
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "ut_minputmethodquickplugin"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
b68471839fb41bcf6ed1753edb5987d7904ad990bbf5c0089e6c84d05d394a9ee4fd068b2503dbb9bd291cc91808866cbe0de09df6d3b115cbd6cae10692d7f1  maliit-framework-2.3.0.tar.gz
a4c25fb26a98261adcf74506e3d6b5b27e6334f47b219239a37fba109e75d6f20be9d0febfbf1c6caabf4a9b813bdd1fd1ff557f1f4b53fe36333a939c7ecfcc  0001-ut_mimserveroptions-Move-the-operator-definition-to-.patch
73fa3a9388a18fb8d01bab72025a0938af4244767a92ae001a15e1c2afdcd24de35a9273f520c39062bd562787f2dc116b1b4ba4403a5c61051470bcac022838  0002-connection-Move-dbus-socket-to-well-known-path-in-XD.patch
"
