summaryrefslogtreecommitdiff
path: root/hadrian/src/Expression.hs
diff options
context:
space:
mode:
authorTravis Whitaker <pi.boy.travis@gmail.com>2020-05-06 04:14:47 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-29 13:34:48 -0400
commit67738db10010fd28a8e997b5c8f83ea591b88a0e (patch)
tree92e283a33006eca3888019c744f5d1b5ed34cddb /hadrian/src/Expression.hs
parentf9a513e064bd8a33ad6f8aa5fb8673931507eca1 (diff)
downloadhaskell-67738db10010fd28a8e997b5c8f83ea591b88a0e.tar.gz
Build a threaded stage 1 if the bootstrapping GHC supports it.
Diffstat (limited to 'hadrian/src/Expression.hs')
-rw-r--r--hadrian/src/Expression.hs26
1 files changed, 24 insertions, 2 deletions
diff --git a/hadrian/src/Expression.hs b/hadrian/src/Expression.hs
index 197827a5f0..d0b166fdaa 100644
--- a/hadrian/src/Expression.hs
+++ b/hadrian/src/Expression.hs
@@ -6,8 +6,9 @@ module Expression (
expr, exprIO, arg, remove,
-- ** Predicates
- (?), stage, stage0, stage1, stage2, notStage0, package, notPackage,
- packageOneOf, libraryPackage, builder, way, input, inputs, output, outputs,
+ (?), stage, stage0, stage1, stage2, notStage0, threadedBootstrapper,
+ package, notPackage, packageOneOf, libraryPackage, builder, way, input,
+ inputs, output, outputs,
-- ** Evaluation
interpret, interpretInContext,
@@ -26,6 +27,7 @@ import Base
import Builder
import Context hiding (stage, package, way)
import Expression.Type
+import Oracles.Flag
import Hadrian.Expression hiding (Expr, Predicate, Args)
import Hadrian.Haskell.Cabal.Type
import Hadrian.Oracles.Cabal
@@ -86,6 +88,19 @@ instance BuilderPredicate a => BuilderPredicate (FilePath -> a) where
way :: Way -> Predicate
way w = (w ==) <$> getWay
+{-
+Note [Stage Names]
+~~~~~~~~~~~~~~~~~~
+
+Code referring to specific stages can be a bit tricky. In Hadrian, the stages
+have the same names they carried in the autoconf build system, but they are
+often referred to by the stage used to construct them. For example, the stage 1
+artifacts will be placed in _build/stage0, because they are constructed by the
+stage 0 compiler. The stage predicates in this module behave the same way,
+'stage0' will return 'True' while stage 0 is being used to build the stage 1
+compiler.
+-}
+
-- | Is the build currently in stage 0?
stage0 :: Predicate
stage0 = stage Stage0
@@ -102,6 +117,13 @@ stage2 = stage Stage2
notStage0 :: Predicate
notStage0 = notM stage0
+-- | Whether or not the bootstrapping compiler provides a threaded RTS. We need
+-- to know this when building stage 1, since stage 1 links against the
+-- compiler's RTS ways. See Note [Linking ghc-bin against threaded stage0 RTS]
+-- in Settings.Packages for details.
+threadedBootstrapper :: Predicate
+threadedBootstrapper = expr (flag BootstrapThreadedRts)
+
-- | Is a certain package /not/ built right now?
notPackage :: Package -> Predicate
notPackage = notM . package