# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-htc-m8
pkgdesc="HTC One M8"
pkgver=1
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="
	mkbootimg
	postmarketos-base
"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-kernel-downstream:kernel_downstream
	$pkgname-kernel-mainline:kernel_mainline
	$pkgname-nonfree-firmware:nonfree_firmware
"
source="
	deviceinfo
	initfs-hook.sh
	90-android-touch-dev.rules
"

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
}

kernel_downstream() {
	pkgdesc="Downstream kernel"
	depends="linux-htc-m8 msm-fb-refresher"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline() {
	pkgdesc="Close to mainline kernel"
	depends="linux-postmarketos-qcom-msm8974"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="Wifi firmware"
	depends="firmware-htc-m8"
	mkdir "$subpkgdir"
}

sha512sums="
596b3e77947cffe9c20d8e679aca1e8620b41dd9f516a6625fbf4985eefcf875eec246d32ae2f9943aed0c0fc98c84c56ff047a9ea38f10e287219cf05128217  deviceinfo
765abaad5fda0dfda5e62e1e48414d3eea822198f39d0792171a04d73f86f6273a6e562afab430cbfcdd084412568a0ad03d012e9c40c5564f5cd1b9c0f181eb  initfs-hook.sh
f0f69ab3b5b3fed11ec5049f37c71c4e9dcf87dc1f238199a3917dd61957d46783a8798d63d400cc5d3983987e750e3fec6d7117561ad5005f28131ae4821d66  90-android-touch-dev.rules
"
