Hadrian: introduce ways to skip some documentation targets
[ghc.git] / hadrian / src / Flavour.hs
1 module Flavour
2 ( Flavour (..), werror
3 , DocTargets, DocTarget(..)
4 ) where
5
6 import Expression
7 import Data.Set (Set)
8
9 -- Please update doc/{flavours.md, user-settings.md} when changing this file.
10 -- | 'Flavour' is a collection of build settings that fully define a GHC build.
11 -- Note the following type semantics:
12 -- * @Bool@: a plain Boolean flag whose value is known at compile time.
13 -- * @Action Bool@: a flag whose value can depend on the build environment.
14 -- * @Predicate@: a flag whose value can depend on the build environment and
15 -- on the current build target.
16 data Flavour = Flavour {
17 -- | Flavour name, to select this flavour from command line.
18 name :: String,
19 -- | Use these command line arguments.
20 args :: Args,
21 -- | Build these packages.
22 packages :: Stage -> Action [Package],
23 -- | Either 'integerGmp' or 'integerSimple'.
24 integerLibrary :: Action Package,
25 -- | Build libraries these ways.
26 libraryWays :: Ways,
27 -- | Build RTS these ways.
28 rtsWays :: Ways,
29 -- | Build split objects.
30 splitObjects :: Predicate,
31 -- | Build dynamic GHC programs.
32 dynamicGhcPrograms :: Action Bool,
33 -- | Enable GHCi debugger.
34 ghciWithDebugger :: Bool,
35 -- | Build profiled GHC.
36 ghcProfiled :: Bool,
37 -- | Build GHC with debug information.
38 ghcDebugged :: Bool,
39 -- | Whether to build docs and which ones
40 -- (haddocks, user manual, haddock manual)
41 ghcDocs :: Action DocTargets }
42
43 -- | A set of documentation targets
44 type DocTargets = Set DocTarget
45
46 -- | Documentation targets
47 --
48 -- While we can't reasonably expose settings or CLI options
49 -- to selectively disable, say, base's haddocks, we can offer
50 -- a less fine-grained choice:
51 --
52 -- - haddocks for libraries
53 -- - non-haddock html pages (e.g GHC's user manual)
54 -- - PDF documents (e.g haddock's manual)
55 -- - man pages (GHC's)
56 --
57 -- The main goal being to have easy ways to do away with the need
58 -- for e.g @sphinx-build@ or @xelatex@ and associated packages
59 -- while still being able to build a(n almost) complete binary
60 -- distribution.
61 data DocTarget = Haddocks | SphinxHTML | SphinxPDFs | SphinxMan
62 deriving (Eq, Ord, Show, Bounded, Enum)
63
64 -- | Turn on -Werror for packages built with the stage1 compiler.
65 -- It mimics the CI settings so is useful to turn on when developing.
66 werror :: Flavour -> Flavour
67 werror fl = fl { args = args fl <> (builder Ghc ? notStage0 ? arg "-Werror") }