maintainer="Zach DeCook <zachdecook@librem.one>"
pkgname=hyprgraphics
pkgver=0.1.3
pkgrel=0
pkgdesc="Hyprland graphics / resource utilities"
url="https://github.com/hyprwm/hyprgraphics"
arch="all"
license="BSD-3-Clause"
source="
	https://github.com/hyprwm/hyprgraphics/archive/v$pkgver/hyprgraphics-v$pkgver.tar.gz
	big-endian-jpeg.patch
	"
subpackages="$pkgname-doc $pkgname-dev"
makedepends="
	cairo-dev
	cmake
	file-dev
	hyprutils-dev
	libjpeg-turbo-dev
	libspng-dev
	libwebp-dev
	samurai
	pixman-dev
	"

# libjxl not available on s390x, so compile without JXL support
if ! test "$CARCH" = "s390x"; then
	makedepends="$makedepends libjxl-dev"
fi

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_BUILD_TYPE=None
	cmake --build build
}

check() {
	cd build
	ctest
}

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


sha512sums="
7cde20b641d5c3427278125b85b5438ddc1c1149efa3e148159e8d9da74afa0e3afbde974e723a8eb1649514610434f5e94a44bc7f8145b01fb4dab1c28159a4  hyprgraphics-v0.1.3.tar.gz
e03b6ccde020a02d4a32c7a524837c30cf54455b30ab5cf156110c0c6dfebda560a8060af5c4c3e2491f1a1ec333169c4cf6c5bc3db68540a40d1574a86ed18d  big-endian-jpeg.patch
"
