gnucash.scm 14 KB

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