#![doc = "README.md"]
#![cfg_attr(not(test), no_main)]
#![cfg_attr(test, allow(dead_code))]
mod build;
use build::{Build, Executable};
#[unsafe(no_mangle)]
#[cfg(not(test))]
pub unsafe extern "C" fn main(argc: i32, argv: *const *const i8, envp: *const *const i8) {
let result = unsafe { run(argc, argv, envp) };
proc_exit::exit(result);
}
unsafe fn run(argc: i32, argv: *const *const i8, envp: *const *const i8) -> proc_exit::ExitResult {
#[cfg(feature = "debug")]
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("debug")).init();
let build = Build::find().unwrap_or_default();
#[cfg(feature = "debug")]
log::debug!(
"Executing build with the following CPU features: {}",
build.features()
);
unsafe { build.exec(argc, argv, envp) }?;
Ok(())
}