[commit: ghc] master: Implement install_docs (#442) (7a85ccf)

git at git.haskell.org git at git.haskell.org
Tue Oct 23 20:10:31 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7a85ccf58a5fdd82fa44cc0a2703c4bc621211e1/ghc

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

commit 7a85ccf58a5fdd82fa44cc0a2703c4bc621211e1
Author: Zhen Zhang <izgzhen at gmail.com>
Date:   Sat Oct 28 06:16:20 2017 +0800

    Implement install_docs (#442)


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

7a85ccf58a5fdd82fa44cc0a2703c4bc621211e1
 src/Rules/Documentation.hs |  4 ++++
 src/Rules/Install.hs       | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/Rules/Documentation.hs b/src/Rules/Documentation.hs
index 2cdd4d5..5a5698c 100644
--- a/src/Rules/Documentation.hs
+++ b/src/Rules/Documentation.hs
@@ -23,12 +23,16 @@ documentationRules = do
     buildPdfDocumentation
     buildDocumentationArchives
     buildManPage
+    "//docs//gen_contents_index" %> copyFile "libraries/gen_contents_index"
+    "//docs//prologue.txt" %> copyFile "libraries/prologue.txt"
     "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 [ root -/- htmlRoot -/- "libraries" -/- "gen_contents_index" ]
+        need [ root -/- htmlRoot -/- "libraries" -/- "prologue.txt" ]
         need [manPagePath]
 
 manPagePath :: FilePath
diff --git a/src/Rules/Install.hs b/src/Rules/Install.hs
index 4558646..ae4a7b0 100644
--- a/src/Rules/Install.hs
+++ b/src/Rules/Install.hs
@@ -45,6 +45,7 @@ installRules = do
         installLibExecScripts
         installBins
         installPackages
+        installDocs
 
 -- TODO: Get rid of hard-coded list.
 -- | Binaries to install.
@@ -311,3 +312,24 @@ installIncludes = do
                   (destDir ++ ghcheaderDir ++ "/")
   where
     installHeader = installData -- they share same arguments
+
+-- ref: ghc.mk
+-- | Install documentation to @prefix/share/doc/ghc-<version>@.
+installDocs :: Action ()
+installDocs = do
+    destDir <- getDestDir
+    docDir  <- installDocDir
+    root    <- buildRoot
+    installDirectory (destDir ++ docDir)
+
+    let usersGuide = root -/- "docs/pdfs/users_guide.pdf"
+    whenM (doesFileExist usersGuide) $
+        installData [usersGuide] (destDir ++ docDir)
+
+    let htmlDocDir = destDir ++ docDir -/- "html"
+    installDirectory htmlDocDir
+    installData ["docs/index.html"] htmlDocDir
+
+    forM_ ["Haddock", "libraries", "users_guide"] $ \dirname -> do
+        let dir = (root -/- "docs/html" -/- dirname)
+        whenM (doesDirectoryExist dir) $ copyDirectory dir htmlDocDir



More information about the ghc-commits mailing list