-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathSetup.hs
33 lines (29 loc) · 1.25 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
module Main where
import Distribution.Simple
import Distribution.Simple.Program
import Distribution.Simple.Setup
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Utils
import Distribution.PackageDescription
import Distribution.Text
import System.FilePath
import System.Directory
main = defaultMainWithHooks simpleUserHooks
{ hookedPrograms = [isccProgram]
, postBuild = myPostBuild
}
isccProgram = simpleProgram "ISCC"
myPostBuild _ flags pd lbi = do
case lookupProgram isccProgram (withPrograms lbi) of
Nothing -> warn verb $ "The INNO Setup compile ISCC was not found, skipping the " ++
"creation of the windows setup executable."
Just configuredProg -> do
writeFile includeFilename $ "AppVerName=" ++ display (package pd) ++ "\n"
runProgram verb configuredProg
["/Odist","/F"++setupFilename,"setup.iss"]
removeFile includeFilename
where verb = fromFlag (buildVerbosity flags)
setupFilename = display (pkgName (package pd)) ++
"-setup-" ++
display (pkgVersion (package pd))
includeFilename = "dist" </> "setup-app-ver-name.iss"