@@ -1,5 +1,6 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2+module Util.System(tempfile,environment,getCC,
2−module Util.System(tempfile,environment,getCC,getLibFlags,getIdrisLibDir,getIncFlags,rmFile) where
3+ getLibFlags,getIdrisLibDir,getIncFlags,rmFile) where
4-- System helper functions.
5-- System helper functions.
@@ -11,6 +12,8 @@ import System.IO
11import Control.Exception as CE
12import Control.Exception as CE
14#if MIN_VERSION_base(4,0,0)
17#if MIN_VERSION_base(4,0,0)
15catchIO :: IO a -> (IOError -> IO a) -> IO a
18catchIO :: IO a -> (IOError -> IO a) -> IO a
16catchIO = CE.catch
19catchIO = CE.catch
@@ -38,3 +41,13 @@ rmFile f = do putStrLn $ "Removing " ++ f
38 catchIO (removeFile f)
41 catchIO (removeFile f)
39 (\ioerr -> putStrLn $ "WARNING: Cannot remove file "
42 (\ioerr -> putStrLn $ "WARNING: Cannot remove file "
40 ++ f ++ ", Error msg:" ++ show ioerr)
43 ++ f ++ ", Error msg:" ++ show ioerr)
46+getLibFlags = do dir <- getDataDir
47+ return $ "-L" ++ (dir </> "rts") ++ " -lidris_rts -lgmp -lpthread"
49+getIdrisLibDir = do dir <- getDataDir
50+ return $ addTrailingPathSeparator dir
52+getIncFlags = do dir <- getDataDir
53+ return $ "-I" ++ dir </> "rts"