[commit: ghc] wip/nfs-locking: Fix CABAL_VERSION argument in building ghc-cabal (#319) (1fd9854)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:50:25 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/1fd9854b798e2a003649baa6cfcc76c9150c0421/ghc

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

commit 1fd9854b798e2a003649baa6cfcc76c9150c0421
Author: Zhen Zhang <izgzhen at gmail.com>
Date:   Mon Jun 5 18:54:54 2017 +0800

    Fix CABAL_VERSION argument in building ghc-cabal (#319)


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

1fd9854b798e2a003649baa6cfcc76c9150c0421
 src/Settings/Packages/GhcCabal.hs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/Settings/Packages/GhcCabal.hs b/src/Settings/Packages/GhcCabal.hs
index 8e5837c..3c830ae 100644
--- a/src/Settings/Packages/GhcCabal.hs
+++ b/src/Settings/Packages/GhcCabal.hs
@@ -1,9 +1,17 @@
 module Settings.Packages.GhcCabal (ghcCabalPackageArgs) where
 
+import Distribution.PackageDescription.Parse
+
 import Base
 import GHC
 import Oracles.Config.Setting
 import Predicate
+import Package (pkgCabalFile)
+import Distribution.Verbosity (silent)
+import Distribution.Text (display)
+import Distribution.Package (pkgVersion)
+import Distribution.PackageDescription (packageDescription)
+import qualified Distribution.PackageDescription as DP
 
 ghcCabalPackageArgs :: Args
 ghcCabalPackageArgs = stage0 ? package ghcCabal ? builder Ghc ? do
@@ -12,10 +20,17 @@ ghcCabalPackageArgs = stage0 ? package ghcCabal ? builder Ghc ? do
     win <- lift windowsHost
     let cabalDeps = [ array, base, bytestring, containers, deepseq, directory
                     , pretty, process, time, if win then win32 else unix ]
+
+    lift $ need [pkgCabalFile cabal]
+    pd <- liftIO . readGenericPackageDescription silent $ pkgCabalFile cabal
+    let identifier   = DP.package . packageDescription $ pd
+        cabalVersion = display . pkgVersion $ identifier
+
     mconcat
         [ append [ "-package " ++ pkgNameString pkg | pkg <- cabalDeps ]
         , arg "--make"
         , arg "-j"
+        , arg ("-DCABAL_VERSION=" ++ replace "." "," cabalVersion)
         , arg "-DBOOTSTRAPPING"
         , arg "-DMIN_VERSION_binary_0_8_0"
         , arg "-DGENERICS"



More information about the ghc-commits mailing list