Join & Part abilities now require you to be an admin
[infinity.git] / Setup.hs
blob510320c2a094d085362d471300412d08c8ed8d36
1 #!/usr/bin/env runghc
2 import Distribution.Simple
3 import qualified Control.Exception as Ex
4 import qualified Tests.Properties as P
5 import System.Directory
6 import System.FilePath
7 import Control.Monad
8 import System.Info
9 import System.Exit
10 import List
12 inf = "infinity"
13 bins = [inf] ++
14 ["util" </> "unlambda"] -- files to remove
15 dirs = [ "."
16 , "Tests"
17 , "util"
18 , "Infinity"
19 , "Infinity" </> "Plugins"] -- directories to clean
21 main = defaultMainWithHooks $ defaultUserHooks {
22 runTests = tests,
23 postBuild = copyInfinity,
24 postClean = cleanInfinity
27 tests _ _ _ _ = P.main
29 copyInfinity _ _ _ _ = do
30 copyFile (joinPath ["dist","build","infinity",inf]) inf
31 ignore (createDirectory "Log" >> createDirectory "State")
33 cleanInfinity _ _ _ _ = do
34 mapM_ (ignore . removeFile) bins
35 mapM_ clean dirs
36 where
37 clean d = getDirectoryContents d >>= mapM_ (check d)
38 check d f = when (any (`isSuffixOf` f) exts)
39 (removeFile (d </> f))
40 exts = ["~",".o",".hi",".o-boot",".hi-boot"]
43 -- convenience
44 ignore a = Ex.catch a (\_ -> return ())