Subject: [PATCH 1/1] gnu: Add GnuCash documentation.

From: Chris Marusich <[email-masked]>
Date: Tue, 19 Sep 2017 02:10:58 -0700

* gnu/packages/gnucash.scm (gnucash-docs): Add it.
  (gnucash): Use the glib-or-gtk-build-system, create a "doc" output, and
  install the output of "gnucash-docs" into there.
---
 gnu/packages/gnucash.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/gnucash.scm b/gnu/packages/gnucash.scm
index ac2dce576..45f804fa3 100644
--- a/gnu/packages/gnucash.scm
+++ b/gnu/packages/gnucash.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015, 2016 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2015 Eric Bavier <[email-masked]>
 ;;; Copyright © 2016 Efraim Flashner <[email-masked]>
+;;; Copyright © 2017 Chris Marusich <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,8 +24,11 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system glib-or-gtk)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages docbook)
+  #:use-module (gnu packages documentation)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages glib)
@@ -52,7 +56,7 @@
        (base32
         "0g2risryfgplxh6cxpsl7fn255vipgsx38b4l081h665nqwmz5nv"))
       (patches (search-patches "gnucash-price-quotes-perl.patch"))))
-    (build-system gnu-build-system)
+    (build-system glib-or-gtk-build-system)
     (inputs
      `(("guile" ,guile-2.0)
        ("icu4c" ,icu4c)
@@ -69,15 +73,25 @@
     (native-inputs
      `(("glib" ,glib "bin") ; glib-compile-schemas, etc.
        ("intltool" ,intltool)
+       ("gnucash-docs" ,gnucash-docs)
        ("pkg-config" ,pkg-config)))
+    (outputs '("out" "doc"))
     (arguments
      `(#:tests? #f ;FIXME: failing at /qof/gnc-date/qof print date dmy buff
        #:configure-flags '("--disable-dbi"
                            "--enable-aqbanking")
        #:phases
        (modify-phases %standard-phases
+         ;; There are about 100 megabytes of documentation.
+         (add-after
+          'install 'install-docs
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let ((docs (assoc-ref inputs "gnucash-docs"))
+                  (doc-output (assoc-ref outputs "doc")))
+              (symlink (string-append docs "/share/gnome")
+                       (string-append doc-output "/share/gnome")))))
          (add-after
-          'install 'wrap-programs
+          'install-docs 'wrap-programs
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (for-each (lambda (prog)
                         (wrap-program (string-append (assoc-ref outputs "out")
@@ -114,6 +128,42 @@ import and transaction matching.  It also automates several tasks, such as
 financial calculations or scheduled transactions.")
     (license license:gpl3+)))
 
+;; This package is not public, since we use it to build the "doc" output of
+;; the gnucash package (see above).  It would be confusing if it were public.
+(define gnucash-docs
+  (package
+    (name "gnucash-docs")
+    (version (package-version gnucash))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/gnucash/gnucash-docs/"
+                           version "/gnucash-docs-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0dfb4m4084apav9kjsc4mfbj99xsyxm59qhpm1nxvhybn5h6qr3r"))))
+    (build-system gnu-build-system)
+    ;; These are native-inputs because they are only required for building the
+    ;; documentation.
+    (native-inputs
+     `(("libxml2" ,libxml2)
+       ;; The "check" target needs the docbook xml packages for validating the
+       ;; DocBook XML during the tests.
+       ("docbook-xml-4.4" ,docbook-xml-4.4)
+       ("docbook-xml-4.2" ,docbook-xml-4.2)
+       ("docbook-xml-4.1.2" ,docbook-xml-4.1.2)
+       ("libxslt" ,libxslt)
+       ("docbook-xsl" ,docbook-xsl)
+       ("scrollkeeper" ,scrollkeeper)))
+    (home-page "http://www.gnucash.org/")
+    (synopsis "Documentation for GnuCash")
+    (description
+     "User guide and other documentation for GnuCash in various languages.
+This package exists because the GnuCash project maintains its documentation in
+an entirely separate package from the actual GnuCash program.  It is intended
+to be read using the GNOME Yelp program.")
+    (license (list license:fdl1.1+ license:gpl3+))))
+
 (define-public gwenhywfar
   (package
     (name "gwenhywfar")
-- 
2.14.1