# Forked from Alpine to add Qualcomm SSC support with libssc
maintainer="Dylan Van Assche <me@dylanvanassche.be>"
pkgname=iio-sensor-proxy
_pkgver=3.8
pkgver=9999$_pkgver
pkgrel=5
pkgdesc="IIO sensors to D-Bus proxy"
url="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy"
arch="aarch64"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="
	eudev-dev
	glib-dev
	libgudev-dev
	meson
	polkit-dev
	libssc-dev>=0.2.1
	"
subpackages="$pkgname-openrc $pkgname-systemd $pkgname-udev"
builddir="$srcdir/$pkgname-$_pkgver"
source="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/archive/$_pkgver/iio-sensor-proxy-$_pkgver.tar.gz
	iio-sensor-proxy.initd
	system-iio-sensor-proxy.service.d-hexagonrpcd.conf
	0001-iio-sensor-proxy-depend-on-libssc.patch
	0001-WIP-iio-sensor-proxy.c-Do-not-exit-based-on-sensor-e.patch
	0002-proximity-support-SSC-proximity-sensor.patch
	0003-light-support-SSC-light-sensor.patch
	0004-accelerometer-support-SSC-accelerometer-sensor.patch
	0005-compass-support-SSC-compass-sensor.patch
	0006-data-add-libssc-udev-rules.patch
	0007-data-iio-sensor-proxy.service.in-add-AF_QIPCRTR.patch
	0008-drv-ssc-implement-set_polling.patch
	0009-tests-integration-test-add-SSC-sensors.patch
	0010-fixup-data-add-libssc-udev-rules.patch
	0013-integration-test-add-test-for-sensors-that-report-no.patch
	"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dssc-support=true \
		-Dsystemdsystemunitdir=/usr/lib/systemd/system \
		. output
	meson compile -C output
}

check() {
	meson test --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname

	install -Dm644 "$srcdir"/system-iio-sensor-proxy.service.d-hexagonrpcd.conf \
		"$pkgdir"/usr/lib/systemd/system/iio-sensor-proxy.service.d/hexagonrpcd.conf
}

sha512sums="
9cca8d706c531c9a2e34dfebdc8673a1765b615533e3f7776118c74cb1ce145e472203c6c7804d35701c22cc93755609829bc3817c5920d5961249d7e8de87c6  iio-sensor-proxy-3.8.tar.gz
b25df94e249ca46fe96926e5a866c20dc913fa52a2d9259fb7a3594861c6b2f246fc7fef8a21f5b021f3a71401f734ae27210137b0b1917a7daaffb5e3221f2e  iio-sensor-proxy.initd
2e8a876b61093add48e0677dcbfdac148690eddb398ff51ab4edb6547515ad8f8cfec31e8fda6886746b3bf30410b7b63c7486dcfe2441a7e742ea5023981a45  system-iio-sensor-proxy.service.d-hexagonrpcd.conf
d46eeb1deabb6ee6017b86f573fcb717d8b992979bfd447e52c6dabc95d9e6c986ab937f602c2f0a731d10d87d67578aa59930d7faff69b2f42a0eab25f4c60c  0001-iio-sensor-proxy-depend-on-libssc.patch
4b43ea53b71c9be29367897a3c9ba349e9fdb71185300aafc00be69f923d7f27aa02bb7f0f5c5be800f0d494035992e046c010fd70a1754f8a47701b17666926  0001-WIP-iio-sensor-proxy.c-Do-not-exit-based-on-sensor-e.patch
59800fbd73abd77c6cf86ab1bcdce85abefb07e3cd28d58c3e91a4b3cdd9d893a9671e8f0f3dc212064d5744a62b0b24c54fa91ce8f3ac84e361f7ba8cc64ded  0002-proximity-support-SSC-proximity-sensor.patch
7cdcd1d78629f662fa588c90e657c6abed7e43f1462c43f0d14e7756933ea927435077e193429d069b7360ba2d1c16b608226e1707858e56460c82595f054080  0003-light-support-SSC-light-sensor.patch
a956d28d55ee0e0a03bea63caf06881ead7511ac60000a5def61d482b3575006575edd6b0b30ae7874ffd9b2268fd8008a273d6ede561cc44aad46f18233d789  0004-accelerometer-support-SSC-accelerometer-sensor.patch
d4379f8e53eea02f53640752bef883870a44d0169cf821d3f5bb3245309cac1d1502a7848d5cce60d40bcdd484c9baa1f63f60d887613ad25a5ca88721d7c4c8  0005-compass-support-SSC-compass-sensor.patch
4651572ada878fd07ba281426b4cf4b9baf19d8464fd3af1a1c1a98765bcf358d1d445bdef53acd3bf30b1d2c8c234489e96f728d9228e3681e5038f10059573  0006-data-add-libssc-udev-rules.patch
376999144da2c5a6374de73bfaaf0eb605c5c686640f4de8cbcabbe3e78f3fce4675d5bfdc2dd60dacaa84447a039cf22cc4e5fcda478ea77a00001f052a3d85  0007-data-iio-sensor-proxy.service.in-add-AF_QIPCRTR.patch
bf0ea8a078eb168937645a661fea5b979bf1747ee0c1cd556a238c25f4f26eefd6b2f7a1da1eb0b7d66dcafe24ce31521d71e1a188a324671b08178b392206af  0008-drv-ssc-implement-set_polling.patch
2a208aa064e4f3d6cb24701f65c5cdc5d35a99f61489ac0ab5f336aa8229bc1aa7571b6d7e928a3a28e53b8e35a07655ec3e8b432d7295d82606f8b1f206e7af  0009-tests-integration-test-add-SSC-sensors.patch
4f2d227efb645ce01f4ce997b2923d4a5b12a5d896c47b7e6189fd76abcae4659d5d1fb71608ce4809b19ac5a1129176c81063097826a4a19bc35ed5099537cb  0010-fixup-data-add-libssc-udev-rules.patch
9273f01d35e0f45ddc943808326d87f3a2e678ea29e607d3d70cabc9ea321db761cc170a86b3093553a4c3dfae1d81c5057d146b9a90ff490c85641f02b040df  0013-integration-test-add-test-for-sensors-that-report-no.patch
"
