pkgname=firmware-samsung-j5nlte
pkgver=1
pkgrel=0
pkgdesc="Firmware for Samsung Galaxy J5 2015 (SM-J500FN)"
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-J500FN.tar.xz"

_fwdir="/lib/firmware/postmarketos"

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

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

venus() {
	pkgdesc="Samsung Gelaxy J5 2015 (SM-J500FN) video firmware"
	install -Dm644 "$srcdir"/venus.* -t "$subpkgdir/$_fwdir"/qcom/venus-1.8
}

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

sha512sums="9f332156ca2a72ebf2ffdc741f55dfa3788c51e356e6ad3cc524b2b337f51fa3b24cd0cbbe84118cb0df8916dedb6b0520ee3d2f103e1b8f97c5be1fb2c463a4  SM-J500FN.tar.xz"
