diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2019-01-19 01:06:00 -0800 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2019-01-23 14:07:28 -0500 |
commit | d26869ac83935432e0dcea1ff591268232daef32 (patch) | |
tree | e73d204ac760e666a709b13c92fb6397eea64119 /hadrian | |
parent | 512a5f365b774a999c81ff45b951edb7a56262e4 (diff) | |
download | haskell-d26869ac83935432e0dcea1ff591268232daef32.tar.gz |
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.
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/src/Rules/BinaryDist.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hadrian/src/Rules/BinaryDist.hs b/hadrian/src/Rules/BinaryDist.hs index f847af9166..03740cdad9 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@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" , "# ----------------------------------------------------------------------" ] |