Auto merge of #75625 - mati865:mingw-cross-compile, r=Mark-Simulacrum

Fix windows-gnu host cross-compilation

Fixes https://github.com/rust-lang/rust/issues/64218

Also turns out it's faster to run Linux virtual machine on Windows and cross-compile `./x.py dist` than doing it on Windows directly...
This commit is contained in:
bors 2020-08-24 23:07:41 +00:00
commit 3cf8f69fec
2 changed files with 10 additions and 1 deletions

View file

@ -226,7 +226,7 @@ fn make_win_dist(
let idx = line.find(':').unwrap(); let idx = line.find(':').unwrap();
let key = &line[..idx]; let key = &line[..idx];
let trim_chars: &[_] = &[' ', '=']; let trim_chars: &[_] = &[' ', '='];
let value = line[(idx + 1)..].trim_start_matches(trim_chars).split(';').map(PathBuf::from); let value = env::split_paths(line[(idx + 1)..].trim_start_matches(trim_chars));
if key == "programs" { if key == "programs" {
bin_path.extend(value); bin_path.extend(value);

View file

@ -151,6 +151,12 @@ fn main() {
continue; continue;
} }
// Include path contains host directory, replace it with target
if is_crossed && flag.starts_with("-I") {
cfg.flag(&flag.replace(&host, &target));
continue;
}
cfg.flag(flag); cfg.flag(flag);
} }
@ -189,6 +195,9 @@ fn main() {
if !is_crossed { if !is_crossed {
cmd.arg("--system-libs"); cmd.arg("--system-libs");
} else if target.contains("windows-gnu") {
println!("cargo:rustc-link-lib=shell32");
println!("cargo:rustc-link-lib=uuid");
} }
cmd.args(&components); cmd.args(&components);