diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-05-25 16:22:35 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-05-31 08:35:17 -0400 |
commit | 5c4421b1a2d45edfc31f2d37c8b4a47c619a424b (patch) | |
tree | 345186479e2cc75c314cb02ee4cca3f49fa3e100 /hadrian/src/Rules.hs | |
parent | 83467435c4ea81daa7b97ed5d914f543f9e885a3 (diff) | |
download | haskell-5c4421b1a2d45edfc31f2d37c8b4a47c619a424b.tar.gz |
hadrian: Introduce new package database for executables needed to build stage0
These executables (such as hsc2hs) are built using the boot compiler and
crucially, most libraries from the global package database.
We also move other build-time executables to be built in this stage such
as linters which also cleans up which libraries end up in the global
package database. This allows us to remove hacks where linters-common is
removed from the package database when a bindist is created.
This fixes issues caused by infinite recursion due to bytestring adding
a dependency on template-haskell.
Fixes #21634
Diffstat (limited to 'hadrian/src/Rules.hs')
-rw-r--r-- | hadrian/src/Rules.hs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/hadrian/src/Rules.hs b/hadrian/src/Rules.hs index 521c0ac154..9b432b8966 100644 --- a/hadrian/src/Rules.hs +++ b/hadrian/src/Rules.hs @@ -32,16 +32,12 @@ import Settings.Program (programContext) import Target import UserSettings - -allStages :: [Stage] -allStages = [minBound .. maxBound] - -- | This rule calls 'need' on all top-level build targets that Hadrian builds -- by default, respecting the 'finalStage' flag. topLevelTargets :: Rules () topLevelTargets = action $ do verbosity <- getVerbosity - forM_ [ Stage1 ..] $ \stage -> do + forM_ [ Stage1, Stage2, Stage3] $ \stage -> do when (verbosity >= Verbose) $ do (libraries, programs) <- partition isLibrary <$> stagePackages stage libNames <- mapM (name stage) libraries @@ -52,14 +48,14 @@ topLevelTargets = action $ do putInfo . unlines $ [ stageHeader "libraries" libNames , stageHeader "programs" pgmNames ] - let buildStages = [ s | s <- [Stage0 ..], s < finalStage ] + let buildStages = [ s | s <- allStages, s < finalStage ] targets <- concatForM buildStages $ \stage -> do packages <- stagePackages stage mapM (path stage) packages -- Why we need wrappers: https://gitlab.haskell.org/ghc/ghc/issues/16534. root <- buildRoot - let wrappers = [ root -/- ("ghc-" ++ stageString s) | s <- [Stage1 ..] + let wrappers = [ root -/- ("ghc-" ++ stageString s) | s <- [Stage1, Stage2, Stage3] , s < finalStage ] need (targets ++ wrappers) where @@ -117,7 +113,7 @@ packageRules = do Rules.Program.buildProgramRules readPackageDb Rules.Register.configurePackageRules - forM_ [Stage0 ..] (Rules.Register.registerPackageRules writePackageDb) + forM_ allStages (Rules.Register.registerPackageRules writePackageDb) -- TODO: Can we get rid of this enumeration of contexts? Since we iterate -- over it to generate all 4 types of rules below, all the time, we |