[Git][ghc/ghc][wip/absolute-i-paths] Hadrian: Make -i paths absolute

Matthew Pickering gitlab at gitlab.haskell.org
Tue Mar 31 07:36:34 UTC 2020



Matthew Pickering pushed to branch wip/absolute-i-paths at Glasgow Haskell Compiler / GHC


Commits:
636bf8ad by Matthew Pickering at 2020-03-31T08:36:25+01:00
Hadrian: Make -i paths absolute

The primary reason for this change is that ghcide does not work with
relative paths. It also matches what cabal and stack do, they always
pass absolute paths.

- - - - -


1 changed file:

- hadrian/src/Settings/Builders/Ghc.hs


Changes:

=====================================
hadrian/src/Settings/Builders/Ghc.hs
=====================================
@@ -13,6 +13,7 @@ import Settings.Builders.Common
 import Settings.Warnings
 import qualified Context as Context
 import Rules.Libffi (libffiName)
+import System.Directory
 
 ghcBuilderArgs :: Args
 ghcBuilderArgs = mconcat [ compileAndLinkHs, compileC, findHsDependencies
@@ -214,18 +215,20 @@ packageGhcArgs = do
 includeGhcArgs :: Args
 includeGhcArgs = do
     pkg     <- getPackage
-    path    <- getBuildPath
+    path    <- exprIO . makeAbsolute =<< getBuildPath
     context <- getContext
     srcDirs <- getContextData srcDirs
-    autogen <- expr $ autogenPath context
+    abSrcDirs <- exprIO $ mapM makeAbsolute [ (pkgPath pkg -/- dir) | dir <- srcDirs ]
+    autogen <- expr (autogenPath context)
+    cautogen <-  exprIO (makeAbsolute autogen)
     stage <- getStage
-    libPath <- expr $ stageLibPath stage
+    libPath <- expr (stageLibPath stage)
     let cabalMacros = autogen -/- "cabal_macros.h"
     expr $ need [cabalMacros]
     mconcat [ arg "-i"
             , arg $ "-i" ++ path
-            , arg $ "-i" ++ autogen
-            , pure [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ]
+            , arg $ "-i" ++ cautogen
+            , pure [ "-i" ++ d | d <- abSrcDirs ]
             , cIncludeArgs
             , arg $      "-I" ++ libPath
             , arg $ "-optc-I" ++ libPath



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/636bf8ad7280623bdb2d0f9b49168af9290b406f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/636bf8ad7280623bdb2d0f9b49168af9290b406f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200331/ac8a328c/attachment-0001.html>


More information about the ghc-commits mailing list