Fix whereIsTool for cross

This commit is contained in:
Julian Ospald 2021-07-15 22:38:42 +02:00
parent bc85a7d9c3
commit 42134fd2a5
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F
2 changed files with 14 additions and 1 deletions

View File

@ -1929,7 +1929,7 @@ whereIsTool tool ver@GHCTargetVersion {..} = do
whenM (lift $ fmap not $ ghcInstalled ver)
$ throwE (NotInstalled GHC ver)
bdir <- lift $ ghcupGHCDir ver
pure (bdir </> "bin" </> "ghc" <> exeExt)
pure (bdir </> "bin" </> ghcBinaryName ver)
Cabal -> do
whenM (lift $ fmap not $ cabalInstalled _tvVersion)
$ throwE (NotInstalled Cabal (GHCTargetVersion Nothing _tvVersion))

View File

@ -1093,3 +1093,16 @@ ensureDirectories dirs = do
createDirRecursive' logsDir
createDirRecursive' confDir
pure ()
-- | For ghc without arch triple, this is:
--
-- - ghc-<ver> (e.g. ghc-8.10.4)
--
-- For ghc with arch triple:
--
-- - <triple>-ghc-<ver> (e.g. arm-linux-gnueabihf-ghc-8.10.4)
ghcBinaryName :: GHCTargetVersion -> String
ghcBinaryName (GHCTargetVersion (Just t) v') = T.unpack (t <> "-ghc-" <> prettyVer v' <> T.pack exeExt)
ghcBinaryName (GHCTargetVersion Nothing v') = T.unpack ("ghc-" <> prettyVer v' <> T.pack exeExt)