[commit: ghc] wip/nfs-locking: Fix generated includes (c6cb106)

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


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

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

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

commit c6cb106cf0d437ff1352b95b57224d6a2c2a4744
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Oct 3 04:58:54 2016 +0900

    Fix generated includes
    
    See #113.


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

c6cb106cf0d437ff1352b95b57224d6a2c2a4744
 src/Rules/Generate.hs                    | 4 ++++
 src/Settings/Builders/Common.hs          | 2 ++
 src/Settings/Builders/DeriveConstants.hs | 2 ++
 src/Settings/Builders/Ghc.hs             | 2 ++
 src/Settings/Builders/GhcCabal.hs        | 4 +++-
 src/Settings/Packages/Compiler.hs        | 4 +---
 src/Settings/Packages/Rts.hs             | 3 +--
 7 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 266141f..035318f 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -45,6 +45,8 @@ includesDependencies = fmap (generatedPath -/-)
     [ "ghcautoconf.h"
     , "ghcplatform.h"
     , "ghcversion.h" ]
+    ++ -- TODO: This is a temporary fix, see #113:
+    [ "includes/ghcversion.h"]
 
 ghcPrimDependencies :: Expr [FilePath]
 ghcPrimDependencies = do
@@ -165,6 +167,8 @@ copyRules = do
     "inplace/lib/template-hsc.h"     <~ pkgPath hsc2hs
     rtsBuildPath -/- "sm/Evac_thr.c" %> copyFile (pkgPath rts -/- "sm/Evac.c")
     rtsBuildPath -/- "sm/Scav_thr.c" %> copyFile (pkgPath rts -/- "sm/Scav.c")
+    -- TODO: This is a temporary fix, see #113:
+    "includes/ghcversion.h"          <~ generatedPath
   where
     file <~ dir = file %> copyFile (dir -/- takeFileName file)
 
diff --git a/src/Settings/Builders/Common.hs b/src/Settings/Builders/Common.hs
index 49e5f30..698b343 100644
--- a/src/Settings/Builders/Common.hs
+++ b/src/Settings/Builders/Common.hs
@@ -9,6 +9,7 @@ import Oracles.Config.Flag
 import Oracles.Config.Setting
 import Oracles.PackageData
 import Settings
+import Settings.Paths
 import UserSettings
 
 cIncludeArgs :: Args
@@ -18,6 +19,7 @@ cIncludeArgs = do
     incDirs <- getPkgDataList IncludeDirs
     depDirs <- getPkgDataList DepIncludeDirs
     mconcat [ arg "-Iincludes"
+            , arg $ "-I" ++ generatedPath
             , arg $ "-I" ++ path
             , arg $ "-I" ++ path -/- "autogen"
             , append [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
diff --git a/src/Settings/Builders/DeriveConstants.hs b/src/Settings/Builders/DeriveConstants.hs
index 9cfd9dd..621a225 100644
--- a/src/Settings/Builders/DeriveConstants.hs
+++ b/src/Settings/Builders/DeriveConstants.hs
@@ -5,6 +5,7 @@ import Oracles.Config.Flag
 import Oracles.Config.Setting
 import Predicate
 import Settings.Builders.Common
+import Settings.Paths
 
 -- TODO: do we need to support `includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT`?
 deriveConstantsBuilderArgs :: Args
@@ -34,5 +35,6 @@ includeCcArgs = mconcat
     , flag GhcUnregisterised ? arg "-DUSE_MINIINTERPRETER"
     , arg "-Irts"
     , arg "-Iincludes"
+    , arg $ "-I" ++ generatedPath
     , notM ghcWithSMP ? arg "-DNOSMP"
     , arg "-fcommon" ]
diff --git a/src/Settings/Builders/Ghc.hs b/src/Settings/Builders/Ghc.hs
index d2cd761..475c9b3 100644
--- a/src/Settings/Builders/Ghc.hs
+++ b/src/Settings/Builders/Ghc.hs
@@ -135,6 +135,8 @@ includeGhcArgs = do
             , arg $ "-i" ++ path -/- "autogen"
             , append [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ]
             , cIncludeArgs
+            , arg $      "-I" ++ generatedPath
+            , arg $ "-optc-I" ++ generatedPath
             , arg "-optP-include"
             , arg $ "-optP" ++ path -/- "autogen/cabal_macros.h" ]
 
diff --git a/src/Settings/Builders/GhcCabal.hs b/src/Settings/Builders/GhcCabal.hs
index 7a3b3a0..14c1254 100644
--- a/src/Settings/Builders/GhcCabal.hs
+++ b/src/Settings/Builders/GhcCabal.hs
@@ -64,10 +64,12 @@ libraryArgs = do
 -- TODO: WARNING: unrecognized options: --with-compiler, --with-gmp-libraries, --with-cc
 configureArgs :: Args
 configureArgs = do
+    top <- getTopDirectory
     let conf key = appendSubD $ "--configure-option=" ++ key
         cFlags   = mconcat [ cArgs
                            , remove ["-Werror"]
-                           , argStagedSettingList ConfCcArgs ]
+                           , argStagedSettingList ConfCcArgs
+                           , arg $ "-I" ++ top -/- generatedPath ]
         ldFlags  = ldArgs  <> (argStagedSettingList ConfGccLinkerArgs)
         cppFlags = cppArgs <> (argStagedSettingList ConfCppArgs)
     mconcat
diff --git a/src/Settings/Packages/Compiler.hs b/src/Settings/Packages/Compiler.hs
index 1866a1b..df9020d 100644
--- a/src/Settings/Packages/Compiler.hs
+++ b/src/Settings/Packages/Compiler.hs
@@ -16,9 +16,7 @@ compilerPackageArgs = package compiler ? do
     path    <- getBuildPath
     mconcat [ builder Alex ? arg "--latin1"
 
-            , builder Ghc ? mconcat
-              [ arg $      "-I" ++ path
-              , arg $ "-optP-I" ++ generatedPath ]
+            , builder Ghc ? arg ("-I" ++ path)
 
             , builder GhcCabal ? mconcat
               [ arg $ "--ghc-option=-DSTAGE=" ++ show (fromEnum stage + 1)
diff --git a/src/Settings/Packages/Rts.hs b/src/Settings/Packages/Rts.hs
index a4ed2a1..f3f2e43 100644
--- a/src/Settings/Packages/Rts.hs
+++ b/src/Settings/Packages/Rts.hs
@@ -9,7 +9,6 @@ import Oracles.Config.Setting
 import Oracles.WindowsPath
 import Predicate
 import Settings
-import Settings.Paths
 
 rtsConfIn :: FilePath
 rtsConfIn = pkgPath rts -/- "package.conf.in"
@@ -92,7 +91,7 @@ rtsPackageArgs = package rts ? do
             , input "//Evac_thr.c" ? append [ "-DPARALLEL_GC", "-Irts/sm" ]
             , input "//Scav_thr.c" ? append [ "-DPARALLEL_GC", "-Irts/sm" ] ]
 
-        , builder Ghc ? arg "-Irts" <> arg ("-I" ++ generatedPath)
+        , builder Ghc ? arg "-Irts"
 
         , builder (GhcPkg Stage1) ? mconcat
           [ remove ["rts/stage1/inplace-pkg-config"] -- TODO: fix, see #113



More information about the ghc-commits mailing list