diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 3c380a41a86..c06fd7bdfc3 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiWayIf #-} +{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TupleSections #-} @@ -83,6 +84,7 @@ import Prelude () import Control.Monad (forM_, msum) import Data.Char (isLower) +import Data.List (stripPrefix) import qualified Data.Map as Map import Distribution.CabalSpecVersion import Distribution.InstalledPackageInfo (InstalledPackageInfo) @@ -246,10 +248,16 @@ configure verbosity hcPath hcPkgPath conf0 = do filterExt ext = filter ((/= EnableExtension ext) . fst) + compilerId :: CompilerId + compilerId = CompilerId GHC ghcVersion + + compilerAbiTag :: AbiTag + compilerAbiTag = maybe NoAbiTag AbiTag (Map.lookup "Project Unit Id" ghcInfoMap >>= stripPrefix (prettyShow compilerId <> "-")) + let comp = Compiler - { compilerId = CompilerId GHC ghcVersion - , compilerAbiTag = NoAbiTag + { compilerId + , compilerAbiTag , compilerCompat = [] , compilerLanguages = languages , compilerExtensions = extensions diff --git a/cabal-install/src/Distribution/Client/PackageHash.hs b/cabal-install/src/Distribution/Client/PackageHash.hs index 18be444cde7..c5291de2a8e 100644 --- a/cabal-install/src/Distribution/Client/PackageHash.hs +++ b/cabal-install/src/Distribution/Client/PackageHash.hs @@ -39,6 +39,7 @@ import Distribution.Package ) import Distribution.Simple.Compiler ( CompilerId + , AbiTag(..) , DebugInfoLevel (..) , OptimisationLevel (..) , PackageDB @@ -191,6 +192,7 @@ type PackageSourceHash = HashValue -- package hash. data PackageHashConfigInputs = PackageHashConfigInputs { pkgHashCompilerId :: CompilerId + , pkgHashCompilerAbiTag :: AbiTag , pkgHashPlatform :: Platform , pkgHashFlagAssignment :: FlagAssignment -- complete not partial , pkgHashConfigureScriptArgs :: [String] -- just ./configure for build-type Configure @@ -301,6 +303,7 @@ renderPackageHashInputs pkgHashDirectDeps , -- and then all the config entry "compilerid" prettyShow pkgHashCompilerId + , entry "compiler-abi-tag" renderAbiTag pkgHashCompilerAbiTag , entry "platform" prettyShow pkgHashPlatform , opt "flags" mempty showFlagAssignment pkgHashFlagAssignment , opt "configure-script" [] unwords pkgHashConfigureScriptArgs @@ -352,3 +355,8 @@ renderPackageHashInputs opt key def format value | value == def = Nothing | otherwise = entry key format value + +renderAbiTag :: AbiTag -> String +renderAbiTag abiTag = case abiTag of + NoAbiTag -> "unknown" + AbiTag tag -> tag diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index 1b92a8aa54b..9b7b73f6c81 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -4569,6 +4569,7 @@ packageHashConfigInputs packageHashConfigInputs shared@ElaboratedSharedConfig{..} pkg = PackageHashConfigInputs { pkgHashCompilerId = compilerId pkgConfigCompiler + , pkgHashCompilerAbiTag = compilerAbiTag pkgConfigCompiler , pkgHashPlatform = pkgConfigPlatform , pkgHashFlagAssignment = elabFlagAssignment , pkgHashConfigureScriptArgs = elabConfigureScriptArgs