about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJames Farrell <jamesfarrell@google.com>2023-02-28 20:37:05 +0000
committerJames Farrell <jamesfarrell@google.com>2023-02-28 20:37:05 +0000
commit848f6f9b0d25229a974faf202ebec5d0fb0acf50 (patch)
treed60b4dcf630a85fc238e649960ebf101298f580b /src/bootstrap
parent31f858d9a511f24fedb8ed997b28304fec809630 (diff)
Add a new config flag, dist.include-mingw-linker.
The flag controls whether to copy the linker, DLLs, and various
libraries from MinGW into the rustc toolchain.

It applies only when the host or target is pc-windows-gnu.

The flag is true by default to preserve existing behavior.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/config.rs4
-rw-r--r--src/bootstrap/dist.rs4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 05e74254949..5c69ae37720 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -192,6 +192,7 @@ pub struct Config {
     pub dist_sign_folder: Option<PathBuf>,
     pub dist_upload_addr: Option<String>,
     pub dist_compression_formats: Option<Vec<String>>,
+    pub dist_include_mingw_linker: bool,
 
     // libstd features
     pub backtrace: bool, // support for RUST_BACKTRACE
@@ -704,6 +705,7 @@ define_config! {
         src_tarball: Option<bool> = "src-tarball",
         missing_tools: Option<bool> = "missing-tools",
         compression_formats: Option<Vec<String>> = "compression-formats",
+        include_mingw_linker: Option<bool> = "include-mingw-linker",
     }
 }
 
@@ -821,6 +823,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"));
@@ -1311,6 +1314,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 9b2b549612d..3eed0f30be4 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -322,7 +322,7 @@ impl Step for Mingw {
     /// without any extra installed software (e.g., we bundle gcc, libraries, etc).
     fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
         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;
         }
 
@@ -378,7 +378,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");
         }