Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/zmij/build.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / zmij / build.rs` 45 lines ยท 1362 bytes Raw Blame History 1 use std::env; 2 use std::ffi::OsString; 3 use std::process::{self, Command}; 4 use std::str; 5 6 fn main() { 7 println!("cargo:rerun-if-changed=build.rs"); 8 9 let rustc = rustc_minor_version().unwrap_or(u32::MAX); 10 11 if rustc >= 80 { 12 println!("cargo:rustc-check-cfg=cfg(exhaustive)"); 13 println!("cargo:rustc-check-cfg=cfg(opt_level, values(\"s\"))"); 14 println!("cargo:rustc-check-cfg=cfg(zmij_no_select_unpredictable)"); 15 } 16 17 if rustc < 88 { 18 // https://doc.rust-lang.org/std/hint/fn.select_unpredictable.html 19 println!("cargo:rustc-cfg=zmij_no_select_unpredictable"); 20 } 21 22 if let Some(opt_level) = env::var_os("OPT_LEVEL") { 23 if opt_level == "s" || opt_level == "z" { 24 println!("cargo:rustc-cfg=opt_level=\"s\""); 25 } 26 } 27 } 28 29 fn rustc_minor_version() -> Option { 30 let rustc = cargo_env_var("RUSTC"); 31 let output = Command::new(rustc).arg("--version").output().ok()?; 32 let version = str::from_utf8(&output.stdout).ok()?; 33 let mut pieces = version.split('.'); 34 if pieces.next() != Some("rustc 1") { 35 return None; 36 } 37 pieces.next()?.parse().ok() 38 } 39 40 fn cargo_env_var(key: &str) -> OsString { 41 env::var_os(key).unwrap_or_else(|| { 42 eprintln!("Environment variable ${key} is not set during execution of build script"); 43 process::exit(1); 44 }) 45 }