Skip to content

Commit

Permalink
Invoke backtrace-rs buildscript in std buildscript
Browse files Browse the repository at this point in the history
  • Loading branch information
pitaj committed Aug 12, 2023
1 parent 1e836d1 commit 3906e9a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4862,6 +4862,7 @@ version = "0.0.0"
dependencies = [
"addr2line",
"alloc",
"cc",
"cfg-if",
"compiler_builtins",
"core",
Expand Down
4 changes: 4 additions & 0 deletions library/std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ object = { version = "0.31.1", default-features = false, optional = true, featur
rand = { version = "0.8.5", default-features = false, features = ["alloc"] }
rand_xorshift = "0.3.0"

[build-dependencies]
# Dependency of the `backtrace` crate
cc = "1.0.67"

[target.'cfg(any(all(target_family = "wasm", target_os = "unknown"), all(target_vendor = "fortanix", target_env = "sgx")))'.dependencies]
dlmalloc = { version = "0.2.3", features = ['rustc-dep-of-std'] }

Expand Down
8 changes: 8 additions & 0 deletions library/std/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
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");
Expand Down Expand Up @@ -56,4 +62,6 @@ fn main() {
}
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();
}

0 comments on commit 3906e9a

Please sign in to comment.