[commit: ghc] wip/T15971: Switch to the untracked version of getDirectoryFiles when scanning for GMP objects (453dc7f)
git at git.haskell.org
git at git.haskell.org
Wed Jan 9 21:36:43 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T15971
Link : http://ghc.haskell.org/trac/ghc/changeset/453dc7f2c53fec02a13f1a9b952f1c6f783a65ab/ghc
>---------------------------------------------------------------
commit 453dc7f2c53fec02a13f1a9b952f1c6f783a65ab
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Wed Jan 9 21:34:03 2019 +0000
Switch to the untracked version of getDirectoryFiles when scanning for GMP objects
See https://ghc.haskell.org/trac/ghc/ticket/15971.
This is work in progress: this commit does the right thing, but does not
yet fix the ticket.
>---------------------------------------------------------------
453dc7f2c53fec02a13f1a9b952f1c6f783a65ab
hadrian/src/Rules/Gmp.hs | 14 +++++++++++++-
hadrian/src/Rules/Library.hs | 7 ++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/hadrian/src/Rules/Gmp.hs b/hadrian/src/Rules/Gmp.hs
index 32265fe..0194518 100644
--- a/hadrian/src/Rules/Gmp.hs
+++ b/hadrian/src/Rules/Gmp.hs
@@ -1,5 +1,5 @@
module Rules.Gmp (
- gmpRules, gmpBuildPath, gmpObjectsDir, gmpLibraryH
+ gmpRules, gmpBuildPath, gmpObjects, gmpLibraryH
) where
import Base
@@ -9,6 +9,18 @@ import Packages
import Target
import Utilities
+-- | Build GMP library objects and return their paths.
+gmpObjects :: Action [FilePath]
+gmpObjects = do
+ gmpPath <- gmpBuildPath
+ need [gmpPath -/- gmpLibraryH]
+ -- We need to use the untracked version of 'getDirectoryFiles', because the
+ -- contents of 'gmpObjectsDir' is built by Hadrian (in 'gmpRules'). Using
+ -- the tracked version can lead to Shake Lint failure.
+ -- See: https://ghc.haskell.org/trac/ghc/ticket/15971.
+ map unifyPath <$>
+ liftIO (getDirectoryFilesIO "" [gmpPath -/- gmpObjectsDir -/- "*.o"])
+
gmpBase :: FilePath
gmpBase = pkgPath integerGmp -/- "gmp"
diff --git a/hadrian/src/Rules/Library.hs b/hadrian/src/Rules/Library.hs
index 1220040..8bd7067 100644
--- a/hadrian/src/Rules/Library.hs
+++ b/hadrian/src/Rules/Library.hs
@@ -103,11 +103,8 @@ cObjects context = do
-- 'Context' is @integer-gmp at .
extraObjects :: Context -> Action [FilePath]
extraObjects context
- | package context == integerGmp = do
- gmpPath <- gmpBuildPath
- need [gmpPath -/- gmpLibraryH]
- map unifyPath <$> getDirectoryFiles "" [gmpPath -/- gmpObjectsDir -/- "*.o"]
- | otherwise = return []
+ | package context == integerGmp = gmpObjects
+ | otherwise = return []
-- | Return all the object files to be put into the library we're building for
-- the given 'Context'.
More information about the ghc-commits
mailing list