# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=libei
pkgver=1.3.0
pkgrel=0
_munit=fbbdf1467eb0d04a6ee465def2e529e4c87f2118
pkgdesc="Emulated Input library"
url="https://gitlab.freedesktop.org/libinput/libei"
arch="all"
license="MIT"
makedepends="
	basu-dev
	libevdev-dev
	libxkbcommon-dev
	meson
	py3-attrs
	py3-jinja2
	"
checkdepends="
	libxml2-utils
	py3-dbusmock
	py3-pytest
	py3-structlog
	py3-yaml
	"
subpackages="
	$pkgname-dev
	libeis
	liboeffis
	$pkgname-utils
	"
source="https://gitlab.freedesktop.org/libinput/libei/-/archive/$pkgver/libei-$pkgver.tar.bz2
	munit-$_munit.tar.gz::https://github.com/nemequ/munit/archive/$_munit.tar.gz
	"

prepare() {
	default_prepare

	ln -sfv "$srcdir"/munit-$_munit subprojects/munit
}

build() {
	abuild-meson \
		-Db_lto=true \
		-Dliboeffis=enabled \
		-Dsd-bus-provider=basu \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		. output
	meson compile -C output
}

check() {
	meson test -t 5 --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

libeis() {
	amove usr/lib/libeis.so.*
}

liboeffis() {
	amove usr/lib/liboeffis.so.*
}

utils() {
	amove usr/bin
}

sha512sums="
a63b52c7251660404b307dba82ee24e31b64aaff7140acb174a33aeb60a07e59391522e2a5c56cd7bbdc45ab5e4a0e6111e214f2f1b79834b152e6ebc3e5e0c1  libei-1.3.0.tar.bz2
26b5599fd12be627a692823ebf496fa446be7ed04a1233fb42e0667c05109b0f804f76646e289ac660fc815baf45f77ec8caf0ff2ea7fb0b4f87f0038a2b971c  munit-fbbdf1467eb0d04a6ee465def2e529e4c87f2118.tar.gz
"
