-
Notifications
You must be signed in to change notification settings - Fork 1
/
Setup.hs
33 lines (29 loc) · 1.29 KB
/
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
#!/usr/bin/env runhaskell
import Distribution.Simple
import Distribution.Simple.Setup
import Distribution.Simple.PreProcess
import Distribution.Simple.Program
import Distribution.Simple.Utils
import Distribution.PackageDescription
import Distribution.Simple.LocalBuildInfo
import Data.Char
import System.Exit
import System.IO
import System.Directory
import System.FilePath.Windows
main = let hooks = simpleUserHooks
in defaultMainWithHooks hooks { confHook = hailsConfigure
, cleanHook = hailsClean
}
-- This is a non-portable version of hails. It generates the
-- files inside the src dir.
hailsConfigure :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo
hailsConfigure (gpd, info) flags = do
runProgramInvocation verbosity $ simpleProgramInvocation "hails" ["--init", "--output-dir=src"]
(confHook simpleUserHooks) (gpd, info) flags
where verbosity = fromFlag $ configVerbosity flags
hailsClean :: PackageDescription -> () -> UserHooks -> CleanFlags -> IO ()
hailsClean pd () hooks flags = do
runProgramInvocation verbosity $ simpleProgramInvocation "hails" ["--clean", "--output-dir=src"]
(cleanHook simpleUserHooks) pd () hooks flags
where verbosity = fromFlag $ cleanVerbosity flags