diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-11-27 11:34:37 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-28 15:40:23 -0500 |
commit | 75fc1ed58bb9adb3f472e1529d368c0fff479353 (patch) | |
tree | 7233ccc5e6bfcfb7baed929276ab730cac4ebe58 /hadrian | |
parent | a1a75aa9be2c133dd1372a08eeb6a92c31688df7 (diff) | |
download | haskell-75fc1ed58bb9adb3f472e1529d368c0fff479353.tar.gz |
Hadrian: fix detection of ghc-pkg for cross-compilers
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Hadrian/Oracles/Cabal/Rules.hs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs b/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs index 546406ecd2..f1a4b0b5b6 100644 --- a/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs +++ b/hadrian/src/Hadrian/Oracles/Cabal/Rules.hs @@ -59,12 +59,20 @@ cabalOracle = do ++ quote (pkgName pkg) ++ " (" ++ show stage ++ ")..." -- Configure the package with the GHC corresponding to the given stage hcPath <- builderPath (Ghc CompileHs stage) + hcPkgPath <- builderPath (GhcPkg undefined stage) + -- N.B. the hcPath parameter of `configure` is broken when given an + -- empty ProgramDb. To work around this we manually construct an + -- appropriate ProgramDb. + -- + -- We also need to pass the path to ghc-pkg, because Cabal cannot + -- guess it (from ghc's path) when it's for a cross-compiler (e.g., + -- _build/stage0/bin/aarch64-linux-gnu-ghc-pkg). let progDb = userSpecifyPath "ghc" hcPath - $ addKnownProgram ghcProgram emptyProgramDb + $ addKnownProgram ghcProgram + $ userSpecifyPath "ghc-pkg" hcPkgPath + $ addKnownProgram ghcPkgProgram + $ emptyProgramDb (compiler, maybePlatform, _pkgdb) <- liftIO $ - -- 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" |