Commit e25bb01f authored by Andrey Mokhov's avatar Andrey Mokhov Committed by GitHub

Finalise documentation build rule (#447)

* Drop --haddock flag and always build Haddock and xthml

See #414

* Reorder imports

* Update README

See #414
parent 882c4a60
......@@ -39,7 +39,7 @@ Notes:
* If the default build script doesn't work, you might want to give a try to another one, e.g. based
on Cabal sandboxes (`build.cabal.*`), Stack (`build.stack.*`) or the global package database
(`build.global-db.*`). Also see [instructions for building GHC on Windows using Stack][windows-build].
(`build.global-db.*`). Also see [instructions for building GHC on Windows using Stack][windows-build].
* Hadrian is written in Haskell and depends on the following packages:
`ansi-terminal extra mtl quickcheck shake`.
......@@ -67,8 +67,6 @@ on a feature that affects both Stage1 and Stage2 compilers, but may lead to inco
build results. To unfreeze Stage1 GHC simply drop the `--freeze1` flag and Hadrian will
rebuild all out-of-date files.
* `--haddock`: build Haddock documentation.
* `--integer-simple`: build GHC using the `integer-simple` integer library (instead
of `integer-gmp`).
......@@ -112,18 +110,17 @@ are still up-to-date.
#### Documentation
To build GHC documentation, run `build docs --haddock`. The `docs` is the documentation
target, and the `--haddock` flag enables building Haddock. This is a temporary solution
and [we plan](https://github.com/snowleopard/hadrian/issues/414) to simplify this command
to `build docs`.
To build GHC documentation, run `build docs`. Note that finer-grain documentation
targets (e.g. building only HTML documentation or only the GHC User's Guide)
are currently not supported.
#### Source distribution
To build a GHC source distribution tarball, run Hadrian with the `sdist-ghc` target.
To build a GHC source distribution tarball, run `build sdist-ghc`.
#### Installation
To build and install GHC artifacts, run the `install` target.
To build and install GHC artifacts, run `build install`.
By default, GHC will be installed to the specified _prefix_ path on your system,
relative to the root of the file system. For example on UNIX, GHC will be installed
......
module CommandLine (
optDescrs, cmdLineArgsMap, cmdBuildHaddock, cmdFlavour, lookupFreeze1,
cmdIntegerSimple, cmdProgressColour, cmdProgressInfo, cmdSkipConfigure,
cmdSplitObjects, cmdInstallDestDir
optDescrs, cmdLineArgsMap, cmdFlavour, lookupFreeze1, cmdIntegerSimple,
cmdProgressColour, cmdProgressInfo, cmdSkipConfigure, cmdSplitObjects,
cmdInstallDestDir
) where
import Data.Either
......@@ -14,8 +14,7 @@ import System.Environment
-- | All arguments that can be passed to Hadrian via the command line.
data CommandLineArgs = CommandLineArgs
{ buildHaddock :: Bool
, flavour :: Maybe String
{ flavour :: Maybe String
, freeze1 :: Bool
, installDestDir :: Maybe String
, integerSimple :: Bool
......@@ -28,8 +27,7 @@ data CommandLineArgs = CommandLineArgs
-- | Default values for 'CommandLineArgs'.
defaultCommandLineArgs :: CommandLineArgs
defaultCommandLineArgs = CommandLineArgs
{ buildHaddock = False
, flavour = Nothing
{ flavour = Nothing
, freeze1 = False
, installDestDir = Nothing
, integerSimple = False
......@@ -41,9 +39,6 @@ defaultCommandLineArgs = CommandLineArgs
readFreeze1 :: Either String (CommandLineArgs -> CommandLineArgs)
readFreeze1 = Right $ \flags -> flags { freeze1 = True }
readBuildHaddock :: Either String (CommandLineArgs -> CommandLineArgs)
readBuildHaddock = Right $ \flags -> flags { buildHaddock = True }
readFlavour :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readFlavour ms = Right $ \flags -> flags { flavour = lower <$> ms }
......@@ -91,8 +86,6 @@ optDescrs =
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
, Option [] ["haddock"] (NoArg readBuildHaddock)
"Generate Haddock documentation."
, Option [] ["install-destdir"] (OptArg readInstallDestDir "DESTDIR")
"Installation destination directory."
, Option [] ["integer-simple"] (NoArg readIntegerSimple)
......@@ -119,9 +112,6 @@ cmdLineArgsMap = do
cmdLineArgs :: Action CommandLineArgs
cmdLineArgs = userSetting defaultCommandLineArgs
cmdBuildHaddock :: Action Bool
cmdBuildHaddock = buildHaddock <$> cmdLineArgs
cmdFlavour :: Action (Maybe String)
cmdFlavour = flavour <$> cmdLineArgs
......
......@@ -23,8 +23,6 @@ data Flavour = Flavour {
rtsWays :: Ways,
-- | Build split objects.
splitObjects :: Predicate,
-- | Build Haddock and documentation.
buildHaddock :: Predicate,
-- | Build dynamic GHC programs.
dynamicGhcPrograms :: Bool,
-- | Enable GHCi debugger.
......
......@@ -20,8 +20,8 @@ module GHC (
import Base
import CommandLine
import Context
import Oracles.Flag
import Oracles.Setting
import Oracles.Flag (crossCompiling)
-- | These are all GHC packages we know about. Build rules will be generated for
-- all of them. However, not all of these packages will be built. For example,
......@@ -166,7 +166,6 @@ stage0Packages = do
stage1Packages :: Action [Package]
stage1Packages = do
win <- windowsHost
doc <- cmdBuildHaddock
intSimple <- cmdIntegerSimple
libraries0 <- filter isLibrary <$> stage0Packages
return $ libraries0 -- Build all Stage0 libraries in Stage1
......@@ -190,16 +189,14 @@ stage1Packages = do
, rts
, runGhc
, stm
, time ]
, time
, xhtml ]
++ [ iservBin | not win ]
++ [ unix | not win ]
++ [ win32 | win ]
++ [ xhtml | doc ]
stage2Packages :: Action [Package]
stage2Packages = do
doc <- cmdBuildHaddock
return [ haddock | doc ]
stage2Packages = return [haddock]
-- | Given a 'Context', compute the name of the program that is built in it
-- assuming that the corresponding package's type is 'Program'. For example, GHC
......
......@@ -6,7 +6,6 @@ import qualified Hadrian.Oracles.Path
import qualified Hadrian.Oracles.TextFile
import Expression
import Flavour
import qualified Oracles.ModuleFiles
import qualified Rules.Compile
import qualified Rules.PackageData
......@@ -20,8 +19,8 @@ import qualified Rules.Library
import qualified Rules.Program
import qualified Rules.Register
import Settings
import UserSettings (stage1Only)
import Target
import UserSettings
import Utilities
allStages :: [Stage]
......@@ -63,13 +62,9 @@ packageTargets includeGhciLib stage pkg = do
let pkgWays = if pkg == rts then getRtsWays else getLibraryWays
ways <- interpretInContext context pkgWays
libs <- mapM (pkgLibraryFile . Context stage pkg) ways
docs <- interpretInContext context =<< buildHaddock <$> flavour
more <- libraryTargets includeGhciLib context
setup <- pkgSetupConfigFile context
haddock <- pkgHaddockFile context
return $ [ setup | not $ nonCabalContext context ]
++ [ haddock | pkg /= rts && docs && stage == Stage1 ]
++ libs ++ more
return $ [ setup | not (nonCabalContext context) ] ++ libs ++ more
else do -- The only target of a program package is the executable.
prgContext <- programContext stage pkg
prgPath <- programPath prgContext
......
......@@ -5,8 +5,8 @@ module Settings.Default (
) where
import qualified Hadrian.Builder.Ar
import qualified Hadrian.Builder.Tar
import qualified Hadrian.Builder.Sphinx
import qualified Hadrian.Builder.Tar
import CommandLine
import Expression
......@@ -121,7 +121,6 @@ defaultFlavour = Flavour
, libraryWays = defaultLibraryWays
, rtsWays = defaultRtsWays
, splitObjects = defaultSplitObjects
, buildHaddock = expr cmdBuildHaddock
, dynamicGhcPrograms = False
, ghciWithDebugger = False
, ghcProfiled = False
......
module Settings.Flavours.Development (developmentFlavour) where
import Flavour
import Expression
import Flavour
import {-# SOURCE #-} Settings.Default
developmentFlavour :: Stage -> Flavour
......
module Settings.Flavours.Performance (performanceFlavour) where
import Flavour
import Expression
import Flavour
import {-# SOURCE #-} Settings.Default
performanceFlavour :: Flavour
......
module Settings.Flavours.Profiled (profiledFlavour) where
import Flavour
import Expression
import Flavour
import {-# SOURCE #-} Settings.Default
profiledFlavour :: Flavour
......
module Settings.Flavours.Quick (quickFlavour) where
import Flavour
import Expression
import Flavour
import Oracles.Flag
import {-# SOURCE #-} Settings.Default
......
module Settings.Flavours.QuickCross (quickCrossFlavour) where
import Flavour
import Expression
import Flavour
import Oracles.Flag
import {-# SOURCE #-} Settings.Default
......
module Settings.Flavours.Quickest (quickestFlavour) where
import Flavour
import Expression
import Flavour
import {-# SOURCE #-} Settings.Default
quickestFlavour :: Flavour
......@@ -19,6 +19,4 @@ quickestArgs = sourceArgs SourceArgs
, hsGhc = stage0 ? arg "-O" }
quickestRtsWays :: Ways
quickestRtsWays = mconcat
[ pure [vanilla]
, buildHaddock defaultFlavour ? pure [threaded] ]
quickestRtsWays = pure [vanilla, threaded]
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