Commit 463094da authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Refactor settings predicates.

parent b67db18e
......@@ -38,7 +38,6 @@ supports-package-key = @SUPPORTS_PACKAGE_KEY@
solaris-broken-shld = @SOLARIS_BROKEN_SHLD@
split-objects-broken = @SplitObjsBroken@
ghc-unregisterised = @Unregisterised@
validating = NO
ghc-source-path = @hardtop@
# Information about host and target systems:
......
......@@ -2,8 +2,8 @@ module Settings (
settings
) where
import Targets
import Base hiding (arg, args)
import Oracles.Builder
import Settings.GhcPkg
import Settings.GhcCabal
import UserSettings
......@@ -13,7 +13,7 @@ settings :: Settings
settings = defaultSettings <> userSettings
defaultSettings :: Settings
defaultSettings = do
stage <- asks getStage
mconcat [ builder GhcCabal ? cabalSettings
, builder (GhcPkg stage) ? ghcPkgSettings ]
defaultSettings = mconcat
[ cabalSettings
, ghcPkgSettings
, customPackageSettings ]
......@@ -17,7 +17,7 @@ import Settings.Packages
import UserSettings
cabalSettings :: Settings
cabalSettings = do
cabalSettings = builder GhcCabal ? do
stage <- asks getStage
pkg <- asks getPackage
mconcat [ arg "configure"
......@@ -26,7 +26,6 @@ cabalSettings = do
, dllSettings
, with' $ Ghc stage
, with' $ GhcPkg stage
, customConfigureSettings
, stage0 ? bootPackageDbSettings
, librarySettings
, configKeyNonEmpty "hscolour" ? with' HsColour -- TODO: generalise?
......@@ -59,14 +58,18 @@ librarySettings = do
configureSettings :: Settings
configureSettings = do
let conf key = appendSubD $ "--configure-option=" ++ key
ccSettings' = ccSettings <> remove ["-Werror"]
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" ccSettings'
, conf "LDFLAGS" ldSettings
, conf "CPPFLAGS" cppSettings
, appendSubD "--gcc-options" $ ccSettings' <> ldSettings
[ 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"
......@@ -106,9 +109,8 @@ ccSettings = do
let gccGe46 = liftM not gccLt46
mconcat
[ package integerLibrary ? arg "-Ilibraries/integer-gmp2/gmp"
, builder GhcCabal ? argStagedConfig "conf-cc-args"
, validating ? mconcat
[ notBuilder GhcCabal ? arg "-Werror"
[ arg "-Werror"
, arg "-Wall"
, gccIsClang ??
( arg "-Wno-unknown-pragmas" <>
......@@ -117,7 +119,7 @@ ccSettings = do
]
ldSettings :: Settings
ldSettings = builder GhcCabal ? argStagedConfig "conf-gcc-linker-args"
ldSettings = mempty
cppSettings :: Settings
cppSettings = builder GhcCabal ? argStagedConfig "conf-cpp-args"
cppSettings = mempty
......@@ -8,6 +8,7 @@ import Targets
import Switches
import Expression hiding (when, liftIO)
import Settings.Util
import Oracles.Builder
import Settings.GhcCabal
ghcPkgSettings :: Settings
......@@ -15,7 +16,8 @@ ghcPkgSettings = do
pkg <- asks getPackage
stage <- asks getStage
let dir = pkgPath pkg </> targetDirectory stage pkg
mconcat [ arg "update"
, arg "--force"
, stage0 ? bootPackageDbSettings
, arg $ dir </> "inplace-pkg-config" ]
builder (GhcPkg stage) ? mconcat
[ arg "update"
, arg "--force"
, stage0 ? bootPackageDbSettings
, arg $ dir </> "inplace-pkg-config" ]
module Targets (
targetDirectory,
knownPackages,
customConfigureSettings,
customPackageSettings,
array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
deepseq, directory, filepath, ghcPrim, haskeline, hoopl, hpc,
integerLibrary, parallel, pretty, primitive, process, stm, templateHaskell,
......@@ -12,6 +12,7 @@ import Base hiding (arg, args)
import Package
import Switches
import Expression
import Oracles.Builder
-- Build results will be placed into a target directory with the following
-- typical structure:
......@@ -79,15 +80,13 @@ integerLibraryCabal = case integerLibraryImpl of
IntegerGmp2 -> "integer-gmp.cabal" -- Indeed, why make life easier?
IntegerSimple -> "integer-simple.cabal"
-- Custom configure settings for packages
-- TODO: check if '--flag' and '--flags' should be collections of
-- sub-arguments or not.
customConfigureSettings :: Settings
customConfigureSettings = mconcat
-- Custom package settings for packages
customPackageSettings :: Settings
customPackageSettings = builder GhcCabal ? mconcat
[ package integerLibrary ?
windowsHost ? appendSub "--configure-option" ["--with-intree-gmp"]
, package base ? appendSub "--flags" [integerLibraryName]
, package ghcPrim ? appendSub "--flag" ["include-ghc-prim"] ]
windowsHost ? append ["--configure-option=--with-intree-gmp"]
, package base ? append ["--flags=" ++ integerLibraryName]
, package ghcPrim ? 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