ats-pkg 1.4.0.1 → 1.4.0.3
raw patch · 5 files changed
+70/−5 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +57/−3
- ats-pkg.cabal +1/−1
- src/Language/ATS/Package/Build.hs +2/−1
- src/Language/ATS/Package/Dependency.hs +9/−0
- src/Language/ATS/Package/Type.hs +1/−0
README.md view
@@ -27,6 +27,25 @@ may wish to read the Dhall tutorial first, but you do not need to fully understand everything to get started. +### Project Templates++You can use [pi](https://github.com/vmchale/project-init) with the builtin `ats`+template as follows:++```+pi new ats cool-project+```++You can then build with `atspkg build` or install with `atspkg install`.++Alternately, you can start with a templated Haskell library calling ATS code:++```+pi git vmchale/haskell-ats ambitious-project+```++which can be built with `atspkg build` followed by `cabal new-build`.+ ### Building a Binary Package The minimal configuration for a package with a binary target is as follows:@@ -46,7 +65,7 @@ ``` You need only specify the source file and the target; `atspkg` will parse your-ATS source files and track them.+ATS source files and track them (it will not track included C however). ### Depending on a Library @@ -63,14 +82,49 @@ in dep ``` +This defines a dependency by pointing to its tarball. Unlike+[cabal](https://www.haskell.org/cabal/) or other sophisticated package managers,+`atspkg` does not allow transitive dependencies and it does not do any+constraint solving. Let's look at a simple example:++```+let pkg = https://raw.githubusercontent.com/vmchale/atspkg/master/pkgs/default.dhall++in pkg //+ { bin =+ [+ { src = "src/compat.dats"+ , target = "target/poly"+ , libs = ([] : List Text)+ , gc = True+ }+ ]+ , dependencies = [ https://raw.githubusercontent.com/vmchale/ats-concurrency/master/atspkg.dhall ]+ }+```++As Dhall is distributed, you can simply point to the package configuration URL+to add a dependency. You can find several preconfigured packages+[here](https://github.com/vmchale/atspkg/tree/master/pkgs), or you can write+your own configurations.+ ### Building a Haskell Library You can see an example [here](https://github.com/vmchale/fast-arithmetic). You-can+can configure the ATS side of things as follows: ``` let pkg = https://raw.githubusercontent.com/vmchale/atspkg/master/pkgs/default.dhall in pkg //- { atsSource = [ "ats-src/{{ project }}.dats" ] }+ { atsSource = [ "ats-src/ambitious-project.dats" ] } ```++This just tells `atspkg` to look for a source file called+`ats-src/ambitious-project.dats`, which will be compiled to+`ambitious-project.c` in the default directory (i.e. `cbits`). You can then+call the generated code just as you would call C.++You may wish to consider+[ats-setup](http://hackage.haskell.org/package/ats-setup) as well if you are+packaging the Haskell for distribution.
ats-pkg.cabal view
@@ -1,5 +1,5 @@ name: ats-pkg-version: 1.4.0.1+version: 1.4.0.3 synopsis: Package manager for ATS description: A collection of scripts to make building ATS projects easy. homepage: https://github.com/vmchale/ats-pkg#readme
src/Language/ATS/Package/Build.hs view
@@ -89,7 +89,8 @@ pkgToAction :: [String] -> Pkg -> Rules () pkgToAction rs (Pkg bs ts mt v v' ds cds cc cf as cdir) = do unless (rs == ["clean"]) $- liftIO $ fetchDeps False ds cds >> stopGlobalPool+ let cdps = if any gc bs then libcAtomicOps : libcGC : cds else cds in+ liftIO $ fetchDeps False ds cdps >> stopGlobalPool action (need ["atspkg.dhall"]) mapM_ g (bs ++ ts) let bins = TL.unpack . target <$> bs
src/Language/ATS/Package/Dependency.hs view
@@ -4,6 +4,9 @@ fetchDeps -- * Types , Dependency (..)+ -- * Constants+ , libcAtomicOps+ , libcGC ) where import qualified Codec.Archive.Tar as Tar@@ -24,6 +27,12 @@ import System.Environment (getEnv) import System.Posix.Files import System.Process++libcAtomicOps :: Dependency+libcAtomicOps = Dependency "atomic-ops" "atomic-ops-7.6.2" "https://github.com/ivmai/libatomic_ops/releases/download/v7.6.2/libatomic_ops-7.6.2.tar.gz" (Version [7,6,2])++libcGC :: Dependency+libcGC = Dependency "gc" "gc-7.4.10" "https://github.com/ivmai/bdwgc/releases/download/v7.4.10/gc-7.4.10.tar.gz" (Version [7,4,10]) fetchDeps :: Bool -- ^ Set to 'False' if unsure. -> [Dependency] -- ^ ATS dependencies
src/Language/ATS/Package/Type.hs view
@@ -33,6 +33,7 @@ deriving newtype instance Interpret Version +-- TODO make this a map from versions to tarballs etc. -- | Type for a dependency data Dependency = Dependency { libName :: Text -- ^ Library name, e.g. , dir :: Text -- ^ Directory we should unpack to