diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /third_party/rust/neqo-crypto/build.rs | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/neqo-crypto/build.rs')
-rw-r--r-- | third_party/rust/neqo-crypto/build.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/third_party/rust/neqo-crypto/build.rs b/third_party/rust/neqo-crypto/build.rs index a63c34dedb..c4c2a73e75 100644 --- a/third_party/rust/neqo-crypto/build.rs +++ b/third_party/rust/neqo-crypto/build.rs @@ -4,9 +4,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![cfg_attr(feature = "deny-warnings", deny(warnings))] -#![warn(clippy::pedantic)] - use std::{ collections::HashMap, env, fs, @@ -37,7 +34,7 @@ struct Bindings { opaque: Vec<String>, /// enumerations that are turned into a module (without this, the enum is /// mapped using the default, which means that the individual values are - /// formed with an underscore as <enum_type>_<enum_value_name>). + /// formed with an underscore as <`enum_type`>_<`enum_value_name`>). #[serde(default)] enums: Vec<String>, @@ -53,9 +50,10 @@ struct Bindings { } fn is_debug() -> bool { - env::var("DEBUG") - .map(|d| d.parse::<bool>().unwrap_or(false)) - .unwrap_or(false) + // Check the build profile and not whether debug symbols are enabled (i.e., + // `env::var("DEBUG")`), because we enable those for benchmarking/profiling and still want + // to build NSS in release mode. + env::var("PROFILE").unwrap_or_default() == "debug" } // bindgen needs access to libclang. @@ -126,7 +124,7 @@ fn nss_dir() -> PathBuf { } dir }; - assert!(dir.is_dir(), "NSS_DIR {:?} doesn't exist", dir); + assert!(dir.is_dir(), "NSS_DIR {dir:?} doesn't exist"); // Note that this returns a relative path because UNC // paths on windows cause certain tools to explode. dir @@ -150,10 +148,10 @@ fn build_nss(dir: PathBuf) { let mut build_nss = vec![ String::from("./build.sh"), String::from("-Ddisable_tests=1"), + // Generate static libraries in addition to shared libraries. + String::from("--static"), ]; - if is_debug() { - build_nss.push(String::from("--static")); - } else { + if !is_debug() { build_nss.push(String::from("-o")); } if let Ok(d) = env::var("NSS_JOBS") { @@ -318,7 +316,7 @@ fn setup_standalone() -> Vec<String> { "cargo:rustc-link-search=native={}", nsslibdir.to_str().unwrap() ); - if is_debug() { + if is_debug() || env::consts::OS == "windows" { static_link(); } else { dynamic_link(); |