summaryrefslogtreecommitdiff
path: root/hadrian/src/Rules/Gmp.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Rules/Gmp.hs')
-rw-r--r--hadrian/src/Rules/Gmp.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/hadrian/src/Rules/Gmp.hs b/hadrian/src/Rules/Gmp.hs
index 32265fe401..0194518d05 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"