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
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 []
,
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" ],
],
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
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" ]
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