Commit 4ce9fe88 authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot

hadrian: Fix leakage of GHC in PATH into build

Previously hadrian would use GHC on PATH when configuring packages (or
fail if there is no such GHC). Fix this. Unfortunately this runs into
another bug in Cabal which we workaround.
parent 5aae5b32
......@@ -15,6 +15,7 @@ import Control.Monad
import Data.Maybe
import Development.Shake
import Distribution.Simple.GHC
import Distribution.Simple.Program.Builtin
import Distribution.Simple.Program.Db
import Distribution.Verbosity
......@@ -58,8 +59,13 @@ cabalOracle = do
++ quote (pkgName pkg) ++ " (" ++ show stage ++ ")..."
-- Configure the package with the GHC corresponding to the given stage
hcPath <- builderPath (Ghc CompileHs stage)
let progDb = userSpecifyPath "ghc" hcPath
$ addKnownProgram ghcProgram emptyProgramDb
(compiler, maybePlatform, _pkgdb) <- liftIO $
configure silent (Just hcPath) Nothing emptyProgramDb
-- N.B. the hcPath parameter of `configure` is broken when given an
-- empty ProgramDb. To work around this we manually construct an
-- appropriate ProgramDb.
configure silent Nothing Nothing progDb
let platform = fromMaybe (error msg) maybePlatform
msg = "PackageConfiguration oracle: cannot detect platform"
return $ PackageConfiguration (compiler, platform)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment