diff --git a/config.toml.example b/config.toml.example index a12c4e0700c..dee0d8f254b 100644 --- a/config.toml.example +++ b/config.toml.example @@ -659,6 +659,10 @@ changelog-seen = 2 # Build compiler with the optimization enabled and -Zvalidate-mir, currently only for `std` #validate-mir-opts = 3 +# Copy the linker, DLLs, and various libraries from MinGW into the rustc toolchain. +# Only applies when the host or target is pc-windows-gnu. +#include-mingw-linker = true + # ============================================================================= # Options for specific targets # diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 6e64bc20d20..4f417d36511 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -190,6 +190,7 @@ pub struct Config { pub dist_sign_folder: Option, pub dist_upload_addr: Option, pub dist_compression_formats: Option>, + pub dist_include_mingw_linker: bool, // libstd features pub backtrace: bool, // support for RUST_BACKTRACE @@ -700,6 +701,7 @@ define_config! { src_tarball: Option = "src-tarball", missing_tools: Option = "missing-tools", compression_formats: Option> = "compression-formats", + include_mingw_linker: Option = "include-mingw-linker", } } @@ -816,6 +818,7 @@ impl Config { config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")]; config.deny_warnings = true; config.bindir = "bin".into(); + config.dist_include_mingw_linker = true; // set by build.rs config.build = TargetSelection::from_user(&env!("BUILD_TRIPLE")); @@ -1299,6 +1302,7 @@ impl Config { config.dist_compression_formats = t.compression_formats; set(&mut config.rust_dist_src, t.src_tarball); set(&mut config.missing_tools, t.missing_tools); + set(&mut config.dist_include_mingw_linker, t.include_mingw_linker) } if let Some(r) = build.rustfmt { diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index d7008df4179..c9384004100 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -324,7 +324,7 @@ impl Step for Mingw { /// without any extra installed software (e.g., we bundle gcc, libraries, etc). fn run(self, builder: &Builder<'_>) -> Option { let host = self.host; - if !host.ends_with("pc-windows-gnu") { + if !host.ends_with("pc-windows-gnu") || !builder.config.dist_include_mingw_linker { return None; } @@ -380,7 +380,7 @@ impl Step for Rustc { // anything requiring us to distribute a license, but it's likely the // install will *also* include the rust-mingw package, which also needs // licenses, so to be safe we just include it here in all MinGW packages. - if host.ends_with("pc-windows-gnu") { + if host.ends_with("pc-windows-gnu") && builder.config.dist_include_mingw_linker { make_win_dist(tarball.image_dir(), &tmpdir(builder), host, builder); tarball.add_dir(builder.src.join("src/etc/third-party"), "share/doc"); }