# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=lomiri-deviceinfo
pkgver=0.2.3
pkgrel=0
pkgdesc="Library to detect and configure devices"
url="https://gitlab.com/ubports/development/core/deviceinfo"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	gtest-dev
	samurai
	yaml-cpp-dev
"
subpackages="$pkgname-dev"
source="https://gitlab.com/ubports/development/core/deviceinfo/-/archive/$pkgver/deviceinfo-$pkgver.tar.gz"
builddir="$srcdir/deviceinfo-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=none \
		-DCONFIG_PATH=/etc/lomiri-deviceinfo
	cmake --build build
}

check() {
	cd build
	ctest
}

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

sha512sums="
8c60de46a2bd81b07558aced8fe256bf788b22581256e59e4b8a49f20d0d18b1efab60e74f65b808c3389886f74197ee4c4f83919898aeb32501d7852e770447  deviceinfo-0.2.3.tar.gz
"
