make an explicit configure flag for the vty ui

This commit is contained in:
Simon Michael 2009-01-20 03:48:05 +00:00
parent 67a764dce7
commit 15239ecf96
4 changed files with 30 additions and 24 deletions

View File

@ -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:

13
README
View File

@ -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::

View File

@ -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

View File

@ -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