pkgname=firmware-asus-z010d
pkgver=1
pkgrel=1
pkgdesc="Firmware for Asus Zenfone Max ZC550KL"
url="https://gitlab.com/camillathechicken/firmware-max"
subpackages="$pkgname-modem $pkgname-venus $pkgname-wcnss"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck"

_tag="v0.1"
_repo="firmware-max"

source="$pkgname-$_tag.tar.gz::https://gitlab.com/camillathechicken/$_repo/-/archive/$_tag/$_repo-$_tag.tar.gz"
builddir="$srcdir/$_repo-$_tag"

_fwdir="/lib/firmware/postmarketos"

package() {
	# parent package is empty
	mkdir -p "$pkgdir"
}

modem() {
	pkgdesc="Asus Zenfone Max ZC550KL modem firmware"
	install -Dm644 "$builddir"/mba.mbn -t "$subpkgdir/$_fwdir"
	install -Dm644 "$builddir"/modem.* -t "$subpkgdir/$_fwdir"
}

venus() {
	pkgdesc="Asus Zenfone Max ZC550KL video firmware"
	install -Dm644 "$builddir"/venus.* -t "$subpkgdir/$_fwdir"/qcom/venus-1.8
}

wcnss() {
	pkgdesc="Asus Zenfone Max ZC550KL WiFi/BT firmware"
	cd "$builddir"
	install -Dm644 wcnss.* -t "$subpkgdir/$_fwdir"
	install -Dm644 WCNSS_* -t "$subpkgdir/$_fwdir"/wlan/prima
}

sha512sums="870c4835de86aac68f29249d6f1545dc8b9ccdb4c3a19ed19eb3429c5d0ab40ed3ffceba36bf54b69a9e3ca2170fde66b2e357a8686580865bfa38e8b99e0cd6  firmware-asus-z010d-v0.1.tar.gz"
