[commit: ghc] wip/nfs-locking: Build man page (#424) (e1c9afa)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:00:42 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/e1c9afa3c5e29a7cea8d3853a06e08005d06f83b/ghc

>---------------------------------------------------------------

commit e1c9afa3c5e29a7cea8d3853a06e08005d06f83b
Author: Zhen Zhang <izgzhen at gmail.com>
Date:   Sun Oct 1 05:01:28 2017 +0800

    Build man page (#424)


>---------------------------------------------------------------

e1c9afa3c5e29a7cea8d3853a06e08005d06f83b
 src/Rules/Documentation.hs      | 15 +++++++++++++++
 src/Settings/Builders/Sphinx.hs |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/Rules/Documentation.hs b/src/Rules/Documentation.hs
index bafb1b2..2cdd4d5 100644
--- a/src/Rules/Documentation.hs
+++ b/src/Rules/Documentation.hs
@@ -22,12 +22,17 @@ documentationRules = do
     buildHtmlDocumentation
     buildPdfDocumentation
     buildDocumentationArchives
+    buildManPage
     "docs" ~> do
         root <- buildRoot
         let html = htmlRoot -/- "index.html"
             archives = map pathArchive docPaths
             pdfs = map pathPdf $ docPaths \\ [ "libraries" ]
         need $ map (root -/-) $ [html] ++ archives ++ pdfs
+        need [manPagePath]
+
+manPagePath :: FilePath
+manPagePath = "_build/docs/users_guide/build-man/ghc.1"
 
 -- TODO: Add support for Documentation Packages so we can
 -- run the builders without this hack.
@@ -176,3 +181,13 @@ buildArchive path = do
             src = root -/- pathIndex path
         need [src]
         build $ target context (Tar Create) [takeDirectory src] [file]
+
+-- | build man page
+buildManPage :: Rules ()
+buildManPage = do
+    manPagePath %> \file -> do
+        need ["docs/users_guide/ghc.rst"]
+        let context = vanillaContext Stage0 docPackage
+        withTempDir $ \dir -> do
+            build $ target context (Sphinx Man) ["docs/users_guide"] [dir]
+            copyFileUntracked (dir -/- "ghc.1") file
diff --git a/src/Settings/Builders/Sphinx.hs b/src/Settings/Builders/Sphinx.hs
index 6ac88a0..2338cfc 100644
--- a/src/Settings/Builders/Sphinx.hs
+++ b/src/Settings/Builders/Sphinx.hs
@@ -16,7 +16,7 @@ sphinxBuilderArgs = do
                 , arg =<< getInput
                 , arg outPath ]
             , builder (Sphinx Man) ? mconcat
-                [ arg "-b", arg "latex"
+                [ arg "-b", arg "man"
                 , arg "-d", arg $ outPath -/- ".doctrees-man"
                 , arg =<< getInput
                 , arg outPath ] ]



More information about the ghc-commits mailing list