Add full FreeBSD, OpenBSD, NetBSD, and DragonflyBSD target support

This commit is contained in:
peoplemiau1
2026-05-28 22:48:51 +03:00
parent 06a8458ca7
commit 2cb02aa102
6 changed files with 239 additions and 17 deletions

View File

@@ -80,15 +80,26 @@ pub fn build(args: &[String]) -> i32 {
}
if flags.target.is_none() {
let default_target = if cfg!(target_os = "linux") {
"x86_64-unknown-linux-gnu"
format!("{}-unknown-linux-gnu", std::env::consts::ARCH)
} else if cfg!(target_os = "macos") {
"x86_64-apple-darwin"
"x86_64-apple-darwin".to_string()
} else if cfg!(target_os = "windows") {
"x86_64-pc-windows-msvc"
"x86_64-pc-windows-msvc".to_string()
} else if cfg!(any(
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd",
target_os = "dragonfly"
)) {
format!(
"{}-unknown-{}",
std::env::consts::ARCH,
std::env::consts::OS
)
} else {
"unknown"
"unknown".to_string()
};
flags.target = Some(default_target.to_string());
flags.target = Some(default_target);
}
if flags.clean {
let mut clean_args = Vec::new();
@@ -390,6 +401,15 @@ fn ensure_target_dirs(
let default_dir = if cfg!(target_os = "linux") {
let arch = std::env::consts::ARCH;
format!("{arch}-unknown-linux-gnu/{profile}")
} else if cfg!(any(
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd",
target_os = "dragonfly"
)) {
let arch = std::env::consts::ARCH;
let os = std::env::consts::OS;
format!("{arch}-unknown-{os}/{profile}")
} else {
profile.to_string()
};