mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 21:02:04 +03:00
d4965b87ff
hack-handler-simpleserver is presumably quite a bit easier to install than happstack, and so far fits hledger's needs just as well, so it is now the default when installing with -fweb. To build with happstack, use -fwebhappstack instead. hledger --version shows which webserver was built. Also webserver thread management has been simplified so should be more consistent across platforms.
76 lines
2.7 KiB
Haskell
76 lines
2.7 KiB
Haskell
{-# LANGUAGE CPP #-}
|
|
{-
|
|
Version-related utilities. See the Makefile for details of our version
|
|
numbering policy.
|
|
-}
|
|
|
|
module Version
|
|
where
|
|
import System.Info (os, arch)
|
|
import Ledger.Utils
|
|
import Options (progname)
|
|
|
|
-- version and PATCHLEVEL are set by the makefile
|
|
version = "0.8.0"
|
|
|
|
#ifdef PATCHLEVEL
|
|
patchlevel = "." ++ show PATCHLEVEL -- must be numeric !
|
|
#else
|
|
patchlevel = ""
|
|
#endif
|
|
|
|
buildversion = version ++ patchlevel :: String
|
|
|
|
binaryfilename = prettify $ splitAtElement '.' buildversion :: String
|
|
where
|
|
prettify (major:minor:bugfix:patches:[]) =
|
|
printf "hledger-%s.%s%s%s-%s-%s%s" major minor bugfix' patches' os' arch suffix
|
|
where
|
|
bugfix'
|
|
| bugfix `elem` ["0"{-,"98","99"-}] = ""
|
|
| otherwise = '.' : bugfix
|
|
patches'
|
|
| patches/="0" = '+' : patches
|
|
| otherwise = ""
|
|
(os',suffix)
|
|
| os == "darwin" = ("mac","")
|
|
| os == "mingw32" = ("windows",".exe")
|
|
| otherwise = (os,"")
|
|
prettify (major:minor:bugfix:[]) = prettify [major,minor,bugfix,"0"]
|
|
prettify (major:minor:[]) = prettify [major,minor,"0","0"]
|
|
prettify (major:[]) = prettify [major,"0","0","0"]
|
|
prettify [] = error "VERSION is empty, please fix"
|
|
prettify _ = error "VERSION has too many components, please fix"
|
|
|
|
versionstr = prettify $ splitAtElement '.' buildversion :: String
|
|
where
|
|
prettify (major:minor:bugfix:patches:[]) =
|
|
printf "%s.%s%s%s" major minor bugfix' patches'
|
|
where
|
|
bugfix'
|
|
| bugfix `elem` ["0"{-,"98","99"-}] = ""
|
|
| otherwise = '.' : bugfix
|
|
patches'
|
|
| patches/="0" = "+"++patches
|
|
| otherwise = ""
|
|
prettify s = intercalate "." s
|
|
|
|
versionmsg = progname ++ "-" ++ versionstr ++ configmsg :: String
|
|
where configmsg
|
|
| null configflags = " with no extras"
|
|
| otherwise = " with " ++ intercalate ", " configflags
|
|
|
|
configflags = tail [""
|
|
#ifdef CHART
|
|
,"chart"
|
|
#endif
|
|
#ifdef VTY
|
|
,"vty"
|
|
#endif
|
|
#if defined(WEB)
|
|
,"web (using simpleserver)"
|
|
#else if defined(WEBHAPPSTACK)
|
|
,"web (using happstack)"
|
|
#endif
|
|
]
|