# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=sensorfw
pkgver=0.14.10
pkgrel=0
pkgdesc="Sensorfw"
url="https://github.com/sailfishos/sensorfw"
arch="all"
license="LGPL-2.1-only"
depends="iio-sensor-proxy"
makedepends="
	doxygen
	elogind-dev
	eudev-dev
	qt5-qtbase-dev
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://github.com/sailfishos/sensorfw/archive/$pkgver/sensorfw-$pkgver.tar.gz
	0001-Do-not-hide-stepcounter-by-default.patch
	0002-Add-heart-rate-monitor-sensor-with-hybris-adaptor.patch
	0003-Add-Wrist-gesture-sensor-via-libhybris-adaptor.patch
	0004-Fix-compilation-when-hybris-is-used.patch
	primaryuse.conf
	sensorfw.initd
	sensorfw.confd
	"
options="!check" # Broken, fails to find symbols

build() {
	qmake-qt5 \
		PREFIX=/usr
	make

	sed "s=@LIB@=lib=g" sensord-qt5.pc.in > sensord-qt5.pc
}

check() {
	make check
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	install -Dm644 -t "$pkgdir"/etc/sensorfw "$srcdir"/primaryuse.conf
	install -Dm755 "$srcdir"/sensorfw.initd "$pkgdir"/etc/init.d/sensorfw
	install -Dm644 "$srcdir"/sensorfw.confd "$pkgdir"/etc/conf.d/sensorfw

	mkdir -p "$pkgdir"/usr/share/dbus-1/system.d/
	mv "$pkgdir"/etc/dbus-1/system.d/* "$pkgdir"/usr/share/dbus-1/system.d/
}

sha512sums="
cebf70998d543ef28fdc9fa451748ae8d44ab41046c31a96774efd4672697f1f9b1d392ff8f76f05445841e4d280266eb1aeaec2bebefc883fa16b4dd23fd5e2  sensorfw-0.14.10.tar.gz
0959dec01898ca1992967f9e8ad90ccba9a5123df3a5f67ed75666f930b4d14a858611ae6d72572bcdc0afa42ce8b6c8c1fabc1d9613fe69afd03fde50d1afad  0001-Do-not-hide-stepcounter-by-default.patch
e5764e5ef2e11afe57b66730ce05a375588c0c500263145c1f68546f68f83f61f457ed905e25e8ac157a1a9fa094c33046e54cc08360b128dd58d2c2323b02a9  0002-Add-heart-rate-monitor-sensor-with-hybris-adaptor.patch
86b72bf996ae32834116483c6b2d2e2d66cda8c969e915c4c3b45069d5798f836c70adc5e44e6b43ccb2ad98a58d5235ac81652d81e6df07f1641d3788bff040  0003-Add-Wrist-gesture-sensor-via-libhybris-adaptor.patch
f3c33bd7a439bcccc10bfa4a030b06f020792e2d5f1edd5e7b9e96660a77c157a2a586f7870a62562e8cc1d3ecb9c111e9cd59ad9a6245ef258092e031349cdb  0004-Fix-compilation-when-hybris-is-used.patch
8e362f48fc5db58dc37d035f80f5ab0b09a20c82e6859e9662affdc192e2aa0bc7a259a9b0c63db330b3873d8b1f22af3f9193a0b7d79068354d1a788391376c  primaryuse.conf
17f5d578766b92022992fd5cd333d204a846d1111e7ef59234d7a907290e4cf9e9beb1cb0370b2c9c9982720e62effc5022e625469d9d64eb7613a8d6ef7f8c2  sensorfw.initd
b841282b96110ec59a7aa539db0737327b09549d55c78dc4b2c3b28b4a6ad1facf015b3175cb6d3a38f13e47aa6314ef3dc1514a4e60dd653a97409ec54ba706  sensorfw.confd
"
