# Maintainer: David Heidelberg <david@ixit.cz>
pkgname=libdrm-grate
pkgver=2.4.100_git20191221
pkgrel=1
pkgdesc="Userspace interface to kernel DRM services"
url="https://github.com/grate-driver/libdrm"
arch="armhf armv7"
# Requires a computer with gfx, no X running, build user in 'video' group..
options="!check"
license="MIT"
depends_dev="linux-headers"
provides="libdrm"
makedepends="$depends_dev meson libpthread-stubs eudev-dev libpciaccess-dev xmlto"
checkdepends="cunit-dev bash"
subpackages="$pkgname-dev $pkgname-doc"
_commit="fb342d0d78446f5f8898d8676fa986610d01c766"
source="$pkgname-$_commit.tar.gz::https://github.com/grate-driver/libdrm/archive/$_commit.tar.gz
	ioctl.patch
	"

_pkgname=libdrm
builddir="$srcdir/$_pkgname-$_commit"

build() {
	meson \
		-Dprefix=/usr \
		-Dfreedreno=true \
		-Dtegra=true \
		-Detnaviv=true \
		-Dudev=true \
		. build
	ninja -C build
}

check() {
	cd "$builddir"/build
	meson test
}

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

dev() {
	default_dev

	provides="libdrm-dev"
}

sha512sums="90618e48589bb74a5846c991f51cb53f0e483124db6c05a4dafafc2d63c3763972ef24dc62a4f2244c0ba23828894f7040111ba9f60421fc7ce19d19e726312a  libdrm-grate-fb342d0d78446f5f8898d8676fa986610d01c766.tar.gz
af52fef51aaa05a4dd17919371cb9d92a77480402730bf53ba223e54df52f3825be05a7f28e6aef8c904db5ee59fe38a6c15bc6aafa7f8d31a719e80399dd51f  ioctl.patch"
