mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 07:22:42 +00:00
93677276bc
Based on #99883 by @Arc-blroth Depends on rust-lang/backtrace-rs#556 and rust-lang/cc-rs#705
70 lines
2.6 KiB
Rust
70 lines
2.6 KiB
Rust
use std::env;
|
|
|
|
// backtrace-rs requires a feature check on Android targets, so
|
|
// we need to run its build.rs as well.
|
|
#[allow(unused_extern_crates)]
|
|
#[path = "../backtrace/build.rs"]
|
|
mod backtrace_build_rs;
|
|
|
|
fn main() {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
let target = env::var("TARGET").expect("TARGET was not set");
|
|
if target.contains("freebsd") {
|
|
if env::var("RUST_STD_FREEBSD_12_ABI").is_ok() {
|
|
println!("cargo:rustc-cfg=freebsd12");
|
|
} else if env::var("RUST_STD_FREEBSD_13_ABI").is_ok() {
|
|
println!("cargo:rustc-cfg=freebsd12");
|
|
println!("cargo:rustc-cfg=freebsd13");
|
|
}
|
|
} else if target.contains("linux")
|
|
|| target.contains("netbsd")
|
|
|| target.contains("dragonfly")
|
|
|| target.contains("openbsd")
|
|
|| target.contains("solaris")
|
|
|| target.contains("illumos")
|
|
|| target.contains("apple-darwin")
|
|
|| target.contains("apple-ios")
|
|
|| target.contains("apple-tvos")
|
|
|| target.contains("apple-watchos")
|
|
|| target.contains("uwp")
|
|
|| target.contains("windows")
|
|
|| target.contains("fuchsia")
|
|
|| (target.contains("sgx") && target.contains("fortanix"))
|
|
|| target.contains("hermit")
|
|
|| target.contains("l4re")
|
|
|| target.contains("redox")
|
|
|| target.contains("haiku")
|
|
|| target.contains("vxworks")
|
|
|| target.contains("wasm32")
|
|
|| target.contains("wasm64")
|
|
|| target.contains("asmjs")
|
|
|| target.contains("espidf")
|
|
|| target.contains("solid")
|
|
|| target.contains("nintendo-3ds")
|
|
|| target.contains("vita")
|
|
|| target.contains("nto")
|
|
|| target.contains("xous")
|
|
|| target.contains("hurd")
|
|
|| target.contains("uefi")
|
|
// See src/bootstrap/synthetic_targets.rs
|
|
|| env::var("RUSTC_BOOTSTRAP_SYNTHETIC_TARGET").is_ok()
|
|
{
|
|
// These platforms don't have any special requirements.
|
|
} else {
|
|
// This is for Cargo's build-std support, to mark std as unstable for
|
|
// typically no_std platforms.
|
|
// This covers:
|
|
// - os=none ("bare metal" targets)
|
|
// - mipsel-sony-psp
|
|
// - nvptx64-nvidia-cuda
|
|
// - arch=avr
|
|
// - JSON targets
|
|
// - Any new targets that have not been explicitly added above.
|
|
println!("cargo:rustc-cfg=feature=\"restricted-std\"");
|
|
}
|
|
println!("cargo:rustc-env=STD_ENV_ARCH={}", env::var("CARGO_CFG_TARGET_ARCH").unwrap());
|
|
println!("cargo:rustc-cfg=backtrace_in_libstd");
|
|
|
|
backtrace_build_rs::main();
|
|
}
|