We need to thread lots more paths through installPackage to make bindists work
authorIan Lynagh <igloo@earth.li>
Thu, 13 Sep 2007 15:48:30 +0000 (15:48 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 13 Sep 2007 15:48:30 +0000 (15:48 +0000)
libraries/Makefile
libraries/installPackage.hs

index e67466a..4068cf2 100644 (file)
@@ -232,12 +232,15 @@ stamp/configure.library.build$(CONFIGURE_STAMP_EXTRAS).%: %/setup/Setup
        ( cd $* && setup/Setup configure \
                   $(CONFIGURE_OPTS) \
                   --prefix='$$topdir' \
-                          --docdir='$(docdir)' \
-                          --htmldir='$(htmldir_configure)' \
-                  --datadir='$(datadir)' \
+                  --bindir='$(bindir)' \
+                  --libdir='$(libdir)' \
                   --libsubdir='$(libsubdir)' \
-                  --with-compiler=../../compiler/stage1/ghc-inplace$ \
-                  --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace$ \
+                  --libexecdir='$(libexecdir)' \
+                  --datadir='$(datadir)' \
+                  --docdir='$(docdir)' \
+                  --htmldir='$(htmldir_configure)' \
+                  --with-compiler=../../compiler/stage1/ghc-inplace \
+                  --with-hc-pkg=../../utils/ghc-pkg/ghc-pkg-inplace \
                   --with-hsc2hs=../../utils/hsc2hs/hsc2hs-inplace \
                   --with-ld=$(LD) \
                   --haddock-options="--use-contents=../index.html \
@@ -336,11 +339,14 @@ install-docs:
 # prefix and (on Windows) htmldir use $topdir when configuring, so we
 # need to tell installPackage the real path to use when installing.
 
+# We also need to pass all the other directories in, as they can be
+# overridden when installing a bindist.
+
 $(foreach SUBDIR,$(SUBDIRS),install.library.$(SUBDIR)): \
 install.library.%: installPackage/installPackage ifBuildable/ifBuildable
        if ifBuildable/ifBuildable $*; then \
          cd $* && \
-         ../installPackage/installPackage '$(DESTDIR)' '$(prefix)' '$(htmldir_install)' '$(GHC_PKG_PROG)' '$(DESTDIR)$(libdir)/package.conf' ; \
+         ../installPackage/installPackage '$(DESTDIR)' '$(prefix)' '$(bindir)' '$(libdir)' '$(libexecdir)' '$(datadir)' '$(docdir)' '$(htmldir_install)' '$(GHC_PKG_PROG)' '$(DESTDIR)$(libdir)/package.conf' ; \
        fi
 
 .PHONY: binary-dist binary-dist.library.%
index 905b985..0fd35c2 100644 (file)
@@ -13,7 +13,9 @@ main :: IO ()
 main
   = do args <- getArgs
        case args of
-           destdir : pref : ihtmldir : ghcpkg : ghcpkgconf : args' ->
+           destdir : pref : ibindir : ilibdir : ilibexecdir
+                   : idatadir : idocdir : ihtmldir
+                   : ghcpkg : ghcpkgconf : args' ->
                let verbosity = case args' of
                            [] -> normal
                            ['-':'v':v] ->
@@ -22,15 +24,18 @@ main
                                            _ -> Just v
                                in flagToVerbosity m
                            _ -> error ("Bad arguments: " ++ show args)
-               in doit destdir pref ihtmldir ghcpkg ghcpkgconf
-                       verbosity
+               in doit destdir pref ibindir ilibdir ilibexecdir idatadir
+                       idocdir ihtmldir
+                       ghcpkg ghcpkgconf verbosity
            _ ->
                error "Missing arguments"
 
 doit :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath
+     -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath
      -> Verbosity
      -> IO ()
-doit destdir pref ihtmldir ghcpkg ghcpkgconf verbosity =
+doit destdir pref ibindir ilibdir ilibexecdir idatadir idocdir
+     ihtmldir ghcpkg ghcpkgconf verbosity =
        do let userHooks = simpleUserHooks
               copyto = if null destdir then NoCopyDest else CopyTo destdir
               copyFlags = (emptyCopyFlags copyto) {
@@ -61,8 +66,13 @@ doit destdir pref ihtmldir ghcpkg ghcpkgconf verbosity =
               pd_reg  = pd { library = Just (mkLib (const True)) }
               -- When coying, we need to actually give a concrete
               -- directory to copy to rather than "$topdir"
-              i_copy = i { prefixDirTemplate = toPathTemplate pref,
-                           htmlDirTemplate   = toPathTemplate ihtmldir
+              i_copy = i { prefixDirTemplate  = toPathTemplate pref,
+                           binDirTemplate     = toPathTemplate ibindir,
+                           libDirTemplate     = toPathTemplate ilibdir,
+                           libexecDirTemplate = toPathTemplate ilibexecdir,
+                           dataDirTemplate    = toPathTemplate idatadir,
+                           docDirTemplate     = toPathTemplate idocdir,
+                           htmlDirTemplate    = toPathTemplate ihtmldir
                          }
               lbi_copy = lbi { installDirTemplates = i_copy }
               -- When we run GHC we give it a $topdir that includes the