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