-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.hs
More file actions
23 lines (20 loc) · 778 Bytes
/
Setup.hs
File metadata and controls
23 lines (20 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Control.Monad (when)
import Distribution.Simple
import System.Directory (doesFileExist)
import System.Process (readProcess)
import Data.ByteString.Char8 as BS
gitVersion :: IO ()
gitVersion = do
let filename = "src/Gitomail/Version.hs"
versionSh = "./version.sh"
hasVersionSh <- doesFileExist versionSh
when hasVersionSh $ do
ver <- fmap BS.pack $ readProcess versionSh [] ""
let override = BS.writeFile filename ver
e <- doesFileExist filename
if e then do orig_ver <- BS.readFile filename
when (ver /= orig_ver) $ do
override
else override
main :: IO ()
main = gitVersion >> defaultMain