[commit: packages/Cabal] ghc-head: Pass linker options when loading *libraries* in GHCi. (a3bbf4c)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:31:40 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=a3bbf4cc352297ae22ad5dd219b64cf949898859

>---------------------------------------------------------------

commit a3bbf4cc352297ae22ad5dd219b64cf949898859
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Mon Aug 26 09:18:14 2013 +0200

    Pass linker options when loading *libraries* in GHCi.
    
    Fixes #1439. See also #1435, which fixed this for executables.


>---------------------------------------------------------------

a3bbf4cc352297ae22ad5dd219b64cf949898859
 Cabal/Distribution/Simple/GHC.hs |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs
index 7c75bbc..b572fcf 100644
--- a/Cabal/Distribution/Simple/GHC.hs
+++ b/Cabal/Distribution/Simple/GHC.hs
@@ -704,7 +704,8 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do
   createDirectoryIfMissingVerbose verbosity True libTargetDir
   -- TODO: do we need to put hs-boot files into place for mutually recursive
   -- modules?
-  let baseOpts    = componentGhcOptions verbosity lbi libBi clbi libTargetDir
+  let cObjs       = map (`replaceExtension` objExtension) (cSources libBi)
+      baseOpts    = componentGhcOptions verbosity lbi libBi clbi libTargetDir
       vanillaOpts = baseOpts `mappend` mempty {
                       ghcOptMode         = toFlag GhcModeMake,
                       ghcOptPackageName  = toFlag pkgid,
@@ -725,11 +726,18 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do
                       ghcOptObjSuffix   = toFlag "dyn_o",
                       ghcOptExtra       = ghcSharedOptions libBi
                     }
-
+      linkerOpts = mempty {
+                      ghcOptLinkOptions    = PD.ldOptions libBi,
+                      ghcOptLinkLibs       = extraLibs libBi,
+                      ghcOptLinkLibPath    = extraLibDirs libBi,
+                      ghcOptLinkFrameworks = PD.frameworks libBi,
+                      ghcOptInputFiles     = [pref </> x | x <- cObjs]
+                   }
       replOpts    = vanillaOpts {
                       ghcOptExtra        = filterGhciFlags
                                            (ghcOptExtra vanillaOpts)
                     }
+                    `mappend` linkerOpts
                     `mappend` mempty {
                       ghcOptMode         = toFlag GhcModeInteractive,
                       ghcOptOptimisation = toFlag GhcNoOptimisation
@@ -785,8 +793,7 @@ buildOrReplLib forRepl verbosity pkg_descr lbi lib clbi = do
 
   -- link:
   info verbosity "Linking..."
-  let cObjs       = map (`replaceExtension` objExtension) (cSources libBi)
-      cProfObjs   = map (`replaceExtension` ("p_" ++ objExtension))
+  let cProfObjs   = map (`replaceExtension` ("p_" ++ objExtension))
                     (cSources libBi)
       cSharedObjs = map (`replaceExtension` ("dyn_" ++ objExtension))
                     (cSources libBi)





More information about the ghc-commits mailing list