packages feed

shake-ats 1.5.0.11 → 1.6.0.1

raw patch · 4 files changed

+23/−61 lines, 4 filesdep ~shake-ext

Dependency ranges changed: shake-ext

Files

shake-ats.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: shake-ats-version: 1.5.0.11+version: 1.6.0.1 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018 Vanessa McHale@@ -39,7 +39,7 @@         base >=4.11 && <5,         hashable -any,         language-ats -any,-        shake-ext >=2.7.0.0,+        shake-ext >=2.8.0.0,         hs2ats >=0.2.0.1,         directory -any,         microlens -any,
src/Development/Shake/ATS.hs view
@@ -14,8 +14,6 @@                              , getSubdirs                              , ccToDir                              , withPF-                             , defaultATSTarget-                             , defaultATSToolConfig                              -- * Environment/configuration                              , patscc                              , patsopt@@ -33,10 +31,10 @@                              , cc                              , gc                              , hasPretty-                             , compilerVer                              , genTargets                              , hsLibs-                             , libVersion+                             , patsHome+                             , patsHomeLocs                              , libs                              , linkStatic                              , linkTargets@@ -51,7 +49,6 @@ import           Control.Monad.IO.Class import           Data.Bool                         (bool) import           Data.Either                       (fromRight)-import           Data.List                         (intercalate) import           Data.Maybe                        (fromMaybe) import           Data.Semigroup                    (Semigroup (..)) import qualified Data.Text.Lazy                    as TL@@ -75,9 +72,8 @@                           -> Action r atsCommand tc sourceFile out = do     path <- liftIO $ getEnv "PATH"-    home' <- home tc-    let env = patsEnv home' path-    patsc <- patsopt tc+    let env = patsEnv tc path+        patsc = patsopt tc      command env patsc ["--output", out, "-dd", sourceFile, "-cc"] @@ -98,19 +94,11 @@ -- Copy source files to the appropriate place. This is necessary because -- @#include@s in ATS are weird. copySources :: ATSToolConfig -> [FilePath] -> Action ()-copySources (ATSToolConfig v v' _ _ _) sources =+copySources (ATSToolConfig home' _ _ _ _) sources =     forM_ sources $ \dep -> do-        h <- patsHome v'-        let home' = h ++ "lib/ats2-postiats-" ++ show v         liftIO $ createDirectoryIfMissing True (home' ++ "/" ++ takeDirectory dep)         liftIO $ copyFile dep (home' ++ "/" ++ dep) --- | This is the @$PATSHOMELOCS@ variable to be passed to the shell.-patsHomeLocs :: Int-             -> String-patsHomeLocs n = intercalate ":" $ (<> ".atspkg/contrib") . ("./" <>) <$> g-    where g = [ join $ replicate i "../" | i <- [0..n] ]- makeCFlags :: [String] -- ^ Inputs            -> [ForeignCabal] -- ^ Haskell libraries            -> String -- ^ GHC version@@ -127,38 +115,30 @@     where h (ForeignCabal mpr cf _) = fromMaybe cf mpr  -- | Location of @patscc@-patscc :: MonadIO m => ATSToolConfig -> m String+patscc :: ATSToolConfig -> String patscc = patsTool "patscc"  -- | Location of @patsopt@-patsopt :: MonadIO m => ATSToolConfig -> m String+patsopt :: ATSToolConfig -> String patsopt = patsTool "patsopt" -patsTool :: MonadIO m => String -> ATSToolConfig -> m String-patsTool tool tc = (<> prep) <$> ph-    where ph = patsHome (_compilerVer tc)-          prep = "lib/ats2-postiats-" ++ show (_libVersion tc) ++ "/bin/" ++ tool+patsTool :: String -> ATSToolConfig -> String+patsTool tool tc = _patsHome tc ++ "/bin/" ++ tool  cconfig :: MonadIO m => ATSToolConfig -> [String] -> Bool -> [String] -> m CConfig cconfig tc libs' gc' extras = do-    h <- patsHome (_compilerVer tc)+    let h = _patsHome tc     let cc' = _cc tc     h' <- pkgHome cc'-    home' <- home tc     let libs'' = ("atslib" :) $ bool libs' ("gc" : libs') gc'     -- TODO only include /ccomp/atslib/lib if it's not a cross build-    pure $ CConfig [h ++ "ccomp/runtime/", h, h' ++ "include", ".atspkg/contrib"] libs'' [h' ++ "lib", home' ++ "/ccomp/atslib/lib"] extras (_linkStatic tc)--home :: MonadIO m => ATSToolConfig -> m String-home tc = do-    h <- patsHome (_compilerVer tc)-    pure $ h ++ "lib/ats2-postiats-" ++ show (_libVersion tc)+    pure $ CConfig [h ++ "/ccomp/runtime/", h, h' ++ "include", ".atspkg/contrib"] libs'' [h' ++ "lib", _patsHome tc ++ "/ccomp/atslib/lib"] extras (_linkStatic tc) -patsEnv :: FilePath -> FilePath -> [CmdOption]-patsEnv home' path = EchoStderr False :+patsEnv :: ATSToolConfig -> FilePath -> [CmdOption]+patsEnv cfg path = EchoStderr False :     zipWith AddEnv         ["PATSHOME", "PATH", "PATSHOMELOCS"]-        [home', home' ++ "/bin:" ++ path, patsHomeLocs 5]+        [_patsHome cfg, _patsHome cfg ++ "/bin:" ++ path, _patsHomeLocs cfg]  atsToC :: FilePath -> FilePath atsToC = (-<.> "c") . (".atspkg/c/" <>)@@ -171,18 +151,6 @@ doLib :: ArtifactType -> Rules () -> Rules () doLib Executable = pure mempty doLib _          = id--defaultATSTarget :: [FilePath] -- ^ ATS source files-                 -> ArtifactType-                 -> FilePath -- ^ Target-                 -> ATSTarget-defaultATSTarget sources tgt' out =-    ATSTarget mempty defaultATSToolConfig False mempty sources mempty mempty mempty out mempty tgt'--defaultATSToolConfig :: ATSToolConfig-defaultATSToolConfig =-    ATSToolConfig v v False (GCC Nothing) False-        where v = Version [0,3,9]  -- | Rules for generating binaries or libraries from ATS code. This is very -- general; use 'defaultATSTarget' for sensible defaults that can be modified
src/Development/Shake/ATS/Environment.hs view
@@ -1,12 +1,10 @@ module Development.Shake.ATS.Environment ( fixDir                                          , pkgHome-                                         , patsHome                                          , ccToDir                                          ) where  import           Control.Monad.IO.Class import qualified Data.Text.Lazy             as TL-import           Development.Shake.ATS.Type import           Development.Shake.C import           Development.Shake.FilePath import           System.Environment         (getEnv)@@ -21,10 +19,6 @@ -- | The directory @~/.atspkg@ pkgHome :: MonadIO m => CCompiler -> m String pkgHome cc' = liftIO $ (++ ("/.atspkg/" ++ ccToDir cc')) <$> getEnv "HOME"---- | The directory that will be @PATSHOME@.-patsHome :: MonadIO m => Version -> m String-patsHome v = fmap (++ (show v ++ "/")) (pkgHome (GCC Nothing))  fixDir :: FilePath -> String -> String fixDir p =
src/Development/Shake/ATS/Type.hs view
@@ -24,9 +24,9 @@                                   , genTargets                                   , hsLibs                                   , libs+                                  , patsHome+                                  , patsHomeLocs                                   , tgtType-                                  , compilerVer-                                  , libVersion                                   , linkTargets                                   ) where @@ -74,11 +74,11 @@                   deriving (Generic, Binary)  -- | Information about where to find @patscc@ and @patsopt@.-data ATSToolConfig = ATSToolConfig { _libVersion  :: Version -- ^ Standard library version to be used.-                                   , _compilerVer :: Version -- ^ Version of @patscc@ to be used.-                                   , _hasPretty   :: Bool -- ^ Whether to display errors via @pats-filter@-                                   , _cc          :: CCompiler -- ^ C compiler to be used-                                   , _linkStatic  :: Bool -- ^ Force static linking+data ATSToolConfig = ATSToolConfig { _patsHome     :: String -- ^ Value to be used for @PATSHOME@.+                                   , _patsHomeLocs :: String -- ^ Value to be used for @PATSHOMELOCS@.+                                   , _hasPretty    :: Bool -- ^ Whether to display errors via @pats-filter@+                                   , _cc           :: CCompiler -- ^ C compiler to be used+                                   , _linkStatic   :: Bool -- ^ Force static linking                                    } deriving (Generic, Binary)  data ATSGen = ATSGen { hsFile     :: FilePath -- ^ Haskell file containing types