Commit 4512f273 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Drop stringly-typed configuration keys.

parent 580d3972
......@@ -3,7 +3,6 @@ module Settings.GhcCabal (
) where
import Way
import Stage
import Builder
import Package
import Util
......@@ -36,7 +35,7 @@ cabalArgs = builder GhcCabal ? do
, configureArgs
, stage0 ? packageConstraints
, with $ Gcc stage
, notStage Stage0 ? with Ld
, notStage0 ? with Ld
, with Ar
, with Alex
, with Happy ]
......@@ -65,25 +64,25 @@ configureArgs = do
let conf key = appendSubD $ "--configure-option=" ++ key
cFlags = mconcat [ ccArgs
, remove ["-Werror"]
, argStagedConfig "conf-cc-args" ]
ldFlags = ldArgs <> argStagedConfig "conf-gcc-linker-args"
cppFlags = cppArgs <> argStagedConfig "conf-cpp-args"
, argSettingList $ ConfCcArgs stage ]
ldFlags = ldArgs <> (argSettingList $ ConfGccLinkerArgs stage)
cppFlags = cppArgs <> (argSettingList $ ConfCppArgs stage)
mconcat
[ conf "CFLAGS" cFlags
, conf "LDFLAGS" ldFlags
, conf "CPPFLAGS" cppFlags
, appendSubD "--gcc-options" $ cFlags <> ldFlags
, conf "--with-iconv-includes" $ argConfig "iconv-include-dirs"
, conf "--with-iconv-libraries" $ argConfig "iconv-lib-dirs"
, conf "--with-gmp-includes" $ argConfig "gmp-include-dirs"
, conf "--with-gmp-libraries" $ argConfig "gmp-lib-dirs"
, conf "--with-iconv-includes" $ argSettingList IconvIncludeDirs
, conf "--with-iconv-libraries" $ argSettingList IconvLibDirs
, conf "--with-gmp-includes" $ argSettingList GmpIncludeDirs
, conf "--with-gmp-libraries" $ argSettingList GmpLibDirs
-- TODO: why TargetPlatformFull and not host?
, crossCompiling ? (conf "--host" $ argConfig "target-platform-full")
, crossCompiling ? (conf "--host" $ argSetting TargetPlatformFull)
, conf "--with-cc" . argM . builderPath $ Gcc stage ]
bootPackageDbArgs :: Args
bootPackageDbArgs = do
sourcePath <- lift $ askConfig "ghc-source-path"
sourcePath <- lift . setting $ GhcSourcePath
arg $ "--package-db=" ++ sourcePath </> "libraries/bootstrapping.conf"
-- This is a positional argument, hence:
......
module Settings.Util (
-- Primitive settings elements
arg, argPath, argM,
argConfig, argStagedConfig, argConfigList, argStagedConfigList,
argSetting, argSettingList,
appendCcArgs,
needBuilder
-- argBuilderPath, argStagedBuilderPath,
......@@ -13,11 +13,11 @@ module Settings.Util (
) where
import Util
import Stage
import Builder
import Settings.User
import Oracles.Base
import Expression
import Oracles.Base
import Oracles.Setting
import Settings.User
-- A single argument.
arg :: String -> Args
......@@ -30,24 +30,11 @@ argPath = append . return . unifyPath
argM :: Action String -> Args
argM = appendM . fmap return
argConfig :: String -> Args
argConfig = appendM . fmap return . askConfig
argConfigList :: String -> Args
argConfigList = appendM . fmap words . askConfig
argSetting :: Setting -> Args
argSetting = argM . setting
stagedKey :: Stage -> String -> String
stagedKey stage key = key ++ "-stage" ++ show stage
argStagedConfig :: String -> Args
argStagedConfig key = do
stage <- asks getStage
argConfig (stagedKey stage key)
argStagedConfigList :: String -> Args
argStagedConfigList key = do
stage <- asks getStage
argConfigList (stagedKey stage key)
argSettingList :: SettingList -> Args
argSettingList = appendM . settingList
-- Pass arguments to Gcc and corresponding lists of sub-arguments of GhcCabal
appendCcArgs :: [String] -> Args
......
module Switches (
notStage, stage0, stage1, stage2,
stage0, stage1, stage2, notStage, notStage0,
registerPackage, splitObjects
) where
......@@ -9,9 +9,6 @@ import Oracles.Setting
import Expression
-- Derived predicates
notStage :: Stage -> Predicate
notStage = notP . stage
stage0 :: Predicate
stage0 = stage Stage0
......@@ -21,6 +18,12 @@ stage1 = stage Stage1
stage2 :: Predicate
stage2 = stage Stage2
notStage :: Stage -> Predicate
notStage = notP . stage
notStage0 :: Predicate
notStage0 = notP stage0
-- TODO: Actually, we don't register compiler in some circumstances -- fix.
registerPackage :: Predicate
registerPackage = return True
......
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