[commit: ghc] wip/nfs-locking: Keep up with recent GHC changes, see #215. (e34e7e2)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:07:56 UTC 2017


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

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

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

commit e34e7e287864bd8028e1b1d2e4b526135106787a
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Apr 18 01:19:21 2016 +0100

    Keep up with recent GHC changes, see #215.


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

e34e7e287864bd8028e1b1d2e4b526135106787a
 cfg/system.config.in              |  2 ++
 shaking-up-ghc.cabal              |  2 +-
 src/Oracles/Config/Flag.hs        |  2 ++
 src/Settings/Builders/Ghc.hs      |  8 +++++++-
 src/Settings/Packages/GhcCabal.hs | 10 ++++++++--
 5 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/cfg/system.config.in b/cfg/system.config.in
index d053e65..f235f19 100644
--- a/cfg/system.config.in
+++ b/cfg/system.config.in
@@ -70,6 +70,8 @@ ghc-major-version     = @GhcMajVersion@
 ghc-minor-version     = @GhcMinVersion@
 ghc-patch-level       = @GhcPatchLevel@
 
+supports-this-unit-id = @SUPPORTS_THIS_UNIT_ID@
+
 project-name          = @ProjectName@
 project-version       = @ProjectVersion@
 project-version-int   = @ProjectVersionInt@
diff --git a/shaking-up-ghc.cabal b/shaking-up-ghc.cabal
index 17b48f0..92be3c7 100644
--- a/shaking-up-ghc.cabal
+++ b/shaking-up-ghc.cabal
@@ -118,7 +118,7 @@ executable ghc-shake
                        , ScopedTypeVariables
     build-depends:       base >= 4.8 && < 5
                        , ansi-terminal        == 0.6.*
-                       , Cabal                == 1.22.*
+                       , Cabal                == 1.22.* || == 1.24.*
                        , containers           == 0.5.*
                        , directory            == 1.2.*
                        , extra                == 1.4.*
diff --git a/src/Oracles/Config/Flag.hs b/src/Oracles/Config/Flag.hs
index 9d33445..449e2b2 100644
--- a/src/Oracles/Config/Flag.hs
+++ b/src/Oracles/Config/Flag.hs
@@ -18,6 +18,7 @@ data Flag = ArSupportsAtFile
           | LeadingUnderscore
           | SolarisBrokenShld
           | SplitObjectsBroken
+          | SupportsThisUnitId
           | WithLibdw
           | UseSystemFfi
 
@@ -34,6 +35,7 @@ flag f = do
         LeadingUnderscore  -> "leading-underscore"
         SolarisBrokenShld  -> "solaris-broken-shld"
         SplitObjectsBroken -> "split-objects-broken"
+        SupportsThisUnitId -> "supports-this-unit-id"
         WithLibdw          -> "with-libdw"
         UseSystemFfi       -> "use-system-ffi"
     value <- askConfigWithDefault key . putError
diff --git a/src/Settings/Builders/Ghc.hs b/src/Settings/Builders/Ghc.hs
index 067c76e..a07c512 100644
--- a/src/Settings/Builders/Ghc.hs
+++ b/src/Settings/Builders/Ghc.hs
@@ -5,6 +5,7 @@ module Settings.Builders.Ghc (
 import Base
 import Expression
 import GHC
+import Oracles.Config.Flag
 import Oracles.Config.Setting
 import Oracles.PackageData
 import Predicates hiding (way, stage)
@@ -114,11 +115,16 @@ packageGhcArgs = do
     lift . when (isLibrary pkg) $ do
         conf <- pkgConfFile context
         need [conf]
+    -- FIXME: Get rid of to-be-deprecated -this-package-key.
+    thisArg <- do
+        not0 <- notStage0
+        unit <- getFlag SupportsThisUnitId
+        return $ if not0 || unit then "-this-unit-id " else "-this-package-key "
     mconcat
         [ arg "-hide-all-packages"
         , arg "-no-user-package-db"
         , bootPackageDbArgs
-        , isLibrary pkg ? (arg $ "-this-package-key " ++ compId)
+        , isLibrary pkg ? (arg $ thisArg ++ compId)
         , append $ map ("-package-id " ++) pkgDepIds ]
 
 -- TODO: Improve handling of "cabal_macros.h"
diff --git a/src/Settings/Packages/GhcCabal.hs b/src/Settings/Packages/GhcCabal.hs
index 762720f..80bda57 100644
--- a/src/Settings/Packages/GhcCabal.hs
+++ b/src/Settings/Packages/GhcCabal.hs
@@ -2,7 +2,8 @@ module Settings.Packages.GhcCabal (ghcCabalPackageArgs) where
 
 import Base
 import Expression
-import GHC (ghcCabal)
+import GHC
+import Oracles.Config.Setting
 import Predicates (builderGhc, package, stage0)
 import Settings
 
@@ -19,8 +20,13 @@ ghcCabalBootArgs = stage0 ? do
     path <- getBuildPath
     let cabalMacros     = path -/- "autogen/cabal_macros.h"
         cabalMacrosBoot = pkgPath ghcCabal -/- "cabal_macros_boot.h"
+    cabalDeps <- fromDiffExpr $ mconcat
+        [ append [ array, base, bytestring, containers, deepseq, directory
+                 , pretty, process, time ]
+        , notM windowsHost ? append [unix]
+        , windowsHost ? append [win32] ]
     mconcat
-        [ remove ["-hide-all-packages"]
+        [ append [ "-package " ++ pkgNameString pkg | pkg <- cabalDeps ]
         , removePair "-optP-include" $ "-optP" ++ cabalMacros
         , arg "--make"
         , arg "-j"



More information about the ghc-commits mailing list