# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=qtmir
pkgver=0_git20190222
_commit="1bddb8c2331f990a53286aeeb070ed384850b52e"
pkgrel=0
pkgdesc="QPA plugin to make Qt a Mir server"
arch="x86_64"
url="https://unity8.io"
license="LGPL-3.0"
depends=""
makedepends="$depends_dev cmake cmake-extras gtest-dev mir-dev process-cpp-dev qt5-qtdeclarative-dev qt5-qtsensors-dev ubuntu-app-launch-dev gsettings-qt-dev libqtdbustest libqtdbusmock content-hub-dev valgrind-dev url-dispatcher-dev"
source="$pkgname-$_commit.tar.gz::https://github.com/ubports/$pkgname/archive/$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit"

prepare() {
	default_prepare
	mkdir -p "$builddir"/build

	# Don't build tests, they require Mir to be built with tests which is disabled
	truncate -s 0 "$builddir"/tests/CMakeLists.txt
}

build() {
	cd "$builddir"/build
	cmake \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib ..
	make
}

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

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

sha512sums="36492fc7ffe0937abb343e9ab816b7194636a4fb8e946f25a3113639460e0c79f8449c05d8fe4b44e4e30167fa39dd8c054bd4df536e21926b73b855212db9eb  qtmir-1bddb8c2331f990a53286aeeb070ed384850b52e.tar.gz"
