Commit 3872f968 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

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

parent 4b70d6e8
......@@ -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
......
module Rules.Install (installTargets, installRules) where
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" ]
installRules :: Rules ()
installRules = do
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 %> \out -> do
let source = dir -/- takeFileName out
copyFileChanged source out
putSuccess $ "| Installed " ++ source ++ " -> " ++ out
file <~ dir = file %> \_ -> copy file dir
copy file dir = do
let source = dir -/- takeFileName file
copyFileChanged source file
putBuild $ "| Copy " ++ source ++ " -> " ++ file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment