summary refs log tree commit diff
path: root/gnu/packages/finance.scm
diff options
context:
space:
mode:
authorAlex Griffin <a@ajgrf.com>2016-05-07 12:20:47 -0500
committerAlex Kost <alezost@gmail.com>2016-05-16 18:01:18 +0300
commitd3699b311b01b09d37640ed613fa6094059ed72f (patch)
treed9e669dc0dbebb412a66dae3d1a40851c8a8c16e /gnu/packages/finance.scm
parentf17a54475656f16867767ecfd512552e5f547cf1 (diff)
downloadguix-d3699b311b01b09d37640ed613fa6094059ed72f.tar.gz
gnu: Add ledger.
* gnu/packages/finance.scm (ledger): New variable.

Co-authored-by: Alex Kost <alezost@gmail.com>
Diffstat (limited to 'gnu/packages/finance.scm')
-rw-r--r--gnu/packages/finance.scm106
1 files changed, 106 insertions, 0 deletions
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index e9487d4207..b511d2c951 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,13 +24,21 @@
  #: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 base)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages databases)
+ #:use-module (gnu packages emacs)
+ #: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 textutils)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages upnp))
 
@@ -81,3 +90,100 @@ 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
+     `(#:modules ((guix build cmake-build-system)
+                  (guix build utils)
+                  (guix build emacs-utils))
+       #:imported-modules (,@%cmake-build-system-modules
+                           (guix build emacs-utils))
+       #:configure-flags
+       `("-DBUILD_DOCS:BOOL=ON"
+         "-DBUILD_WEB_DOCS:BOOL=ON"
+         "-DBUILD_EMACSLISP:BOOL=ON"
+         "-DUSE_PYTHON:BOOL=ON"
+         "-DCMAKE_INSTALL_LIBDIR:PATH=lib"
+         ,(string-append "-DUTFCPP_INCLUDE_DIR:PATH="
+                         (assoc-ref %build-inputs "utfcpp")
+                         "/include"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'install-examples
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((examples (string-append (assoc-ref outputs "out")
+                                            "/share/doc/ledger/examples")))
+               (install-file "test/input/sample.dat" examples)
+               (install-file "test/input/demo.ledger" examples))
+             #t))
+         (add-after 'build 'build-doc
+           (lambda _ (zero? (system* "make" "doc"))))
+         (add-before 'check 'check-setup
+           ;; One test fails if it can't set the timezone.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "TZDIR"
+                     (string-append (assoc-ref inputs "tzdata")
+                                    "/share/zoneinfo"))
+             #t))
+         (add-after 'install 'relocate-elisp
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((site-dir (string-append (assoc-ref outputs "out")
+                                             "/share/emacs/site-lisp"))
+                    (guix-dir (string-append site-dir "/guix.d"))
+                    (orig-dir (string-append site-dir "/ledger-mode"))
+                    (dest-dir (string-append guix-dir "/ledger-mode")))
+               (mkdir-p guix-dir)
+               (rename-file orig-dir dest-dir)
+               (emacs-generate-autoloads ,name dest-dir))
+             #t)))))
+    (inputs
+     `(("boost" ,boost)
+       ("gmp" ,gmp)
+       ("libedit" ,libedit)
+       ("mpfr" ,mpfr)
+       ("python" ,python-2)
+       ("tzdata" ,tzdata)
+       ("utfcpp" ,utfcpp)))
+    (native-inputs
+     `(("emacs" ,emacs-no-x)
+       ("groff" ,groff)
+       ("texinfo" ,texinfo)))
+    (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.")
+    ;; There are some extra licenses in files which do not presently get
+    ;; installed when you build this package.  Different versions of the GPL
+    ;; are used in the contrib and python subdirectories.  The bundled version
+    ;; of utfcpp is under the Boost 1.0 license. Also the file
+    ;; `tools/update_copyright_year` has an Expat license.
+    (license (list license:bsd-3
+                   license:asl2.0     ; src/strptime.cc
+                   (license:non-copyleft
+                    "file://src/wcwidth.cc"
+                    "See src/wcwidth.cc in the distribution.")
+                   license:gpl2+))))  ; lisp/*