Skip to content

Commit bcc3e98

Browse files
committed
Use 'compiler/ghc.cabal.in' to determine workdir, as 'boot' file is not present in src tar.gz
Also use the workdir for applyAnyPatch
1 parent 1be68ba commit bcc3e98

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/GHCup/GHC.hs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -868,23 +868,22 @@ compileGHC targetGhc crossTarget vps bstrap hghc jobs mbuildConfig patches aargs
868868
tmpDownload <- lift withGHCupTmpDir
869869
tmpUnpack <- lift mkGhcupTmpDir
870870
tar <- liftE $ download uri Nothing Nothing Nothing (fromGHCupPath tmpDownload) Nothing False
871-
(bf, 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] tmpUnpack $ do
872872
liftE $ unpackToDir (fromGHCupPath tmpUnpack) tar
873873

874-
liftE $ applyAnyPatch patches (fromGHCupPath tmpUnpack)
875-
876-
let regex = [s|^(.*/)*boot$|] :: B.ByteString
877-
[bootFile] <- liftIO $ findFilesDeep
874+
let regex = [s|^(.*/)*compiler/ghc.cabal.in$|] :: B.ByteString
875+
(ghcCabalIn:_) <- liftIO $ findFilesDeep
878876
tmpUnpack
879-
(makeRegexOpts compExtended
880-
execBlank
881-
regex
882-
)
883-
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer
884-
(appendGHCupPath tmpUnpack (takeDirectory bootFile))
885-
pure (bootFile, tver)
877+
(makeRegexOpts compExtended execBlank regex)
878+
879+
let workdir = appendGHCupPath tmpUnpack (takeDirectory (takeDirectory ghcCabalIn))
880+
881+
lift $ logDebug $ "GHC compile workdir: " <> T.pack (fromGHCupPath workdir)
882+
883+
liftE $ applyAnyPatch patches (fromGHCupPath workdir)
886884

887-
let workdir = appendGHCupPath tmpUnpack (takeDirectory bf)
885+
tver <- liftE $ catchAllE @_ @'[ProcessError, ParseError, NotFoundInPATH] @'[] (\_ -> pure Nothing) $ fmap Just $ getGHCVer workdir
886+
pure (workdir, tver)
888887

889888
ov <- case vps of
890889
Just vps' -> fmap Just $ expandVersionPattern tver "" "" "" "" vps'

0 commit comments

Comments
 (0)