From 15239ecf963334d94121e0401e1613de910b3ee7 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 20 Jan 2009 03:48:05 +0000 Subject: [PATCH] make an explicit configure flag for the vty ui --- Makefile | 6 ++++-- README | 13 +++++++++++-- hledger.cabal | 23 +++++++++++------------ hledger.hs | 12 ++++-------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index a001bba85..8361f56fe 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ BENCHEXES=hledger ledger BUILD=ghc --make hledger.hs -o hledger -O +BUILDFLAGS=-DVTY build: tag - $(BUILD) + $(BUILD) $(BUILDFLAGS) BUILDO2=ghc --make hledger.hs -o hledgero2 -O2 -fvia-C buildo2: @@ -15,8 +16,9 @@ rebuild: clean build # recompile and run tests whenever a module changes # see http://searchpath.org , you may need the patched version from # http://joyful.com/repos/searchpath +CICMD=test continuous ci: - sp --no-exts --no-default-map -o hledger ghc --make hledger.hs --run test + sp --no-exts --no-default-map -o hledger ghc --make hledger.hs $(BUILDFLAGS) --run $(CICMD) # run code tests test: diff --git a/README b/README index e5eb2e7f7..9666b8e03 100644 --- a/README +++ b/README @@ -29,8 +29,17 @@ http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hledger and do:: sudo runhaskell Setup.hs install This will complain about any missing libraries, which you can download and -install manually from hackage.haskell.org. (The Build-Depends: in -hledger.cabal has the full package list.) +install manually from hackage.haskell.org. The Build-Depends: in +hledger.cabal has the full package list. + +You can configure with optional flags to build additional hledger +features. These are:: + + -f vty - Build vty-based text ui (requires vty, not available on windows) + +Eg:: + + cabal install -f "vty" hledger (or runhaskell Setup.hs configure -f "vty") To get the latest development code do:: diff --git a/hledger.cabal b/hledger.cabal index ebbc7bcf5..8933299b8 100644 --- a/hledger.cabal +++ b/hledger.cabal @@ -17,16 +17,13 @@ License-File: LICENSE Extra-Source-Files: README sample.ledger Extra-Tmp-Files: Cabal-Version: >= 1.2 +Flag vty + description: Build vty-based text ui (requires vty, not available on windows) + default: False Executable hledger Main-Is: hledger.hs - - if !os(windows) - Build-Depends:vty>=3.1.8.2 - Other-Modules:UICommand - - Build-Depends: - base, + Build-Depends: base, containers, haskell98, directory, @@ -38,8 +35,7 @@ Executable hledger HUnit, mtl, bytestring - Other-Modules: - BalanceCommand + Other-Modules: BalanceCommand Options PrintCommand RegisterCommand @@ -61,12 +57,15 @@ Executable hledger Ledger.Transaction Ledger.Types Ledger.Utils + if flag(vty) + Build-Depends:vty>=3.1.8.2 + Other-Modules:UICommand + cpp-options: -DVTY -library +Library Build-Depends: base, containers, haskell98, directory, parsec, regex-compat, old-locale, time, HUnit - Exposed-modules: - Ledger + Exposed-modules:Ledger Ledger.Account Ledger.AccountName Ledger.Amount diff --git a/hledger.hs b/hledger.hs index 53415f23d..a0d7e8d65 100644 --- a/hledger.hs +++ b/hledger.hs @@ -40,10 +40,6 @@ module Main ( module BalanceCommand, module PrintCommand, module RegisterCommand, -#ifndef mingw32_HOST_OS --- the ui command requires vty which is not available on windows - module UICommand, -#endif ) where import Control.Monad.Error @@ -56,8 +52,8 @@ import Options import BalanceCommand import PrintCommand import RegisterCommand -#ifndef mingw32_HOST_OS -import UICommand +#ifdef VTY +import qualified UICommand #endif import Tests @@ -73,8 +69,8 @@ main = do | cmd `isPrefixOf` "balance" = parseLedgerAndDo opts args balance | cmd `isPrefixOf` "print" = parseLedgerAndDo opts args print' | cmd `isPrefixOf` "register" = parseLedgerAndDo opts args register -#ifndef mingw32_HOST_OS - | cmd `isPrefixOf` "ui" = parseLedgerAndDo opts args ui +#ifdef VTY + | cmd `isPrefixOf` "ui" = parseLedgerAndDo opts args UICommand.ui #endif | cmd `isPrefixOf` "test" = runtests opts args >> return () | otherwise = putStr $ usage