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

Add argWith.

parent 238398a8
......@@ -12,8 +12,7 @@ import Oracles.Base
import Oracles.Flag
import Oracles.Option
-- A Builder is an external command invoked in separate process
-- by calling Shake.cmd
-- A Builder is an external command invoked in separate process using Shake.cmd
--
-- Ghc Stage0 is the bootstrapping compiler
-- Ghc StageN, N > 0, is the one built on stage (N - 1)
......@@ -82,11 +81,11 @@ needBuilder builder = do
need [exe]
-- Action 'with Gcc' returns '--with-gcc=/path/to/gcc' and needs Gcc
with :: Builder -> Args
with :: Builder -> Action String
with builder = do
exe <- showArg builder
needBuilder builder
return [withBuilderKey builder ++ exe]
return $ withBuilderKey builder ++ exe
withBuilderKey :: Builder -> String
withBuilderKey builder = case builder of
......
......@@ -25,18 +25,18 @@ cabalSettings = builder GhcCabal ? do
, arg $ pkgPath pkg
, arg $ targetDirectory stage pkg
, dllSettings
, with' $ Ghc stage
, with' $ GhcPkg stage
, argWith $ Ghc stage
, argWith $ GhcPkg stage
, stage0 ? bootPackageDbSettings
, librarySettings
, configKeyNonEmpty "hscolour" ? with' HsColour -- TODO: generalise?
, configKeyNonEmpty "hscolour" ? argWith HsColour -- TODO: generalise?
, configureSettings
, stage0 ? packageConstraints
, with' $ Gcc stage
, notStage Stage0 ? with' Ld
, with' Ar
, with' Alex
, with' Happy ] -- TODO: reorder with's
, argWith $ Gcc stage
, notStage Stage0 ? argWith Ld
, argWith Ar
, argWith Alex
, argWith Happy ] -- TODO: reorder argWiths
-- TODO: Isn't vanilla always built? If yes, some conditions are redundant.
librarySettings :: Settings
......@@ -90,10 +90,6 @@ bootPackageDbSettings = do
dllSettings :: Settings
dllSettings = arg ""
-- TODO: remove
with' :: Builder -> Settings
with' builder = appendM $ with builder
packageConstraints :: Settings
packageConstraints = do
pkgs <- fromDiffExpr packages
......
......@@ -2,7 +2,7 @@
module Settings.Util (
-- Primitive settings elements
arg, argM, args,
arg, argM, args, argWith,
argConfig, argStagedConfig, argConfigList, argStagedConfigList,
ccArgs,
-- argBuilderPath, argStagedBuilderPath,
......@@ -28,6 +28,9 @@ argM = appendM . fmap return
args :: [String] -> Settings
args = append
argWith :: Builder -> Settings
argWith = argM . with
argConfig :: String -> Settings
argConfig = appendM . fmap return . askConfig
......
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