packages feed

ats-pkg 2.3.0.3 → 2.3.0.6

raw patch · 8 files changed

+57/−30 lines, 8 filesdep +bzlibdep +lzma

Dependencies added: bzlib, lzma

Files

ats-pkg.cabal view
@@ -1,5 +1,5 @@ name:                ats-pkg-version:             2.3.0.3+version:             2.3.0.6 synopsis:            A build tool for ATS description:         A collection of scripts to simplify building ATS projects. homepage:            https://github.com/vmchale/atspkg#readme@@ -45,6 +45,8 @@                      , http-client                      , bytestring                      , shake+                     , bzlib+                     , lzma                      , tar                      , zlib                      , http-client-tls
docs/manual.tex view
@@ -53,6 +53,7 @@ by cabal, so this is a flexible approach.  ATSPackage can also generate data types for ATS based on Haskell types. You can-use this to eliminate some of the work involved in writing FFI bindings.+use this to eliminate some of the work involved in writing FFI bindings, and+particularly to avoid ATS' lack of generics.  \end{document}
man/atspkg.1 view
@@ -66,6 +66,11 @@ Disable the shake linter .RS .RE+.TP+.B \f[B]\-t\f[], \f[B]\-\-target\f[]+Set the compilation target using its triple.+.RS+.RE .SH CONFIGURATION .PP \f[B]atspkg\f[] is configured with Dhall, in an atspkg.dhall file.
src/Language/ATS/Package/Build.hs view
@@ -13,6 +13,7 @@  import           Control.Composition import           Control.Concurrent.ParallelIO.Global+import           Control.Lens import           Control.Monad.IO.Class               (MonadIO) import           Data.Binary                          (decode, encode) import qualified Data.ByteString                      as BS@@ -159,8 +160,8 @@             , pkgToAction setup rs tgt =<< cleanConfig rs             ] -asTuple :: TargetPair -> (Text, Text)-asTuple (TargetPair s t) = (s, t)+asTuple :: TargetPair -> (Text, Text, Bool)+asTuple (TargetPair s t b) = (s, t, b)  mkConfig :: Rules () mkConfig =@@ -184,6 +185,12 @@ pkgToTargets ~Pkg{..} [] = TL.unpack . target <$> bin pkgToTargets _ ts        = ts +-- CROSS-COMPILING atslib:+--+-- 1. use the intmin version+--+-- 2. Then idk?? it's a mess??+ pkgToAction :: [IO ()] -- ^ Setup actions to be performed             -> [String] -- ^ Targets             -> Maybe String -- ^ Optional compiler triple (overrides 'ccompiler')@@ -193,12 +200,14 @@      unless (rs == ["clean"]) $ do -        want [".atspkg/config"]+        checkDeps <- liftIO $ doesFileExist ".atspkg/config"          let cdps = if any gcBin bs then "gc" : cds else cds -        liftIO $ fetchDeps setup (TL.unpack <$> ds) (TL.unpack <$> cdps) False >> stopGlobalPool+        liftIO $ fetchDeps (ccFromString cc') setup (TL.unpack <$> ds) (TL.unpack <$> cdps) checkDeps >> stopGlobalPool +        want [".atspkg/config"]+         let bins = TL.unpack . target <$> bs         setTargets rs bins mt @@ -208,7 +217,7 @@      where g (Bin s t ls hs' atg gc' cSrc) =             atsBin-                (BinaryTarget cc' (TL.unpack <$> cf) (ATSToolConfig v v' False) gc' (TL.unpack <$> ls) (TL.unpack s) hs' (both TL.unpack . asTuple <$> atg) (TL.unpack t) (TL.unpack <$> cSrc))+                (BinaryTarget cc' (TL.unpack <$> cf) (ATSToolConfig v v' False) gc' (TL.unpack <$> ls) (TL.unpack s) hs' (unpackBoth . asTuple <$> atg) (TL.unpack t) (TL.unpack <$> cSrc))            cDepsRules = unless (null as) $ do             let cedar = TL.unpack cdir@@ -219,3 +228,6 @@             mapM_ (cgen $ ATSToolConfig v v' hasPF) atsSourceDirs            cc' = maybe (TL.unpack ccLocal) (<> "-gcc") tgt++          unpackBoth :: (Text, Text, Bool) -> (String, String, Bool)+          unpackBoth = over _1 TL.unpack . over _2 TL.unpack
src/Language/ATS/Package/Dependency.hs view
@@ -7,7 +7,9 @@  import qualified Codec.Archive.Tar                    as Tar import           Codec.Archive.Zip                    (ZipOption (..), extractFilesFromArchive, toArchive)+import qualified Codec.Compression.BZip               as Bzip import qualified Codec.Compression.GZip               as Gzip+import qualified Codec.Compression.Lzma               as Lzma import           Control.Concurrent.ParallelIO.Global import           Control.Lens import           Control.Monad@@ -20,32 +22,33 @@ import           Language.ATS.Package.Error import           Language.ATS.Package.PackageSet import           Language.ATS.Package.Type-import           Network.HTTP.Client+import           Network.HTTP.Client                  hiding (host) import           Network.HTTP.Client.TLS              (tlsManagerSettings) import           System.Directory import           System.Environment                   (getEnv) import           System.Posix.Files import           System.Process -fetchDeps :: [IO ()] -- ^ Setup steps that can be performed concurrently+fetchDeps :: CCompiler -- ^ C compiler to use+          -> [IO ()] -- ^ Setup steps that can be performed concurrently           -> [String] -- ^ ATS dependencies           -> [String] -- ^ C Dependencies           -> Bool -- ^ Whether to perform setup anyhow.           -> IO ()-fetchDeps setup' deps cdeps b' =+fetchDeps cc' setup' deps cdeps b' =     unless (null deps && null cdeps && b') $ do-        deps' <- join <$> setBuildPlan "ats" deps 15+        deps' <- join <$> setBuildPlan "ats" deps         putStrLn "Checking ATS dependencies..."-        d <- (<> "lib/") <$> pkgHome+        d <- (<> "lib/") <$> pkgHome cc'         let libs' = fmap (buildHelper False) deps'-        cdeps' <- join <$> setBuildPlan "c" cdeps 4+        cdeps' <- join <$> setBuildPlan "c" cdeps         let unpacked = fmap (over dirLens (TL.pack d <>)) cdeps'             clibs = fmap (buildHelper False) unpacked         parallel_ (setup' ++ libs' ++ clibs)-        mapM_ (setup (GCC Nothing Nothing)) unpacked+        mapM_ (setup cc') unpacked -pkgHome :: IO FilePath-pkgHome = (++ "/.atspkg/") <$> getEnv "HOME"+pkgHome :: CCompiler -> IO FilePath+pkgHome cc' = (++ ("/.atspkg/" ++ ccToDir cc')) <$> getEnv "HOME"  allSubdirs :: FilePath -> IO [FilePath] allSubdirs [] = pure mempty@@ -56,7 +59,7 @@     ds' <- mapM allSubdirs ds     pure $ join (ds : ds') --- TODO? autoconf+-- TODO we should allow ATS libraries to be set up like this? clibSetup :: CCompiler -- ^ C compiler           -> String -- ^ Library name           -> FilePath -- ^ Filepath to unpack to@@ -65,10 +68,10 @@     subdirs <- allSubdirs p     configurePath <- fromMaybe (p <> "/configure") <$> findFile subdirs "configure"     setFileMode configurePath ownerModes-    h <- pkgHome+    h <- pkgHome cc'     let procEnv = Just [("CC", ccToString cc'), ("CFLAGS" :: String, "-I" <> h <> "include"), ("PATH", "/usr/bin:/bin")]     putStrLn $ "configuring " ++ lib' ++ "..."-    void $ readCreateProcess ((proc configurePath ["--prefix", h]) { cwd = Just p, env = procEnv, std_err = CreatePipe }) ""+    void $ readCreateProcess ((proc configurePath ["--prefix", h, "--host", host]) { cwd = Just p, env = procEnv, std_err = CreatePipe }) ""     putStrLn $ "building " ++ lib' ++ "..."     void $ readCreateProcess ((proc "make" []) { cwd = Just p, std_err = CreatePipe }) ""     putStrLn $ "installing " ++ lib' ++ "..."@@ -78,7 +81,7 @@       -> ATSDependency -- ^ ATSDependency itself       -> IO () setup cc' (ATSDependency lib' dirName' _ _ _) = do-    lib'' <- (<> TL.unpack lib') <$> pkgHome+    lib'' <- (<> TL.unpack lib') <$> pkgHome cc'     b <- doesFileExist lib''     unless b $ do         clibSetup cc' (TL.unpack lib') (TL.unpack dirName')@@ -88,6 +91,8 @@ getCompressor s     | ".tar.gz" `TL.isSuffixOf` s || ".tgz" `TL.isSuffixOf` s = pure Gzip.decompress     | ".tar" `TL.isSuffixOf` s = pure id+    | ".tar.xz" `TL.isSuffixOf` s = pure Lzma.decompress+    | ".tar.bz2" `TL.isSuffixOf` s = pure Bzip.decompress     | otherwise = unrecognized (TL.unpack s)  tarResponse :: Text -> FilePath -> ByteString -> IO ()
src/Language/ATS/Package/PackageSet.hs view
@@ -28,9 +28,8 @@  setBuildPlan :: FilePath -- ^ Filepath for cache inside @.atspkg@              -> [String] -- ^ Libraries we want-             -> Int -- ^ Depth of search when resolving dependencies              -> IO [[ATSDependency]]-setBuildPlan p deps n  = do+setBuildPlan p deps = do     b <- doesFileExist depCache     bool setBuildPlan' (decode <$> BSL.readFile depCache) b @@ -38,14 +37,14 @@           setBuildPlan' = do             putStrLn "Resolving dependencies..."             pkgSet <- input auto "https://raw.githubusercontent.com/vmchale/atspkg/master/pkgs/pkg-set.dhall"-            case mkBuildPlan pkgSet n deps of+            case mkBuildPlan pkgSet deps of                 Right x -> createDirectoryIfMissing True ".atspkg" >> BSL.writeFile depCache (encode x) >> pure x                 Left x  -> resolutionFailed x -mkBuildPlan :: ATSPackageSet -> Int -> [String] -> DepM [[ATSDependency]]-mkBuildPlan aps@(ATSPackageSet ps) n = finalize . resolve . fmap asDep <=< stringBuildPlan+mkBuildPlan :: ATSPackageSet -> [String] -> DepM [[ATSDependency]]+mkBuildPlan aps@(ATSPackageSet ps) = finalize . resolve . fmap asDep <=< stringBuildPlan     where finalize = fmap (fmap (fmap (lookupVersions aps)))-          resolve = resolveDependencies n (atsPkgsToPkgs aps)+          resolve = resolveDependencies (atsPkgsToPkgs aps)           stringBuildPlan names = sequence [ lookup' x libs | x <- names ]               where libs = (TL.unpack . libName &&& id) <$> ps                     lookup' k vs = case lookup k vs of
src/Language/ATS/Package/Type.hs view
@@ -48,8 +48,9 @@ makeLensesFor [("dir", "dirLens")] ''ATSDependency  -- | This is just a tuple, except I can figure out how to use it with Dhall.-data TargetPair = TargetPair { hs  :: Text-                             , ats :: Text+data TargetPair = TargetPair { hs    :: Text+                             , ats   :: Text+                             , cpphs :: Bool                              } deriving (Eq, Show, Generic, Interpret, Binary)  deriving instance Interpret ForeignCabal
stack.yaml view
@@ -3,14 +3,16 @@ packages:   - '.'   - 'dependency'+  - 'shake-ats'+  - 'hs2ats' extra-deps:   - shake-ext-2.3.0.0-  - shake-ats-1.3.0.6   - composition-prelude-1.1.0.2   - language-ats-0.2.0.0   - cli-setup-0.2.0.1-  - hs2ats-0.2.1.3   - ats-setup-0.3.0.2+  - hspec-dirstream-0.3.0.0+  - dirstream-1.0.3 flags:   ats-pkg:     development: false