module Development.Shake.BinDist (
tarLzip
, tarZstd
, tarBz2
, tarGz
, tarXz
, tarLzipA
, tarZstdA
, tarBz2A
, tarGzA
, tarXzA
) where
import Archive.Compression (packFromFilesAndCompress)
import qualified Codec.Compression.BZip as Bz2
import qualified Codec.Compression.GZip as GZip
import qualified Codec.Compression.Zstd.Lazy as Zstd
import qualified Codec.Compression.Lzma as Lzma
import qualified Codec.Lzip as Lzip
import qualified Data.ByteString.Lazy as BSL
import Development.Shake hiding (action)
tarGenericA :: String
-> (BSL.ByteString -> BSL.ByteString)
-> [FilePath]
-> FilePath
-> Action ()
tarGenericA :: String
-> (ByteString -> ByteString) -> [String] -> String -> Action ()
tarGenericA String
rn ByteString -> ByteString
f [String]
fps String
tar = do
Partial => [String] -> Action ()
[String] -> Action ()
need [String]
fps
String -> IO () -> Action ()
forall a. String -> IO a -> Action a
traced String
rn (IO () -> Action ()) -> IO () -> Action ()
forall a b. (a -> b) -> a -> b
$ (ByteString -> ByteString) -> String -> [String] -> IO ()
packFromFilesAndCompress ByteString -> ByteString
f String
tar [String]
fps
mkRule :: (a -> FilePath -> Action ()) -> a -> FilePattern -> Rules ()
mkRule :: (a -> String -> Action ()) -> a -> String -> Rules ()
mkRule a -> String -> Action ()
action a
x String
pat =
String
pat Partial => String -> (String -> Action ()) -> Rules ()
String -> (String -> Action ()) -> Rules ()
%> \String
out ->
a -> String -> Action ()
action a
x String
out
tarLzip :: [FilePath]
-> FilePattern
-> Rules ()
tarLzip :: [String] -> String -> Rules ()
tarLzip = ([String] -> String -> Action ()) -> [String] -> String -> Rules ()
forall a. (a -> String -> Action ()) -> a -> String -> Rules ()
mkRule [String] -> String -> Action ()
tarLzipA
tarZstd :: [FilePath]
-> FilePattern
-> Rules ()
tarZstd :: [String] -> String -> Rules ()
tarZstd = ([String] -> String -> Action ()) -> [String] -> String -> Rules ()
forall a. (a -> String -> Action ()) -> a -> String -> Rules ()
mkRule [String] -> String -> Action ()
tarZstdA
tarGz :: [FilePath]
-> FilePattern
-> Rules ()
tarGz :: [String] -> String -> Rules ()
tarGz = ([String] -> String -> Action ()) -> [String] -> String -> Rules ()
forall a. (a -> String -> Action ()) -> a -> String -> Rules ()
mkRule [String] -> String -> Action ()
tarGzA
tarBz2 :: [FilePath]
-> FilePattern
-> Rules ()
tarBz2 :: [String] -> String -> Rules ()
tarBz2 = ([String] -> String -> Action ()) -> [String] -> String -> Rules ()
forall a. (a -> String -> Action ()) -> a -> String -> Rules ()
mkRule [String] -> String -> Action ()
tarBz2A
tarXz :: [FilePath]
-> FilePattern
-> Rules ()
tarXz :: [String] -> String -> Rules ()
tarXz = ([String] -> String -> Action ()) -> [String] -> String -> Rules ()
forall a. (a -> String -> Action ()) -> a -> String -> Rules ()
mkRule [String] -> String -> Action ()
tarBz2A
tarLzipA :: [FilePath]
-> FilePath
-> Action ()
tarLzipA :: [String] -> String -> Action ()
tarLzipA = String
-> (ByteString -> ByteString) -> [String] -> String -> Action ()
tarGenericA String
"tar-lzip" ByteString -> ByteString
Lzip.compressBest
tarZstdA :: [FilePath]
-> FilePath
-> Action ()
tarZstdA :: [String] -> String -> Action ()
tarZstdA = String
-> (ByteString -> ByteString) -> [String] -> String -> Action ()
tarGenericA String
"tar-zstd" (Int -> ByteString -> ByteString
Zstd.compress Int
Zstd.maxCLevel)
tarGzA :: [FilePath]
-> FilePath
-> Action ()
tarGzA :: [String] -> String -> Action ()
tarGzA = String
-> (ByteString -> ByteString) -> [String] -> String -> Action ()
tarGenericA String
"tar-gz" ByteString -> ByteString
GZip.compress
tarBz2A :: [FilePath]
-> FilePath
-> Action ()
tarBz2A :: [String] -> String -> Action ()
tarBz2A = String
-> (ByteString -> ByteString) -> [String] -> String -> Action ()
tarGenericA String
"tar-bz2" ByteString -> ByteString
Bz2.compress
tarXzA :: [FilePath]
-> FilePath
-> Action ()
tarXzA :: [String] -> String -> Action ()
tarXzA = String
-> (ByteString -> ByteString) -> [String] -> String -> Action ()
tarGenericA String
"lzma" ByteString -> ByteString
Lzma.compress