# Maintainer: Martijn Braam <martijn@brixit.nl>
pkgname=firmware-motorola-osprey
pkgver=1
pkgrel=0
pkgdesc="Firmware for Motorola Moto G 2015"
url="https://github.com/pmsourcedump/firmware-motorola-osprey"
subpackages="$pkgname-wcnss $pkgname-venus $pkgname-modem"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck"

_commit="a47c5a1c2dd806226c61305c9c97135f2734d0c7"
source="$pkgname-$_commit.tar.gz::https://github.com/pmsourcedump/firmware-motorola-osprey/archive/$_commit.tar.gz"

_fwdir="/lib/firmware/postmarketos"

package() {
	mkdir -p "$pkgdir"
}

wcnss() {
	pkgdesc="Motorola Moto G 2015 Wi-Fi/Bluetooth firmware"
	cd "$srcdir/firmware-motorola-osprey-$_commit"
	install -Dm644 wcnss.* -t "$subpkgdir/$_fwdir"
	install -Dm644 wlan/prima/WCNSS_qcom_wlan_nv.bin -t "$subpkgdir/$_fwdir/wlan/prima"
}

venus() {
	pkgdesc="Motorola Moto G 2015 video firmware"
	cd "$srcdir/firmware-motorola-osprey-$_commit"
	install -Dm644 venus.b* -t "$subpkgdir/$_fwdir/qcom/venus-1.8"
	install -Dm644 venus.mdt -t "$subpkgdir/$_fwdir/qcom/venus-1.8"
}

modem() {
	pkgdesc="Motorola Moto G 2015 modem firmware"
	cd "$srcdir/firmware-motorola-osprey-$_commit"
	install -Dm644 modem.* -t "$subpkgdir/$_fwdir"
	install -Dm644 mba.mbn -t "$subpkgdir/$_fwdir"
}

sha512sums="7e8d02baa8864c50b4a8be1f9af830e8b5440eee61a012725ed114d93012f0fb19ec005908832d3c96e0ba54b51a5ec7bcf137bfcc64c63594212f2497604629  firmware-motorola-osprey-a47c5a1c2dd806226c61305c9c97135f2734d0c7.tar.gz"
