Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new config flag, dist.include-mingw-linker. #108581

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,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
#
Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
}
}

Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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");
}
Expand Down