Commit 6b143638 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Build haddock.

parent f3199c17
module GHC (
array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
compareSizes, deepseq, directory, dllSplit, filepath, ghc, ghcCabal, ghcPkg, ghcPrim,
ghcPwd, ghcTags, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
mkUserGuidePart, parallel, pretty,
primitive, process, runghc, stm, templateHaskell, terminfo, time, transformers,
unix, win32, xhtml,
......@@ -23,7 +23,7 @@ defaultKnownPackages =
[ array, base, binPackageDb, binary, bytestring, cabal, compiler
, containers, compareSizes, deepseq, directory, dllSplit, filepath, ghc
, ghcCabal, ghcPkg, ghcPrim
, ghcPwd, ghcTags, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple
, ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple
, mkUserGuidePart, parallel, pretty, primitive, process, runghc, stm, templateHaskell, terminfo
, time, transformers, unix, win32, xhtml ]
......@@ -31,7 +31,7 @@ defaultKnownPackages =
array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
compareSizes, deepseq, directory, dllSplit, filepath, ghc, ghcCabal, ghcPkg,
ghcPrim, ghcPwd,
ghcTags, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
mkUserGuidePart, parallel, pretty,
primitive, process, runghc, stm, templateHaskell, terminfo, time, transformers,
unix, win32, xhtml :: Package
......@@ -55,6 +55,7 @@ ghcPkg = utility "ghc-pkg"
ghcPrim = library "ghc-prim"
ghcPwd = utility "ghc-pwd"
ghcTags = utility "ghctags"
haddock = utility "haddock"
haskeline = library "haskeline"
hsc2hs = utility "hsc2hs"
hoopl = library "hoopl"
......@@ -77,6 +78,13 @@ unix = library "unix"
win32 = library "Win32"
xhtml = library "xhtml"
-- TODO: deriveConstants, genapply, genprimocode, hp2ps
-- TODO: The following utils are not included into the build system because
-- they seem to be unused or unrelated to the build process: chechUniques,
-- completion, count_lines, coverity, debugNGC, describe-unexpected, genargs,
-- lndir, mkdirhier, testremove, touchy, unlit, vagrant
-- GHC build results will be placed into target directories with the following
-- typical structure:
-- * build/ : contains compiled object code
......@@ -102,6 +110,7 @@ defaultProgramPath stage pkg
| pkg == ghcPkg = program $ pkgName pkg
| pkg == ghcPwd = program $ pkgName pkg
| pkg == ghcTags = program $ pkgName pkg
| pkg == haddock = program $ pkgName pkg
| pkg == hsc2hs = program $ pkgName pkg
| pkg == hpcBin = program $ pkgName pkg
| pkg == mkUserGuidePart = program $ pkgName pkg
......
......@@ -39,7 +39,7 @@ generateTargets = action $ do
need $ reverse targets
-- TODO: add Stage2 (compiler only?)
-- TODO: use stage 2 compiler for building stage 2 packages (instead of stage 1)
packageRules :: Rules ()
packageRules = do
resources <- resourceRules
......
......@@ -17,6 +17,7 @@ compilePackage _ target @ (PartialTarget stage package) = do
matchBuildResult buildPath "hi-boot" ?> \hiboot ->
need [ hiboot -<.> obootsuf (detectWay hiboot) ]
-- TODO: add dependencies for #include of .h and .hs-incl files (gcc -MM?)
matchBuildResult buildPath "o" ?> \obj -> do
(src, deps) <- dependencies buildPath obj
need $ src : deps
......
......@@ -18,9 +18,10 @@ buildProgram _ target @ (PartialTarget stage pkg) = do
(\f -> program == Just f) ?> \bin -> do
cSrcs <- cSources target -- TODO: remove code duplication (Library.hs)
hSrcs <- hSources target
let cObjs = [ buildPath -/- src -<.> osuf vanilla | src <- cSrcs ]
hObjs = [ buildPath -/- src <.> osuf vanilla | src <- hSrcs ]
++ [ buildPath -/- "Paths_hsc2hs.o" | pkg == hsc2hs ]
let cObjs = [ buildPath -/- src -<.> osuf vanilla | src <- cSrcs ]
hObjs = [ buildPath -/- src <.> osuf vanilla | src <- hSrcs ]
++ [ buildPath -/- "Paths_hsc2hs.o" | pkg == hsc2hs ]
++ [ buildPath -/- "Paths_haddock.o" | pkg == haddock ]
objs = cObjs ++ hObjs
need objs
build $ fullTargetWithWay target (Ghc stage) vanilla objs [bin]
......
......@@ -18,6 +18,7 @@ ghcArgs :: Args
ghcArgs = stagedBuilder Ghc ? do
output <- getOutput
way <- getWay
pkg <- getPackage
let buildObj = ("//*." ++ osuf way) ?== output || ("//*." ++ obootsuf way) ?== output
libs <- getPkgDataList DepExtraLibs
libDirs <- getPkgDataList DepLibDirs
......@@ -28,9 +29,9 @@ ghcArgs = stagedBuilder Ghc ? do
, notStage0 ? arg "-O2"
, arg "-Wall"
, arg "-fwarn-tabs"
, buildObj ? splitObjects ? arg "-split-objs"
, isLibrary pkg ? splitObjects ? arg "-split-objs"
, package ghc ? arg "-no-hs-main"
-- , not buildObj ? arg "-no-auto-link-packages"
, not buildObj ? arg "-no-auto-link-packages"
, package runghc ? file "//Main.o" ?
append ["-cpp", "-DVERSION=\"" ++ version ++ "\""]
, not buildObj ? append [ "-optl-l" ++ lib | lib <- libs ]
......
......@@ -165,6 +165,8 @@ customPackageArgs = do
, ghcWithInterpreter ?
notStage0 ? arg "--flags=ghci"
]
, package haddock ?
builder GhcCabal ? append ["--flag", "in-ghc-tree"]
]
withBuilderKey :: Builder -> String
......
......@@ -12,12 +12,13 @@ getPackages = fromDiffExpr $ defaultPackages <> userPackages
defaultPackages :: Packages
defaultPackages = mconcat
[ stage0 ? packagesStage0
, stage1 ? packagesStage1 ]
, stage1 ? packagesStage1
, stage2 ? packagesStage2 ]
packagesStage0 :: Packages
packagesStage0 = mconcat
[ append [ binPackageDb, binary, cabal, compiler, ghc, ghcCabal, ghcPkg
, ghcPwd, hsc2hs, hoopl, hpc, templateHaskell, transformers ]
, hsc2hs, hoopl, hpc, templateHaskell, transformers ]
, notM windowsHost ? notM (anyHostOs ["ios"]) ? append [terminfo] ]
-- TODO: what do we do with parallel, stm, random, primitive, vector and dph?
......@@ -26,12 +27,17 @@ packagesStage1 = mconcat
[ packagesStage0
, append [ array, base, bytestring, containers, compareSizes, deepseq
, directory, dllSplit, filepath
, ghcPrim, ghcTags, haskeline, hpcBin, integerLibrary
, ghcPrim, ghcPwd, haskeline, hpcBin, integerLibrary
, mkUserGuidePart, pretty, process, runghc, time ]
, windowsHost ? append [win32]
, notM windowsHost ? append [unix]
, buildHaddock ? append [xhtml] ]
packagesStage2 :: Packages
packagesStage2 = mconcat
[ append [ghcTags]
, buildHaddock ? append [haddock] ]
knownPackages :: [Package]
knownPackages = defaultKnownPackages ++ userKnownPackages
......
Supports Markdown
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