# Contributor: Luca Weiss <luca@lucaweiss.eu>
# Maintainer: Luca Weiss <luca@lucaweiss.eu>
pkgname=libayatana-common
pkgver=0.9.10
pkgrel=1
pkgdesc="Shared Library for common functions required by the Ayatana System Indicators"
url="https://github.com/AyatanaIndicators/libayatana-common"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	cmake-extras
	glib-dev
	gobject-introspection-dev
	gtest-dev
	intltool
	samurai
	vala
	"
subpackages="$pkgname-dev $pkgname-lang"
source="https://github.com/AyatanaIndicators/libayatana-common/archive/$pkgver/libayatana-common-$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="
f60f2a0583247628feed95dc28456ee4ccf39b2510f2c91069f8f776c7d7b175ec6a9a71ff526272d283123f0c3dde1913d3282bb4f3bdac5f813a5083a7a390  libayatana-common-0.9.10.tar.gz
"
