summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Rules/BinaryDist.hs22
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"
, "# ----------------------------------------------------------------------"
]