module MOO.Version (version, serverVersion, lmdbVersion, pcreVersion,
runtimeVersion) where
import Data.Char (toUpper)
import Data.Text (Text, pack)
import Data.Version (showVersion)
import Foreign (Ptr, nullPtr)
import Foreign.C (CString, CInt, peekCString)
import System.Info (compilerName, compilerVersion)
import System.IO.Unsafe (unsafePerformIO)
import Paths_EtaMOO (version)
import MOO.Builtins.Match (pcreVersion)
foreign import ccall unsafe "static lmdb.h"
mdb_version :: Ptr CInt -> Ptr CInt -> Ptr CInt -> IO CString
serverVersion :: Text
serverVersion = pack $ "EtaMOO/" ++ showVersion version
lmdbVersion :: String
lmdbVersion = unsafePerformIO
(peekCString =<< mdb_version nullPtr nullPtr nullPtr)
runtimeVersion :: String
runtimeVersion = map toUpper compilerName ++ " runtime " ++
showVersion compilerVersion