diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /library/backtrace/build.rs | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/backtrace/build.rs')
-rw-r--r-- | library/backtrace/build.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/library/backtrace/build.rs b/library/backtrace/build.rs index 812fbb1fe..9bd3abd16 100644 --- a/library/backtrace/build.rs +++ b/library/backtrace/build.rs @@ -1,8 +1,10 @@ extern crate cc; use std::env; +use std::path::Path; -fn main() { +// Must be public so the build script of `std` can call it. +pub fn main() { match env::var("CARGO_CFG_TARGET_OS").unwrap_or_default().as_str() { "android" => build_android(), _ => {} @@ -10,7 +12,13 @@ fn main() { } fn build_android() { - let expansion = match cc::Build::new().file("src/android-api.c").try_expand() { + // Resolve `src/android-api.c` relative to this file. + // Required to support calling this from the `std` build script. + let android_api_c = Path::new(file!()) + .parent() + .unwrap() + .join("src/android-api.c"); + let expansion = match cc::Build::new().file(android_api_c).try_expand() { Ok(result) => result, Err(e) => { println!("failed to run C compiler: {}", e); |