# Maintainer: Svyatoslav Ryhel <clamor95@gmail.com>

pkgname=device-asus-tf300tg
pkgdesc="Asus Transformer Pad 3G TF300TG"
pkgver=2
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="
fe051ecca0a74dbde0195daed9602152fe20149d286694c3b37e03806f0fcf7700ed343cc2431c9ff92a8a19a0c4d9a0f7ef6478736f78de839239cda1f37b1a  deviceinfo
d4270d13750b4c63a2f02a31ef42d00496ae71fc2c9cb8a7505da41d343911df353ff9150136f5cef143bf844024fee096f751ec0fa18589fae51dc30b1063c6  pointercal
a68de5e4d219b2d0746542e768db02b3240d56c977f0aa4cedd09b25933845e3ad0410439a5b47321d8a071b93620c002785fd4e51be06222c754feacac4f382  phoc.ini
"
