# Maintainer: vipaoL <vipaolmail@gmail.com>

pkgname=firmware-xiaomi-markw
pkgver=1
pkgrel=0
pkgdesc="Firmware files for Xiaomi Redmi 4 Prime (markw)"
url="https://gitlab.com/vipaoL/firmware-xiaomi-markw"
arch="aarch64"
depends="firmware-xiaomi-markw-initramfs"
license="proprietary"
options="!strip !check !archcheck !spdx !tracedeps pmb:cross-native"

_commit="8cc7f7d9e56aa9fa0193403b694115d759eafaf2"

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

package() {
	cd "$srcdir/$pkgname-$_commit/"
	while IFS="" read -r _i || [ -n "$_i" ]; do
		[ ! -d $(dirname $_i) ] && mkdir -p $(dirname $_i)
		install -Dm644 $_i "$pkgdir/$_i"
	done < "$srcdir/firmware.files"
}

firmware_initramfs() {
	mkdir "$subpkgdir"
	install -Dm644 "$srcdir"/30-gpu-firmware.files -t \
		"$subpkgdir"/usr/share/mkinitfs/files
}

sha512sums="
f57ec60776f0cfd89ccc0f4a561aa261367b299796b4a9121814c560eab7a28b3049a3defcc129942098b88937fad8f6c3bbf2d1ac7d89d4175c8ec4014c1a8a  firmware-xiaomi-markw.tar.gz
da36a1dee69c3dd2bbd5557a547b93ab23a2e8993fe1c735ebd25cc6258b54e981daca9d3461c848835e623f7c7694c73bcb05527170ab3ea171049d5352c703  firmware.files
302c0bec754bb79ef561c1a8d4ff34ba52b904c853bce6a15a79ba7b5b7a3d02c1c75bbe86d59be7b608a6dc744dd3e3c638eaa4539c53d20fa55fa5ea397d74  30-gpu-firmware.files
"
