diff options
| author | bors <bors@rust-lang.org> | 2022-06-29 18:42:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-06-29 18:42:19 +0000 |
| commit | ddcbba036aee08f0709f98a92a342a278eae5c05 (patch) | |
| tree | 746cce42c59c782314757a884b2630e8e9d1c1c2 /src/bootstrap | |
| parent | 3fcf43bb0f3e86c16a88f239da18a1729a94d244 (diff) | |
| parent | d34c4ca9be41d14d8eb460f23abb353ce3be8ae7 (diff) | |
| download | rust-ddcbba036aee08f0709f98a92a342a278eae5c05.tar.gz rust-ddcbba036aee08f0709f98a92a342a278eae5c05.zip | |
Auto merge of #98680 - matthiaskrgr:rollup-1bkrrn9, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #98434 (Ensure that `static_crt` is set in the bootstrapper whenever using `cc-rs` to get a compiler command line.) - #98636 (Triagebot: Fix mentions word wrapping.) - #98642 (Fix #98260) - #98643 (Improve pretty printing of valtrees for references) - #98646 (rustdoc: fix bugs in main.js popover help and settings) - #98647 (Update cargo) - #98652 (`alloc`: clean and ensure `no_global_oom_handling` builds are warning-free) - #98660 (Unbreak stage1 tests via ignore-stage1 in `proc-macro/invalid-punct-ident-1.rs`.) - #98665 (Use verbose help for deprecation suggestion) - #98668 (Avoid some `&str` to `String` conversions with `MultiSpan::push_span_label`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/cc_detect.rs | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs index dca782c29c2..759a99c330c 100644 --- a/src/bootstrap/cc_detect.rs +++ b/src/bootstrap/cc_detect.rs @@ -61,6 +61,30 @@ fn cc2ar(cc: &Path, target: TargetSelection) -> Option<PathBuf> { } } +fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build { + let mut cfg = cc::Build::new(); + cfg.cargo_metadata(false) + .opt_level(2) + .warnings(false) + .debug(false) + .target(&target.triple) + .host(&build.build.triple); + match build.crt_static(target) { + Some(a) => { + cfg.static_crt(a); + } + None => { + if target.contains("msvc") { + cfg.static_crt(true); + } + if target.contains("musl") { + cfg.static_flag(true); + } + } + } + cfg +} + pub fn find(build: &mut Build) { // For all targets we're going to need a C compiler for building some shims // and such as well as for being a linker for Rust code. @@ -72,27 +96,7 @@ pub fn find(build: &mut Build) { .chain(iter::once(build.build)) .collect::<HashSet<_>>(); for target in targets.into_iter() { - let mut cfg = cc::Build::new(); - cfg.cargo_metadata(false) - .opt_level(2) - .warnings(false) - .debug(false) - .target(&target.triple) - .host(&build.build.triple); - match build.crt_static(target) { - Some(a) => { - cfg.static_crt(a); - } - None => { - if target.contains("msvc") { - cfg.static_crt(true); - } - if target.contains("musl") { - cfg.static_flag(true); - } - } - } - + let mut cfg = new_cc_build(build, target); let config = build.config.target_config.get(&target); if let Some(cc) = config.and_then(|c| c.cc.as_ref()) { cfg.compiler(cc); @@ -112,15 +116,8 @@ pub fn find(build: &mut Build) { // If we use llvm-libunwind, we will need a C++ compiler as well for all targets // We'll need one anyways if the target triple is also a host triple - let mut cfg = cc::Build::new(); - cfg.cargo_metadata(false) - .opt_level(2) - .warnings(false) - .debug(false) - .cpp(true) - .target(&target.triple) - .host(&build.build.triple); - + let mut cfg = new_cc_build(build, target); + cfg.cpp(true); let cxx_configured = if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) { cfg.compiler(cxx); true |
