-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSetup.hs
34 lines (27 loc) · 838 Bytes
/
Setup.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env runhaskell
import Distribution.Simple
import Distribution.PackageDescription
import Control.Monad
import System.Directory
import FindBench
import FindConfig
main = defaultMainWithHooks simpleUserHooks {
preConf = createConfDir
, postConf = writeLocalConf
, postClean = deleteLocalConf}
createConfDir _ _ = do
e <- doesDirectoryExist configDir
unless e (createDirectory configDir)
return emptyHookedBuildInfo
writeLocalConf _ _ _ _ = do
findLocalConfigs configDir
findLocalBenchmarks benchmarkDir
deleteLocalConf _ _ _ _ = do
deleteIfExists (localConfigsFileName configDir)
deleteIfExists :: FilePath -> IO ()
deleteIfExists f = do
e <- doesFileExist f
when e (removeFile f)
configDir, benchmarkDir :: FilePath
configDir = "config"
benchmarkDir = "benchmarks"