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:
Simon Michael 2009-06-05 02:07:38 +00:00
parent 956cd0e993
commit c936e90a54
4 changed files with 47 additions and 16 deletions

View File

@ -18,6 +18,7 @@ VIEWHTMLCMD=open
VIEWPSCMD=open VIEWPSCMD=open
PLATFORMBINARIES=hledgermac hledgerlinux #hledgerwin PLATFORMBINARIES=hledgermac hledgerlinux #hledgerwin
BINARYFILENAME=`runhaskell ./hledger.hs --binary-filename`
SOURCEFILES:=*hs Commands/*hs Ledger/*hs SOURCEFILES:=*hs Commands/*hs Ledger/*hs
DOCFILES:=HOME README NEWS CONTRIBUTORS SCREENSHOTS DOCFILES:=HOME README NEWS CONTRIBUTORS SCREENSHOTS
PATCHLEVEL:=$(shell expr `darcs changes --count --from-tag=\\\\\.` - 1) 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 # build a deployable binary for mac, one which uses only standard osx libs
hledgermac: setversion hledgermac: setversion
sudo port deactivate gmp 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 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 # build a deployable binary for gnu/linux, statically linked
hledgerlinux: setversion hledgerlinux: setversion
@ -339,7 +341,7 @@ send:
darcs send http://joyful.com/repos/hledger --to=hledger@googlegroups.com --edit-description darcs send http://joyful.com/repos/hledger --to=hledger@googlegroups.com --edit-description
# push patches and anything else pending to the public server # push patches and anything else pending to the public server
push: pushprofs pushbinaries push: pushprofs pushbinary
darcs push joyful.com:/repos/hledger darcs push joyful.com:/repos/hledger
# pull anything pending from the public server # pull anything pending from the public server
@ -347,7 +349,7 @@ pull: pullprofs
darcs pull -a joyful.com:/repos/hledger darcs pull -a joyful.com:/repos/hledger
# push any new profiles and benchtest results to the public site # 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: pushprofs:
rsync -azP profs/ joyful.com:/repos/hledger/profs/ rsync -azP profs/ joyful.com:/repos/hledger/profs/
@ -355,9 +357,11 @@ pushprofs:
pullprofs: pullprofs:
rsync -azP joyful.com:/repos/hledger/profs/ profs/ rsync -azP joyful.com:/repos/hledger/profs/ profs/
# push any new deployment binaries to the public site # push a deployable binary for this platform to the public site
pushbinaries: # make hledgerPLAT first
-for b in $(PLATFORMBINARIES); do rsync -azP $$b joyful.com:/repos/hledger/website/binaries/; done pushbinary:
-gzip -9 $(BINARYFILENAME)
rsync -aP $(BINARYFILENAME).gz joyful.com:/repos/hledger/website/binaries/
# show project stats useful for release notes # show project stats useful for release notes
stats: showlastreleasedate showreleaseauthors showloc showerrors showlocalchanges showreleasechanges bench stats: showlastreleasedate showreleaseauthors showloc showerrors showlocalchanges showreleasechanges bench

View File

@ -84,6 +84,7 @@ options = [
,Option ['h'] ["help"] (NoArg Help) "show this help" ,Option ['h'] ["help"] (NoArg Help) "show this help"
,Option ['V'] ["version"] (NoArg Version) "show version information" ,Option ['V'] ["version"] (NoArg Version) "show version information"
,Option ['v'] ["verbose"] (NoArg Verbose) "show verbose test output" ,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"] (NoArg Debug) "show some debug output"
,Option [] ["debug-no-ui"] (NoArg DebugNoUI) "run ui commands with no output" ,Option [] ["debug-no-ui"] (NoArg DebugNoUI) "run ui commands with no output"
] ]
@ -110,6 +111,7 @@ data Opt =
Help | Help |
Verbose | Verbose |
Version Version
| BinaryFilename
| Debug | Debug
| DebugNoUI | DebugNoUI
deriving (Show,Eq) deriving (Show,Eq)

View File

@ -1,19 +1,43 @@
{-# OPTIONS_GHC -cpp #-} {-# 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 module Version
where where
import System.Info (os, arch)
import Ledger.Utils import Ledger.Utils
import Options (progname) import Options (progname)
-- updated by build process from VERSION -- version and PATCHLEVEL are set by the makefile
version = "0.5.1" version = "0.5.1"
#ifdef PATCHLEVEL #ifdef PATCHLEVEL
-- a "make" development build defines PATCHLEVEL from the repo state
patchlevel = "." ++ show PATCHLEVEL -- must be numeric ! patchlevel = "." ++ show PATCHLEVEL -- must be numeric !
#else #else
patchlevel = "" patchlevel = ""
#endif #endif
buildversion = version ++ patchlevel 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 versionstr = prettify $ splitAtElement '.' buildversion
where where
prettify (major:minor:bugfix:patches:[]) = prettify (major:minor:bugfix:patches:[]) =
@ -23,7 +47,7 @@ versionstr = prettify $ splitAtElement '.' buildversion
| bugfix `elem` ["0"{-,"98","99"-}] = "" | bugfix `elem` ["0"{-,"98","99"-}] = ""
| otherwise = "."++bugfix | otherwise = "."++bugfix
patches' patches'
| patches/="0" = " + "++patches++" patches" | patches/="0" = "+"++patches++" patches"
| otherwise = "" | otherwise = ""
desc desc
-- | bugfix=="98" = " (alpha)" -- | bugfix=="98" = " (alpha)"
@ -31,10 +55,10 @@ versionstr = prettify $ splitAtElement '.' buildversion
| otherwise = "" | otherwise = ""
prettify s = intercalate "." s prettify s = intercalate "." s
versionmsg = progname ++ " " ++ versionstr ++ configmsg ++ "\n" versionmsg = progname ++ "-" ++ versionstr ++ configmsg
where configmsg where configmsg
| null configflags = "" | null configflags = " with no extras"
| otherwise = ", built with " ++ intercalate ", " configflags | otherwise = " with " ++ intercalate ", " configflags
configflags = tail ["" configflags = tail [""
#ifdef VTY #ifdef VTY

View File

@ -43,7 +43,7 @@ module Main (-- export for easy ghci access:
) )
where where
import Control.Monad.Error import Control.Monad.Error
import Prelude hiding (putStr) import Prelude hiding (putStr, putStrLn)
import System.IO (stderr) import System.IO (stderr)
import System.IO.UTF8 import System.IO.UTF8
import qualified Data.Map as Map (lookup) import qualified Data.Map as Map (lookup)
@ -53,7 +53,7 @@ import Ledger
import Options import Options
import Tests import Tests
import Utils (withLedgerDo) import Utils (withLedgerDo)
import Version (versionmsg) import Version (versionmsg, binaryfilename)
main :: IO () main :: IO ()
@ -63,7 +63,8 @@ main = do
where where
run cmd opts args run cmd opts args
| Help `elem` opts = putStr $ usage | 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` "balance" = withLedgerDo opts args cmd balance
| cmd `isPrefixOf` "convert" = withLedgerDo opts args cmd convert | cmd `isPrefixOf` "convert" = withLedgerDo opts args cmd convert
| cmd `isPrefixOf` "print" = withLedgerDo opts args cmd print' | cmd `isPrefixOf` "print" = withLedgerDo opts args cmd print'