# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: Minecrell <minecrell@minecrell.net>
# Co-Maintainer: Alexey Min <alexey.min@gmail.com>
pkgname=device-samsung-a5
pkgdesc="Samsung Galaxy A5 (2015)"
pkgver=10.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base mkbootimg linux-postmarketos-qcom-msm8916
	 soc-qcom-msm8916 soc-qcom-msm8916-rproc soc-samsung-msm8916-modem-workaround"
makedepends="devicepkg-dev"
source="deviceinfo"
subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
"
_pmb_select="soc-qcom-msm8916-rproc"

# Backwards compatibility for old device package names + kernel variants
_substitutes="device-samsung-a5lte device-samsung-a5ulte"
replaces="$_substitutes $pkgname-kernel-mainline $pkgname-kernel-mainline-modem"
for pkg in $_substitutes; do replaces="$replaces $pkg-kernel-mainline $pkg-kernel-mainline-modem"; done
for pkg in $replaces; do provides="$provides $pkg=$pkgver-r$pkgrel"; done

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

nonfree_firmware() {
	pkgdesc="GPU/WiFi/BT/Modem/Video firmware"
	depends="firmware-qcom-adreno-a300 msm-firmware-loader firmware-samsung-a5-wcnss-nv"
	replaces=""
	for pkg in $_substitutes; do replaces="$replaces $pkg-nonfree-firmware"; done
	for pkg in $replaces; do provides="$provides $pkg=$pkgver-r$pkgrel"; done
	mkdir "$subpkgdir"
}

sha512sums="
6af9b3ef868bfc398e645746bf1e95829eb0900bd78b8b7f68bf1eae8248f70a49287f49bc79deaf690b6a3b73c899c120518006f9552693b6d8a123b5641354  deviceinfo
"
