Experiement with stack in travis
[darcs-mirror-arbtt.git] / Setup.hs
1 module Main where
2
3 import Distribution.Simple
4 import Distribution.Simple.Program
5 import Distribution.Simple.Setup
6 import Distribution.Simple.LocalBuildInfo
7 import Distribution.Simple.Utils
8 import Distribution.PackageDescription
9 import Distribution.Text
10 import System.FilePath
11 import System.Directory
12
13 main = defaultMainWithHooks simpleUserHooks
14         { hookedPrograms = [isccProgram]
15         , postBuild = myPostBuild
16         }
17
18 isccProgram = simpleProgram "ISCC"
19
20 myPostBuild _ flags pd lbi = do
21         case lookupProgram isccProgram (withPrograms lbi) of
22           Nothing -> warn verb $ "The INNO Setup compile ISCC was not found, skipping the " ++
23                                  "creation of the windows setup executable."
24           Just configuredProg -> do
25                 writeFile includeFilename $ "AppVerName=" ++ display (package pd) ++ "\n"
26                 rawSystemProgram verb configuredProg
27                                 ["/Odist","/F"++setupFilename,"setup.iss"]
28                 removeFile includeFilename
29   where verb = fromFlag (buildVerbosity flags)
30         setupFilename = display (pkgName (package pd)) ++
31                         "-setup-" ++
32                         display (pkgVersion (package pd))
33         includeFilename = "dist" </> "setup-app-ver-name.iss"