shake-ats 1.3.0.1 → 1.3.0.2
raw patch · 4 files changed
+37/−14 lines, 4 filesdep +dependency
Dependencies added: dependency
Files
- shake-ats.cabal +2/−1
- src/Development/Shake/ATS.hs +17/−0
- src/Development/Shake/ATS/Rules.hs +1/−1
- src/Development/Shake/ATS/Type.hs +17/−12
shake-ats.cabal view
@@ -1,5 +1,5 @@ name: shake-ats-version: 1.3.0.1+version: 1.3.0.2 synopsis: Utilities for building ATS projects with shake description: Various helper functions for building [ATS](http://www.ats-lang.org/) with the [shake](http://shakebuild.com/) library homepage: https://github.com/vmchale/shake-ats#readme@@ -31,6 +31,7 @@ , hs2ats >= 0.2.0.1 , directory , text+ , dependency , shake , binary default-language: Haskell2010
src/Development/Shake/ATS.hs view
@@ -15,11 +15,14 @@ , patsHome -- * Helper functions , getSubdirs+ , ccToString+ , compatible -- Types , Version (..) , ForeignCabal (..) , BinaryTarget (..) , ATSToolConfig (..)+ , CCompiler (..) ) where import Control.Monad@@ -39,6 +42,19 @@ import System.Directory (copyFile, createDirectoryIfMissing) import System.Exit (ExitCode (ExitSuccess)) +-- | Whether+compatible :: CCompiler -> CCompiler -> Bool+compatible (GCC Nothing Nothing) Clang = True+compatible Clang (GCC Nothing Nothing) = True+compatible x y = x == y++ccToString :: CCompiler -> String+ccToString Clang = "clang"+ccToString (Other s) = s+ccToString (GCC pre suff) = h (g <$> [pre, suff]) "gcc"+ where g = maybe id mappend+ h = foldr fmap id+ -- | Run @patsopt@ given information about atsCommand :: CmdResult r => ATSToolConfig -> String -- ^ Source file@@ -81,6 +97,7 @@ hsExtra = bool ["--make", "-odir", ".atspkg", "-no-hs-main", "-package-db", "~/.cabal/store/ghc-" ++ ghcVersion ++ "/package.db/"] mempty noHs noHs = null fc +-- TODO libraries should be linked against *cross-compiled* versions!! atsBin :: BinaryTarget -> Rules () atsBin BinaryTarget{..} = do
src/Development/Shake/ATS/Rules.hs view
@@ -23,7 +23,7 @@ genATS src target = target %> \out -> liftIO $ do createDirectoryIfMissing True (takeDirectory out)- genATSTypes src target+ genATSTypes src out getSubdirs :: FilePath -> IO [FilePath] getSubdirs p = do
src/Development/Shake/ATS/Type.hs view
@@ -1,5 +1,6 @@-{-# LANGUAGE DeriveAnyClass #-}-{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE PatternSynonyms #-} -- gcc -c -o lib1.o lib1.c@@ -11,12 +12,17 @@ , BinaryTarget (..) , ArtifactType (..) , ATSToolConfig (..)+ , CCompiler (GCC, Clang, Other, GCCStd) ) where-import Data.Binary (Binary (..))-import Data.List (intercalate)-import qualified Data.Text.Lazy as TL-import GHC.Generics (Generic) +import Data.Binary (Binary (..))+import Data.Dependency (Version (..))+import qualified Data.Text.Lazy as TL+import GHC.Generics (Generic)++pattern GCCStd :: CCompiler+pattern GCCStd = GCC Nothing Nothing+ -- We should have four build types: -- -- 1. Static library@@ -48,6 +54,11 @@ | DynamicLibrary | Binary Bool +data CCompiler = GCC { _prefix :: Maybe String, _suffix :: Maybe String }+ | Clang+ | Other String+ deriving (Eq)+ -- | Information about where to find @patscc@ and @patsopt@. data ATSToolConfig = ATSToolConfig { libVersion :: Version , compilerVer :: Version@@ -70,9 +81,3 @@ data ForeignCabal = ForeignCabal { cabalFile :: TL.Text -- ^ @.cabal@ file associated with the library , objectFile :: TL.Text -- ^ Object file to be generated } deriving (Eq, Show, Generic, Binary)--newtype Version = Version [Integer]- deriving (Eq, Generic, Binary)--instance Show Version where- show (Version is) = intercalate "." (show <$> is)