Patchwork [2/3] gnu: Add ledger.

login
register
mail settings
Submitter Alex Griffin
Date May 7, 2016, 6:38 p.m.
Message ID <1462646320.1130194.601019473.51C9DD36@webmail.messagingengine.com>
Download mbox | patch
Permalink /patch/12129/
State New
Headers show

Comments

Alex Griffin - May 7, 2016, 6:38 p.m.
This is a minimal build of ledger. If people want more features enabled
I could add the shared library and Python module later. It might also be
useful to package ledger 2.x in addition to 3.x because it can import
from GnuCash.

Patch

From 4dfdd06d6ae1809cde07cd0270762601046b34c4 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Sat, 7 May 2016 12:20:47 -0500
Subject: [PATCH 2/3] gnu: Add ledger.

* gnu/packages/finance.scm (ledger): New variable.
---
 gnu/packages/finance.scm | 61 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index e9487d4..beff15e 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -1,6 +1,7 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,14 +24,20 @@ 
  #:use-module (guix download)
  #:use-module (guix build utils)
  #:use-module (guix build-system gnu)
+ #:use-module (guix build-system cmake)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages databases)
+ #:use-module (gnu packages groff)
+ #:use-module (gnu packages libedit)
  #:use-module (gnu packages linux)
+ #:use-module (gnu packages multiprecision)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages python)
  #:use-module (gnu packages qt)
+ #:use-module (gnu packages texinfo)
  #:use-module (gnu packages tls)
+ #:use-module (gnu packages unicode)
  #:use-module (gnu packages upnp))
 
 (define-public bitcoin-core
@@ -81,3 +88,57 @@  collectively by the network.  Bitcoin Core is the reference implementation
 of the bitcoin protocol.  This package provides the Bitcoin Core command
 line client and a client based on Qt.")
     (license license:expat)))
+
+(define-public ledger
+  (package
+    (name "ledger")
+    (version "3.1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/ledger/ledger/archive/v" version
+                                  ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "12jlv3gsjhrja25q9hrwh73cdacd2l3c2yyn8qnijav9mdhnbw4h"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'build 'build-doc
+           (lambda _ (zero? (system* "make" "doc"))))
+         (add-after 'install 'remove-emacs-doc
+           (lambda _ (delete-file (string-append (assoc-ref %outputs "out")
+                                                 "/share/info/ledger-mode.info")))))
+       #:configure-flags
+       `("-DBUILD_DOCS:BOOL=ON"
+         "-DBUILD_LIBRARY:BOOL=OFF"
+         ,(string-append "-DUTFCPP_INCLUDE_DIR:PATH="
+                         (assoc-ref %build-inputs "utfcpp")
+                         "/include"))))
+    (inputs `(("boost" ,boost)
+              ("gmp" ,gmp)
+              ("libedit" ,libedit)
+              ("mpfr" ,mpfr)
+              ("utfcpp" ,utfcpp)))
+    (native-inputs `(("texinfo" ,texinfo)
+                     ("groff" ,groff)))
+    (home-page "http://ledger-cli.org/")
+    (synopsis "Command-line double-entry accounting program")
+    (description
+     "Ledger is a powerful, double-entry accounting system that is
+     accessed from the UNIX command-line.  This may put off some users,
+     since there is no flashy UI, but for those who want unparalleled
+     reporting access to their data there are few alternatives.
+
+     Ledger uses text files for input.  It reads the files and generates
+     reports; there is no other database or stored state.  To use Ledger,
+     you create a file of your account names and transactions, run from
+     the command line with some options to specify input and requested
+     reports, and get output.  The output is generally plain text, though
+     you could generate a graph or html instead.  Ledger is simple in
+     concept, surprisingly rich in ability, and easy to use.")
+    (license (list license:bsd-3
+                   license:asl2.0
+                   (license:non-copyleft "file://src/wcwidth.cc"
+                                         "See src/wcwidth.cc in the distribution.")))))
-- 
2.7.4