Obey DESTDIR when installing library docs
authorIan Lynagh <igloo@earth.li>
Fri, 31 Aug 2007 01:23:51 +0000 (01:23 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 31 Aug 2007 01:23:51 +0000 (01:23 +0000)
libraries/Makefile
libraries/installPackage.hs

index 1e76ede..3163fc6 100644 (file)
@@ -298,15 +298,17 @@ endif
 
 .PHONY: install install-docs install.library.%
 
+DESTlibraryhtmldir = $(DESTDIR)$(libraryhtmldir)/html
+
 install: $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR))
 ifeq "$(HADDOCK_DOCS)" "YES"
-       $(INSTALL_DIR)                                      $(libraryhtmldir)/html
-       $(INSTALL_DATA)   index.html doc-index.html         $(libraryhtmldir)/html
-       $(INSTALL_SCRIPT) gen_contents_index                $(libraryhtmldir)/html
+       $(INSTALL_DIR)                                      $(DESTlibraryhtmldir)
+       $(INSTALL_DATA)   index.html doc-index.html         $(DESTlibraryhtmldir)
+       $(INSTALL_SCRIPT) gen_contents_index                $(DESTlibraryhtmldir)
        # Hacks:
-       $(INSTALL_DATA)   $(libraryhtmldir)/html/base/*.css $(libraryhtmldir)/html
-       $(INSTALL_DATA)   $(libraryhtmldir)/html/base/*.js  $(libraryhtmldir)/html
-       $(INSTALL_DATA)   $(libraryhtmldir)/html/base/*.gif $(libraryhtmldir)/html
+       $(INSTALL_DATA)   $(DESTlibraryhtmldir)/base/*.css $(DESTlibraryhtmldir)
+       $(INSTALL_DATA)   $(DESTlibraryhtmldir)/base/*.js  $(DESTlibraryhtmldir)
+       $(INSTALL_DATA)   $(DESTlibraryhtmldir)/base/*.gif $(DESTlibraryhtmldir)
 endif
 
 # Cabal doesn't let us ask to install docs only, so do nothing here
@@ -320,7 +322,7 @@ $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \
 install.library.%: installPackage/installPackage ifBuildable/ifBuildable
        if ifBuildable/ifBuildable $*; then \
          cd $* && \
-         ../installPackage/installPackage $(DESTDIR)$(prefix) $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace $(DESTDIR)$(libdir)/package.conf; \
+         ../installPackage/installPackage $(DESTDIR) $(prefix) $(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/ghc-pkg-inplace $(DESTDIR)$(libdir)/package.conf; \
        fi
 
 .PHONY: binary-dist binary-dist.library.%
index c091b0b..31d9ed1 100644 (file)
@@ -11,7 +11,7 @@ import System.Environment
 main :: IO ()
 main = do args <- getArgs
           case args of
-              pref : ghcpkg : ghcpkgconf : args' ->
+              destdir : pref : ghcpkg : ghcpkgconf : args' ->
                   let verbosity = case args' of
                               [] -> normal
                               ['-':'v':v] ->
@@ -20,14 +20,14 @@ main = do args <- getArgs
                                               _ -> Just v
                                   in flagToVerbosity m
                               _ -> error ("Bad arguments: " ++ show args)
-                  in doit pref ghcpkg ghcpkgconf verbosity
+                  in doit destdir pref ghcpkg ghcpkgconf verbosity
               _ ->
                   error "Missing arguments"
 
-doit :: FilePath -> FilePath -> FilePath -> Verbosity -> IO ()
-doit pref ghcpkg ghcpkgconf verbosity =
+doit :: FilePath -> FilePath -> FilePath -> FilePath -> Verbosity -> IO ()
+doit destdir pref ghcpkg ghcpkgconf verbosity =
        do let userHooks = simpleUserHooks
-              copyFlags = (emptyCopyFlags NoCopyDest) {
+              copyFlags = (emptyCopyFlags (CopyTo destdir)) {
                               copyVerbose = verbosity
                           }
               registerFlags = emptyRegisterFlags {