# Forked from Alpine to add Qualcomm SSC support with libssc

pkgname=iio-sensor-proxy
pkgver=9999
pkgrel=4
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.1.6
	"
subpackages="$pkgname-openrc"
_commit="fe56bdba1243cc5f6a652eb75d11ae1d1957ff7e"
builddir="$srcdir/$pkgname-$_commit"
source="https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/archive/$_commit/iio-sensor-proxy-$_commit.tar.gz
	iio-sensor-proxy.initd
	0001-iio-sensor-proxy-depend-on-libssc.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-CI-add-libssc-build.patch
	0008-data-iio-sensor-proxy.service.in-add-AF_QIPCRTR.patch
	"
# tests fail on armv7 and armhf, and it seems to be due to some weird issue
# with pmaports qemu CI (not reproducible locally with `pmb build --arch
# armv7`)
options="!check"
build() {
	abuild-meson \
		-Db_lto=true \
		-Dssc-support=true \
		-Dsystemdsystemunitdir=/no \
		. output
	meson compile -C output
}

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

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

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

sha512sums="
49b96fefbcfabb706fc6189d3f40e6e1a1e847ec6e4101398bf639db9e844c5c5057f2267f3e541d302d002d0042a84fdd56191207ed0e911f80342cd1d416c4  iio-sensor-proxy-fe56bdba1243cc5f6a652eb75d11ae1d1957ff7e.tar.gz
f695c3f6c7cad50a5da8b8df28172b4a8c0be750e3bfc93a1b80a7fe1e5a05f24fd0e5af3e0af727c05dfe3a98b3067a6ebd7617c13243b60e1e495b2b3d6987  iio-sensor-proxy.initd
3d1be8e5a932ca6ca0b908caaa7f16dcdbbc6e48a75183c1b7c225689f309203f7008f53ed4276c93790dc7dc0b2cb3c9b3f00cef84305657f279369f1307d89  0001-iio-sensor-proxy-depend-on-libssc.patch
bb8e1496411c030062eeb1bb919c9680c32d9571587540368c663b6739e3c506d21ab90836a4e83be526019e654af393dc849031ab81bb8aadff623873232d58  0002-proximity-support-SSC-proximity-sensor.patch
465f4296778b3c0269b00badd11f841c2ea9dbc14b7489b21f2e4d8e45a628fa59327c91692f8e350c926776de05173e2abc9bef54e51bf0378866ace3891152  0003-light-support-SSC-light-sensor.patch
4f6a3b76fc10eb42a4824cc49b063acc1c54a762637f7ff37a1ac42adb1410fbfe5e17b5277bb8fcb4d232b94971cf96c61925f4c207c9b4b56c78321b1b7d69  0004-accelerometer-support-SSC-accelerometer-sensor.patch
80d59825dde8ff8bcc92b3d6d659968f88f82c8198e9576e1a77b2d38be074781926c45115e213e4c557a3dc7ba1c1391d67cb6f0c49d23aff2e0cdbfedefc87  0005-compass-support-SSC-compass-sensor.patch
651d3281fe64fb72780bdfc4f3416af6f221c5c0aebf8b9a87d2cf6b5a31ebd0816199b45c97f24810807286a4a8839b6304a12cfc23b4191261a30efd3fbe2b  0006-data-add-libssc-udev-rules.patch
bdb8831d89f389badd5de0eb52d9eca5dbdf045dbcfab18165d43798c9e329c3e68e3209b8ad1053916cfac6c54984dd47aa379c419d46f1c25ad6a57c2bd771  0007-CI-add-libssc-build.patch
c778168de17f86e3d50b62a4905d3940e9d69bb919fe3b9b5fc8962d8fe9b7cdb48a57dd8128ded93ff08493f65a7f602e6e7ad295e6736c74c273a2c6399c35  0008-data-iio-sensor-proxy.service.in-add-AF_QIPCRTR.patch
"
