From 5dfc10caf7878ccf9513025ae19a5cb92082160f Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 11 Sep 2007 22:47:34 +0000 Subject: [PATCH] Further tweaking of haddock doc installation On Windows we now always use a path beginning $topdir/ so bindists are relocatable. We also now tell "Setup configure" where we are putting the documentation, and tell installPackage to override as little as possible. --- libraries/Makefile | 38 +++++++++++++++++++++++++++++--------- libraries/installPackage.hs | 10 ++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/libraries/Makefile b/libraries/Makefile index ae92be9..061b988 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -91,6 +91,22 @@ space=$(empty) $(empty) # ----------------------------------------------------------------------------- +docdir := $(docdir)/libraries/$$pkgid +ifeq "$(Windows)" "YES" +# On Windows we want to make moveable bindists, but we need to tell +# ghc-pkg where the haddock docs are. Therefore we completely ignore +# where the user tells us to put the haddock documentation and put it +# somewhere whose relative location we know. When installing we need +# to give Cabal a real path, though. +htmldir_configure = $$topdir/doc/libraries/$$pkgid +htmldir_install = $(prefix)/doc/libraries/$$pkgid +else +# On non-Windows we can just give absolute paths all the time, and +# thus obey the htmldir that we are given. +htmldir_configure = $(htmldir)/libraries/$$pkgid +htmldir_install = $(htmldir_configure) +endif + ifneq "$(DOING_BIN_DIST)" "YES" CONFIGURE_OPTS = @@ -216,6 +232,8 @@ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: %/setup/Setup ( cd $* && setup/Setup configure \ $(CONFIGURE_OPTS) \ --prefix='$$topdir' \ + --docdir='$(docdir)' \ + --htmldir='$(htmldir_configure)' \ --datadir='$(datadir)' \ --libsubdir='$(libsubdir)' \ --with-compiler=../../compiler/stage1/ghc-inplace$ \ @@ -296,17 +314,15 @@ endif .PHONY: install install-docs install.library.% -libraryhtmldir = $(htmldir)/libraries - install: $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)) ifeq "$(HADDOCK_DOCS)" "YES" - $(INSTALL_DIR) $(DESTDIR)$(libraryhtmldir) - $(INSTALL_DATA) index.html doc-index.html $(DESTDIR)$(libraryhtmldir) - $(INSTALL_SCRIPT) gen_contents_index $(DESTDIR)$(libraryhtmldir) + $(INSTALL_DIR) $(DESTDIR)$(htmldir_install) + $(INSTALL_DATA) index.html doc-index.html $(DESTDIR)$(htmldir_install) + $(INSTALL_SCRIPT) gen_contents_index $(DESTDIR)$(htmldir_install) # Hacks: - $(INSTALL_DATA) $(DESTDIR)$(libraryhtmldir)/base/*.css $(DESTDIR)$(libraryhtmldir) - $(INSTALL_DATA) $(DESTDIR)$(libraryhtmldir)/base/*.js $(DESTDIR)$(libraryhtmldir) - $(INSTALL_DATA) $(DESTDIR)$(libraryhtmldir)/base/*.gif $(DESTDIR)$(libraryhtmldir) + $(INSTALL_DATA) $(DESTDIR)$(htmldir_install)/base/*.css $(DESTDIR)$(htmldir_install) + $(INSTALL_DATA) $(DESTDIR)$(htmldir_install)/base/*.js $(DESTDIR)$(htmldir_install) + $(INSTALL_DATA) $(DESTDIR)$(htmldir_install)/base/*.gif $(DESTDIR)$(htmldir_install) endif # Cabal doesn't let us ask to install docs only, so do nothing here @@ -316,11 +332,15 @@ install-docs: # Ideally this would depend on a stamp/build.library.%, but if it does # then we can't change the libraries and then just rerun make. # Thus if you install without building then it will just break. + +# prefix and (on Windows) htmldir use $topdir when configuring, so we +# need to tell installPackage the real path to use when installing. + $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \ install.library.%: installPackage/installPackage ifBuildable/ifBuildable if ifBuildable/ifBuildable $*; then \ cd $* && \ - ../installPackage/installPackage "$(DESTDIR)" "$(prefix)" "$(datadir)" "$(libraryhtmldir)/$*" "$(libraryhtmldir)" "$(GHC_PKG_PROG)" "$(DESTDIR)$(libdir)/package.conf" ; \ + ../installPackage/installPackage '$(DESTDIR)' '$(prefix)' '$(htmldir_install)' '$(GHC_PKG_PROG)' '$(DESTDIR)$(libdir)/package.conf' ; \ fi .PHONY: binary-dist binary-dist.library.% diff --git a/libraries/installPackage.hs b/libraries/installPackage.hs index 965ef52..905b985 100644 --- a/libraries/installPackage.hs +++ b/libraries/installPackage.hs @@ -13,7 +13,7 @@ main :: IO () main = do args <- getArgs case args of - destdir : pref : idatadir : idocdir : ihtmldir : ghcpkg : ghcpkgconf : args' -> + destdir : pref : ihtmldir : ghcpkg : ghcpkgconf : args' -> let verbosity = case args' of [] -> normal ['-':'v':v] -> @@ -22,15 +22,15 @@ main _ -> Just v in flagToVerbosity m _ -> error ("Bad arguments: " ++ show args) - in doit destdir pref idatadir idocdir ihtmldir ghcpkg ghcpkgconf + in doit destdir pref ihtmldir ghcpkg ghcpkgconf verbosity _ -> error "Missing arguments" -doit :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath +doit :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> Verbosity -> IO () -doit destdir pref idatadir idocdir ihtmldir ghcpkg ghcpkgconf verbosity = +doit destdir pref ihtmldir ghcpkg ghcpkgconf verbosity = do let userHooks = simpleUserHooks copyto = if null destdir then NoCopyDest else CopyTo destdir copyFlags = (emptyCopyFlags copyto) { @@ -62,8 +62,6 @@ doit destdir pref idatadir idocdir ihtmldir ghcpkg ghcpkgconf verbosity = -- When coying, we need to actually give a concrete -- directory to copy to rather than "$topdir" i_copy = i { prefixDirTemplate = toPathTemplate pref, - dataDirTemplate = toPathTemplate idatadir, - docDirTemplate = toPathTemplate idocdir, htmlDirTemplate = toPathTemplate ihtmldir } lbi_copy = lbi { installDirTemplates = i_copy } -- 1.7.10.4