# Contributor: Luca Weiss <luca@lucaweiss.eu>
# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=ayatana-indicator-power
pkgver=24.5.1
pkgrel=1
pkgdesc="Ayatana Indicator Power Applet"
url="https://github.com/AyatanaIndicators/ayatana-indicator-power"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	dbus-test-runner-dev
	glib-dev
	gtest-dev
	intltool
	libayatana-common-dev
	libnotify-dev
	librda-dev
	samurai
	"
checkdepends="dbus dbus-test-runner"
subpackages="$pkgname-lang"
source="https://github.com/AyatanaIndicators/ayatana-indicator-power/archive/$pkgver/ayatana-indicator-power-$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DENABLE_TESTS=ON \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="
3b096f742cbdbaf01f71a9f6fa772b6b0d2a9833a35bf8a88433050fbc5899521b6b73a454e9a98dc3b340ec6ee8df4a239168f58d67cccbd656f6ac09b487a2  ayatana-indicator-power-24.5.1.tar.gz
"
