From 32523713e044732ac37f2e2cdce2f6820f9c0997 Mon Sep 17 00:00:00 2001 From: Matthew Pickering <matthewtpickering@gmail.com> Date: Thu, 5 Oct 2023 16:42:13 +0100 Subject: [PATCH] hadrian: Move ghcBinDeps into ghcLibDeps This completes a5227080b57cb51ac34d4c9de1accdf6360b818b, the `ghc-usage.txt` and `ghci-usage.txt` file are also used by the `ghc` library so need to make sure they are present in the libdir even if we are not going to build `ghc-bin`. This also fixes things for cross compilers because the stage2 cross-compiler requires the ghc-usage.txt file, but we are using the stage2 lib folder but not building stage3:exe:ghc-bin so ghc-usage.txt was not being generated. --- hadrian/src/Base.hs | 11 +++-------- hadrian/src/Builder.hs | 7 +------ hadrian/src/Rules/Program.hs | 2 -- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/hadrian/src/Base.hs b/hadrian/src/Base.hs index e135d355e03f..9000c1144265 100644 --- a/hadrian/src/Base.hs +++ b/hadrian/src/Base.hs @@ -32,7 +32,7 @@ module Base ( hadrianPath, configPath, configFile, sourcePath, shakeFilesDir, stageBinPath, stageLibPath, templateHscPath, buildTargetFile, hostTargetFile, targetTargetFile, - ghcBinDeps, ghcLibDeps, haddockDeps, + ghcLibDeps, haddockDeps, relativePackageDbPath, packageDbPath, packageDbStamp, mingwStamp, systemCxxStdLibConf, systemCxxStdLibConfPath , PackageDbLoc(..), Inplace(..) @@ -151,17 +151,12 @@ ghcLibDeps stage iplace = do , "llvm-passes" , "ghc-interp.js" , "settings" + , "ghc-usage.txt" + , "ghci-usage.txt" ] cxxStdLib <- systemCxxStdLibConfPath (PackageDbLoc stage iplace) return (cxxStdLib : ps) --- | Files the GHC binary depends on. -ghcBinDeps :: Stage -> Action [FilePath] -ghcBinDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f)) - [ "ghc-usage.txt" - , "ghci-usage.txt" - ] - -- | Files the `haddock` binary depends on haddockDeps :: Stage -> Action [FilePath] haddockDeps stage = do diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs index a97a9033b117..87171c960977 100644 --- a/hadrian/src/Builder.hs +++ b/hadrian/src/Builder.hs @@ -238,17 +238,12 @@ instance H.Builder Builder where -- changes (#18001). _bootGhcVersion <- setting GhcVersion pure [] - Ghc _ stage -> do + Ghc {} -> do root <- buildRoot touchyPath <- programPath (vanillaContext (Stage0 InTreeLibs) touchy) unlitPath <- builderPath Unlit - -- GHC from the previous stage is used to build artifacts in the - -- current stage. Need the previous stage's GHC deps. - ghcdeps <- ghcBinDeps (predStage stage) - return $ [ unlitPath ] - ++ ghcdeps ++ [ touchyPath | windowsHost ] ++ [ root -/- mingwStamp | windowsHost ] -- proxy for the entire mingw toolchain that diff --git a/hadrian/src/Rules/Program.hs b/hadrian/src/Rules/Program.hs index 09965ee64ce4..3c5e9f00d461 100644 --- a/hadrian/src/Rules/Program.hs +++ b/hadrian/src/Rules/Program.hs @@ -85,8 +85,6 @@ buildProgram bin ctx@(Context{..}) rs = do need [template] -- Custom dependencies: this should be modeled better in the -- Cabal file somehow. - when (package == ghc) $ do - need =<< ghcBinDeps stage when (package == haddock) $ do -- Haddock has a resource folder need =<< haddockDeps stage -- GitLab