@@ -868,7 +868,7 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
868
868
tmpDownload <- lift withGHCupTmpDir
869
869
tmpUnpack <- lift mkGhcupTmpDir
870
870
tar <- liftE $ download uri Nothing Nothing Nothing (fromGHCupPath tmpDownload) Nothing False
871
- (workdir, tver) <- liftE $ cleanUpOnError @ '[UnknownArchive , ArchiveResult , ProcessError , PatchFailed , DownloadFailed , DigestError , ContentLengthError , GPGError ] tmpUnpack $ do
871
+ (workdir, tver) <- liftE $ cleanUpOnError @ '[UnknownArchive , ArchiveResult , ProcessError , PatchFailed , DownloadFailed , DigestError , ContentLengthError , GPGError , NotFoundInPATH ] tmpUnpack $ do
872
872
liftE $ unpackToDir (fromGHCupPath tmpUnpack) tar
873
873
874
874
let regex = [s |^(.*/)*compiler/ghc.cabal.in$|] :: B. ByteString
@@ -882,6 +882,9 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
882
882
883
883
liftE $ applyAnyPatch patches (fromGHCupPath workdir)
884
884
885
+ -- bootstrap, if necessary
886
+ liftE $ bootAndConfigure workdir
887
+
885
888
tver <- liftE $ catchAllE @ _ @ '[ProcessError , ParseError , NotFoundInPATH ] @ '[] (\ _ -> pure Nothing ) $ fmap Just $ getGHCVer workdir
886
889
pure (workdir, tver)
887
890
@@ -936,6 +939,8 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
936
939
liftE $ applyAnyPatch patches (fromGHCupPath tmpUnpack)
937
940
938
941
-- bootstrap
942
+ liftE $ bootAndConfigure tmpUnpack
943
+
939
944
tver <- liftE $ catchAllE @ _ @ '[ProcessError , ParseError , NotFoundInPATH ] @ '[] (\ _ -> pure Nothing ) $ fmap Just $ getGHCVer
940
945
tmpUnpack
941
946
liftE $ catchWarn $ lEM @ _ @ '[ProcessError ] $ darwinNotarization _rPlatform (fromGHCupPath tmpUnpack)
@@ -1037,6 +1042,24 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
1037
1042
pure installVer
1038
1043
1039
1044
where
1045
+ bootAndConfigure :: ( MonadReader env m
1046
+ , HasSettings env
1047
+ , HasDirs env
1048
+ , HasLog env
1049
+ , MonadIO m
1050
+ , MonadThrow m
1051
+ )
1052
+ => GHCupPath
1053
+ -> Excepts '[ProcessError , NotFoundInPATH ] m ()
1054
+ bootAndConfigure tmpUnpack = do
1055
+ let bootFile = fromGHCupPath tmpUnpack </> " boot"
1056
+ hasBootFile <- liftIO $ doesFileExist bootFile
1057
+ when hasBootFile $ do
1058
+ lift $ logDebug " Doing ghc-bootstrap"
1059
+ python3 <- liftE $ makeAbsolute " python3"
1060
+ lEM $ execLogged python3 [" ./boot" ] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap" Nothing
1061
+ liftE $ configureWithGhcBoot Nothing [] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap"
1062
+
1040
1063
getGHCVer :: ( MonadReader env m
1041
1064
, HasSettings env
1042
1065
, HasDirs env
@@ -1047,8 +1070,6 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
1047
1070
=> GHCupPath
1048
1071
-> Excepts '[ProcessError , ParseError , NotFoundInPATH ] m Version
1049
1072
getGHCVer tmpUnpack = do
1050
- lEM $ execLogged " python3" [" ./boot" ] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap" Nothing
1051
- liftE $ configureWithGhcBoot Nothing [] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap"
1052
1073
let versionFile = fromGHCupPath tmpUnpack </> " VERSION"
1053
1074
hasVersionFile <- liftIO $ doesFileExist versionFile
1054
1075
if hasVersionFile
0 commit comments