Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • hadrian/src/Rules/Test.hs
    ... ... @@ -316,8 +316,10 @@ timeoutProgBuilder = do
    316 316
     needTestsuitePackages :: Stage -> Action ()
    
    317 317
     needTestsuitePackages stg = do
    
    318 318
       allpkgs <- packages <$> flavour
    
    319
    -  -- TODO: This used to force the packages to Stage1. Check if the tuple dance is still useful now.
    
    320
    -  libpkgs <- map (stg,) . filter isLibrary <$> allpkgs stg
    
    319
    +  isCross <- crossStage stg
    
    320
    +  -- In cross case, the libraries are one stage ahead
    
    321
    +  let libraryStage = if isCross then succStage stg else stg
    
    322
    +  libpkgs <- map (libraryStage,) . filter isLibrary <$> allpkgs libraryStage
    
    321 323
       -- And the executables of the current stage
    
    322 324
       exepkgs <- map (stg,) . filter isProgram <$> allpkgs stg
    
    323 325
       -- Don't require lib:ghc or lib:cabal when testing the stage1 compiler
    
    ... ... @@ -326,7 +328,19 @@ needTestsuitePackages stg = do
    326 328
       -- Unfortunately, we still need the liba
    
    327 329
       let pkgs = filter (\(_,p) -> not $ (pkgName p `elem` ["ghc", "Cabal"]) && isStage0 stg)
    
    328 330
                         (libpkgs ++ exepkgs ++ [ (stg,timeout) | windowsHost ])
    
    331
    +
    
    329 332
       need =<< mapM (uncurry pkgFile) pkgs
    
    333
    +  when isCross $ do
    
    334
    +    jsTarget <- isJsTarget (succStage stg)
    
    335
    +    wasmTarget <- isWasmTarget (succStage stg)
    
    336
    +    libPath <- stageLibPath stg
    
    337
    +    let jsDeps
    
    338
    +          | jsTarget  = ["ghc-interp.js"]
    
    339
    +          | otherwise = []
    
    340
    +        wasmDeps
    
    341
    +          | wasmTarget = ["dyld.mjs", "post-link.mjs", "prelude.mjs"]
    
    342
    +          | otherwise  = []
    
    343
    +    need $ map (libPath -/-) (jsDeps ++ wasmDeps)
    
    330 344
     
    
    331 345
     -- stage 1 ghc lives under stage0/bin,
    
    332 346
     -- stage 2 ghc lives under stage1/bin, etc
    

  • hadrian/src/Settings/Builders/RunTest.hs
    ... ... @@ -105,6 +105,7 @@ allowHaveLLVM = not . (`elem` ["wasm32", "javascript"])
    105 105
     --
    
    106 106
     inTreeCompilerArgs :: Stage -> Action TestCompilerArgs
    
    107 107
     inTreeCompilerArgs stg = do
    
    108
    +    -- TODO: executable and library stage would be clearer
    
    108 109
         cross <- crossStage stg
    
    109 110
         let ghcStage = succStage stg
    
    110 111
             pkgCacheStage = if cross then ghcStage else stg
    
    ... ... @@ -142,7 +143,7 @@ inTreeCompilerArgs stg = do
    142 143
         pkgConfCacheFile <- System.FilePath.normalise . (top -/-)
    
    143 144
                         <$> (packageDbPath (PackageDbLoc pkgCacheStage Final) <&> (-/- "package.cache"))
    
    144 145
         libdir           <- System.FilePath.normalise . (top -/-)
    
    145
    -                    <$> stageLibPath stg
    
    146
    +                    <$> stageLibPath pkgCacheStage
    
    146 147
     
    
    147 148
         -- For this information, we need to query ghc --info, however, that would
    
    148 149
         -- require building ghc, which we don't want to do here. Therefore, the