# Maintainer: Caleb Connolly <caleb@connolly.tech>

pkgname=firmware-oneplus-sdm845
pkgver=7
pkgrel=1
pkgdesc="Firmware for OnePlus 6 / 6T"
url="https://gitlab.com/sdm845-mainline/firmware-oneplus-sdm845"
arch="aarch64"
depends="linux-firmware-qcom linux-firmware-ath10k"
license="proprietary"
options="!check !strip !archcheck !tracedeps pmb:cross-native"

_version="895bb1c8dd0695635df354bbd713740af48e47ce"

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

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

firmware_initramfs() {
	pkgdesc="Files to be included in the initramfs to support osk-sdl"
	depends="$pkgname"
	install_if="$pkgname-nonfree-firmware"
	mkdir "$subpkgdir"

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

sha512sums="
59091452f1d6363fab0474ebc2738ec8fca6903c64837c3b6228eefb2030b0b4d5f0694770ddadf81f59f2ace4fad548459ad7a6604498aaa08a9064fb1dc736  firmware-oneplus-sdm845.tar.gz
d2295ba3346ded12e88bb1b27958418cb14ab6bb8f2c23e73a66168f53eac0cc8a10e4be28181724e92ff75ef8608c4483641e24bfd9f05c4ff7b351179ba784  firmware.files
bc6c329bf6bb9622320ab610f4f5fb944129e276855a4cf5646cb29a553f4c47cd9a4ef4305cbcd94a991471bc109b8f615cefd6871be99bf6a457fe0fa5aa19  30-gpu-firmware.files
"
