gnu: gnucash: Add information about how to use the documentation.
[jackhill/guix/guix.git] / gnu / packages / gnucash.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017 Chris Marusich <cmmarusich@gmail.com>
6 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages gnucash)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system cmake)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages boost)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages cmake)
35 #:use-module (gnu packages docbook)
36 #:use-module (gnu packages documentation)
37 #:use-module (gnu packages gnome)
38 #:use-module (gnu packages gnupg)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages guile)
42 #:use-module (gnu packages icu4c)
43 #:use-module (gnu packages multiprecision)
44 #:use-module (gnu packages perl)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages tls)
47 #:use-module (gnu packages web)
48 #:use-module (gnu packages webkit)
49 #:use-module (gnu packages xml))
50
51 (define-public gnucash
52 ;; TODO: Unbundle libraries such as guile-json found under the "borrowed/"
53 ;; directory.
54 (package
55 (name "gnucash")
56 (version "3.4")
57 (source
58 (origin
59 (method url-fetch)
60 (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
61 version "/gnucash-" version ".tar.bz2"))
62 (sha256
63 (base32
64 "1ms2wg4sh5gq3rpjmmnp85rh5nc9ahca1imxkvhz4d3yiwy8hm52"))
65 (patches (search-patches "gnucash-fix-test-transaction-failure.patch"))))
66 (build-system cmake-build-system)
67 (inputs
68 `(("guile" ,guile-2.2)
69 ("boost" ,boost)
70 ("icu4c" ,icu4c)
71 ("glib" ,glib)
72 ("gtk" ,gtk+)
73 ("libgnomecanvas" ,libgnomecanvas)
74 ("libxml2" ,libxml2)
75 ("libxslt" ,libxslt)
76 ("webkitgtk" ,webkitgtk)
77 ("aqbanking" ,aqbanking)
78 ("perl-date-manip" ,perl-date-manip)
79 ("perl-finance-quote" ,perl-finance-quote)
80 ("tzdata" ,tzdata-for-tests)))
81 (native-inputs
82 `(("glib" ,glib "bin") ; glib-compile-schemas, etc.
83 ("intltool" ,intltool)
84 ("googlemock" ,(package-source googletest))
85 ("googletest" ,googletest)
86 ("gnucash-docs" ,gnucash-docs)
87 ("pkg-config" ,pkg-config)))
88 (outputs '("out" "doc" "debug"))
89 (arguments
90 `(#:test-target "check"
91 #:configure-flags
92 (list "-DWITH_OFX=OFF" ; libofx is not available yet
93 "-DWITH_SQL=OFF") ; without dbi.h
94 #:make-flags '("GUILE_AUTO_COMPILE=0")
95 #:modules ((guix build cmake-build-system)
96 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
97 (guix build utils))
98 #:imported-modules (,@%gnu-build-system-modules
99 (guix build cmake-build-system)
100 (guix build glib-or-gtk-build-system))
101 #:phases
102 (modify-phases %standard-phases
103 (add-after 'unpack 'unpack-gmock
104 (lambda* (#:key inputs #:allow-other-keys)
105 (mkdir "gmock")
106 (invoke "tar" "xf" (assoc-ref inputs "googlemock")
107 "-C" "gmock" "--strip-components=1")
108 (setenv "GMOCK_ROOT" (string-append (getcwd) "/gmock/googlemock"))
109 #t))
110 (add-after 'unpack 'set-env-vars
111 (lambda* (#:key inputs #:allow-other-keys)
112 (let ((tzdata (assoc-ref inputs "tzdata")))
113 ;; At least one test is time-related and requires this
114 ;; environment variable.
115 (setenv "TZDIR"
116 (string-append tzdata
117 "/share/zoneinfo"))
118 (substitute* "CMakeLists.txt"
119 (("set\\(SHELL /bin/bash\\)")
120 (string-append "set(SHELL " (which "bash") ")")))
121 #t)))
122 ;; After wrapping gnc-fq-check and gnc-fq-helper we can no longer
123 ;; execute them with perl, so execute them directly instead.
124 (add-after 'unpack 'fix-finance-quote-check
125 (lambda _
126 (substitute* "libgnucash/scm/price-quotes.scm"
127 (("\"perl\" \"-w\" ") ""))
128 #t))
129 ;; The test-stress-options unit test is known to fail, so we disable
130 ;; it (see: https://bugs.gnucash.org/show_bug.cgi?id=796877).
131 (add-after 'unpack 'disable-stress-options-test
132 (lambda _
133 (substitute* "gnucash/report/standard-reports/test/CMakeLists.txt"
134 (("test-stress-options.scm") ""))
135 #t))
136 ;; The qof test requires the en_US, en_GB, and fr_FR locales.
137 (add-before 'check 'install-locales
138 (lambda _
139 (setenv "LOCPATH" (getcwd))
140 (invoke "localedef" "-i" "en_US" "-f" "UTF-8" "./en_US.UTF-8")
141 (invoke "localedef" "-i" "en_GB" "-f" "UTF-8" "./en_GB.UTF-8")
142 (invoke "localedef" "-i" "fr_FR" "-f" "UTF-8" "./fr_FR.UTF-8")
143 #t))
144 ;; There are about 100 megabytes of documentation.
145 (add-after 'install 'install-docs
146 (lambda* (#:key inputs outputs #:allow-other-keys)
147 (let ((docs (assoc-ref inputs "gnucash-docs"))
148 (doc-output (assoc-ref outputs "doc")))
149 (mkdir-p (string-append doc-output "/share"))
150 (symlink (string-append docs "/share/gnome")
151 (string-append doc-output "/share/gnome"))
152 #t)))
153 (add-after 'install-docs 'wrap-programs
154 (lambda* (#:key inputs outputs #:allow-other-keys)
155 (for-each (lambda (prog)
156 (wrap-program (string-append (assoc-ref outputs "out")
157 "/bin/" prog)
158 `("PERL5LIB" ":" prefix
159 ,(map (lambda (o)
160 (string-append o "/lib/perl5/site_perl/"
161 ,(package-version perl)))
162 (if (string=? prog "gnc-fq-helper")
163 (list
164 ,@(transitive-input-references
165 'inputs
166 (map (lambda (l)
167 (assoc l (inputs)))
168 '("perl-finance-quote"
169 "perl-date-manip"))))
170 (list
171 ,@(transitive-input-references
172 'inputs
173 (map (lambda (l)
174 (assoc l (inputs)))
175 '("perl-finance-quote")))))))))
176 '("gnucash"
177 "gnc-fq-check"
178 "gnc-fq-helper"
179 "gnc-fq-dump"))))
180 (add-after 'install 'glib-or-gtk-compile-schemas
181 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
182 (add-after 'install 'glib-or-gtk-wrap
183 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
184 (home-page "https://www.gnucash.org/")
185 (synopsis "Personal and small business financial accounting software")
186 (description
187 "GnuCash is personal and professional financial-accounting software.
188 It can be used to track bank accounts, stocks, income and expenses, based on
189 the double-entry accounting practice. It includes support for QIF/OFX/HBCI
190 import and transaction matching. It also automates several tasks, such as
191 financial calculations or scheduled transactions.
192
193 To make the GnuCash documentation available, its doc output must be
194 installed as well as Yelp, the Gnome help browser.")
195 (license license:gpl3+)))
196
197 ;; This package is not public, since we use it to build the "doc" output of
198 ;; the gnucash package (see above). It would be confusing if it were public.
199 (define gnucash-docs
200 (let ((revision "1")) ;set to the empty string when no revision
201 (package
202 (name "gnucash-docs")
203 (version (package-version gnucash))
204 (source
205 (origin
206 (method url-fetch)
207 (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
208 version "/gnucash-docs-" version
209 (if (string-null? revision)
210 ""
211 (string-append "-" revision))
212 ".tar.gz"))
213 (sha256
214 (base32
215 "0bgjxpxgk7hy8ihn1kvd8p6vv191q5md2hz6jb9mqc4aykpvdlq7"))))
216 (build-system gnu-build-system)
217 ;; These are native-inputs because they are only required for building the
218 ;; documentation.
219 (native-inputs
220 `(("libxml2" ,libxml2)
221 ;; The "check" target needs the docbook xml package for validating the
222 ;; DocBook XML during the tests.
223 ("docbook-xml" ,docbook-xml)
224 ("libxslt" ,libxslt)
225 ("docbook-xsl" ,docbook-xsl)
226 ("scrollkeeper" ,scrollkeeper)))
227 (home-page "https://www.gnucash.org/")
228 (synopsis "Documentation for GnuCash")
229 (description
230 "User guide and other documentation for GnuCash in various languages.
231 This package exists because the GnuCash project maintains its documentation in
232 an entirely separate package from the actual GnuCash program. It is intended
233 to be read using the GNOME Yelp program.")
234 (license (list license:fdl1.1+ license:gpl3+)))))
235
236 (define-public gwenhywfar
237 (package
238 (name "gwenhywfar")
239 (version "4.20.0")
240 (source
241 (origin
242 (method url-fetch)
243 (uri (string-append "https://www.aquamaniac.de/sites/download/"
244 "download.php?package=01&release=208&file=02&"
245 "dummy=gwenhywfar-" version ".tar.gz"))
246 (file-name (string-append name "-" version ".tar.gz"))
247 (sha256
248 (base32
249 "1c0g3f8jk6j693774ifslx2ds4ksabgbbalhhm9gk20kpamxm22s"))))
250 (build-system gnu-build-system)
251 (arguments
252 `(#:configure-flags
253 (list "--disable-network-checks"
254 ;; GTK+3, GTK+2 and QT4 are supported.
255 "--with-guis=gtk3"
256 (string-append "--with-openssl-includes="
257 (assoc-ref %build-inputs "openssl") "/include")
258 (string-append "--with-openssl-libs="
259 (assoc-ref %build-inputs "openssl") "/lib"))))
260 (inputs
261 `(("libgcrypt" ,libgcrypt)
262 ("gnutls" ,gnutls)
263 ("openssl" ,openssl)
264 ("gtk+" ,gtk+)))
265 (native-inputs
266 `(("pkg-config" ,pkg-config)))
267 (home-page "http://www.aquamaniac.de/sites/aqbanking/index.php")
268 (synopsis "Utility library for networking and security applications")
269 (description
270 "This package provides a helper library for networking and security
271 applications and libraries. It is used by AqBanking.")
272 ;; The license includes an explicit additional permission to compile and
273 ;; distribute this library with the OpenSSL Toolkit.
274 (license license:lgpl2.1+)))
275
276 (define-public aqbanking
277 (package
278 (name "aqbanking")
279 (version "5.7.8")
280 (source
281 (origin
282 (method url-fetch)
283 (uri (string-append "https://www.aquamaniac.de/sites/download/"
284 "download.php?package=03&release=217&file=02&"
285 "dummy=aqbanking-" version ".tar.gz"))
286 (file-name (string-append name "-" version ".tar.gz"))
287 (sha256
288 (base32
289 "0s67mysskbiw1h1p0np4ph4351r7wq3nc873vylam7lsqi66xy0n"))))
290 (build-system gnu-build-system)
291 (arguments
292 `(;; Parallel building fails because aqhbci is required before it's
293 ;; built.
294 #:parallel-build? #f
295 #:configure-flags
296 (list (string-append "--with-gwen-dir="
297 (assoc-ref %build-inputs "gwenhywfar")))))
298 (propagated-inputs
299 `(("gwenhywfar" ,gwenhywfar)))
300 (inputs
301 `(("gmp" ,gmp)
302 ("xmlsec" ,xmlsec)
303 ("gnutls" ,gnutls)))
304 (native-inputs
305 `(("pkg-config" ,pkg-config)
306 ("libltdl" ,libltdl)))
307 (home-page "http://www.aquamaniac.de/sites/aqbanking/index.php")
308 (synopsis "Interface for online banking tasks")
309 (description
310 "AqBanking is a modular and generic interface to online banking tasks,
311 financial file formats (import/export) and bank/country/currency information.
312 AqBanking uses backend plugins to actually perform the online tasks. HBCI,
313 OFX DirectConnect, YellowNet, GeldKarte, and DTAUS discs are currently
314 supported. AqBanking is used by GnuCash, KMyMoney, and QBankManager.")
315 ;; AqBanking is licensed under the GPLv2 or GPLv3
316 (license (list license:gpl2 license:gpl3))))