on 489ea6f help sign in
Idris-dev/Setup.hs
62 lines 2.2 kB history raw
1import Distribution.Simple
2import Distribution.Simple.InstallDirs as I
3import Distribution.Simple.LocalBuildInfo as L
4import qualified Distribution.Simple.Setup as S
5import qualified Distribution.Simple.Program as P
6import Distribution.PackageDescription
8import System.Exit
9import System.FilePath ((</>))
10import System.Process
12-- After Idris is built, we need to check and install the prelude and other libs
14make verbosity = P.runProgramInvocation verbosity . P.simpleProgramInvocation "make"
16cleanStdLib verbosity
17 = make verbosity [ "-C", "lib", "clean" ]
19installStdLib pkg local verbosity copy
20 = do let dirs = L.absoluteInstallDirs pkg local copy
21 let idir = datadir dirs
22 let icmd = ".." </> buildDir local </> "idris" </> "idris"
23 putStrLn $ "Installing libraries in " ++ idir
24 make verbosity
25 [ "-C", "lib", "install"
26 , "TARGET=" ++ idir
27 , "IDRIS=" ++ icmd
28 ]
29 make verbosity
30 [ "-C", "support", "install"
31 , "TARGET=" ++ idir
32 , "IDRIS=" ++ icmd
33 ]
35checkStdLib local verbosity
36 = do let icmd = ".." </> buildDir local </> "idris" </> "idris"
37 putStrLn $ "Building libraries..."
38 make verbosity
39 [ "-C", "lib", "check"
40 , "IDRIS=" ++ icmd
41 ]
42 make verbosity
43 [ "-C", "support", "check"
44 , "IDRIS=" ++ icmd
45 ]
47-- Install libraries during both copy and install
48-- See http://hackage.haskell.org/trac/hackage/ticket/718
49main = defaultMainWithHooks $ simpleUserHooks
50 { postCopy = \ _ flags pkg lbi -> do
51 installStdLib pkg lbi (S.fromFlag $ S.copyVerbosity flags)
52 (S.fromFlag $ S.copyDest flags)
53 , postInst = \ _ flags pkg lbi -> do
54 installStdLib pkg lbi (S.fromFlag $ S.installVerbosity flags)
55 NoCopyDest
56 , postClean = \ _ flags _ _ -> do
57 cleanStdLib (S.fromFlag $ S.cleanVerbosity flags)
58 , postBuild = \ _ flags _ lbi -> do
59 checkStdLib lbi (S.fromFlag $ S.buildVerbosity flags)
60 }