X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FPackages.lhs;h=a59e60ce50a2acfb7645118d943e8af9b3cafee1;hb=d5036717526fdd27f6a1c770fd19a6090af60254;hp=fb54a1291fbf6cca5fc7f8c146533c348820ae64;hpb=046ee54f048ddd721dcee41916d6a6f68db3b15b;p=ghc-hetmet.git diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs index fb54a12..a59e60c 100644 --- a/compiler/main/Packages.lhs +++ b/compiler/main/Packages.lhs @@ -4,6 +4,13 @@ % Package manipulation % \begin{code} +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module Packages ( module PackageConfig, @@ -107,9 +114,6 @@ import Control.Exception ( throwDyn ) -- in a different DLL, by setting the DLL flag. data PackageState = PackageState { - origPkgIdMap :: PackageConfigMap, -- PackageId -> PackageConfig - -- The on-disk package database - pkgIdMap :: PackageConfigMap, -- PackageId -> PackageConfig -- The exposed flags are adjusted according to -package and -- -hide-package flags, and -ignore-package removes packages. @@ -167,7 +171,8 @@ initPackages dflags = do Just db -> return db (pkg_state, preload, this_pkg) <- mkPackageState dflags pkg_db [] (thisPackage dflags) - return (dflags{ pkgState = pkg_state, + return (dflags{ pkgDatabase = Just pkg_db, + pkgState = pkg_state, thisPackage = this_pkg }, preload) @@ -375,7 +380,8 @@ findWiredInPackages dflags pkgs preload this_package = do wired_in_pkgids = [ basePackageId, rtsPackageId, haskell98PackageId, - thPackageId ] + thPackageId, + ndpPackageId ] wired_in_names = map packageIdString wired_in_pkgids @@ -528,7 +534,6 @@ mkPackageState dflags orig_pkg_db preload0 this_package = do let new_dep_preload = filter (`notElem` preload0) dep_preload let pstate = PackageState{ preloadPackages = dep_preload, - origPkgIdMap = orig_pkg_db, pkgIdMap = pkg_db, moduleToPkgConfAll = mkModuleMap pkg_db } @@ -590,26 +595,17 @@ getPackageLinkOpts dflags pkgs = do let tag = buildTag dflags rts_tag = rtsBuildTag dflags let - imp = if opt_Static then "" else "_dyn" - libs p = map ((++imp) . addSuffix) (hsLibraries p) - ++ hACK_dyn (extraLibraries p) + 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 - suffix = if null tag then "" else '_':tag - rts_suffix = if null rts_tag then "" else '_':rts_tag + addSuffix rts@"HSrts" = rts ++ (expandTag rts_tag) + addSuffix other_lib = other_lib ++ (expandTag tag) - addSuffix rts@"HSrts" = rts ++ rts_suffix - addSuffix other_lib = other_lib ++ suffix - - -- This is a hack that's even more horrible (and hopefully more temporary) - -- than the one below [referring to previous splittage of HSbase into chunks - -- to work around GNU ld bug]. HSbase_cbits and friends require the _dyn suffix - -- for dynamic linking, but not _p or other 'way' suffix. So we just add - -- _dyn to extraLibraries if they already have a _cbits suffix. - - hACK_dyn = map hack - where hack lib | not opt_Static && "_cbits" `isSuffixOf` lib = lib ++ "_dyn" - | otherwise = lib + expandTag t | null t = "" + | otherwise = '_':t return (concat (map all_opts ps))