hledger/Version.hs
Simon Michael 3c1d3a6d7f simplify: drop the ansi ui, and enable the vty ui by default
If what I'm hearing is correct, cabal on windows will turn off the vty
flag automatically. The alternative ansi ui is not worth the hassle.
2009-04-03 04:17:48 +00:00

47 lines
1.5 KiB
Haskell

{-# OPTIONS_GHC -cpp #-}
module Version
where
import Ledger.Utils
import Options (progname)
-- updated by build process from VERSION
version = "0.4.0"
#ifdef PATCHES
-- a "make" development build defines PATCHES from the repo state
patchlevel = "." ++ show PATCHES -- must be numeric !
#else
patchlevel = ""
#endif
buildversion = version ++ patchlevel
versionstr = prettify $ splitAtElement '.' buildversion
where
prettify (major:minor:bugfix:patches:[]) =
printf "%s.%s%s%s%s" major minor bugfix' patches' desc
where
bugfix'
| bugfix `elem` ["0"{-,"98","99"-}] = ""
| otherwise = "."++bugfix
patches'
| patches/="0" = " + "++patches++" patches"
| otherwise = ""
desc
-- | bugfix=="98" = " (alpha)"
-- | bugfix=="99" = " (beta)"
| otherwise = ""
prettify s = intercalate "." s
versionmsg = progname ++ " " ++ versionstr ++ configmsg ++ "\n"
where configmsg
| null configflags = ""
| otherwise = ", built with " ++ intercalate ", " configflags
configflags = tail [""
#ifdef VTY
,"vty"
#endif
#ifdef HAPPS
,"happs"
#endif
]