diff --git a/build.rs b/build.rs index 6b7ee9cc03dc265d064493772f3a86ec250b23c0..66f53f78d31102e020d5b2caffa297d5911f662e 100644 --- a/build.rs +++ b/build.rs @@ -29,7 +29,7 @@ use std::fs::{File, OpenOptions}; use std::io::Write; use std::path::Path; use std::process::Command; -use std::str; +use std::{env, str}; const BUILD_OUT_FILE: &str = "build.rs"; const SOURCE_DIR: &str = "./src/gen"; @@ -70,6 +70,12 @@ fn main() { &format!("{}", now_utc.format("%H:%M:%S")), ); + write_str_constant( + &mut file, + "NAME", + option_env!("CARGO_PKG_NAME").unwrap_or("UNKNOWN"), + ); + write_str_constant( &mut file, "VERSION", @@ -93,6 +99,30 @@ fn main() { .as_str(); write_str_constant(&mut file, "COMPILER_VERSION", compiler_version); + write_str_constant( + &mut file, + "HOST", + &env::var("HOST").unwrap_or(String::from("UNKNOWN")), + ); + + write_str_constant( + &mut file, + "TARGET", + &env::var("TARGET").unwrap_or(String::from("UNKNOWN")), + ); + + write_str_constant( + &mut file, + "PROFILE", + &env::var("PROFILE").unwrap_or(String::from("UNKNOWN")), + ); + + write_str_constant( + &mut file, + "MAKEFLAGS", + option_env!("CARGO_MAKEFLAGS").unwrap_or("UNKNOWN"), + ); + let mut features = vec!["cpu"]; if cfg!(feature = "wasm-extension") { diff --git a/src/gen/mock.rs b/src/gen/mock.rs index f98bedf3e31541d2330099a8569b78ba54213c1d..b292a5535bfad74d61516726026930cd7cf21e6e 100644 --- a/src/gen/mock.rs +++ b/src/gen/mock.rs @@ -2,9 +2,14 @@ pub const COMPILATION_DATE: &str = "-"; pub const COMPILATION_TIME: &str = "-"; +pub const NAME: &str = "-"; pub const VERSION: &str = "x.x.x"; pub const COMPILER: &str = "rustc"; pub const COMPILER_VERSION: &str = "x.x.x"; +pub const HOST: &str = "-"; +pub const TARGET: &str = "-"; +pub const PROFILE: &str = "-"; +pub const MAKEFLAGS: &str = "-"; pub const FEATURES: [&str; 1] = ["cpu"]; pub const PLATFORM_CPU_BITS: &str = "64"; pub const DEFAULT_THREAD_POOL_SIZE: usize = 1;