[commit: ghc] wip/nfs-locking: Add targetPath. (35d9a07)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:12:30 UTC 2017


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

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

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

commit 35d9a0726b9751c29c8f0250bd925f84074cc3b2
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Jul 13 22:24:50 2015 +0100

    Add targetPath.


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

35d9a0726b9751c29c8f0250bd925f84074cc3b2
 src/Rules.hs                    | 4 +---
 src/Rules/Data.hs               | 8 ++++----
 src/Settings/GhcCabal.hs        | 1 +
 src/Settings/GhcPkg.hs          | 4 +---
 src/Settings/TargetDirectory.hs | 6 +++++-
 5 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/Rules.hs b/src/Rules.hs
index 852a6cf..ce204ea 100644
--- a/src/Rules.hs
+++ b/src/Rules.hs
@@ -6,7 +6,6 @@ module Rules (
 
 import Base hiding (arg, args, Args)
 import Control.Monad
-import Package
 import Expression
 import Rules.Package
 import Settings.Packages
@@ -19,8 +18,7 @@ generateTargets = action $
     forM_ [Stage0 ..] $ \stage -> do
         pkgs <- interpret (stageTarget stage) packages
         forM_ pkgs $ \pkg -> do
-            let dir = targetDirectory stage pkg
-            need [pkgPath pkg </> dir </> "package-data.mk"]
+            need [targetPath stage pkg </> "package-data.mk"]
 
 -- TODO: add Stage2 (compiler only?)
 packageRules :: Rules ()
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index d608fea..a18a097 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -18,9 +18,9 @@ buildPackageData :: Target -> Rules ()
 buildPackageData target =
     let stage = getStage target
         pkg   = getPackage target
-        dir   = pkgPath pkg </> targetDirectory stage pkg
+        path  = targetPath stage pkg
     in
-    (dir </>) <$>
+    (path </>) <$>
     [ "package-data.mk"
     , "haddock-prologue.txt"
     , "inplace-pkg-config"
@@ -31,7 +31,7 @@ buildPackageData target =
     ] &%> \_ -> do
         let configure = pkgPath pkg </> "configure"
             -- TODO: 1) how to automate this? 2) handle multiple files?
-            newEnv    = target { getFile = dir </> "package-data.mk" }
+            newEnv    = target { getFile = path </> "package-data.mk" }
         -- GhcCabal will run the configure script, so we depend on it
         need [pkgPath pkg </> pkgCabal pkg]
         -- We still don't know who built the configure script from configure.ac
@@ -39,7 +39,7 @@ buildPackageData target =
         run' newEnv GhcCabal
         -- TODO: when (registerPackage settings) $
         run' newEnv (GhcPkg stage)
-        postProcessPackageData $ dir </> "package-data.mk"
+        postProcessPackageData $ path </> "package-data.mk"
 
 -- TODO: This should probably go to Oracles.Builder
 run' :: Target -> Builder -> Action ()
diff --git a/src/Settings/GhcCabal.hs b/src/Settings/GhcCabal.hs
index 8e1a8cf..578c264 100644
--- a/src/Settings/GhcCabal.hs
+++ b/src/Settings/GhcCabal.hs
@@ -106,6 +106,7 @@ packageConstraints = do
     args $ concatMap (\c -> ["--constraint", c]) $ constraints
 
 -- TODO: should be in a different file
+-- TODO: put all validating options together in one file
 ccSettings :: Settings
 ccSettings = validating ? do
     let gccGe46 = liftM not gccLt46
diff --git a/src/Settings/GhcPkg.hs b/src/Settings/GhcPkg.hs
index d5fb21e..601d2b8 100644
--- a/src/Settings/GhcPkg.hs
+++ b/src/Settings/GhcPkg.hs
@@ -3,7 +3,6 @@ module Settings.GhcPkg (
     ) where
 
 import Base hiding (arg, args)
-import Package
 import Switches
 import Expression hiding (when, liftIO)
 import Settings.Util
@@ -15,9 +14,8 @@ ghcPkgSettings :: Settings
 ghcPkgSettings = do
     pkg <- asks getPackage
     stage <- asks getStage
-    let dir = pkgPath pkg </> targetDirectory stage pkg
     builder (GhcPkg stage) ? mconcat
         [ arg "update"
         , arg "--force"
         , stage0 ? bootPackageDbSettings
-        , arg $ dir </> "inplace-pkg-config" ]
+        , arg $ targetPath stage pkg </> "inplace-pkg-config" ]
diff --git a/src/Settings/TargetDirectory.hs b/src/Settings/TargetDirectory.hs
index 83e1d0e..d8eb067 100644
--- a/src/Settings/TargetDirectory.hs
+++ b/src/Settings/TargetDirectory.hs
@@ -1,5 +1,5 @@
 module Settings.TargetDirectory (
-    targetDirectory
+    targetDirectory, targetPath
     ) where
 
 import Base
@@ -9,3 +9,7 @@ import UserSettings
 -- User can override the default target directory settings given below
 targetDirectory :: Stage -> Package -> FilePath
 targetDirectory = userTargetDirectory
+
+-- Path to the target directory from GHC source root
+targetPath :: Stage -> Package -> FilePath
+targetPath stage pkg = pkgPath pkg </> targetDirectory stage pkg



More information about the ghc-commits mailing list