File: Setup.hs

package info (click to toggle)
arbtt 0.10.1-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 600 kB
  • sloc: haskell: 3,484; xml: 2,038; makefile: 33
file content (33 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (6)
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"
                rawSystemProgram 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"