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

# Auto-Generated by cargo-ebuild 0.5.4-r1

EAPI=8

CRATES="
	adler2@2.0.1
	ahash@0.8.12
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	alsa@0.9.1
	alsa-sys@0.3.1
	android_system_properties@0.1.5
	anstream@0.6.21
	anstyle@1.0.13
	anstyle-parse@0.2.7
	anstyle-query@1.1.4
	anstyle-wincon@3.0.10
	anyhow@1.0.100
	arboard@3.6.1
	arc-swap@1.7.1
	arrayvec@0.7.6
	autocfg@1.5.0
	bindgen@0.72.1
	bitflags@1.3.2
	bitflags@2.9.4
	block-buffer@0.10.4
	bstr@1.12.0
	bumpalo@3.19.0
	bytemuck@1.24.0
	byteorder@1.5.0
	bytes@1.10.1
	camino@1.2.1
	cargo-platform@0.2.0
	cargo-util-schemas@0.8.2
	cargo_metadata@0.21.0
	cc@1.2.41
	cesu8@1.1.0
	cexpr@0.6.0
	cfg-if@1.0.3
	cfg_aliases@0.2.1
	chrono@0.4.42
	clang-sys@1.8.1
	clap@4.5.48
	clap-help@1.5.0
	clap_builder@4.5.48
	clap_complete@4.5.58
	clap_derive@4.5.47
	clap_lex@0.7.5
	cli-log@2.1.0
	clipboard-win@5.4.1
	clru@0.6.2
	colorchoice@1.0.4
	combine@4.6.7
	convert_case@0.7.1
	coolor@1.1.0
	core-foundation-sys@0.8.7
	coreaudio-rs@0.11.3
	coreaudio-sys@0.2.17
	cpal@0.15.3
	cpufeatures@0.2.17
	crc32fast@1.5.0
	crokey@1.3.0
	crokey-proc_macros@1.3.0
	crossbeam@0.8.4
	crossbeam-channel@0.5.15
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-queue@0.3.12
	crossbeam-utils@0.8.21
	crossterm@0.29.0
	crossterm_winapi@0.9.1
	crypto-common@0.1.6
	ctrlc@3.5.0
	dasp_sample@0.11.0
	derive_more@2.0.1
	derive_more-impl@2.0.1
	diff@0.1.13
	digest@0.10.7
	directories-next@2.0.0
	dirs-sys-next@0.1.2
	dispatch@0.2.0
	dispatch2@0.3.0
	displaydoc@0.2.5
	document-features@0.2.11
	dunce@1.0.5
	either@1.15.0
	encoding_rs@0.8.35
	equivalent@1.0.2
	erased-serde@0.4.8
	errno@0.3.14
	error-code@3.3.2
	faster-hex@0.10.0
	fastrand@2.3.0
	file-size@1.0.3
	filetime@0.2.26
	find-msvc-tools@0.1.4
	flate2@1.1.4
	fnv@1.0.7
	form_urlencoded@1.2.2
	fsevent-sys@4.1.0
	generic-array@0.14.9
	gethostname@1.0.2
	getrandom@0.2.16
	getrandom@0.3.3
	gix@0.72.1
	gix-actor@0.35.4
	gix-bitmap@0.2.14
	gix-chunk@0.4.11
	gix-command@0.6.2
	gix-commitgraph@0.28.0
	gix-config@0.45.1
	gix-config-value@0.15.1
	gix-date@0.10.5
	gix-diff@0.52.1
	gix-discover@0.40.1
	gix-features@0.42.1
	gix-fs@0.15.0
	gix-glob@0.20.1
	gix-hash@0.18.0
	gix-hashtable@0.8.1
	gix-ignore@0.15.0
	gix-index@0.40.1
	gix-lock@17.1.0
	gix-object@0.49.1
	gix-odb@0.69.1
	gix-pack@0.59.1
	gix-packetline@0.19.1
	gix-path@0.10.20
	gix-protocol@0.50.1
	gix-quote@0.6.0
	gix-ref@0.52.1
	gix-refspec@0.30.1
	gix-revision@0.34.1
	gix-revwalk@0.20.1
	gix-sec@0.11.0
	gix-shallow@0.4.0
	gix-tempfile@17.1.0
	gix-trace@0.1.13
	gix-transport@0.47.0
	gix-traverse@0.46.2
	gix-url@0.31.0
	gix-utils@0.3.0
	gix-validate@0.10.0
	gix-worktree@0.41.0
	glob@0.3.3
	hash32@0.3.1
	hashbrown@0.14.5
	hashbrown@0.16.0
	heapless@0.8.0
	heck@0.5.0
	home@0.5.11
	iana-time-zone@0.1.64
	iana-time-zone-haiku@0.1.2
	icu_collections@2.0.0
	icu_locale_core@2.0.0
	icu_normalizer@2.0.0
	icu_normalizer_data@2.0.0
	icu_properties@2.0.1
	icu_properties_data@2.0.1
	icu_provider@2.0.0
	idna@1.1.0
	idna_adapter@1.2.1
	indexmap@2.11.4
	inotify@0.11.0
	inotify-sys@0.1.5
	iq@0.4.0
	is_executable@1.0.5
	is_terminal_polyfill@1.70.1
	itertools@0.13.0
	itoa@1.0.15
	jiff@0.2.15
	jiff-static@0.2.15
	jiff-tzdb@0.1.4
	jiff-tzdb-platform@0.1.3
	jni@0.21.1
	jni-sys@0.3.0
	jobserver@0.1.34
	js-sys@0.3.81
	kqueue@1.1.1
	kqueue-sys@1.0.4
	lazy-regex@3.4.1
	lazy-regex-proc_macros@3.4.1
	lazy_static@1.5.0
	libc@0.2.177
	libloading@0.8.9
	libredox@0.1.10
	libz-rs-sys@0.5.2
	linux-raw-sys@0.11.0
	litemap@0.8.0
	litrs@0.4.2
	lock_api@0.4.14
	log@0.4.28
	mach2@0.4.3
	maybe-async@0.2.10
	memchr@2.7.6
	memmap2@0.9.8
	minimad@0.13.1
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mio@1.0.4
	ndk@0.8.0
	ndk-context@0.1.1
	ndk-sys@0.5.0+25.2.9519653
	nix@0.29.0
	nix@0.30.1
	nom@7.1.3
	notify@8.2.0
	notify-types@2.0.0
	num-derive@0.4.2
	num-traits@0.2.19
	num_enum@0.7.4
	num_enum_derive@0.7.4
	objc2@0.6.3
	objc2-app-kit@0.3.2
	objc2-core-foundation@0.3.2
	objc2-core-graphics@0.3.2
	objc2-encode@4.1.0
	objc2-foundation@0.3.2
	objc2-io-surface@0.3.2
	oboe@0.6.1
	oboe-sys@0.6.1
	once_cell@1.21.3
	once_cell_polyfill@1.70.1
	ordered-float@2.10.1
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	paste@1.0.15
	percent-encoding@2.3.2
	pkg-config@0.3.32
	portable-atomic@1.11.1
	portable-atomic-util@0.2.4
	potential_utf@0.1.3
	pretty_assertions@1.4.1
	proc-macro-crate@3.4.0
	proc-macro2@1.0.101
	proc-status@0.1.1
	prodash@29.0.2
	quote@1.0.41
	r-efi@5.3.0
	redox_syscall@0.5.18
	redox_users@0.4.6
	regex@1.12.2
	regex-automata@0.4.13
	regex-syntax@0.8.8
	rodio@0.20.1
	rustc-hash@2.1.1
	rustix@1.1.2
	rustversion@1.0.22
	ryu@1.0.20
	same-file@1.0.6
	scopeguard@1.2.0
	semver@1.0.27
	serde@1.0.228
	serde-untagged@0.1.9
	serde-value@0.7.0
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.145
	serde_spanned@0.6.9
	sha1@0.10.6
	sha1-checked@0.10.0
	shell-words@1.1.0
	shlex@1.3.0
	signal-hook@0.3.18
	signal-hook-mio@0.2.4
	signal-hook-registry@1.4.6
	simd-adler32@0.3.7
	smallvec@1.15.1
	stable_deref_trait@1.2.1
	strict@0.2.0
	strsim@0.11.1
	symphonia@0.5.5
	symphonia-bundle-mp3@0.5.5
	symphonia-core@0.5.5
	symphonia-metadata@0.5.5
	syn@2.0.106
	synstructure@0.13.2
	tempfile@3.23.0
	termimad@0.34.0
	terminal-light@1.8.0
	thiserror@1.0.69
	thiserror@2.0.17
	thiserror-impl@1.0.69
	thiserror-impl@2.0.17
	tinystr@0.8.1
	tinyvec@1.10.0
	tinyvec_macros@0.1.1
	toml@0.8.23
	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
	typeid@1.0.3
	typenum@1.19.0
	unicode-bom@2.0.3
	unicode-ident@1.0.19
	unicode-normalization@0.1.24
	unicode-segmentation@1.12.0
	unicode-width@0.1.14
	unicode-width@0.2.2
	unicode-xid@0.2.6
	url@2.5.7
	utf8_iter@1.0.4
	utf8parse@0.2.2
	version_check@0.9.5
	vte@0.15.0
	walkdir@2.5.0
	wasi@0.11.1+wasi-snapshot-preview1
	wasi@0.14.7+wasi-0.2.4
	wasip2@1.0.1+wasi-0.2.4
	wasm-bindgen@0.2.104
	wasm-bindgen-backend@0.2.104
	wasm-bindgen-futures@0.4.54
	wasm-bindgen-macro@0.2.104
	wasm-bindgen-macro-support@0.2.104
	wasm-bindgen-shared@0.2.104
	web-sys@0.3.81
	winapi@0.3.9
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.11
	winapi-x86_64-pc-windows-gnu@0.4.0
	windows@0.54.0
	windows-core@0.54.0
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-result@0.1.2
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.45.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_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
	winnow@0.7.13
	wit-bindgen@0.46.0
	writeable@0.6.1
	x11rb@0.13.2
	x11rb-protocol@0.13.2
	xterm-query@0.5.2
	yansi@1.0.1
	yoke@0.8.0
	yoke-derive@0.8.0
	zerocopy@0.8.27
	zerocopy-derive@0.8.27
	zerofrom@0.1.6
	zerofrom-derive@0.1.6
	zerotrie@0.2.2
	zerovec@0.11.4
	zerovec-derive@0.11.1
	zlib-rs@0.5.2
"

inherit cargo shell-completion

DESCRIPTION="background rust compiler"
HOMEPAGE="https://dystroy.org/bacon https://github.com/Canop/bacon"
SRC_URI="
	https://github.com/Canop/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="AGPL-3"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 BSD Boost-1.0 CC0-1.0 ISC MIT MPL-2.0 Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"

RUST_MIN_VER="1.86.0"

# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"
QA_PRESTRIPPED="${QA_FLAGS_IGNORED}"

src_compile() {
	cargo_src_compile

	COMPLETE=bash $(cargo_target_dir)/${PN} > bash-completion.sh || die
	COMPLETE=zsh  $(cargo_target_dir)/${PN} > zsh-completion.zsh || die
	COMPLETE=fish $(cargo_target_dir)/${PN} > fish-completion.fish || die

	# replace generated path with final install location
	sed -i -e "s#${S}/$(cargo_target_dir)#/usr/bin#" bash-completion.sh
	sed -i -e "s#${S}/$(cargo_target_dir)#/usr/bin#" zsh-completion.zsh
	sed -i -e "s#${S}/$(cargo_target_dir)#/usr/bin#" fish-completion.fish
}

src_install() {
	cargo_src_install

	newbashcomp bash-completion.sh ${PN}
	newzshcomp zsh-completion.zsh _${PN}
	newfishcomp fish-completion.fish ${PN}.fish
}