Commit d7c80c83 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add Quickest build flavour

See #259, #268.
parent 1ff9eadb
......@@ -88,6 +88,7 @@ executable hadrian
, Settings.Builders.Tar
, Settings.Default
, Settings.Flavours.Quick
, Settings.Flavours.Quickest
, Settings.Packages
, Settings.Packages.Base
, Settings.Packages.Compiler
......
......@@ -21,7 +21,7 @@ data Untracked = Untracked
, splitObjects :: Bool }
deriving (Eq, Show)
data Flavour = Default | Quick deriving (Eq, Show)
data Flavour = Default | Quick | Quickest deriving (Eq, Show)
data ProgressColour = Never | Auto | Always deriving (Eq, Show)
data ProgressInfo = None | Brief | Normal | Unicorn deriving (Eq, Show)
......@@ -43,9 +43,10 @@ readFlavour ms =
maybe (Left "Cannot parse flavour") (Right . set) (go =<< lower <$> ms)
where
go :: String -> Maybe Flavour
go "default" = Just Default
go "quick" = Just Quick
go _ = Nothing
go "default" = Just Default
go "quick" = Just Quick
go "quickest" = Just Quickest
go _ = Nothing
set :: Flavour -> Untracked -> Untracked
set flag flags = flags { flavour = flag }
......@@ -83,7 +84,7 @@ readSplitObjects = Right $ \flags -> flags { splitObjects = True }
cmdFlags :: [OptDescr (Either String (Untracked -> Untracked))]
cmdFlags =
[ Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
"Build flavour (Default or Quick)."
"Build flavour (Default, Quick or Quickest)."
, Option [] ["haddock"] (NoArg readBuildHaddock)
"Generate Haddock documentation."
, Option [] ["progress-colour"] (OptArg readProgressColour "MODE")
......
......@@ -20,6 +20,7 @@ import Settings.Builders.Ld
import Settings.Builders.Make
import Settings.Builders.Tar
import Settings.Flavours.Quick
import Settings.Flavours.Quickest
import Settings.Packages.Base
import Settings.Packages.Compiler
import Settings.Packages.Directory
......@@ -88,5 +89,7 @@ defaultPackageArgs = mconcat
, unlitPackageArgs ]
flavourArgs :: Args
flavourArgs = mconcat
[ cmdFlavour == Quick ? quickFlavourArgs ]
flavourArgs = case cmdFlavour of
Default -> mempty
Quick -> quickFlavourArgs
Quickest -> quickestFlavourArgs
module Settings.Flavours.Quickest (quickestFlavourArgs, quickestFlavourWays) where
import Context
import GHC
import Predicate
optimise :: Context -> Bool
optimise Context {..} = stage == Stage0 && package `elem` [compiler, ghc]
quickestFlavourArgs :: Args
quickestFlavourArgs = builder Ghc ? do
context <- getContext
if optimise context then arg "-O" else arg "-O0"
quickestFlavourWays :: Ways
quickestFlavourWays = remove [profiling]
......@@ -5,6 +5,7 @@ import CmdLineFlag
import Oracles.Config.Flag
import Predicate
import Settings.Flavours.Quick
import Settings.Flavours.Quickest
import UserSettings
-- | Combine default library ways with user modifications.
......@@ -29,8 +30,10 @@ defaultLibraryWays = mconcat
, notStage0 ? platformSupportsSharedLibs ? append [dynamic] ]
flavourLibraryWays :: Ways
flavourLibraryWays = mconcat
[ cmdFlavour == Quick ? quickFlavourWays ]
flavourLibraryWays = case cmdFlavour of
Default -> mempty
Quick -> quickFlavourWays
Quickest -> quickestFlavourWays
defaultRtsWays :: Ways
defaultRtsWays = do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment