on 5570cee help sign in
Idris-dev/Setup.hs
39 lines 1.4 kB history raw
1import Distribution.Simple
2import Distribution.Simple.InstallDirs as I
3import Distribution.Simple.LocalBuildInfo as L
4import Distribution.PackageDescription
6import System.Exit
7import System.Process
9-- After Idris is built, we need to check and install the prelude and other libs
11system' cmd = do
12 exit <- system cmd
13 case exit of
14 ExitSuccess -> return ()
15 ExitFailure _ -> exitWith exit
17postCleanLib args flags desc _
18 = system' "make -C lib clean"
20addPrefix pfx var c = "export " ++ var ++ "=" ++ show pfx ++ "/" ++ c ++ ":$" ++ var
22postInstLib args flags desc local
23 = do let pkg = localPkgDescr local
24 let penv = packageTemplateEnv (package pkg)
25 let cenv = compilerTemplateEnv (compilerId (compiler local))
26 let dirs_pkg = substituteInstallDirTemplates penv (installDirTemplates local)
27 let dirs = substituteInstallDirTemplates cenv dirs_pkg
28 let datad = datadir dirs
29 let datasubd = datasubdir dirs
30 let bind = fromPathTemplate (bindir dirs)
31 let idir = fromPathTemplate (datadir dirs) ++ "/" ++
32 fromPathTemplate (datasubdir dirs)
33 putStrLn $ "Installing libraries in " ++ idir
34 system' $ "make -C lib install TARGET=" ++ idir ++ " BINDIR=" ++ bind
36main = defaultMainWithHooks (simpleUserHooks { postInst = postInstLib,
37 postClean = postCleanLib })