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