Skip to content

Commit

Permalink
Add cfg option gnu_time64_abi
Browse files Browse the repository at this point in the history
  • Loading branch information
snogge committed Sep 11, 2023
1 parent 5a7c94b commit 8b67a37
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ fn main() {
Some(_) | None => (),
}

// Some ABIs need to redirect time related symbols to their time64 equivalents.
if is_gnu_time64_abi() {
println!("cargo:rustc-cfg=gnu_time64_abi");
}

// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
Expand Down Expand Up @@ -281,3 +286,32 @@ fn set_cfg(cfg: &str) {
}
println!("cargo:rustc-cfg={}", cfg);
}

fn is_gnu_time64_abi() -> bool {
match env::var("CARGO_CFG_TARGET_ENV") {
Ok(target_env) => {
if target_env != "gnu" {
return false;
}
},
Err(_) => panic!("CARGO_CFG_TARGET_ENV not set"),
}
match env::var("CARGO_CFG_TARGET_OS") {
Ok(target_os) => {
if target_os != "linux" {
return false;
}
},
Err(_) => panic!("CARGO_CFG_TARGET_OS not set"),
}
let _ptrbits = match env::var("CARGO_CFG_TARGET_POINTER_WIDTH") {
Ok(bits) => {
if bits == "64" {
return false;
}
bits
},
Err(_) => panic!("CARGO_CFG_TARGERT_POINTER_WIDTH not set"),
};
return false;
}

0 comments on commit 8b67a37

Please sign in to comment.