pkgname=firmware-samsung-j53g
pkgver=1
pkgrel=0
pkgdesc="Firmware for Samsung Galaxy J5 2015 (SM-J500H)"
url="https://pepethekingprawn.gitlab.io/firmware/"
subpackages="$pkgname-modem $pkgname-venus $pkgname-wcnss"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck"
_repository="j53g_firmware"
_commit="70035cb2197bfe99f2d728675ee0c4e295b86d07"
source="$pkgname-$_commit.tar.gz::https://github.com/nergzd723/$_repository/archive/$_commit.tar.gz"

_fwdir="/lib/firmware/postmarketos"

builddir="$srcdir/$_repository-$_commit"
package() {
	# parent package is empty
	mkdir -p "$pkgdir"
}

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

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

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

sha512sums="96b6da87c5ba67fd053a4c21a2bcc82faa39508d28793f18a9fee2f6b8dd4b0e904b65e98c366dbb76777853c1d936d0cd347bc6cf8c5ca12308a4d6c99b32f3  firmware-samsung-j53g-70035cb2197bfe99f2d728675ee0c4e295b86d07.tar.gz"
