X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdriver%2FPackageSrc.hs;h=a517e3fc697c0ea2b400d786858c7742b2486667;hb=9c853f5c5bd1e6fac952e98628597b3f5839a8df;hp=5395b05584781370bd7c5263ecf8ea8728c28f20;hpb=877aad486de6dcfac29ee647b79eeac930607381;p=ghc-hetmet.git diff --git a/ghc/driver/PackageSrc.hs b/ghc/driver/PackageSrc.hs index 5395b05..a517e3f 100644 --- a/ghc/driver/PackageSrc.hs +++ b/ghc/driver/PackageSrc.hs @@ -1,312 +1,358 @@ +#include "../includes/config.h" + module Main (main) where -import IOExts +import Utils + import IO import System import Config import Package +main :: IO () main = do args <- getArgs case args of - [ "install" ] -> do { putStr (pprPackage (package_details True)) } - [ "in-place" ] -> do { putStr (pprPackage (package_details False)) } - _ -> do hPutStr stderr "usage: pkgconf (install | in-place)\n" - exitWith (ExitFailure 1) + [ "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) -package_details :: Bool -> [(String,Package)] +package_details :: Bool -> [Package] package_details installing = [ - ( "gmp", -- GMP is at the bottom of the heap - Package { - import_dirs = [], - library_dirs = if _HaveLibGmp == "YES" - then [] - else if installing - then [ _libdir ] - else [ ghc_src_dir _GHC_RUNTIME_DIR ++ "/gmp" ], - libraries = [ "gmp" ], - include_dir = "", - c_include = "", - package_deps = [], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "gmp", -- GMP is at the bottom of the heap + import_dirs = [], + library_dirs = if cHaveLibGmp == "YES" + then [] + else if installing + then [ clibdir ] + else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ], + hs_libraries = [], + extra_libraries = [ "gmp" ], + include_dirs = [], + c_includes = [], + package_deps = [], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "rts", -- The RTS is just another package! - Package { - import_dirs = [], - library_dirs = [ if installing - then _libdir - else ghc_src_dir _GHC_RUNTIME_DIR ], - libraries = [ "HSrts" ], - include_dir = if installing - then "" - else ghc_src_dir _GHC_INCLUDE_DIR, - c_include = "Stg.h", -- ha! - package_deps = [ "gmp" ], - extra_ghc_opts = "", - extra_cc_opts = "", - -- the RTS forward-references to a bunch of stuff in the prelude, - -- so we force it to be included with special options to ld. - extra_ld_opts = unwords [ - "-u PrelMain_mainIO_closure", - "-u PrelBase_Izh_static_info", - "-u PrelBase_Czh_static_info", - "-u PrelFloat_Fzh_static_info", - "-u PrelFloat_Dzh_static_info", - "-u PrelAddr_Azh_static_info", - "-u PrelAddr_Wzh_static_info", - "-u PrelAddr_I64zh_static_info", - "-u PrelAddr_W64zh_static_info", - "-u PrelStable_StablePtr_static_info", - "-u PrelBase_Izh_con_info", - "-u PrelBase_Czh_con_info", - "-u PrelFloat_Fzh_con_info", - "-u PrelFloat_Dzh_con_info", - "-u PrelAddr_Azh_con_info", - "-u PrelAddr_Wzh_con_info", - "-u PrelAddr_I64zh_con_info", - "-u PrelAddr_W64zh_con_info", - "-u PrelStable_StablePtr_con_info", - "-u PrelBase_False_closure", - "-u PrelBase_True_closure", - "-u PrelPack_unpackCString_closure", - "-u PrelException_stackOverflow_closure", - "-u PrelException_heapOverflow_closure", - "-u PrelException_NonTermination_closure", - "-u PrelException_PutFullMVar_closure", - "-u PrelException_BlockedOnDeadMVar_closure", - "-u PrelWeak_runFinalizzerBatch_closure", - "-u __init_Prelude", - "-u __init_PrelMain" + Package { + name = "rts", -- The RTS is just another package! + import_dirs = [], + library_dirs = if installing + then [ clibdir ] + else [ ghc_src_dir cGHC_RUNTIME_DIR ], + hs_libraries = [ "HSrts" ], + extra_libraries = [ "" ], + include_dirs = if installing + then [ clibdir ++ "/includes" ] + else [ ghc_src_dir cGHC_INCLUDE_DIR ], + c_includes = [ "Stg.h" ], -- ha! + package_deps = [ "gmp" ], + extra_ghc_opts = [], + extra_cc_opts = [], + -- the RTS forward-references to a bunch of stuff in the prelude, + -- so we force it to be included with special options to ld. + extra_ld_opts = map ( +#ifndef LEADING_UNDERSCORE + "-u " +#else + "-u _" +#endif + ++ ) [ + "PrelBase_Izh_static_info" + , "PrelBase_Czh_static_info" + , "PrelFloat_Fzh_static_info" + , "PrelFloat_Dzh_static_info" + , "PrelAddr_Azh_static_info" + , "PrelAddr_Wzh_static_info" + , "PrelAddr_I64zh_static_info" + , "PrelAddr_W64zh_static_info" + , "PrelStable_StablePtr_static_info" + , "PrelBase_Izh_con_info" + , "PrelBase_Czh_con_info" + , "PrelFloat_Fzh_con_info" + , "PrelFloat_Dzh_con_info" + , "PrelAddr_Azh_con_info" + , "PrelAddr_Wzh_con_info" + , "PrelAddr_I64zh_con_info" + , "PrelAddr_W64zh_con_info" + , "PrelStable_StablePtr_con_info" + , "PrelBase_False_closure" + , "PrelBase_True_closure" + , "PrelPack_unpackCString_closure" + , "PrelIOBase_stackOverflow_closure" + , "PrelIOBase_heapOverflow_closure" + , "PrelIOBase_NonTermination_closure" + , "PrelIOBase_PutFullMVar_closure" + , "PrelIOBase_BlockedOnDeadMVar_closure" + , "PrelWeak_runFinalizzerBatch_closure" + , "__init_Prelude" ] - } - ), + }, - ( "std", -- The Prelude & Standard Libraries - Package { - import_dirs = [ if installing - then _libdir ++ "/imports/std" - else ghc_src_dir _GHC_LIB_DIR ++ "/std" ], - library_dirs = if installing - then [ _libdir ] - else [ ghc_src_dir _GHC_LIB_DIR ++ "/std" - , ghc_src_dir _GHC_LIB_DIR ++ "/std/cbits" ], - libraries = [ "HSstd", "HSstd_cbits" ], - include_dir = if installing - then "" - else ghc_src_dir _GHC_LIB_DIR ++ "/std/cbits", - c_include = "HsStd.h", - package_deps = [ "rts" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "-lm" - } - ), + Package { + name = "std", -- The Prelude & Standard Hs_libraries + import_dirs = if installing + then [ clibdir ++ "/imports/std" ] + else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ], + library_dirs = if installing + then [ clibdir ] + else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" + , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ], + hs_libraries = [ "HSstd" ], + extra_libraries = [ "HSstd_cbits" ], + include_dirs = if installing + then [] + else [ ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ], + c_includes = [ "HsStd.h" ], + package_deps = [ "rts" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [ "-lm" +#ifdef mingw32_TARGET_OS + , "-lwsock32" +#endif + ] + }, - ( "lang", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/lang" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/lang" - , _FPTOOLS_TOP_ABS ++ "/hslibs/lang/monads"], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/lang" - , _FPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ], - libraries = [ "HSlang", "HSlang_cbits" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits", - c_include = "HsLang.h", - package_deps = [], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "lang", + import_dirs = if installing + then [ clibdir ++ "/imports/lang" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang" + , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/monads" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang" + , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ], + hs_libraries = [ "HSlang" ], + extra_libraries = [ "HSlang_cbits" ], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ], + c_includes = [ "HsLang.h" ], + package_deps = [], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "concurrent", - Package { - import_dirs = [ if installing - then _libdir ++ "/imports/concurrent" - else _FPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ], - library_dirs = [ if installing - then _libdir - else _FPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ], - libraries = [ "HSconcurrent" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits", - c_include = "HsConcurrent.h", - package_deps = [ "lang" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "concurrent", + import_dirs = if installing + then [ clibdir ++ "/imports/concurrent" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ], + hs_libraries = [ "HSconcurrent" ], + extra_libraries = [], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ], + c_includes = [], + package_deps = [ "lang" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "data", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/data" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/data" - , _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison" - , _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Assoc" - , _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Coll" - , _FPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Seq" ], - library_dirs = if installing - then [_libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/data" ], - libraries = [ "HSdata" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/data/cbits", - c_include = "HsData.h", - package_deps = [ "lang" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "data", + import_dirs = if installing + then [ clibdir ++ "/imports/data" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" + , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison" + , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Assoc" + , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Coll" + , cFPTOOLS_TOP_ABS ++ "/hslibs/data/edison/Seq" ], + library_dirs = if installing + then [clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ], + hs_libraries = [ "HSdata" ], + extra_libraries = [], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ], + c_includes = [], + package_deps = [ "lang" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "net", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/net" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/net" ], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/net" - , _FPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ], - libraries = [ "HSnet", "HSnet_cbits" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/net/cbits", - c_include = "HsNet.h", - package_deps = [ "lang", "text" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = if postfixMatch "solaris2" _TARGETPLATFORM - then "-lnsl -lsocket" - else "" - } - ), + Package { + name = "net", + import_dirs = if installing + then [ clibdir ++ "/imports/net" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" + , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ], + hs_libraries = [ "HSnet" ], + extra_libraries = [ "HSnet_cbits" ], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ], + c_includes = [ "HsNet.h" ], + package_deps = [ "lang", "text" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = if suffixMatch "solaris2" cTARGETPLATFORM + then [ "-lnsl", "-lsocket" ] + else [] + }, - ( "posix", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/posix" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/posix" ], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/posix" - , _FPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ], - libraries = [ "HSposix", "HSposix_cbits" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits", - c_include = "HsPosix.h", - package_deps = [ "lang" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "posix", + import_dirs = if installing + then [ clibdir ++ "/imports/posix" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" + , cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ], + hs_libraries = [ "HSposix" ], + extra_libraries = [ "HSposix_cbits" ], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ], + c_includes = [ "HsPosix.h" ], + package_deps = [ "lang" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "text", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/text" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/text" - , _FPTOOLS_TOP_ABS ++ "/hslibs/text/html" - , _FPTOOLS_TOP_ABS ++ "/hslibs/text/haxml/lib" - , _FPTOOLS_TOP_ABS ++ "/hslibs/text/parsec" ], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/text" - , _FPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ], - libraries = [ "HStext", "HStext_cbits" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/text/cbits", - c_include = "HsText.h", - package_deps = [ "lang", "data" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "text", + import_dirs = if installing + then [ clibdir ++ "/imports/text" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text" + , cFPTOOLS_TOP_ABS ++ "/hslibs/text/html" + , cFPTOOLS_TOP_ABS ++ "/hslibs/text/HaXml/lib" + , cFPTOOLS_TOP_ABS ++ "/hslibs/text/parsec" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text" + , cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ], + hs_libraries = [ "HStext" ], + extra_libraries = [ "HStext_cbits" ], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ], + c_includes = [ "HsText.h" ], + package_deps = [ "lang", "data" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "util", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/util" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/util" - , _FPTOOLS_TOP_ABS ++ "/hslibs/util/check" ], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/util" - , _FPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ], - libraries = [ "HSutil", "HSutil_cbits" ], - include_dir = if installing - then "" - else _FPTOOLS_TOP_ABS ++ "/hslibs/util/cbits", - c_include = "HsUtil.h", - package_deps = ["lang", "concurrent", "posix"], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "" - } - ), + Package { + name = "util", + import_dirs = if installing + then [ clibdir ++ "/imports/util" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util" + , cFPTOOLS_TOP_ABS ++ "/hslibs/util/check" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util" + , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ], + hs_libraries = [ "HSutil" ], + extra_libraries = [ "HSutil_cbits" ], + include_dirs = if installing + then [] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ], + c_includes = [ "HsUtil.h" ], + package_deps = [ "lang", "concurrent" +#ifndef mingw32_TARGET_OS + , "posix" +#endif + ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = words cLibsReadline + }, - ( "win32", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/win32" ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hslibs/win32/src" ], - libraries = [ "HSwin32" ], - include_dir = "", - c_include = "", -- ??? - package_deps = ["lang"], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "-luser32 -lgdi32" - } - ), + -- no cbits at the moment, we'll need to add one if this library + -- ever calls out to any C libs. + Package { + name = "hssource", + import_dirs = if installing + then [ clibdir ++ "/imports/hssource" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ], + hs_libraries = [ "HShssource" ], + extra_libraries = [], + include_dirs = [], + c_includes = [], + package_deps = [ "text" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + }, - ( "com", - Package { - import_dirs = if installing - then [ _libdir ++ "/imports/com" ] - else [ _FPTOOLS_TOP_ABS ++ "/hdirect/lib" ], - library_dirs = if installing - then [ _libdir ] - else [ _FPTOOLS_TOP_ABS ++ "/hdirect/lib" ], - libraries = [ "HScom" ], - include_dir = "", - c_include = "", -- ??? - package_deps = [ "lang" ], - extra_ghc_opts = "", - extra_cc_opts = "", - extra_ld_opts = "-luser32 -lole32 -loleaut32 -ladvapi32" - } - ) - ] + Package { + name = "greencard", + import_dirs = if installing + then [ clibdir ++ "/imports/greencard" ] + else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ], + hs_libraries = [ "HSgreencard" ], + extra_libraries = [], + include_dirs = [], + c_includes = [], + package_deps = [], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [], + }, -ghc_src_dir path = _FPTOOLS_TOP_ABS ++ '/':_CURRENT_DIR ++ '/':path + Package { + name = "win32", + import_dirs = if installing + then [ clibdir ++ "/imports/win32" ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ], + hs_libraries = [ "HSwin32" ], + extra_libraries = [], + include_dirs = [], + c_includes = [], -- ??? + package_deps = [ "lang", "greencard" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [ "-luser32", "-lgdi32" ] + }, -prefixMatch :: Eq a => [a] -> [a] -> Bool -prefixMatch [] str = True -prefixMatch pat [] = False -prefixMatch (p:ps) (s:ss) | p == s = prefixMatch ps ss - | otherwise = False + Package { + name = "com", + import_dirs = if installing + then [ clibdir ++ "/imports/com" ] + else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ], + library_dirs = if installing + then [ clibdir ] + else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ], + hs_libraries = [ "HScom" ], + extra_libraries = [], + include_dirs = [], + c_includes = [], -- ??? + package_deps = [ "lang" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [ "-luser32", "-lole32", "-loleaut32", "-ladvapi32" ] + } + ] -postfixMatch :: String -> String -> Bool -postfixMatch pat str = prefixMatch (reverse pat) (reverse str) +ghc_src_dir :: String -> String +ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path