diff options
Diffstat (limited to 'Setup.lhs')
-rw-r--r-- | Setup.lhs | 37 |
1 files changed, 36 insertions, 1 deletions
@@ -2,7 +2,42 @@ | |||
2 | 2 | ||
3 | > import Distribution.Simple | 3 | > import Distribution.Simple |
4 | > import System.Process(system) | 4 | > import System.Process(system) |
5 | > | ||
6 | > import Config(config) | ||
7 | > | ||
8 | > import Distribution.Simple.Setup | ||
9 | > import Distribution.PackageDescription | ||
10 | > import Distribution.Simple.LocalBuildInfo | ||
11 | > import Distribution.Simple.Command | ||
12 | > import Distribution.PackageDescription.Parse | ||
13 | > import Distribution.Simple.Utils(info) | ||
14 | > import Distribution.Verbosity | ||
15 | |||
16 | > main = do | ||
17 | > defaultMainWithHooks autoconfUserHooks { | ||
18 | > runTests = t, | ||
19 | > postConf = modifiedPostConf } | ||
20 | > where modifiedPostConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO () | ||
21 | > modifiedPostConf args flags pkg_descr lbi | ||
22 | > = do let verbosity = fromFlag (configVerbosity flags) | ||
23 | > noExtraFlags args | ||
24 | > | ||
25 | > config | ||
26 | > | ||
27 | > pbi <- getHookedBuildInfo verbosity | ||
28 | > let pkg_descr' = updatePackageDescription pbi pkg_descr | ||
29 | > postConf simpleUserHooks args flags pkg_descr' lbi | ||
30 | |||
31 | |||
32 | > getHookedBuildInfo :: Verbosity -> IO HookedBuildInfo | ||
33 | > getHookedBuildInfo verbosity = do | ||
34 | > maybe_infoFile <- defaultHookedPackageDesc | ||
35 | > case maybe_infoFile of | ||
36 | > Nothing -> return emptyHookedBuildInfo | ||
37 | > Just infoFile -> do | ||
38 | > info verbosity $ "Reading parameters from " ++ infoFile | ||
39 | > readHookedBuildInfo verbosity infoFile | ||
5 | 40 | ||
6 | > main = defaultMainWithHooks autoconfUserHooks {runTests = t} | ||
7 | 41 | ||
8 | > t _ _ _ _ = system ( "runhaskell examples/tests.hs") >> return() | 42 | > t _ _ _ _ = system ( "runhaskell examples/tests.hs") >> return() |
43 | |||