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

Add development flavours

See #188, #268
parent 1774b40d
......@@ -85,6 +85,7 @@ executable hadrian
, Settings.Builders.Make
, Settings.Builders.Tar
, Settings.Default
, Settings.Flavours.Development
, Settings.Flavours.Perf
, Settings.Flavours.Prof
, Settings.Flavours.Quick
......
......@@ -38,7 +38,7 @@ readBuildHaddock :: Either String (Untracked -> Untracked)
readBuildHaddock = Right $ \flags -> flags { buildHaddock = True }
readFlavour :: Maybe String -> Either String (Untracked -> Untracked)
readFlavour ms = Right $ \flags -> flags { flavour = ms }
readFlavour ms = Right $ \flags -> flags { flavour = lower <$> ms }
readProgressColour :: Maybe String -> Either String (Untracked -> Untracked)
readProgressColour ms =
......@@ -74,7 +74,7 @@ readSplitObjects = Right $ \flags -> flags { splitObjects = True }
cmdFlags :: [OptDescr (Either String (Untracked -> Untracked))]
cmdFlags =
[ Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
"Build flavour (default, quick or quickest)."
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["haddock"] (NoArg readBuildHaddock)
"Generate Haddock documentation."
, Option [] ["progress-colour"] (OptArg readProgressColour "MODE")
......
......@@ -15,6 +15,7 @@ import GHC
import Oracles.PackageData
import Oracles.Path
import {-# SOURCE #-} Settings.Default
import Settings.Flavours.Development
import Settings.Flavours.Perf
import Settings.Flavours.Prof
import Settings.Flavours.Quick
......@@ -53,8 +54,9 @@ getPkgDataList :: (FilePath -> PackageDataList) -> Expr [String]
getPkgDataList key = lift . pkgDataList . key =<< getBuildPath
hadrianFlavours :: [Flavour]
hadrianFlavours = [ defaultFlavour, perfFlavour, profFlavour, quickFlavour
, quickestFlavour ]
hadrianFlavours =
[ defaultFlavour, developmentFlavour Stage1, developmentFlavour Stage2
, perfFlavour, profFlavour, quickFlavour, quickestFlavour ]
flavour :: Flavour
flavour = fromMaybe unknownFlavour $ find ((== flavourName) . name) flavours
......
......@@ -9,9 +9,6 @@ ghcBuilderArgs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do
needTouchy
mconcat [ arg "-Wall"
, commonGhcArgs
, arg "-H32m"
, stage0 ? arg "-O"
, notStage0 ? arg "-O2"
, splitObjectsArgs
, ghcLinkArgs
, builder (Ghc CompileHs) ? arg "-c"
......
......@@ -40,7 +40,10 @@ import Settings.Packages.RunGhc
-- | All default command line arguments.
defaultArgs :: Args
defaultArgs = defaultBuilderArgs <> defaultPackageArgs
defaultArgs = mconcat
[ defaultBuilderArgs
, builder Ghc ? mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2", arg "-H32m"]
, defaultPackageArgs ]
-- | Packages that are built by default. You can change this by editing
-- 'userPackages' in "UserSettings".
......
module Settings.Flavours.Development (developmentFlavour) where
import Flavour
import GHC
import Predicate
import {-# SOURCE #-} Settings.Default
-- TODO: Implement an equivalent of LAX_DEPENDENCIES = YES setting, see #250.
developmentFlavour :: Stage -> Flavour
developmentFlavour ghcStage = defaultFlavour
{ name = "devel" ++ show (fromEnum ghcStage)
, args = developmentArgs ghcStage
, libraryWays = append [vanilla] }
developmentArgs :: Stage -> Args
developmentArgs ghcStage = do
stage <- getStage
pkg <- getPackage
let now = succ stage == ghcStage
mconcat [ defaultBuilderArgs
, builder Ghc ? mconcat
[ append ["-O", "-H64m"]
, now ? pkg == compiler ? append ["-O0", "-DDEBUG", "-dcore-lint"]
, now ? pkg == ghc ? append ["-O0", "-DDEBUG"]
, notStage0 ? isLibrary pkg ? arg "-dcore-lint" ]
, defaultPackageArgs ]
Markdown is supported
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