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

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



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


Commits:
3d0583b1 by Matthew Pickering at 2020-03-31T08:16: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,19 @@ 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 <-  exprIO . makeAbsolute =<< expr (autogenPath context)
     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 ]
+            , pure [ "-i" ++ d | d <- abSrcDirs ]
             , cIncludeArgs
             , arg $      "-I" ++ libPath
             , arg $ "-optc-I" ++ libPath



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3d0583b1d6c03a38758dbf2bad9abe37c5cc4b58

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3d0583b1d6c03a38758dbf2bad9abe37c5cc4b58
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/1caea808/attachment-0001.html>


More information about the ghc-commits mailing list