# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-sony-yuga
pkgver=3
pkgrel=1
pkgdesc="Sony Xperia Z"
url="https://postmarketos.org"
arch="armv7"
license="MIT"
depends="postmarketos-base mkbootimg"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-kernel-downstream:kernel_downstream
	$pkgname-kernel-mainline:kernel_mainline
"
source="deviceinfo 90-android-touch-dev.rules"
options="!check !archcheck"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
	install -D -m644 "$srcdir"/90-android-touch-dev.rules \
		"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules

	# Disable v4l (video4linux), because without the camera firmware
	# blobs this makes dev hang with the kernel this device uses (#1033)
	ln -s /dev/null "$pkgdir"/etc/udev/rules.d/60-persistent-v4l.rules
}

kernel_downstream() {
	pkgdesc="LineageOS downstream kernel (recommended)"
	depends="linux-sony-yuga msm-fb-refresher"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline() {
	pkgdesc="Close to mainline; do not use - only for development!"
	depends="linux-postmarketos-qcom-apq8064"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="Wifi firmware"
	depends="firmware-sony-fusion3"
	mkdir "$subpkgdir"
}

sha512sums="
ed2a1880bb0249148c7a069a6ea17f1666c41787106b308b228747bf2546fa8fe9a8fca16a6f7b0d88b9bcc91485784e6c0beb4187f85e7996fbfd259f940efa  deviceinfo
8b6034c0338ab4c7d648f47983aad6da07e427e7dba47baabf85a1b3ddeeda47c8d7fbcd547a302c9a759b2943ee30d3e82c3b368d8582833a058e4671638a9e  90-android-touch-dev.rules
"
