[Git][ghc/ghc][wip/T25974] Relax the requirements of `set_up_tarballs` Windows toolchain check

Serge S. Gulin pushed to branch wip/T25974 at Glasgow Haskell Compiler / GHC Commits: 49d94b1d by Serge S. Gulin at 2025-05-15T15:26:22+04:00 Relax the requirements of `set_up_tarballs` Windows toolchain check - - - - - 5 changed files: - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - hadrian/src/Builder.hs - hadrian/src/Rules/BinaryDist.hs - m4/fp_setup_windows_toolchain.m4 Changes: ===================================== .gitlab/generate-ci/gen_ci.hs ===================================== @@ -873,10 +873,6 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} } , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh configure" -- We have to trigger cabal build in an independent way to mitigate Wine hangs at MSYS2/Arm64EC , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l -c './hadrian/build-cabal clean'" - -- We use "--enable-distro-toolchain" due of TOOLCHAIN_SOURCE="env", so we have to manually copy - -- bootstrap's compiler mingw into `_build` because binary-dist-dir requires it at Windows. - -- After './hadrian/build-cabal clean' we have to recreate the build root directory. - , "mkdir ./_build && cp -r ~/.wine/drive_c/msys64/opt/ghc-bootstrap/mingw ./_build/" , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh build_hadrian" , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh test_hadrian" ] ===================================== .gitlab/jobs.yaml ===================================== @@ -523,7 +523,6 @@ "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh setup", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh configure", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l -c './hadrian/build-cabal clean'", - "mkdir ./_build && cp -r ~/.wine/drive_c/msys64/opt/ghc-bootstrap/mingw ./_build/", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh build_hadrian", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh test_hadrian" ], @@ -1281,7 +1280,6 @@ "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh setup", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh configure", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l -c './hadrian/build-cabal clean'", - "mkdir ./_build && cp -r ~/.wine/drive_c/msys64/opt/ghc-bootstrap/mingw ./_build/", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh build_hadrian", "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh test_hadrian" ], ===================================== hadrian/src/Builder.hs ===================================== @@ -26,7 +26,7 @@ import Hadrian.Builder.Tar import Hadrian.Oracles.Path import Hadrian.Oracles.TextFile import Hadrian.Utilities -import Oracles.Setting (bashPath, targetStage, isWinHost) +import Oracles.Setting (bashPath, targetStage, isWinHost, isWinTarget) import System.Exit import System.IO (stderr) @@ -240,12 +240,14 @@ instance H.Builder Builder where Ghc _ st -> do root <- buildRoot unlitPath <- builderPath Unlit + win_target <- isWinTarget + win_host <- isWinHost distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW libffi_adjustors <- useLibffiForAdjustors use_system_ffi <- flag UseSystemFfi return $ [ unlitPath ] - ++ [ root -/- mingwStamp | windowsHost, distro_mingw == "NO" ] + ++ [ root -/- mingwStamp | win_target, win_host, distro_mingw == "NO" ] -- proxy for the entire mingw toolchain that -- we have in inplace/mingw initially, and then at -- root -/- mingw. ===================================== hadrian/src/Rules/BinaryDist.hs ===================================== @@ -256,7 +256,10 @@ bindistRules = do copyFile ("libraries" -/- "prologue.txt") (bindistFilesDir -/- "docs-utils" -/- "prologue.txt") copyFile ("libraries" -/- "gen_contents_index") (bindistFilesDir -/- "docs-utils" -/- "gen_contents_index" ) - when windowsHost $ do + win_host <- isWinHost + win_target <- isWinTarget + distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW + when (win_host && win_target && distro_mingw == "NO") $ do copyDirectory (root -/- "mingw") bindistFilesDir -- we use that opportunity to delete the .stamp file that we use -- as a proxy for the whole mingw toolchain, there's no point in ===================================== m4/fp_setup_windows_toolchain.m4 ===================================== @@ -9,7 +9,19 @@ AC_DEFUN([FP_INSTALL_WINDOWS_TOOLCHAIN],[ fi set_up_tarballs() { - AC_MSG_NOTICE([Checking for Windows toolchain tarballs...]) + AC_MSG_CHECKING([for Windows toolchain tarballs...]) + + # We are leaving an option to substitute the toolchain with manually prepared one at the CI due of cross-compile targets. + # Builtin toolchain does not support cross-compile nor we have other reasons why it should. + # Probably we shouldn't ship GHC with a built-in toolchain for all cross-compile options. + # Cross-compile support is a relatively new and experimental option for Windows target but + # important to support AArch64. Same as Darwin. + if test -d inplace/mingw + then + AC_MSG_RESULT([skipping, inplace/mingw exists]) + return 0 + fi + local action if test "$TarballsAutodownload" = "NO" then @@ -17,6 +29,9 @@ AC_DEFUN([FP_INSTALL_WINDOWS_TOOLCHAIN],[ else action="download" fi + readonly action + AC_MSG_RESULT([$action...]) + $PYTHON mk/get-win32-tarballs.py $action $mingw_arch case $? in 0) @@ -45,22 +60,19 @@ AC_DEFUN([FP_INSTALL_WINDOWS_TOOLCHAIN],[ esac # Extract all the tarballs in one go - if ! test -d inplace/mingw - then - AC_MSG_NOTICE([Extracting Windows toolchain from archives (may take a while)...]) - rm -rf inplace/mingw - local base_dir="../ghc-tarballs/${tarball_dest_dir}" - ( cd inplace && - find "${base_dir}" -name "*.tar.xz" -exec tar --xz -xf {} \; && - find "${base_dir}" -name "*.tar.zst" -exec tar --zstd -xf {} \; && - rm ".MTREE" && - rm ".PKGINFO" && - cd .. ) || AC_MSG_ERROR([Could not extract Windows toolchains.]) - - mv "inplace/${tarball_mingw_dir}" inplace/mingw && - touch inplace/mingw - AC_MSG_NOTICE([In-tree MingW-w64 tree created]) - fi + AC_MSG_NOTICE([Extracting Windows toolchain from archives (may take a while)...]) + rm -rf inplace/mingw + local base_dir="../ghc-tarballs/${tarball_dest_dir}" + ( cd inplace && + find "${base_dir}" -name "*.tar.xz" -exec tar --xz -xf {} \; && + find "${base_dir}" -name "*.tar.zst" -exec tar --zstd -xf {} \; && + rm ".MTREE" && + rm ".PKGINFO" && + cd .. ) || AC_MSG_ERROR([Could not extract Windows toolchains.]) + + mv "inplace/${tarball_mingw_dir}" inplace/mingw && + touch inplace/mingw + AC_MSG_NOTICE([In-tree MingW-w64 tree created]) } # See Note [How we configure the bundled windows toolchain] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/49d94b1dcb8a161d3988f02d8ad47732... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/49d94b1dcb8a161d3988f02d8ad47732... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Serge S. Gulin (@gulin.serge)