[commit: ghc] wip/nfs-locking: Refactor libffi rules. (709026d)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:38:04 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/709026de4920d45ad83a9e6a98153b9328533d1a/ghc
>---------------------------------------------------------------
commit 709026de4920d45ad83a9e6a98153b9328533d1a
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Tue Jan 5 17:00:37 2016 +0000
Refactor libffi rules.
>---------------------------------------------------------------
709026de4920d45ad83a9e6a98153b9328533d1a
src/Rules/Copy.hs | 14 --------------
src/Rules/Libffi.hs | 26 +++++++++++++++++++-------
2 files changed, 19 insertions(+), 21 deletions(-)
diff --git a/src/Rules/Copy.hs b/src/Rules/Copy.hs
index b1f9760..7454fd9 100644
--- a/src/Rules/Copy.hs
+++ b/src/Rules/Copy.hs
@@ -5,9 +5,6 @@ import Expression
import GHC
import Rules.Actions
import Rules.Generate
-import Rules.Libffi
-import Settings.Packages.Rts
-import Settings.TargetDirectory
installTargets :: [FilePath]
installTargets = [ "inplace/lib/template-hsc.h"
@@ -16,17 +13,6 @@ installTargets = [ "inplace/lib/template-hsc.h"
copyRules :: Rules ()
copyRules = do
- targetPath Stage1 rts -/- "build/ffi*.h" %> \ffih -> do
- need [libffiLibrary]
- ffiHPaths <- getDirectoryFiles "" ["libffi/build/inst/lib/*/include/ffi.h"]
- when (length ffiHPaths /= 1) $
- putError $ "copyRules: exactly one ffi.h header expected"
- ++ "(found: " ++ show ffiHPaths ++ ")."
-
- copyFile (takeDirectory (head ffiHPaths) -/- takeFileName ffih) ffih
- libffiName <- rtsLibffiLibraryName
- copyFile libffiLibrary (targetPath Stage1 rts -/- "build/lib" ++ libffiName <.> "a")
-
"inplace/lib/template-hsc.h" <~ pkgPath hsc2hs
"inplace/lib/platformConstants" <~ derivedConstantsPath
"inplace/lib/settings" <~ "."
diff --git a/src/Rules/Libffi.hs b/src/Rules/Libffi.hs
index 603b35f..041650f 100644
--- a/src/Rules/Libffi.hs
+++ b/src/Rules/Libffi.hs
@@ -1,4 +1,4 @@
-module Rules.Libffi (libffiRules, libffiLibrary) where
+module Rules.Libffi (libffiRules, libffiDependencies) where
import Base
import Expression
@@ -6,15 +6,22 @@ import GHC
import Oracles
import Rules.Actions
import Settings.Builders.Common
+import Settings.Packages.Rts
+import Settings.TargetDirectory
import Settings.User
--- We use this file to track the whole libffi library
-libffiLibrary :: FilePath
-libffiLibrary = libffiBuild -/- "inst/lib/libffi.a"
+rtsBuildPath :: FilePath
+rtsBuildPath = targetPath Stage1 rts -/- "build"
+
+libffiDependencies :: [FilePath]
+libffiDependencies = (rtsBuildPath -/-) <$> [ "ffi.h", "ffitarget.h" ]
libffiBuild :: FilePath
libffiBuild = "libffi/build"
+libffiLibrary :: FilePath
+libffiLibrary = libffiBuild -/- "inst/lib/libffi.a"
+
libffiMakefile :: FilePath
libffiMakefile = libffiBuild -/- "Makefile.in"
@@ -61,7 +68,7 @@ configureArguments = do
libffiRules :: Rules ()
libffiRules = do
- libffiLibrary %> \_ -> do
+ libffiDependencies &%> \_ -> do
when trackBuildSystem $ need [sourcePath -/- "Rules/Libffi.hs"]
liftIO $ removeFiles libffiBuild ["//*"]
tarballs <- getDirectoryFiles "" ["libffi-tarballs/libffi*.tar.gz"]
@@ -87,9 +94,14 @@ libffiRules = do
runMake libffiBuild []
runMake libffiBuild ["install"]
- putSuccess $ "| Successfully built custom library 'libffi'"
+ forM_ ["ffi.h", "ffitarget.h"] $ \file -> do
+ let src = libffiBuild -/- "inst/lib" -/- libname -/- "include" -/- file
+ copyFile src (rtsBuildPath -/- file)
- "libffi/build/inst/lib/*/include/*.h" %> \_ -> need [libffiLibrary]
+ libffiName <- rtsLibffiLibraryName
+ copyFile libffiLibrary (rtsBuildPath -/- "lib" ++ libffiName <.> "a")
+
+ putSuccess $ "| Successfully built custom library 'libffi'"
-- chmod +x libffi/ln
-- # wc on OS X has spaces in its output, which libffi's Makefile
More information about the ghc-commits
mailing list