unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 2/3] gnu: Add ledger.
@ 2016-05-07 18:38 Alex Griffin
  2016-05-07 19:20 ` Alex Griffin
  0 siblings, 1 reply; 19+ messages in thread
From: Alex Griffin @ 2016-05-07 18:38 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

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.
-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-ledger.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-ledger.patch", Size: 4276 bytes --]

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


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-07 18:38 [PATCH 2/3] gnu: Add ledger Alex Griffin
@ 2016-05-07 19:20 ` Alex Griffin
  2016-05-07 22:23   ` Leo Famulari
  0 siblings, 1 reply; 19+ messages in thread
From: Alex Griffin @ 2016-05-07 19:20 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

Here's an updated patch which doesn't delete the ledger-mode docs. I had
initially removed them from this package thinking they belonged in
emacs-ledger-mode, then forgot about it before submitting. Turns out
it's more complicated to build the docs with the emacs-build-system than
the cmake-build-system.

Sorry about that,
-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-ledger.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-ledger.patch", Size: 4067 bytes --]

From cb279e6edc2ed9c3351e4ab9a200d334c6094df0 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 | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index e9487d4..eac124ee 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,54 @@ 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")))))
+       #: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


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-07 19:20 ` Alex Griffin
@ 2016-05-07 22:23   ` Leo Famulari
  2016-05-08  2:10     ` Alex Griffin
  0 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2016-05-07 22:23 UTC (permalink / raw)
  To: Alex Griffin; +Cc: guix-devel

On Sat, May 07, 2016 at 02:20:16PM -0500, Alex Griffin wrote:
> Here's an updated patch which doesn't delete the ledger-mode docs. I had
> initially removed them from this package thinking they belonged in
> emacs-ledger-mode, then forgot about it before submitting. Turns out
> it's more complicated to build the docs with the emacs-build-system than
> the cmake-build-system.

Thanks for the follow-up!

> * gnu/packages/finance.scm (ledger): New variable.

It works, at least for the basic things I tried against the examples in
'tests/input'. Speaking of which, it would be nice to include an example
in the output, perhaps under 'share/doc/ledger'.

> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "https://github.com/ledger/ledger/archive/v" version

Will you make this line < 80 characters?

> +    (build-system cmake-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'build 'build-doc
> +           (lambda _ (zero? (system* "make" "doc")))))
> +       #:configure-flags
> +       `("-DBUILD_DOCS:BOOL=ON"
> +         "-DBUILD_LIBRARY:BOOL=OFF"

What's the story with the library? Are there any programs that use it?

> +    (license (list license:bsd-3
> +                   license:asl2.0
> +                   (license:non-copyleft "file://src/wcwidth.cc"
> +                                         "See src/wcwidth.cc in the distribution.")))))

There are some GPL'd files in 'contrib/', 'lisp/', and 'python/res/'

The file 'tools/update_copyright_year' has an Expat license.

And, I think that unless we delete the bundled utfcpp, we are
distributing it through `guix build --source ledger`, so we should
mention its Boost license.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-07 22:23   ` Leo Famulari
@ 2016-05-08  2:10     ` Alex Griffin
  2016-05-09  3:39       ` Leo Famulari
  0 siblings, 1 reply; 19+ messages in thread
From: Alex Griffin @ 2016-05-08  2:10 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

On Sat, May 7, 2016, at 05:23 PM, Leo Famulari wrote:
> It works, at least for the basic things I tried against the examples in
> 'tests/input'. Speaking of which, it would be nice to include an example
> in the output, perhaps under 'share/doc/ledger'.

Okay, done.

> Will you make this line < 80 characters?

Done.

> What's the story with the library? Are there any programs that use it?

Not that I know of, which is why I didn't include it (well, also I
couldn't figure out how to tell cmake that I don't want it to put stuff
in "$out/lib64"). And Python users will probably prefer beancount to the
ledger module. (Beancount is a reimplementation of ledger in Python.)

> There are some GPL'd files in 'contrib/', 'lisp/', and 'python/res/'
> 
> The file 'tools/update_copyright_year' has an Expat license.
> 
> And, I think that unless we delete the bundled utfcpp, we are
> distributing it through `guix build --source ledger`, so we should
> mention its Boost license.

Is the license field for the source tarball or the package that actually
gets installed? If it's the former, I have to say that's really
unintuitive. I was aware of these extra licenses, but none of that code
gets installed after you build the package. Note that emacs-ledger-mode
uses the same source tarball and I specified its license as GPL2+.
Instead of changing the license field in this patch, I added a note
about the other files to make it clear that changing the build options
may require the license field to change too. I can change it again if
that's wrong, but it seems to me that the license field should really be
about what gets installed.
-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-ledger.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-ledger.patch", Size: 4883 bytes --]

From b97f82dc6bed962fdc59ad674785cb7122846f4a 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 | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index e9487d4..e57dfaf 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,69 @@ 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)
+    ;; If you change the build flags you may need to change the license field
+    ;; too; see below.
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'install-examples
+           (lambda _
+             (let* ((out (assoc-ref %outputs "out"))
+                    (examples (string-append out
+                                             "/share/doc/ledger/examples")))
+               (install-file "test/input/sample.dat" examples)
+               (install-file "test/input/demo.ledger" examples))))
+         (add-after 'build 'build-doc
+           (lambda _ (zero? (system* "make" "doc")))))
+       #: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.")
+    ;; 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, lisp, and python subdirectories. Also the file
+    ;; `tools/update_copyright_year` has an Expat license.
+    (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


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-08  2:10     ` Alex Griffin
@ 2016-05-09  3:39       ` Leo Famulari
  2016-05-09 20:23         ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2016-05-09  3:39 UTC (permalink / raw)
  To: Alex Griffin; +Cc: guix-devel

On Sat, May 07, 2016 at 09:10:48PM -0500, Alex Griffin wrote:
> On Sat, May 7, 2016, at 05:23 PM, Leo Famulari wrote:
> > What's the story with the library? Are there any programs that use it?
> 
> Not that I know of, which is why I didn't include it (well, also I
> couldn't figure out how to tell cmake that I don't want it to put stuff
> in "$out/lib64"). And Python users will probably prefer beancount to the
> ledger module. (Beancount is a reimplementation of ledger in Python.)

Okay, I think it deserves a "TODO" comment where it is disabled.

> > There are some GPL'd files in 'contrib/', 'lisp/', and 'python/res/'
> > 
> > The file 'tools/update_copyright_year' has an Expat license.
> > 
> > And, I think that unless we delete the bundled utfcpp, we are
> > distributing it through `guix build --source ledger`, so we should
> > mention its Boost license.
> 
> Is the license field for the source tarball or the package that actually
> gets installed?

Good question. Can anyone answer it?

> If it's the former, I have to say that's really
> unintuitive. I was aware of these extra licenses, but none of that code
> gets installed after you build the package. Note that emacs-ledger-mode
> uses the same source tarball and I specified its license as GPL2+.
> Instead of changing the license field in this patch, I added a note
> about the other files to make it clear that changing the build options
> may require the license field to change too. I can change it again if
> that's wrong, but it seems to me that the license field should really be
> about what gets installed.

Good points. My original thought when bringing this up was that we also
distribute the source code with `guix package --source`. I don't think
we have an idiomatic way to specify a different set of licenses for the
source code and the built package.

Advice requested!

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-09  3:39       ` Leo Famulari
@ 2016-05-09 20:23         ` Ludovic Courtès
  2016-05-09 21:01           ` Leo Famulari
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2016-05-09 20:23 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

Leo Famulari <leo@famulari.name> skribis:

> On Sat, May 07, 2016 at 09:10:48PM -0500, Alex Griffin wrote:
>> On Sat, May 7, 2016, at 05:23 PM, Leo Famulari wrote:

[...]

>> > There are some GPL'd files in 'contrib/', 'lisp/', and 'python/res/'
>> > 
>> > The file 'tools/update_copyright_year' has an Expat license.
>> > 
>> > And, I think that unless we delete the bundled utfcpp, we are
>> > distributing it through `guix build --source ledger`, so we should
>> > mention its Boost license.
>> 
>> Is the license field for the source tarball or the package that actually
>> gets installed?
>
> Good question. Can anyone answer it?

It’s meant to be for the installed package.  In practice, we’ve often
encoded the license of the source files, usually a superset of the
licenses that apply to the installed software.

When specifying a list of licenses, make sure to add a comment saying
what the list means: if it’s a combination, a license choice, etc.

We should provide ways to express these different things at some point…

>> If it's the former, I have to say that's really
>> unintuitive. I was aware of these extra licenses, but none of that code
>> gets installed after you build the package. Note that emacs-ledger-mode
>> uses the same source tarball and I specified its license as GPL2+.
>> Instead of changing the license field in this patch, I added a note
>> about the other files to make it clear that changing the build options
>> may require the license field to change too. I can change it again if
>> that's wrong, but it seems to me that the license field should really be
>> about what gets installed.
>
> Good points. My original thought when bringing this up was that we also
> distribute the source code with `guix package --source`.

Right, but the source carries its own license anyway in ‘COPYING’, file
headers, etc.

So I sympathize with what Alex wrote.

Thoughts?

Ludo’.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-09 20:23         ` Ludovic Courtès
@ 2016-05-09 21:01           ` Leo Famulari
  2016-05-12  3:28             ` Alex Griffin
  0 siblings, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2016-05-09 21:01 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Mon, May 09, 2016 at 10:23:22PM +0200, Ludovic Courtès wrote:
> Leo Famulari <leo@famulari.name> skribis:
> > Good points. My original thought when bringing this up was that we also
> > distribute the source code with `guix package --source`.
> 
> Right, but the source carries its own license anyway in ‘COPYING’, file
> headers, etc.

Okay, that makes sense!

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-09 21:01           ` Leo Famulari
@ 2016-05-12  3:28             ` Alex Griffin
  2016-05-12  9:12               ` Alex Kost
  0 siblings, 1 reply; 19+ messages in thread
From: Alex Griffin @ 2016-05-12  3:28 UTC (permalink / raw)
  To: Leo Famulari, Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

Here's an updated patch with the suggested changes. I also re-enabled
the shared library and python module, and built html docs, and a few
other things. This turned out to be a much more challenging package than
I expected! Hopefully it is finally finished or very close to finished.

Thanks,
-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-ledger.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-ledger.patch", Size: 5742 bytes --]

From e6fb89828f44765d36a658bd2b497aa8bd8b12d9 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/2] gnu: Add ledger.

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

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index e9487d4..c19e2ca 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,85 @@ 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
+       (let* ((out (assoc-ref %outputs "out"))
+              (examples (string-append out "/share/doc/ledger/examples"))
+              (site-lisp (string-append out "/share/emacs/site-lisp")))
+         (modify-phases %standard-phases
+           (add-before 'configure 'install-examples
+             (lambda _
+               (install-file "test/input/sample.dat" examples)
+               (install-file "test/input/demo.ledger" examples)))
+           (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 _ (setenv "TZDIR"
+                               (string-append (assoc-ref %build-inputs "tzdata")
+                                              "/share/zoneinfo"))))
+           (add-after 'install 'relocate-elisp
+             (lambda _
+               (mkdir-p (string-append site-lisp "/guix.d"))
+               (rename-file (string-append site-lisp "/ledger-mode")
+                            (string-append site-lisp "/guix.d/ledger-mode"))))))
+       #: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"))))
+    (inputs `(("boost" ,boost)
+              ("gmp" ,gmp)
+              ("libedit" ,libedit)
+              ("mpfr" ,mpfr)
+              ("python" ,python-2)
+              ("tzdata" ,tzdata)
+              ("utfcpp" ,utfcpp)))
+    (native-inputs `(("emacs-no-x" ,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/*
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-12  3:28             ` Alex Griffin
@ 2016-05-12  9:12               ` Alex Kost
  2016-05-12 16:31                 ` Alex Griffin
  0 siblings, 1 reply; 19+ messages in thread
From: Alex Kost @ 2016-05-12  9:12 UTC (permalink / raw)
  To: Alex Griffin; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 4371 bytes --]

Alex Griffin (2016-05-12 06:28 +0300) wrote:

> Here's an updated patch with the suggested changes. I also re-enabled
> the shared library and python module, and built html docs, and a few
> other things. This turned out to be a much more challenging package than
> I expected! Hopefully it is finally finished or very close to finished.

Hello, was this package built successfully for you?  I tried it but the
build phase failed (I'm attaching the last part of the build process [1]
just in case).  I don't know, maybe I just don't have enough memory
(3GB) to build it (I had such problems with cmake before).

> From e6fb89828f44765d36a658bd2b497aa8bd8b12d9 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/2] gnu: Add ledger.
>
> * gnu/packages/finance.scm (ledger): New variable.
[...]
> +(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
> +       (let* ((out (assoc-ref %outputs "out"))
> +              (examples (string-append out "/share/doc/ledger/examples"))
> +              (site-lisp (string-append out "/share/emacs/site-lisp")))
> +         (modify-phases %standard-phases
> +           (add-before 'configure 'install-examples
> +             (lambda _
> +               (install-file "test/input/sample.dat" examples)
> +               (install-file "test/input/demo.ledger" examples)))

Every phase should return non-false value if it succeeded.  So since the
returned value of 'install-file' is not specified, we add #t to the end
of such phases.  Please add #t to all phases except the following
(build-doc) because zero? returns #t if succeeded.

> +           (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 _ (setenv "TZDIR"
> +                               (string-append (assoc-ref %build-inputs "tzdata")
> +                                              "/share/zoneinfo"))))

Unlike configure-flags where we can use only %build-inputs, in phases,
it is better to use a functional style using 'inputs' passed to a phase
as argument:

             (lambda* (#:key inputs #:allow-other-keys)
               (setenv "TZDIR"
                       (string-append (assoc-ref inputs "tzdata")
                                      "/share/zoneinfo"))
               #t)

> +           (add-after 'install 'relocate-elisp
> +             (lambda _
> +               (mkdir-p (string-append site-lisp "/guix.d"))
> +               (rename-file (string-append site-lisp "/ledger-mode")
> +                            (string-append site-lisp "/guix.d/ledger-mode"))))))

(Sorry, the following comment is not related to this patch)

This is another point for us to get rid of "guix.d" part: it is a common
practice for packages to put elisp files in a sub-directory of
"share/emacs/site-lisp/" (at least mu, magit and git-modes do this as
well).

It seems natural for me if our emacs will look in "site-lisp/<package>"
instead of "site-lisp/guix.d/<package>", so there will be no need to
adjust such packages to move elisp files.

So I beg people to answer to
<http://lists.gnu.org/archive/html/guix-devel/2016-05/msg00296.html>.
"guix.d" part is a redundant level in file hierarchy, let's remove it!

> +       #: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"))))

It doesn't matter but usually we put #:configure-flags before #:phases.


[-- Attachment #2: guix-ledger-build-fail.log --]
[-- Type: application/octet-stream, Size: 21995 bytes --]

...
[ 23%] Building CXX object src/CMakeFiles/libledger.dir/generate.cc.o
cd /tmp/guix-build-ledger-3.1.1.drv-0/build/src && /gnu/store/sjvcirri2bg7q5hlrkaywhmxllik0cfx-gcc-4.9.3/bin/c++   -Dlibledger_EXPORTS -O3 -DNDEBUG -fPIC -isystem /gnu/store/kcc3cxnx9l2hbg7pjhxsa0r5yq2j2f38-python-2.7.10/include/python2.7 -isystem /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include -isystem /gnu/store/jm4pd6hvgpclkxw2jgxnjl0s77grcwnr-gmp-6.1.0/include -isystem /gnu/store/5vrfmnmlsaz2v7rcr7p5qabx7l6xkkvr-mpfr-3.1.3/include -isystem /gnu/store/wpqssylyn9yyz4rvz4ff9ngnkir25b0d-libedit-20150325-3.1/include -I/gnu/store/mga4vf4bg0i30n09gwmswxpwxkpl2yqg-utfcpp-2.3.4/include -I/tmp/guix-build-ledger-3.1.1.drv-0/build    -std=c++11 -o CMakeFiles/libledger.dir/generate.cc.o -c /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/csv.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
                                                                               ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
                                                                               ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:12:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/bool_trait_def.hpp:18:79: note: #pragma message: NOTE: Use of this header (bool_trait_def.hpp) is deprecated
 # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
                                                                               ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/bool_trait_def.hpp:21:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:12,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/csv.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/bool_trait_def.hpp:21:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:12,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/bool_trait_def.hpp:21:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:12,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:13:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:13:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/is_dereferenceable.hpp:13:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/resolve.hpp:26,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/push.hpp:24,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/detail/streambuf/indirect_streambuf.hpp:31,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream_buffer.hpp:22,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/iostreams/stream.hpp:21,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:196,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/csv.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/template_arity_spec.hpp:13:84: note: #pragma message: NOTE: Use of this header (template_arity_spec.hpp) is deprecated
 # pragma message("NOTE: Use of this header (template_arity_spec.hpp) is deprecated")
                                                                                    ^
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
src/CMakeFiles/libledger.dir/build.make:113: recipe for target 'src/CMakeFiles/libledger.dir/csv.cc.o' failed
make[2]: *** [src/CMakeFiles/libledger.dir/csv.cc.o] Error 4
make[2]: *** Waiting for unfinished jobs....
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:15:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_or.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_or.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated")
                                                                       ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:15:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_or.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_or.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated")
                                                                       ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:16:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_and.hpp:18:72: note: #pragma message: NOTE: Use of this header (ice_and.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_and.hpp) is deprecated")
                                                                        ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:16:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_and.hpp:18:72: note: #pragma message: NOTE: Use of this header (ice_and.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_and.hpp) is deprecated")
                                                                        ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:17:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_not.hpp:17:72: note: #pragma message: NOTE: Use of this header (ice_not.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_not.hpp) is deprecated")
                                                                        ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:17:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_not.hpp:17:72: note: #pragma message: NOTE: Use of this header (ice_not.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_not.hpp) is deprecated")
                                                                        ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:18:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/generate.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_eq.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_eq.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated")
                                                                       ^
In file included from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/ice.hpp:18:0,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/detail/def_helper.hpp:9,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python/class.hpp:29,
                 from /gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/python.hpp:18,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/build/system.hh:246,
                 from /tmp/guix-build-ledger-3.1.1.drv-0/ledger-3.1.1/src/stats.cc:32:
/gnu/store/g70195d256g0nllq75r6zphdf38d9zmr-boost-1.60.0/include/boost/type_traits/detail/ice_eq.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_eq.hpp) is deprecated
 # pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated")
                                                                       ^
make[2]: Leaving directory '/tmp/guix-build-ledger-3.1.1.drv-0/build'
CMakeFiles/Makefile2:127: recipe for target 'src/CMakeFiles/libledger.dir/all' failed
make[1]: *** [src/CMakeFiles/libledger.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-ledger-3.1.1.drv-0/build'
Makefile:163: recipe for target 'all' failed
make: *** [all] Error 2
phase `build' failed after 29.4 seconds
builder for `/gnu/store/p247wj2y2vc1smij9f1xmvy18a8qlnkq-ledger-3.1.1.drv' failed with exit code 1
@ build-failed /gnu/store/p247wj2y2vc1smij9f1xmvy18a8qlnkq-ledger-3.1.1.drv - 1 builder for `/gnu/store/p247wj2y2vc1smij9f1xmvy18a8qlnkq-ledger-3.1.1.drv' failed with exit code 1
guix build: error: build failed: build of `/gnu/store/p247wj2y2vc1smij9f1xmvy18a8qlnkq-ledger-3.1.1.drv' failed

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-12  9:12               ` Alex Kost
@ 2016-05-12 16:31                 ` Alex Griffin
  2016-05-12 19:03                   ` Leo Famulari
  2016-05-13 19:16                   ` Alex Kost
  0 siblings, 2 replies; 19+ messages in thread
From: Alex Griffin @ 2016-05-12 16:31 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

On Thu, May 12, 2016, at 04:12 AM, Alex Kost wrote:
> Hello, was this package built successfully for you?  I tried it but the
> build phase failed (I'm attaching the last part of the build process [1]
> just in case).  I don't know, maybe I just don't have enough memory
> (3GB) to build it (I had such problems with cmake before).

Yes, it builds fine for me. It looks like the important line in your
build log is "c++: internal compiler error: Killed (program cc1plus)",
which could be from running out of memory. Does it still happen if you
add `#:parallel-build? #f` to the build system arguments?

> Every phase should return non-false value if it succeeded.  So since the
> returned value of 'install-file' is not specified, we add #t to the end
> of such phases.  Please add #t to all phases except the following
> (build-doc) because zero? returns #t if succeeded.

OK, done.

> Unlike configure-flags where we can use only %build-inputs, in phases,
> it is better to use a functional style using 'inputs' passed to a phase
> as argument:

Done.

> It doesn't matter but usually we put #:configure-flags before #:phases.

Done. Attached is an updated patch.

Thanks,
-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-ledger.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-ledger.patch", Size: 5825 bytes --]

From 0090f1d526f35a72144a3d32158cbad987ef4d10 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/2] gnu: Add ledger.

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

diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index e9487d4..0fb0534 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,89 @@ 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
+     `(#: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
+       (let* ((out (assoc-ref %outputs "out"))
+              (examples (string-append out "/share/doc/ledger/examples"))
+              (site-lisp (string-append out "/share/emacs/site-lisp")))
+         (modify-phases %standard-phases
+           (add-before 'configure 'install-examples
+             (lambda _
+               (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 _
+               (mkdir-p (string-append site-lisp "/guix.d"))
+               (rename-file (string-append site-lisp "/ledger-mode")
+                            (string-append site-lisp "/guix.d/ledger-mode"))
+               #t))))))
+    (inputs `(("boost" ,boost)
+              ("gmp" ,gmp)
+              ("libedit" ,libedit)
+              ("mpfr" ,mpfr)
+              ("python" ,python-2)
+              ("tzdata" ,tzdata)
+              ("utfcpp" ,utfcpp)))
+    (native-inputs `(("emacs-no-x" ,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/*
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-12 16:31                 ` Alex Griffin
@ 2016-05-12 19:03                   ` Leo Famulari
  2016-05-13 19:16                   ` Alex Kost
  1 sibling, 0 replies; 19+ messages in thread
From: Leo Famulari @ 2016-05-12 19:03 UTC (permalink / raw)
  To: Alex Griffin; +Cc: guix-devel, Alex Kost

On Thu, May 12, 2016 at 11:31:14AM -0500, Alex Griffin wrote:
> On Thu, May 12, 2016, at 04:12 AM, Alex Kost wrote:
> > Hello, was this package built successfully for you?  I tried it but the
> > build phase failed (I'm attaching the last part of the build process [1]
> > just in case).  I don't know, maybe I just don't have enough memory
> > (3GB) to build it (I had such problems with cmake before).
> 
> Yes, it builds fine for me. It looks like the important line in your
> build log is "c++: internal compiler error: Killed (program cc1plus)",
> which could be from running out of memory. Does it still happen if you
> add `#:parallel-build? #f` to the build system arguments?

I can build it on x86_64 with 8 GB RAM.

I monitored resource usage, and saw peak usage of > 4 GB RAM.
4.16s user 0.18s system 0% cpu 7:49.75 total

When #:parallel-build? was #f, I saw peaks of ~1 GB RAM.
4.08s user 0.16s system 0% cpu 15:12.48 total

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-12 16:31                 ` Alex Griffin
  2016-05-12 19:03                   ` Leo Famulari
@ 2016-05-13 19:16                   ` Alex Kost
  2016-05-13 21:05                     ` Alex Griffin
  2016-05-14  2:49                     ` Leo Famulari
  1 sibling, 2 replies; 19+ messages in thread
From: Alex Kost @ 2016-05-13 19:16 UTC (permalink / raw)
  To: Alex Griffin; +Cc: guix-devel

Alex Griffin (2016-05-12 19:31 +0300) wrote:

> On Thu, May 12, 2016, at 04:12 AM, Alex Kost wrote:
>> Hello, was this package built successfully for you?  I tried it but the
>> build phase failed (I'm attaching the last part of the build process [1]
>> just in case).  I don't know, maybe I just don't have enough memory
>> (3GB) to build it (I had such problems with cmake before).
>
> Yes, it builds fine for me. It looks like the important line in your
> build log is "c++: internal compiler error: Killed (program cc1plus)",
> which could be from running out of memory. Does it still happen if you
> add `#:parallel-build? #f` to the build system arguments?

Oh indeed, if parallel-build is disabled, it is built successfully.
Thank you (and Leo)!

So I don't know, should ‘#:parallel-build? #f’ be used in the final
package recipe?  I guess not, as it looks like a problem on my side (not
enough memory for parallel-build).

>> Every phase should return non-false value if it succeeded.  So since the
>> returned value of 'install-file' is not specified, we add #t to the end
>> of such phases.  Please add #t to all phases except the following
>> (build-doc) because zero? returns #t if succeeded.
>
> OK, done.
>
>> Unlike configure-flags where we can use only %build-inputs, in phases,
>> it is better to use a functional style using 'inputs' passed to a phase
>> as argument:
>
> Done.
>
>> It doesn't matter but usually we put #:configure-flags before #:phases.
>
> Done. Attached is an updated patch.

Thank you!  Overall the patch looks good to me, I have only a couple of
comments more (I'm sorry I didn't notice it before :-)).  But no need to
resent the patch, I can fix it on my side and commit it.  The only thing
that is unclear for me is whether this parallel-build should be disabled
or not.

> From 0090f1d526f35a72144a3d32158cbad987ef4d10 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/2] gnu: Add ledger.
>
> * gnu/packages/finance.scm (ledger): New variable.
[...]
> +(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
> +     `(#: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
> +       (let* ((out (assoc-ref %outputs "out"))
> +              (examples (string-append out "/share/doc/ledger/examples"))
> +              (site-lisp (string-append out "/share/emacs/site-lisp")))
> +         (modify-phases %standard-phases

I only notice just now that you have 'modify-phases' inside this let.  I
would rather make local 'let'-s with necessary variables inside phases.
I mean 'examples' directory is needed only inside 'install-examples'
phase; 'site-lisp' inside 'relocate-elisp' phase.  Also it is better to
use 'outputs' argument passed to phases instead of the global %outputs.

> +           (add-before 'configure 'install-examples
> +             (lambda _
> +               (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 _
> +               (mkdir-p (string-append site-lisp "/guix.d"))
> +               (rename-file (string-append site-lisp "/ledger-mode")
> +                            (string-append site-lisp "/guix.d/ledger-mode"))
> +               #t))))))

It is also good to generate "ledger-autoloads.el" file.  This allows a
user to have "M-x ledger-mode" available by default without any
additional settings.  This can be done by calling:

  (emacs-generate-autoloads "ledger" "<elisp-dir>")

However it is a bit tricky: 'emacs-generate-autoloads' procedure is
placed in (guix build emacs-utils) module which is not available for
cmake build system by default, so this module should be:

1) imported (via #:imported-modules argument), i.e. available for using
2) used (via #:modules argument).

Overall, here is how I would write 'arguments' field of this package:

    (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"))
       #:parallel-build? #f  ; needed?
       #: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)))))

The rest looks good to me, so if there will be no other comments, I will
commit it (without ‘#:parallel-build? #f’).

> +    (inputs `(("boost" ,boost)
> +              ("gmp" ,gmp)
> +              ("libedit" ,libedit)
> +              ("mpfr" ,mpfr)
> +              ("python" ,python-2)
> +              ("tzdata" ,tzdata)
> +              ("utfcpp" ,utfcpp)))
> +    (native-inputs `(("emacs-no-x" ,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/*

-- 
Alex

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-13 19:16                   ` Alex Kost
@ 2016-05-13 21:05                     ` Alex Griffin
  2016-05-14  2:49                     ` Leo Famulari
  1 sibling, 0 replies; 19+ messages in thread
From: Alex Griffin @ 2016-05-13 21:05 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

I don't know whether parallel builds should be enabled or disabled. My
initial thought was that it makes sense if it allows ledger to build on
more machines. On the other hand, the more general fix (one that will
also work on lots of other packages) is simply to allocate more swap on
those machines.

On Fri, May 13, 2016, at 02:16 PM, Alex Kost wrote:
> Overall, here is how I would write 'arguments' field of this package: [...]

Since I wrote this package largely by copying other packages I found,
I'm curious how I would ever learn some of this stuff. How do I know
which variables are available in different parts of the package
definition, and similar details? I could probably just continue diving
deeper into the source, but since it's guile I suspect there's some way
to explore interactively. I'm just not sure how; my REPL fu is weak.
-- 
Alex Griffin

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-13 19:16                   ` Alex Kost
  2016-05-13 21:05                     ` Alex Griffin
@ 2016-05-14  2:49                     ` Leo Famulari
  2016-05-16 15:03                       ` Alex Kost
  2016-05-16 17:45                       ` Christopher Allan Webber
  1 sibling, 2 replies; 19+ messages in thread
From: Leo Famulari @ 2016-05-14  2:49 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

On Fri, May 13, 2016 at 10:16:29PM +0300, Alex Kost wrote:
> Alex Griffin (2016-05-12 19:31 +0300) wrote:
> > Yes, it builds fine for me. It looks like the important line in your
> > build log is "c++: internal compiler error: Killed (program cc1plus)",
> > which could be from running out of memory. Does it still happen if you
> > add `#:parallel-build? #f` to the build system arguments?
> 
> Oh indeed, if parallel-build is disabled, it is built successfully.
> Thank you (and Leo)!
> 
> So I don't know, should ‘#:parallel-build? #f’ be used in the final
> package recipe?  I guess not, as it looks like a problem on my side (not
> enough memory for parallel-build).

My opinion is that 3 or 4 GB is not a very small amount of RAM for a
personal computer.

I think that allowing users with "only" 4 GB RAM to build our ledger
package is worth it taking twice as long for the rest of us.

Or, users with ≤ 4 GB RAM could make a private variant of ledger that
disables parallel building. We sometimes suggest that users with
esoteric requirements or restrictions do something like this, but I
don't think this is one of those cases.

Thoughts?

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-14  2:49                     ` Leo Famulari
@ 2016-05-16 15:03                       ` Alex Kost
  2016-05-16 17:45                       ` Christopher Allan Webber
  1 sibling, 0 replies; 19+ messages in thread
From: Alex Kost @ 2016-05-16 15:03 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

Leo Famulari (2016-05-14 05:49 +0300) wrote:

> On Fri, May 13, 2016 at 10:16:29PM +0300, Alex Kost wrote:
>> Alex Griffin (2016-05-12 19:31 +0300) wrote:
>> > Yes, it builds fine for me. It looks like the important line in your
>> > build log is "c++: internal compiler error: Killed (program cc1plus)",
>> > which could be from running out of memory. Does it still happen if you
>> > add `#:parallel-build? #f` to the build system arguments?
>> 
>> Oh indeed, if parallel-build is disabled, it is built successfully.
>> Thank you (and Leo)!
>> 
>> So I don't know, should ‘#:parallel-build? #f’ be used in the final
>> package recipe?  I guess not, as it looks like a problem on my side (not
>> enough memory for parallel-build).
>
> My opinion is that 3 or 4 GB is not a very small amount of RAM for a
> personal computer.
>
> I think that allowing users with "only" 4 GB RAM to build our ledger
> package is worth it taking twice as long for the rest of us.
>
> Or, users with ≤ 4 GB RAM could make a private variant of ledger that
> disables parallel building. We sometimes suggest that users with
> esoteric requirements or restrictions do something like this, but I
> don't think this is one of those cases.

I have commited this patch without ‘#:parallel-build? #f’.  Let's see if
hydra can build it or not :-)

-- 
Alex

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-14  2:49                     ` Leo Famulari
  2016-05-16 15:03                       ` Alex Kost
@ 2016-05-16 17:45                       ` Christopher Allan Webber
  2016-05-16 18:05                         ` Efraim Flashner
  2016-05-16 18:06                         ` Leo Famulari
  1 sibling, 2 replies; 19+ messages in thread
From: Christopher Allan Webber @ 2016-05-16 17:45 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel, Alex Kost

Leo Famulari writes:

> On Fri, May 13, 2016 at 10:16:29PM +0300, Alex Kost wrote:
>> Alex Griffin (2016-05-12 19:31 +0300) wrote:
>> > Yes, it builds fine for me. It looks like the important line in your
>> > build log is "c++: internal compiler error: Killed (program cc1plus)",
>> > which could be from running out of memory. Does it still happen if you
>> > add `#:parallel-build? #f` to the build system arguments?
>> 
>> Oh indeed, if parallel-build is disabled, it is built successfully.
>> Thank you (and Leo)!
>> 
>> So I don't know, should ‘#:parallel-build? #f’ be used in the final
>> package recipe?  I guess not, as it looks like a problem on my side (not
>> enough memory for parallel-build).
>
> My opinion is that 3 or 4 GB is not a very small amount of RAM for a
> personal computer.
>
> I think that allowing users with "only" 4 GB RAM to build our ledger
> package is worth it taking twice as long for the rest of us.
>
> Or, users with ≤ 4 GB RAM could make a private variant of ledger that
> disables parallel building. We sometimes suggest that users with
> esoteric requirements or restrictions do something like this, but I
> don't think this is one of those cases.
>
> Thoughts?

I guess I'm of a different view... it was only very recently that I
upgraded to a machine that had > 4GB ram.  And not too long ago I had a
machine with 2GB of ram for a long time.

Which, yes maybe that's living in the past... I dunno :)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-16 17:45                       ` Christopher Allan Webber
@ 2016-05-16 18:05                         ` Efraim Flashner
  2016-05-16 18:06                         ` Leo Famulari
  1 sibling, 0 replies; 19+ messages in thread
From: Efraim Flashner @ 2016-05-16 18:05 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel, Alex Kost

[-- Attachment #1: Type: text/plain, Size: 1960 bytes --]

On Mon, May 16, 2016 at 12:45:57PM -0500, Christopher Allan Webber wrote:
> Leo Famulari writes:
> 
> > On Fri, May 13, 2016 at 10:16:29PM +0300, Alex Kost wrote:
> >> Alex Griffin (2016-05-12 19:31 +0300) wrote:
> >> > Yes, it builds fine for me. It looks like the important line in your
> >> > build log is "c++: internal compiler error: Killed (program cc1plus)",
> >> > which could be from running out of memory. Does it still happen if you
> >> > add `#:parallel-build? #f` to the build system arguments?
> >> 
> >> Oh indeed, if parallel-build is disabled, it is built successfully.
> >> Thank you (and Leo)!
> >> 
> >> So I don't know, should ‘#:parallel-build? #f’ be used in the final
> >> package recipe?  I guess not, as it looks like a problem on my side (not
> >> enough memory for parallel-build).
> >
> > My opinion is that 3 or 4 GB is not a very small amount of RAM for a
> > personal computer.
> >
> > I think that allowing users with "only" 4 GB RAM to build our ledger
> > package is worth it taking twice as long for the rest of us.
> >
> > Or, users with ≤ 4 GB RAM could make a private variant of ledger that
> > disables parallel building. We sometimes suggest that users with
> > esoteric requirements or restrictions do something like this, but I
> > don't think this is one of those cases.
> >
> > Thoughts?
> 
> I guess I'm of a different view... it was only very recently that I
> upgraded to a machine that had > 4GB ram.  And not too long ago I had a
> machine with 2GB of ram for a long time.
> 
> Which, yes maybe that's living in the past... I dunno :)
> 

I wish I could remember, but we do have another build that has a test
disabled because it uses ~4GB of memory.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-16 17:45                       ` Christopher Allan Webber
  2016-05-16 18:05                         ` Efraim Flashner
@ 2016-05-16 18:06                         ` Leo Famulari
  2016-05-16 18:45                           ` Leo Famulari
  1 sibling, 1 reply; 19+ messages in thread
From: Leo Famulari @ 2016-05-16 18:06 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel, Alex Kost

On Mon, May 16, 2016 at 12:45:57PM -0500, Christopher Allan Webber wrote:
> Leo Famulari writes:
> > My opinion is that 3 or 4 GB is not a very small amount of RAM for a
> > personal computer.
> >
> > I think that allowing users with "only" 4 GB RAM to build our ledger
> > package is worth it taking twice as long for the rest of us.
> >
> > Or, users with ≤ 4 GB RAM could make a private variant of ledger that
> > disables parallel building. We sometimes suggest that users with
> > esoteric requirements or restrictions do something like this, but I
> > don't think this is one of those cases.
> >
> > Thoughts?
> 
> I guess I'm of a different view... it was only very recently that I
> upgraded to a machine that had > 4GB ram.  And not too long ago I had a
> machine with 2GB of ram for a long time.

Don't we agree? I think we should not parellelize the tests, since 4 GB
RAM is too high to be a minimum requirement.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/3] gnu: Add ledger.
  2016-05-16 18:06                         ` Leo Famulari
@ 2016-05-16 18:45                           ` Leo Famulari
  0 siblings, 0 replies; 19+ messages in thread
From: Leo Famulari @ 2016-05-16 18:45 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel, Alex Kost

On Mon, May 16, 2016 at 02:06:51PM -0400, Leo Famulari wrote:
> On Mon, May 16, 2016 at 12:45:57PM -0500, Christopher Allan Webber wrote:
> > Leo Famulari writes:
> > > My opinion is that 3 or 4 GB is not a very small amount of RAM for a
> > > personal computer.
> > >
> > > I think that allowing users with "only" 4 GB RAM to build our ledger
> > > package is worth it taking twice as long for the rest of us.
> > >
> > > Or, users with ≤ 4 GB RAM could make a private variant of ledger that
> > > disables parallel building. We sometimes suggest that users with
> > > esoteric requirements or restrictions do something like this, but I
> > > don't think this is one of those cases.
> > >
> > > Thoughts?
> > 
> > I guess I'm of a different view... it was only very recently that I
> > upgraded to a machine that had > 4GB ram.  And not too long ago I had a
> > machine with 2GB of ram for a long time.
> 
> Don't we agree? I think we should not parellelize the tests, since 4 GB
> RAM is too high to be a minimum requirement.

I mean the entire build, not just the tests.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-05-16 18:45 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-07 18:38 [PATCH 2/3] gnu: Add ledger Alex Griffin
2016-05-07 19:20 ` Alex Griffin
2016-05-07 22:23   ` Leo Famulari
2016-05-08  2:10     ` Alex Griffin
2016-05-09  3:39       ` Leo Famulari
2016-05-09 20:23         ` Ludovic Courtès
2016-05-09 21:01           ` Leo Famulari
2016-05-12  3:28             ` Alex Griffin
2016-05-12  9:12               ` Alex Kost
2016-05-12 16:31                 ` Alex Griffin
2016-05-12 19:03                   ` Leo Famulari
2016-05-13 19:16                   ` Alex Kost
2016-05-13 21:05                     ` Alex Griffin
2016-05-14  2:49                     ` Leo Famulari
2016-05-16 15:03                       ` Alex Kost
2016-05-16 17:45                       ` Christopher Allan Webber
2016-05-16 18:05                         ` Efraim Flashner
2016-05-16 18:06                         ` Leo Famulari
2016-05-16 18:45                           ` Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).