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

Move Settings/Default.hs to GHC.hs, add Settings.hs.

parent d4a438fb
module Settings.Default (
defaultTargetDirectory, defaultKnownPackages,
module GHC (
array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
deepseq, directory, filepath, ghcPrim, haskeline, hoopl, hpc, integerGmp,
integerSimple, parallel, pretty, primitive, process, stm, templateHaskell,
terminfo, time, transformers, unix, win32, xhtml
terminfo, time, transformers, unix, win32, xhtml,
defaultKnownPackages, defaultTargetDirectory
) where
import Stage
import Package
-- Build results will be placed into a target directory with the following
-- typical structure:
-- * build/ : contains compiled object code
-- * doc/ : produced by haddock
-- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
defaultTargetDirectory :: Stage -> Package -> FilePath
defaultTargetDirectory stage package
| package == compiler = "stage" ++ show (fromEnum stage + 1)
| stage == Stage0 = "dist-boot"
| otherwise = "dist-install"
-- These are all packages we know about. Build rules will be generated for
-- all of them. However, not all of these packages will be built. For example,
-- package 'win32' is built only on Windows.
-- Settings/Packages.hs defines default conditions for building each package,
-- which can be overridden in UserSettings.hs.
-- which can be overridden in Settings/User.hs.
defaultKnownPackages :: [Package]
defaultKnownPackages =
[ array, base, binPackageDb, binary, bytestring, cabal, compiler
......@@ -68,3 +57,14 @@ transformers = library "transformers"
unix = library "unix"
win32 = library "Win32"
xhtml = library "xhtml"
-- Build results will be placed into a target directory with the following
-- typical structure:
-- * build/ : contains compiled object code
-- * doc/ : produced by haddock
-- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
defaultTargetDirectory :: Stage -> Package -> FilePath
defaultTargetDirectory stage package
| package == compiler = "stage" ++ show (fromEnum stage + 1)
| stage == Stage0 = "dist-boot"
| otherwise = "dist-install"
......@@ -7,8 +7,8 @@ module Oracles.ArgsHash (
import Base
import Target
import Expression
import Settings
import Settings.Args
import Settings.User
newtype ArgsHashKey = ArgsHashKey Target
deriving (Show, Eq, Typeable, Binary, Hashable, NFData)
......
......@@ -6,8 +6,8 @@ module Predicates (
import Base
import Expression
import GHC
import Oracles
import Settings.Default
-- Basic predicates (see Switches.hs for derived predicates)
stage :: Stage -> Predicate
......
......@@ -8,8 +8,8 @@ import Builder
import Expression
import Oracles
import Oracles.ArgsHash
import Settings
import Settings.Args
import Settings.User
import Settings.Builders.Ar
-- Build a given target using an appropriate builder and acquiring necessary
......
......@@ -4,7 +4,7 @@ import Base
import Stage
import Package hiding (library)
import Expression
import Settings.Packages
import Settings
import Data.Version
import Distribution.Package
import Distribution.Verbosity
......
......@@ -6,7 +6,7 @@ import Util
import Builder
import Target (PartialTarget (..), fullTarget, fullTargetWithWay)
import Oracles.Dependencies
import Settings.TargetDirectory
import Settings
import Rules.Actions
import Rules.Resources
......
......@@ -7,9 +7,8 @@ import Package
import Builder
import Expression
import Predicates (registerPackage)
import Oracles.PackageDeps
import Settings.Packages
import Settings.TargetDirectory
import Oracles
import Settings
import Rules.Actions
import Rules.Resources
......@@ -62,8 +61,8 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
-- Reason: Shake's built-in makefile parser doesn't recognise slashes
postProcessPackageData :: FilePath -> Action ()
postProcessPackageData file = do
pkgData <- fmap (filter ('$' `notElem`) . lines) . liftIO $ readFile file
length pkgData `seq` writeFileLines file $ map processLine pkgData
contents <- fmap (filter ('$' `notElem`) . lines) . liftIO $ readFile file
length contents `seq` writeFileLines file $ map processLine contents
where
processLine line = replaceSeparators '_' prefix ++ suffix
where
......
......@@ -7,7 +7,7 @@ import Package
import Expression
import Target (PartialTarget (..), fullTarget)
import Oracles.PackageData
import Settings.Util
import Settings
import Rules.Actions
import Rules.Resources
......
......@@ -8,12 +8,9 @@ import Package
import Expression
import Oracles.PackageData
import Target (PartialTarget (..), fullTarget, fullTargetWithWay)
import Settings.TargetDirectory
import Rules.Actions
import Rules.Resources
import Settings.Util
import Settings.User
import Settings.Packages
import Settings
-- Note: this build rule creates plenty of files, not just the .haddock one.
-- All of them go into the 'doc' subdirectory. Pedantically tracking all built
......
......@@ -6,7 +6,7 @@ import Oracles.PackageData
import Predicates (splitObjects)
import Rules.Actions
import Rules.Resources
import Settings.Util
import Settings
import System.Directory (getDirectoryContents)
import Target (PartialTarget (..), fullTarget)
......
module Settings (
module Settings.Packages,
module Settings.TargetDirectory,
module Settings.User,
module Settings.Util,
module Settings.Ways
) where
import Settings.Packages
import Settings.TargetDirectory
import Settings.User
import Settings.Util
import Settings.Ways
module Settings.Args (args, getArgs) where
import Expression
import Settings.User
import Settings
import Settings.Builders.Ar
import Settings.Builders.Ld
import Settings.Builders.Ghc
......@@ -19,7 +19,6 @@ getArgs = fromDiffExpr args
-- TODO: add all other settings
-- TODO: add src-hc-args = -H32m -O
-- TODO: GhcStage2HcOpts=-O2 unless GhcUnregisterised
-- TODO: libraries/ghc-prim_dist-install_MODULES := $$(filter-out GHC.Prim, ...
-- TODO: compiler/stage1/build/Parser_HC_OPTS += -O0 -fno-ignore-interface-pragmas
-- TODO: compiler/main/GhcMake_HC_OPTS += -auto-all
-- TODO: compiler_stage2_HADDOCK_OPTS += --optghc=-DSTAGE=2
......
......@@ -4,8 +4,7 @@ import Util
import Expression
import Predicates (stagedBuilder, splitObjects, stage0)
import Oracles
import Settings.Util
import Settings.Ways
import Settings
-- TODO: add support for -dyno
-- $1/$2/build/%.$$($3_o-bootsuf) : $1/$4/%.hs-boot
......
......@@ -12,10 +12,7 @@ import Package
import Expression
import Predicates
import Oracles
import Settings.User
import Settings.Ways
import Settings.Util
import Settings.Packages
import Settings
cabalArgs :: Args
cabalArgs = builder GhcCabal ? do
......
module Settings.Packages (
module Settings.Default,
packages, getPackages, knownPackages, findKnownPackage
module GHC,
getPackages, knownPackages, findKnownPackage
) where
import Package
import Expression
import Predicates
import GHC
import Oracles
import Predicates
import Settings.User
import Settings.Default
-- Combining default list of packages with user modifications
packages :: Packages
packages = defaultPackages <> userPackages
getPackages :: Expr [Package]
getPackages = fromDiffExpr packages
getPackages = fromDiffExpr $ defaultPackages <> userPackages
-- These are the packages we build by default
defaultPackages :: Packages
......
......@@ -5,11 +5,9 @@ module Settings.User (
dynamicGhcPrograms, laxDependencies
) where
import Stage
import Package
import Expression
import GHC
import Predicates
import Settings.Default
-- No user-specific settings by default
-- TODO: rename to userArgs
......
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