Build mkUserGuidePart with stage-0
[hadrian.git] / src / Settings / Default.hs
1 module Settings.Default (
2 defaultBuilderArgs, defaultPackageArgs, defaultArgs, defaultPackages,
3 defaultLibraryWays, defaultRtsWays, defaultFlavour, defaultSplitObjects
4 ) where
5
6 import Base
7 import CmdLineFlag
8 import Flavour
9 import GHC
10 import Oracles.Config.Flag
11 import Oracles.Config.Setting
12 import Predicate
13 import Settings
14 import Settings.Builders.Alex
15 import Settings.Builders.Ar
16 import Settings.Builders.DeriveConstants
17 import Settings.Builders.Cc
18 import Settings.Builders.Configure
19 import Settings.Builders.GenApply
20 import Settings.Builders.GenPrimopCode
21 import Settings.Builders.Ghc
22 import Settings.Builders.GhcCabal
23 import Settings.Builders.GhcPkg
24 import Settings.Builders.Haddock
25 import Settings.Builders.Happy
26 import Settings.Builders.Hsc2Hs
27 import Settings.Builders.HsCpp
28 import Settings.Builders.Ld
29 import Settings.Builders.Make
30 import Settings.Builders.Tar
31 import Settings.Packages.Base
32 import Settings.Packages.Compiler
33 import Settings.Packages.Directory
34 import Settings.Packages.Ghc
35 import Settings.Packages.GhcCabal
36 import Settings.Packages.GhcPrim
37 import Settings.Packages.Haddock
38 import Settings.Packages.Hp2ps
39 import Settings.Packages.IntegerGmp
40 import Settings.Packages.IservBin
41 import Settings.Packages.Rts
42 import Settings.Packages.RunGhc
43 import Settings.Packages.Touchy
44 import Settings.Packages.Unlit
45 import UserSettings
46
47 -- | All 'Builder'-dependent command line arguments.
48 defaultBuilderArgs :: Args
49 defaultBuilderArgs = mconcat
50 [ alexBuilderArgs
51 , arBuilderArgs
52 , ccBuilderArgs
53 , configureBuilderArgs
54 , deriveConstantsBuilderArgs
55 , genApplyBuilderArgs
56 , genPrimopCodeBuilderArgs
57 , ghcBuilderArgs
58 , ghcCabalBuilderArgs
59 , ghcCabalHsColourBuilderArgs
60 , ghcMBuilderArgs
61 , ghcPkgBuilderArgs
62 , haddockBuilderArgs
63 , happyBuilderArgs
64 , hsc2hsBuilderArgs
65 , hsCppBuilderArgs
66 , ldBuilderArgs
67 , makeBuilderArgs
68 , tarBuilderArgs ]
69
70
71 -- | All 'Package'-dependent command line arguments.
72 defaultPackageArgs :: Args
73 defaultPackageArgs = mconcat
74 [ basePackageArgs
75 , compilerPackageArgs
76 , directoryPackageArgs
77 , ghcPackageArgs
78 , ghcCabalPackageArgs
79 , ghcPrimPackageArgs
80 , haddockPackageArgs
81 , hp2psPackageArgs
82 , integerGmpPackageArgs
83 , iservBinPackageArgs
84 , rtsPackageArgs
85 , runGhcPackageArgs
86 , touchyPackageArgs
87 , unlitPackageArgs ]
88
89 -- | All default command line arguments.
90 defaultArgs :: Args
91 defaultArgs = mconcat
92 [ defaultBuilderArgs
93 , defaultPackageArgs
94 , builder Ghc ? remove ["-Wall", "-fwarn-tabs"] ] -- TODO: Fix warning Args.
95
96 -- TODO: Simplify.
97 -- | Packages that are built by default. You can change this by editing
98 -- 'userPackages' in "UserSettings".
99 defaultPackages :: Packages
100 defaultPackages = mconcat
101 [ stage0 ? packagesStage0
102 , stage1 ? packagesStage1
103 , stage2 ? packagesStage2 ]
104
105 packagesStage0 :: Packages
106 packagesStage0 = mconcat
107 [ append [ binary, cabal, compiler, ghc, ghcBoot, ghcBootTh, ghcCabal
108 , ghcPkg, hsc2hs, hoopl, hpc, templateHaskell, transformers ]
109 -- the stage0 predicate makes sure these packages are built only in Stage0
110 , stage0 ? append [ deriveConstants, dllSplit, genapply, genprimopcode
111 , hp2ps, unlit, mkUserGuidePart ]
112 , stage0 ? windowsHost ? append [touchy]
113 , notM windowsHost ? notM iosHost ? append [terminfo] ]
114
115 packagesStage1 :: Packages
116 packagesStage1 = mconcat
117 [ packagesStage0
118 , append [ array, base, bytestring, containers, compareSizes, deepseq
119 , directory, filepath, ghci, ghcPrim, haskeline, hpcBin
120 , integerLibrary, pretty, process, rts, runGhc, time ]
121 , windowsHost ? append [win32]
122 , notM windowsHost ? append [unix]
123 , notM windowsHost ? append [iservBin]
124 , buildHaddock flavour ? append [xhtml] ]
125
126 -- TODO: Currently there is an unchecked assumption that we build only programs
127 -- in Stage2 and Stage3. Can we check this in compile time?
128 packagesStage2 :: Packages
129 packagesStage2 = mconcat
130 [ append [checkApiAnnotations, ghcTags ]
131 , buildHaddock flavour ? append [haddock] ]
132
133 -- TODO: What about profilingDynamic way? Do we need platformSupportsSharedLibs?
134 -- | Default build ways for library packages:
135 -- * We always build 'vanilla' way.
136 -- * We build 'profiling' way when stage > Stage0.
137 -- * We build 'dynamic' way when stage > Stage0 and the platform supports it.
138 defaultLibraryWays :: Ways
139 defaultLibraryWays = mconcat
140 [ append [vanilla]
141 , notStage0 ? append [profiling] ]
142 -- FIXME: Fix dynamic way and uncomment the line below, #4.
143 -- , notStage0 ? platformSupportsSharedLibs ? append [dynamic] ]
144
145 -- | Default build ways for the RTS.
146 defaultRtsWays :: Ways
147 defaultRtsWays = do
148 ways <- getLibraryWays
149 mconcat
150 [ append [ logging, debug, threaded, threadedDebug, threadedLogging ]
151 , (profiling `elem` ways) ? append [threadedProfiling]
152 , (dynamic `elem` ways) ?
153 append [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic
154 , loggingDynamic, threadedLoggingDynamic ] ]
155
156 -- | Default build flavour. Other build flavours are defined in modules
157 -- @Settings.Flavours.*@. Users can add new build flavours in "UserSettings".
158 defaultFlavour :: Flavour
159 defaultFlavour = Flavour
160 { name = "default"
161 , args = defaultArgs
162 , packages = defaultPackages
163 , libraryWays = defaultLibraryWays
164 , rtsWays = defaultRtsWays
165 , splitObjects = defaultSplitObjects
166 , buildHaddock = return cmdBuildHaddock
167 , dynamicGhcPrograms = False
168 , ghciWithDebugger = False
169 , ghcProfiled = False
170 , ghcDebugged = False }
171
172 -- | Default condition for building split objects.
173 defaultSplitObjects :: Predicate
174 defaultSplitObjects = do
175 goodStage <- notStage0 -- We don't split bootstrap (stage 0) packages
176 pkg <- getPackage
177 supported <- lift supportsSplitObjects
178 let goodPackage = isLibrary pkg && pkg /= compiler && pkg /= rts
179 return $ cmdSplitObjects && goodStage && goodPackage && supported