# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=libdrm
pkgver=2.4.100
pkgrel=0
pkgdesc="Userspace interface to kernel DRM services"
url="https://dri.freedesktop.org/"
arch="all"
# Requires a computer with gfx, no X running, build user in 'video' group..
options="!check"
license="MIT"
depends=""
depends_dev="linux-headers"
checkdepends="bash cunit-dev"
makedepends="$depends_dev bash eudev-dev libpciaccess-dev libpthread-stubs
	xmlto"
subpackages="$pkgname-dev $pkgname-doc"
source="https://dri.freedesktop.org/$pkgname/$pkgname-$pkgver.tar.bz2
	ioctl.patch
	"

build() {
	case $CARCH in
	arm*|aarch64*) _arch_conf="--enable-omap-experimental-api
		--enable-exynos-experimental-api
		--enable-tegra-experimental-api" ;;
	esac

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-udev \
		--disable-valgrind \
		$_arch_conf
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="4d3a5556e650872944af52f49de395e0ce8ac9ac58530e39a34413e94dc56c231ee71b8b8de9fb944263515a922b3ebbf7ddfebeaaa91543c2604f9bcf561247  libdrm-2.4.100.tar.bz2
af52fef51aaa05a4dd17919371cb9d92a77480402730bf53ba223e54df52f3825be05a7f28e6aef8c904db5ee59fe38a6c15bc6aafa7f8d31a719e80399dd51f  ioctl.patch"