# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=lomiri-location-service
pkgver=3.3.0
pkgrel=3
pkgdesc="Location service aggregating position/velocity/heading updates and exporting them over dbus"
arch="all"
url="https://gitlab.com/ubports/development/core/lomiri-location-service"
license="GPL-3.0-only AND LGPL-3.0-only"
depends_dev="
	boost-dev
	dbus-cpp-dev
	dbus-dev
	gflags-dev
	glog-dev
	gpsd-dev
	json-c-dev
	libapparmor-dev
	lomiri-trust-store-dev
	net-cpp-dev
	process-cpp-dev
	properties-cpp-dev
	qt5-qtbase-dev
	qt5-qtlocation-dev
	"
makedepends="$depends_dev
	cmake-extras
	gettext
	gmock
	gtest-dev
	samurai
	"
checkdepends="coreutils"
source="https://gitlab.com/ubports/development/core/lomiri-location-service/-/archive/$pkgver/lomiri-location-service-$pkgver.tar.gz
	0001-data-CMakeLists.txt-don-t-hardcode-lib-paths-when-in.patch
	0002-Add-GLOG_USE_GLOG_EXPORT-definition-for-glog.patch
	0003-cmake-install-libraries.patch
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
# tests try to write to /var/lib/lomiri-location-service/config.ini
options="!check"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_BUILD_TYPE=None \
		-DLOCATION_SERVICE_ENABLE_GPS_PROVIDER=OFF
	cmake --build build
}

check() {
	ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
a6e611f6b58208eaf01f48b61dbc4fa7c3eff65106c922637dca8a0bbcd7b7b2b17ee03ed47ac1a1257a98f7251fd8974da4ff38734de4123250842ee5e08e6b  lomiri-location-service-3.3.0.tar.gz
b317b86437ae843333efe68b1eae9e24d69f6886b20d98a62c649896cd914898cc2c90d7bd8eb644d1c5b444bc68a1c16c1053dab6115e5579aa69b4ba1d27b3  0001-data-CMakeLists.txt-don-t-hardcode-lib-paths-when-in.patch
2b079fadb6c4d883ef7d2362152c88d28cc1d52f58f1432e6f07b6678e4d917c24add8ab3e1e05139809398c926b920372dbf694ec971e3f13ab6b7e6e863b2e  0002-Add-GLOG_USE_GLOG_EXPORT-definition-for-glog.patch
f63e946872d3aee39c60e904abae80ff3dd5a6ebaeeac52dcd8661b5fe2b4923851ef75671f87613893d771e47853fab94752cc0262e94453e7dda7633b767bb  0003-cmake-install-libraries.patch
"
