Keep up with recent GHC changes, see #215.
authorAndrey Mokhov <andrey.mokhov@gmail.com>
Mon, 18 Apr 2016 00:19:21 +0000 (01:19 +0100)
committerAndrey Mokhov <andrey.mokhov@gmail.com>
Mon, 18 Apr 2016 00:19:21 +0000 (01:19 +0100)
cfg/system.config.in
shaking-up-ghc.cabal
src/Oracles/Config/Flag.hs
src/Settings/Builders/Ghc.hs
src/Settings/Packages/GhcCabal.hs

index d053e65..f235f19 100644 (file)
@@ -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@
index 17b48f0..92be3c7 100644 (file)
@@ -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.*
index 9d33445..449e2b2 100644 (file)
@@ -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
index 067c76e..a07c512 100644 (file)
@@ -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"
index 762720f..80bda57 100644 (file)
@@ -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"