[commit: ghc] wip/nfs-locking: Move custom contexts to Settings.Path (72a08b0)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:14:31 UTC 2017


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

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

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

commit 72a08b0e226c62396437c29e019a61dba03e48fd
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Nov 27 12:01:41 2016 +0000

    Move custom contexts to Settings.Path


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

72a08b0e226c62396437c29e019a61dba03e48fd
 src/Rules/Data.hs    |  1 -
 src/Rules/Gmp.hs     |  3 ---
 src/Rules/Libffi.hs  |  9 +--------
 src/Settings/Path.hs | 31 ++++++++++++++++++++++---------
 4 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index 5c8a63b..58164d8 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -8,7 +8,6 @@ import Oracles.Config.Setting
 import Oracles.Dependencies
 import Oracles.Path
 import Rules.Generate
-import Rules.Libffi
 import Settings.Path
 import Target
 import UserSettings
diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index 2409b6e..1442118 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -14,9 +14,6 @@ import Util
 gmpBase :: FilePath
 gmpBase = pkgPath integerGmp -/- "gmp"
 
-gmpContext :: Context
-gmpContext = vanillaContext Stage1 integerGmp
-
 gmpLibraryInTreeH :: FilePath
 gmpLibraryInTreeH = gmpBuildPath -/- "include/gmp.h"
 
diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 8d72017..989288e 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -1,21 +1,14 @@
-module Rules.Libffi (rtsBuildPath, libffiRules, libffiDependencies) where
+module Rules.Libffi (libffiRules, libffiDependencies) where
 
 import Settings.Builders.Common
 import Settings.Packages.Rts
 import Target
 import Util
 
--- TODO: this should be moved elsewhere
-rtsBuildPath :: FilePath
-rtsBuildPath = buildPath rtsContext
-
 -- TODO: Why copy these include files into rts? Keep in libffi!
 libffiDependencies :: [FilePath]
 libffiDependencies = (rtsBuildPath -/-) <$> [ "ffi.h", "ffitarget.h" ]
 
-libffiContext :: Context
-libffiContext = vanillaContext Stage1 libffi
-
 libffiLibrary :: FilePath
 libffiLibrary = libffiBuildPath -/- "inst/lib/libffi.a"
 
diff --git a/src/Settings/Path.hs b/src/Settings/Path.hs
index 8999300..9e88ca6 100644
--- a/src/Settings/Path.hs
+++ b/src/Settings/Path.hs
@@ -1,10 +1,11 @@
 module Settings.Path (
     stageDirectory, buildPath, pkgDataFile, pkgHaddockFile, pkgLibraryFile,
-    pkgLibraryFile0, pkgGhciLibraryFile, gmpBuildPath, gmpObjects, gmpLibraryH,
-    gmpBuildInfoPath, generatedPath, libffiBuildPath, shakeFilesPath,
-    pkgConfFile, packageDbDirectory, packageDbStamp, bootPackageConstraints,
-    packageDependencies, objectPath, programInplacePath, programInplaceLibPath,
-    installPath, autogenPath, pkgInplaceConfig, rtsContext, rtsConfIn
+    pkgLibraryFile0, pkgGhciLibraryFile, gmpContext, gmpBuildPath, gmpObjects,
+    gmpLibraryH, gmpBuildInfoPath, generatedPath, libffiContext, libffiBuildPath,
+    rtsContext, rtsBuildPath, rtsConfIn, shakeFilesPath,packageDbDirectory,
+    pkgConfFile, packageDbStamp, bootPackageConstraints, packageDependencies,
+    objectPath, programInplacePath, programInplaceLibPath, installPath,
+    autogenPath, pkgInplaceConfig
     ) where
 
 import Base
@@ -100,17 +101,25 @@ pkgFile context prefix suffix = do
     componentId <- pkgData $ ComponentId path
     return $ path -/- prefix ++ componentId ++ suffix
 
--- | RTS is considered a Stage1 package. This determines RTS build path.
+-- | RTS is considered a Stage1 package. This determines RTS build directory.
 rtsContext :: Context
 rtsContext = vanillaContext Stage1 rts
 
+-- | Path to the RTS build directory.
+rtsBuildPath :: FilePath
+rtsBuildPath = buildPath rtsContext
+
 -- | Path to RTS package configuration file, to be processed by HsCpp.
 rtsConfIn :: FilePath
 rtsConfIn = pkgPath rts -/- "package.conf.in"
 
+-- | GMP is considered a Stage1 package. This determines GMP build directory.
+gmpContext :: Context
+gmpContext = vanillaContext Stage1 integerGmp
+
 -- | Build directory for in-tree GMP library.
 gmpBuildPath :: FilePath
-gmpBuildPath = buildRootPath -/- "stage1/gmp"
+gmpBuildPath = buildRootPath -/- stageDirectory (stage gmpContext) -/- "gmp"
 
 -- | Path to the GMP library header.
 gmpLibraryH :: FilePath
@@ -124,9 +133,13 @@ gmpObjects = gmpBuildPath -/- "objs"
 gmpBuildInfoPath :: FilePath
 gmpBuildInfoPath = pkgPath integerGmp -/- "integer-gmp.buildinfo"
 
--- | Build directory for in-tree libffi library.
+-- | Libffi is considered a Stage1 package. This determines its build directory.
+libffiContext :: Context
+libffiContext = vanillaContext Stage1 libffi
+
+-- | Build directory for in-tree Libffi library.
 libffiBuildPath :: FilePath
-libffiBuildPath = buildRootPath -/- "stage1/libffi"
+libffiBuildPath = buildPath libffiContext
 
 -- TODO: Move to buildRootPath, see #113.
 -- | Path to package database directory of a given 'Stage'. Note: StageN, N > 0,



More information about the ghc-commits mailing list