Add comment to explain why CG_RUSTFLAGS is needed

This commit is contained in:
Antoni Boucher 2025-01-24 10:48:53 -05:00
parent bbc54734de
commit f24b0d358a
2 changed files with 4 additions and 0 deletions

View file

@ -150,6 +150,8 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
"debug"
};
// We have a different environment variable than RUSTFLAGS to make sure those flags are only
// sent to rustc_codegen_gcc and not the LLVM backend.
if let Ok(cg_rustflags) = std::env::var("CG_RUSTFLAGS") {
rustflags.push(' ');
rustflags.push_str(&cg_rustflags);

View file

@ -381,6 +381,8 @@ impl ConfigInfo {
}
// This environment variable is useful in case we want to change options of rustc commands.
// We have a different environment variable than RUSTFLAGS to make sure those flags are
// only sent to rustc_codegen_gcc and not the LLVM backend.
if let Some(cg_rustflags) = env.get("CG_RUSTFLAGS") {
rustflags.extend_from_slice(&split_args(&cg_rustflags)?);
}