# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=image-roll
pkgver=2.1.0
pkgrel=1
pkgdesc="Simple and fast GTK image viewer with basic image manipulation tools"
url="https://github.com/weclaw1/image-roll"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"  # limited by rust/cargo
license="MIT"
makedepends="cargo gtk4.0-dev cargo-auditable"
source="https://github.com/weclaw1/image-roll/archive/$pkgver/image-roll-$pkgver.tar.gz"
options="!check"  # no tests provided


prepare() {
	default_prepare

	# This build script just installs glib schema to ~/.
	rm build.rs

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release --no-default-features  # w/o wallpaper
}

package() {
	local appid='com.github.weclaw1.ImageRoll'

	install -D -m755 target/release/image-roll -t "$pkgdir"/usr/bin/

	install -D -m644 src/resources/$appid.desktop -t "$pkgdir"/usr/share/applications/
	install -D -m644 src/resources/$appid.metainfo.xml -t "$pkgdir"/usr/share/metainfo/
	install -D -m644 src/resources/$appid.gschema.xml -t "$pkgdir"/usr/share/glib-2.0/schemas/

	install -D -m644 -t "$pkgdir"/usr/share/icons/hicolor/scalable/apps/ \
		src/resources/$appid.svg \
		src/resources/$appid.Devel.svg \
		src/resources/$appid-symbolic.svg
}

sha512sums="
675c14d8c0c25be511ad6dc7dee6df0188d9ad61b96b55bbe76c172cf1f555b1fb98323c91b9710fdf17271a0aaff04eac52a09acd63b59ae98f607f1c27b35b  image-roll-2.1.0.tar.gz
"
