Fix putSuccess
[ghc.git] / src / Settings / User.hs
1 module Settings.User (
2 buildRootPath, trackBuildSystem, userArgs, userPackages, userLibraryWays,
3 userRtsWays, userKnownPackages, integerLibrary, buildHaddock, validating,
4 ghciWithDebugger, ghcProfiled, ghcDebugged, dynamicGhcPrograms,
5 turnWarningsIntoErrors, splitObjects, verboseCommands, putBuild, putSuccess
6 ) where
7
8 import System.Console.ANSI
9
10 import Base
11 import CmdLineFlag
12 import GHC
13 import Predicate
14 import Settings.Default
15
16 -- See doc/user-settings.md for instructions.
17
18 -- | All build results are put into 'buildRootPath' directory.
19 buildRootPath :: FilePath
20 buildRootPath = "_build"
21
22 -- | Modify default build command line arguments.
23 userArgs :: Args
24 userArgs = builder Ghc ? remove ["-Wall", "-fwarn-tabs"]
25
26 -- | Modify the set of packages that are built by default in each stage.
27 userPackages :: Packages
28 userPackages = mempty
29
30 -- | Add user defined packages. Don't forget to add them to 'userPackages' too.
31 userKnownPackages :: [Package]
32 userKnownPackages = []
33
34 -- | Choose the integer library: 'integerGmp' or 'integerSimple'.
35 integerLibrary :: Package
36 integerLibrary = integerGmp
37
38 -- FIXME: We skip 'dynamic' since it's currently broken #4.
39 -- | Modify the set of ways in which library packages are built.
40 userLibraryWays :: Ways
41 userLibraryWays = remove [dynamic]
42
43 -- | Modify the set of ways in which the 'rts' package is built.
44 userRtsWays :: Ways
45 userRtsWays = mempty
46
47 -- | User defined flags. Note the following type semantics:
48 -- * @Bool@: a plain Boolean flag whose value is known at compile time.
49 -- * @Action Bool@: a flag whose value can depend on the build environment.
50 -- * @Predicate@: a flag whose value can depend on the build environment and
51 -- on the current build target.
52
53 -- TODO: Drop 'trackBuildSystem' as it brings negligible gains.
54 -- | Set this to True if you are making any changes in the build system and want
55 -- appropriate rebuilds to be initiated. Switching this to False speeds things
56 -- up a little (particularly zero builds).
57 -- WARNING: a complete rebuild is required when changing this setting.
58 trackBuildSystem :: Bool
59 trackBuildSystem = True
60
61 -- TODO: This should be set automatically when validating.
62 validating :: Bool
63 validating = False
64
65 -- | Control when split objects are generated. Note, due to the GHC bug #11315
66 -- it is necessary to do a full clean rebuild when changing this option.
67 splitObjects :: Predicate
68 splitObjects = (return cmdSplitObjects) &&^ defaultSplitObjects
69
70 -- | Control when to build Haddock documentation.
71 buildHaddock :: Predicate
72 buildHaddock = return cmdBuildHaddock
73
74 -- TODO: Do we need to be able to set these from command line?
75 -- TODO: Turn the flags below into a simple list @ghcWays :: [Way]@?
76 dynamicGhcPrograms :: Bool
77 dynamicGhcPrograms = False
78
79 ghciWithDebugger :: Bool
80 ghciWithDebugger = False
81
82 ghcProfiled :: Bool
83 ghcProfiled = False
84
85 ghcDebugged :: Bool
86 ghcDebugged = False
87
88 -- TODO: Replace with stage2 ? arg "-Werror"? Also see #251.
89 -- | To enable -Werror in Stage2 set turnWarningsIntoErrors = stage2.
90 turnWarningsIntoErrors :: Predicate
91 turnWarningsIntoErrors = return False
92
93 -- | Set to True to print full command lines during the build process. Note,
94 -- this is a Predicate, hence you can enable verbose output only for certain
95 -- targets, e.g.: @verboseCommands = package ghcPrim@.
96 verboseCommands :: Predicate
97 verboseCommands = return False
98
99 -- | Customise build progress messages (e.g. executing a build command).
100 putBuild :: String -> Action ()
101 putBuild = putColoured Vivid White
102
103 -- | Customise build success messages (e.g. a package is built successfully).
104 putSuccess :: String -> Action ()
105 putSuccess = putColoured Vivid Green