# Maintainer: Integral <integral@member.fsf.org>

pkgname=hyprutils-git
_pkgname="${pkgname%-git}"
pkgver=0.14.0.r4.g5a7b8cf
pkgrel=1
pkgdesc="Hyprland utilities library used across the ecosystem"
arch=('x86_64' 'aarch64' 'riscv64')
url="https://github.com/hyprwm/${_pkgname}"
license=('BSD-3-Clause')
depends=('pixman')
makedepends=('git' 'cmake')
checkdepends=('gtest')
source=("git+${url}.git")
conflicts=("${_pkgname}")
provides=("${_pkgname}" "lib${_pkgname}.so")
sha256sums=('SKIP')

pkgver() {
	cd "${_pkgname}/"
	git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//'
}

build() {
	cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr -S "${_pkgname}" -B build
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="${pkgdir}" cmake --install ./build
	install -Dm644 "${_pkgname}/LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
