[commit: ghc] wip/nfs-locking: Rename installRules into copyRules and add copy rules for ffi*.h files, #22. (3872f96)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:21:32 UTC 2017


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

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

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

commit 3872f96896f53e4967674a7e4839dfd0fe1700b7
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Jan 2 02:12:02 2016 +0000

    Rename installRules into copyRules and add copy rules for ffi*.h files, #22.


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

3872f96896f53e4967674a7e4839dfd0fe1700b7
 src/Main.hs          |  4 ++--
 src/Rules/Copy.hs    | 32 ++++++++++++++++++++++++++++++++
 src/Rules/Install.hs | 22 ----------------------
 3 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/src/Main.hs b/src/Main.hs
index fdc43cd..b2c5340 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -3,14 +3,14 @@ import Rules
 import Rules.Cabal
 import Rules.Config
 import Rules.Generate
-import Rules.Install
+import Rules.Copy
 import Rules.Oracles
 
 main :: IO ()
 main = shakeArgs options $ do
     cabalRules      -- see Rules.Cabal
     configRules     -- see Rules.Config
-    installRules    -- see Rules.Install
+    copyRules       -- see Rules.Copy
     generateTargets -- see Rules
     generateRules   -- see Rules.Generate
     oracleRules     -- see Rules.Oracles
diff --git a/src/Rules/Copy.hs b/src/Rules/Copy.hs
new file mode 100644
index 0000000..47d6f02
--- /dev/null
+++ b/src/Rules/Copy.hs
@@ -0,0 +1,32 @@
+module Rules.Copy (installTargets, copyRules) where
+
+import Base
+import Expression
+import GHC
+import Rules.Generate
+import Settings.TargetDirectory
+
+installTargets :: [FilePath]
+installTargets = [ "inplace/lib/template-hsc.h"
+                 , "inplace/lib/platformConstants"
+                 , "inplace/lib/settings" ]
+
+copyRules :: Rules ()
+copyRules = do
+    targetPath Stage1 rts -/- "build/ffi*.h" %> \ffih -> do
+        ffiHPaths <- getDirectoryFiles "" ["libffi/build/inst/lib/*/include/ffi.h"]
+        when (length ffiHPaths /= 1) $
+            putError "copyRules: cannot determine location of ffi.h"
+        let ffiHPath = takeDirectory $ head ffiHPaths
+        copy ffih ffiHPath
+
+    "inplace/lib/template-hsc.h"    <~ pkgPath hsc2hs
+    "inplace/lib/platformConstants" <~ derivedConstantsPath
+    "inplace/lib/settings"          <~ "."
+  where
+    file <~ dir = file %> \_ -> copy file dir
+
+    copy file dir = do
+        let source = dir -/- takeFileName file
+        copyFileChanged source file
+        putBuild $ "| Copy " ++ source ++ " -> " ++ file
diff --git a/src/Rules/Install.hs b/src/Rules/Install.hs
deleted file mode 100644
index 2e74bd3..0000000
--- a/src/Rules/Install.hs
+++ /dev/null
@@ -1,22 +0,0 @@
-module Rules.Install (installTargets, installRules) where
-
-import Base
-import Expression
-import GHC
-import Rules.Generate
-
-installTargets :: [FilePath]
-installTargets = [ "inplace/lib/template-hsc.h"
-                 , "inplace/lib/platformConstants"
-                 , "inplace/lib/settings" ]
-
-installRules :: Rules ()
-installRules = do
-    "inplace/lib/template-hsc.h"    <~ pkgPath hsc2hs
-    "inplace/lib/platformConstants" <~ derivedConstantsPath
-    "inplace/lib/settings"          <~ "."
-  where
-    file <~ dir = file %> \out -> do
-        let source = dir -/- takeFileName out
-        copyFileChanged source out
-        putSuccess $ "| Installed " ++ source ++ " -> " ++ out



More information about the ghc-commits mailing list