# Reference: <https://postmarketos.org/devicepkg>
maintainer="Raymond Hackley <wonderfulShrineMaidenOfParadise@postmarketos.org>"
pkgname=device-samsung-fortuna
pkgdesc="Samsung Galaxy Grand Prime"
pkgver=10
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	firmware-qcom-adreno-a300
	mkbootimg
	msm-firmware-loader
	postmarketos-base
	soc-qcom-msm8916
	soc-qcom-msm8916-rproc
"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-kernel-fortuna3g:kernel_fortuna3g
	$pkgname-kernel-gprimeltecan:kernel_fortuna3g
	$pkgname-kernel-grandprimelte:kernel_grandprimelte
"
source="deviceinfo kernel-cmdline.conf modules-initfs"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

kernel_fortuna3g() {
	pkgdesc="$pkgdesc (SM-G530H)"
	depends="
		$pkgname=$pkgver-r$pkgrel
		firmware-samsung-fortuna3g-wcnss-nv
		linux-postmarketos-qcom-msm8916
	"

	# Backwards compatibility for old device package name
	local _old_pkgname="device-samsung-fortuna3g"
	replaces="$_old_pkgname"
	provides="$_old_pkgname=$pkgver-r$pkgrel"

	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_gprimeltecan() {
	pkgdesc="$pkgdesc (SM-G530W)"
	depends="
		$pkgname=$pkgver-r$pkgrel
		firmware-samsung-gprimeltecan-wcnss-nv
		linux-postmarketos-qcom-msm8916
	"

	# Backwards compatibility for old device package name
	local _old_pkgname="device-samsung-gprimeltecan"
	replaces="$_old_pkgname"
	provides="$_old_pkgname=$pkgver-r$pkgrel"

	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_grandprimelte() {
	pkgdesc="$pkgdesc (SM-G530FZ)"
	depends="
		$pkgname=$pkgver-r$pkgrel
		firmware-samsung-grandprimelte-wcnss-nv
		linux-postmarketos-qcom-msm8916
	"

	# Backwards compatibility for old device package name
	local _old_pkgname="device-samsung-gprimeltexx"
	replaces="$_old_pkgname"
	provides="$_old_pkgname=$pkgver-r$pkgrel"

	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

sha512sums="
3ebc5acc8d86c6e29df634243e6df06884e48f8e9ad3f5c60be00ab89228897d38a2f448f4a8367fb5175c04c6496a0dc9068a8f0b4ff223b09b6fdeb3192b2d  deviceinfo
37e1e5f8839b624ab3eb850a24ed4daeb61a651257a1fb593f49cb869323e5d1b339c831a18eb26a9d7bd0a618ea9eb2bb9bf3882133af5f2606a878e6d39c67  kernel-cmdline.conf
02b6d383149ba2ec3a31b206767be7ead31d9f0e7ee5cab11047000c53ccad387a118cbddb06093bca5cae3e82f884c02194de47b8e7a9c76102ac46506bb111  modules-initfs
"
