[project @ 2001-05-18 09:18:05 by simonmar]
[ghc-hetmet.git] / ghc / driver / PackageSrc.hs
index f774708..2c8875b 100644 (file)
@@ -6,20 +6,30 @@ import Utils
 
 import IO
 import System
-import Config
 import Package
 
 main :: IO ()
 main = do
   args <- getArgs
   case args of
-        [ "install"  ] -> do { putStrLn (dumpPackages (package_details True)) }
-        [ "in-place" ] -> do { putStrLn (dumpPackages (package_details False)) }
-        _ -> do hPutStr stderr "usage: pkgconf (install | in-place)\n"
-                exitWith (ExitFailure 1)
+     ("install":rest)  -> do { putStrLn (dumpPackages (package_details True rest)) }
+     ("in-place":rest) -> do { putStrLn (dumpPackages (package_details False rest)) }
+     _ -> do hPutStr stderr "usage: pkgconf (install | in-place) ...\n"
+             exitWith (ExitFailure 1)
+
+package_details :: Bool -> [String] -> [PackageConfig]
+package_details installing
+ [ cTARGETPLATFORM
+ , cCURRENT_DIR
+ , cHaveLibGmp
+ , cLibsReadline
+ , clibdir
+ , cGHC_LIB_DIR
+ , cGHC_RUNTIME_DIR
+ , cGHC_UTILS_DIR
+ , cGHC_INCLUDE_DIR
+ , cFPTOOLS_TOP_ABS ] =
 
-package_details :: Bool -> [PackageConfig]
-package_details installing =
  [
         Package {
        name           = "gmp",  -- GMP is at the bottom of the heap
@@ -216,8 +226,7 @@ package_details installing =
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ],
          hs_libraries      = [ "HSnet" ],
-        extra_libraries   = [ "HSnet_cbits" ] 
-                             ++ if suffixMatch "solaris2" cTARGETPLATFORM
+        extra_libraries   = if suffixMatch "solaris2" cTARGETPLATFORM
                                 then [ "nsl",  "socket" ]
                                 else []
                              ,
@@ -290,7 +299,7 @@ package_details installing =
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util"
                                   , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
          hs_libraries      = [ "HSutil" ],
-        extra_libraries   = [ "HSutil_cbits" ],
+        extra_libraries   = [ "HSutil_cbits" ] ++ words cLibsReadline,
          include_dirs   = if installing
                              then []
                              else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ],
@@ -302,7 +311,7 @@ package_details installing =
                          ],
          extra_ghc_opts = [],
          extra_cc_opts  = [],
-         extra_ld_opts  = words cLibsReadline
+         extra_ld_opts  = []
         },
 
         -- no cbits at the moment, we'll need to add one if this library
@@ -343,9 +352,10 @@ package_details installing =
          extra_ghc_opts = [],
          extra_cc_opts  = [],
          extra_ld_opts  = [],
-        },
+        }
 
-         Package {
+#if defined(mingw32_TARGET_OS) || defined(cygwin32_TARGET_OS)
+         ,Package {
          name         = "win32",
         import_dirs    = if installing
                              then [ clibdir ++ "/imports/win32" ]
@@ -382,7 +392,8 @@ package_details installing =
          extra_cc_opts  = [],
          extra_ld_opts  = []
         }
+#endif
    ]
-
-ghc_src_dir :: String -> String
-ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path
+  where
+       ghc_src_dir :: String -> String
+       ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path