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 BENCHEXES=hledger ledger
BUILD=ghc --make hledger.hs -o hledger -O BUILD=ghc --make hledger.hs -o hledger -O
BUILDFLAGS=-DVTY
build: tag build: tag
$(BUILD) $(BUILD) $(BUILDFLAGS)
BUILDO2=ghc --make hledger.hs -o hledgero2 -O2 -fvia-C BUILDO2=ghc --make hledger.hs -o hledgero2 -O2 -fvia-C
buildo2: buildo2:
@ -15,8 +16,9 @@ rebuild: clean build
# recompile and run tests whenever a module changes # recompile and run tests whenever a module changes
# see http://searchpath.org , you may need the patched version from # see http://searchpath.org , you may need the patched version from
# http://joyful.com/repos/searchpath # http://joyful.com/repos/searchpath
CICMD=test
continuous ci: 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 # run code tests
test: 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 sudo runhaskell Setup.hs install
This will complain about any missing libraries, which you can download and This will complain about any missing libraries, which you can download and
install manually from hackage.haskell.org. (The Build-Depends: in install manually from hackage.haskell.org. The Build-Depends: in
hledger.cabal has the full package list.) 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:: To get the latest development code do::

View File

@ -17,16 +17,13 @@ License-File: LICENSE
Extra-Source-Files: README sample.ledger Extra-Source-Files: README sample.ledger
Extra-Tmp-Files: Extra-Tmp-Files:
Cabal-Version: >= 1.2 Cabal-Version: >= 1.2
Flag vty
description: Build vty-based text ui (requires vty, not available on windows)
default: False
Executable hledger Executable hledger
Main-Is: hledger.hs Main-Is: hledger.hs
Build-Depends: base,
if !os(windows)
Build-Depends:vty>=3.1.8.2
Other-Modules:UICommand
Build-Depends:
base,
containers, containers,
haskell98, haskell98,
directory, directory,
@ -38,8 +35,7 @@ Executable hledger
HUnit, HUnit,
mtl, mtl,
bytestring bytestring
Other-Modules: Other-Modules: BalanceCommand
BalanceCommand
Options Options
PrintCommand PrintCommand
RegisterCommand RegisterCommand
@ -61,12 +57,15 @@ Executable hledger
Ledger.Transaction Ledger.Transaction
Ledger.Types Ledger.Types
Ledger.Utils 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, Build-Depends: base, containers, haskell98, directory, parsec, regex-compat,
old-locale, time, HUnit old-locale, time, HUnit
Exposed-modules: Exposed-modules:Ledger
Ledger
Ledger.Account Ledger.Account
Ledger.AccountName Ledger.AccountName
Ledger.Amount Ledger.Amount

View File

@ -40,10 +40,6 @@ module Main (
module BalanceCommand, module BalanceCommand,
module PrintCommand, module PrintCommand,
module RegisterCommand, module RegisterCommand,
#ifndef mingw32_HOST_OS
-- the ui command requires vty which is not available on windows
module UICommand,
#endif
) )
where where
import Control.Monad.Error import Control.Monad.Error
@ -56,8 +52,8 @@ import Options
import BalanceCommand import BalanceCommand
import PrintCommand import PrintCommand
import RegisterCommand import RegisterCommand
#ifndef mingw32_HOST_OS #ifdef VTY
import UICommand import qualified UICommand
#endif #endif
import Tests import Tests
@ -73,8 +69,8 @@ main = do
| cmd `isPrefixOf` "balance" = parseLedgerAndDo opts args balance | cmd `isPrefixOf` "balance" = parseLedgerAndDo opts args balance
| cmd `isPrefixOf` "print" = parseLedgerAndDo opts args print' | cmd `isPrefixOf` "print" = parseLedgerAndDo opts args print'
| cmd `isPrefixOf` "register" = parseLedgerAndDo opts args register | cmd `isPrefixOf` "register" = parseLedgerAndDo opts args register
#ifndef mingw32_HOST_OS #ifdef VTY
| cmd `isPrefixOf` "ui" = parseLedgerAndDo opts args ui | cmd `isPrefixOf` "ui" = parseLedgerAndDo opts args UICommand.ui
#endif #endif
| cmd `isPrefixOf` "test" = runtests opts args >> return () | cmd `isPrefixOf` "test" = runtests opts args >> return ()
| otherwise = putStr $ usage | otherwise = putStr $ usage