summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2022-12-14 14:41:50 +0100
committerPietro Albini <pietro.albini@ferrous-systems.com>2023-03-06 09:43:30 +0100
commite74f73544f29fe3559081250b9a657a36bc860eb (patch)
tree27ff4e7c07c8f2ffe9c5f43683f73eb2aac35d06
parentb636da0a67185598bbe739ed2c20910e51514e4d (diff)
downloadrust-libc-e74f73544f29fe3559081250b9a657a36bc860eb.tar.gz
support extra check-cfg
-rw-r--r--build.rs11
1 files changed, 11 insertions, 0 deletions
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);
+ }
}
}