Commit d26869ac authored by Alec Theriault's avatar Alec Theriault Committed by Ben Gamari

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.
parent 512a5f36
......@@ -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"
, "# ----------------------------------------------------------------------"
]
......
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