[commit: ghc] wip/nfs-locking: Add Quickest build flavour (d7c80c8)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 01:04:48 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/d7c80c8303b7bc4596c9d04b569c365128cfd958/ghc
>---------------------------------------------------------------
commit d7c80c8303b7bc4596c9d04b569c365128cfd958
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Mon Jun 20 03:07:24 2016 +0100
Add Quickest build flavour
See #259, #268.
>---------------------------------------------------------------
d7c80c8303b7bc4596c9d04b569c365128cfd958
hadrian.cabal | 1 +
src/CmdLineFlag.hs | 11 ++++++-----
src/Settings/Args.hs | 7 +++++--
src/Settings/Flavours/Quickest.hs | 16 ++++++++++++++++
src/Settings/Ways.hs | 7 +++++--
5 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/hadrian.cabal b/hadrian.cabal
index 5ffcb65..2b773ee 100644
--- a/hadrian.cabal
+++ b/hadrian.cabal
@@ -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
diff --git a/src/CmdLineFlag.hs b/src/CmdLineFlag.hs
index 10c39f2..df3af5b 100644
--- a/src/CmdLineFlag.hs
+++ b/src/CmdLineFlag.hs
@@ -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")
diff --git a/src/Settings/Args.hs b/src/Settings/Args.hs
index 18079a2..2ff071a 100644
--- a/src/Settings/Args.hs
+++ b/src/Settings/Args.hs
@@ -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
diff --git a/src/Settings/Flavours/Quickest.hs b/src/Settings/Flavours/Quickest.hs
new file mode 100644
index 0000000..cc1de6b
--- /dev/null
+++ b/src/Settings/Flavours/Quickest.hs
@@ -0,0 +1,16 @@
+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]
diff --git a/src/Settings/Ways.hs b/src/Settings/Ways.hs
index 79dd164..95301e1 100644
--- a/src/Settings/Ways.hs
+++ b/src/Settings/Ways.hs
@@ -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
More information about the ghc-commits
mailing list