@@ -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
-- bootstrapped ghc renames boot to boot.source
@@ -883,6 +883,9 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
883
883
884
884
liftE $ applyAnyPatch patches (fromGHCupPath workdir)
885
885
886
+ -- bootstrap, if necessary
887
+ liftE $ bootAndGenVersion workdir
888
+
886
889
tver <- liftE $ catchAllE @ _ @ '[ProcessError , ParseError , NotFoundInPATH ] @ '[] (\ _ -> pure Nothing ) $ fmap Just $ getGHCVer workdir
887
890
pure (workdir, tver)
888
891
@@ -937,6 +940,8 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
937
940
liftE $ applyAnyPatch patches (fromGHCupPath tmpUnpack)
938
941
939
942
-- bootstrap
943
+ liftE $ bootAndGenVersion tmpUnpack
944
+
940
945
tver <- liftE $ catchAllE @ _ @ '[ProcessError , ParseError , NotFoundInPATH ] @ '[] (\ _ -> pure Nothing ) $ fmap Just $ getGHCVer
941
946
tmpUnpack
942
947
liftE $ catchWarn $ lEM @ _ @ '[ProcessError ] $ darwinNotarization _rPlatform (fromGHCupPath tmpUnpack)
@@ -1038,6 +1043,24 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
1038
1043
pure installVer
1039
1044
1040
1045
where
1046
+ bootAndGenVersion :: ( MonadReader env m
1047
+ , HasSettings env
1048
+ , HasDirs env
1049
+ , HasLog env
1050
+ , MonadIO m
1051
+ , MonadThrow m
1052
+ )
1053
+ => GHCupPath
1054
+ -> Excepts '[ProcessError , NotFoundInPATH ] m ()
1055
+ bootAndGenVersion tmpUnpack = do
1056
+ let bootFile = fromGHCupPath tmpUnpack </> " boot"
1057
+ hasBootFile <- liftIO $ doesFileExist bootFile
1058
+ when hasBootFile $ do
1059
+ lift $ logDebug " Doing ghc-bootstrap"
1060
+ lEM $ execLogged " python3" [" ./boot" ] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap" Nothing
1061
+ -- This configure is to generate VERSION file
1062
+ liftE $ configureWithGhcBoot Nothing [] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap"
1063
+
1041
1064
getGHCVer :: ( MonadReader env m
1042
1065
, HasSettings env
1043
1066
, HasDirs env
@@ -1048,8 +1071,6 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
1048
1071
=> GHCupPath
1049
1072
-> Excepts '[ProcessError , ParseError , NotFoundInPATH ] m Version
1050
1073
getGHCVer tmpUnpack = do
1051
- lEM $ execLogged " python3" [" ./boot" ] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap" Nothing
1052
- liftE $ configureWithGhcBoot Nothing [] (Just $ fromGHCupPath tmpUnpack) " ghc-bootstrap"
1053
1074
let versionFile = fromGHCupPath tmpUnpack </> " VERSION"
1054
1075
hasVersionFile <- liftIO $ doesFileExist versionFile
1055
1076
if hasVersionFile
0 commit comments