#![warn(unused_results)]
#[cfg(target_os = "windows")]
use std::path::Path;
#[cfg(target_os = "windows")]
use std::path::PathBuf;
pub type ThreadSafeStdError = dyn std::error::Error + Send + Sync;
pub type BoxedThreadSafeStdError = Box<ThreadSafeStdError>;
#[cfg(target_os = "windows")]
type PathStr = Path;
#[cfg(target_os = "windows")]
type PathString = PathBuf;
pub(crate) fn map_processor(machine: &str) -> String {
match machine {
"arm64" => "arm".to_string(),
"aarch64" => "aarch64".to_string(),
"x86_64" | "amd64" => "x86_64".to_string(),
"i386" | "i486" | "i586" | "i686" => "i686".to_string(),
"armv7l" | "armv6l" | "armv8l" => "arm".to_string(),
_ => machine.to_string(),
}
}
const HOST_OS_NAME: &str = if cfg!(all(
target_os = "linux",
any(target_env = "gnu", target_env = "")
)) {
"GNU/Linux"
} else if cfg!(all(
target_os = "linux",
not(any(target_env = "gnu", target_env = ""))
)) {
"Linux"
} else if cfg!(target_os = "android") {
"Android"
} else if cfg!(target_os = "windows") {
"MS/Windows" } else if cfg!(target_os = "freebsd") {
"FreeBSD"
} else if cfg!(target_os = "netbsd") {
"NetBSD"
} else if cfg!(target_os = "openbsd") {
"OpenBSD"
} else if cfg!(target_vendor = "apple") {
"Darwin"
} else if cfg!(target_os = "fuchsia") {
"Fuchsia"
} else if cfg!(target_os = "redox") {
"Redox"
} else if cfg!(target_os = "illumos") {
"illumos"
} else if cfg!(target_os = "solaris") {
"Solaris"
} else if cfg!(target_os = "haiku") {
"Haiku"
} else if cfg!(target_os = "dragonfly") {
"DragonFly"
} else if cfg!(target_os = "aix") {
"AIX"
} else if cfg!(target_os = "cygwin") {
"Cygwin"
} else if cfg!(target_os = "wasi") {
"WASI"
} else {
"unknown"
};
#[cfg(all(unix, not(target_os = "wasi")))]
#[path = "platform/unix.rs"]
mod target;
#[cfg(windows)]
#[path = "platform/windows.rs"]
mod target;
#[cfg(target_os = "wasi")]
#[path = "platform/wasi.rs"]
mod target;
#[cfg(not(any(unix, windows, target_os = "wasi")))]
#[path = "platform/unknown.rs"]
mod target;
pub use target::*;
#[test]
fn test_map_processor_mappings() {
assert_eq!(map_processor("arm64"), "arm");
assert_eq!(map_processor("aarch64"), "aarch64");
assert_eq!(map_processor("armv6l"), "arm");
assert_eq!(map_processor("armv7l"), "arm");
assert_eq!(map_processor("armv8l"), "arm");
assert_eq!(map_processor("x86_64"), "x86_64");
assert_eq!(map_processor("amd64"), "x86_64");
assert_eq!(map_processor("i386"), "i686");
assert_eq!(map_processor("i486"), "i686");
assert_eq!(map_processor("i586"), "i686");
assert_eq!(map_processor("i686"), "i686");
assert_eq!(map_processor("riscv64"), "riscv64");
assert_eq!(map_processor("powerpc64"), "powerpc64");
assert_eq!(map_processor("unknown"), "unknown");
}