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

Clean up.

parent f124e236
......@@ -16,7 +16,7 @@ import Oracles.Option
--
-- Ghc Stage0 is the bootstrapping compiler
-- Ghc StageN, N > 0, is the one built on stage (N - 1)
-- GhcPkg Stage0 is the bootstrapping GhcPkg
-- GhcPkg Stage0 is the bootstrapping GhcPkg
-- GhcPkg StageN, N > 0, is the one built on stage 0 (TODO: need only Stage1?)
data Builder = Ar
| Ld
......@@ -72,15 +72,15 @@ needBuilder ghc @ (Ghc stage) = do
laxDeps <- test LaxDeps
if laxDeps then orderOnly [exe] else need [exe]
needBuilder builder = do
needBuilder builder = do
[exe] <- showArgs builder
need [exe]
-- Action 'with Gcc' returns '--with-gcc=/path/to/gcc' and needs Gcc
-- Raises an error if the builder is not uniquely specified in config files
with :: Builder -> Args
with builder = do
let key = case builder of
with builder = do
let key = case builder of
Ar -> "--with-ar="
Ld -> "--with-ld="
Gcc -> "--with-gcc="
......@@ -107,13 +107,11 @@ run builder args = do
-- Raises an error if the builder is not uniquely specified in config files
terseRun :: Builder -> Args -> Action ()
terseRun builder args = do
needBuilder builder
[exe] <- showArgs builder
args' <- args
putNormal $ "|--------\n| Running " ++ show builder ++ " with arguments:"
putNormal $ "/--------\n| Running " ++ show builder ++ " with arguments:"
mapM_ (putNormal . ("| " ++)) $ interestingInfo builder args'
putNormal "|--------"
quietly $ cmd [exe] args'
putNormal "\\--------"
quietly $ run builder args
interestingInfo :: Builder -> [String] -> [String]
interestingInfo builder ss = case builder of
......
......@@ -8,7 +8,7 @@ module Package.Base (
defaultSettings, libraryPackage,
commonCcArgs, commonLdArgs, commonCppArgs, commonCcWarninigArgs,
bootPkgConstraints,
pathArgs, packageArgs, includeArgs, pkgHsSources,
pathArgs, packageArgs, includeArgs, pkgHsSources,
pkgDepObjects, pkgLibObjects
) where
......@@ -65,13 +65,12 @@ commonLdArgs = mempty -- TODO: Why empty? Perhaps drop it altogether?
commonCppArgs :: Args
commonCppArgs = mempty -- TODO: Why empty? Perhaps drop it altogether?
-- TODO: simplify
commonCcWarninigArgs :: Args
commonCcWarninigArgs = when Validating $
GccIsClang <?> arg "-Wno-unknown-pragmas"
<> (not GccIsClang && not GccLt46) <?> arg "-Wno-error=inline"
<> (GccIsClang && not GccLt46 && windowsHost) <?>
arg "-Werror=unused-but-set-variable"
commonCcWarninigArgs = when Validating $ arg
[ when GccIsClang $ arg "-Wno-unknown-pragmas"
, when (not GccIsClang && not GccLt46) $ arg "-Wno-error=inline"
, when (GccIsClang && not GccLt46 && windowsHost) $
arg "-Werror=unused-but-set-variable" ]
bootPkgConstraints :: Args
bootPkgConstraints = mempty
......@@ -100,7 +99,7 @@ packageArgs stage pkgData = do
productArgs "-package" (Deps pkgData)
includeArgs :: FilePath -> FilePath -> Args
includeArgs path dist =
includeArgs path dist =
let pkgData = toStandard $ path </> dist </> "package-data.mk"
buildDir = toStandard $ path </> dist </> "build"
in arg "-i"
......@@ -117,13 +116,13 @@ pkgHsSources path dist = do
findModuleFiles pkgData dirs [".hs", ".lhs"]
-- Find objects we depend on (we don't want to depend on split objects)
-- TODO: look for non-hs objects too
-- TODO: look for non-hs objects too
pkgDepObjects :: FilePath -> FilePath -> Way -> Action [FilePath]
pkgDepObjects path dist way = do
let pkgData = path </> dist </> "package-data.mk"
buildDir = path </> dist </> "build"
dirs <- map (normaliseEx . (path </>)) <$> arg (SrcDirs pkgData)
fmap concat $ forM dirs $ \d ->
fmap concat $ forM dirs $ \d ->
map (toStandard . (buildDir ++) . (-<.> osuf way) . drop (length d))
<$> (findModuleFiles pkgData [d] [".hs", ".lhs"])
......
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