fn main() { // RFC 019 §7 test canary (agreed Q3): compiled without stack-clash // protection so its 96 KiB local is a genuine one-displacement guard // jumper; distro-hardened compilers would otherwise probe it page-wise // and defeat the test's purpose. cc::Build::new() .file("canary/canary.c") .flag_if_supported("-fno-stack-clash-protection") .compile("smarm_canary"); println!("cargo:rerun-if-changed=canary/canary.c"); // RFC 010 c6d — build_hash inputs. The compile-time facts a peer must // share for a mesh link: the exact toolchain and the declared (enabled) // feature set. Emitted as a plain string; the hashing (FNV-1a folded // with PROTO_VERSION) happens in src/cluster.rs where the protocol // version actually lives — parsing it out of a source file here would // be a second, fragile copy. Always emitted, even for non-cluster // builds: one env var costs the default build nothing. let rustc = std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string()); let version = std::process::Command::new(&rustc) .arg("-V") .output() .ok() .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) .filter(|v| !v.is_empty()) .unwrap_or_else(|| "rustc-unknown".to_string()); let mut feats: Vec = std::env::vars() .filter_map(|(k, _)| k.strip_prefix("CARGO_FEATURE_").map(str::to_string)) .collect(); feats.sort(); println!( "cargo:rustc-env=SMARM_BUILD_HASH_INPUTS={version};features={}", feats.join(",") ); println!("cargo:rerun-if-env-changed=RUSTC"); }