Introduce the UciSource abstraction as a config-rs Source that reads UCI packages and maps them into the configuration tree. Supports package selection, required/optional behavior, and custom config/save directories. Move rust-uci dependency to cfg(unix) to enable UCI support on all Unix systems for development and testing, while Linux/OpenWrt remains the production-supported platform.
27 lines
995 B
Rust
27 lines
995 B
Rust
use std::env;
|
|
|
|
fn main() {
|
|
let uci_enabled = env::var_os("CARGO_FEATURE_UCI").is_some();
|
|
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
|
let target = env::var("TARGET").unwrap_or_else(|_| "unknown".into());
|
|
|
|
if uci_enabled && target_os != "linux" {
|
|
println!(
|
|
"cargo:warning=UCI support on {target} is intended for development \
|
|
and testing; Linux/OpenWrt remains the production-supported platform"
|
|
);
|
|
}
|
|
|
|
match target_os.as_str() {
|
|
"linux" => {}
|
|
"macos" => println!(
|
|
"cargo::warning=traffic control is unavailable on macOS; requested rate changes will be calculated but not applied"
|
|
),
|
|
_ => println!(
|
|
"cargo::warning=target `{target}` has no native interface-statistics or traffic-control backend; synthetic interface load will be used and requested rate changes will not be applied"
|
|
),
|
|
}
|
|
|
|
println!("cargo::rerun-if-changed=build.rs");
|
|
}
|