[commit: ghc] master: Update Cabal (eabd61a)

Ian Lynagh igloo at earth.li
Tue Mar 12 01:43:59 CET 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/eabd61a476cfe6d546360cd5d0ab0074282a19f7

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

commit eabd61a476cfe6d546360cd5d0ab0074282a19f7
Author: Ian Lynagh <ian at well-typed.com>
Date:   Mon Mar 11 20:12:36 2013 +0000

    Update Cabal

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

 libraries/Cabal             |  2 +-
 rules/build-package-data.mk | 13 ++++++-------
 utils/ghc-cabal/Main.hs     | 33 ++++++++++++++++++++-------------
 utils/ghc-cabal/ghc.mk      |  2 +-
 utils/ghctags/Main.hs       |  9 ++++++---
 5 files changed, 34 insertions(+), 25 deletions(-)

diff --git a/libraries/Cabal b/libraries/Cabal
index 7e2bdc3..24bdc9b 160000
--- a/libraries/Cabal
+++ b/libraries/Cabal
@@ -1 +1 @@
-Subproject commit 7e2bdc37dbb3c6bafc0287e93fd922360818cda1
+Subproject commit 24bdc9b8862d228656ea2b5b0bd6307cb985819e
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 0380f7c..bcd863f 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -18,8 +18,14 @@ $(call profStart, build-package-data($1,$2,$3))
 # $2 = distdir
 # $3 = GHC stage to use (0 == bootstrapping compiler)
 
+$1_$2_CONFIGURE_OPTS += --disable-library-for-ghci
 ifeq "$$(filter v,$$($1_$2_WAYS))" "v"
 $1_$2_CONFIGURE_OPTS += --enable-library-vanilla
+ifeq "$$(GhcWithInterpreter)" "YES"
+ifneq "$$(DYNAMIC_BY_DEFAULT)" "YES"
+$1_$2_CONFIGURE_OPTS += --enable-library-for-ghci
+endif
+endif
 else
 $1_$2_CONFIGURE_OPTS += --disable-library-vanilla
 endif
@@ -36,13 +42,6 @@ else
 $1_$2_CONFIGURE_OPTS += --disable-shared
 endif
 
-$1_$2_CONFIGURE_OPTS += --disable-library-for-ghci
-ifeq "$$(GhcWithInterpreter)" "YES"
-ifneq "$$(DYNAMIC_BY_DEFAULT)" "YES"
-$1_$2_CONFIGURE_OPTS += --enable-library-for-ghci
-endif
-endif
-
 ifeq "$$(HSCOLOUR_SRCS)" "YES"
 $1_$2_CONFIGURE_OPTS += --with-hscolour="$$(HSCOLOUR_CMD)"
 endif
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index 6878afe..3ecae9b 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -218,18 +218,15 @@ doRegister ghc ghcpkg topdir directory distDir
             let Just ghcPkgProg = lookupProgram ghcPkgProgram' progs'
             instInfos <- dump verbosity ghcPkgProg GlobalPackageDB
             let installedPkgs' = PackageIndex.fromList instInfos
-            let mlc = libraryConfig lbi
-                mlc' = case mlc of
-                       Just lc ->
-                           let cipds = componentPackageDeps lc
-                               cipds' = [ (fixupPackageId instInfos ipid, pid)
-                                        | (ipid,pid) <- cipds ]
-                           in Just $ lc {
-                                         componentPackageDeps = cipds'
-                                     }
-                       Nothing -> Nothing
+            let updateComponentConfig (cn, clbi, deps)
+                    = (cn, updateComponentLocalBuildInfo clbi, deps)
+                updateComponentLocalBuildInfo (ComponentLocalBuildInfo cpds)
+                    = ComponentLocalBuildInfo
+                          [ (fixupPackageId instInfos ipid, pid)
+                          | (ipid,pid) <- cpds ]
+                ccs' = map updateComponentConfig (componentsConfigs lbi)
                 lbi' = lbi {
-                               libraryConfig = mlc',
+                               componentsConfigs = ccs',
                                installedPkgs = installedPkgs',
                                installDirTemplates = idts,
                                withPrograms = progs'
@@ -309,8 +306,13 @@ generate config_args distdir directory
       -- generate Paths_<pkg>.hs and cabal-macros.h
       writeAutogenFiles verbosity pd lbi
 
+      let findLibraryConfig []                         = Nothing
+          findLibraryConfig ((CLibName, clbi, _) :  _) = Just clbi
+          findLibraryConfig (_                   : xs) = findLibraryConfig xs
+          mLibraryConfig = findLibraryConfig (componentsConfigs lbi)
+
       -- generate inplace-pkg-config
-      case (library pd, libraryConfig lbi) of
+      case (library pd, mLibraryConfig) of
           (Nothing, Nothing) -> return ()
           (Just lib, Just clbi) -> do
               cwd <- getCurrentDirectory
@@ -323,7 +325,12 @@ generate config_args distdir directory
                               }
                   content = Installed.showInstalledPackageInfo final_ipi ++ "\n"
               writeFileAtomic (distdir </> "inplace-pkg-config") (BS.pack $ toUTF8 content)
-          _ -> error "Inconsistent lib components; can't happen?"
+          (Just _, Nothing) ->
+              -- There is a library, but we aren't building it
+              -- Happens e.g. with haddock, which has both a library
+              -- and executable in its .cabal file.
+              return ()
+          (Nothing, Just _) -> die ["Library local build info, but no library in package description"]
 
       let
           libBiModules lib = (libBuildInfo lib, libModules lib)
diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
index c80c4ef..bb0a35e 100644
--- a/utils/ghc-cabal/ghc.mk
+++ b/utils/ghc-cabal/ghc.mk
@@ -14,7 +14,7 @@
 
 # Euch, hideous hack:
 # XXX This should be in a different Makefile
-CABAL_DOTTED_VERSION := $(shell grep "^Version:" libraries/Cabal/Cabal/Cabal.cabal | sed "s/^Version: //")
+CABAL_DOTTED_VERSION := $(shell grep "^version:" libraries/Cabal/Cabal/Cabal.cabal | sed "s/^version: //")
 CABAL_VERSION := $(subst .,$(comma),$(CABAL_DOTTED_VERSION))
 CABAL_CONSTRAINT := --constraint="Cabal == $(CABAL_DOTTED_VERSION)"
 
diff --git a/utils/ghctags/Main.hs b/utils/ghctags/Main.hs
index 514f299..a4cb302 100644
--- a/utils/ghctags/Main.hs
+++ b/utils/ghctags/Main.hs
@@ -18,13 +18,12 @@ import FastString
 import MonadUtils       ( liftIO )
 import SrcLoc
 
--- Every GHC comes with Cabal anyways, so this is not a bad new dependency
 import Distribution.Simple.GHC ( componentGhcOptions )
 import Distribution.Simple.Configure ( getPersistBuildConfig )
 import Distribution.Simple.Compiler ( compilerVersion )
 import Distribution.Simple.Program.GHC ( renderGhcOptions )
 import Distribution.PackageDescription ( library, libBuildInfo )
-import Distribution.Simple.LocalBuildInfo ( localPkgDescr, buildDir, libraryConfig, compiler )
+import Distribution.Simple.LocalBuildInfo
 import qualified Distribution.Verbosity as V
 
 import Control.Monad hiding (mapM)
@@ -183,7 +182,11 @@ flagsFromCabal :: FilePath -> IO [String]
 flagsFromCabal distPref = do
   lbi <- getPersistBuildConfig distPref
   let pd = localPkgDescr lbi
-  case (library pd, libraryConfig lbi) of
+      findLibraryConfig []                         = Nothing
+      findLibraryConfig ((CLibName, clbi, _) :  _) = Just clbi
+      findLibraryConfig (_                   : xs) = findLibraryConfig xs
+      mLibraryConfig = findLibraryConfig (componentsConfigs lbi)
+  case (library pd, mLibraryConfig) of
     (Just lib, Just clbi) ->
       let bi = libBuildInfo lib
           odir = buildDir lbi





More information about the ghc-commits mailing list