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
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:
... | ... | @@ -873,10 +873,6 @@ job arch opsys buildConfig = NamedJob { name = jobName, jobInfo = Job {..} } |
873 | 873 | , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh configure"
|
874 | 874 | -- We have to trigger cabal build in an independent way to mitigate Wine hangs at MSYS2/Arm64EC
|
875 | 875 | , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l -c './hadrian/build-cabal clean'"
|
876 | - -- We use "--enable-distro-toolchain" due of TOOLCHAIN_SOURCE="env", so we have to manually copy
|
|
877 | - -- bootstrap's compiler mingw into `_build` because binary-dist-dir requires it at Windows.
|
|
878 | - -- After './hadrian/build-cabal clean' we have to recreate the build root directory.
|
|
879 | - , "mkdir ./_build && cp -r ~/.wine/drive_c/msys64/opt/ghc-bootstrap/mingw ./_build/"
|
|
880 | 876 | , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh build_hadrian"
|
881 | 877 | , "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh test_hadrian"
|
882 | 878 | ]
|
... | ... | @@ -523,7 +523,6 @@ |
523 | 523 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh setup",
|
524 | 524 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh configure",
|
525 | 525 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l -c './hadrian/build-cabal clean'",
|
526 | - "mkdir ./_build && cp -r ~/.wine/drive_c/msys64/opt/ghc-bootstrap/mingw ./_build/",
|
|
527 | 526 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh build_hadrian",
|
528 | 527 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh test_hadrian"
|
529 | 528 | ],
|
... | ... | @@ -1281,7 +1280,6 @@ |
1281 | 1280 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh setup",
|
1282 | 1281 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh configure",
|
1283 | 1282 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l -c './hadrian/build-cabal clean'",
|
1284 | - "mkdir ./_build && cp -r ~/.wine/drive_c/msys64/opt/ghc-bootstrap/mingw ./_build/",
|
|
1285 | 1283 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh build_hadrian",
|
1286 | 1284 | "/opt/wine-arm64ec-msys2-deb12/bin/wine c:/msys64/usr/bin/bash.exe -l .gitlab/ci.sh test_hadrian"
|
1287 | 1285 | ],
|
... | ... | @@ -26,7 +26,7 @@ import Hadrian.Builder.Tar |
26 | 26 | import Hadrian.Oracles.Path
|
27 | 27 | import Hadrian.Oracles.TextFile
|
28 | 28 | import Hadrian.Utilities
|
29 | -import Oracles.Setting (bashPath, targetStage, isWinHost)
|
|
29 | +import Oracles.Setting (bashPath, targetStage, isWinHost, isWinTarget)
|
|
30 | 30 | import System.Exit
|
31 | 31 | import System.IO (stderr)
|
32 | 32 | |
... | ... | @@ -240,12 +240,14 @@ instance H.Builder Builder where |
240 | 240 | Ghc _ st -> do
|
241 | 241 | root <- buildRoot
|
242 | 242 | unlitPath <- builderPath Unlit
|
243 | + win_target <- isWinTarget
|
|
244 | + win_host <- isWinHost
|
|
243 | 245 | distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW
|
244 | 246 | libffi_adjustors <- useLibffiForAdjustors
|
245 | 247 | use_system_ffi <- flag UseSystemFfi
|
246 | 248 | |
247 | 249 | return $ [ unlitPath ]
|
248 | - ++ [ root -/- mingwStamp | windowsHost, distro_mingw == "NO" ]
|
|
250 | + ++ [ root -/- mingwStamp | win_target, win_host, distro_mingw == "NO" ]
|
|
249 | 251 | -- proxy for the entire mingw toolchain that
|
250 | 252 | -- we have in inplace/mingw initially, and then at
|
251 | 253 | -- root -/- mingw.
|
... | ... | @@ -256,7 +256,10 @@ bindistRules = do |
256 | 256 | copyFile ("libraries" -/- "prologue.txt") (bindistFilesDir -/- "docs-utils" -/- "prologue.txt")
|
257 | 257 | copyFile ("libraries" -/- "gen_contents_index") (bindistFilesDir -/- "docs-utils" -/- "gen_contents_index" )
|
258 | 258 | |
259 | - when windowsHost $ do
|
|
259 | + win_host <- isWinHost
|
|
260 | + win_target <- isWinTarget
|
|
261 | + distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW
|
|
262 | + when (win_host && win_target && distro_mingw == "NO") $ do
|
|
260 | 263 | copyDirectory (root -/- "mingw") bindistFilesDir
|
261 | 264 | -- we use that opportunity to delete the .stamp file that we use
|
262 | 265 | -- as a proxy for the whole mingw toolchain, there's no point in
|
... | ... | @@ -9,7 +9,19 @@ AC_DEFUN([FP_INSTALL_WINDOWS_TOOLCHAIN],[ |
9 | 9 | fi
|
10 | 10 | |
11 | 11 | set_up_tarballs() {
|
12 | - AC_MSG_NOTICE([Checking for Windows toolchain tarballs...])
|
|
12 | + AC_MSG_CHECKING([for Windows toolchain tarballs...])
|
|
13 | + |
|
14 | + # We are leaving an option to substitute the toolchain with manually prepared one at the CI due of cross-compile targets.
|
|
15 | + # Builtin toolchain does not support cross-compile nor we have other reasons why it should.
|
|
16 | + # Probably we shouldn't ship GHC with a built-in toolchain for all cross-compile options.
|
|
17 | + # Cross-compile support is a relatively new and experimental option for Windows target but
|
|
18 | + # important to support AArch64. Same as Darwin.
|
|
19 | + if test -d inplace/mingw
|
|
20 | + then
|
|
21 | + AC_MSG_RESULT([skipping, inplace/mingw exists])
|
|
22 | + return 0
|
|
23 | + fi
|
|
24 | + |
|
13 | 25 | local action
|
14 | 26 | if test "$TarballsAutodownload" = "NO"
|
15 | 27 | then
|
... | ... | @@ -17,6 +29,9 @@ AC_DEFUN([FP_INSTALL_WINDOWS_TOOLCHAIN],[ |
17 | 29 | else
|
18 | 30 | action="download"
|
19 | 31 | fi
|
32 | + readonly action
|
|
33 | + AC_MSG_RESULT([$action...])
|
|
34 | + |
|
20 | 35 | $PYTHON mk/get-win32-tarballs.py $action $mingw_arch
|
21 | 36 | case $? in
|
22 | 37 | 0)
|
... | ... | @@ -45,22 +60,19 @@ AC_DEFUN([FP_INSTALL_WINDOWS_TOOLCHAIN],[ |
45 | 60 | esac
|
46 | 61 | |
47 | 62 | # Extract all the tarballs in one go
|
48 | - if ! test -d inplace/mingw
|
|
49 | - then
|
|
50 | - AC_MSG_NOTICE([Extracting Windows toolchain from archives (may take a while)...])
|
|
51 | - rm -rf inplace/mingw
|
|
52 | - local base_dir="../ghc-tarballs/${tarball_dest_dir}"
|
|
53 | - ( cd inplace &&
|
|
54 | - find "${base_dir}" -name "*.tar.xz" -exec tar --xz -xf {} \; &&
|
|
55 | - find "${base_dir}" -name "*.tar.zst" -exec tar --zstd -xf {} \; &&
|
|
56 | - rm ".MTREE" &&
|
|
57 | - rm ".PKGINFO" &&
|
|
58 | - cd .. ) || AC_MSG_ERROR([Could not extract Windows toolchains.])
|
|
59 | - |
|
60 | - mv "inplace/${tarball_mingw_dir}" inplace/mingw &&
|
|
61 | - touch inplace/mingw
|
|
62 | - AC_MSG_NOTICE([In-tree MingW-w64 tree created])
|
|
63 | - fi
|
|
63 | + AC_MSG_NOTICE([Extracting Windows toolchain from archives (may take a while)...])
|
|
64 | + rm -rf inplace/mingw
|
|
65 | + local base_dir="../ghc-tarballs/${tarball_dest_dir}"
|
|
66 | + ( cd inplace &&
|
|
67 | + find "${base_dir}" -name "*.tar.xz" -exec tar --xz -xf {} \; &&
|
|
68 | + find "${base_dir}" -name "*.tar.zst" -exec tar --zstd -xf {} \; &&
|
|
69 | + rm ".MTREE" &&
|
|
70 | + rm ".PKGINFO" &&
|
|
71 | + cd .. ) || AC_MSG_ERROR([Could not extract Windows toolchains.])
|
|
72 | + |
|
73 | + mv "inplace/${tarball_mingw_dir}" inplace/mingw &&
|
|
74 | + touch inplace/mingw
|
|
75 | + AC_MSG_NOTICE([In-tree MingW-w64 tree created])
|
|
64 | 76 | }
|
65 | 77 | |
66 | 78 | # See Note [How we configure the bundled windows toolchain]
|