mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-18 17:57:11 +03:00
add a --binary-filename option and "make pushbinary" for easy publishing
Also note that we don't yet follow cabal package versioning policy.
This commit is contained in:
parent
956cd0e993
commit
c936e90a54
18
Makefile
18
Makefile
@ -18,6 +18,7 @@ VIEWHTMLCMD=open
|
||||
VIEWPSCMD=open
|
||||
|
||||
PLATFORMBINARIES=hledgermac hledgerlinux #hledgerwin
|
||||
BINARYFILENAME=`runhaskell ./hledger.hs --binary-filename`
|
||||
SOURCEFILES:=*hs Commands/*hs Ledger/*hs
|
||||
DOCFILES:=HOME README NEWS CONTRIBUTORS SCREENSHOTS
|
||||
PATCHLEVEL:=$(shell expr `darcs changes --count --from-tag=\\\\\.` - 1)
|
||||
@ -49,9 +50,10 @@ hledgeropt: setversion
|
||||
# build a deployable binary for mac, one which uses only standard osx libs
|
||||
hledgermac: setversion
|
||||
sudo port deactivate gmp
|
||||
ghc --make hledger.hs -o hledgermac $(BUILDFLAGS) -O2 -optl-L/usr/lib #-optl-F/Library/Frameworks/GMP
|
||||
ghc --make hledger.hs -o $(BINARYFILENAME) $(BUILDFLAGS) -O2 -optl-L/usr/lib #-optl-F/Library/Frameworks/GMP
|
||||
sudo port activate gmp
|
||||
otool -L hledgermac
|
||||
@echo Please check the build depends only on standard system libraries:
|
||||
otool -L $(BINARYFILENAME)
|
||||
|
||||
# build a deployable binary for gnu/linux, statically linked
|
||||
hledgerlinux: setversion
|
||||
@ -339,7 +341,7 @@ send:
|
||||
darcs send http://joyful.com/repos/hledger --to=hledger@googlegroups.com --edit-description
|
||||
|
||||
# push patches and anything else pending to the public server
|
||||
push: pushprofs pushbinaries
|
||||
push: pushprofs pushbinary
|
||||
darcs push joyful.com:/repos/hledger
|
||||
|
||||
# pull anything pending from the public server
|
||||
@ -347,7 +349,7 @@ pull: pullprofs
|
||||
darcs pull -a joyful.com:/repos/hledger
|
||||
|
||||
# push any new profiles and benchtest results to the public site
|
||||
# beware, results may look different depending on which machine generated them
|
||||
# beware, results will vary depending on which machine generated them
|
||||
pushprofs:
|
||||
rsync -azP profs/ joyful.com:/repos/hledger/profs/
|
||||
|
||||
@ -355,9 +357,11 @@ pushprofs:
|
||||
pullprofs:
|
||||
rsync -azP joyful.com:/repos/hledger/profs/ profs/
|
||||
|
||||
# push any new deployment binaries to the public site
|
||||
pushbinaries:
|
||||
-for b in $(PLATFORMBINARIES); do rsync -azP $$b joyful.com:/repos/hledger/website/binaries/; done
|
||||
# push a deployable binary for this platform to the public site
|
||||
# make hledgerPLAT first
|
||||
pushbinary:
|
||||
-gzip -9 $(BINARYFILENAME)
|
||||
rsync -aP $(BINARYFILENAME).gz joyful.com:/repos/hledger/website/binaries/
|
||||
|
||||
# show project stats useful for release notes
|
||||
stats: showlastreleasedate showreleaseauthors showloc showerrors showlocalchanges showreleasechanges bench
|
||||
|
@ -84,6 +84,7 @@ options = [
|
||||
,Option ['h'] ["help"] (NoArg Help) "show this help"
|
||||
,Option ['V'] ["version"] (NoArg Version) "show version information"
|
||||
,Option ['v'] ["verbose"] (NoArg Verbose) "show verbose test output"
|
||||
,Option [] ["binary-filename"] (NoArg BinaryFilename) "show the download filename for this hledger build"
|
||||
,Option [] ["debug"] (NoArg Debug) "show some debug output"
|
||||
,Option [] ["debug-no-ui"] (NoArg DebugNoUI) "run ui commands with no output"
|
||||
]
|
||||
@ -110,6 +111,7 @@ data Opt =
|
||||
Help |
|
||||
Verbose |
|
||||
Version
|
||||
| BinaryFilename
|
||||
| Debug
|
||||
| DebugNoUI
|
||||
deriving (Show,Eq)
|
||||
|
36
Version.hs
36
Version.hs
@ -1,19 +1,43 @@
|
||||
{-# OPTIONS_GHC -cpp #-}
|
||||
{-
|
||||
Version-related utilities.
|
||||
|
||||
We should follow http://haskell.org/haskellwiki/Package_versioning_policy .
|
||||
But currently hledger's version is MAJOR[.MINOR[.BUGFIX]][+PATCHLEVEL].
|
||||
See also the Makefile.
|
||||
|
||||
-}
|
||||
|
||||
module Version
|
||||
where
|
||||
import System.Info (os, arch)
|
||||
import Ledger.Utils
|
||||
import Options (progname)
|
||||
|
||||
-- updated by build process from VERSION
|
||||
-- version and PATCHLEVEL are set by the makefile
|
||||
version = "0.5.1"
|
||||
|
||||
#ifdef PATCHLEVEL
|
||||
-- a "make" development build defines PATCHLEVEL from the repo state
|
||||
patchlevel = "." ++ show PATCHLEVEL -- must be numeric !
|
||||
#else
|
||||
patchlevel = ""
|
||||
#endif
|
||||
|
||||
buildversion = version ++ patchlevel
|
||||
|
||||
binaryfilename = prettify $ splitAtElement '.' buildversion
|
||||
where
|
||||
prettify (major:minor:bugfix:patches:[]) =
|
||||
printf "hledger-%s.%s%s%s-%s-%s" major minor bugfix' patches' os arch
|
||||
where
|
||||
bugfix'
|
||||
| bugfix `elem` ["0"{-,"98","99"-}] = ""
|
||||
| otherwise = "."++bugfix
|
||||
patches'
|
||||
| patches/="0" = "+"++patches
|
||||
| otherwise = ""
|
||||
prettify s = intercalate "." s
|
||||
|
||||
versionstr = prettify $ splitAtElement '.' buildversion
|
||||
where
|
||||
prettify (major:minor:bugfix:patches:[]) =
|
||||
@ -23,7 +47,7 @@ versionstr = prettify $ splitAtElement '.' buildversion
|
||||
| bugfix `elem` ["0"{-,"98","99"-}] = ""
|
||||
| otherwise = "."++bugfix
|
||||
patches'
|
||||
| patches/="0" = " + "++patches++" patches"
|
||||
| patches/="0" = "+"++patches++" patches"
|
||||
| otherwise = ""
|
||||
desc
|
||||
-- | bugfix=="98" = " (alpha)"
|
||||
@ -31,10 +55,10 @@ versionstr = prettify $ splitAtElement '.' buildversion
|
||||
| otherwise = ""
|
||||
prettify s = intercalate "." s
|
||||
|
||||
versionmsg = progname ++ " " ++ versionstr ++ configmsg ++ "\n"
|
||||
versionmsg = progname ++ "-" ++ versionstr ++ configmsg
|
||||
where configmsg
|
||||
| null configflags = ""
|
||||
| otherwise = ", built with " ++ intercalate ", " configflags
|
||||
| null configflags = " with no extras"
|
||||
| otherwise = " with " ++ intercalate ", " configflags
|
||||
|
||||
configflags = tail [""
|
||||
#ifdef VTY
|
||||
|
@ -43,7 +43,7 @@ module Main (-- export for easy ghci access:
|
||||
)
|
||||
where
|
||||
import Control.Monad.Error
|
||||
import Prelude hiding (putStr)
|
||||
import Prelude hiding (putStr, putStrLn)
|
||||
import System.IO (stderr)
|
||||
import System.IO.UTF8
|
||||
import qualified Data.Map as Map (lookup)
|
||||
@ -53,7 +53,7 @@ import Ledger
|
||||
import Options
|
||||
import Tests
|
||||
import Utils (withLedgerDo)
|
||||
import Version (versionmsg)
|
||||
import Version (versionmsg, binaryfilename)
|
||||
|
||||
|
||||
main :: IO ()
|
||||
@ -63,7 +63,8 @@ main = do
|
||||
where
|
||||
run cmd opts args
|
||||
| Help `elem` opts = putStr $ usage
|
||||
| Version `elem` opts = putStr versionmsg
|
||||
| Version `elem` opts = putStrLn versionmsg
|
||||
| BinaryFilename `elem` opts = putStrLn binaryfilename
|
||||
| cmd `isPrefixOf` "balance" = withLedgerDo opts args cmd balance
|
||||
| cmd `isPrefixOf` "convert" = withLedgerDo opts args cmd convert
|
||||
| cmd `isPrefixOf` "print" = withLedgerDo opts args cmd print'
|
||||
|
Loading…
Reference in New Issue
Block a user