From e74f73544f29fe3559081250b9a657a36bc860eb Mon Sep 17 00:00:00 2001 From: Pietro Albini Date: Wed, 14 Dec 2022 14:41:50 +0100 Subject: support extra check-cfg --- build.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.rs b/build.rs index cb70d6e238..43a5d890d1 100644 --- a/build.rs +++ b/build.rs @@ -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); + } } } -- cgit v1.2.1