# Maintainer: Minecrell <minecrell@minecrell.net>
pkgname=soc-qcom-msm8916
pkgdesc="Common package for Qualcomm MSM8916 devices"
pkgver=10
pkgrel=1
url="https://postmarketos.org"
license="BSD-3-Clause"
arch="aarch64 armv7"
options="!check !archcheck !tracedeps pmb:cross-native"
depends="mesa-dri-gallium $pkgname-ucm"
subpackages="$pkgname-ucm $pkgname-modem"

_ucm_commit="66d2d458458b975fa3bf8e657bbd34b2db4b6b77"
source="$pkgname-$_ucm_commit.tar.gz::https://github.com/msm8916-mainline/alsa-ucm-conf/archive/$_ucm_commit.tar.gz
	q6voiced.conf
	"

package() {
	# parent package is empty
	mkdir -p "$pkgdir"
}

# Upstream keeps making breaking changes to UCM in patch releases.
# My last upstreaming efforts failed without ever getting a reply,
# since then UCM was entirely reworked like 3 times already...
# I don't want to fix this up every few months, so let's package a stable
# version for now. Once all the UCM refactoring upstream has settled down a bit
# we can investigate how to integrate it properly for upstreaming.
ucm() {
	provides="alsa-ucm-conf"

	cd "$srcdir/alsa-ucm-conf-$_ucm_commit"
	mkdir -p "$subpkgdir"/usr/share/alsa
	cp -r ucm2 "$subpkgdir"/usr/share/alsa
}

modem() {
	depends="msm-modem-rpmsg q6voiced"
	install="$subpkgname.post-install"

	install -Dm644 q6voiced.conf "$subpkgdir"/etc/conf.d/q6voiced
}

sha512sums="e00b637b9f0756f73e1d43189d2dceec22a3b21193f6649de32689d1eea3d6c96ad6c1665fb5c82d6beee6cb341d5b84e36ae04e9b780093700715db9688b54f  soc-qcom-msm8916-66d2d458458b975fa3bf8e657bbd34b2db4b6b77.tar.gz
3a4a9322839d4b3ef9d79668a37840a9f444954759ae3c512e694051d2f9a2573db42ad6c4c1a5c75eeb861232a27ba1a8cef9b503decd54ead25a96e3dd6f98  q6voiced.conf"
