# Reference: <https://postmarketos.org/devicepkg>
# Co-Maintainer: Casey Connolly <kcxt@postmarketos.org>
# Co-Maintainer: Dylan Van Assche <dylan@postmarketos.org>
maintainer="Alexander Martinz <amartinz@shiftphones.com>"
pkgname=device-shift-axolotl
pkgdesc="SHIFT6mq"
pkgver=25
pkgrel=1
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	alsa-ucm-conf-sdm845
	firmware-shift-sdm845>=20230815-r2
	fwupd>=1.8.6
	hexagonrpcd>=0.3.2-r3
	linux-postmarketos-qcom-sdm845
	make-dynpart-mappings
	mkbootimg
	postmarketos-base
	soc-qcom
	soc-qcom-modem
	soc-qcom-qbootctl
	systemd-boot
	unl0kr-fbforcerefresh
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	kernel-cmdline.conf
	hexagonrpcd.confd
	modules-initfs
	q6voiced.conf
	81-libssc-shift-axolotl.rules
"
subpackages="
	$pkgname-openrc
	$pkgname-pmtest
"
replaces="device-shift-axolotl-nonfree-firmware"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname

	install -Dm644 "$srcdir"/81-libssc-shift-axolotl.rules \
		-t "$pkgdir"/usr/lib/udev/rules.d/
	install -Dm644 "$srcdir"/q6voiced.conf \
		-t "$pkgdir"/usr/share/q6voiced/
	install -Dm644 "$srcdir"/hexagonrpcd.confd \
		"$pkgdir"/usr/share/hexagonrpcd/hexagonrpcd-sdsp.conf
}

openrc() {
	default_openrc
	replaces="device-shift-axolotl-nonfree-firmware-openrc"
	install="$subpkgname.post-install $subpkgname.post-upgrade"
	depends="hexagonrpcd-openrc"

	mkdir -p "$subpkgdir"
}

pmtest() {
	depends="postmarketos-test-bootrr qrtr firmware-shift-sdm845 postmarketos-test-unl0kr"
	install_if="$pkgname=$pkgver-r$pkgrel postmarketos-mkinitfs-hook-ci"

	mkdir -p "$subpkgdir"
}

sha512sums="
7304e795a2969d251110b223a29acbaaf42811522f50b42cb6dae03afff697845c8af9be04f312137e8c4973092f87b0eb6ba5650c6086e277df171c0610303f  deviceinfo
f16e550f623522be29027954c69a956eb6543f2f608a4c6b37c1a3983403a3edaa24e70aa42dbe88e76216991aba867b48c7341c9b8a81f675902d6223937b51  kernel-cmdline.conf
5966325963a3a62c919b5f39f7bc56e1785f192f50c40a6cc644a2fea0c9b8dd083e287ef43c59c2b9cab5c88d65266b0cd9cf1f5110924950bd250be5385622  hexagonrpcd.confd
a7a86b0ac85f2080d9001b2ec117897fa1d474106bebc25f59123d9f6c4ac8f70bff863c0bf7f28cb8379af6baa8778d1716dfe6ccf30b705488e70d3c71b661  modules-initfs
2a3cbdad5aa91181d24a4e56e63986af6accf887c64fa4d1b6ddad1926e29050243c4b1e2fd892d38ca7c16e24dff8545a16552e5749ae31b6d01bf428468e51  q6voiced.conf
3bd3a82b88a7aca4e2df2f5522cee7a98d017994f1dc1a965a7e386be9c17632b9cdbe013feb737dec12e99d74f54a9e4599144193bb57ec18e6d6a18c94cf1f  81-libssc-shift-axolotl.rules
"
