gnucash.scm 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. (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. (define-public gnucash
  51. ;; TODO: Unbundle libraries such as guile-json found under the "borrowed/"
  52. ;; directory.
  53. (package
  54. (name "gnucash")
  55. (version "3.4")
  56. (source
  57. (origin
  58. (method url-fetch)
  59. (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
  60. version "/gnucash-" version ".tar.bz2"))
  61. (sha256
  62. (base32
  63. "1ms2wg4sh5gq3rpjmmnp85rh5nc9ahca1imxkvhz4d3yiwy8hm52"))
  64. (patches (search-patches "gnucash-fix-test-transaction-failure.patch"))))
  65. (build-system cmake-build-system)
  66. (inputs
  67. `(("guile" ,guile-2.2)
  68. ("boost" ,boost)
  69. ("icu4c" ,icu4c)
  70. ("glib" ,glib)
  71. ("gtk" ,gtk+)
  72. ("libgnomecanvas" ,libgnomecanvas)
  73. ("libxml2" ,libxml2)
  74. ("libxslt" ,libxslt)
  75. ("webkitgtk" ,webkitgtk)
  76. ("aqbanking" ,aqbanking)
  77. ("perl-date-manip" ,perl-date-manip)
  78. ("perl-finance-quote" ,perl-finance-quote)
  79. ("tzdata" ,tzdata-for-tests)))
  80. (native-inputs
  81. `(("glib" ,glib "bin") ; glib-compile-schemas, etc.
  82. ("intltool" ,intltool)
  83. ("googlemock" ,(package-source googletest))
  84. ("googletest" ,googletest)
  85. ("gnucash-docs" ,gnucash-docs)
  86. ("pkg-config" ,pkg-config)))
  87. (outputs '("out" "doc" "debug"))
  88. (arguments
  89. `(#:test-target "check"
  90. #:configure-flags
  91. (list "-DWITH_OFX=OFF" ; libofx is not available yet
  92. "-DWITH_SQL=OFF") ; without dbi.h
  93. #:make-flags '("GUILE_AUTO_COMPILE=0")
  94. #:modules ((guix build cmake-build-system)
  95. ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
  96. (guix build utils))
  97. #:imported-modules (,@%gnu-build-system-modules
  98. (guix build cmake-build-system)
  99. (guix build glib-or-gtk-build-system))
  100. #:phases
  101. (modify-phases %standard-phases
  102. (add-after 'unpack 'unpack-gmock
  103. (lambda* (#:key inputs #:allow-other-keys)
  104. (mkdir "gmock")
  105. (invoke "tar" "xf" (assoc-ref inputs "googlemock")
  106. "-C" "gmock" "--strip-components=1")
  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 (inputs)))
  167. '("perl-finance-quote"
  168. "perl-date-manip"))))
  169. (list
  170. ,@(transitive-input-references
  171. 'inputs
  172. (map (lambda (l)
  173. (assoc l (inputs)))
  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. To make the GnuCash documentation available, its doc output must be
  192. installed as well as Yelp, the Gnome help browser.")
  193. (license license:gpl3+)))
  194. ;; This package is not public, since we use it to build the "doc" output of
  195. ;; the gnucash package (see above). It would be confusing if it were public.
  196. (define gnucash-docs
  197. (let ((revision "a")) ;set to the empty string when no revision
  198. (package
  199. (name "gnucash-docs")
  200. (version (package-version gnucash))
  201. (source
  202. (origin
  203. (method url-fetch)
  204. (uri (string-append "mirror://sourceforge/gnucash/gnucash%20%28stable%29/"
  205. version "/gnucash-docs-" version revision ".tar.gz"))
  206. (sha256
  207. (base32
  208. "0bgjxpxgk7hy8ihn1kvd8p6vv191q5md2hz6jb9mqc4aykpvdlq7"))))
  209. (build-system gnu-build-system)
  210. ;; These are native-inputs because they are only required for building the
  211. ;; documentation.
  212. (native-inputs
  213. `(("libxml2" ,libxml2)
  214. ;; The "check" target needs the docbook xml package for validating the
  215. ;; DocBook XML during the tests.
  216. ("docbook-xml" ,docbook-xml)
  217. ("libxslt" ,libxslt)
  218. ("docbook-xsl" ,docbook-xsl)
  219. ("scrollkeeper" ,scrollkeeper)))
  220. (home-page "https://www.gnucash.org/")
  221. (synopsis "Documentation for GnuCash")
  222. (description
  223. "User guide and other documentation for GnuCash in various languages.
  224. This package exists because the GnuCash project maintains its documentation in
  225. an entirely separate package from the actual GnuCash program. It is intended
  226. to be read using the GNOME Yelp program.")
  227. (license (list license:fdl1.1+ license:gpl3+)))))
  228. (define-public gwenhywfar
  229. (package
  230. (name "gwenhywfar")
  231. (version "4.20.0")
  232. (source
  233. (origin
  234. (method url-fetch)
  235. (uri (string-append "https://www.aquamaniac.de/sites/download/"
  236. "download.php?package=01&release=208&file=02&"
  237. "dummy=gwenhywfar-" version ".tar.gz"))
  238. (file-name (string-append name "-" version ".tar.gz"))
  239. (sha256
  240. (base32
  241. "1c0g3f8jk6j693774ifslx2ds4ksabgbbalhhm9gk20kpamxm22s"))))
  242. (build-system gnu-build-system)
  243. (arguments
  244. `(#:configure-flags
  245. (list "--disable-network-checks"
  246. ;; GTK+3, GTK+2 and QT4 are supported.
  247. "--with-guis=gtk3"
  248. (string-append "--with-openssl-includes="
  249. (assoc-ref %build-inputs "openssl") "/include")
  250. (string-append "--with-openssl-libs="
  251. (assoc-ref %build-inputs "openssl") "/lib"))))
  252. (inputs
  253. `(("libgcrypt" ,libgcrypt)
  254. ("gnutls" ,gnutls)
  255. ("openssl" ,openssl)
  256. ("gtk+" ,gtk+)))
  257. (native-inputs
  258. `(("pkg-config" ,pkg-config)))
  259. (home-page "https://www.aquamaniac.de/sites/aqbanking/index.php")
  260. (synopsis "Utility library for networking and security applications")
  261. (description
  262. "This package provides a helper library for networking and security
  263. applications and libraries. It is used by AqBanking.")
  264. ;; The license includes an explicit additional permission to compile and
  265. ;; distribute this library with the OpenSSL Toolkit.
  266. (license license:lgpl2.1+)))
  267. (define-public aqbanking
  268. (package
  269. (name "aqbanking")
  270. (version "5.7.8")
  271. (source
  272. (origin
  273. (method url-fetch)
  274. (uri (string-append "https://www.aquamaniac.de/sites/download/"
  275. "download.php?package=03&release=217&file=02&"
  276. "dummy=aqbanking-" version ".tar.gz"))
  277. (file-name (string-append name "-" version ".tar.gz"))
  278. (sha256
  279. (base32
  280. "0s67mysskbiw1h1p0np4ph4351r7wq3nc873vylam7lsqi66xy0n"))))
  281. (build-system gnu-build-system)
  282. (arguments
  283. `(;; Parallel building fails because aqhbci is required before it's
  284. ;; built.
  285. #:parallel-build? #f
  286. #:configure-flags
  287. (list (string-append "--with-gwen-dir="
  288. (assoc-ref %build-inputs "gwenhywfar")))))
  289. (propagated-inputs
  290. `(("gwenhywfar" ,gwenhywfar)))
  291. (inputs
  292. `(("gmp" ,gmp)
  293. ("xmlsec" ,xmlsec)
  294. ("gnutls" ,gnutls)))
  295. (native-inputs
  296. `(("pkg-config" ,pkg-config)
  297. ("libltdl" ,libltdl)))
  298. (home-page "https://www.aquamaniac.de/sites/aqbanking/index.php")
  299. (synopsis "Interface for online banking tasks")
  300. (description
  301. "AqBanking is a modular and generic interface to online banking tasks,
  302. financial file formats (import/export) and bank/country/currency information.
  303. AqBanking uses backend plugins to actually perform the online tasks. HBCI,
  304. OFX DirectConnect, YellowNet, GeldKarte, and DTAUS discs are currently
  305. supported. AqBanking is used by GnuCash, KMyMoney, and QBankManager.")
  306. ;; AqBanking is licensed under the GPLv2 or GPLv3
  307. (license (list license:gpl2 license:gpl3))))