packages feed

shake-ext 1.1.0.0 → 1.2.0.0

raw patch · 3 files changed

+24/−24 lines, 3 files

Files

shake-ext.cabal view
@@ -1,5 +1,5 @@ name:                shake-ext-version:             1.1.0.0+version:             1.2.0.0 synopsis:            Helper functions for linting with shake  description:         This package provides several linters out of the box, as well as functionality for building ATS source files with [shake](http://shakebuild.com/). homepage:            https://hub.darcs.net/vmchale/shake-ext
src/Development/Shake/ATS.hs view
@@ -32,14 +32,14 @@     show (Version [x])    = show x     show (Version (x:xs)) = show x ++ "." ++ show (Version xs) -patsHome :: Action String-patsHome = fromMaybe "/usr/local/lib/ats2-postiats-0.3.9" <$> mh-    where mh = fmap (++ "/.atspkg/0.3.8/") <$> getEnv "HOME"+patsHome :: Version -> Action String+patsHome v = fromMaybe "/usr/local/lib/ats2-postiats-0.3.9" <$> mh+    where mh = fmap (++ ("/.atspkg/" ++ show v ++ "/")) <$> getEnv "HOME"  -- TODO install the whole compiler?-atsCommand :: CmdResult r => Version -> String -> String -> Action r-atsCommand v sourceFile out = do-    h <- patsHome+atsCommand :: CmdResult r => Version -> Version -> String -> String -> Action r+atsCommand v v' sourceFile out = do+    h <- patsHome v'     let home = h ++ "lib/ats2-postiats-" ++ show v     let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]         patsc = "patsopt"@@ -49,24 +49,24 @@ gcFlag False = "-DATS_MEMALLOC_LIBC" gcFlag True  = "-DATS_MEMALLOC_GCBDW" -copySources :: Version -> [FilePath] -> Action ()-copySources v sources =+copySources :: Version -> Version -> [FilePath] -> Action ()+copySources v v' sources =     forM_ sources $ \dep -> do-        h <- patsHome+        h <- patsHome v'         let home = h ++ "lib/ats2-postiats-" ++ show v         liftIO $ createDirectoryIfMissing True (home ++ "/" ++ takeDirectory dep)         liftIO $ copyFile dep (home ++ "/" ++ dep)  -- TODO musl?-atsBin :: Version -> Bool -> [String] -> String -> String -> Rules ()-atsBin v gc libs sourceFile out =+atsBin :: Version -> Version -> Bool -> [String] -> String -> String -> Rules ()+atsBin v v' gc libs sourceFile out =      out %> \_ -> do         sources <- transitiveDeps [sourceFile]-        h <- patsHome+        h <- patsHome v'         let home = h ++ "lib/ats2-postiats-" ++ show v         need sources-        copySources v sources+        copySources v v' sources         cmd_ ["mkdir", "-p", dropDirectory1 out]          let toLibs = fmap ("-l" <>)@@ -93,11 +93,11 @@         removeFilesAfter ".atspkg" ["//*"]         removeFilesAfter "ats-deps" ["//*"] -handleSource :: Version -> FilePath -> Action ()-handleSource v sourceFile = do+handleSource :: Version -> Version -> FilePath -> Action ()+handleSource v v' sourceFile = do         sources <- transitiveDeps [sourceFile]         need sources-        copySources v sources+        copySources v v' sources  -- | This provides rules for generating C code from ATS source files in the -- @ats-src@ directory.@@ -106,8 +106,8 @@      "//*.c" %> \out -> do         let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")-        handleSource v sourceFile-        atsCommand v sourceFile out+        handleSource v v sourceFile+        atsCommand v v sourceFile out  trim :: String -> String trim = init . drop 1@@ -128,8 +128,8 @@     "//*.c" %> \out -> do          let sourceFile = dir ++ "/" ++ (dropDirectory1 out -<.> "dats")-        handleSource v sourceFile-        (Exit c, Stderr err) :: (Exit, Stderr String) <- atsCommand v sourceFile out+        handleSource v v sourceFile+        (Exit c, Stderr err) :: (Exit, Stderr String) <- atsCommand v v sourceFile out         cmd_ [Stdin err] Shell "pats-filter"         if c /= ExitSuccess             then error "patscc failure"
src/Development/Shake/C.hs view
@@ -5,10 +5,10 @@ import           Development.Shake.ATS  -- | Build a C binary, including relevant ATS-related paths.-cBinary :: FilePath -> FilePath -> Action ()-cBinary src target = do+cBinary :: Version -> FilePath -> FilePath -> Action ()+cBinary v src target = do     need [src]-    home <- patsHome+    home <- patsHome v     let atsArgs = [EchoStderr False, AddEnv "PATSHOME" home]     command atsArgs "gcc" [src, "-flto", "-I" ++ home ++ "/ccomp/runtime", "-I" ++ home, "-o", target, "-O2"]         -- cmd ["strip", out]