David Eichmann pushed to branch wip/davide/hadrian-aclocal_path at Glasgow Haskell Compiler / GHC
Commits:
-
2b6f845a
by David Eichmann at 2026-05-27T18:09:03+01:00
3 changed files:
Changes:
| ... | ... | @@ -54,7 +54,9 @@ def autoreconf(): |
| 54 | 54 | if os.name == 'nt':
|
| 55 | 55 | # Get the normalized ACLOCAL_PATH for Windows
|
| 56 | 56 | # This is necessary since on Windows this will be a Windows
|
| 57 | - # path, which autoreconf doesn't know doesn't know how to handle.
|
|
| 57 | + # path, which autoreconf doesn't know how to handle.
|
|
| 58 | + #
|
|
| 59 | + # This logic is duplicated in Hadrian. Specifically in hadrian/src/Rules/BinaryDist.hs
|
|
| 58 | 60 | ac_local = os.getenv('ACLOCAL_PATH', '')
|
| 59 | 61 | ac_local_arg = re.sub(r';', r':', ac_local)
|
| 60 | 62 | ac_local_arg = re.sub(r'\\', r'/', ac_local_arg)
|
| ... | ... | @@ -331,7 +331,22 @@ bindistRules = do |
| 331 | 331 | ghcRoot <- topDirectory
|
| 332 | 332 | copyFile (ghcRoot -/- "aclocal.m4") (ghcRoot -/- "distrib" -/- "aclocal.m4")
|
| 333 | 333 | copyDirectory (ghcRoot -/- "m4") (ghcRoot -/- "distrib")
|
| 334 | - buildWithCmdOptions [] $
|
|
| 334 | + |
|
| 335 | + -- Get the normalized ACLOCAL_PATH for Windows
|
|
| 336 | + -- This is necessary since on Windows this will be a Windows
|
|
| 337 | + -- path, which autoreconf doesn't know how to handle.
|
|
| 338 | + --
|
|
| 339 | + -- This logic is duplicated in the `boot` python script
|
|
| 340 | + win_host <- isWinHost
|
|
| 341 | + env <- if not win_host
|
|
| 342 | + then pure []
|
|
| 343 | + else do
|
|
| 344 | + aclocalPathMay <- getEnv "ACLOCAL_PATH"
|
|
| 345 | + pure [ AddEnv "ACLOCAL_PATH" (msys2WindowsToUnixPath aclocalPath)
|
|
| 346 | + | Just aclocalPath <- [aclocalPathMay]
|
|
| 347 | + ]
|
|
| 348 | + |
|
| 349 | + buildWithCmdOptions env $
|
|
| 335 | 350 | target (vanillaContext Stage1 ghc) (Autoreconf $ ghcRoot -/- "distrib") [] []
|
| 336 | 351 | -- We clean after ourselves, moving the configure script we generated in
|
| 337 | 352 | -- our bindist dir
|
| ... | ... | @@ -3,7 +3,8 @@ module Utilities ( |
| 3 | 3 | askWithResources,
|
| 4 | 4 | runBuilder, runBuilderWith,
|
| 5 | 5 | contextDependencies, stage1Dependencies,
|
| 6 | - topsortPackages, cabalDependencies
|
|
| 6 | + topsortPackages, cabalDependencies,
|
|
| 7 | + msys2WindowsToUnixPath
|
|
| 7 | 8 | ) where
|
| 8 | 9 | |
| 9 | 10 | import qualified Hadrian.Builder as H
|
| ... | ... | @@ -69,3 +70,17 @@ topsortPackages pkgs = do |
| 69 | 70 | let annotated = map (annotateInDeg es) es
|
| 70 | 71 | inDegZero = map snd $ filter ((== 0). fst) annotated
|
| 71 | 72 | in inDegZero ++ topSort (es \\ inDegZero)
|
| 73 | + |
|
| 74 | +-- | Converts a windows style path to a unix style path using msys2 conventions.
|
|
| 75 | +-- >>> msys2WindowsToUnixPath "C:\\foo\\bar;C:\\msys2\\bin"
|
|
| 76 | +-- "/C/foo/bar:/c/msys2/bin"
|
|
| 77 | +msys2WindowsToUnixPath :: String -> String
|
|
| 78 | +msys2WindowsToUnixPath =
|
|
| 79 | + replaceDrivePrefix
|
|
| 80 | + . replace "\\" "/"
|
|
| 81 | + . replace ";" ":"
|
|
| 82 | + where
|
|
| 83 | + replaceDrivePrefix p = case p of
|
|
| 84 | + drive : ':' : '/' : rest -> '/' : drive : '/' : replaceDrivePrefix rest
|
|
| 85 | + c : cs -> c : replaceDrivePrefix cs
|
|
| 86 | + [] -> [] |