# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.15.0

EAPI=8

CRATES="
	adler2@2.0.1
	android_system_properties@0.1.5
	anstream@0.6.21
	anstyle-parse@0.2.7
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anstyle@1.0.13
	anyhow@1.0.101
	arraydeque@0.5.1
	arrayvec@0.7.6
	autocfg@1.5.0
	bitflags@1.3.2
	bitflags@2.10.0
	bumpalo@3.19.1
	bytemuck@1.25.0
	bytemuck_derive@1.10.2
	byteorder-lite@0.1.0
	cairo-rs@0.21.5
	cairo-sys-rs@0.21.5
	cc@1.2.55
	cfg-expr@0.20.6
	cfg-if@1.0.4
	chrono@0.4.43
	clap@4.5.57
	clap_builder@4.5.57
	clap_complete@4.5.65
	clap_complete_fig@4.5.2
	clap_complete_nushell@4.5.10
	clap_derive@4.5.55
	clap_lex@0.7.7
	colorchoice@1.0.4
	core-foundation-sys@0.8.7
	core_maths@0.1.1
	crc32fast@1.5.0
	dlib@0.5.2
	either@1.15.0
	endi@1.1.1
	epoxy@0.1.0
	equivalent@1.0.2
	fastrand@2.3.0
	femtovg@0.20.1
	field-offset@0.3.6
	find-msvc-tools@0.1.9
	flate2@1.1.9
	flume@0.12.0
	fnv@1.0.7
	fontconfig@0.10.0
	fragile@2.0.1
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	futures@0.3.31
	gdk-pixbuf-sys@0.21.5
	gdk-pixbuf@0.21.5
	gdk4-sys@0.10.3
	gdk4@0.10.3
	getrandom@0.2.17
	gio-sys@0.21.5
	gio@0.21.5
	gl_generator@0.9.0
	glib-macros@0.21.5
	glib-sys@0.21.5
	glib@0.21.5
	glow@0.16.0
	gobject-sys@0.21.5
	graphene-rs@0.21.5
	graphene-sys@0.21.5
	gsk4-sys@0.10.3
	gsk4@0.10.3
	gtk4-macros@0.10.3
	gtk4-sys@0.10.3
	gtk4@0.10.3
	gvdb@0.9.0
	hashbrown@0.16.1
	heck@0.5.0
	hex_color@3.0.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.65
	image@0.25.9
	imgref@1.12.0
	indexmap@2.13.0
	is_terminal_polyfill@1.70.2
	itertools@0.14.0
	itoa@1.0.17
	js-sys@0.3.85
	keycode@1.0.0
	keycode_macro@1.0.0
	khronos_api@2.2.0
	lazy_static@1.5.0
	libadwaita-sys@0.8.1
	libadwaita@0.8.1
	libc@0.2.180
	libloading@0.8.9
	libloading@0.9.0
	libm@0.2.16
	lock_api@0.4.14
	log@0.4.29
	lru@0.16.3
	memchr@2.7.6
	memoffset@0.9.1
	miniz_oxide@0.8.9
	moxcms@0.7.11
	num-traits@0.2.19
	once_cell@1.21.3
	once_cell_polyfill@1.70.2
	pango-sys@0.21.5
	pango@0.21.5
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	pkg-config@0.3.32
	ppv-lite86@0.2.21
	proc-macro-crate@3.4.0
	proc-macro2@1.0.106
	pxfm@0.1.27
	quick-xml@0.38.4
	quote@1.0.44
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	relm4-css@0.10.1
	relm4-icons-build@0.10.1
	relm4-icons@0.10.1
	relm4-macros@0.10.1
	relm4@0.10.1
	resource@0.6.1
	resource_list_proc_macro@0.6.1
	rgb@0.8.52
	rustc_version@0.4.1
	rustversion@1.0.22
	rustybuzz@0.20.1
	same-file@1.0.6
	scopeguard@1.2.0
	semver@1.0.27
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.149
	serde_spanned@1.0.4
	shared_library@0.1.9
	shlex@1.3.0
	simd-adler32@0.3.8
	slab@0.4.12
	slotmap@1.1.1
	smallvec@1.15.1
	spin@0.9.8
	strsim@0.11.1
	syn@2.0.114
	system-deps@7.0.7
	target-lexicon@0.13.3
	thiserror-impl@2.0.18
	thiserror@2.0.18
	tokio@1.49.0
	toml@0.9.11+spec-1.1.0
	toml_datetime@0.7.5+spec-1.1.0
	toml_edit@0.23.10+spec-1.0.0
	toml_parser@1.0.6+spec-1.1.0
	toml_writer@1.0.6+spec-1.1.0
	tracing-attributes@0.1.31
	tracing-core@0.1.36
	tracing@0.1.44
	ttf-parser@0.25.1
	unicode-bidi-mirroring@0.4.0
	unicode-bidi@0.3.18
	unicode-ccc@0.4.0
	unicode-ident@1.0.22
	unicode-properties@0.1.4
	unicode-script@0.5.8
	unicode-segmentation@1.12.0
	utf8parse@0.2.2
	version-compare@0.2.1
	version_check@0.9.5
	walkdir@2.5.0
	wasi@0.11.1+wasi-snapshot-preview1
	wasm-bindgen-macro-support@0.2.108
	wasm-bindgen-macro@0.2.108
	wasm-bindgen-shared@0.2.108
	wasm-bindgen@0.2.108
	web-sys@0.3.85
	winapi-util@0.1.11
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.61.2
	winnow@0.7.14
	xdg@3.0.0
	xml-rs@0.7.0
	yeslogic-fontconfig-sys@6.0.0
	zerocopy-derive@0.8.39
	zerocopy@0.8.39
	zmij@1.0.19
	zvariant@5.9.2
	zvariant_derive@5.9.2
	zvariant_utils@3.3.0
"

inherit cargo desktop xdg

DESCRIPTION="A screenshot annotation tool inspired by Swappy and Flameshot."
HOMEPAGE="https://github.com/Satty-org/Satty"

if [[ "${PV}" == 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/Satty-org/Satty.git"
else
	SRC_URI="
		https://github.com/Satty-org/Satty/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
		${CARGO_CRATE_URIS}
	"
	M_PN=Satty
	S="${WORKDIR}/${M_PN}-${PV}"
	KEYWORDS="~amd64"
fi

LICENSE="MPL-2.0"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions CC0-1.0 ISC MIT
	Unicode-3.0 ZLIB
"
SLOT="0"

RDEPEND="
	dev-libs/glib:2
	media-libs/fontconfig
	media-libs/libepoxy
	media-libs/mesa[opengl]
	media-libs/graphene
	gui-libs/libadwaita
	gui-libs/gtk:4
	x11-libs/cairo
	x11-libs/gdk-pixbuf:2
	x11-libs/pango
"

QA_FLAGS_IGNORED="usr/bin/${PN}"

src_unpack() {
	if [[ "${PV}" == 9999 ]]; then
		git-r3_src_unpack
		cargo_live_src_unpack
	else
		cargo_src_unpack
	fi
}

src_install() {
	dodoc README.md

	dobin "$(cargo_target_dir)"/satty
	#Just add the icon and desktop file
	doicon "${S}/assets/satty.svg"
	domenu "${S}/satty.desktop"
}