X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdriver%2FPackageSrc.hs;h=11b4cbf7cbe823f97d08aa49161fa4a89ab47fe9;hb=35ef279adf79818085e3a2fb407dc52ec723786f;hp=81b963b779aecb6fd6dff6e571ae77d07aad07b6;hpb=6a7b4975f302561440f7202b9042390a0aef8db4;p=ghc-hetmet.git diff --git a/ghc/driver/PackageSrc.hs b/ghc/driver/PackageSrc.hs index 81b963b..11b4cbf 100644 --- a/ghc/driver/PackageSrc.hs +++ b/ghc/driver/PackageSrc.hs @@ -6,28 +6,45 @@ 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) + +-- The compiler automatically replaces the string "$libdir" at the +-- beginning of a path with the directory passed to the compiler via +-- the -B flag. Absolute path names will be unchanged. +-- +-- This is how we make package.conf independent of GHC's installation +-- location. + +package_details :: Bool -> [String] -> [PackageConfig] +package_details installing + [ cTARGETPLATFORM + , cCURRENT_DIR + , cHaveLibGmp + , cLibsReadline + , cGHC_LIB_DIR + , cGHC_RUNTIME_DIR + , cGHC_UTILS_DIR + , cGHC_INCLUDE_DIR + ] = -package_details :: Bool -> [Package] -package_details installing = [ Package { name = "gmp", -- GMP is at the bottom of the heap import_dirs = [], + source_dirs = [], library_dirs = if cHaveLibGmp == "YES" then [] else if installing - then [ clibdir ] + then [ "$libdir" ] else [ ghc_src_dir cGHC_RUNTIME_DIR ++ "/gmp" ], hs_libraries = [], extra_libraries = [ "gmp" ], @@ -42,17 +59,22 @@ package_details installing = Package { name = "rts", -- The RTS is just another package! import_dirs = [], + source_dirs = [], library_dirs = if installing - then [ clibdir ] + then [ "$libdir" ] else [ ghc_src_dir cGHC_RUNTIME_DIR ], hs_libraries = [ "HSrts" ], #ifndef mingw32_TARGET_OS extra_libraries = [], #else - extra_libraries = [ "winmm" ], -- for the threadDelay timer + extra_libraries = [ "winmm", "wsock32" ], -- winmm for the threadDelay timer, wsock32 for the linker #endif include_dirs = if installing - then [ clibdir ++ "/includes" ] + then [ "$libdir/include" +#ifdef mingw32_TARGET_OS + , "$libdir/include/mingw" +#endif + ] else [ ghc_src_dir cGHC_INCLUDE_DIR ], c_includes = [ "Stg.h" ], -- ha! package_deps = [ "gmp" ], @@ -94,7 +116,6 @@ package_details installing = , "PrelIOBase_stackOverflow_closure" , "PrelIOBase_heapOverflow_closure" , "PrelIOBase_NonTermination_closure" - , "PrelIOBase_PutFullMVar_closure" , "PrelIOBase_BlockedOnDeadMVar_closure" , "PrelWeak_runFinalizzerBatch_closure" , "__init_Prelude" @@ -104,18 +125,30 @@ package_details installing = Package { name = "std", -- The Prelude & Standard Hs_libraries import_dirs = if installing - then [ clibdir ++ "/imports/std" ] + then [ "$libdir/imports/std" ] else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] + then [ "$libdir" ] else [ ghc_src_dir cGHC_LIB_DIR ++ "/std" , ghc_src_dir cGHC_LIB_DIR ++ "/std/cbits" ], - hs_libraries = [ "HSstd" ], + + hs_libraries = +# ifndef mingw32_TARGET_OS + [ "HSstd" ] +# else + -- This splitting is the subject of a totally + -- horrible hack, which glues HSstd1 and HSstd2 + -- back into HSstd for the purposes of static linking. + -- See DriverState.getPackageLibraries for details. + [ "HSstd1", "HSstd2" ] +# endif + , extra_libraries = [ "HSstd_cbits" ] ++ # ifdef mingw32_TARGET_OS - ["wsock32"] + [ "wsock32", "msvcrt" ] # else - ["m"] -- libm, that is + [ "m" ] -- libm, that is # endif , include_dirs = if installing @@ -131,18 +164,19 @@ package_details installing = Package { name = "lang", import_dirs = if installing - then [ clibdir ++ "/imports/lang" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang" - , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/monads" ], + then [ "$libdir/imports/lang" ] + else [ "$libdir/hslibs/lang" + , "$libdir/hslibs/lang/monads" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang" - , cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/lang" + , "$libdir/hslibs/lang/cbits" ], hs_libraries = [ "HSlang" ], extra_libraries = [ "HSlang_cbits" ], include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/lang/cbits" ], + else [ "$libdir/hslibs/lang/cbits" ], c_includes = [ "HsLang.h" ], package_deps = [], extra_ghc_opts = [], @@ -159,16 +193,17 @@ package_details installing = Package { name = "concurrent", import_dirs = if installing - then [ clibdir ++ "/imports/concurrent" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ], + then [ "$libdir/imports/concurrent" ] + else [ "$libdir/hslibs/concurrent" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/concurrent" ], hs_libraries = [ "HSconcurrent" ], extra_libraries = [], include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/concurrent/cbits" ], + else [ "$libdir/hslibs/concurrent/cbits" ], c_includes = [], package_deps = [ "lang" ], extra_ghc_opts = [], @@ -179,20 +214,21 @@ package_details installing = 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" ], + then [ "$libdir/imports/data" ] + else [ "$libdir/hslibs/data" + , "$libdir/hslibs/data/edison" + , "$libdir/hslibs/data/edison/Assoc" + , "$libdir/hslibs/data/edison/Coll" + , "$libdir/hslibs/data/edison/Seq" ], + source_dirs = [], library_dirs = if installing - then [clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/data" ], hs_libraries = [ "HSdata" ], extra_libraries = [], include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/data/cbits" ], + else [ "$libdir/hslibs/data/cbits" ], c_includes = [], package_deps = [ "lang", "util" ], extra_ghc_opts = [], @@ -203,21 +239,21 @@ package_details installing = Package { name = "net", import_dirs = if installing - then [ clibdir ++ "/imports/net" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" ], + then [ "$libdir/imports/net" ] + else [ "$libdir/hslibs/net" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net" - , cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/net" + , "$libdir/hslibs/net/cbits" ], hs_libraries = [ "HSnet" ], - extra_libraries = [ "HSnet_cbits" ] - ++ if suffixMatch "solaris2" cTARGETPLATFORM + extra_libraries = if suffixMatch "solaris2" cTARGETPLATFORM then [ "nsl", "socket" ] else [] , include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/net/cbits" ], + else [ "$libdir/hslibs/net/cbits" ], c_includes = [ "HsNet.h" ], package_deps = [ "lang", "text", "concurrent" ], extra_ghc_opts = [], @@ -228,17 +264,18 @@ package_details installing = Package { name = "posix", import_dirs = if installing - then [ clibdir ++ "/imports/posix" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" ], + then [ "$libdir/imports/posix" ] + else [ "$libdir/hslibs/posix" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix" - , cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/posix" + , "$libdir/hslibs/posix/cbits" ], hs_libraries = [ "HSposix" ], extra_libraries = [ "HSposix_cbits" ], include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/posix/cbits" ], + else [ "$libdir/hslibs/posix/cbits" ], c_includes = [ "HsPosix.h" ], package_deps = [ "lang" ], extra_ghc_opts = [], @@ -249,20 +286,21 @@ package_details installing = 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" ], + then [ "$libdir/imports/text" ] + else [ "$libdir/hslibs/text" + , "$libdir/hslibs/text/html" + , "$libdir/hslibs/text/HaXml/lib" + , "$libdir/hslibs/text/parsec" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text" - , cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/text" + , "$libdir/hslibs/text/cbits" ], hs_libraries = [ "HStext" ], extra_libraries = [ "HStext_cbits" ], include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/text/cbits" ], + else [ "$libdir/hslibs/text/cbits" ], c_includes = [ "HsText.h" ], package_deps = [ "lang" ], extra_ghc_opts = [], @@ -273,18 +311,23 @@ package_details installing = Package { name = "util", import_dirs = if installing - then [ clibdir ++ "/imports/util" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util" - , cFPTOOLS_TOP_ABS ++ "/hslibs/util/check" ], + then [ "$libdir/imports/util" ] + else [ "$libdir/hslibs/util" + , "$libdir/hslibs/util/check" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util" - , cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/util" + , "$libdir/hslibs/util/cbits" ], hs_libraries = [ "HSutil" ], - extra_libraries = [ "HSutil_cbits" ], + extra_libraries = [ "HSutil_cbits" ] +#ifndef mingw32_TARGET_OS + ++ words cLibsReadline +#endif + , include_dirs = if installing then [] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/util/cbits" ], + else [ "$libdir/hslibs/util/cbits" ], c_includes = [ "HsUtil.h" ], package_deps = [ "lang", "concurrent" #ifndef mingw32_TARGET_OS @@ -293,7 +336,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 @@ -301,11 +344,12 @@ package_details installing = Package { name = "hssource", import_dirs = if installing - then [ clibdir ++ "/imports/hssource" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ], + then [ "$libdir/imports/hssource" ] + else [ "$libdir/hslibs/hssource" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/hssource" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/hssource" ], hs_libraries = [ "HShssource" ], extra_libraries = [], include_dirs = [], @@ -319,11 +363,12 @@ package_details installing = Package { name = "greencard", import_dirs = if installing - then [ clibdir ++ "/imports/greencard" ] - else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ], + then [ "$libdir/imports/greencard" ] + else [ "$libdir/green-card/lib/ghc" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/green-card/lib/ghc" ], + then [ "$libdir" ] + else [ "$libdir/green-card/lib/ghc" ], hs_libraries = [ "HSgreencard" ], extra_libraries = [], include_dirs = [], @@ -332,16 +377,18 @@ 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" ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ], + then [ "$libdir/imports/win32" ] + else [ "$libdir/hslibs/win32" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hslibs/win32" ], + then [ "$libdir" ] + else [ "$libdir/hslibs/win32" ], hs_libraries = [ "HSwin32" ], extra_libraries = [ "user32", "gdi32", "winmm" ], include_dirs = [], @@ -355,11 +402,12 @@ package_details installing = Package { name = "com", import_dirs = if installing - then [ clibdir ++ "/imports/com" ] - else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ], + then [ "$libdir/imports/com" ] + else [ "$libdir/hdirect/lib" ], + source_dirs = [], library_dirs = if installing - then [ clibdir ] - else [ cFPTOOLS_TOP_ABS ++ "/hdirect/lib" ], + then [ "$libdir" ] + else [ "$libdir/hdirect/lib" ], hs_libraries = [ "HScom" ], extra_libraries = [ "user32", "ole32", "oleaut32", "advapi32" ], include_dirs = [], @@ -369,7 +417,48 @@ package_details installing = extra_cc_opts = [], extra_ld_opts = [] } - ] +#endif + + ,Package { + name = "xlib", + import_dirs = if installing + then [ "$libdir/imports/xlib" ] + else [ "$libdir/hslibs/xlib" ], + source_dirs = [], + library_dirs = if installing + then [ "$libdir" ] + else [ "$libdir/hslibs/xlib" + , "$libdir/hslibs/xlib/cbits" ], + hs_libraries = [ "HSxlib" ], + extra_libraries = [ "HSxlib_cbits", "X11" ], + include_dirs = if installing + then [] + else [ "$libdir/hslibs/xlib/cbits" ], + c_includes = [ "HsXlib.h" ], + package_deps = [ "greencard" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + } -ghc_src_dir :: String -> String -ghc_src_dir path = cFPTOOLS_TOP_ABS ++ '/':cCURRENT_DIR ++ '/':path + ,Package { + name = "HGL", + import_dirs = if installing + then [ "$libdir/imports/HGL" ] + else [ "$libdir/hslibs/graphics/lib/x11" ], + source_dirs = [], + library_dirs = [], + hs_libraries = [ "HSHGL" ], + extra_libraries= [], + include_dirs = [], + c_includes = [], + package_deps = [ "xlib", "concurrent" ], + extra_ghc_opts = [], + extra_cc_opts = [], + extra_ld_opts = [] + } + + ] + where + ghc_src_dir :: String -> String + ghc_src_dir path = "$libdir/" ++ cCURRENT_DIR ++ '/':path