summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Infra/BuildInfo.hs
blob: 9cf111831f3bc6212dc84a2b6971120221215d27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# LANGUAGE CPP #-}
module GF.Infra.BuildInfo where
import System.Info
import Data.Version(showVersion)
import DarcsVersion_gf

{-# NOINLINE buildInfo #-}
buildInfo =
    {-details++"\n"++-}
    "Built on "++os++"/"++arch
    ++" with "++compilerName++"-"++showVersion compilerVersion
    ++", flags:"
#ifdef USE_INTERRUPT
    ++" interrupt"
#endif
#ifdef SERVER_MODE
    ++" server"
#endif
#ifdef NEW_COMP
    ++" new-comp"
#endif
#ifdef C_RUNTIME
    ++" c-runtime"
#endif
  where
    details = either (const no_info) info darcs_info
    no_info = "No detailed version info available"
    info (otag,olast,changes,whatsnew) =
      (case changes of
         0 -> "No recorded changes"
         1 -> "One recorded change"
         _ -> show changes++" recorded changes")++
      (case whatsnew of
         0 -> ""
         1 -> " + one file with unrecorded changes"
         _ -> " + "++show whatsnew++" files with unrecorded changes")++
      (maybe "" (" since "++) otag)++
      (maybe "" ("\nLast recorded change: "++) olast)