forked from agda/agda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setup.hs
25 lines (20 loc) · 909 Bytes
/
Setup.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
import Distribution.Simple.BuildPaths (exeExtension)
import Distribution.PackageDescription
import System.FilePath
import System.Process
import System.Exit
main = defaultMainWithHooks hooks
hooks = simpleUserHooks { postInst = checkAgdaPrimitive }
checkAgdaPrimitive :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
checkAgdaPrimitive args flags pkg info = do
let dirs = absoluteInstallDirs pkg info NoCopyDest
agda = buildDir info </> "agda" </> "agda" <.> exeExtension
prim = datadir dirs </> "lib" </> "prim" </> "Agda" </> "Primitive" <.> "agda"
putStrLn "Generating Agda library interface files..."
ok <- rawSystem agda [prim, "-v0"]
case ok of
ExitSuccess -> return ()
ExitFailure _ -> putStrLn "WARNING: Failed to typecheck Agda.Primitive!"