# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-sagit
pkgdesc="Xiaomi Mi 6"
pkgver=2
pkgrel=4
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	mkbootimg
	postmarketos-base
	linux-postmarketos-qcom-msm8998
	soc-qcom-sdm845
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	modules-initfs
	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="
36b7ac99f4e24bc2bcf08f12f129b6be48c0b390e6ceafc577b6632929eeef45a374f9cf8cdd7ae81fbe8c5e58e5f7cfd9b6e578c064f3bd6ba723b213ca24ba  deviceinfo
1a58c96c0c73569eea2691e0dc817c3ab8e5e284049458c18d1db499dd1047e519b11f54331ab01ea8eedb824988cea51a41af19c079a54e8dbe42bd61dd37e6  modules-initfs
2288f08a44aae5136c0c0c846501c2bd4bcb10f05454b40c6e4490d398385b8a7129216047b5eb7982ca6d62d3aa71f3e18bfb8661d0cd32c8a600685ca0da48  phoc.ini
"
