summaryrefslogtreecommitdiff
path: root/Setup.lhs
blob: 17efee44592dc49392c62da0d3fcb7ac6f4965da (plain)
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
35
36
37
38
39
40
41
42
43
#! /usr/bin/env runhaskell

> import Distribution.Simple
> import System.Process(system)
>
> import Config(config)
>
> import Distribution.Simple.Setup
> import Distribution.PackageDescription
> import Distribution.Simple.LocalBuildInfo
> import Distribution.Simple.Command
> import Distribution.PackageDescription.Parse
> import Distribution.Simple.Utils(info)
> import Distribution.Verbosity

> main = do
>    defaultMainWithHooks autoconfUserHooks {
>        runTests = t, 
>        postConf = modifiedPostConf }
>   where modifiedPostConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ()
>         modifiedPostConf args flags pkg_descr lbi
>              = do let verbosity = fromFlag (configVerbosity flags)
>                   noExtraFlags args
>
>                   config
>
>                   pbi <- getHookedBuildInfo verbosity
>                   let pkg_descr' = updatePackageDescription pbi pkg_descr
>                   postConf simpleUserHooks args flags pkg_descr' lbi


> getHookedBuildInfo :: Verbosity -> IO HookedBuildInfo
> getHookedBuildInfo verbosity = do
>   maybe_infoFile <- defaultHookedPackageDesc
>   case maybe_infoFile of
>     Nothing       -> return emptyHookedBuildInfo
>     Just infoFile -> do
>       info verbosity $ "Reading parameters from " ++ infoFile
>       readHookedBuildInfo verbosity infoFile


> t _ _ _ _ = system ( "runhaskell examples/tests.hs") >> return()