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

EAPI=8

CRATES="
	ab_glyph@0.2.32
	ab_glyph_rasterizer@0.1.10
	accesskit@0.21.1
	accesskit_atspi_common@0.14.2
	accesskit_consumer@0.31.0
	accesskit_macos@0.22.2
	accesskit_unix@0.17.2
	accesskit_windows@0.29.2
	accesskit_winit@0.29.2
	addr2line@0.24.2
	adler2@2.0.1
	ahash@0.8.12
	aho-corasick@1.1.4
	allocator-api2@0.2.21
	ambient-authority@0.0.2
	android-activity@0.6.0
	android-properties@0.2.2
	android_system_properties@0.1.5
	anstream@0.6.21
	anstyle-parse@0.2.7
	anstyle-query@1.1.4
	anstyle-wincon@3.0.10
	anstyle@1.0.13
	anyhow@1.0.100
	ar_archive_writer@0.2.0
	arbitrary@1.4.2
	arboard@3.6.1
	arrayvec@0.7.6
	as-raw-xcb-connection@1.0.1
	ashpd@0.11.0
	async-broadcast@0.7.2
	async-channel@2.5.0
	async-executor@1.13.3
	async-io@2.6.0
	async-lock@3.4.1
	async-process@2.5.0
	async-recursion@1.1.1
	async-signal@0.2.13
	async-task@4.7.1
	async-trait@0.1.89
	atomic-waker@1.1.2
	atspi-common@0.9.0
	atspi-connection@0.9.0
	atspi-proxies@0.9.0
	atspi@0.25.0
	autocfg@1.5.0
	base64@0.21.7
	base64@0.22.1
	bincode@1.3.3
	bindgen@0.72.1
	bit-set@0.8.0
	bit-vec@0.8.0
	bitflags@1.3.2
	bitflags@2.10.0
	block-buffer@0.10.4
	block2@0.5.1
	block2@0.6.2
	blocking@1.6.2
	bumpalo@3.19.0
	bytemuck@1.24.0
	bytemuck_derive@1.10.2
	byteorder-lite@0.1.0
	byteorder@1.5.0
	bytes@1.10.1
	bytesize@2.1.0
	calloop-wayland-source@0.3.0
	calloop@0.13.0
	camino@1.2.1
	cap-fs-ext@3.4.5
	cap-primitives@3.4.5
	cap-rand@3.4.5
	cap-std@3.4.5
	cap-time-ext@3.4.5
	cbindgen@0.29.2
	cc@1.2.43
	cesu8@1.1.0
	cexpr@0.6.0
	cfg-if@1.0.4
	cfg_aliases@0.2.1
	cgl@0.3.2
	chrono@0.4.42
	clang-sys@1.8.1
	clap@4.5.51
	clap_builder@4.5.51
	clap_derive@4.5.49
	clap_lex@0.7.6
	clipboard-win@5.4.1
	cobs@0.3.0
	codespan-reporting@0.12.0
	colorchoice@1.0.4
	combine@4.6.7
	concurrent-queue@2.5.0
	config@0.15.18
	core-foundation-sys@0.8.7
	core-foundation@0.10.1
	core-foundation@0.9.4
	core-graphics-types@0.1.3
	core-graphics@0.23.2
	cpp_demangle@0.4.5
	cpufeatures@0.2.17
	cranelift-assembler-x64-meta@0.117.2
	cranelift-assembler-x64@0.117.2
	cranelift-bforest@0.117.2
	cranelift-bitset@0.117.2
	cranelift-codegen-meta@0.117.2
	cranelift-codegen-shared@0.117.2
	cranelift-codegen@0.117.2
	cranelift-control@0.117.2
	cranelift-entity@0.117.2
	cranelift-frontend@0.117.2
	cranelift-isle@0.117.2
	cranelift-native@0.117.2
	crc32fast@1.5.0
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-utils@0.8.21
	crunchy@0.2.4
	crypto-common@0.1.6
	cursor-icon@1.2.0
	darling@0.20.11
	darling_core@0.20.11
	darling_macro@0.20.11
	deranged@0.5.5
	derive_builder@0.20.2
	derive_builder_core@0.20.2
	derive_builder_macro@0.20.2
	derive_more-impl@2.0.1
	derive_more@2.0.1
	digest@0.10.7
	directories-next@2.0.0
	directories@6.0.0
	dirs-sys-next@0.1.2
	dirs-sys@0.3.7
	dirs-sys@0.5.0
	dirs@4.0.0
	dispatch2@0.3.0
	dispatch@0.2.0
	displaydoc@0.2.5
	dlib@0.5.2
	document-features@0.2.12
	downcast-rs@1.2.1
	dpi@0.1.2
	ecolor@0.33.0
	eframe@0.33.0
	egui-remixicon@0.29.1
	egui-wgpu@0.33.0
	egui-winit@0.33.0
	egui@0.33.0
	egui_extras@0.33.0
	egui_glow@0.33.0
	egui_plot@0.34.0
	either@1.15.0
	emath@0.33.0
	embedded-io@0.4.0
	embedded-io@0.6.1
	encoding_rs@0.8.35
	endi@1.1.0
	enum-iterator-derive@1.5.0
	enum-iterator@2.3.0
	enum-map-derive@0.17.0
	enum-map@2.7.3
	enumflags2@0.7.12
	enumflags2_derive@0.7.12
	enumn@0.1.14
	env_filter@0.1.4
	env_logger@0.11.8
	epaint@0.33.0
	epaint_default_fonts@0.33.0
	equivalent@1.0.2
	errno@0.3.14
	error-code@3.3.2
	event-listener-strategy@0.5.4
	event-listener@5.4.1
	extism-convert-macros@1.12.0
	extism-convert@1.12.0
	extism-manifest@1.12.0
	extism-pdk-derive@1.4.1
	extism-pdk@1.4.1
	extism@1.12.0
	eyre@0.6.12
	fallible-iterator@0.3.0
	fastrand@2.3.0
	fax@0.2.6
	fax_derive@0.2.0
	fd-lock@4.0.4
	fdeflate@0.3.7
	filetime@0.2.26
	find-msvc-tools@0.1.4
	flate2@1.1.5
	fnv@1.0.7
	foldhash@0.1.5
	foldhash@0.2.0
	foreign-types-macros@0.2.3
	foreign-types-shared@0.1.1
	foreign-types-shared@0.3.1
	foreign-types@0.3.2
	foreign-types@0.5.0
	form_urlencoded@1.2.2
	fs-set-times@0.20.3
	fsevent-sys@4.1.0
	fst-reader@0.14.1
	ftr_parser@0.2.0
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-lite@2.6.1
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	futures@0.3.31
	fuzzy-matcher@0.3.7
	generic-array@0.14.9
	gethostname@1.1.0
	getrandom@0.2.16
	getrandom@0.3.4
	gimli@0.31.1
	gl_generator@0.14.0
	glob@0.3.3
	glow@0.16.0
	glutin-winit@0.5.0
	glutin@0.32.3
	glutin_egl_sys@0.7.1
	glutin_glx_sys@0.6.1
	glutin_wgl_sys@0.6.1
	h2@0.4.12
	half@2.7.1
	hashbrown@0.15.5
	hashbrown@0.16.0
	heck@0.5.0
	hermit-abi@0.5.2
	hex@0.4.3
	hexf-parse@0.2.1
	http-body-util@0.1.3
	http-body@1.0.1
	http@1.3.1
	httparse@1.10.1
	httpdate@1.0.3
	hyper-rustls@0.27.7
	hyper-tls@0.6.0
	hyper-util@0.1.17
	hyper@1.7.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.64
	icu_collections@2.1.1
	icu_locale_core@2.1.1
	icu_normalizer@2.1.1
	icu_normalizer_data@2.1.1
	icu_properties@2.1.1
	icu_properties_data@2.1.1
	icu_provider@2.1.1
	id-arena@2.2.1
	ident_case@1.0.1
	idna@1.1.0
	idna_adapter@1.2.1
	image@0.25.8
	indenter@0.3.4
	indexmap@2.12.0
	indoc@2.0.7
	inotify-sys@0.1.5
	inotify@0.11.0
	io-extras@0.18.4
	io-lifetimes@2.0.4
	ipnet@2.11.0
	iri-string@0.7.8
	is_terminal_polyfill@1.70.2
	itertools@0.12.1
	itertools@0.13.0
	itertools@0.14.0
	itoa@1.0.15
	jni-sys@0.3.0
	jni@0.21.1
	jobserver@0.1.34
	js-sys@0.3.77
	khronos_api@3.1.0
	kqueue-sys@1.0.4
	kqueue@1.1.1
	lazy_static@1.5.0
	leb128@0.2.5
	leb128fmt@0.1.0
	libc@0.2.177
	libloading@0.8.9
	libm@0.2.15
	libredox@0.1.10
	linux-raw-sys@0.11.0
	linux-raw-sys@0.4.15
	litemap@0.8.1
	litrs@1.0.0
	local-impl@0.1.2
	lock_api@0.4.14
	log@0.4.28
	lz4_flex@0.11.5
	mach2@0.4.3
	manyhow-macros@0.11.4
	manyhow@0.11.4
	matchers@0.2.0
	maybe-owned@0.3.4
	memchr@2.7.6
	memfd@0.6.5
	memmap2@0.9.9
	memoffset@0.9.1
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mio@1.1.0
	moxcms@0.7.9
	naga@27.0.3
	native-tls@0.2.14
	ndk-context@0.1.1
	ndk-sys@0.6.0+11769913
	ndk@0.9.0
	nix@0.30.1
	nohash-hasher@0.2.0
	nom@7.1.3
	notify-types@2.0.0
	notify@8.2.0
	nu-ansi-term@0.50.3
	num-bigint@0.4.6
	num-complex@0.4.6
	num-conv@0.1.0
	num-integer@0.1.46
	num-iter@0.1.45
	num-rational@0.4.2
	num-traits@0.2.19
	num@0.4.3
	num_enum@0.7.5
	num_enum_derive@0.7.5
	num_threads@0.1.7
	numeric-sort@0.1.5
	objc-sys@0.3.5
	objc2-app-kit@0.2.2
	objc2-app-kit@0.3.2
	objc2-cloud-kit@0.2.2
	objc2-contacts@0.2.2
	objc2-core-data@0.2.2
	objc2-core-foundation@0.3.2
	objc2-core-graphics@0.3.2
	objc2-core-image@0.2.2
	objc2-core-location@0.2.2
	objc2-encode@4.1.0
	objc2-foundation@0.2.2
	objc2-foundation@0.3.2
	objc2-io-surface@0.3.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
	objc2@0.6.3
	object@0.32.2
	object@0.36.7
	once_cell@1.21.3
	once_cell_polyfill@1.70.2
	openssl-macros@0.1.1
	openssl-probe@0.1.6
	openssl-sys@0.9.110
	openssl@0.10.74
	option-ext@0.2.0
	orbclient@0.3.48
	ordered-stream@0.2.0
	owned_ttf_parser@0.25.1
	parking@2.2.1
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	paste@1.0.15
	pathdiff@0.2.3
	percent-encoding@2.3.2
	pin-project-internal@1.1.10
	pin-project-lite@0.2.16
	pin-project@1.1.10
	pin-utils@0.1.0
	piper@0.2.4
	pkg-config@0.3.32
	png@0.18.0
	polling@3.11.0
	pollster@0.4.0
	portable-atomic-util@0.2.4
	portable-atomic@1.11.1
	postcard@1.1.3
	potential_utf@0.1.4
	powerfmt@0.2.0
	ppv-lite86@0.2.21
	prettyplease@0.2.37
	proc-macro-crate@3.4.0
	proc-macro-utils@0.10.0
	proc-macro2@1.0.103
	profiling@1.0.17
	prost-derive@0.14.1
	prost@0.14.1
	psm@0.1.28
	pulley-interpreter@30.0.2
	pure-rust-locales@0.8.2
	pxfm@0.1.25
	pyo3-build-config@0.27.1
	pyo3-ffi@0.27.1
	pyo3-macros-backend@0.27.1
	pyo3-macros@0.27.1
	pyo3@0.27.1
	quick-error@2.0.1
	quick-xml@0.36.2
	quick-xml@0.37.5
	quote@1.0.41
	r-efi@5.3.0
	rand@0.8.5
	rand@0.9.2
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.6.4
	rand_core@0.9.3
	raw-window-handle@0.6.2
	rayon-core@1.13.0
	rayon@1.11.0
	redox_syscall@0.4.1
	redox_syscall@0.5.18
	redox_users@0.4.6
	redox_users@0.5.2
	regalloc2@0.11.2
	regex-automata@0.4.13
	regex-syntax@0.8.8
	regex@1.12.2
	renderdoc-sys@1.1.0
	reqwest@0.12.24
	rfd@0.15.4
	ring@0.17.14
	rmp-serde@1.3.0
	rmp@0.8.14
	ron@0.10.1
	rustc-demangle@0.1.26
	rustc-hash@1.1.0
	rustc-hash@2.1.1
	rustix-linux-procfs@0.1.1
	rustix@0.38.44
	rustix@1.1.2
	rustls-pki-types@1.13.0
	rustls-webpki@0.103.8
	rustls@0.23.34
	rustversion@1.0.22
	ryu@1.0.20
	same-file@1.0.6
	schannel@0.1.28
	scoped-tls@1.0.1
	scopeguard@1.2.0
	security-framework-sys@2.15.0
	security-framework@2.11.1
	semver@1.0.27
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.145
	serde_repr@0.1.20
	serde_spanned@0.6.9
	serde_spanned@1.0.3
	serde_urlencoded@0.7.1
	sha2@0.10.9
	sharded-slab@0.1.7
	shellexpand@2.1.2
	shlex@1.3.0
	signal-hook-registry@1.4.6
	simd-adler32@0.3.7
	simple-eyre@0.3.1
	slab@0.4.11
	slotmap@1.0.7
	smallvec@1.15.1
	smithay-client-toolkit@0.19.2
	smithay-clipboard@0.7.2
	smol_str@0.2.2
	socket2@0.6.1
	softposit@0.4.0
	sptr@0.3.2
	stable_deref_trait@1.2.1
	static_assertions@1.1.0
	strsim@0.11.1
	subtle@2.6.1
	syn@2.0.108
	sync_wrapper@1.0.2
	synstructure@0.13.2
	sys-locale@0.3.2
	system-configuration-sys@0.6.0
	system-configuration@0.6.1
	system-interface@0.27.3
	tar@0.4.44
	target-lexicon@0.13.3
	tempfile@3.23.0
	termcolor@1.4.1
	thiserror-impl@1.0.69
	thiserror-impl@2.0.17
	thiserror@1.0.69
	thiserror@2.0.17
	thread_local@1.1.9
	tiff@0.10.3
	time-core@0.1.6
	time-macros@0.2.24
	time@0.3.44
	tinystr@0.8.2
	tokio-macros@2.6.0
	tokio-native-tls@0.3.1
	tokio-rustls@0.26.4
	tokio-stream@0.1.17
	tokio-util@0.7.16
	tokio@1.48.0
	toml@0.8.23
	toml@0.9.8
	toml_datetime@0.6.11
	toml_datetime@0.7.3
	toml_edit@0.22.27
	toml_edit@0.23.7
	toml_parser@1.0.4
	toml_write@0.1.2
	toml_writer@1.0.4
	tower-http@0.6.6
	tower-layer@0.3.3
	tower-service@0.3.3
	tower@0.5.2
	tracing-attributes@0.1.30
	tracing-core@0.1.34
	tracing-log@0.2.0
	tracing-subscriber@0.3.20
	tracing-wasm@0.2.1
	tracing@0.1.41
	trait-variant@0.1.2
	try-lock@0.2.5
	ttf-parser@0.25.1
	twox-hash@2.1.2
	type-map@0.5.1
	typenum@1.19.0
	uds_windows@1.1.0
	unicode-ident@1.0.22
	unicode-segmentation@1.12.0
	unicode-width@0.2.2
	unicode-xid@0.2.6
	unindent@0.2.4
	untrusted@0.9.0
	url@2.5.7
	urlencoding@2.1.3
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid@1.18.1
	valuable@0.1.1
	vcpkg@0.2.15
	vergen-gitcl@1.0.8
	vergen-lib@0.1.6
	vergen@9.0.6
	version_check@0.9.5
	walkdir@2.5.0
	want@0.3.1
	wasi-common@30.0.2
	wasi@0.11.1+wasi-snapshot-preview1
	wasip2@1.0.1+wasi-0.2.4
	wasite@0.1.0
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-futures@0.4.50
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	wasm-encoder@0.224.1
	wasm-encoder@0.240.0
	wasm-streams@0.4.2
	wasmparser@0.224.1
	wasmparser@0.240.0
	wasmprinter@0.224.1
	wasmtime-asm-macros@30.0.2
	wasmtime-cache@30.0.2
	wasmtime-component-macro@30.0.2
	wasmtime-component-util@30.0.2
	wasmtime-cranelift@30.0.2
	wasmtime-environ@30.0.2
	wasmtime-fiber@30.0.2
	wasmtime-jit-icache-coherence@30.0.2
	wasmtime-math@30.0.2
	wasmtime-slab@30.0.2
	wasmtime-versioned-export-macros@30.0.2
	wasmtime-winch@30.0.2
	wasmtime-wit-bindgen@30.0.2
	wasmtime@30.0.2
	wast@240.0.0
	wast@35.0.2
	wat@1.240.0
	wayland-backend@0.3.11
	wayland-client@0.31.11
	wayland-csd-frame@0.3.0
	wayland-cursor@0.31.11
	wayland-protocols-plasma@0.3.9
	wayland-protocols-wlr@0.3.9
	wayland-protocols@0.32.9
	wayland-scanner@0.31.7
	wayland-sys@0.31.7
	web-sys@0.3.77
	web-time@1.1.0
	webbrowser@1.0.6
	weezl@0.1.10
	wellen@0.19.0
	wgpu-core-deps-windows-linux-android@27.0.0
	wgpu-core@27.0.3
	wgpu-hal@27.0.4
	wgpu-types@27.0.1
	wgpu@27.0.1
	whoami@1.6.1
	wiggle-generate@30.0.2
	wiggle-macro@30.0.2
	wiggle@30.0.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.11
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	winch-codegen@30.0.2
	windows-collections@0.2.0
	windows-core@0.61.2
	windows-core@0.62.2
	windows-future@0.2.1
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.1.3
	windows-link@0.2.1
	windows-numerics@0.2.0
	windows-registry@0.5.3
	windows-result@0.3.4
	windows-result@0.4.1
	windows-strings@0.4.2
	windows-strings@0.5.1
	windows-sys@0.45.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.42.2
	windows-targets@0.52.6
	windows-targets@0.53.5
	windows-threading@0.1.0
	windows@0.61.3
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.1
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.1
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.1
	winit@0.30.12
	winnow@0.7.13
	winx@0.36.4
	wit-bindgen@0.46.0
	wit-parser@0.224.1
	witx@0.9.1
	writeable@0.6.2
	x11-dl@2.21.0
	x11rb-protocol@0.13.2
	x11rb@0.13.2
	xattr@1.6.1
	xcursor@0.3.10
	xkbcommon-dl@0.4.2
	xkeysym@0.2.1
	xml-rs@0.8.28
	yoke-derive@0.8.1
	yoke@0.8.1
	zbus-lockstep-macros@0.5.1
	zbus-lockstep@0.5.1
	zbus@5.12.0
	zbus_macros@5.12.0
	zbus_names@4.2.0
	zbus_xml@5.0.2
	zerocopy-derive@0.8.27
	zerocopy@0.8.27
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.2
	zerotrie@0.2.3
	zerovec-derive@0.11.2
	zerovec@0.11.5
	zstd-safe@7.2.4
	zstd-sys@2.0.16+zstd.1.5.7
	zstd@0.13.3
	zune-core@0.4.12
	zune-jpeg@0.4.21
	zvariant@5.8.0
	zvariant_derive@5.8.0
	zvariant_utils@3.2.1
"

# Git submodule commits
F128_COMMIT="e60de395f0d6454c1dc546b87f06a6358425b6b6"
INSTRUCTION_DECODER_COMMIT="7c5adb7621a6f277ee13ec1a4babe32ce56cc0c3"

PYTHON_COMPAT=( python3_{11..14} )

inherit cargo desktop python-any-r1

DESCRIPTION="Waveform viewer with a focus on a snappy usable interface"
HOMEPAGE="https://surfer-project.org/ https://gitlab.com/surfer-project/surfer"
SRC_URI="
	https://gitlab.com/surfer-project/${PN}/-/archive/v${PV}/${PN}-v${PV}.tar.bz2
		-> ${P}.tar.bz2
	https://github.com/jkarns275/f128/archive/${F128_COMMIT}.tar.gz
		-> f128-${F128_COMMIT}.tar.gz
	https://github.com/ics-jku/instruction-decoder/archive/${INSTRUCTION_DECODER_COMMIT}.tar.gz
		-> instruction-decoder-${INSTRUCTION_DECODER_COMMIT}.tar.gz
	https://gitlab.com/surfer-project/${PN}/-/raw/main/surfer/assets/com.gitlab.surferproject.surfer.png
	https://gitlab.com/surfer-project/${PN}/-/raw/main/surfer/assets/com.gitlab.surferproject.surfer.desktop
	${CARGO_CRATE_URIS}
"

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

LICENSE="EUPL-1.2"
# Dependent crate licenses
LICENSE+="
	0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD Boost-1.0
	CC0-1.0 ISC MIT MPL-2.0 OFL-1.1 UbuntuFontLicense-1.0
	Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"
IUSE="accesskit +performance-plot python +wasm-plugins"

DEPEND="dev-libs/openssl:="
RDEPEND="${DEPEND}"
BDEPEND="
	virtual/pkgconfig
	python? ( ${PYTHON_DEPS} )
"

RUST_MIN_VER="1.85"

# rust does not use *FLAGS from make.conf, silence portage warning
QA_FLAGS_IGNORED="
	usr/bin/${PN}
	usr/bin/surver
"

# Tests require network and special files
RESTRICT="test"

pkg_setup() {
	use python && python-any-r1_pkg_setup
	rust_pkg_setup
}

src_prepare() {
	default

	# Move submodules into place
	rm -rf f128 instruction-decoder || die
	mv "${WORKDIR}/f128-${F128_COMMIT}" f128 || die
	mv "${WORKDIR}/instruction-decoder-${INSTRUCTION_DECODER_COMMIT}" instruction-decoder || die

	# Remove dev-dependencies that aren't needed (tests disabled) and can't be
	# fetched in offline mode
	sed -i \
		-e '/^\[dev-dependencies\]/,/^\[/{ /^\[dev-dependencies\]/d; /^\[/!d; }' \
		-e "/^\[target\.'cfg(not(target_os = \"unknown\"))'.dev-dependencies\]/,/^\[/{ /^\[target/d; /^\[/!d; }" \
		libsurfer/Cargo.toml || die
}

src_configure() {
	local myfeatures=(
		$(usev accesskit)
		$(usev performance-plot performance_plot)
		$(usev python)
		$(usev wasm-plugins wasm_plugins)
	)
	cargo_src_configure
}

src_compile() {
	cargo_src_compile --bin surfer --bin surver
}

src_install() {
	# Install binaries directly from build output
	# Using dobin instead of cargo_src_install since this is a workspace
	# and surver doesn't have the same features as surfer
	dobin target/release/surfer
	dobin target/release/surver

	# Install desktop file and icon (from main branch)
	# Desktop file expects Icon=com.gitlab.surferproject.surfer.png
	doicon "${DISTDIR}/com.gitlab.surferproject.surfer.png"
	domenu "${DISTDIR}/com.gitlab.surferproject.surfer.desktop"

	dodoc README.md CHANGELOG.md
}