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

Add comments. Minor refactoring.

parent 8f6fe558
...@@ -124,7 +124,7 @@ interpretDiff env = interpret env . fromDiff ...@@ -124,7 +124,7 @@ interpretDiff env = interpret env . fromDiff
(??) :: Monoid a => Predicate -> (Expr a, Expr a) -> Expr a (??) :: Monoid a => Predicate -> (Expr a, Expr a) -> Expr a
p ?? (t, f) = p ? t <> (liftM not p) ? f p ?? (t, f) = p ? t <> (liftM not p) ? f
-- Basic predicates -- Basic predicates (see Switches.hs for derived predicates)
stage :: Stage -> Predicate stage :: Stage -> Predicate
stage s = liftM (s ==) (asks getStage) stage s = liftM (s ==) (asks getStage)
...@@ -137,6 +137,7 @@ package p = liftM (p ==) (asks getPackage) ...@@ -137,6 +137,7 @@ package p = liftM (p ==) (asks getPackage)
configKeyValue :: String -> String -> Predicate configKeyValue :: String -> String -> Predicate
configKeyValue key value = liftM (value ==) (lift $ askConfig key) configKeyValue key value = liftM (value ==) (lift $ askConfig key)
-- checks if there is at least one match -- Check if there is at least one match
-- Example: configKeyValues "host-os-cpp" ["mingw32", "cygwin32"]
configKeyValues :: String -> [String] -> Predicate configKeyValues :: String -> [String] -> Predicate
configKeyValues key values = liftM (`elem` values) (lift $ askConfig key) configKeyValues key values = liftM (`elem` values) (lift $ askConfig key)
...@@ -13,7 +13,7 @@ import Rules.Package ...@@ -13,7 +13,7 @@ import Rules.Package
import Settings.Packages import Settings.Packages
-- generateTargets needs package-data.mk files of all target packages -- generateTargets needs package-data.mk files of all target packages
-- TODO: make interpret total -- TODO: make interpretDiff total
generateTargets :: Rules () generateTargets :: Rules ()
generateTargets = action $ generateTargets = action $
forM_ [Stage0 ..] $ \stage -> do forM_ [Stage0 ..] $ \stage -> do
...@@ -23,7 +23,6 @@ generateTargets = action $ ...@@ -23,7 +23,6 @@ generateTargets = action $
let dir = targetDirectory stage pkg let dir = targetDirectory stage pkg
need [pkgPath pkg </> dir </> "package-data.mk"] need [pkgPath pkg </> dir </> "package-data.mk"]
-- TODO: make interpret total
-- TODO: add Stage2 (compiler only?) -- TODO: add Stage2 (compiler only?)
packageRules :: Rules () packageRules :: Rules ()
packageRules = packageRules =
......
...@@ -12,6 +12,7 @@ import Expression hiding (when, liftIO) ...@@ -12,6 +12,7 @@ import Expression hiding (when, liftIO)
settings :: Settings settings :: Settings
settings = defaultSettings <> userSettings settings = defaultSettings <> userSettings
-- TODO: add all other settings
defaultSettings :: Settings defaultSettings :: Settings
defaultSettings = mconcat defaultSettings = mconcat
[ cabalSettings [ cabalSettings
......
...@@ -105,7 +105,7 @@ packageConstraints = do ...@@ -105,7 +105,7 @@ packageConstraints = do
++ cabal ++ "'." ++ cabal ++ "'."
args $ concatMap (\c -> ["--constraint", c]) $ constraints args $ concatMap (\c -> ["--constraint", c]) $ constraints
-- TODO: remove -- TODO: should be in a different file
ccSettings :: Settings ccSettings :: Settings
ccSettings = validating ? do ccSettings = validating ? do
let gccGe46 = liftM not gccLt46 let gccGe46 = liftM not gccLt46
......
...@@ -47,6 +47,7 @@ argStagedConfigList key = do ...@@ -47,6 +47,7 @@ argStagedConfigList key = do
stage <- asks getStage stage <- asks getStage
argConfigList (stagedKey stage key) argConfigList (stagedKey stage key)
-- Pass arguments to Gcc and corresponding lists of sub-arguments of GhcCabal
appendCcArgs :: [String] -> Settings appendCcArgs :: [String] -> Settings
appendCcArgs args = do appendCcArgs args = do
stage <- asks getStage stage <- asks getStage
...@@ -54,6 +55,10 @@ appendCcArgs args = do ...@@ -54,6 +55,10 @@ appendCcArgs args = do
, builder GhcCabal ? appendSub "--configure-option=CFLAGS" args , builder GhcCabal ? appendSub "--configure-option=CFLAGS" args
, builder GhcCabal ? appendSub "--gcc-options" args ] , builder GhcCabal ? appendSub "--gcc-options" args ]
-- packageData :: Arity -> String -> Settings -- packageData :: Arity -> String -> Settings
-- packageData arity key = -- packageData arity key =
-- return $ EnvironmentParameter $ PackageData arity key Nothing Nothing -- return $ EnvironmentParameter $ PackageData arity key Nothing Nothing
......
...@@ -12,6 +12,8 @@ module Switches ( ...@@ -12,6 +12,8 @@ module Switches (
import Base import Base
import Expression import Expression
-- TODO: This setting should be moved to UserSettings.hs
-- TODO: Define three packages for integer library instead of one in Targets.hs
-- Support for multiple integer library implementations -- Support for multiple integer library implementations
data IntegerLibraryImpl = IntegerGmp | IntegerGmp2 | IntegerSimple data IntegerLibraryImpl = IntegerGmp | IntegerGmp2 | IntegerSimple
......
...@@ -20,6 +20,7 @@ import Oracles.Builder ...@@ -20,6 +20,7 @@ import Oracles.Builder
-- * build/ : contains compiled object code -- * build/ : contains compiled object code
-- * doc/ : produced by haddock -- * doc/ : produced by haddock
-- * package-data.mk : contains output of ghc-cabal applied to pkgCabal -- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
-- TODO: This is currently not user configurable. Is this right?
targetDirectory :: Stage -> Package -> FilePath targetDirectory :: Stage -> Package -> FilePath
targetDirectory stage package targetDirectory stage package
| package == compiler = "stage" ++ show (fromEnum stage + 1) | package == compiler = "stage" ++ show (fromEnum stage + 1)
...@@ -85,14 +86,14 @@ customPackageSettings :: Settings ...@@ -85,14 +86,14 @@ customPackageSettings :: Settings
customPackageSettings = mconcat customPackageSettings = mconcat
[ package integerLibrary ? [ package integerLibrary ?
mconcat [ windowsHost ? builder GhcCabal ? mconcat [ windowsHost ? builder GhcCabal ?
append ["--configure-option=--with-intree-gmp"] arg "--configure-option=--with-intree-gmp"
, appendCcArgs ["-Ilibraries/integer-gmp2/gmp"] ] , appendCcArgs ["-Ilibraries/integer-gmp2/gmp"] ]
, package base ? , package base ?
builder GhcCabal ? append ["--flags=" ++ integerLibraryName] builder GhcCabal ? arg ("--flags=" ++ integerLibraryName)
, package ghcPrim ? , package ghcPrim ?
builder GhcCabal ? append ["--flag=include-ghc-prim"] ] builder GhcCabal ? arg "--flag=include-ghc-prim" ]
-- Note [Cabal name weirdness] -- Note [Cabal name weirdness]
-- Find out if we can move the contents to just Cabal/ -- Find out if we can move the contents to just Cabal/
......
...@@ -10,18 +10,23 @@ import Ways ...@@ -10,18 +10,23 @@ import Ways
import Targets import Targets
import Switches import Switches
import Expression import Expression
import Settings.Util
-- No user-specific settings by default -- No user-specific settings by default
userSettings :: Settings userSettings :: Settings
userSettings = mempty userSettings = mempty
-- Control conditions of which packages get to be built
-- TODO: adding *new* packages is not possible (see knownPackages in Targets.hs)
userPackages :: Packages userPackages :: Packages
userPackages = mempty userPackages = mempty
-- Control which ways are built
userWays :: Ways userWays :: Ways
userWays = mempty userWays = mempty
-- User-defined predicates -- User-defined predicates
-- TODO: migrate more predicates here from configuration files
buildHaddock :: Predicate buildHaddock :: Predicate
buildHaddock = return True buildHaddock = return True
...@@ -31,7 +36,7 @@ validating = return False ...@@ -31,7 +36,7 @@ validating = return False
-- Examples: -- Examples:
userSettings' :: Settings userSettings' :: Settings
userSettings' = mconcat userSettings' = mconcat
[ package compiler ? stage0 ? append ["foo", "bar"] [ package compiler ? stage0 ? arg "foo"
, builder (Ghc Stage0) ? remove ["-O2"] , builder (Ghc Stage0) ? remove ["-O2"]
, builder GhcCabal ? removeSub "--configure-option=CFLAGS" ["-Werror"] ] , builder GhcCabal ? removeSub "--configure-option=CFLAGS" ["-Werror"] ]
......
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