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

EAPI=8

CRATES="
	Inflector@0.11.4
	addr2line@0.25.1
	adler2@2.0.1
	aead@0.5.2
	aes-gcm@0.10.3
	aes@0.8.4
	age-core@0.11.0
	age@0.11.2
	ahash@0.8.12
	aho-corasick@1.1.4
	allocative@0.3.6
	allocative_derive@0.3.6
	allocator-api2@0.2.21
	alsa-sys@0.4.0
	alsa@0.11.0
	android_system_properties@0.1.5
	annotate-snippets@0.9.2
	ansi-to-tui@8.0.1
	anstream@0.6.21
	anstyle-parse@0.2.7
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anstyle@1.0.13
	anyhow@1.0.103
	approx@0.5.1
	arbitrary@1.4.2
	arboard@3.6.1
	arc-swap@1.9.0
	arrayref@0.3.9
	arrayvec@0.7.6
	ascii@1.1.0
	asn1-rs-derive@0.5.1
	asn1-rs-derive@0.6.0
	asn1-rs-impl@0.2.0
	asn1-rs@0.6.2
	asn1-rs@0.7.1
	assert-json-diff@2.0.2
	assert_cmd@2.1.2
	assert_matches@1.5.0
	async-broadcast@0.7.2
	async-channel@2.5.0
	async-executor@1.13.3
	async-fs@2.2.0
	async-io@2.6.0
	async-lock@3.4.2
	async-process@2.5.0
	async-recursion@1.1.1
	async-signal@0.2.13
	async-stream-impl@0.3.6
	async-stream@0.3.6
	async-task@4.7.1
	async-trait@0.1.89
	asynk-strim@0.1.5
	atoi@2.0.0
	atomic-polyfill@1.0.3
	atomic-waker@1.1.2
	atomic@0.5.3
	atomic@0.6.1
	atomic_refcell@0.1.14
	audio-codec-algorithms@0.8.1
	audioadapter-buffers@5.2.0
	audioadapter-sample@5.2.0
	audioadapter@5.0.0
	autocfg@1.5.0
	aws-config@1.8.12
	aws-credential-types@1.2.11
	aws-lc-rs@1.18.1
	aws-lc-sys@0.45.0
	aws-runtime@1.5.17
	aws-sdk-signin@1.2.0
	aws-sdk-sso@1.91.0
	aws-sdk-ssooidc@1.93.0
	aws-sdk-sts@1.95.0
	aws-sigv4@1.3.7
	aws-smithy-async@1.2.14
	aws-smithy-http-client@1.1.12
	aws-smithy-http@0.62.6
	aws-smithy-json@0.61.9
	aws-smithy-observability@0.1.5
	aws-smithy-query@0.60.9
	aws-smithy-runtime-api-macros@1.0.0
	aws-smithy-runtime-api@1.12.0
	aws-smithy-runtime@1.9.5
	aws-smithy-types@1.4.7
	aws-smithy-xml@0.60.13
	aws-types@1.3.11
	axum-core@0.5.6
	axum@0.8.8
	backtrace@0.3.76
	base16ct@0.2.0
	base64-simd@0.8.0
	base64@0.21.7
	base64@0.22.1
	base64@0.23.0
	base64ct@1.8.3
	basic-toml@0.1.10
	bech32@0.9.1
	beef@0.5.2
	bincode@1.3.3
	bindgen@0.72.1
	bit-set@0.5.3
	bit-set@0.8.0
	bit-vec@0.6.3
	bit-vec@0.8.0
	bit-vec@0.9.1
	bitflags@1.3.2
	bitflags@2.13.1
	blake2@0.10.6
	blake3@1.8.2
	block-buffer@0.10.4
	block-buffer@0.12.0
	block-padding@0.3.3
	block2@0.6.2
	blocking@1.6.2
	bm25@2.3.2
	borsh@1.6.0
	bstr@1.12.1
	bumpalo@3.19.1
	by_address@1.2.1
	bytecheck@0.8.3
	bytecheck_derive@0.8.3
	bytemuck@1.25.0
	bytemuck_derive@1.10.2
	byteorder-lite@0.1.0
	byteorder@1.5.0
	bytes-utils@0.1.4
	bytes@1.12.1
	bzip2-sys@0.1.13+1.0.8
	bzip2@0.5.2
	cached@0.56.0
	cached_proc_macro@0.25.0
	cached_proc_macro_types@0.1.1
	calendrical_calculations@0.2.4
	caseless@0.2.2
	castaway@0.2.4
	cbc@0.1.2
	cc@1.2.55
	ccm@0.5.0
	cexpr@0.6.0
	cfg-expr@0.20.9
	cfg-if@1.0.4
	cfg_aliases@0.1.1
	cfg_aliases@0.2.1
	chacha20@0.10.2
	chacha20@0.9.1
	chacha20poly1305@0.10.1
	chardetng@0.1.17
	chrono@0.4.43
	chunked_transfer@1.5.0
	cidr@0.3.2
	cipher@0.4.4
	clang-sys@1.8.1
	clap@4.5.58
	clap_builder@4.5.58
	clap_complete@4.5.65
	clap_derive@4.5.55
	clap_lex@1.0.0
	clatter@2.2.0
	clipboard-win@5.4.1
	clru@0.6.3
	cmake@0.1.57
	cmov@0.5.3
	cmp_any@0.8.1
	cobs@0.3.0
	color-eyre@0.6.5
	color-spantrace@0.3.0
	color_quant@1.1.0
	colorchoice@1.0.4
	combine@4.6.7
	compact_str@0.9.1
	concurrent-queue@2.5.0
	condtype@1.3.0
	console@0.15.11
	const-hex@1.17.0
	const-oid@0.9.6
	const_format@0.2.35
	const_format_proc_macros@0.2.34
	constant_time_eq@0.3.1
	convert_case@0.10.0
	convert_case@0.6.0
	cookie-factory@0.3.3
	cookie@0.18.1
	cookie_store@0.22.1
	core-foundation-sys@0.8.7
	core-foundation@0.10.1
	core-foundation@0.9.4
	core_maths@0.1.1
	coreaudio-rs@0.14.2
	cpal@0.18.2
	cpufeatures@0.2.17
	cpufeatures@0.3.0
	crc-catalog@2.4.0
	crc32c@0.6.8
	crc32fast@1.5.0
	crc@3.4.0
	critical-section@1.2.0
	crossbeam-channel@0.5.15
	crossbeam-deque@0.8.6
	crossbeam-epoch@0.9.20
	crossbeam-queue@0.3.12
	crossbeam-utils@0.8.21
	crossterm_winapi@0.9.1
	crunchy@0.2.4
	crypto-bigint@0.5.5
	crypto-common@0.1.7
	crypto-common@0.2.2
	crypto_box@0.9.1
	crypto_secretbox@0.1.1
	csscolorparser@0.6.2
	csv-core@0.1.13
	csv@1.4.0
	ctor-proc-macro@0.0.7
	ctor@0.6.3
	ctor@1.0.6
	ctr@0.9.2
	ctutils@0.4.2
	curve25519-dalek-derive@0.1.1
	curve25519-dalek@4.1.3
	darling@0.20.11
	darling@0.21.3
	darling@0.23.0
	darling@0.24.0
	darling_core@0.20.11
	darling_core@0.21.3
	darling_core@0.23.0
	darling_core@0.24.0
	darling_macro@0.20.11
	darling_macro@0.21.3
	darling_macro@0.23.0
	darling_macro@0.24.0
	dashmap@6.1.0
	dasp_sample@0.11.0
	data-encoding@2.10.0
	dbus-secret-service@4.1.0
	dbus@0.9.10
	deadpool-runtime@0.1.4
	deadpool@0.12.3
	debugid@0.8.0
	debugserver-types@0.5.0
	deflate64@0.1.10
	deltae@0.3.2
	deno_core_icudata@0.77.0
	der-parser@10.0.0
	der-parser@9.0.0
	der@0.7.10
	deranged@0.5.5
	derivative@2.2.0
	derive_arbitrary@1.4.2
	derive_more-impl@1.0.0
	derive_more-impl@2.1.1
	derive_more@1.0.0
	derive_more@2.1.1
	deunicode@1.6.2
	diff@0.1.13
	difflib@0.4.0
	diffy@0.4.2
	digest@0.10.7
	digest@0.11.3
	diplomat-runtime@0.15.1
	diplomat@0.15.0
	diplomat_core@0.15.0
	dirs-next@2.0.0
	dirs-sys-next@0.1.2
	dirs-sys@0.5.0
	dirs@6.0.0
	dispatch2@0.3.0
	display_container@0.9.0
	displaydoc@0.2.5
	divan-macros@0.1.21
	divan@0.1.21
	dns-lookup@3.0.1
	document-features@0.2.12
	dotenvy@0.15.7
	downcast-rs@1.2.1
	dtor-proc-macro@0.0.6
	dtor@0.1.1
	dunce@1.0.5
	dupe@0.9.1
	dupe_derive@0.9.1
	dyn-clone@1.0.20
	ecdsa@0.16.9
	ed25519-dalek@2.2.0
	ed25519@2.2.3
	either@1.15.0
	elliptic-curve@0.13.8
	embedded-io@0.4.0
	embedded-io@0.6.1
	encode_unicode@1.0.0
	encoding_rs@0.8.35
	endi@1.1.1
	endian-type@0.1.2
	endian-type@0.2.0
	enum-as-inner@0.6.1
	enumflags2@0.7.12
	enumflags2_derive@0.7.12
	env_filter@1.0.0
	env_home@0.1.0
	env_logger@0.11.9
	equivalent@1.0.2
	erased-serde@0.3.31
	erased-serde@0.4.10
	errno@0.3.14
	error-code@3.3.2
	etcetera@0.11.0
	euclid@0.22.14
	event-listener-strategy@0.5.4
	event-listener@5.4.1
	eventsource-stream@0.2.3
	extended@0.1.0
	eyre@0.6.12
	fancy-regex@0.11.0
	fancy-regex@0.16.2
	fast-srgb8@1.0.0
	faster-hex@0.10.0
	fastrand@2.3.0
	fax@0.2.6
	fax_derive@0.2.0
	fd-lock@4.0.4
	fdeflate@0.3.7
	ff@0.13.1
	fiat-crypto@0.2.9
	filedescriptor@0.8.3
	filetime@0.2.27
	find-crate@0.6.3
	find-msvc-tools@0.1.9
	finl_unicode@1.4.0
	fixed_decimal@0.7.2
	fixedbitset@0.4.2
	fixedbitset@0.5.7
	flatbuffers@25.12.19
	flate2@1.1.8
	float-cmp@0.10.0
	fluent-bundle@0.15.3
	fluent-langneg@0.13.1
	fluent-syntax@0.11.1
	fluent-uri@0.1.4
	fluent@0.16.1
	flume@0.12.0
	fnv@1.0.7
	foldhash@0.1.5
	foldhash@0.2.0
	foreign-types-shared@0.1.1
	foreign-types@0.3.2
	form_urlencoded@1.2.2
	fs_extra@1.3.0
	fsevent-sys@4.1.0
	fslock@0.2.1
	futures-channel@0.3.34
	futures-core@0.3.34
	futures-executor@0.3.34
	futures-intrusive@0.5.0
	futures-io@0.3.34
	futures-lite@2.6.1
	futures-macro@0.3.34
	futures-sink@0.3.34
	futures-task@0.3.34
	futures-util@0.3.34
	futures@0.3.34
	fxhash@0.2.1
	generator@0.8.8
	generic-array@0.14.7
	gethostname@1.1.0
	getrandom@0.2.17
	getrandom@0.3.4
	getrandom@0.4.2
	ghash@0.5.1
	gif@0.14.1
	gimli@0.32.3
	gio-sys@0.22.8
	gix-actor@0.40.0
	gix-archive@0.30.0
	gix-attributes@0.31.0
	gix-bitmap@0.3.0
	gix-blame@0.11.0
	gix-chunk@0.7.0
	gix-command@0.8.0
	gix-commitgraph@0.35.0
	gix-config-value@0.17.1
	gix-config@0.54.0
	gix-date@0.15.1
	gix-diff@0.61.0
	gix-dir@0.23.0
	gix-discover@0.49.0
	gix-error@0.2.1
	gix-features@0.46.2
	gix-filter@0.28.0
	gix-fs@0.19.2
	gix-glob@0.24.0
	gix-hash@0.23.0
	gix-hashtable@0.13.0
	gix-ignore@0.19.1
	gix-index@0.49.0
	gix-lock@21.0.2
	gix-merge@0.14.0
	gix-negotiate@0.29.0
	gix-object@0.58.0
	gix-odb@0.78.0
	gix-pack@0.68.0
	gix-packetline@0.21.2
	gix-path@0.11.2
	gix-pathspec@0.16.1
	gix-protocol@0.59.0
	gix-quote@0.7.0
	gix-ref@0.61.0
	gix-refspec@0.39.0
	gix-revision@0.43.0
	gix-revwalk@0.29.0
	gix-sec@0.13.2
	gix-shallow@0.10.0
	gix-status@0.28.0
	gix-submodule@0.28.0
	gix-tempfile@21.0.2
	gix-trace@0.1.18
	gix-transport@0.55.1
	gix-traverse@0.55.0
	gix-url@0.35.2
	gix-utils@0.3.1
	gix-validate@0.11.0
	gix-worktree-state@0.28.0
	gix-worktree-stream@0.30.0
	gix-worktree@0.50.0
	gix@0.81.0
	glib-macros@0.22.6
	glib-sys@0.22.8
	glib@0.22.8
	glob@0.3.3
	globset@0.4.18
	gobject-sys@0.22.6
	group@0.13.0
	gstreamer-app-sys@0.25.0
	gstreamer-app@0.25.2
	gstreamer-audio-sys@0.25.3
	gstreamer-audio@0.25.3
	gstreamer-base-sys@0.25.3
	gstreamer-base@0.25.3
	gstreamer-sys@0.25.2
	gstreamer@0.25.3
	gzip-header@1.0.0
	h2@0.4.16
	half@2.7.1
	hash32@0.2.1
	hash32@0.3.1
	hashbrown@0.12.3
	hashbrown@0.14.5
	hashbrown@0.15.5
	hashbrown@0.16.1
	hashbrown@0.17.1
	hashlink@0.11.0
	headers-core@0.3.0
	headers@0.4.1
	heapless@0.7.17
	heapless@0.8.0
	heck@0.5.0
	hermit-abi@0.5.2
	hex@0.4.3
	hickory-proto@0.25.2
	hickory-resolver@0.25.2
	hkdf@0.12.4
	hkdf@0.13.0
	hmac@0.12.1
	hmac@0.13.0
	home@0.5.12
	http-body-util@0.1.3
	http-body@0.4.6
	http-body@1.0.1
	http-range-header@0.4.2
	http@0.2.12
	http@1.4.0
	httparse@1.10.1
	httpdate@1.0.3
	hybrid-array@0.2.3
	hybrid-array@0.4.12
	hyper-rustls@0.27.7
	hyper-timeout@0.5.2
	hyper-tls@0.6.0
	hyper-util@0.1.20
	hyper@1.8.1
	i18n-config@0.4.8
	i18n-embed-fl@0.9.4
	i18n-embed-impl@0.8.4
	i18n-embed@0.15.4
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.65
	icu_calendar@2.2.1
	icu_calendar_data@2.2.0
	icu_collections@2.2.0
	icu_decimal@2.2.0
	icu_decimal_data@2.2.0
	icu_locale@2.2.0
	icu_locale_core@2.2.0
	icu_locale_data@2.2.0
	icu_normalizer@2.2.0
	icu_normalizer_data@2.2.0
	icu_plurals@2.2.0
	icu_plurals_data@2.2.0
	icu_properties@2.2.0
	icu_properties_data@2.2.0
	icu_provider@2.2.0
	id-arena@2.3.0
	ident_case@1.0.1
	idna@1.1.0
	idna_adapter@1.2.1
	ignore@0.4.25
	image-webp@0.2.4
	image@0.25.9
	imara-diff@0.1.8
	imara-diff@0.2.0
	include_dir@0.7.4
	include_dir_macros@0.7.4
	indenter@0.3.4
	indexmap@1.9.3
	indexmap@2.14.0
	indoc@2.0.7
	inotify-sys@0.1.5
	inotify@0.11.0
	inout@0.1.4
	insta@1.46.3
	instability@0.3.11
	intl-memoizer@0.5.3
	intl_pluralrules@7.0.2
	inventory@0.3.24
	io-close@0.3.7
	io_tee@0.1.1
	ipconfig@0.3.2
	ipnet@2.11.0
	iri-string@0.7.10
	is-terminal@0.4.17
	is_ci@1.2.0
	is_terminal_polyfill@1.70.2
	itertools@0.13.0
	itertools@0.14.0
	itertools@0.15.0
	itoa@1.0.17
	ixdtf@0.6.4
	jiff-static@0.2.23
	jiff-tzdb-platform@0.1.3
	jiff-tzdb@0.1.6
	jiff@0.2.23
	jni-macros@0.22.4
	jni-sys-macros@0.4.1
	jni-sys@0.3.1
	jni-sys@0.4.1
	jni@0.22.4
	jobserver@0.1.34
	js-sys@0.3.85
	jsonptr@0.7.1
	jsonwebtoken@9.3.1
	kasuari@0.4.12
	keccak@0.1.6
	kem@0.3.0-pre.0
	keyring@3.6.3
	kqueue-sys@1.0.4
	kqueue@1.1.1
	kstring@2.0.2
	lab@0.11.0
	landlock@0.4.4
	lazy_static@1.5.0
	leb128fmt@0.1.0
	libc@0.2.186
	libdbus-sys@0.2.7
	libloading@0.8.9
	libm@0.2.16
	libredox@0.1.12
	libsqlite3-sys@0.37.0
	line-clipping@0.3.7
	link-section@0.17.2
	linktime-proc-macro@0.1.0
	linux-keyutils@0.2.4
	linux-raw-sys@0.12.1
	linux-raw-sys@0.4.15
	litemap@0.8.1
	litrs@1.0.0
	lock_api@0.4.14
	lock_free_hashtable@0.1.4
	log@0.4.34
	logos-codegen@0.15.1
	logos-derive@0.15.1
	logos@0.15.1
	loom@0.7.2
	lru-slab@0.1.2
	lru@0.18.2
	lsp-types@0.97.0
	lzma-rs@0.3.0
	lzma-sys@0.1.20
	mac_address@1.1.8
	mach2@0.6.0
	maplit@1.0.2
	matchers@0.2.0
	matchit@0.8.4
	matchit@0.9.1
	maybe-async@0.2.10
	md-5@0.10.6
	md-5@0.11.0
	md5@0.8.0
	memchr@2.8.1
	memmap2@0.9.10
	memmem@0.1.1
	memoffset@0.9.1
	mime@0.3.17
	mime_guess@2.0.5
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mio@1.2.0
	ml-kem@0.2.3
	moka@0.12.13
	moxcms@0.7.11
	muldiv@1.0.1
	multimap@0.10.1
	munge@0.4.7
	munge_macro@0.4.7
	native-tls@0.2.14
	ndk-context@0.1.1
	ndk-sys@0.6.0+11769913
	ndk@0.9.0
	nibble_vec@0.1.0
	nix@0.28.0
	nix@0.29.0
	nix@0.30.1
	nix@0.31.3
	nom@7.1.3
	nom@8.0.0
	nonempty@0.12.0
	normalize-line-endings@0.3.0
	notify-types@2.1.0
	notify@8.2.0
	nu-ansi-term@0.50.3
	num-bigint@0.4.6
	num-complex@0.4.6
	num-conv@0.2.0
	num-derive@0.4.2
	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_cpus@1.17.0
	num_enum@0.7.6
	num_enum_derive@0.7.6
	num_threads@0.1.7
	numtoa@0.2.4
	oauth2@5.0.0
	objc2-app-kit@0.3.2
	objc2-audio-toolbox@0.3.2
	objc2-avf-audio@0.3.2
	objc2-cloud-kit@0.3.2
	objc2-core-audio-types@0.3.2
	objc2-core-audio@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-local-authentication@0.3.2
	objc2-quartz-core@0.3.2
	objc2-ui-kit@0.3.2
	objc2-user-notifications@0.3.2
	objc2@0.6.3
	object@0.37.3
	oid-registry@0.7.1
	oid-registry@0.8.1
	once_cell@1.21.4
	once_cell_polyfill@1.70.2
	onig@6.5.1
	onig_sys@69.9.1
	opaque-debug@0.3.1
	openssl-macros@0.1.1
	openssl-probe@0.1.6
	openssl-probe@0.2.1
	openssl-src@300.6.1+3.6.3
	openssl-sys@0.9.111
	openssl@0.10.75
	opentelemetry-appender-tracing@0.31.1
	opentelemetry-http@0.31.0
	opentelemetry-otlp@0.31.0
	opentelemetry-proto@0.31.0
	opentelemetry-semantic-conventions@0.31.0
	opentelemetry@0.31.0
	opentelemetry_sdk@0.31.0
	option-ext@0.2.0
	option-operations@0.6.1
	opus@0.4.0
	opusic-sys@0.7.5
	ordered-float@4.6.0
	ordered-stream@0.2.0
	os_info@3.14.0
	os_pipe@1.2.3
	outref@0.5.2
	owo-colors@4.3.0
	p256@0.13.2
	p384@0.13.1
	pagable@0.4.1
	pagable_derive@0.4.1
	palette@0.7.6
	palette_derive@0.7.6
	parking@2.2.1
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	paste@1.0.15
	pastey@0.2.1
	pathdiff@0.2.3
	pbkdf2@0.12.2
	pem-rfc7468@0.7.0
	pem@3.0.6
	percent-encoding@2.3.2
	pest@2.8.7
	pest_derive@2.8.7
	pest_generator@2.8.7
	pest_meta@2.8.7
	petgraph@0.8.3
	phf@0.11.3
	phf_codegen@0.11.3
	phf_generator@0.11.3
	phf_macros@0.11.3
	phf_shared@0.11.3
	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
	pkcs8@0.10.2
	pkg-config@0.3.32
	plist@1.9.0
	png@0.18.0
	polling@3.11.0
	poly1305@0.8.0
	polyval@0.6.2
	portable-atomic-util@0.2.5
	portable-atomic@1.13.1
	portable-pty@0.9.0
	postcard@1.1.3
	potential_utf@0.1.4
	powerfmt@0.2.0
	ppv-lite86@0.2.21
	predicates-core@1.0.9
	predicates-tree@1.0.12
	predicates@3.1.3
	pretty_assertions@1.4.1
	prettyplease@0.2.37
	primeorder@0.13.6
	proc-macro-crate@3.4.0
	proc-macro-error-attr2@2.0.0
	proc-macro-error2@2.0.1
	proc-macro2@1.0.106
	process-wrap@9.0.1
	prodash@31.0.0
	proptest@1.9.0
	prost-build@0.14.3
	prost-derive@0.14.3
	prost-types@0.14.3
	prost@0.14.3
	protoc-bin-vendored-linux-aarch_64@3.2.0
	protoc-bin-vendored-linux-ppcle_64@3.2.0
	protoc-bin-vendored-linux-s390_64@3.2.0
	protoc-bin-vendored-linux-x86_32@3.2.0
	protoc-bin-vendored-linux-x86_64@3.2.0
	protoc-bin-vendored-macos-aarch_64@3.2.0
	protoc-bin-vendored-macos-x86_64@3.2.0
	protoc-bin-vendored-win32@3.2.0
	protoc-bin-vendored@3.2.0
	psl-types@2.0.11
	psl@2.1.184
	ptr_meta@0.3.2
	ptr_meta_derive@0.3.2
	publicsuffix@2.3.0
	pulldown-cmark-escape@0.10.1
	pulldown-cmark@0.10.3
	pxfm@0.1.27
	quick-error@2.0.1
	quick-xml@0.39.4
	quick-xml@0.41.0
	quickcheck@1.1.0
	quinn-proto@0.11.15
	quinn-udp@0.5.14
	quinn-udp@0.6.1
	quinn@0.11.9
	quote@1.0.45
	r-efi@5.3.0
	r-efi@6.0.0
	radix_trie@0.2.1
	radix_trie@0.3.0
	rama-core@0.3.0-alpha.4
	rama-dns@0.3.0-alpha.4
	rama-error@0.3.0-alpha.4
	rama-http-backend@0.3.0-alpha.4
	rama-http-core@0.3.0-alpha.4
	rama-http-headers@0.3.0-alpha.4
	rama-http-types@0.3.0-alpha.4
	rama-http@0.3.0-alpha.4
	rama-macros@0.3.0-alpha.4
	rama-net@0.3.0-alpha.4
	rama-socks5@0.3.0-alpha.4
	rama-tcp@0.3.0-alpha.4
	rama-tls-rustls@0.3.0-alpha.4
	rama-udp@0.3.0-alpha.4
	rama-unix@0.3.0-alpha.4
	rama-utils@0.3.0-alpha.4
	rancor@0.1.3
	rand@0.10.1
	rand@0.8.6
	rand@0.9.3
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.10.1
	rand_core@0.6.4
	rand_core@0.9.5
	rand_regex@0.18.1
	rand_xorshift@0.4.0
	ratatui-core@0.1.2
	ratatui-crossterm@0.1.2
	ratatui-macros@0.7.2
	ratatui-termina@0.1.0
	ratatui-termion@0.1.2
	ratatui-termwiz@0.1.2
	ratatui-widgets@0.3.2
	ratatui@0.30.2
	rayon-core@1.13.0
	rayon@1.11.0
	rcgen@0.14.9
	redox_syscall@0.5.18
	redox_syscall@0.7.0
	redox_users@0.4.6
	redox_users@0.5.2
	ref-cast-impl@1.0.25
	ref-cast@1.0.25
	regex-automata@0.4.13
	regex-lite@0.1.8
	regex-syntax@0.8.8
	regex@1.12.3
	rend@0.5.4
	reqwest@0.12.28
	reqwest@0.13.4
	resb@0.1.2
	resolv-conf@0.7.6
	rfc6979@0.4.0
	ring@0.17.14
	rkyv@0.8.18
	rkyv_derive@0.8.18
	rmcp-macros@3.2.0
	rmcp@3.2.0
	rtc-datachannel@0.20.3
	rtc-dtls@0.20.3
	rtc-ice@0.20.3
	rtc-interceptor-derive@0.20.3
	rtc-interceptor@0.20.3
	rtc-mdns@0.20.3
	rtc-media@0.20.3
	rtc-rtcp@0.20.3
	rtc-rtp@0.20.3
	rtc-sctp@0.20.3
	rtc-sdp@0.20.3
	rtc-shared@0.20.3
	rtc-srtp@0.20.3
	rtc-stun@0.20.3
	rtc-turn@0.20.3
	rtc@0.20.3
	rubato@5.0.0
	rust-embed-impl@8.11.0
	rust-embed-utils@8.11.0
	rust-embed@8.11.0
	rust-stemmers@1.2.0
	rustc-demangle@0.1.27
	rustc-hash@1.1.0
	rustc-hash@2.1.1
	rustc_version@0.4.1
	rusticata-macros@4.1.0
	rustix@0.38.44
	rustix@1.1.4
	rustls-native-certs@0.8.3
	rustls-pki-types@1.14.0
	rustls-platform-verifier-android@0.1.1
	rustls-platform-verifier@0.7.0
	rustls-webpki@0.103.15
	rustls@0.23.45
	rustversion@1.0.22
	rustyline@14.0.0
	ryu@1.0.22
	salsa20@0.10.2
	same-file@1.0.6
	sansio@1.0.1
	scc@2.4.0
	schannel@0.1.28
	schemafy@0.5.2
	schemafy_core@0.5.2
	schemafy_lib@0.5.2
	schemars@0.8.22
	schemars@0.9.0
	schemars@1.2.1
	schemars_derive@0.8.22
	schemars_derive@1.2.1
	scoped-tls@1.0.1
	scopeguard@1.2.0
	scrypt@0.11.0
	sdd@3.0.10
	sec1@0.7.3
	seccompiler@0.5.0
	secrecy@0.10.3
	secret-service@4.0.0
	security-framework-sys@2.15.0
	security-framework@2.11.1
	security-framework@3.5.1
	self_cell@0.10.3
	self_cell@1.2.2
	semver@1.0.27
	sentry-core@0.46.1
	sentry-types@0.46.1
	sentry@0.46.1
	sequence_trie@0.3.6
	serde@1.0.228
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_derive_internals@0.29.1
	serde_html_form@0.3.2
	serde_ignored@0.1.14
	serde_json@1.0.149
	serde_path_to_error@0.1.20
	serde_repr@0.1.20
	serde_spanned@1.0.4
	serde_urlencoded@0.7.1
	serde_with@3.17.0
	serde_with_macros@3.17.0
	serde_yaml@0.9.34+deprecated
	serial2@0.2.33
	serial_test@3.3.1
	serial_test_derive@3.3.1
	sha1-checked@0.10.0
	sha1@0.10.6
	sha1@0.11.0
	sha1_smol@1.0.1
	sha2@0.10.9
	sha2@0.11.0
	sha3@0.10.9
	sharded-slab@0.1.7
	shared_library@0.1.9
	shell-words@1.1.1
	shlex@1.3.0
	signal-hook-mio@0.2.5
	signal-hook-registry@1.4.8
	signal-hook@0.3.18
	signature@2.2.0
	simd-adler32@0.3.8
	simd_cesu8@1.2.0
	simdutf8@0.1.5
	similar@2.7.0
	simple_asn1@0.6.4
	siphasher@1.0.3
	slab@0.4.12
	smallvec@1.15.1
	smawk@0.3.2
	smol_str@0.3.5
	socket2@0.5.10
	socket2@0.6.3
	sonora-aec3@0.2.0
	sonora-agc2@0.2.0
	sonora-common-audio@0.2.0
	sonora-fft@0.2.0
	sonora-ns@0.2.0
	sonora-simd@0.2.0
	sonora@0.2.0
	sorted_vector_map@0.2.1
	spin@0.9.8
	spki@0.7.3
	sqlx-core@0.9.0
	sqlx-macros-core@0.9.0
	sqlx-macros@0.9.0
	sqlx-mysql@0.9.0
	sqlx-postgres@0.9.0
	sqlx-sqlite@0.9.0
	sqlx@0.9.0
	sse-stream@0.2.5
	stable_deref_trait@1.2.1
	starlark@0.14.2
	starlark_derive@0.14.2
	starlark_map@0.14.2
	starlark_syntax@0.14.2
	static_assertions@1.1.0
	static_interner@0.1.2
	stop-words@0.9.0
	strck@1.0.0
	streaming-iterator@0.1.9
	stringprep@0.1.5
	strong_hash@0.1.0
	strong_hash_derive@0.1.0
	strsim@0.10.0
	strsim@0.11.1
	strum@0.27.2
	strum@0.28.0
	strum_macros@0.27.2
	strum_macros@0.28.0
	substring@1.4.5
	subtle@2.6.1
	supports-color@2.1.0
	supports-color@3.0.2
	symphonia-bundle-mp3@0.6.0
	symphonia-common@0.6.0
	symphonia-core@0.6.0
	symphonia-format-isomp4@0.6.0
	symphonia-format-mkv@0.6.0
	symphonia-format-ogg@0.6.0
	symphonia-format-riff@0.6.0
	symphonia-metadata@0.6.0
	symphonia@0.6.0
	syn@1.0.109
	syn@2.0.117
	syn@3.0.3
	sync_wrapper@1.0.2
	synstructure@0.13.2
	syntect@5.3.0
	sys-locale@0.3.2
	system-configuration-sys@0.6.0
	system-configuration@0.7.0
	system-deps@7.0.8
	tagptr@0.2.0
	take_mut@0.2.2
	tar@0.4.45
	target-lexicon@0.13.5
	tempfile@3.27.0
	temporal_capi@0.2.3
	temporal_rs@0.2.3
	termcolor@1.4.1
	termina@0.3.3
	terminal_size@0.4.3
	terminfo@0.9.0
	termion@4.0.6
	termios@0.3.3
	termtree@0.5.1
	termwiz@0.23.3
	test-case-core@3.3.1
	test-case-macros@3.3.1
	test-case@3.3.1
	test-log-macros@0.2.19
	test-log@0.2.19
	textwrap@0.11.0
	textwrap@0.16.2
	thiserror-impl-no-std@2.0.2
	thiserror-impl@1.0.69
	thiserror-impl@2.0.18
	thiserror-no-std@2.0.2
	thiserror@1.0.69
	thiserror@2.0.18
	thread_local@1.1.9
	tiff@0.10.3
	tikv-jemalloc-sys@0.7.1+5.3.1-0-g81034ce1f1373e37dc865038e1bc8eeecf559ce8
	tikv-jemallocator@0.7.0
	time-core@0.1.8
	time-macros@0.2.27
	time@0.3.47
	timezone_provider@0.2.3
	tiny_http@0.12.0
	tinystr@0.8.3
	tinyvec@1.10.0
	tinyvec_macros@0.1.1
	tokio-graceful@0.2.2
	tokio-macros@2.7.0
	tokio-native-tls@0.3.1
	tokio-rustls@0.26.4
	tokio-stream@0.1.18
	tokio-test@0.4.5
	tokio-util@0.7.18
	tokio@1.52.3
	toml@0.5.11
	toml@0.9.11+spec-1.1.0
	toml@1.0.6+spec-1.1.0
	toml_datetime@0.7.5+spec-1.1.0
	toml_datetime@1.1.1+spec-1.1.0
	toml_edit@0.23.10+spec-1.0.0
	toml_edit@0.24.0+spec-1.1.0
	toml_parser@1.1.3+spec-1.1.0
	toml_writer@1.0.6+spec-1.1.0
	tonic-build@0.14.3
	tonic-prost-build@0.14.3
	tonic-prost@0.14.3
	tonic@0.14.3
	tower-http@0.6.8
	tower-layer@0.3.3
	tower-service@0.3.3
	tower@0.5.3
	tracelogging@1.2.3
	tracelogging_macros@1.2.3
	tracing-appender@0.2.4
	tracing-attributes@0.1.31
	tracing-core@0.1.36
	tracing-error@0.2.1
	tracing-log@0.2.0
	tracing-opentelemetry@0.32.1
	tracing-serde@0.2.0
	tracing-subscriber@0.3.22
	tracing-test-macro@0.2.5
	tracing-test@0.2.5
	tracing@0.1.44
	tree-sitter-bash@0.25.1
	tree-sitter-language@0.1.7
	tree-sitter-powershell@0.26.4
	tree-sitter@0.25.10
	tree_magic_mini@3.2.2
	triomphe@0.1.15
	try-lock@0.2.5
	ts-rs-macros@11.1.0
	ts-rs@11.1.0
	two-face@0.5.1
	type-map@0.5.1
	typeid@1.0.3
	typenum@1.20.0
	ucd-trie@0.1.7
	uds_windows@1.1.0
	unarray@0.1.4
	unic-langid-impl@0.9.6
	unic-langid@0.9.6
	unicase@2.9.0
	unicode-bidi@0.3.18
	unicode-bom@2.0.3
	unicode-general-category@1.1.0
	unicode-ident@1.0.22
	unicode-linebreak@0.1.5
	unicode-normalization@0.1.25
	unicode-properties@0.1.4
	unicode-segmentation@1.12.0
	unicode-truncate@2.0.1
	unicode-width@0.1.14
	unicode-width@0.2.1
	unicode-xid@0.2.6
	universal-hash@0.5.1
	unsafe-libyaml@0.2.11
	untrusted@0.7.1
	untrusted@0.9.0
	url@2.5.8
	urlencoding@2.1.3
	utf-8@0.7.6
	utf8_iter@1.0.4
	utf8parse@0.2.2
	uuid@1.20.0
	v8@150.4.0
	valuable@0.1.1
	vcpkg@0.2.15
	version-compare@0.2.1
	version_check@0.9.5
	visibility@0.1.1
	vsimd@0.8.0
	vt100@0.16.2
	vte@0.15.0
	vtparse@0.6.2
	wait-timeout@0.2.1
	walkdir@2.5.0
	want@0.3.1
	wasi@0.11.1+wasi-snapshot-preview1
	wasip2@1.0.2+wasi-0.2.9
	wasip3@0.4.0+wasi-0.3.0-rc-2026-01-06
	wasite@0.1.0
	wasm-bindgen-futures@0.4.58
	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
	wasm-streams@0.4.2
	wasm-streams@0.5.0
	wasmparser@0.244.0
	wayland-backend@0.3.12
	wayland-client@0.31.12
	wayland-protocols-wlr@0.3.10
	wayland-protocols@0.32.10
	wayland-scanner@0.31.10
	wayland-sys@0.31.8
	web-sys@0.3.85
	web-time@1.1.0
	webbrowser@1.2.4
	webpki-root-certs@1.0.5
	webpki-roots@1.0.5
	webrtc@0.20.3
	weezl@0.1.12
	wezterm-bidi@0.2.3
	wezterm-blob-leases@0.1.1
	wezterm-color-types@0.3.0
	wezterm-dynamic-derive@0.1.1
	wezterm-dynamic@0.2.1
	wezterm-input-types@0.1.0
	which@6.0.3
	which@8.0.0
	whoami@1.6.1
	whoami@2.1.2
	widestring@1.2.1
	wildcard@0.3.0
	wildmatch@2.6.1
	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
	windowfunctions@0.1.1
	windows-collections@0.3.2
	windows-core@0.58.0
	windows-core@0.62.2
	windows-future@0.3.2
	windows-implement@0.58.0
	windows-implement@0.60.2
	windows-interface@0.58.0
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-numerics@0.3.1
	windows-registry@0.6.1
	windows-result@0.2.0
	windows-result@0.4.1
	windows-strings@0.1.0
	windows-strings@0.5.1
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows-targets@0.53.5
	windows-threading@0.2.1
	windows@0.58.0
	windows@0.62.2
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.48.5
	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.48.5
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.1
	winnow@0.7.14
	winnow@1.0.4
	winreg@0.10.1
	winreg@0.50.0
	winreg@0.55.0
	winsafe@0.0.19
	winsplit@0.1.0
	wiremock@0.6.5
	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
	wl-clipboard-rs@0.9.3
	writeable@0.6.2
	x11rb-protocol@0.13.2
	x11rb@0.13.2
	x25519-dalek@2.0.1
	x509-parser@0.16.0
	x509-parser@0.18.1
	xdg-home@1.3.0
	xmlparser@0.13.6
	xz2@0.1.7
	yansi@1.0.1
	yasna@0.6.0
	yoke-derive@0.8.2
	yoke@0.8.2
	zbus@4.4.0
	zbus_macros@4.4.0
	zbus_names@3.0.0
	zerocopy-derive@0.8.37
	zerocopy@0.8.37
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.2
	zeroize_derive@1.4.3
	zerotrie@0.2.4
	zerovec-derive@0.11.3
	zerovec@0.11.6
	zip@2.4.2
	zlib-rs@0.5.5
	zlib-rs@0.6.3
	zmij@1.0.19
	zoneinfo64@0.3.0
	zopfli@0.8.3
	zstd-safe@7.2.4
	zstd-sys@2.0.16+zstd.1.5.7
	zstd@0.13.3
	zune-core@0.4.12
	zune-core@0.5.1
	zune-jpeg@0.4.21
	zune-jpeg@0.5.12
	zvariant@4.2.0
	zvariant_derive@4.2.0
	zvariant_utils@2.1.0
"

declare -A GIT_CRATES=(
	[appcontainer_common]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/backends/appcontainer/common'
	[crossterm]='https://github.com/openai-oss-forks/crossterm;efa177859fd9623d57b9fe7ae9bf491ae1ac6ec4;crossterm-%commit%'
	[h3]='https://github.com/hyperium/h3;e07e69412876f7e26f026bd75a48b2704d8c8283;h3-%commit%/h3'
	[h3-quinn]='https://github.com/hyperium/h3;e07e69412876f7e26f026bd75a48b2704d8c8283;h3-%commit%/h3-quinn'
	[learning_mode_core]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/learning_mode_core'
	[learning_mode_windows]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/backends/learning_mode/windows'
	[mxc_config_contract]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/mxc_config_contract'
	[mxc_telemetry]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/mxc_telemetry'
	[nucleo]='https://github.com/helix-editor/nucleo;4253de9faabb4e5c6d81d946a5e35a90f87347ee;nucleo-%commit%'
	[nucleo-matcher]='https://github.com/helix-editor/nucleo;4253de9faabb4e5c6d81d946a5e35a90f87347ee;nucleo-%commit%/matcher'
	[process_security_environment_spec]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/generated/process_security_environment_specification'
	[runfiles]='https://github.com/dzbarsky/rules_rust;b56cbaa8465e74127f1ea216f813cd377295ad81;rules_rust-%commit%/rust/runfiles'
	[sandbox_spec]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/generated/base_container_specification'
	[tokio-tungstenite]='https://github.com/openai-oss-forks/tokio-tungstenite;0e5b2d73aa18dd9f0a50ee9ff199d5aef7594186;tokio-tungstenite-%commit%'
	[tungstenite]='https://github.com/openai-oss-forks/tungstenite-rs;4fffad30fe373adbdcffab9545e9e9bf4f2fc19f;tungstenite-rs-%commit%'
	[wxc_common]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/wxc_common'
)

RUST_MIN_VER="1.95.0"

# python3 .github/scripts/rusty_v8_bazel.py resolved-v8-crate-version
RUSTY_V8_TAG="150.4.0"

inherit cargo check-reqs toolchain-funcs

CHECKREQS_MEMORY="15G"
CHECKREQS_DISK_BUILD="20G"

DESCRIPTION="Codex CLI - OpenAI's AI-powered coding agent"
HOMEPAGE="https://github.com/openai/codex"

SRC_URI="
	https://github.com/openai/${PN}/archive/rust-v${PV}.tar.gz -> ${P}.tar.gz
	code-mode? (
		amd64? (
			https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/librusty_v8_release_x86_64-unknown-linux-musl.a.gz
				-> rusty_v8_${RUSTY_V8_TAG}_librusty_v8_release_x86_64-unknown-linux-musl.a.gz
			https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/src_binding_release_x86_64-unknown-linux-musl.rs
				-> rusty_v8_${RUSTY_V8_TAG}_src_binding_release_x86_64-unknown-linux-musl.rs
		)
		arm64? (
			https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/librusty_v8_release_aarch64-unknown-linux-musl.a.gz
				-> rusty_v8_${RUSTY_V8_TAG}_librusty_v8_release_aarch64-unknown-linux-musl.a.gz
			https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/src_binding_release_aarch64-unknown-linux-musl.rs
				-> rusty_v8_${RUSTY_V8_TAG}_src_binding_release_aarch64-unknown-linux-musl.rs
		)
	)
	${CARGO_CRATE_URIS}
"

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

LICENSE="Apache-2.0"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD Boost-1.0
	CC0-1.0 CDLA-Permissive-2.0 ISC MIT MPL-2.0 Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="-* ~amd64 ~arm64"
# The code mode host embeds V8, which upstream ships as a library already
# built against musl rather than as source.
IUSE="+code-mode"
# Tests fail due to ring crate conflicts with system OpenSSL
RESTRICT="mirror test"

DEPEND="
	dev-libs/openssl:=
	sys-apps/dbus
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"

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

pkg_pretend() {
	check-reqs_pkg_pretend
}

pkg_setup() {
	check-reqs_pkg_setup
	rust_pkg_setup
	if tc-is-lto; then
		export CARGO_PROFILE_RELEASE_LTO=thin
	else
		export CARGO_PROFILE_RELEASE_LTO=false
	fi
}

gen_git_crate_dir() {
	# https://github.com/gentoo/gentoo/blob/b09dd88412fe2d5eee5a8891e08bfa2d67848da3/eclass/cargo.eclass#L442
	IFS=';' read -r crate_uri commit crate_dir <<<"${GIT_CRATES[$1]}"
	echo "${WORKDIR}/${crate_dir//%commit%/${commit}}"
}

src_prepare() {
	default

	# Fix tokio-tungstenite's git dependency on tungstenite
	sed -i '/^\[dependencies\.tungstenite\]/,/^$/{
		s|git = "https://github.com/openai-oss-forks/tungstenite-rs"|path = "'"$(gen_git_crate_dir tungstenite)"'"|
		/^rev = /d
	}' "$(gen_git_crate_dir tokio-tungstenite)/Cargo.toml" || die

	# Remove the [patch.crates-io] section and add path-based patches
	sed -i '/^\[patch\.crates-io\]/,/^$/d' "${S}/Cargo.toml" || die
	sed -i '/^\[patch\."ssh:\/\/git@github\.com/,/^$/d' "${S}/Cargo.toml" || die

	# Add new patch section with local paths
	cat >> "${S}/Cargo.toml" <<-EOF || die

	[patch.crates-io]
	crossterm = { path = "$(gen_git_crate_dir crossterm)" }
	tokio-tungstenite = { path = "$(gen_git_crate_dir tokio-tungstenite)" }
	tungstenite = { path = "$(gen_git_crate_dir tungstenite)" }
	EOF

	# Increase recursion limit to avoid query depth overflow during layout computation of cli_main
	sed -i '1i #![recursion_limit = "512"]' "${S}/cli/src/main.rs" || die
	# Same overflow now occurs in codex-chatgpt's connectors layout
	sed -i '1i #![recursion_limit = "512"]' "${S}/chatgpt/src/lib.rs" || die
}

src_compile() {
	local rusty_v8_triple
	use amd64 && rusty_v8_triple=x86_64-unknown-linux-musl
	use arm64 && rusty_v8_triple=aarch64-unknown-linux-musl

	# codex-core trait resolution overflows rustc's default 8MiB stack
	export RUST_MIN_STACK=16777216

	if ! use code-mode; then
		cargo_src_compile --package codex-cli
		return
	fi

	RUSTY_V8_ARCHIVE="${DISTDIR}/rusty_v8_${RUSTY_V8_TAG}_librusty_v8_release_${rusty_v8_triple}.a.gz" \
	RUSTY_V8_SRC_BINDING_PATH="${DISTDIR}/rusty_v8_${RUSTY_V8_TAG}_src_binding_release_${rusty_v8_triple}.rs" \
		cargo_src_compile --package codex-cli --package codex-code-mode-host
}

src_install() {
	dobin "$(cargo_target_dir)/codex"
	use code-mode && dobin "$(cargo_target_dir)/codex-code-mode-host"
	einstalldocs
}