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

EAPI=8

CRATES="
	addr2line@0.24.2
	adler2@2.0.0
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	annotate-snippets@0.9.2
	anstream@0.6.19
	anstyle-parse@0.2.7
	anstyle-query@1.1.3
	anstyle-wincon@3.0.9
	anstyle@1.0.11
	anyhow@1.0.98
	async-trait@0.1.88
	autocfg@1.4.0
	backtrace@0.3.75
	base64@0.22.1
	bincode@1.3.3
	bindgen@0.69.5
	bindgen@0.72.0
	bitfield-macros@0.19.1
	bitfield@0.19.1
	bitflags@1.3.2
	bitflags@2.9.1
	block-buffer@0.10.4
	bumpalo@3.18.1
	byteorder@1.5.0
	bzip2-sys@0.1.13+1.0.8
	bzip2@0.5.2
	caps@0.5.5
	cc@1.2.26
	cexpr@0.6.0
	cfg-expr@0.15.8
	cfg-if@1.0.0
	cfg_aliases@0.2.1
	clang-sys@1.8.1
	codicon@3.0.0
	colorchoice@1.0.4
	convert_case@0.6.0
	cookie-factory@0.3.3
	cpufeatures@0.2.17
	crc32fast@1.4.2
	crossbeam-channel@0.5.15
	crossbeam-utils@0.8.21
	crypto-common@0.1.6
	digest@0.10.7
	dirs-sys@0.5.0
	dirs@6.0.0
	either@1.15.0
	env_filter@0.1.3
	env_logger@0.11.8
	equivalent@1.0.2
	flate2@1.1.1
	foldhash@0.1.5
	foreign-types-shared@0.1.1
	foreign-types@0.3.2
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	futures@0.3.31
	generic-array@0.14.7
	getrandom@0.2.16
	getrandom@0.3.3
	gimli@0.31.1
	glob@0.3.2
	hashbrown@0.15.3
	heck@0.5.0
	hex@0.4.3
	imago@0.1.5
	indexmap@2.9.0
	iocuddle@0.1.1
	is_terminal_polyfill@1.70.1
	itertools@0.12.1
	itoa@1.0.15
	jiff-static@0.2.14
	jiff@0.2.14
	jobserver@0.1.33
	js-sys@0.3.77
	kbs-types@0.13.0
	kvm-bindings@0.12.0
	kvm-ioctls@0.22.0
	lazy_static@1.5.0
	lazycell@1.3.0
	libc@0.2.172
	libloading@0.8.8
	libredox@0.1.3
	libspa-sys@0.8.0
	libspa@0.8.0
	linux-loader@0.13.0
	log@0.4.27
	lru@0.14.0
	memchr@2.7.4
	memoffset@0.7.1
	memoffset@0.9.1
	minimal-lexical@0.2.1
	miniz_oxide@0.8.8
	nitro-enclaves@0.3.0
	nix@0.26.4
	nix@0.27.1
	nix@0.29.0
	nix@0.30.1
	nom@7.1.3
	object@0.36.7
	once_cell@1.21.3
	once_cell_polyfill@1.70.1
	openssl-macros@0.1.1
	openssl-src@300.5.0+3.5.0
	openssl-sys@0.9.109
	openssl@0.10.73
	option-ext@0.2.0
	page_size@0.6.0
	pin-project-lite@0.2.16
	pin-utils@0.1.0
	pipewire-sys@0.8.0
	pipewire@0.8.0
	pkg-config@0.3.32
	portable-atomic-util@0.2.4
	portable-atomic@1.11.1
	ppv-lite86@0.2.21
	proc-macro2@1.0.95
	quote@1.0.40
	r-efi@5.2.0
	rand@0.9.2
	rand_chacha@0.9.0
	rand_core@0.6.4
	rand_core@0.9.3
	rdrand@0.8.3
	redox_users@0.5.0
	regex-automata@0.4.9
	regex-syntax@0.8.5
	regex@1.11.1
	remain@0.2.15
	rustc-demangle@0.1.24
	rustc-hash@1.1.0
	rustc-hash@2.1.1
	rustc_version@0.4.1
	rustversion@1.0.21
	ryu@1.0.20
	semver@1.0.26
	serde-big-array@0.5.1
	serde@1.0.219
	serde_bytes@0.11.17
	serde_derive@1.0.219
	serde_json@1.0.140
	serde_spanned@0.6.9
	sev@6.2.1
	sha2@0.10.9
	shlex@1.3.0
	slab@0.4.9
	sm3@0.4.2
	smallvec@1.15.0
	static_assertions@1.1.0
	strum@0.27.2
	strum_macros@0.27.2
	syn@2.0.101
	system-deps@6.2.2
	target-lexicon@0.12.16
	tdx@0.1.0
	thiserror-impl@1.0.69
	thiserror-impl@2.0.12
	thiserror@1.0.69
	thiserror@2.0.12
	tokio@1.45.1
	toml@0.8.23
	toml_datetime@0.6.11
	toml_edit@0.22.27
	tracing-attributes@0.1.29
	tracing-core@0.1.34
	tracing@0.1.41
	typenum@1.18.0
	unicode-ident@1.0.18
	unicode-segmentation@1.12.0
	unicode-width@0.1.14
	utf8parse@0.2.2
	uuid@1.17.0
	vcpkg@0.2.15
	version-compare@0.2.0
	version_check@0.9.5
	virtio-bindings@0.2.6
	vm-fdt@0.3.0
	vm-memory@0.16.2
	vmm-sys-util@0.12.1
	vmm-sys-util@0.14.0
	vsock@0.5.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasi@0.14.2+wasi-0.2.4
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-sys@0.59.0
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.52.6
	winnow@0.7.10
	wit-bindgen-rt@0.39.0
	yansi-term@0.1.2
	zerocopy-derive@0.8.26
	zerocopy@0.8.26
	zstd-safe@7.2.4
	zstd-sys@2.0.15+zstd.1.5.7
	zstd@0.13.3
"

inherit cargo

DESCRIPTION="A dynamic library providing Virtualization-based process isolation capabilities"
HOMEPAGE="https://github.com/containers/libkrun"

SRC_URI="
	${CARGO_CRATE_URIS}
	https://github.com/containers/libkrun/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
"

LICENSE="0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD BSD-2 Boost-1.0 ISC MIT MPL-2.0 Unicode-DFS-2016 Unlicense ZLIB"
SLOT="0"
KEYWORDS="-* ~amd64 ~arm64"

RDEPEND="
	dev-libs/libkrunfw
	media-libs/virglrenderer
	media-video/pipewire
"
DEPEND="
	${RDEPEND}
"
src_compile() {
	unset ARCH
	emake PREFIX=/usr GPU=1 BLK=1 NET=1 SND=1
}

src_install() {
	emake DESTDIR="${D}" PREFIX=/usr install
}