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

Implement appendCcArgs abstraction for passing arguments both to Gcc and GhcCabal.

parent 463094da
......@@ -58,13 +58,13 @@ librarySettings = do
configureSettings :: Settings
configureSettings = do
stage <- asks getStage
let conf key = appendSubD $ "--configure-option=" ++ key
cFlags = mconcat [ ccSettings
, remove ["-Werror"]
, argStagedConfig "conf-cc-args" ]
ldFlags = ldSettings <> argStagedConfig "conf-gcc-linker-args"
cppFlags = cppSettings <> argStagedConfig "conf-cpp-args"
stage <- asks getStage
mconcat
[ conf "CFLAGS" cFlags
, conf "LDFLAGS" ldFlags
......@@ -86,6 +86,7 @@ bootPackageDbSettings = do
dllSettings :: Settings
dllSettings = arg ""
-- TODO: remove
with' :: Builder -> Settings
with' builder = appendM $ with builder
......@@ -104,19 +105,16 @@ packageConstraints = do
++ cabal ++ "'."
args $ concatMap (\c -> ["--constraint", c]) $ constraints
-- TODO: remove
ccSettings :: Settings
ccSettings = do
ccSettings = validating ? do
let gccGe46 = liftM not gccLt46
mconcat
[ package integerLibrary ? arg "-Ilibraries/integer-gmp2/gmp"
, validating ? mconcat
[ arg "-Werror"
mconcat [ arg "-Werror"
, arg "-Wall"
, gccIsClang ??
( arg "-Wno-unknown-pragmas" <>
gccGe46 ? windowsHost ? arg "-Werror=unused-but-set-variable"
, gccGe46 ? arg "-Wno-error=inline" )]
]
ldSettings :: Settings
ldSettings = mempty
......
......@@ -4,6 +4,7 @@ module Settings.Util (
-- Primitive settings elements
arg, argM, args,
argConfig, argStagedConfig, argConfigList, argStagedConfigList,
appendCcArgs,
-- argBuilderPath, argStagedBuilderPath,
-- argPackageKey, argPackageDeps, argPackageDepKeys, argSrcDirs,
-- argIncludeDirs, argDepIncludeDirs,
......@@ -46,6 +47,13 @@ argStagedConfigList key = do
stage <- asks getStage
argConfigList (stagedKey stage key)
appendCcArgs :: [String] -> Settings
appendCcArgs args = do
stage <- asks getStage
mconcat [ builder (Gcc stage) ? append args
, builder GhcCabal ? appendSub "--configure-option=CFLAGS" args
, builder GhcCabal ? appendSub "--gcc-options" args ]
-- packageData :: Arity -> String -> Settings
-- packageData arity key =
-- return $ EnvironmentParameter $ PackageData arity key Nothing Nothing
......
module Switches (
IntegerLibraryImpl (..), integerLibraryImpl,
notStage, stage0, stage1, stage2, notBuilder,
notStage, stage0, stage1, stage2, builders, notBuilder,
supportsPackageKey, targetPlatforms, targetPlatform,
targetOss, targetOs, notTargetOs,
targetArchs, dynamicGhcPrograms, ghcWithInterpreter,
......@@ -31,6 +31,9 @@ stage1 = stage Stage1
stage2 :: Predicate
stage2 = stage Stage2
builders :: [Builder] -> Predicate
builders = liftM or . sequence . map builder
notBuilder :: Builder -> Predicate
notBuilder = liftM not . builder
......
......@@ -12,6 +12,7 @@ import Base hiding (arg, args)
import Package
import Switches
import Expression
import Settings.Util
import Oracles.Builder
-- Build results will be placed into a target directory with the following
......@@ -80,13 +81,18 @@ integerLibraryCabal = case integerLibraryImpl of
IntegerGmp2 -> "integer-gmp.cabal" -- Indeed, why make life easier?
IntegerSimple -> "integer-simple.cabal"
-- Custom package settings for packages
customPackageSettings :: Settings
customPackageSettings = builder GhcCabal ? mconcat
customPackageSettings = mconcat
[ package integerLibrary ?
windowsHost ? append ["--configure-option=--with-intree-gmp"]
, package base ? append ["--flags=" ++ integerLibraryName]
, package ghcPrim ? append ["--flag=include-ghc-prim"] ]
mconcat [ windowsHost ? builder GhcCabal ?
append ["--configure-option=--with-intree-gmp"]
, appendCcArgs ["-Ilibraries/integer-gmp2/gmp"] ]
, package base ?
builder GhcCabal ? append ["--flags=" ++ integerLibraryName]
, package ghcPrim ?
builder GhcCabal ? append ["--flag=include-ghc-prim"] ]
-- Note [Cabal name weirdness]
-- Find out if we can move the contents to just Cabal/
......
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