Commit 28e3a26c authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Clean up code.

parent c7f9f7c3
......@@ -43,7 +43,7 @@ stage2 :: Predicate
stage2 = stage Stage2
notStage0 :: Predicate
notStage0 = fmap not stage0
notStage0 = notM stage0
-- TODO: Actually, we don't register compiler in some circumstances -- fix.
registerPackage :: Predicate
......@@ -52,11 +52,6 @@ registerPackage = return True
splitObjects :: Predicate
splitObjects = do
goodStage <- notStage0 -- We don't split bootstrap (stage 0) packages
goodPkg <- fmap not $ package compiler -- We don't split compiler
broken <- getFlag SplitObjectsBroken
ghcUnreg <- getFlag GhcUnregisterised
goodArch <- lift $ targetArchs [ "i386", "x86_64", "powerpc", "sparc" ]
goodOs <- lift $ targetOss [ "mingw32", "cygwin32", "linux", "darwin"
, "solaris2", "freebsd", "dragonfly"
, "netbsd", "openbsd" ]
return $ goodStage && goodPkg && not broken && not ghcUnreg && goodArch && goodOs
goodPackage <- notM $ package compiler -- We don't split compiler
supported <- lift supportsSplitObjects
return $ goodStage && goodPackage && supported
......@@ -101,12 +101,12 @@ ccArgs = validating ? ccWarnings
-- TODO: should be in a different file
ccWarnings :: Args
ccWarnings = do
let notClang = fmap not gccIsClang
let gccGe46 = notM $ (flag GccIsClang ||^ flag GccLt46)
mconcat [ arg "-Werror"
, arg "-Wall"
, gccIsClang ? arg "-Wno-unknown-pragmas"
, notClang ? gccGe46 ? notWindowsHost ? arg "-Werror=unused-but-set-variable"
, notClang ? gccGe46 ? arg "-Wno-error=inline" ]
, flag GccIsClang ? arg "-Wno-unknown-pragmas"
, gccGe46 ? notM windowsHost ? arg "-Werror=unused-but-set-variable"
, gccGe46 ? arg "-Wno-error=inline" ]
ldArgs :: Args
ldArgs = mempty
......@@ -147,10 +147,10 @@ customPackageArgs = do
mconcat [ arg $ "--ghc-option=-DSTAGE=" ++ show nextStage
, arg $ "--flags=stage" ++ show nextStage
, arg "--disable-library-for-ghci"
, targetOs "openbsd" ? arg "--ld-options=-E"
, anyTargetOs ["openbsd"] ? arg "--ld-options=-E"
, flag GhcUnregisterised ? arg "--ghc-option=-DNO_REGS"
, fmap not ghcWithSMP ? arg "--ghc-option=-DNOSMP"
, fmap not ghcWithSMP ? arg "--ghc-option=-optc-DNOSMP"
, notM ghcWithSMP ? arg "--ghc-option=-DNOSMP"
, notM ghcWithSMP ? arg "--ghc-option=-optc-DNOSMP"
, (threaded `elem` rtsWays) ?
notStage0 ? arg "--ghc-option=-optc-DTHREADED_RTS"
, ghcWithNativeCodeGen ? arg "--flags=ncg"
......@@ -158,7 +158,7 @@ customPackageArgs = do
notStage0 ? arg "--flags=ghci"
, ghcWithInterpreter ?
ghcEnableTablesNextToCode ?
fmap not (flag GhcUnregisterised) ?
notM (flag GhcUnregisterised) ?
notStage0 ? arg "--ghc-option=-DGHCI_TABLES_NEXT_TO_CODE"
, ghcWithInterpreter ?
ghciWithDebugger ?
......@@ -183,7 +183,7 @@ withBuilderKey b = case b of
-- Expression 'with Gcc' appends "--with-gcc=/path/to/gcc" and needs Gcc.
with :: Builder -> Args
with b = specified b ? do
path <- lift $ builderPath b
path <- getBuilderPath b
lift $ needBuilder laxDependencies b
append [withBuilderKey b ++ path]
......
......@@ -24,7 +24,7 @@ hsc2HsArgs = builder Hsc2Hs ? do
else getSetting ProjectVersionInt
mconcat [ arg $ "--cc=" ++ ccPath
, arg $ "--ld=" ++ ccPath
, notWindowsHost ? arg "--cross-safe"
, notM windowsHost ? arg "--cross-safe"
, append $ map ("-I" ++) gmpDirs
, append $ map ("--cflag=" ++) cFlags
, append $ map ("--lflag=" ++) lFlags
......
......@@ -17,7 +17,7 @@ defaultPackages = mconcat
packagesStage0 :: Packages
packagesStage0 = mconcat
[ append [ binPackageDb, binary, cabal, compiler, hoopl, hpc, transformers ]
, notWindowsHost ? notTargetOs "ios" ? append [terminfo] ]
, notM windowsHost ? notM (anyHostOs ["ios"]) ? append [terminfo] ]
-- TODO: what do we do with parallel, stm, random, primitive, vector and dph?
packagesStage1 :: Packages
......@@ -27,7 +27,7 @@ packagesStage1 = mconcat
, filepath, ghcPrim, haskeline, integerLibrary, pretty, process
, templateHaskell, time ]
, windowsHost ? append [win32]
, notWindowsHost ? append [unix]
, notM windowsHost ? append [unix]
, buildHaddock ? append [xhtml] ]
knownPackages :: [Package]
......
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