pkgname=firmware-samsung-a5lte
pkgver=2
pkgrel=0
pkgdesc="Firmware for Samsung Galaxy A5 (SM-A500F)"
url="https://pepethekingprawn.gitlab.io/firmware/"
subpackages="$pkgname-modem $pkgname-venus $pkgname-wcnss"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck"
source="https://pepethekingprawn.gitlab.io/firmware/SM-A500F.tar.xz"

_fwdir="/lib/firmware/postmarketos"

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

modem() {
	pkgdesc="Samsung Galaxy A5 (SM-A500F) modem firmware"
	install -Dm644 "$srcdir"/mba.mbn -t "$subpkgdir/$_fwdir"
	install -Dm644 "$srcdir"/modem.* -t "$subpkgdir/$_fwdir"
}

venus() {
	pkgdesc="Samsung Galaxy A5 (SM-A500F) video firmware"
	install -Dm644 "$srcdir"/venus.* -t "$subpkgdir/$_fwdir"/qcom/venus-1.8
}

wcnss() {
	pkgdesc="Samsung Galaxy A5 (SM-A500F) WiFi/BT firmware"
	cd "$srcdir"
	install -Dm644 wcnss.* -t "$subpkgdir/$_fwdir"
	install -Dm644 WCNSS_* -t "$subpkgdir/$_fwdir"/wlan/prima
}

sha512sums="08421f2788eb873b4c4440c09da6732065233075e99a37b25932112297e036443664b5a9c19bb11f03da68618e065ce7638b41f80a2ad6a295a1375137a20405  SM-A500F.tar.xz"