Fix bindist creation on Windows
[ghc-hetmet.git] / libraries / installPackage.hs
index da04e35..451fda1 100644 (file)
@@ -9,23 +9,27 @@ import Distribution.Verbosity
 import System.Environment
 
 main :: IO ()
-main = do args <- getArgs
-          case args of
-              destdir : pref : ghcpkg : ghcpkgconf : args' ->
-                  let verbosity = case args' of
-                              [] -> normal
-                              ['-':'v':v] ->
-                                  let m = case v of
-                                              "" -> Nothing
-                                              _ -> Just v
-                                  in flagToVerbosity m
-                              _ -> error ("Bad arguments: " ++ show args)
-                  in doit destdir pref ghcpkg ghcpkgconf verbosity
-              _ ->
-                  error "Missing arguments"
+main
+  = do args <- getArgs
+       case args of
+           destdir : pref : idatadir : idocdir : ghcpkg : ghcpkgconf : args' ->
+               let verbosity = case args' of
+                           [] -> normal
+                           ['-':'v':v] ->
+                               let m = case v of
+                                           "" -> Nothing
+                                           _ -> Just v
+                               in flagToVerbosity m
+                           _ -> error ("Bad arguments: " ++ show args)
+               in doit destdir pref idatadir idocdir ghcpkg ghcpkgconf
+                       verbosity
+           _ ->
+               error "Missing arguments"
 
-doit :: FilePath -> FilePath -> FilePath -> FilePath -> Verbosity -> IO ()
-doit destdir pref ghcpkg ghcpkgconf verbosity =
+doit :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath
+     -> Verbosity
+     -> IO ()
+doit destdir pref idatadir idocdir ghcpkg ghcpkgconf verbosity =
        do let userHooks = simpleUserHooks
               copyto = if null destdir then NoCopyDest else CopyTo destdir
               copyFlags = (emptyCopyFlags copyto) {
@@ -56,7 +60,10 @@ doit destdir pref 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 }
+              i_copy = i { prefixDirTemplate = toPathTemplate pref,
+                           dataDirTemplate   = toPathTemplate idatadir,
+                           docDirTemplate    = toPathTemplate idocdir
+                         }
               lbi_copy = lbi { installDirTemplates = i_copy }
               -- When we run GHC we give it a $topdir that includes the
               -- $compiler/lib/ part of libsubdir, so we only want the