X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FPackages.lhs;h=9904fdf609a82fb1d5348dec94d330c566d0dd30;hb=d5b1999089dd4a45cf872f88dd0d49e1207a3161;hp=078b84c5f2fb0857a5fda97919f9f70580758206;hpb=aa2ce971940119b46a7915e88402ae6d3a615ba4;p=ghc-hetmet.git diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs index 078b84c..9904fdf 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, @@ -520,7 +527,11 @@ mkPackageState dflags orig_pkg_db preload0 this_package = do -- add base & rts to the preload packages basicLinkedPackages = filter (flip elemUFM pkg_db) [basePackageId,rtsPackageId] - preload2 = nub (basicLinkedPackages ++ map mkPackageId preload1) + -- but in any case remove the current package from the set of + -- preloaded packages so that base/rts does not end up in the + -- set up preloaded package when we are just building it + preload2 = nub (filter (/= new_this_pkg) + (basicLinkedPackages ++ map mkPackageId preload1)) -- Close the preload packages with their dependencies dep_preload <- closeDeps pkg_db (zip preload2 (repeat Nothing)) @@ -588,26 +599,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 ++ rts_suffix - addSuffix other_lib = other_lib ++ suffix + addSuffix rts@"HSrts" = rts ++ (expandTag rts_tag) + addSuffix other_lib = other_lib ++ (expandTag tag) - -- 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))