gnu: nnn: Don't use NAME in source URI.
[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.4")
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 "1ms2wg4sh5gq3rpjmmnp85rh5nc9ahca1imxkvhz4d3yiwy8hm52"))
66 (patches (search-patches "gnucash-fix-test-transaction-failure.patch"))))
67 (build-system cmake-build-system)
68 (inputs
69 `(("guile" ,guile-2.2)
70 ("boost" ,boost)
71 ("icu4c" ,icu4c)
72 ("glib" ,glib)
73 ("gtk" ,gtk+)
74 ("libgnomecanvas" ,libgnomecanvas)
75 ("libxml2" ,libxml2)
76 ("libxslt" ,libxslt)
77 ("webkitgtk" ,webkitgtk)
78 ("aqbanking" ,aqbanking)
79 ("perl-date-manip" ,perl-date-manip)
80 ("perl-finance-quote" ,perl-finance-quote)
81 ("tzdata" ,tzdata-for-tests)))
82 (native-inputs
83 `(("glib" ,glib "bin") ; glib-compile-schemas, etc.
84 ("intltool" ,intltool)
85 ("googlemock" ,(package-source googletest))
86 ("googletest" ,googletest)
87 ("gnucash-docs" ,gnucash-docs)
88 ("pkg-config" ,pkg-config)))
89 (outputs '("out" "doc" "debug"))
90 (arguments
91 `(#:test-target "check"
92 #:configure-flags
93 (list "-DWITH_OFX=OFF" ; libofx is not available yet
94 "-DWITH_SQL=OFF") ; without dbi.h
95 #:make-flags '("GUILE_AUTO_COMPILE=0")
96 #:modules ((guix build cmake-build-system)
97 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
98 (guix build utils))
99 #:imported-modules (,@%gnu-build-system-modules
100 (guix build cmake-build-system)
101 (guix build glib-or-gtk-build-system))
102 #:phases
103 (modify-phases %standard-phases
104 (add-after 'unpack 'unpack-gmock
105 (lambda* (#:key inputs #:allow-other-keys)
106 (mkdir "gmock")
107 (invoke "tar" "xf" (assoc-ref inputs "googlemock")
108 "-C" "gmock" "--strip-components=1")
109 (setenv "GMOCK_ROOT" (string-append (getcwd) "/gmock/googlemock"))
110 #t))
111 (add-after 'unpack 'set-env-vars
112 (lambda* (#:key inputs #:allow-other-keys)
113 (let ((tzdata (assoc-ref inputs "tzdata")))
114 ;; At least one test is time-related and requires this
115 ;; environment variable.
116 (setenv "TZDIR"
117 (string-append tzdata
118 "/share/zoneinfo"))
119 (substitute* "CMakeLists.txt"
120 (("set\\(SHELL /bin/bash\\)")
121 (string-append "set(SHELL " (which "bash") ")")))
122 #t)))
123 ;; After wrapping gnc-fq-check and gnc-fq-helper we can no longer
124 ;; execute them with perl, so execute them directly instead.
125 (add-after 'unpack 'fix-finance-quote-check
126 (lambda _
127 (substitute* "libgnucash/scm/price-quotes.scm"
128 (("\"perl\" \"-w\" ") ""))
129 #t))
130 ;; The test-stress-options unit test is known to fail, so we disable
131 ;; it (see: https://bugs.gnucash.org/show_bug.cgi?id=796877).
132 (add-after 'unpack 'disable-stress-options-test
133 (lambda _
134 (substitute* "gnucash/report/standard-reports/test/CMakeLists.txt"
135 (("test-stress-options.scm") ""))
136 #t))
137 ;; The qof test requires the en_US, en_GB, and fr_FR locales.
138 (add-before 'check 'install-locales
139 (lambda _
140 (setenv "LOCPATH" (getcwd))
141 (invoke "localedef" "-i" "en_US" "-f" "UTF-8" "./en_US.UTF-8")
142 (invoke "localedef" "-i" "en_GB" "-f" "UTF-8" "./en_GB.UTF-8")
143 (invoke "localedef" "-i" "fr_FR" "-f" "UTF-8" "./fr_FR.UTF-8")
144 #t))
145 ;; There are about 100 megabytes of documentation.
146 (add-after 'install 'install-docs
147 (lambda* (#:key inputs outputs #:allow-other-keys)
148 (let ((docs (assoc-ref inputs "gnucash-docs"))
149 (doc-output (assoc-ref outputs "doc")))
150 (mkdir-p (string-append doc-output "/share"))
151 (symlink (string-append docs "/share/gnome")
152 (string-append doc-output "/share/gnome"))
153 #t)))
154 (add-after 'install-docs 'wrap-programs
155 (lambda* (#:key inputs outputs #:allow-other-keys)
156 (for-each (lambda (prog)
157 (wrap-program (string-append (assoc-ref outputs "out")
158 "/bin/" prog)
159 `("PERL5LIB" ":" prefix
160 ,(map (lambda (o)
161 (string-append o "/lib/perl5/site_perl/"
162 ,(package-version perl)))
163 (if (string=? prog "gnc-fq-helper")
164 (list
165 ,@(transitive-input-references
166 'inputs
167 (map (lambda (l)
168 (assoc l (inputs)))
169 '("perl-finance-quote"
170 "perl-date-manip"))))
171 (list
172 ,@(transitive-input-references
173 'inputs
174 (map (lambda (l)
175 (assoc l (inputs)))
176 '("perl-finance-quote")))))))))
177 '("gnucash"
178 "gnc-fq-check"
179 "gnc-fq-helper"
180 "gnc-fq-dump"))))
181 (add-after 'install 'glib-or-gtk-compile-schemas
182 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
183 (add-after 'install 'glib-or-gtk-wrap
184 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
185 (home-page "https://www.gnucash.org/")
186 (synopsis "Personal and small business financial accounting software")
187 (description
188 "GnuCash is personal and professional financial-accounting software.
189 It can be used to track bank accounts, stocks, income and expenses, based on
190 the double-entry accounting practice. It includes support for QIF/OFX/HBCI
191 import and transaction matching. It also automates several tasks, such as
192 financial calculations or scheduled transactions.
193
194 To make the GnuCash documentation available, its doc output must be
195 installed as well as Yelp, the Gnome help browser.")
196 (license license:gpl3+)))
197
198 ;; This package is not public, since we use it to build the "doc" output of
199 ;; the gnucash package (see above). It would be confusing if it were public.
200 (define gnucash-docs
201 (let ((revision "a")) ;set to the empty string when no revision
202 (package
203 (name "gnucash-docs")
204 (version (package-version gnucash))
205 (source
206 (origin
207 (method url-fetch)
208 (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
209 version "/gnucash-docs-" version revision ".tar.gz"))
210 (sha256
211 (base32
212 "0bgjxpxgk7hy8ihn1kvd8p6vv191q5md2hz6jb9mqc4aykpvdlq7"))))
213 (build-system gnu-build-system)
214 ;; These are native-inputs because they are only required for building the
215 ;; documentation.
216 (native-inputs
217 `(("libxml2" ,libxml2)
218 ;; The "check" target needs the docbook xml package for validating the
219 ;; DocBook XML during the tests.
220 ("docbook-xml" ,docbook-xml)
221 ("libxslt" ,libxslt)
222 ("docbook-xsl" ,docbook-xsl)
223 ("scrollkeeper" ,scrollkeeper)))
224 (home-page "https://www.gnucash.org/")
225 (synopsis "Documentation for GnuCash")
226 (description
227 "User guide and other documentation for GnuCash in various languages.
228 This package exists because the GnuCash project maintains its documentation in
229 an entirely separate package from the actual GnuCash program. It is intended
230 to be read using the GNOME Yelp program.")
231 (license (list license:fdl1.1+ license:gpl3+)))))
232
233 (define-public gwenhywfar
234 (package
235 (name "gwenhywfar")
236 (version "4.20.0")
237 (source
238 (origin
239 (method url-fetch)
240 (uri (string-append "https://www.aquamaniac.de/sites/download/"
241 "download.php?package=01&release=208&file=02&"
242 "dummy=gwenhywfar-" version ".tar.gz"))
243 (file-name (string-append name "-" version ".tar.gz"))
244 (sha256
245 (base32
246 "1c0g3f8jk6j693774ifslx2ds4ksabgbbalhhm9gk20kpamxm22s"))))
247 (build-system gnu-build-system)
248 (arguments
249 `(#:configure-flags
250 (list "--disable-network-checks"
251 ;; GTK+3, GTK+2 and QT4 are supported.
252 "--with-guis=gtk3"
253 (string-append "--with-openssl-includes="
254 (assoc-ref %build-inputs "openssl") "/include")
255 (string-append "--with-openssl-libs="
256 (assoc-ref %build-inputs "openssl") "/lib"))))
257 (inputs
258 `(("libgcrypt" ,libgcrypt)
259 ("gnutls" ,gnutls)
260 ("openssl" ,openssl)
261 ("gtk+" ,gtk+)))
262 (native-inputs
263 `(("pkg-config" ,pkg-config)))
264 (home-page "http://www.aquamaniac.de/sites/aqbanking/index.php")
265 (synopsis "Utility library for networking and security applications")
266 (description
267 "This package provides a helper library for networking and security
268 applications and libraries. It is used by AqBanking.")
269 ;; The license includes an explicit additional permission to compile and
270 ;; distribute this library with the OpenSSL Toolkit.
271 (license license:lgpl2.1+)))
272
273 (define-public aqbanking
274 (package
275 (name "aqbanking")
276 (version "5.7.8")
277 (source
278 (origin
279 (method url-fetch)
280 (uri (string-append "https://www.aquamaniac.de/sites/download/"
281 "download.php?package=03&release=217&file=02&"
282 "dummy=aqbanking-" version ".tar.gz"))
283 (file-name (string-append name "-" version ".tar.gz"))
284 (sha256
285 (base32
286 "0s67mysskbiw1h1p0np4ph4351r7wq3nc873vylam7lsqi66xy0n"))))
287 (build-system gnu-build-system)
288 (arguments
289 `(;; Parallel building fails because aqhbci is required before it's
290 ;; built.
291 #:parallel-build? #f
292 #:configure-flags
293 (list (string-append "--with-gwen-dir="
294 (assoc-ref %build-inputs "gwenhywfar")))))
295 (propagated-inputs
296 `(("gwenhywfar" ,gwenhywfar)))
297 (inputs
298 `(("gmp" ,gmp)
299 ("xmlsec" ,xmlsec)
300 ("gnutls" ,gnutls)))
301 (native-inputs
302 `(("pkg-config" ,pkg-config)
303 ("libltdl" ,libltdl)))
304 (home-page "http://www.aquamaniac.de/sites/aqbanking/index.php")
305 (synopsis "Interface for online banking tasks")
306 (description
307 "AqBanking is a modular and generic interface to online banking tasks,
308 financial file formats (import/export) and bank/country/currency information.
309 AqBanking uses backend plugins to actually perform the online tasks. HBCI,
310 OFX DirectConnect, YellowNet, GeldKarte, and DTAUS discs are currently
311 supported. AqBanking is used by GnuCash, KMyMoney, and QBankManager.")
312 ;; AqBanking is licensed under the GPLv2 or GPLv3
313 (license (list license:gpl2 license:gpl3))))