[commit: ghc] wip/nfs-locking: Refactor settings predicates. (463094d)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:57:51 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/463094da9933beec44729dd96ea47430a4e9f2a0/ghc
>---------------------------------------------------------------
commit 463094da9933beec44729dd96ea47430a4e9f2a0
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Mon Jun 15 00:44:08 2015 +0100
Refactor settings predicates.
>---------------------------------------------------------------
463094da9933beec44729dd96ea47430a4e9f2a0
cfg/default.config.in | 1 -
src/Settings.hs | 10 +++++-----
src/Settings/GhcCabal.hs | 26 ++++++++++++++------------
src/Settings/GhcPkg.hs | 10 ++++++----
src/Targets.hs | 17 ++++++++---------
5 files changed, 33 insertions(+), 31 deletions(-)
diff --git a/cfg/default.config.in b/cfg/default.config.in
index 2e65688..f31af13 100644
--- a/cfg/default.config.in
+++ b/cfg/default.config.in
@@ -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:
diff --git a/src/Settings.hs b/src/Settings.hs
index a9f5cce..cde678e 100644
--- a/src/Settings.hs
+++ b/src/Settings.hs
@@ -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 ]
diff --git a/src/Settings/GhcCabal.hs b/src/Settings/GhcCabal.hs
index d0f6512..db972ac 100644
--- a/src/Settings/GhcCabal.hs
+++ b/src/Settings/GhcCabal.hs
@@ -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
diff --git a/src/Settings/GhcPkg.hs b/src/Settings/GhcPkg.hs
index b3ba6f9..0e17b02 100644
--- a/src/Settings/GhcPkg.hs
+++ b/src/Settings/GhcPkg.hs
@@ -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" ]
diff --git a/src/Targets.hs b/src/Targets.hs
index 5218909..c8aeb22 100644
--- a/src/Targets.hs
+++ b/src/Targets.hs
@@ -1,7 +1,7 @@
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/
More information about the ghc-commits
mailing list