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

Clean up code.

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