# Maintainer: Svyatoslav Ryhel <clamor95@gmail.com>
# Co-Maintainer: Ion Agorria

pkgname=device-asus-tf201
pkgdesc="Asus Transformer Prime TF201"
pkgver=4
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
	alsa-ucm-conf
	asus-transformer-blobtools
	libvdpau-tegra
	linux-postmarketos-grate
	mkbootimg
	postmarketos-base
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	pointercal
	phoc.ini
"
subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-phosh
	$pkgname-x11
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname

	# osk-sdl touchscreen calibration
	install -Dm644 "$srcdir"/pointercal \
		"$pkgdir"/etc/pointercal
}

phosh() {
	install_if="$pkgname=$pkgver-r$pkgrel postmarketos-ui-phosh"
	install -Dm644 "$srcdir"/phoc.ini \
		"$subpkgdir"/etc/phosh/phoc.ini
}

nonfree_firmware() {
	pkgdesc="Asus Transformers WiFi & BT firmware"
	depends="firmware-asus-transformer"
	mkdir "$subpkgdir"
}

x11() {
	install_if="$pkgname=$pkgver-r$pkgrel xorg-server"
	depends="xf86-video-opentegra"
	mkdir "$subpkgdir"
}

sha512sums="
5c8652e181c741002aafa2ca714ee169172ad83fe8d8d0156176ed253d40381a90e3868737ae7b2fefc107277ce80d68553dbe8a985ecb4747fa43e0fd63fe6f  deviceinfo
dcb4e5b6b808205811d9e4f8d5dfa88ff357eb98a8e73ebe46c5cb22f1d2addfc49e552a93bfe678e91467907032676cf7602d418463a20da245b2dbdb494b78  pointercal
a68de5e4d219b2d0746542e768db02b3240d56c977f0aa4cedd09b25933845e3ad0410439a5b47321d8a071b93620c002785fd4e51be06222c754feacac4f382  phoc.ini
"
