packages feed

shake-ext 0.3.1.3 → 0.4.0.0

raw patch · 3 files changed

+25/−6 lines, 3 filesdep +directoryPVP ok

version bump matches the API change (PVP)

Dependencies added: directory

API changes (from Hackage documentation)

+ Development.Shake.C: cBinary :: FilePath -> FilePath -> Action ()

Files

shake-ext.cabal view
@@ -1,5 +1,5 @@ name:                shake-ext-version:             0.3.1.3+version:             0.4.0.0 synopsis:            Helper functions for linting with shake  description:         This package provides several linters out of the box, as well as functionality for building ATS source files with [shake](http://shakebuild.com/). homepage:            https://hub.darcs.net/vmchale/shake-ext@@ -25,10 +25,12 @@   exposed-modules:     Development.Shake.FileDetect                      , Development.Shake.Linters                      , Development.Shake.ATS+                     , Development.Shake.C   build-depends:       base >= 4.10 && < 5                      , shake                      , language-ats                      , composition-prelude+                     , directory   default-language:    Haskell2010   if flag(development)     ghc-options:       -Werror
src/Development/Shake/ATS.hs view
@@ -6,12 +6,13 @@                              , patsHome                              ) where -import           Control.Monad              (filterM)+import           Control.Monad              (filterM, forM_) import           Data.Either                (fromRight) import           Data.Maybe                 (fromMaybe) import           Development.Shake import           Development.Shake.FilePath import           Language.ATS+import           System.Directory           (copyFile) import           System.Exit                (ExitCode (ExitSuccess))  patsHome :: Action String@@ -21,8 +22,10 @@ -- TODO install the whole compiler? atsCommand :: CmdResult r => String -> String -> Action r atsCommand sourceFile out = do-    let atsArgs = [EchoStderr False, AddEnv "PATSHOME" "/usr/local/lib/ats2-postiats-0.3.8"]-    command atsArgs "patsopt" ["--output", out, "-dd", sourceFile, "-cc"]+    home <- patsHome+    let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]+        patsc = home ++ "/bin/patsopt"+    command atsArgs patsc ["--output", out, "-dd", sourceFile, "-cc"]  cleanATS :: Rules () cleanATS =@@ -53,8 +56,9 @@         let ats = fromRight mempty . parseATS . lexATS $ contents         deps <- filterM doesFileExist $ getDependencies ats         need deps-        {- forM_ deps $ \dep ->  -}-            {- copyFile dep (patsHome ++ "/" ++  -}+        home <- patsHome+        forM_ deps $ \dep ->+            liftIO $ copyFile dep (home ++ "/" ++ dep)  -- | This uses @pats-filter@ to prettify the errors. cgenPretty :: Rules ()
+ src/Development/Shake/C.hs view
@@ -0,0 +1,13 @@+module Development.Shake.C ( cBinary+                           ) where++import           Development.Shake+import           Development.Shake.ATS++-- | Build a C binary, including relevant ATS-related paths.+cBinary :: FilePath -> FilePath -> Action ()+cBinary src target = do+    need [src]+    home <- patsHome+    let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]+    command atsArgs "gcc" ["-flto", "-I" ++ home ++ "/ccomp/runtime", "-I" ++ home, "-o", target, "-O2"]