From 42134fd2a5e7f4a5220a78e3f3164a0e3ab84261 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 15 Jul 2021 22:38:42 +0200 Subject: [PATCH] Fix whereIsTool for cross --- lib/GHCup.hs | 2 +- lib/GHCup/Utils.hs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/GHCup.hs b/lib/GHCup.hs index d12cde8..943370b 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -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)) diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index c95818a..c4fa5a5 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -1093,3 +1093,16 @@ ensureDirectories dirs = do createDirRecursive' logsDir createDirRecursive' confDir pure () + + +-- | For ghc without arch triple, this is: +-- +-- - ghc- (e.g. ghc-8.10.4) +-- +-- For ghc with arch triple: +-- +-- - -ghc- (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) +