# Contributor: Daniel Santana <daniel@santana.tech>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=maim
pkgver=5.7.4
pkgrel=8
pkgdesc="Utility that takes screenshots of your desktop"
url="https://github.com/naelstrof/maim"
arch="all"
license="GPL-3.0-or-later"
makedepends="
	cmake
	glm-dev
	icu-dev
	libjpeg-turbo-dev
	libpng-dev
	libwebp-dev
	libxcomposite-dev
	libxrandr-dev
	libxrender-dev
	mesa-dev
	samurai
	slop-dev
	"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/naelstrof/maim/archive/v$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 \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

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

sha512sums="
f91ba00e436514d2d0eecc664c02dd45c53750045b5bc4abbc2cfbf64159085e83736e820c54fa819b4d82b0905a3cfe76a5227db49dd54238f655fd4899cd6c  maim-5.7.4.tar.gz
"
