removed the "standalone" flag (unsafe with Boost)
This commit is contained in:
parent
b4304515ff
commit
3034529d54
4 changed files with 31 additions and 61 deletions
11
Makefile.am
11
Makefile.am
|
|
@ -8,10 +8,6 @@ endif
|
||||||
if DEBUG
|
if DEBUG
|
||||||
libledger_la_CXXFLAGS = -DDEBUG_LEVEL=4
|
libledger_la_CXXFLAGS = -DDEBUG_LEVEL=4
|
||||||
libledger_la_SOURCES += debug.cc
|
libledger_la_SOURCES += debug.cc
|
||||||
else
|
|
||||||
if STANDALONE
|
|
||||||
libledger_a_CXXFLAGS = -DSGI_STL_USE_SINGLE_CLIENT_ALLOCATOR=1
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
libledger_la_LDFLAGS = -version-info 2:0
|
libledger_la_LDFLAGS = -version-info 2:0
|
||||||
|
|
||||||
|
|
@ -20,10 +16,6 @@ libledger_la_LDFLAGS = -version-info 2:0
|
||||||
bin_PROGRAMS = ledger
|
bin_PROGRAMS = ledger
|
||||||
if DEBUG
|
if DEBUG
|
||||||
ledger_CXXFLAGS = -DDEBUG_LEVEL=4
|
ledger_CXXFLAGS = -DDEBUG_LEVEL=4
|
||||||
else
|
|
||||||
if STANDALONE
|
|
||||||
ledger_CXXFLAGS = -DSGI_STL_USE_SINGLE_CLIENT_ALLOCATOR=1
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
ledger_SOURCES = main.cc
|
ledger_SOURCES = main.cc
|
||||||
ledger_LDADD = $(LIBOBJS) libledger.la
|
ledger_LDADD = $(LIBOBJS) libledger.la
|
||||||
|
|
@ -73,5 +65,8 @@ bin_PROGRAMS += ledger.so
|
||||||
ledger.so: python.cc libledger_bpy.a
|
ledger.so: python.cc libledger_bpy.a
|
||||||
CFLAGS="$(CPPFLAGS) -L." python setup.py build --build-lib=.
|
CFLAGS="$(CPPFLAGS) -L." python setup.py build --build-lib=.
|
||||||
|
|
||||||
|
install-exec-hook:
|
||||||
|
CFLAGS="$(CPPFLAGS) -L." python setup.py install --prefix=$(DESTDIR)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
61
README
61
README
|
|
@ -3,26 +3,27 @@ Welcome to Ledger, a command-line accounting program.
|
||||||
Quick start
|
Quick start
|
||||||
===========
|
===========
|
||||||
|
|
||||||
To build ledger, you will first need these two libraries installed:
|
To build Ledger, you will first need these two libraries installed:
|
||||||
|
|
||||||
gmp GNU multi-precision library
|
gmp GNU multi-precision library
|
||||||
pcre Perl regular expression library
|
pcre Perl regular expression library
|
||||||
|
|
||||||
If you wish to read Gnucash data files, you will also need two XML libraries,
|
If you wish to read Gnucash data files, you will also need two XML
|
||||||
which may or may not be available in a single package (it depends on your
|
libraries, which may or may not be available in a single package (it
|
||||||
distribution):
|
depends on your distribution):
|
||||||
|
|
||||||
xmlparse
|
xmlparse
|
||||||
xmltok
|
xmltok
|
||||||
|
|
||||||
Once you have determined where the headers and libraries for the above
|
Once you have determined where the headers and libraries for the above
|
||||||
packages are installed, run the script "configure", passing those paths. If
|
packages are installed, run the script "configure", passing those
|
||||||
you installed everything under /usr/local, you can probably just type
|
paths. If you installed everything under /usr/local, you can probably
|
||||||
"./configure". Otherwise, do this:
|
just type "./configure". Otherwise, do this:
|
||||||
|
|
||||||
./configure CPPFLAGS=-I<INCLUDE-PATH> LDFLAGS=-L<LIBRARY-PATH>
|
./configure CPPFLAGS=-I<INCLUDE-PATH> LDFLAGS=-L<LIBRARY-PATH>
|
||||||
|
|
||||||
If you need to specify multiple include or library paths, then do this:
|
If you need to specify multiple include or library paths, then do
|
||||||
|
this:
|
||||||
|
|
||||||
./configure CPPFLAGS="-I<PATH1> -I<PATH2>" LDFLAGS="-L<PATH1> -L<PATH2>"
|
./configure CPPFLAGS="-I<PATH1> -I<PATH2>" LDFLAGS="-L<PATH1> -L<PATH2>"
|
||||||
|
|
||||||
|
|
@ -30,40 +31,12 @@ Once configure is done running, just type:
|
||||||
|
|
||||||
make install
|
make install
|
||||||
|
|
||||||
Building on OS/X
|
Building Ledger as a Python Module
|
||||||
================
|
==================================
|
||||||
|
|
||||||
If you are building ledger for OS/X, there are a couple of things you can do
|
If you have Python 2.2 or higher installed, and Boost.Python, then
|
||||||
to ensure that it runs as quickly as possible. First, you will want to
|
Ledger will also be built as a Python module. This means you can
|
||||||
configure ledger using this command, which you can cut and paste from here:
|
interact with your Ledger data from Python, making it easier to write
|
||||||
|
very custom reporting code. See the developer documentation for
|
||||||
./configure CPPFLAGS="-I/sw/include -I/usr/include/httpd/xml" \
|
information on Ledger's interfaces, and for some example reports
|
||||||
LDFLAGS=-L/sw/lib \
|
written in Python.
|
||||||
CXXFLAGS="-fomit-frame-pointer -fastf -mcpu=7450" \
|
|
||||||
--enable-standalone
|
|
||||||
|
|
||||||
Next, if you are interested, we need to change the system headers so that
|
|
||||||
command-line ledger can use an STL allocator that is not thread-safe. Being
|
|
||||||
hread-safe has no benefit for the standalone, command-line version of ledger,
|
|
||||||
and so is needlessly 10% slower. However, there is no easy way to do this,
|
|
||||||
other than modifying the system headers. So, sudo over to a root shell, and
|
|
||||||
edit this file:
|
|
||||||
|
|
||||||
/usr/include/gcc/darwin/3.3/c++/bits/stl_alloc.h
|
|
||||||
|
|
||||||
Around line 617, you will find a typedef declaration that looks like this:
|
|
||||||
|
|
||||||
typedef __default_alloc_template<true,0> __alloc;
|
|
||||||
|
|
||||||
Replace this line with the following block, which will permit the ledger
|
|
||||||
sources to select a different default allocator:
|
|
||||||
|
|
||||||
#ifdef SGI_STL_USE_SINGLE_CLIENT_ALLOCATOR
|
|
||||||
typedef __default_alloc_template<false,0> __alloc;
|
|
||||||
#else
|
|
||||||
typedef __default_alloc_template<true,0> __alloc;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
The disadvantage to doing this, in general, is that an app using a different
|
|
||||||
default will not be able to link to other C++ libraries, which use another
|
|
||||||
default. But since ledger doesn't use any C++ libraries, this is no problem.
|
|
||||||
|
|
|
||||||
|
|
@ -58,15 +58,6 @@ AC_ARG_ENABLE(debug,
|
||||||
esac],[debug=false])
|
esac],[debug=false])
|
||||||
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
|
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
|
||||||
|
|
||||||
AC_ARG_ENABLE(standalone,
|
|
||||||
[ --enable-standalone Build standalone on OS/X (see README)],
|
|
||||||
[case "${enableval}" in
|
|
||||||
yes) standalone=true ;;
|
|
||||||
no) standalone=false ;;
|
|
||||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-standalone) ;;
|
|
||||||
esac],[standalone=false])
|
|
||||||
AM_CONDITIONAL(STANDALONE, test x$standalone = xtrue)
|
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_STDC_HEADERS
|
AC_STDC_HEADERS
|
||||||
AC_HAVE_HEADERS(sys/stat.h)
|
AC_HAVE_HEADERS(sys/stat.h)
|
||||||
|
|
|
||||||
11
main.py
Normal file
11
main.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from ledger import *
|
||||||
|
|
||||||
|
parser = TextualParser ()
|
||||||
|
register_parser (parser)
|
||||||
|
|
||||||
|
journal = Journal ()
|
||||||
|
parse_journal_file (sys.argv[1], journal)
|
||||||
|
|
||||||
|
print journal[-1].payee
|
||||||
Loading…
Add table
Reference in a new issue