summaryrefslogtreecommitdiff
path: root/hadrian/src/UserSettings.hs
diff options
context:
space:
mode:
authorAndrey Mokhov <andrey.mokhov@gmail.com>2017-11-06 22:59:38 +0000
committerAndrey Mokhov <andrey.mokhov@gmail.com>2017-11-06 22:59:38 +0000
commit5cee48036ed69ae298a599d43cf72e0fe73e3b4e (patch)
tree5fe732c738a769d02e732469f4ffecd4ac9e191a /hadrian/src/UserSettings.hs
parent275ac8ef0a0081f16abbfb8934e10cf271573768 (diff)
parent7b0b9f603bb1215e2b7af23c2404d637b95a4988 (diff)
downloadhaskell-5cee48036ed69ae298a599d43cf72e0fe73e3b4e.tar.gz
Merge commit '7b0b9f603bb1215e2b7af23c2404d637b95a4988' as 'hadrian'
Diffstat (limited to 'hadrian/src/UserSettings.hs')
-rw-r--r--hadrian/src/UserSettings.hs64
1 files changed, 64 insertions, 0 deletions
diff --git a/hadrian/src/UserSettings.hs b/hadrian/src/UserSettings.hs
new file mode 100644
index 0000000000..1b7c3f8bdd
--- /dev/null
+++ b/hadrian/src/UserSettings.hs
@@ -0,0 +1,64 @@
+-- If you want to customise your build you should copy this file from
+-- hadrian/src/UserSettings.hs to hadrian/UserSettings.hs and edit your copy.
+-- If you don't copy the file your changes will be tracked by git and you can
+-- accidentally commit them.
+module UserSettings (
+ userBuildRoot, userFlavours, userPackages, verboseCommand,
+ buildProgressColour, successColour, stage1Only
+ ) where
+
+import Hadrian.Utilities
+import System.Console.ANSI
+
+import Flavour
+import Expression
+import {-# SOURCE #-} Settings.Default
+
+-- See doc/user-settings.md for instructions.
+-- Please update doc/user-settings.md when committing changes to this file.
+
+-- | All build results are put into the 'buildRoot' directory.
+userBuildRoot :: BuildRoot
+userBuildRoot = BuildRoot "_build"
+
+-- | User-defined build flavours. See 'userFlavour' as an example.
+userFlavours :: [Flavour]
+userFlavours = [userFlavour] -- Add more build flavours if need be.
+
+-- | This is an example user-defined build flavour. Feel free to modify it and
+-- use by passing @--flavour=user@ from the command line.
+userFlavour :: Flavour
+userFlavour = defaultFlavour { name = "user" } -- Modify other settings here.
+
+-- | Add user-defined packages. Note, this only lets Hadrian know about the
+-- existence of a new package; to actually build it you need to create a new
+-- build flavour, modifying the list of packages that are built by default.
+userPackages :: [Package]
+userPackages = []
+
+-- | Set to 'True' to print full command lines during the build process. Note:
+-- this is a 'Predicate', hence you can enable verbose output only for certain
+-- targets, e.g.: @verboseCommand = package ghcPrim@.
+verboseCommand :: Predicate
+verboseCommand = do
+ verbosity <- expr getVerbosity
+ return $ verbosity >= Loud
+
+-- | Set colour for build progress messages (e.g. executing a build command).
+buildProgressColour :: BuildProgressColour
+buildProgressColour = BuildProgressColour (Dull, Magenta)
+
+-- | Set colour for success messages (e.g. a package is built successfully).
+successColour :: SuccessColour
+successColour = SuccessColour (Dull, Green)
+
+-- TODO: Set this flag from the command line.
+-- | Set this flag to 'True' to disable building Stage2 GHC (i.e. the @ghc-stage2@
+-- executable) and Stage2 utilities (such as @haddock@). Note that all Stage0
+-- and Stage1 libraries (including 'compiler') will still be built. Enabling
+-- this flag during installation leads to installing @ghc-stage1@ instead of
+-- @ghc-stage2@, and @ghc-pkg@ that was build with the Stage0 compiler.
+-- Also see Note [No stage2 packages when CrossCompiling or Stage1Only] in the
+-- top-level @ghc.mk@.
+stage1Only :: Bool
+stage1Only = False