Fix cross installation

See https://gitlab.haskell.org/ghc/ghc/-/issues/14297
This commit is contained in:
Julian Ospald 2021-07-15 20:30:33 +02:00
parent 7e14fd4a08
commit bc85a7d9c3
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F

View File

@ -1618,11 +1618,11 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs
Right g -> pure $ Right g
Left bver -> pure $ Left ("ghc-" <> (T.unpack . prettyVer $ bver) <> exeExt)
(bindist, bmk) <- liftE $ runBuildAction
(mBindist, bmk) <- liftE $ runBuildAction
tmpUnpack
Nothing
(do
b <- compileBindist bghc tver workdir
b <- compileBindist bghc tver workdir ghcdir
bmk <- liftIO $ B.readFile (build_mk workdir)
pure (b, bmk)
)
@ -1630,6 +1630,8 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs
when alreadyInstalled $ do
lift $ $(logInfo) [i|Deleting existing installation|]
liftE $ rmGHCVer tver
forM_ mBindist $ \bindist -> do
liftE $ installPackedGHC bindist
(Just $ RegexDir "ghc-.*")
ghcdir
@ -1670,11 +1672,12 @@ HADDOCK_DOCS = YES|]
=> Either FilePath FilePath
-> GHCTargetVersion
-> FilePath
-> FilePath
-> Excepts
'[FileDoesNotExistError, InvalidBuildConfig, PatchFailed, ProcessError, NotFoundInPATH, CopyError]
m
FilePath -- ^ output path of bindist
compileBindist bghc tver workdir = do
(Maybe FilePath) -- ^ output path of bindist, None for cross
compileBindist bghc tver workdir ghcdir = do
lift $ $(logInfo) [i|configuring build|]
liftE checkBuildConfig
@ -1695,6 +1698,7 @@ HADDOCK_DOCS = YES|]
("./configure" : maybe mempty
(\x -> ["--target=" <> T.unpack x])
(_tvTarget tver)
++ ["--prefix=" <> ghcdir]
#if defined(IS_WINDOWS)
++ ["--enable-tarballs-autodownload"]
#endif
@ -1711,6 +1715,7 @@ HADDOCK_DOCS = YES|]
++ maybe mempty
(\x -> ["--target=" <> T.unpack x])
(_tvTarget tver)
++ ["--prefix=" <> ghcdir]
#if defined(IS_WINDOWS)
++ ["--enable-tarballs-autodownload"]
#endif
@ -1731,6 +1736,11 @@ HADDOCK_DOCS = YES|]
lift $ $(logInfo) [i|Building (this may take a while)...|]
lEM $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) (Just workdir)
if | isCross tver -> do
lift $ $(logInfo) [i|Installing cross toolchain...|]
lEM $ make ["install"] (Just workdir)
pure Nothing
| otherwise -> do
lift $ $(logInfo) [i|Creating bindist...|]
lEM $ make ["binary-dist"] (Just workdir)
[tar] <- liftIO $ findFiles
@ -1754,7 +1764,7 @@ HADDOCK_DOCS = YES|]
handleIO (throwE . CopyError . show) $ liftIO $ copyFile (workdir </> tar)
tarPath
lift $ $(logInfo) [i|Copied bindist to #{tarPath}|]
pure tarPath
pure $ Just tarPath
build_mk workdir = workdir </> "mk" </> "build.mk"
@ -1781,6 +1791,9 @@ HADDOCK_DOCS = YES|]
)
_ -> pure ()
isCross :: GHCTargetVersion -> Bool
isCross = isJust . _tvTarget