Skip to content
Open
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
28 changes: 9 additions & 19 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
return;
}

let (bin_path, libs_path) = get_cc_search_dirs(target, builder);
let (bin_path, _) = get_cc_search_dirs(target, builder);

let mut rustc_dlls = vec![];
// windows-gnu and windows-gnullvm require different runtime libs
Expand All @@ -354,15 +354,6 @@ fn runtime_dll_dist(rust_root: &Path, target: TargetSelection, builder: &Builder
} else {
panic!("Vendoring of runtime DLLs for `{target}` is not supported`");
}
// FIXME(#144656): Remove this whole `let ...`
let bin_path = if target.ends_with("windows-gnullvm") && builder.host_target != target {
bin_path
.into_iter()
.chain(libs_path.iter().map(|path| path.with_file_name("bin")))
.collect()
} else {
bin_path
};
let rustc_dlls = find_files(&rustc_dlls, &bin_path);

// Copy runtime dlls next to rustc.exe
Expand Down Expand Up @@ -1721,7 +1712,7 @@ impl Step for Extended {
tarballs.push(builder.ensure(Rustc { target_compiler }));
tarballs.push(builder.ensure(Std { build_compiler, target }).expect("missing std"));

if target.is_windows_gnu() {
if target.is_windows_gnu() || target.is_windows_gnullvm() {
tarballs.push(builder.ensure(Mingw { target }).expect("missing mingw"));
}

Expand Down Expand Up @@ -1868,8 +1859,7 @@ impl Step for Extended {
cmd.run(builder);
}

// FIXME(mati865): `gnullvm` here is temporary, remove it once it can host itself
if target.is_windows() && !target.contains("gnullvm") {
if target.is_windows() {
let exe = tmp.join("exe");
let _ = fs::remove_dir_all(&exe);

Expand Down Expand Up @@ -1907,7 +1897,7 @@ impl Step for Extended {
prepare(tool);
}
}
if target.is_windows_gnu() {
if target.is_windows_gnu() || target.is_windows_gnullvm() {
prepare("rust-mingw");
}

Expand Down Expand Up @@ -2072,7 +2062,7 @@ impl Step for Extended {
.arg("-t")
.arg(etc.join("msi/remove-duplicates.xsl"))
.run(builder);
if target.is_windows_gnu() {
if target.is_windows_gnu() || target.is_windows_gnullvm() {
command(&heat)
.current_dir(&exe)
.arg("dir")
Expand Down Expand Up @@ -2121,7 +2111,7 @@ impl Step for Extended {
if built_tools.contains("miri") {
cmd.arg("-dMiriDir=miri");
}
if target.is_windows_gnu() {
if target.is_windows_gnu() || target.is_windows_gnullvm() {
cmd.arg("-dGccDir=rust-mingw");
}
cmd.run(builder);
Expand Down Expand Up @@ -2149,7 +2139,7 @@ impl Step for Extended {
}
candle("AnalysisGroup.wxs".as_ref());

if target.is_windows_gnu() {
if target.is_windows_gnu() || target.is_windows_gnullvm() {
candle("GccGroup.wxs".as_ref());
}

Expand Down Expand Up @@ -2192,7 +2182,7 @@ impl Step for Extended {
cmd.arg("DocsGroup.wixobj");
}

if target.is_windows_gnu() {
if target.is_windows_gnu() || target.is_windows_gnullvm() {
cmd.arg("GccGroup.wixobj");
}
// ICE57 wrongly complains about the shortcuts
Expand Down Expand Up @@ -2231,7 +2221,7 @@ fn add_env(
.env("CFG_BUILD", target.triple)
.env("CFG_CHANNEL", &builder.config.channel);

if target.contains("windows-gnullvm") {
if target.is_windows_gnullvm() {
cmd.env("CFG_MINGW", "1").env("CFG_ABI", "LLVM");
} else if target.is_windows_gnu() {
cmd.env("CFG_MINGW", "1").env("CFG_ABI", "GNU");
Expand Down
35 changes: 0 additions & 35 deletions src/ci/docker/host-x86_64/dist-aarch64-windows-gnullvm/Dockerfile

This file was deleted.

37 changes: 0 additions & 37 deletions src/ci/docker/host-x86_64/dist-x86_64-windows-gnullvm/Dockerfile

This file was deleted.

This file was deleted.

28 changes: 22 additions & 6 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,6 @@ auto:
- name: dist-s390x-linux
<<: *job-linux-4c

- name: dist-aarch64-windows-gnullvm
<<: *job-linux-4c

- name: dist-x86_64-windows-gnullvm
<<: *job-linux-4c

- name: dist-various-1
<<: *job-linux-4c

Expand Down Expand Up @@ -689,6 +683,28 @@ auto:
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-windows

- name: dist-aarch64-llvm-mingw
env:
SCRIPT: python x.py dist bootstrap --include-default-paths
RUST_CONFIGURE_ARGS: >-
--build=aarch64-pc-windows-gnullvm
--enable-full-tools
--enable-profiler
DIST_REQUIRE_ALL_TOOLS: 1
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-windows-aarch64

- name: dist-x86_64-llvm-mingw
env:
SCRIPT: python x.py dist bootstrap --include-default-paths
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-gnullvm
--enable-full-tools
--enable-profiler
DIST_REQUIRE_ALL_TOOLS: 1
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-windows

- name: dist-x86_64-msvc-alt
env:
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler
Expand Down
59 changes: 46 additions & 13 deletions src/ci/scripts/install-mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,37 @@ source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"

MINGW_ARCHIVE_32="i686-14.1.0-release-posix-dwarf-msvcrt-rt_v12-rev0.7z"
MINGW_ARCHIVE_64="x86_64-14.1.0-release-posix-seh-msvcrt-rt_v12-rev0.7z"
LLVM_MINGW_ARCHIVE_AARCH64="llvm-mingw-20251104-ucrt-aarch64.zip"
LLVM_MINGW_ARCHIVE_X86_64="llvm-mingw-20251104-ucrt-x86_64.zip"

if isWindows && isKnownToBeMingwBuild; then
case "${CI_JOB_NAME}" in
*aarch64-llvm*)
mingw_dir="clangarm64"
mingw_archive="${LLVM_MINGW_ARCHIVE_AARCH64}"
arch="aarch64"
# Rustup defaults to AArch64 MSVC which has a hard time building Ring crate
# for citool. MSVC jobs install special Clang build to solve that, but here
# it would be an overkill. So we just use toolchain that doesn't have this
# issue.
rustup default stable-aarch64-pc-windows-gnullvm
;;
*x86_64-llvm*)
mingw_dir="clang64"
mingw_archive="${LLVM_MINGW_ARCHIVE_X86_64}"
arch="x86_64"
;;
*i686*)
bits=32
mingw_dir="mingw32"
mingw_archive="${MINGW_ARCHIVE_32}"
;;
*x86_64*)
bits=64
mingw_dir="mingw64"
mingw_archive="${MINGW_ARCHIVE_64}"
;;
*aarch64*)
# aarch64 is a cross-compiled target. Use the x86_64
# mingw, since that's the host architecture.
bits=64
mingw_archive="${MINGW_ARCHIVE_64}"
echo "AArch64 Windows is not supported by GNU tools"
exit 1
;;
*)
echo "src/ci/scripts/install-mingw.sh can't detect the builder's architecture"
Expand All @@ -38,14 +53,32 @@ if isWindows && isKnownToBeMingwBuild; then
msys2Path="c:/msys64"
ciCommandAddPath "${msys2Path}/usr/bin"

mingw_dir="mingw${bits}"
case "${mingw_archive}" in
*.7z)
curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
7z x -y mingw.7z > /dev/null
;;
*.zip)
curl -o mingw.zip "${MIRRORS_BASE}/${mingw_archive}"
unzip -q mingw.zip
mv llvm-mingw-20251104-ucrt-$arch $mingw_dir
# Temporary workaround: https://github.com/mstorsjo/llvm-mingw/issues/493
mkdir -p $mingw_dir/bin
ln -s $arch-w64-windows-gnu.cfg $mingw_dir/bin/$arch-pc-windows-gnu.cfg
;;
*)
echo "Unrecognized archive type"
exit 1
;;
esac

curl -o mingw.7z "${MIRRORS_BASE}/${mingw_archive}"
7z x -y mingw.7z > /dev/null
ciCommandAddPath "$(cygpath -m "$(pwd)/${mingw_dir}/bin")"

# Initialize mingw for the user.
# This should be done by github but isn't for some reason.
# (see https://github.com/actions/runner-images/issues/12600)
/c/msys64/usr/bin/bash -lc ' '
# MSYS2 is not installed on AArch64 runners
if [[ "${CI_JOB_NAME}" != *aarch64-llvm* ]]; then
# Initialize mingw for the user.
# This should be done by github but isn't for some reason.
# (see https://github.com/actions/runner-images/issues/12600)
/c/msys64/usr/bin/bash -lc ' '
fi
fi
20 changes: 20 additions & 0 deletions src/etc/installer/msi/rust.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
<?elseif $(env.CFG_CHANNEL)="dev" ?>
<?define UpgradeCode="231A9544-7E39-4A60-A069-0EB3CA4BAB2E" ?>
<?endif ?>
<?elseif $(env.CFG_ABI)="LLVM" ?>
<?if $(env.CFG_CHANNEL)="stable" ?>
<?define UpgradeCode="BA2B2E96-F3E2-4DE9-8809-38C31382CC96" ?>
<?elseif $(env.CFG_CHANNEL)="beta" ?>
<?define UpgradeCode="44A2D96F-6CF2-4ED9-AE05-7CF0C3A7D0D9" ?>
<?elseif $(env.CFG_CHANNEL)="nightly" ?>
<?define UpgradeCode="FB0EEAE4-13FB-46BB-86E8-F9D00E6DA364" ?>
<?elseif $(env.CFG_CHANNEL)="dev" ?>
<?define UpgradeCode="73C94FB8-266F-48DC-A23B-B6E5DBDCF508" ?>
<?endif ?>
<?endif ?>
<?define PlatformProgramFilesFolder="ProgramFiles64Folder" ?>
<?elseif $(sys.BUILDARCH)="x86" ?>
Expand All @@ -61,6 +71,16 @@
<?elseif $(env.CFG_CHANNEL)="dev" ?>
<?define UpgradeCode="87DFC303-6492-4E9B-911E-56EAD56C5E58" ?>
<?endif ?>
<?elseif $(env.CFG_ABI)="LLVM" ?>
<?if $(env.CFG_CHANNEL)="stable" ?>
<?define UpgradeCode="DB29CBDE-CDDF-4EC9-9C68-B6F00038EEDD" ?>
<?elseif $(env.CFG_CHANNEL)="beta" ?>
<?define UpgradeCode="AE1EF98B-1387-43BE-BE55-2310449D7E02" ?>
<?elseif $(env.CFG_CHANNEL)="nightly" ?>
<?define UpgradeCode="27B805BC-9C71-4198-A397-3082B1E708A7" ?>
<?elseif $(env.CFG_CHANNEL)="dev" ?>
<?define UpgradeCode="9DDD8D25-57C4-4410-AB35-A23A805AAD17" ?>
<?endif ?>
<?endif ?>
<?define PlatformProgramFilesFolder="ProgramFilesFolder" ?>
<?else ?>
Expand Down
Loading