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

# Autogenerated by pycargoebuild 0.15.0

EAPI=8

CRATES="
	addr2line@0.25.1
	adler2@2.0.1
	aho-corasick@1.1.4
	allocator-api2@0.2.21
	android_system_properties@0.1.5
	anstream@0.6.21
	anstream@1.0.0
	anstyle-parse@0.2.7
	anstyle-parse@1.0.0
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anstyle@1.0.13
	anyhow@1.0.102
	ar@0.9.0
	arrayref@0.3.9
	arrayvec@0.7.6
	atomic-polyfill@1.0.3
	atomic-take@1.1.0
	autocfg@1.5.0
	backtrace@0.3.76
	bitflags@2.11.1
	blake3@1.8.5
	block-buffer@0.12.0
	block2@0.6.2
	bumpalo-herd@0.1.2
	bumpalo@3.20.2
	bytecount@0.6.9
	byteorder@1.5.0
	bytes@1.11.1
	bytesize@2.3.1
	cc@1.2.62
	cfg-if@1.0.4
	cfg_aliases@0.2.1
	clap@4.5.60
	clap_builder@4.5.60
	clap_derive@4.5.55
	clap_lex@1.0.0
	cobs@0.3.0
	colorchoice@1.0.4
	colored@3.1.1
	colosseum@0.2.2
	console@0.16.2
	const-oid@0.10.2
	constant_time_eq@0.4.2
	convert_case@0.10.0
	cpp_demangle@0.4.5
	cpufeatures@0.3.0
	crc32fast@1.5.0
	critical-section@1.2.0
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.18
	crossbeam-queue@0.3.12
	crossbeam-utils@0.8.21
	crypto-common@0.2.1
	debugid@0.8.0
	derive_more-impl@2.1.1
	derive_more@2.1.1
	dhat@0.3.3
	digest@0.11.3
	dispatch2@0.3.1
	either@1.15.0
	embedded-io@0.4.0
	embedded-io@0.6.1
	encode_unicode@1.0.0
	equivalent@1.0.2
	errno@0.3.14
	escape8259@0.5.3
	fastrand@2.3.0
	find-msvc-tools@0.1.9
	flate2@1.1.9
	fnv@1.0.7
	foldhash@0.1.5
	foldhash@0.2.0
	getrandom@0.3.4
	getrandom@0.4.1
	gimli@0.32.3
	gimli@0.33.0
	glob@0.3.3
	hash32@0.2.1
	hashbrown@0.15.5
	hashbrown@0.16.1
	hashbrown@0.17.1
	heapless@0.7.17
	heck@0.5.0
	hex@0.4.3
	hybrid-array@0.4.12
	iced-x86@1.21.0
	id-arena@2.3.0
	indexmap@2.14.0
	indicatif@0.18.4
	is_terminal_polyfill@1.70.2
	itertools@0.14.0
	itoa@1.0.17
	jobserver@0.1.34
	js-sys@0.3.85
	lazy_static@1.5.0
	leb128@0.2.6
	leb128fmt@0.1.0
	libc@0.2.186
	libloading@0.9.0
	libmimalloc-sys@0.1.47
	libtest-mimic@0.8.2
	linux-raw-sys@0.12.1
	lock_api@0.4.14
	log@0.4.29
	matchers@0.2.0
	memchr@2.8.0
	memmap2@0.9.10
	mimalloc@0.1.50
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mintex@0.1.4
	nix@0.30.1
	nom@7.1.3
	num-traits@0.2.19
	objc2-cloud-kit@0.3.2
	objc2-core-data@0.3.2
	objc2-core-foundation@0.3.2
	objc2-core-graphics@0.3.2
	objc2-core-image@0.3.2
	objc2-core-location@0.3.2
	objc2-core-text@0.3.2
	objc2-encode@4.1.0
	objc2-foundation@0.3.2
	objc2-io-surface@0.3.2
	objc2-quartz-core@0.3.2
	objc2-ui-kit@0.3.2
	objc2-user-notifications@0.3.2
	objc2@0.6.4
	object@0.37.3
	object@0.39.1
	once_cell@1.21.3
	once_cell_polyfill@1.70.2
	os_info@3.14.0
	papergrid@0.17.0
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	paste@1.0.15
	perf-event-open-sys@4.0.0
	perf-event@0.4.8
	perfetto-recorder@0.3.2
	pin-project-lite@0.2.16
	pkg-config@0.3.32
	portable-atomic@1.13.1
	postcard@1.1.3
	ppv-lite86@0.2.21
	prettyplease@0.2.37
	proc-macro-error-attr2@2.0.0
	proc-macro-error2@2.0.1
	proc-macro2@1.0.106
	prost-derive@0.14.3
	prost@0.14.3
	quote@1.0.44
	r-efi@5.3.0
	rand@0.9.2
	rand_chacha@0.9.0
	rand_core@0.9.5
	rayon-core@1.13.0
	rayon@1.12.0
	redox_syscall@0.5.18
	regex-automata@0.4.14
	regex-syntax@0.8.9
	regex@1.12.3
	remain@0.2.15
	rustc-demangle@0.1.27
	rustc-hash@1.1.0
	rustc_version@0.4.1
	rustix@1.1.4
	rustversion@1.0.22
	ruzstd@0.8.2
	ryu@1.0.23
	scopeguard@1.2.0
	semver@1.0.27
	serde-keyvalue@0.1.0
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_json@1.0.149
	serde_spanned@1.1.1
	serde_yaml@0.9.34+deprecated
	sha2@0.11.0
	sharded-offset-map@0.2.0
	sharded-slab@0.1.7
	sharded-vec-writer@0.3.0
	sharded-vec-writer@0.4.0
	shlex@1.3.0
	simd-adler32@0.3.8
	smallvec@1.15.1
	spin@0.9.8
	stable_deref_trait@1.2.1
	strsim@0.11.1
	strum@0.28.0
	strum_macros@0.28.0
	symbolic-common@13.0.0
	symbolic-demangle@13.0.0
	syn@2.0.117
	tabled@0.20.0
	tabled_derive@0.11.0
	tempfile@3.27.0
	testing_table@0.3.0
	thiserror-impl@1.0.69
	thiserror-impl@2.0.18
	thiserror@1.0.69
	thiserror@2.0.18
	thousands@0.2.0
	thread_local@1.1.9
	toml@1.1.2+spec-1.1.0
	toml_datetime@1.1.1+spec-1.1.0
	toml_parser@1.1.2+spec-1.1.0
	toml_writer@1.1.1+spec-1.1.0
	tracing-attributes@0.1.31
	tracing-core@0.1.36
	tracing-subscriber@0.3.23
	tracing@0.1.44
	twox-hash@2.1.2
	typenum@1.20.0
	unicode-ident@1.0.24
	unicode-segmentation@1.12.0
	unicode-width@0.2.2
	unicode-xid@0.2.6
	unit-prefix@0.5.2
	unsafe-libyaml@0.2.11
	utf8parse@0.2.2
	uuid@1.23.1
	wait-timeout@0.2.1
	wait4@0.1.3
	wasip2@1.0.2+wasi-0.2.9
	wasip3@0.4.0+wasi-0.3.0-rc-2026-01-06
	wasm-bindgen-macro-support@0.2.108
	wasm-bindgen-macro@0.2.108
	wasm-bindgen-shared@0.2.108
	wasm-bindgen@0.2.108
	wasm-encoder@0.244.0
	wasm-metadata@0.244.0
	wasmparser@0.244.0
	wasmparser@0.248.0
	web-time@1.1.0
	which@8.0.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-link@0.2.1
	windows-sys@0.61.2
	winnow@1.0.3
	wit-bindgen-core@0.51.0
	wit-bindgen-rust-macro@0.51.0
	wit-bindgen-rust@0.51.0
	wit-bindgen@0.51.0
	wit-component@0.244.0
	wit-parser@0.244.0
	zerocopy-derive@0.8.48
	zerocopy@0.8.48
	zlib-rs@0.6.2
	zmij@1.0.21
	zstd-safe@7.2.4
	zstd-sys@2.0.16+zstd.1.5.7
	zstd@0.13.3
"

LLVM_COMPAT=( {21..22} )
RUST_MIN_VER="1.92"
inherit cargo llvm-r2 unpacker

DESCRIPTION="A very fast linker for Linux"
HOMEPAGE="https://github.com/davidlattimore/wild"
if [[ ${PV} == *9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/davidlattimore/wild.git"
else
	SRC_URI="https://github.com/davidlattimore/wild/archive/${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"
	KEYWORDS="~amd64 ~arm64 ~riscv"
fi

LICENSE="|| ( Apache-2.0 MIT )"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0 Unicode-3.0 ZLIB"
SLOT="0"
# LTO disabled by default upstream
IUSE="lto test"
RESTRICT="!test? ( test )"

# TODO: blake3 still bundled?
# https://github.com/BLAKE3-team/BLAKE3/issues/130
# https://github.com/BLAKE3-team/BLAKE3/issues/425
RDEPEND="app-arch/zstd:="
DEPEND="${RDEPEND}"

# Upstream uses LLD and Clang for running some of their tests
BDEPEND="
	virtual/pkgconfig
	test? ( $(llvm_gen_dep '
			llvm-core/clang:${LLVM_SLOT}=
			llvm-core/lld:${LLVM_SLOT}=
		')
	)
"

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

pkg_setup() {
	# zstd-sys https://wiki.gentoo.org/wiki/Project:Rust/sys_crates#zstd-sys
	export ZSTD_SYS_USE_PKG_CONFIG=1
	rust_pkg_setup
	use test && llvm-r2_pkg_setup
}

src_unpack() {
	if [[ ${PV} == *9999* ]]; then
		git-r3_src_unpack
		S="${S}/rust-src" cargo_live_src_unpack
	else
		unpacker ${P}.tar.gz
		cargo_src_unpack
	fi
}

src_configure() {
	# LTO linker plugin (experimental)
	local myfeatures=( $(usev lto plugins) )

	cargo_src_configure
}

src_install() {
	# Wild has a virtual Cargo.toml, so specify the path to the bin
	cargo_src_install --path "${S}/wild"

	dosym ${PN} /usr/bin/ld.${PN}
}