]> git.lizzy.rs Git - rust.git/blob - library/std/build.rs
Merge commit '0cb0f7636851f9fcc57085cf80197a2ef6db098f' into clippyup
[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("uwp")
19         || target.contains("windows")
20         || target.contains("fuchsia")
21         || (target.contains("sgx") && target.contains("fortanix"))
22         || target.contains("hermit")
23         || target.contains("l4re")
24         || target.contains("redox")
25         || target.contains("haiku")
26         || target.contains("vxworks")
27         || target.contains("wasm32")
28         || target.contains("wasm64")
29         || target.contains("asmjs")
30         || target.contains("espidf")
31         || target.contains("solid")
32         || target.contains("nintendo-3ds")
33     {
34         // These platforms don't have any special requirements.
35     } else {
36         // This is for Cargo's build-std support, to mark std as unstable for
37         // typically no_std platforms.
38         // This covers:
39         // - os=none ("bare metal" targets)
40         // - mipsel-sony-psp
41         // - nvptx64-nvidia-cuda
42         // - arch=avr
43         // - tvos (aarch64-apple-tvos, x86_64-apple-tvos)
44         // - uefi (x86_64-unknown-uefi, i686-unknown-uefi)
45         // - JSON targets
46         // - Any new targets that have not been explicitly added above.
47         println!("cargo:rustc-cfg=feature=\"restricted-std\"");
48     }
49     println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
50     println!("cargo:rustc-cfg=backtrace_in_libstd");
51 }