# Maintainer: Svyatoslav Ryhel <clamor95@gmail.com>
# Reference: <https://postmarketos.org/devicepkg>

pkgname=device-lg-p895
pkgdesc="LG Optimus Vu"
pkgver=2
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
	alsa-ucm-conf
	libvdpau-tegra
	linux-postmarketos-grate
	mkbootimg
	postmarketos-base
"
makedepends="
	devicepkg-dev
"
source="
	deviceinfo
	pointercal
"
subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-x11
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname

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

nonfree_firmware() {
	pkgdesc="LG Optimus X3 WiFi & BT firmware"
	depends="firmware-lg-x3"
	mkdir "$subpkgdir"
}

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

sha512sums="
2acc5f6d4dd02216b143b3023100ceae0d4eda25df82f33e73d9adcfc7e05f046eff21e242e644dce12fde689c6477e2615b45e2ed5f0633ad570916c06f4c00  deviceinfo
de3c2db575a7c67adfd4f26700642e8fa0b912cb074dcc92778f620574e2f5e6dadcd4b05d13a2968668f943cc01557924c31b40f6fce3ce9002a3dcd55f423f  pointercal
"
