# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License-2

EAPI=8

CRATES="
	anstyle@1.0.7
	async-io@1.13.0
	async-lock@2.8.0
	atk@0.18.0
	atk-sys@0.18.0
	autocfg@1.3.0
	bitflags@1.3.2
	bitflags@2.5.0
	byteorder@1.5.0
	cairo-rs@0.18.5
	cairo-sys-rs@0.18.2
	cc@1.0.96
	cfg-expr@0.15.8
	cfg-if@1.0.0
	clap@4.4.18
	clap_builder@4.4.18
	clap_lex@0.6.0
	concurrent-queue@2.5.0
	crossbeam-utils@0.8.19
	derivative@2.2.0
	enumflags2@0.6.4
	enumflags2_derive@0.6.4
	equivalent@1.0.1
	errno@0.3.8
	event-listener@2.5.3
	fastrand@1.9.0
	field-offset@0.3.6
	futures@0.3.30
	futures-channel@0.3.30
	futures-core@0.3.30
	futures-executor@0.3.30
	futures-io@0.3.30
	futures-lite@1.13.0
	futures-macro@0.3.30
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-util@0.3.30
	gdk@0.18.0
	gdk-pixbuf@0.18.5
	gdk-pixbuf-sys@0.18.0
	gdk-sys@0.18.0
	gio@0.18.4
	gio-sys@0.18.1
	glib@0.18.5
	glib-macros@0.18.5
	glib-sys@0.18.1
	gobject-sys@0.18.0
	gtk@0.18.1
	gtk-sys@0.18.0
	gtk3-macros@0.18.0
	hashbrown@0.14.5
	heck@0.4.1
	heck@0.5.0
	hermit-abi@0.3.9
	indexmap@2.2.6
	instant@0.1.12
	io-lifetimes@1.0.11
	itoa@1.0.11
	libc@0.2.154
	linux-raw-sys@0.3.8
	log@0.4.21
	maplit@1.0.2
	memchr@2.7.2
	memmap2@0.7.1
	memoffset@0.6.5
	memoffset@0.9.1
	nb-connect@1.2.0
	nix@0.22.3
	once_cell@1.19.0
	pango@0.18.3
	pango-sys@0.18.0
	parking@2.2.0
	pin-project-lite@0.2.14
	pin-utils@0.1.0
	pkg-config@0.3.30
	polling@2.8.0
	proc-macro-crate@0.1.5
	proc-macro-crate@1.3.1
	proc-macro-crate@2.0.2
	proc-macro-error@1.0.4
	proc-macro-error-attr@1.0.4
	proc-macro2@1.0.81
	quote@1.0.36
	rustc_version@0.4.0
	rustix@0.37.27
	ryu@1.0.17
	scoped-tls@1.0.1
	semver@1.0.22
	serde@1.0.200
	serde_derive@1.0.200
	serde_repr@0.1.19
	serde_spanned@0.6.5
	serde_yaml@0.9.34+deprecated
	slab@0.4.9
	smallvec@1.13.2
	socket2@0.4.10
	static_assertions@1.1.0
	syn@1.0.109
	syn@2.0.60
	system-deps@6.2.2
	target-lexicon@0.12.14
	thiserror@1.0.59
	thiserror-impl@1.0.59
	toml@0.5.11
	toml@0.8.2
	toml_datetime@0.6.3
	toml_edit@0.19.15
	toml_edit@0.20.2
	unicode-ident@1.0.12
	unsafe-libyaml@0.2.11
	version-compare@0.2.0
	version_check@0.9.4
	waker-fn@1.1.1
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-targets@0.48.5
	windows-targets@0.52.5
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.5
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.5
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.5
	windows_i686_gnullvm@0.52.5
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.5
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.5
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.5
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.5
	winnow@0.5.40
	xkbcommon@0.5.1
	zbus@1.9.3
	zbus_macros@1.9.3
	zvariant@2.10.0
	zvariant_derive@2.10.0
"

inherit cargo gnome2-utils meson toolchain-funcs xdg

DESCRIPTION="Virtual keyboard supporting Wayland, built primarily for the Librem 5 phone"
HOMEPAGE="https://gitlab.gnome.org/World/Phosh/squeekboard"
SRC_URI="https://gitlab.gnome.org/World/Phosh/squeekboard/-/archive/v${PV}/squeekboard-v${PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" $(cargo_crate_uris ${CRATES})"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~arm ~arm64"

RDEPEND="
	${PYTHON_DEPS}
	dev-libs/feedbackd
	dev-libs/wayland
	dev-libs/wayland-protocols
	gnome-base/gnome-desktop
	media-fonts/noto-emoji
	x11-libs/gtk+:3[wayland]
"

BDEPEND="
	dev-util/gtk-doc
	dev-util/intltool
	virtual/pkgconfig
	virtual/rust
"

S="${WORKDIR}/${PN}-v${PV}"

QA_FLAGS_IGNORED="/usr/bin/squeekboard-test-layout"

src_install() {
	CC="$(tc-getCC)"
	meson_src_install
	insinto /usr/bin
	doins "${S}/tools/squeekboard-restyled"
}

pkg_postinst() {
	xdg_pkg_postinst
	gnome2_schemas_update
}

pkg_postrm() {
	xdg_pkg_postrm
	gnome2_schemas_update
}