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

# Autogenerated by pycargoebuild 0.16.0

EAPI=8

CRATES="
cc@1.3.0
find-msvc-tools@0.1.9
shlex@2.0.1
"

inherit cargo

DESCRIPTION="A fork of the compiler for the B Programming Language implemented in Crust"
HOMEPAGE="https://github.com/masterwolf-git/b"
SRC_URI="
https://github.com/masterwolf-git/b/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
${CARGO_CRATE_URIS}
"

LICENSE="MIT"
# Dependent crate licenses
LICENSE+=" || ( Apache-2.0 MIT )"
SLOT="0"
KEYWORDS=""

src_test() {
# Ensure build directory and binary copy exist for btest
mkdir -p build || die
cp target/release/b build/b || die

# Execute custom test runner
cargo_src_compile --bin btest
einfo "Running btest matrix..."
./target/release/btest || die "btest failed"
}

src_compile()
{
cargo_src_compile --bin bgen
einfo "Running bgen code generator..."
./target/release/bgen || die "bgen execution failed"
cargo_src_compile --bin b
}

src_install()
{
cargo_src_install --bin b
}