Move integerLibrary to flavour
[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.GenPrimopCode
20 import Settings.Builders.Ghc
21 import Settings.Builders.GhcCabal
22 import Settings.Builders.GhcPkg
23 import Settings.Builders.Haddock
24 import Settings.Builders.Happy
25 import Settings.Builders.Hsc2Hs
26 import Settings.Builders.HsCpp
27 import Settings.Builders.Ld
28 import Settings.Builders.Make
29 import Settings.Builders.Tar
30 import Settings.Packages.Base
31 import Settings.Packages.Compiler
32 import Settings.Packages.Ghc
33 import Settings.Packages.GhcCabal
34 import Settings.Packages.Ghci
35 import Settings.Packages.GhcPrim
36 import Settings.Packages.Haddock
37 import Settings.Packages.IntegerGmp
38 import Settings.Packages.Rts
39 import Settings.Packages.RunGhc
40
41 -- | All default command line arguments.
42 defaultArgs :: Args
43 defaultArgs = defaultBuilderArgs <> defaultPackageArgs
44
45 -- | Packages that are built by default. You can change this by editing
46 -- 'userPackages' in "UserSettings".
47 defaultPackages :: Packages
48 defaultPackages = mconcat [ stage0 ? stage0Packages
49 , stage1 ? stage1Packages
50 , stage2 ? stage2Packages ]
51
52 stage0Packages :: Packages
53 stage0Packages = do
54 win <- lift windowsHost
55 ios <- lift iosHost
56 append $ [ binary
57 , cabal
58 , compiler
59 , deriveConstants
60 , dllSplit
61 , genapply
62 , genprimopcode
63 , ghc
64 , ghcBoot
65 , ghcBootTh
66 , ghcCabal
67 , ghci
68 , ghcPkg
69 , hsc2hs
70 , hoopl
71 , hp2ps
72 , hpc
73 , mkUserGuidePart
74 , templateHaskell
75 , transformers
76 , unlit ] ++
77 [ terminfo | not win, not ios ] ++
78 [ touchy | win ]
79
80 stage1Packages :: Packages
81 stage1Packages = do
82 win <- lift windowsHost
83 doc <- buildHaddock flavour
84 mconcat [ stage0Packages
85 , apply (filter isLibrary) -- Build all Stage0 libraries in Stage1
86 , append $ [ array
87 , base
88 , bytestring
89 , compact
90 , compareSizes
91 , containers
92 , deepseq
93 , directory
94 , filepath
95 , ghc
96 , ghcCabal
97 , ghci
98 , ghcPrim
99 , haskeline
100 , hpcBin
101 , hsc2hs
102 , integerLibrary flavour
103 , pretty
104 , process
105 , rts
106 , runGhc
107 , time ] ++
108 [ iservBin | not win ] ++
109 [ unix | not win ] ++
110 [ win32 | win ] ++
111 [ xhtml | doc ] ]
112
113 stage2Packages :: Packages
114 stage2Packages = do
115 doc <- buildHaddock flavour
116 append $ [ checkApiAnnotations
117 , ghcTags ] ++
118 [ haddock | doc ]
119
120 -- | Default build ways for library packages:
121 -- * We always build 'vanilla' way.
122 -- * We build 'profiling' way when stage > Stage0.
123 -- * We build 'dynamic' way when stage > Stage0 and the platform supports it.
124 defaultLibraryWays :: Ways
125 defaultLibraryWays = mconcat
126 [ append [vanilla]
127 , notStage0 ? append [profiling] ]
128 -- FIXME: Fix dynamic way and uncomment the line below, #4.
129 -- , notStage0 ? platformSupportsSharedLibs ? append [dynamic] ]
130
131 -- | Default build ways for the RTS.
132 defaultRtsWays :: Ways
133 defaultRtsWays = do
134 ways <- getLibraryWays
135 mconcat
136 [ append [ logging, debug, threaded, threadedDebug, threadedLogging ]
137 , (profiling `elem` ways) ? append [threadedProfiling]
138 , (dynamic `elem` ways) ?
139 append [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic
140 , loggingDynamic, threadedLoggingDynamic ] ]
141
142 -- | Default build flavour. Other build flavours are defined in modules
143 -- @Settings.Flavours.*@. Users can add new build flavours in "UserSettings".
144 defaultFlavour :: Flavour
145 defaultFlavour = Flavour
146 { name = "default"
147 , args = defaultArgs
148 , packages = defaultPackages
149 , integerLibrary = integerGmp
150 , libraryWays = defaultLibraryWays
151 , rtsWays = defaultRtsWays
152 , splitObjects = defaultSplitObjects
153 , buildHaddock = return cmdBuildHaddock
154 , dynamicGhcPrograms = False
155 , ghciWithDebugger = False
156 , ghcProfiled = False
157 , ghcDebugged = False }
158
159 -- | Default condition for building split objects.
160 defaultSplitObjects :: Predicate
161 defaultSplitObjects = do
162 goodStage <- notStage0 -- We don't split bootstrap (stage 0) packages
163 pkg <- getPackage
164 supported <- lift supportsSplitObjects
165 let goodPackage = isLibrary pkg && pkg /= compiler && pkg /= rts
166 return $ cmdSplitObjects && goodStage && goodPackage && supported
167
168 -- | All 'Builder'-dependent command line arguments.
169 defaultBuilderArgs :: Args
170 defaultBuilderArgs = mconcat
171 [ alexBuilderArgs
172 , arBuilderArgs
173 , ccBuilderArgs
174 , configureBuilderArgs
175 , deriveConstantsBuilderArgs
176 , genPrimopCodeBuilderArgs
177 , ghcBuilderArgs
178 , ghcCabalBuilderArgs
179 , ghcCabalHsColourBuilderArgs
180 , ghcMBuilderArgs
181 , ghcPkgBuilderArgs
182 , haddockBuilderArgs
183 , happyBuilderArgs
184 , hsc2hsBuilderArgs
185 , hsCppBuilderArgs
186 , ldBuilderArgs
187 , makeBuilderArgs
188 , tarBuilderArgs ]
189
190 -- | All 'Package'-dependent command line arguments.
191 defaultPackageArgs :: Args
192 defaultPackageArgs = mconcat
193 [ basePackageArgs
194 , compilerPackageArgs
195 , ghcPackageArgs
196 , ghcCabalPackageArgs
197 , ghciPackageArgs
198 , ghcPrimPackageArgs
199 , haddockPackageArgs
200 , integerGmpPackageArgs
201 , rtsPackageArgs
202 , runGhcPackageArgs ]