summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvmchale <>2018-06-26 23:12:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-06-26 23:12:00 (GMT)
commit6c8c97e0f059ac7b452863d69e770ba1c764c4a6 (patch)
tree4c94fe6ab9ba33af5b11cf1e2d1e71bd702a5b6c
parent47a5e2a145376ac33ba4c7300ffddc799e1d97e4 (diff)
version 1.9.0.11.9.0.1
-rw-r--r--shake-ats.cabal2
-rw-r--r--src/Development/Shake/ATS.hs14
-rw-r--r--src/Development/Shake/ATS/Rules.hs14
3 files changed, 16 insertions, 14 deletions
diff --git a/shake-ats.cabal b/shake-ats.cabal
index ac6e4c4..7bfad71 100644
--- a/shake-ats.cabal
+++ b/shake-ats.cabal
@@ -1,6 +1,6 @@
cabal-version: 1.18
name: shake-ats
-version: 1.9.0.0
+version: 1.9.0.1
license: BSD3
license-file: LICENSE
copyright: Copyright: (c) 2018 Vanessa McHale
diff --git a/src/Development/Shake/ATS.hs b/src/Development/Shake/ATS.hs
index d77972b..49dfdf7 100644
--- a/src/Development/Shake/ATS.hs
+++ b/src/Development/Shake/ATS.hs
@@ -33,7 +33,7 @@ import Control.Monad
import Control.Monad.IO.Class
import Data.Bool (bool)
import Data.Either (fromRight)
-import Data.Foldable (fold)
+import Data.Foldable
import Data.Maybe (fromMaybe)
import Data.Semigroup (Semigroup (..))
import qualified Data.Text.Lazy as TL
@@ -45,7 +45,6 @@ import Development.Shake.C
import Development.Shake.FilePath
import Development.Shake.Version
import Language.ATS
--- import Lens.Micro
import System.Directory (copyFile, createDirectoryIfMissing, doesFileExist)
import System.Environment (getEnv)
import System.Exit (ExitCode (ExitSuccess))
@@ -125,7 +124,7 @@ cconfig tc libs' gc' extras = do
patsEnv :: ATSToolConfig -> FilePath -> [CmdOption]
patsEnv cfg path = EchoStderr False :
zipWith AddEnv
- ["PATSHOME", "PATH", "PATSHOMELOCS", "LIBGMP"]
+ ["PATSHOME", "PATH", "PATSHOMELOCS"]
[_patsHome cfg, _patsHome cfg </> "bin:" ++ path, _patsHomeLocs cfg ]
atsToC :: FilePath -> FilePath
@@ -156,11 +155,11 @@ satsGen (HATSGen x y) = genLinks x y
atsBin :: ATSTarget -> Rules ()
atsBin ATSTarget{..} = do
- mapM_ satsGen _linkTargets
+ traverse_ satsGen _linkTargets
- mapM_ hsAts _genTargets
+ traverse_ hsAts _genTargets
- mapM_ (cabalForeign (_cc _toolConfig)) _hsLibs
+ traverse_ (cabalForeign (_cc _toolConfig)) _hsLibs
let cTargets = atsToC <$> _src
@@ -175,7 +174,10 @@ atsBin ATSTarget{..} = do
cconfig' <- cconfig _toolConfig _libs _gc (makeCFlags _cFlags mempty (pure undefined) _gc)
let atsGen = (hatsFile <$> _linkTargets) <> (_atsTarget <$> _genTargets)
+ -- FIXME the generated C should not depend on the C compiler but the
+ -- build artifacts should
atsExtras = _otherDeps <> (TL.unpack . objectFile <$> _hsLibs)
+
zipWithM_ (cgen _toolConfig atsExtras atsGen) _src cTargets
doLib _tgtType (zipWithM_ (objectFileR (_cc _toolConfig) cconfig') cTargets (h' cTargets))
diff --git a/src/Development/Shake/ATS/Rules.hs b/src/Development/Shake/ATS/Rules.hs
index fe7c2a8..c6f3f26 100644
--- a/src/Development/Shake/ATS/Rules.hs
+++ b/src/Development/Shake/ATS/Rules.hs
@@ -7,6 +7,7 @@ module Development.Shake.ATS.Rules ( atsLex
) where
import Control.Monad
+import Data.Foldable
import Data.Semigroup (Semigroup (..))
import qualified Data.Text.Lazy as TL
import Development.Shake hiding (doesDirectoryExist)
@@ -35,7 +36,7 @@ genLinks dats link =
link %> \out -> liftIO $ do
contents <- readFile dats
let proc = generateLinks contents
- writeFile out (either undefined id proc)
+ writeFile out (either undefined id proc) -- FIXME better error
-- | Get subdirectories recursively.
getSubdirs :: FilePath -> IO [FilePath]
@@ -45,12 +46,12 @@ getSubdirs p = do
[] -> pure []
xs -> do
ds' <- filterM doesDirectoryExist ((p </>) <$> xs)
- ss <- mapM getSubdirs ds'
- pure $ ds' <> join ss
+ ss <- traverse getSubdirs ds'
+ pure $ ds' <> fold ss
-- | These rules take a @.cabal@ file and the @.o@ file to be produced from
-- them, building the @.o@ file.
-cabalForeign :: CCompiler -> ForeignCabal -> Rules ()
+cabalForeign :: CCompiler -> ForeignCabal -> Rules () -- TODO HsCompiler?
cabalForeign (GHC _ suff) (ForeignCabal cbp' cf' obf') = do
let cf = TL.unpack cf'
@@ -65,10 +66,9 @@ cabalForeign (GHC _ suff) (ForeignCabal cbp' cf' obf') = do
ghcV' <- quietly ghcVersion
let ghcV = maybe ghcV' (drop 1) suff
- need (cf : fmap ((obfDir <> "/") <>) trDeps)
+ need (cf : fmap ((obfDir <> [pathSeparator]) <>) trDeps)
command_ [Cwd obfDir] "cabal" ["new-build", "all", "-w", "ghc-" ++ ghcV]
- -- TODO move this to the @shake-ext@ package?
let subdir = takeDirectory cbp
correctDir = (== "build")
endsBuild = correctDir . last . splitPath
@@ -80,7 +80,7 @@ cabalForeign (GHC _ suff) (ForeignCabal cbp' cf' obf') = do
let hdr = dropExtension obj ++ "_stub.h"
liftIO $ copyFile hdr (takeDirectory out </> takeFileName hdr)
-cabalForeign _ _ = mempty
+cabalForeign _ _ = mempty -- FXIME error here?
-- | Build a @.lats@ file using @atslex@.
atsLex :: FilePath -- ^ Filepath of @.lats@ file