[commit: ghc] wip/ghc-8.8-merges: Hadrian: install patches 'haddock-{html, interface}' (59a8d47)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 15:08:55 UTC 2019


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

On branch  : wip/ghc-8.8-merges
Link       : http://ghc.haskell.org/trac/ghc/changeset/59a8d4752d4af6b03faaa68d5aae214726a3cbb0/ghc

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

commit 59a8d4752d4af6b03faaa68d5aae214726a3cbb0
Author: Alec Theriault <alec.theriault at gmail.com>
Date:   Sat Jan 19 01:06:00 2019 -0800

    Hadrian: install patches 'haddock-{html,interface}'
    
    Since the `$(docdir)` can be picked independently from the `$(libdir)`,
    we need to make sure that that the `haddock-html` and `haddock-interface`
    fields in the package DB (which is in the `$(libdir)`) get updated to
    point to the appropriate places in the `$(docdir)`.
    
    NB: in the make system, `ghc-cabal` would cover this sort of thing by
    re-running `configure` on installation, but here we get away with a
    couple lines of `sed` and a call to `ghc-pkg recache`.
    
    Fixes #16202.


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

59a8d4752d4af6b03faaa68d5aae214726a3cbb0
 hadrian/src/Rules/BinaryDist.hs | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs
index f847af9..03740cd 100644
--- a/hadrian/src/Rules/BinaryDist.hs
+++ b/hadrian/src/Rules/BinaryDist.hs
@@ -239,12 +239,25 @@ bindistMakefile = unlines
     , "\t$(EXECUTABLE_FILE) $2 ;"
     , "endef"
     , ""
+    , "# Hacky function to patch up the 'haddock-interfaces' and 'haddock-html'"
+    , "# fields in the package .conf files"
+    , "define patchpackageconf"
+    , "# $1 = package name (ex: 'bytestring')"
+    , "# $2 = path to .conf file"
+    , "# $3 = Docs Directory"
+    , "\tcat $2 | sed 's|haddock-interfaces.*|haddock-interfaces: $3/html/libraries/$1/$1.haddock|' \\"
+    , "\t       | sed 's|haddock-html.*|haddock-html: $3/html/libraries/$1|' \\"
+    , "\t       > $2.copy"
+    , "\tmv $2.copy $2"
+    , "endef"
+    , ""
     , "# QUESTION : should we use shell commands?"
     , ""
     , ""
     , ".PHONY: install"
     , "install: install_lib install_bin install_includes"
     , "install: install_docs install_wrappers install_ghci"
+    , "install: update_package_db"
     , ""
     , "ActualBinsDir=${ghclibdir}/bin"
     , "WrapperBinsDir=${bindir}"
@@ -298,6 +311,15 @@ bindistMakefile = unlines
       "$(WrapperBinsDir),$(ActualBinsDir),$(ActualBinsDir)/$p," ++
       "$(libdir),$(docdir),$(includedir)))"
     , ""
+    , "PKG_CONFS = $(wildcard $(libdir)/package.conf.d/*)"
+    , "update_package_db:"
+    , "\t at echo \"Updating the package DB\""
+    , "\t$(foreach p, $(PKG_CONFS),\\"
+    , "\t\t$(call patchpackageconf," ++
+      "$(shell echo $(notdir $p) | sed 's/-\\([0-9]*[0-9]\\.\\)*conf//g')," ++
+      "$p,$(docdir)))"
+    , "\t$(WrapperBinsDir)/ghc-pkg recache"
+    , ""
     , "# END INSTALL"
     , "# ----------------------------------------------------------------------"
     ]



More information about the ghc-commits mailing list