Skip to content

Commit

Permalink
Correctly choose profile to use.
Browse files Browse the repository at this point in the history
If, e.g., a user sets `CARGO_PROFILE_RELEASE_DEBUG=1`, the `DEBUG`
environment variable will be set accordingly, and so the debug build
will be used.

Instead, we should use the PROFILE env variable (see
https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts)
to determine which profile to use.

This isn't 100% correct, because it won't pass through any other flags
(in this case, we won't have debug information for the cubeb backend),
but it is more correct to ensure the matching profile.
  • Loading branch information
mutexlox-signal authored and kinetiknz committed Feb 3, 2025
1 parent 0f685d9 commit ab34373
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cubeb-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn main() {
.env("CARGO_BUILD_TARGET", &target)
.build();

let debug = env::var("DEBUG").unwrap().parse::<bool>().unwrap();
let debug = env::var("PROFILE").unwrap() == "debug";

println!("cargo:rustc-link-lib=static=cubeb");
if windows {
Expand Down

0 comments on commit ab34373

Please sign in to comment.