X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Fmain%2FPackages.lhs;h=505a797c72bff94a73837c398015f9bc8a34578d;hb=d436c70d43fb905c63220040168295e473f4b90a;hp=edeb9fe8caf2324da285df95b8bd5608c064a9c5;hpb=d21cf8c349a332b2900f13779ba0a8856b5f034a;p=ghc-hetmet.git diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs index edeb9fe..505a797 100644 --- a/compiler/main/Packages.lhs +++ b/compiler/main/Packages.lhs @@ -26,6 +26,7 @@ module Packages ( getPreloadPackagesAnd, collectIncludeDirs, collectLibraryPaths, collectLinkOpts, + packageHsLibs, -- * Utils isDllName @@ -49,9 +50,7 @@ import Outputable import System.Environment ( getEnv ) import Distribution.InstalledPackageInfo hiding (depends) -import Distribution.Package hiding (depends) -import Distribution.Text -import Distribution.Version +import Distribution.Package hiding (depends, PackageId) import FastString import ErrUtils ( debugTraceMsg, putMsg, Message ) import Exception @@ -90,7 +89,7 @@ import Data.List -- program depends on (the compiler knows this list by the -- time it gets to the link step). Also, we link in all packages -- which were mentioned with preload @-package@ flags on the command-line, --- or are a transitive dependency of same, or are \"base\"/\"rts\". +-- or are a transitive dependency of same, or are \"base\"\/\"rts\". -- The reason for this is that we might need packages which don't -- contain any Haskell modules, and therefore won't be discovered -- by the normal mechanism of dependency tracking. @@ -391,8 +390,7 @@ findWiredInPackages dflags pkgs preload this_package = do (haskell98PackageId, [""]), (thPackageId, [""]), (dphSeqPackageId, [""]), - (dphParPackageId, [""]), - (ndpPackageId, ["-seq", "-par"]) ] + (dphParPackageId, [""])] matches :: PackageConfig -> (PackageId, [String]) -> Bool pc `matches` (pid, suffixes) @@ -413,11 +411,9 @@ findWiredInPackages dflags pkgs preload this_package = do -> IO (Maybe (PackageIdentifier, PackageId)) findWiredInPackage pkgs wired_pkg = let all_ps = [ p | p <- pkgs, p `matches` wired_pkg ] in - case filter exposed all_ps of - [] -> case all_ps of - [] -> notfound - many -> pick (head (sortByVersion many)) - many -> pick (head (sortByVersion many)) + case all_ps of + [] -> notfound + many -> pick (head (sortByVersion many)) where suffixes = snd wired_pkg notfound = do @@ -444,9 +440,18 @@ findWiredInPackages dflags pkgs preload this_package = do let wired_in_ids = catMaybes mb_wired_in_ids - deleteOtherWiredInPackages pkgs = filterOut bad pkgs - where bad p = any (p `matches`) wired_in_pkgids - && package p `notElem` map fst wired_in_ids + -- this is old: we used to assume that if there were + -- multiple versions of wired-in packages installed that + -- they were mutually exclusive. Now we're assuming that + -- you have one "main" version of each wired-in package + -- (the latest version), and the others are backward-compat + -- wrappers that depend on this one. e.g. base-4.0 is the + -- latest, base-3.0 is a compat wrapper depending on base-4.0. + {- + deleteOtherWiredInPackages pkgs = filterOut bad pkgs + where bad p = any (p `matches`) wired_in_pkgids + && package p `notElem` map fst wired_in_ids + -} updateWiredInDependencies pkgs = map upd_pkg pkgs where upd_pkg p = p{ package = upd_pid (package p), @@ -457,9 +462,9 @@ findWiredInPackages dflags pkgs preload this_package = do ((x, y):_) -> x{ pkgName = PackageName (packageIdString y), pkgVersion = Version [] [] } - pkgs1 = deleteOtherWiredInPackages pkgs + -- pkgs1 = deleteOtherWiredInPackages pkgs - pkgs2 = updateWiredInDependencies pkgs1 + pkgs2 = updateWiredInDependencies pkgs preload1 = map upd_pid preload @@ -633,14 +638,17 @@ getPackageLinkOpts dflags pkgs = collectLinkOpts :: DynFlags -> [PackageConfig] -> [String] collectLinkOpts dflags ps = concat (map all_opts ps) where + libs p = packageHsLibs dflags p ++ extraLibraries p + all_opts p = map ("-l" ++) (libs p) ++ ldOptions p + +packageHsLibs :: DynFlags -> PackageConfig -> [String] +packageHsLibs dflags p = map (mkDynName . addSuffix) (hsLibraries p) + where tag = buildTag dflags rts_tag = rtsBuildTag dflags mkDynName | opt_Static = id | otherwise = (++ ("-ghc" ++ cProjectVersion)) - libs p = map (mkDynName . addSuffix) (hsLibraries p) - ++ extraLibraries p - all_opts p = map ("-l" ++) (libs p) ++ ldOptions p addSuffix rts@"HSrts" = rts ++ (expandTag rts_tag) addSuffix other_lib = other_lib ++ (expandTag tag)