# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-sagit
pkgdesc="Xiaomi Mi 6"
pkgver=2
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	mkbootimg
	postmarketos-base
	postmarketos-update-kernel
	linux-postmarketos-qcom-msm8998
	soc-qcom-sdm845
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	phoc.ini
"
subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-phosh
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

nonfree_firmware() {
	pkgdesc="Firmware for GPU, Wi-Fi, Bluetooth etc. (mainline only, also needed for osk-sdl)"
	depends="firmware-xiaomi-sagit"
	mkdir "$subpkgdir"
}

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

sha512sums="
dfcb291b1ce1ab9fd0074e544fe05f36db67c526c3f4d34fa287b514e8cd1f46a0a2d76ed396f23bb5e5dc04d45a07f0bed71d1693317799865dbd2436af6cef  deviceinfo
2288f08a44aae5136c0c0c846501c2bd4bcb10f05454b40c6e4490d398385b8a7129216047b5eb7982ca6d62d3aa71f3e18bfb8661d0cd32c8a600685ca0da48  phoc.ini
"
