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

# Autogenerated by pycargoebuild 0.13.3

EAPI=8

CRATES="
	ab_glyph@0.2.28
	ab_glyph_rasterizer@0.1.8
	addr2line@0.22.0
	adler@1.0.2
	ahash@0.8.11
	aho-corasick@1.1.3
	alsa-sys@0.3.1
	alsa@0.9.0
	android-activity@0.6.0
	android-properties@0.2.2
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	annotate-snippets@0.9.2
	anstream@0.6.15
	anstyle-parse@0.2.5
	anstyle-query@1.1.1
	anstyle-wincon@3.0.4
	anstyle@1.0.8
	anyhow@1.0.86
	approx@0.5.1
	aquamarine@0.1.12
	arrayref@0.3.8
	arrayvec@0.7.4
	as-raw-xcb-connection@1.0.1
	ash@0.37.3+1.3.251
	ashpd@0.8.1
	async-broadcast@0.7.1
	async-channel@2.3.1
	async-executor@1.13.0
	async-fs@2.1.2
	async-io@2.3.3
	async-lock@3.4.0
	async-net@2.0.0
	async-process@2.2.3
	async-recursion@1.1.1
	async-signal@0.2.9
	async-task@4.7.1
	async-trait@0.1.81
	atomic-waker@1.1.2
	atty@0.2.14
	autocfg@1.3.0
	autocxx-bindgen@0.69.5
	autocxx-build@0.27.0
	autocxx-engine@0.27.0
	autocxx-macro@0.27.0
	autocxx-parser@0.27.0
	autocxx@0.27.0
	backtrace@0.3.73
	base64@0.21.7
	bcdec_rs@0.1.2
	bindgen@0.69.4
	bitflags@1.3.2
	bitflags@2.6.0
	block-buffer@0.10.4
	block2@0.5.1
	blocking@1.6.1
	bumpalo@3.16.0
	bytemuck@1.16.3
	bytemuck_derive@1.7.0
	byteorder@1.5.0
	bytes@1.7.1
	calloop-wayland-source@0.3.0
	calloop@0.13.0
	cc@1.1.7
	cesu8@1.1.0
	cexpr@0.6.0
	cfg-expr@0.15.8
	cfg-if@1.0.0
	cfg_aliases@0.1.1
	cfg_aliases@0.2.1
	chrono-tz-build@0.3.0
	chrono-tz@0.9.0
	chrono@0.4.38
	clang-sys@1.8.1
	clap@4.5.13
	clap_builder@4.5.13
	clap_derive@4.5.13
	clap_lex@0.7.2
	cmake@0.1.50
	codespan-reporting@0.11.1
	colorchoice@1.0.2
	combine@4.6.7
	concurrent-queue@2.5.0
	config@0.14.0
	const-cstr@0.3.0
	const-random-macro@0.1.16
	const-random@0.1.18
	convert_case@0.4.0
	convert_case@0.6.0
	cookie-factory@0.3.3
	core-foundation-sys@0.8.6
	core-foundation@0.9.4
	core-graphics-types@0.1.3
	core-graphics@0.23.2
	coreaudio-rs@0.11.3
	coreaudio-sys@0.2.15
	cpal@0.15.3
	cpufeatures@0.2.12
	crossbeam-deque@0.8.5
	crossbeam-epoch@0.9.18
	crossbeam-queue@0.3.11
	crossbeam-utils@0.8.20
	crunchy@0.2.2
	crypto-common@0.1.6
	cstr@0.2.12
	ctrlc@3.4.4
	cursor-icon@1.1.0
	cxx-gen@0.7.124
	cxx@1.0.124
	cxxbridge-flags@1.0.124
	cxxbridge-macro@1.0.124
	darling@0.20.10
	darling_core@0.20.10
	darling_macro@0.20.10
	dasp_sample@0.11.0
	dbus@0.9.7
	ddsfile@0.5.2
	derivative@2.2.0
	derive_more@0.99.18
	digest@0.10.7
	dispatch@0.2.0
	dlib@0.5.2
	dlopen2@0.7.0
	dlopen2_derive@0.4.0
	dlv-list@0.5.2
	downcast-rs@1.2.1
	dpi@0.1.1
	drm-fourcc@2.2.0
	either@1.13.0
	endi@1.1.0
	enum-primitive-derive@0.2.2
	enumflags2@0.7.10
	enumflags2_derive@0.7.10
	enumset@1.1.5
	enumset_derive@0.10.0
	env_logger@0.9.3
	equivalent@1.0.1
	errno@0.3.9
	event-listener-strategy@0.5.2
	event-listener@5.3.1
	fastrand@2.1.0
	fixedbitset@0.4.2
	flagset@0.4.6
	flexi_logger@0.28.5
	fnv@1.0.7
	fontconfig-rs@0.1.1
	foreign-types-macros@0.2.3
	foreign-types-shared@0.3.1
	foreign-types@0.5.0
	form_urlencoded@1.2.1
	freetype-rs@0.36.0
	freetype-sys@0.20.1
	futures-channel@0.3.30
	futures-core@0.3.30
	futures-executor@0.3.30
	futures-io@0.3.30
	futures-lite@2.3.0
	futures-macro@0.3.30
	futures-sink@0.3.30
	futures-task@0.3.30
	futures-util@0.3.30
	futures@0.3.30
	generic-array@0.14.7
	gethostname@0.4.3
	getrandom@0.2.15
	gimli@0.29.0
	glam@0.28.0
	glob@0.3.1
	half@2.4.1
	hashbrown@0.12.3
	hashbrown@0.13.2
	hashbrown@0.14.5
	heck@0.4.1
	heck@0.5.0
	hermit-abi@0.1.19
	hermit-abi@0.4.0
	hex@0.4.3
	home@0.5.9
	hound@3.5.1
	humantime@2.1.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.60
	ident_case@1.0.1
	idmap-derive@0.1.2
	idmap@0.2.21
	idna@0.5.0
	image_dds@0.6.0
	indexmap@1.9.3
	indexmap@2.3.0
	indoc@1.0.9
	input-linux-sys@0.9.0
	input-linux@0.7.0
	is_terminal_polyfill@1.70.1
	itertools@0.10.5
	itertools@0.12.1
	itertools@0.13.0
	itertools@0.9.0
	itoa@1.0.11
	jni-sys@0.3.0
	jni@0.21.1
	jobserver@0.1.32
	js-sys@0.3.69
	json5@0.4.1
	json@0.12.4
	lazy_static@1.5.0
	lazycell@1.3.0
	libc@0.2.155
	libdbus-sys@0.2.5
	libloading@0.7.4
	libloading@0.8.5
	libredox@0.0.2
	libspa-sys@0.8.0
	libspa@0.8.0
	link-cplusplus@1.0.9
	linked-hash-map@0.5.6
	linux-raw-sys@0.4.14
	lock_api@0.4.12
	log-panics@2.1.0
	log@0.4.22
	mach2@0.4.2
	malloc_buf@0.0.6
	memchr@2.7.4
	memmap2@0.8.0
	memmap2@0.9.4
	memoffset@0.9.1
	miette-derive@5.10.0
	miette@5.10.0
	minimal-lexical@0.2.1
	miniz_oxide@0.7.4
	mint@0.5.9
	moveit@0.6.0
	ndk-context@0.1.1
	ndk-sys@0.5.0+25.2.9519653
	ndk-sys@0.6.0+11769913
	ndk@0.8.0
	ndk@0.9.0
	nix@0.27.1
	nix@0.28.0
	nix@0.29.0
	nom@7.1.3
	normpath@1.2.0
	ntapi@0.4.1
	nu-ansi-term@0.50.1
	num-derive@0.4.2
	num-traits@0.2.19
	num_enum@0.7.3
	num_enum_derive@0.7.3
	objc-sys@0.3.5
	objc2-app-kit@0.2.2
	objc2-cloud-kit@0.2.2
	objc2-contacts@0.2.2
	objc2-core-data@0.2.2
	objc2-core-image@0.2.2
	objc2-core-location@0.2.2
	objc2-encode@4.0.3
	objc2-foundation@0.2.2
	objc2-link-presentation@0.2.2
	objc2-metal@0.2.2
	objc2-quartz-core@0.2.2
	objc2-symbols@0.2.2
	objc2-ui-kit@0.2.2
	objc2-uniform-type-identifiers@0.2.2
	objc2-user-notifications@0.2.2
	objc2@0.5.2
	objc@0.2.7
	object@0.36.2
	oboe-sys@0.6.1
	oboe@0.6.1
	once_cell@1.19.0
	orbclient@0.3.47
	ordered-multimap@0.6.0
	ordered-stream@0.2.0
	owned_ttf_parser@0.24.0
	parking@2.2.0
	parking_lot@0.12.3
	parking_lot_core@0.9.10
	parse-zoneinfo@0.3.1
	pathdiff@0.2.1
	percent-encoding@2.3.1
	pest@2.7.11
	pest_derive@2.7.11
	pest_generator@2.7.11
	pest_meta@2.7.11
	phf@0.11.2
	phf_codegen@0.11.2
	phf_generator@0.11.2
	phf_shared@0.11.2
	pin-project-internal@1.1.5
	pin-project-lite@0.2.14
	pin-project@1.1.5
	pin-utils@0.1.0
	piper@0.2.3
	pipewire-sys@0.8.0
	pipewire@0.8.0
	pkg-config@0.3.31
	polling@3.7.2
	ppv-lite86@0.2.18
	prettyplease@0.2.20
	proc-macro-crate@1.3.1
	proc-macro-crate@2.0.2
	proc-macro-error-attr@1.0.4
	proc-macro-error@1.0.4
	proc-macro2@1.0.86
	quick-xml@0.30.0
	quick-xml@0.34.0
	quote@1.0.36
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	raw-window-handle@0.6.2
	rayon-core@1.12.1
	rayon@1.10.0
	redox_syscall@0.4.1
	redox_syscall@0.5.3
	regex-automata@0.4.7
	regex-syntax@0.8.4
	regex@1.10.6
	rodio@0.19.0
	ron@0.8.1
	rosc@0.10.1
	roxmltree@0.14.1
	rust-ini@0.19.0
	rustc-demangle@0.1.24
	rustc-hash@1.1.0
	rustc_version@0.4.0
	rustix@0.38.34
	rustversion@1.0.17
	rxscreen@0.1.7
	ryu@1.0.18
	same-file@1.0.6
	scoped-tls@1.0.1
	scopeguard@1.2.0
	sctk-adwaita@0.10.1
	semver@1.0.23
	serde@1.0.204
	serde_derive@1.0.204
	serde_json5@0.1.0
	serde_json@1.0.122
	serde_repr@0.1.19
	serde_spanned@0.6.7
	serde_yaml@0.9.34+deprecated
	sha1@0.10.6
	sha2@0.10.8
	shaderc-sys@0.8.3
	shaderc@0.8.3
	shlex@1.3.0
	signal-hook-registry@1.4.2
	siphasher@0.3.11
	slab@0.4.9
	slice-of-array@0.3.2
	smallvec@1.13.2
	smithay-client-toolkit@0.19.2
	smol_str@0.2.2
	static_assertions@1.1.0
	strict-num@0.1.1
	strsim@0.11.1
	strum@0.26.3
	strum_macros@0.26.4
	syn@1.0.109
	syn@2.0.72
	sysinfo@0.31.2
	system-deps@6.2.2
	target-lexicon@0.12.16
	tempfile@3.10.1
	termcolor@1.4.1
	thiserror-impl@1.0.63
	thiserror@1.0.63
	thread_local@1.1.8
	tiny-keccak@2.0.2
	tiny-skia-path@0.11.4
	tiny-skia@0.11.4
	tinyvec@1.8.0
	tinyvec_macros@0.1.1
	toml@0.8.2
	toml_datetime@0.6.3
	toml_edit@0.19.15
	toml_edit@0.20.2
	tracing-attributes@0.1.27
	tracing-core@0.1.32
	tracing@0.1.40
	ttf-parser@0.24.0
	typenum@1.17.0
	ucd-trie@0.1.6
	uds_windows@1.1.0
	unicode-bidi@0.3.15
	unicode-ident@1.0.12
	unicode-normalization@0.1.23
	unicode-segmentation@1.11.0
	unicode-width@0.1.13
	unsafe-libyaml@0.2.11
	url@2.5.2
	utf8parse@0.2.2
	version-compare@0.2.0
	version_check@0.9.5
	vk-parse@0.12.0
	walkdir@2.5.0
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.92
	wasm-bindgen-futures@0.4.42
	wasm-bindgen-macro-support@0.2.92
	wasm-bindgen-macro@0.2.92
	wasm-bindgen-shared@0.2.92
	wasm-bindgen@0.2.92
	wayland-backend@0.3.6
	wayland-client@0.31.5
	wayland-csd-frame@0.3.0
	wayland-cursor@0.31.5
	wayland-protocols-plasma@0.3.3
	wayland-protocols-wlr@0.3.3
	wayland-protocols@0.32.3
	wayland-scanner@0.31.4
	wayland-sys@0.31.4
	web-sys@0.3.69
	web-time@1.1.0
	which@4.4.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.8
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.52.0
	windows-core@0.54.0
	windows-core@0.57.0
	windows-implement@0.57.0
	windows-interface@0.57.0
	windows-result@0.1.2
	windows-sys@0.45.0
	windows-sys@0.52.0
	windows-targets@0.42.2
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows@0.54.0
	windows@0.57.0
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winit@0.30.4
	winnow@0.5.40
	x11-dl@2.21.0
	x11rb-protocol@0.13.1
	x11rb@0.13.1
	xcb@1.4.0
	xcursor@0.3.6
	xdg-home@1.2.0
	xdg@2.5.2
	xkbcommon-dl@0.4.2
	xkbcommon@0.7.0
	xkbcommon@0.8.0
	xkeysym@0.2.1
	xml-rs@0.8.20
	xmlparser@0.13.6
	yaml-rust@0.4.5
	yansi-term@0.1.2
	yeslogic-fontconfig-sys@3.2.0
	zbus@4.0.1
	zbus_macros@4.0.1
	zbus_names@3.0.0
	zerocopy-derive@0.6.6
	zerocopy-derive@0.7.35
	zerocopy@0.6.6
	zerocopy@0.7.35
	zvariant@4.0.0
	zvariant_derive@4.0.0
	zvariant_utils@1.1.0
"

declare -A GIT_CRATES=(
	[libmonado-rs]='https://github.com/technobaboo/libmonado-rs;a495f6d162fce47ae5aafeb7ec38e774cb731c29;libmonado-rs-%commit%'
	[openxr-sys]='https://github.com/galister/openxrs;af4a55df60125491c80c61464c824219c6019b76;openxrs-%commit%/sys'
	[openxr]='https://github.com/galister/openxrs;af4a55df60125491c80c61464c824219c6019b76;openxrs-%commit%/openxr'
	[ovr_overlay]='https://github.com/galister/ovr_overlay_oyasumi;5b5b8bbfdd6d9059f79b2847d8f657e093f2b120;ovr_overlay_oyasumi-%commit%'
	[ovr_overlay_sys]='https://github.com/galister/ovr_overlay_oyasumi;5b5b8bbfdd6d9059f79b2847d8f657e093f2b120;ovr_overlay_oyasumi-%commit%/sys'
	[vulkano-macros]='https://github.com/vulkano-rs/vulkano;94f50f18bd25971ea123adb8b5782ad65a8f085c;vulkano-%commit%/vulkano-macros'
	[vulkano-shaders]='https://github.com/vulkano-rs/vulkano;94f50f18bd25971ea123adb8b5782ad65a8f085c;vulkano-%commit%/vulkano-shaders'
	[vulkano]='https://github.com/vulkano-rs/vulkano;94f50f18bd25971ea123adb8b5782ad65a8f085c;vulkano-%commit%/vulkano'
	[wlx-capture]='https://github.com/galister/wlx-capture;c375a7c1d4b57741655a052ebe8af9fb4774f92d;wlx-capture-%commit%'
)

LLVM_COMPAT=({15..19})

inherit cargo llvm-r2 desktop

DESCRIPTION="A lightweight OpenXR/OpenVR overlay for Wayland and X11 desktops"
HOMEPAGE="https://github.com/galister/wlx-overlay-s"

SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/galister/wlx-overlay-s/archive/refs/tags/v$(ver_cut 1-2).tar.gz -> ${P}.tar.gz
"

S="${WORKDIR}/wlx-overlay-s-$(ver_cut 1-2)"

REQUIRED_USE="
	|| ( openvr openxr )
	|| ( wayland X )
	wayland? ( pipewire )
"

LICENSE="GPL-3"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD CC0-1.0 GPL-3
	ISC MIT Unicode-DFS-2016 Unlicense
"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+openvr +openxr +wayland +X +pipewire +osc"
DEPEND="
	media-libs/alsa-lib
	media-libs/shaderc
	media-libs/fontconfig
	sys-apps/dbus
	media-libs/freetype
	X? (
		x11-libs/libxcb
		x11-libs/libxkbcommon[X]
		x11-libs/libX11
		x11-libs/libXext
		x11-libs/libXrandr
	)
	openvr? (
		=media-libs/openvr-1.23.8-r0
	)
	openxr? (
		media-libs/openxr-loader[X?,wayland?]
	)
	pipewire? (
		media-video/pipewire
	)
	wayland? (
		x11-libs/libxkbcommon[wayland]
	)
	$(llvm_gen_dep '
		llvm-core/clang:${LLVM_SLOT}=
	')
"
BDEPEND="
	virtual/pkgconfig
"
RDEPEND="${DEPEND}"

PATCHES=(
	"${FILESDIR}/${P}-fix-use-pipewire.patch"
	"${FILESDIR}/${P}-devendor-openvr.patch"
)

pkg_setup() {
	export PKG_CONFIG_ALLOW_CROSS=1
	export OPENVR_NO_VENDOR=1
	rust_pkg_setup
}

src_configure() {
	local myfeatures=(
		$(usev openvr)
		$(usev openxr)
		$(usev wayland)
		$(usev X x11)
		$(usev pipewire)
		$(usev osc)
	)
	cargo_src_configure --no-default-features
}

src_install() {
	doicon --size 256 wlx-overlay-s.png
	doicon --size scalable wlx-overlay-s.svg
	domenu wlx-overlay-s.desktop
	cargo_src_install
}