# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Jonathan Albrieux <jonathan.albrieux@gmail.com>
# Co-Maintainer: Minecrell <minecrell@minecrell.net>
pkgname=device-bq-paella
pkgdesc="BQ Aquaris X5"
pkgver=3
pkgrel=5
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base mkbootimg soc-qcom-msm8916"
makedepends="devicepkg-dev"
source="deviceinfo"
subpackages="
	$pkgname-kernel-mainline:kernel_mainline
	$pkgname-kernel-mainline-modem:kernel_mainline_modem
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-nonfree-firmware-modem:nonfree_firmware_modem
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

kernel_mainline() {
	pkgdesc="Close to mainline kernel (no modem, audio routed directly)"
	depends="linux-postmarketos-qcom-msm8916"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline_modem() {
	pkgdesc="Close to mainline kernel (non-free modem, audio routed through ADSP)"
	depends="linux-postmarketos-qcom-msm8916 soc-qcom-msm8916-modem"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="GPU/WiFi/BT/Video(/Modem) firmware"
	depends="linux-firmware-qcom firmware-bq-picmt-venus
		 firmware-qcom-msm8916-wcnss firmware-bq-picmt-wcnss-nv"
	mkdir "$subpkgdir"
}

nonfree_firmware_modem() {
	pkgdesc="Modem firmware"
	depends="firmware-bq-picmt-modem"
	install_if="$pkgname-nonfree-firmware $pkgname-kernel-mainline-modem"
	mkdir "$subpkgdir"
}

sha512sums="
0d766c480ca6c5b0d91610fd33a1269b6ecf8a30fed4366ea1988bdc6398ee3a5a0551e20976a43913a636dc3e27d2e13a7960ae92cd4f268421654cd1a0aaad  deviceinfo
"
