# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=lomiri-deviceinfo
pkgver=0.2.2
pkgrel=1
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_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="
cb87e3c68d193054a2aaa8365d1cfc21280dd62cf4599fc6face61c02acaacfd4b61a257cf5c99a5f6f32a69e63e6c17b00d56590769073fbd0b7f041325a9f7  deviceinfo-0.2.2.tar.gz
"
