diff options
author | Ian Lynagh <igloo@earth.li> | 2007-04-24 21:31:27 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2007-04-24 21:31:27 +0000 |
commit | 98d48f5de4e052652038710310e49ba95be4bfe3 (patch) | |
tree | 3311f2212004cdc585841a04bcfed16c2e9573e6 /libraries/base/Setup.hs | |
parent | d961dd89da8236c118247bd860312132af5440b0 (diff) | |
download | haskell-98d48f5de4e052652038710310e49ba95be4bfe3.tar.gz |
Add extra libraries when compiling with GHC on Windows
Diffstat (limited to 'libraries/base/Setup.hs')
-rw-r--r-- | libraries/base/Setup.hs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libraries/base/Setup.hs b/libraries/base/Setup.hs index 8064d7826b..d080b2a095 100644 --- a/libraries/base/Setup.hs +++ b/libraries/base/Setup.hs @@ -13,6 +13,7 @@ import Distribution.PackageDescription import Distribution.Setup import Distribution.Simple.LocalBuildInfo import System.Environment +import System.Info main :: IO () main = do args <- getArgs @@ -27,8 +28,10 @@ main = do args <- getArgs $ filter_modules_hook $ buildHook defaultUserHooks, makefileHook = add_ghc_options ghcArgs - $ filter_modules_hook - $ makefileHook defaultUserHooks, + $ filter_modules_hook + $ makefileHook defaultUserHooks, + regHook = add_extra_libs + $ regHook defaultUserHooks, instHook = filter_modules_hook $ instHook defaultUserHooks } withArgs args'' $ defaultMainWithHooks hooks @@ -116,3 +119,21 @@ add_extra_deps f pd cf _ -> return lbi +add_extra_libs :: Hook a -> Hook a +add_extra_libs f pd lbi uhs x + = let pd' = if (os == "mingw32") && (compilerFlavor (compiler lbi) == GHC) + then case library pd of + Just lib -> + let lib_bi = libBuildInfo lib + lib_bi' = lib_bi { extraLibs = "wsock32" + : "msvcrt" + : "kernel32" + : "user32" + : "shell32" + : extraLibs lib_bi } + lib' = lib { libBuildInfo = lib_bi' } + in pd { library = Just lib' } + Nothing -> error "Expected a library" + else pd + in f pd' lbi uhs x + |