ats-setup 0.3.0.2 → 0.3.1.0
raw patch · 4 files changed
+50/−13 lines, 4 filesdep +composition-preludePVP ok
version bump matches the API change (PVP)
Dependencies added: composition-prelude
API changes (from Hackage documentation)
+ System.Process.Ext: silentCreateProcess :: CreateProcess -> IO ()
Files
- ats-setup.cabal +3/−1
- src/Distribution/ATS.hs +6/−2
- src/Distribution/ATS/Compiler.hs +32/−10
- src/System/Process/Ext.hs +9/−0
ats-setup.cabal view
@@ -1,5 +1,5 @@ name: ats-setup-version: 0.3.0.2+version: 0.3.1.0 synopsis: ATS scripts for Cabal builds description: This package contains various scripts that go in a package's @Setup.hs@ to make building libraries with ATS dependencies easier. license: BSD3@@ -21,6 +21,7 @@ library hs-source-dirs: src exposed-modules: Distribution.ATS+ , System.Process.Ext other-modules: Distribution.ATS.Compiler build-depends: base >= 4.8 && < 5 , Cabal >= 2.0@@ -36,6 +37,7 @@ , filemanip , dependency , unix+ , composition-prelude >= 1.3.0.0 default-language: Haskell2010 if flag(development) ghc-options: -Werror
src/Distribution/ATS.hs view
@@ -50,11 +50,15 @@ putStrLn "Cleaning up ATS dependencies..." >> cleanATSCabal +-- | Default compiler version+defV :: Dep.Version+defV = Dep.Version [0,3,9]+ fetchCompiler' :: IO ()-fetchCompiler' = fetchCompiler (Just "ats-deps") (Dep.Version [0,3,9])+fetchCompiler' = fetchCompiler (Just "ats-deps") defV setupCompiler' :: IO ()-setupCompiler' = setupCompiler (Just "ats-deps") (Dep.Version [0,3,9])+setupCompiler' = setupCompiler (Just "ats-deps") defV -- | This generates user hooks for a Cabal distribution that has some ATS -- library dependencies. For an example of its use, see the @Setup.hs@ of
src/Distribution/ATS/Compiler.hs view
@@ -9,6 +9,7 @@ import qualified Codec.Archive.Tar as Tar import Codec.Compression.GZip (compress, decompress)+import Control.Composition import Control.Monad (void, when) import qualified Data.ByteString.Lazy as BS import Data.Dependency@@ -33,6 +34,9 @@ bytes <- fmap Tar.write . Tar.pack directory $ fmap (drop $ length (directory :: String) + 1) files BS.writeFile (directory ++ ".tar.gz") (compress bytes) +-- intMinUrl :: Version -> String+-- intMinUrl v = "http://ats-lang.sourceforge.net/IMPLEMENT/Postiats/ATS2-Postiats-intmin-" ++ show v ++ ".tgz"+ pkgUrl :: Version -> String pkgUrl v = "https://github.com/vmchale/atspkg/raw/master/pkgs/ATS2-Postiats-" ++ show v ++ ".tar.gz" @@ -55,19 +59,37 @@ withCompiler "Unpacking" v Tar.unpack cd . Tar.read . decompress $ response -setupCompiler :: Maybe FilePath -> Version -> IO ()-setupCompiler mp v = do+silentCreateProcess :: CreateProcess -> IO ()+silentCreateProcess proc' =+ void $ readCreateProcess (proc' { std_err = NoStream }) "" +make :: Version -> FilePath -> IO ()+make v cd =+ withCompiler "Building" v >>+ silentCreateProcess ((proc "make" []) { cwd = Just cd })++install :: Version -> FilePath -> IO ()+install v cd =+ withCompiler "Installing" v >>+ silentCreateProcess ((proc "make" ["install"]) { cwd = Just cd })++configure :: FilePath -> Version -> FilePath -> IO ()+configure configurePath v cd = do+ withCompiler "Configuring" v- cd <- compilerDir mp v- let configurePath = cd ++ "/configure"+ setFileMode configurePath ownerModes setFileMode (cd ++ "/autogen.sh") ownerModes- void $ readCreateProcess ((proc (cd ++ "/autogen.sh") []) { cwd = Just cd }) ""- void $ readCreateProcess ((proc configurePath ["--prefix", cd]) { cwd = Just cd }) "" - withCompiler "Building" v- void $ readCreateProcess ((proc "make" []) { cwd = Just cd, std_err = CreatePipe }) ""- withCompiler "Installing" v- void $ readCreateProcess ((proc "make" ["install"]) { cwd = Just cd, std_err = CreatePipe }) ""+ silentCreateProcess ((proc (cd ++ "/autogen.sh") []) { cwd = Just cd })++ silentCreateProcess ((proc configurePath ["--prefix", cd]) { cwd = Just cd })++setupCompiler :: Maybe FilePath -> Version -> IO ()+setupCompiler mp v = do++ cd <- compilerDir mp v++ biaxe [configure (cd ++ "/configure"), make, install] v cd+ writeFile (cd ++ "/done") ""
+ src/System/Process/Ext.hs view
@@ -0,0 +1,9 @@+module System.Process.Ext ( silentCreateProcess+ ) where++import Control.Monad+import System.Process++silentCreateProcess :: CreateProcess -> IO ()+silentCreateProcess proc' =+ void $ readCreateProcess (proc' { std_err = NoStream }) ""