diff options
author | Pietro Albini <pietro.albini@ferrous-systems.com> | 2022-12-14 14:41:50 +0100 |
---|---|---|
committer | Pietro Albini <pietro.albini@ferrous-systems.com> | 2023-03-06 09:43:30 +0100 |
commit | e74f73544f29fe3559081250b9a657a36bc860eb (patch) | |
tree | 27ff4e7c07c8f2ffe9c5f43683f73eb2aac35d06 | |
parent | b636da0a67185598bbe739ed2c20910e51514e4d (diff) | |
download | rust-libc-e74f73544f29fe3559081250b9a657a36bc860eb.tar.gz |
support extra check-cfg
-rw-r--r-- | build.rs | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -29,6 +29,13 @@ const ALLOWED_CFGS: &[&str] = &[ "libc_union", ]; +// Extra values to allow for check-cfg. +const CHECK_CFG_EXTRA: &[(&str, &[&str])] = &[ + ("target_os", &["switch", "aix", "ohos"]), + ("target_env", &["illumos", "wasi", "aix", "ohos"]), + ("target_arch", &["loongarch64"]), +]; + fn main() { // Avoid unnecessary re-building. println!("cargo:rerun-if-changed=build.rs"); @@ -151,6 +158,10 @@ fn main() { for cfg in ALLOWED_CFGS { println!("cargo:rustc-check-cfg=values({})", cfg); } + for (name, values) in CHECK_CFG_EXTRA { + let values = values.join("\",\""); + println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values); + } } } |