# Maintainer: Robert Yang <decatf@gmail.com>
pkgname=xf86-video-opentegra
# FIXME: this package does not build anymore (#339)!
# When fixing this, also set a proper pkgver (see !565):
# pkgver=0.6.0_git20190323
pkgver=0.6.0
pkgrel=2
pkgdesc="X.Org driver for NVIDIA tegra"
url="https://github.com/grate-driver/"
arch="armhf armv7"
license="MIT"
subpackages="$pkgname-doc"
depends="libdrm-grate"
makedepends="libdrm-grate-dev xorg-server-dev xproto fontsproto util-macros
	libtool m4 automake autoconf bison flex"
_commit="bf853ada6d906ca1e983c1965995102ae1ccfccc"
source="
	https://github.com/grate-driver/xf86-video-opentegra/archive/$_commit.tar.gz
	Guard-malloc_trim-with-__GLIBC__.patch
	"
builddir="$srcdir"/$pkgname-$_commit

prepare() {
	default_prepare

	export PKG_CONFIG_PATH="/usr/lib/pkgconfig/libdrm-grate:${PKG_CONFIG_PATH}"
	export LDFLAGS="$LDFLAGS -Wl,-z,lazy"

	./autogen.sh \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
}

build() {
	cd "$builddir"
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

sha512sums="7de5fc0e93a46bf8c5f2f04ef144ef2442b117e2260c7fea277dbec050c4fd2124e7a0fd640591ac3192c5be6ca61f79b44a5884fed0c6f6c900f20f29d124e9  bf853ada6d906ca1e983c1965995102ae1ccfccc.tar.gz
3e3cced887a73d865ee03cf030dbe2dd2035e29e3e771d79a95491c6e59a02570e273fc7fec67b87b0bf2008ab97212252bb9ed31bd6137b78d1bbbeda467fec  Guard-malloc_trim-with-__GLIBC__.patch"
