| 2 | | \begin{code} |
| 3 | | |
| 4 | | module Main where |
| 5 | | import Distribution.Simple |
| 6 | | -- import Distribution.PreProcess |
| 7 | | -- import Distribution.PackageDescription |
| 8 | | |
| 9 | | main :: IO () |
| 10 | | main = defaultMain |
| 11 | | |
| 12 | | \end{code} |
| 13 | | |
| 14 | | main' :: IO () |
| 15 | | main' = defaultMainWithHooks $ defaultUserHooks |
| 16 | | { runTests = test |
| 17 | | , preBuild = stage1 |
| 18 | | , hookedPreProcessors = [ppDrift] -- New and/or overrides |
| 19 | | } |
| 20 | | |
| 21 | | test :: a -> b -> c -> IO d |
| 22 | | test _ _ _ = error "foo!" |
| 23 | | |
| 24 | | ppDrift :: a |
| 25 | | ppDrift = error "bar!" |
| 26 | | |
| 27 | | -- Basic plan: Here we detect, by virtue of --bootstrap, whether |
| 28 | | -- we are to do a stage1 build or skip over to the main build after all. |
| 29 | | |
| 30 | | stage1 :: Args -> Int -> IO HookedBuildInfo |
| 31 | | stage1 = error "baz!" |
| | 2 | > import Distribution.Simple |
| | 3 | > import System.Directory |
| | 4 | > import System.Environment |
| | 5 | > import System.Cmd (rawSystem) |
| | 6 | > |
| | 7 | > main :: IO () |
| | 8 | > main = do |
| | 9 | > args <- getArgs |
| | 10 | > if args == ["-d"] then putStrLn =<< getAppUserDataDirectory "cabal" else do |
| | 11 | >-- writeBuildInfo |
| | 12 | > defaultMainWithHooks autoconfUserHooks |
| | 13 | >-- where |
| | 14 | >-- writeBuildInfo = rawSystem "perl" ["Configure.PL"] |