diff options
Diffstat (limited to 'hadrian/src/Rules/Test.hs')
-rw-r--r-- | hadrian/src/Rules/Test.hs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs index f1fb204c88..0c8bd0059d 100644 --- a/hadrian/src/Rules/Test.hs +++ b/hadrian/src/Rules/Test.hs @@ -9,6 +9,7 @@ import Expression import Flavour import Hadrian.Haskell.Cabal.Type (packageDependencies) import Hadrian.Oracles.Cabal (readPackageData) +import Hadrian.Oracles.Path (fixAbsolutePathOnWindows) import Oracles.Setting import Oracles.TestSettings import Oracles.Flag @@ -191,9 +192,32 @@ testRules = do -- Prepare Ghc configuration file for input compiler. need [root -/- timeoutPath] + cross <- flag CrossCompiling - ghcPath <- getCompilerPath testCompilerArg + -- get relative path for the given program in the given stage + let relative_path_stage s p = programPath =<< programContext s p + let make_absolute rel_path = do + abs_path <- liftIO (IO.makeAbsolute rel_path) + fixAbsolutePathOnWindows abs_path + + rel_ghc_pkg <- relative_path_stage Stage1 ghcPkg + rel_hsc2hs <- relative_path_stage Stage1 hsc2hs + rel_hp2ps <- relative_path_stage Stage1 hp2ps + rel_haddock <- relative_path_stage (Stage0 InTreeLibs) haddock + rel_hpc <- relative_path_stage (Stage0 InTreeLibs) hpc + rel_runghc <- relative_path_stage (Stage0 InTreeLibs) runGhc + -- force stage0 program building for cross + when cross $ need [rel_hpc, rel_haddock, rel_runghc] + + prog_ghc_pkg <- make_absolute rel_ghc_pkg + prog_hsc2hs <- make_absolute rel_hsc2hs + prog_hp2ps <- make_absolute rel_hp2ps + prog_haddock <- make_absolute rel_haddock + prog_hpc <- make_absolute rel_hpc + prog_runghc <- make_absolute rel_runghc + + ghcPath <- getCompilerPath testCompilerArg makePath <- builderPath $ Make "" top <- topDirectory @@ -222,6 +246,15 @@ testRules = do setEnv "TEST_HC_OPTS_INTERACTIVE" ghciFlags setEnv "TEST_CC" ccPath setEnv "TEST_CC_OPTS" ccFlags + + when cross $ do + setEnv "GHC_PKG" prog_ghc_pkg + setEnv "HSC2HS" prog_hsc2hs + setEnv "HP2PS_ABS" prog_hp2ps + setEnv "HPC" prog_hpc + setEnv "HADDOCK" prog_haddock + setEnv "RUNGHC" prog_runghc + setEnv "CHECK_PPR" (top -/- root -/- checkPprProgPath) setEnv "CHECK_EXACT" (top -/- root -/- checkExactProgPath) setEnv "COUNT_DEPS" (top -/- root -/- countDepsProgPath) |