# Maintainer: m0rf30 <morf3089@gmail.com>
pkgname=firmware-xiaomi-tulip
pkgver=1
pkgrel=0

pkgdesc="Firmware files for Xiaomi Redmi Note 6 Pro"
url="https://github.com/M0Rf30/postmarketos-vendor-xiaomi-tulip"
arch="aarch64"
license="proprietary"
options="!strip !check !archcheck !tracedeps pmb:cross-native"

_commit="c8f750d4cdd8c5353c4aaa423f81774c63f87d27"

source="
	$pkgname-$_commit.tar.gz::$url/archive/$_commit.tar.gz
	30-gpu-firmware.files
	firmware.files"

subpackages="$pkgname-initramfs:firmware_initramfs"
builddir="$srcdir/postmarketos-vendor-xiaomi-tulip-$_commit"


package() {
	while IFS="" read -r fw; do
		install -Dm644 "$fw" "$pkgdir/lib/firmware/$fw"
	done < "$srcdir"/firmware.files
}

firmware_initramfs() {
	pkgdesc="Files to be included in the initramfs to support osk-sdl"
	depends="$pkgname mesa-egl mesa-gbm"
	install_if="$pkgname"

	install -Dm644 "$srcdir"/30-gpu-firmware.files \
		"$subpkgdir"/etc/postmarketos-mkinitfs/files/30-gpu-firmware.files
}

sha512sums="
fd36819cabb028973015587e4193642e7c36b2321181a1c3dc7631fcfe51e7e736f4679665d4e4ad2eef8ddd4fe541a8a15e93189822702e23463a43023fe549  firmware-xiaomi-tulip-c8f750d4cdd8c5353c4aaa423f81774c63f87d27.tar.gz
f4a81bc3b5fbcac001c6583f78a26b0e11787c3e2d423a72b6db1fbfab69a37f095ed303dfbcf0d6050864dbec9fcd977b9c827e4ba79e86c45491d238ea6c36  30-gpu-firmware.files
4197803672f89fb8d8a6e87ed348544dd645025fc8bbc998296e9a214fb5095edc9e1c5c5a843b06855ccec40f4ea56526c3e08a79f9220776de34593d4b12a1  firmware.files
"
