]> git.lizzy.rs Git - rust.git/blob - library/std/build.rs
Rollup merge of #107710 - ehuss:update-strip-ansi-escapes, r=Mark-Simulacrum
[rust.git] / library / std / build.rs
1 use std::env;
2
3 fn main() {
4     println!("cargo:rerun-if-changed=build.rs");
5     let target = env::var("TARGET").expect("TARGET was not set");
6     if target.contains("freebsd") {
7         if env::var("RUST_STD_FREEBSD_12_ABI").is_ok() {
8             println!("cargo:rustc-cfg=freebsd12");
9         }
10     } else if target.contains("linux")
11         || target.contains("netbsd")
12         || target.contains("dragonfly")
13         || target.contains("openbsd")
14         || target.contains("solaris")
15         || target.contains("illumos")
16         || target.contains("apple-darwin")
17         || target.contains("apple-ios")
18         || target.contains("apple-watchos")
19         || target.contains("uwp")
20         || target.contains("windows")
21         || target.contains("fuchsia")
22         || (target.contains("sgx") && target.contains("fortanix"))
23         || target.contains("hermit")
24         || target.contains("l4re")
25         || target.contains("redox")
26         || target.contains("haiku")
27         || target.contains("vxworks")
28         || target.contains("wasm32")
29         || target.contains("wasm64")
30         || target.contains("asmjs")
31         || target.contains("espidf")
32         || target.contains("solid")
33         || target.contains("nintendo-3ds")
34     {
35         // These platforms don't have any special requirements.
36     } else {
37         // This is for Cargo's build-std support, to mark std as unstable for
38         // typically no_std platforms.
39         // This covers:
40         // - os=none ("bare metal" targets)
41         // - mipsel-sony-psp
42         // - nvptx64-nvidia-cuda
43         // - arch=avr
44         // - tvos (aarch64-apple-tvos, x86_64-apple-tvos)
45         // - uefi (x86_64-unknown-uefi, i686-unknown-uefi)
46         // - JSON targets
47         // - Any new targets that have not been explicitly added above.
48         println!("cargo:rustc-cfg=feature=\"restricted-std\"");
49     }
50     println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
51     println!("cargo:rustc-cfg=backtrace_in_libstd");
52 }