[commit: ghc] master: Make 'ghc' a wired in package. (bb06e2a)

git at git.haskell.org git at git.haskell.org
Mon Jul 21 09:56:25 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/bb06e2a8ae38f0fcfbd2cdfa1f42dfa1e252c939/ghc

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

commit bb06e2a8ae38f0fcfbd2cdfa1f42dfa1e252c939
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Sat Jul 19 16:24:59 2014 +0100

    Make 'ghc' a wired in package.
    
    Summary:
    Previously, the GHC API was "semi" wired-in: it was installed with a
    version number, but that version number was hard-coded into the compiler
    and it wasn't really possible to install other copies of the GHC API.
    This patch makes the GHC API more similar to existing wired-in packages
    such as ghc-prim, and will be helpful when we start extending the amount
    of information passed to -package-name.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: simonmar, simonpj, hvr, austin
    
    Subscribers: simonmar, relrod, carter
    
    Differential Revision: https://phabricator.haskell.org/D78


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

bb06e2a8ae38f0fcfbd2cdfa1f42dfa1e252c939
 compiler/basicTypes/Module.lhs | 2 +-
 compiler/ghc.cabal.in          | 7 +++++++
 compiler/main/Packages.lhs     | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/compiler/basicTypes/Module.lhs b/compiler/basicTypes/Module.lhs
index 080ae47..bd2d119 100644
--- a/compiler/basicTypes/Module.lhs
+++ b/compiler/basicTypes/Module.lhs
@@ -367,7 +367,7 @@ rtsPackageId         = fsToPackageId (fsLit "rts")
 thPackageId          = fsToPackageId (fsLit "template-haskell")
 dphSeqPackageId      = fsToPackageId (fsLit "dph-seq")
 dphParPackageId      = fsToPackageId (fsLit "dph-par")
-thisGhcPackageId     = fsToPackageId (fsLit ("ghc-" ++ cProjectVersion))
+thisGhcPackageId     = fsToPackageId (fsLit "ghc")
 interactivePackageId = fsToPackageId (fsLit "interactive")
 
 -- | This is the package Id for the current program.  It is the default
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index e6f86c9..838a908 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -104,6 +104,13 @@ Library
 
     Include-Dirs: . parser utils
 
+    if impl( ghc >= 7.9 )
+        -- We need to set the package name to ghc (without a version number)
+        -- as it's magic.  But we can't set it for old versions of GHC (e.g.
+        -- when bootstrapping) because those versions of GHC don't understand
+        -- that GHC is wired-in.
+        GHC-Options: -package-name ghc
+
     if flag(stage1)
         Include-Dirs: stage1
     else
diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs
index bb2e048..360519e 100644
--- a/compiler/main/Packages.lhs
+++ b/compiler/main/Packages.lhs
@@ -481,6 +481,7 @@ findWiredInPackages dflags pkgs = do
                             basePackageId,
                             rtsPackageId,
                             thPackageId,
+                            thisGhcPackageId,
                             dphSeqPackageId,
                             dphParPackageId ]
 



More information about the ghc-commits mailing list