File tree Expand file tree Collapse file tree 4 files changed +20
-13
lines changed Expand file tree Collapse file tree 4 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ Other enhancements:
15
15
16
16
Bug fixes:
17
17
18
+ * GHC source builds work properly for recent GHC versions again. See
19
+ [ #5528 ] ( https://github.com/commercialhaskell/stack/issues/5528 )
18
20
19
21
## v2.7.1
20
22
Original file line number Diff line number Diff line change @@ -531,7 +531,7 @@ extra-deps:
531
531
# ### Bootstrapping compiler
532
532
533
533
Building GHC from source requires a working GHC (known as the bootstrap
534
- compiler). As we use a Stack based version of Hadrian (`hadrian/build. stack.sh ` in
534
+ compiler). As we use a Stack based version of Hadrian (`hadrian/build- stack` in
535
535
GHC sources), the bootstrap compiler is configured into `hadrian/stack.yaml` and
536
536
fully managed by Stack.
537
537
Original file line number Diff line number Diff line change @@ -115,8 +115,8 @@ module Stack.Constants
115
115
,relFileStackDotTmpDotExe
116
116
,relFileStackDotTmp
117
117
,ghcShowOptionsOutput
118
- ,hadrianCmdWindows
119
- ,hadrianCmdPosix
118
+ ,hadrianScriptsWindows
119
+ ,hadrianScriptsPosix
120
120
,usrLibDirs
121
121
,testGhcEnvRelFile
122
122
,relFileBuildLock
@@ -533,13 +533,15 @@ ghcShowOptionsOutput :: [String]
533
533
ghcShowOptionsOutput =
534
534
$ (TH. runIO (readProcess " ghc" [" --show-options" ] " " ) >>= TH. lift . lines )
535
535
536
- -- | Relative path inside a GHC repo to the Hadrian build batch script
537
- hadrianCmdWindows :: Path Rel File
538
- hadrianCmdWindows = $ (mkRelFile " hadrian/build.stack.bat" )
536
+ -- | Relative paths inside a GHC repo to the Hadrian build batch script.
537
+ -- The second path is maintained for compatibility with older GHC versions.
538
+ hadrianScriptsWindows :: [Path Rel File ]
539
+ hadrianScriptsWindows = [$ (mkRelFile " hadrian/build-stack.bat" ), $ (mkRelFile " hadrian/build.stack.bat" )]
539
540
540
- -- | Relative path inside a GHC repo to the Hadrian build shell script
541
- hadrianCmdPosix :: Path Rel File
542
- hadrianCmdPosix = $ (mkRelFile " hadrian/build.stack.sh" )
541
+ -- | Relative paths inside a GHC repo to the Hadrian build shell script
542
+ -- The second path is maintained for compatibility with older GHC versions.
543
+ hadrianScriptsPosix :: [Path Rel File ]
544
+ hadrianScriptsPosix = [$ (mkRelFile " hadrian/build-stack" ), $ (mkRelFile " hadrian/build.stack.sh" )]
543
545
544
546
-- | Used in Stack.Setup for detecting libtinfo, see comments at use site
545
547
usrLibDirs :: [Path Abs Dir ]
Original file line number Diff line number Diff line change @@ -836,9 +836,12 @@ buildGhcFromSource getSetupInfo' installed (CompilerRepository url) commitId fla
836
836
, " --flavour=" <> flavour -- selected flavour
837
837
, " binary-dist"
838
838
]
839
- hadrianCmd
840
- | osIsWindows = hadrianCmdWindows
841
- | otherwise = hadrianCmdPosix
839
+ hadrianScripts
840
+ | osIsWindows = hadrianScriptsWindows
841
+ | otherwise = hadrianScriptsPosix
842
+
843
+ foundHadrianPaths <- filterM doesFileExist $ (cwd </> ) <$> hadrianScripts
844
+ hadrianPath <- maybe (throwString " No Hadrian build script found" ) pure $ listToMaybe foundHadrianPaths
842
845
843
846
logSticky $ " Building GHC from source with `"
844
847
<> RIO. display flavour
@@ -847,7 +850,7 @@ buildGhcFromSource getSetupInfo' installed (CompilerRepository url) commitId fla
847
850
-- We need to provide an absolute path to the script since
848
851
-- the process package only sets working directory _after_
849
852
-- discovering the executable
850
- proc (toFilePath (cwd </> hadrianCmd) ) hadrianArgs runProcess_
853
+ proc (toFilePath hadrianPath ) hadrianArgs runProcess_
851
854
852
855
-- find the bindist and install it
853
856
bindistPath <- parseRelDir " _build/bindist"
You can’t perform that action at this time.
0 commit comments