Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / finance.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Andreas Enge <andreas@enge.fr>
3 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
5 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
6 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
7 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
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 finance)
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 (guix build-system python)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages boost)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages databases)
35 #:use-module (gnu packages documentation)
36 #:use-module (gnu packages dns)
37 #:use-module (gnu packages emacs)
38 #:use-module (gnu packages graphviz)
39 #:use-module (gnu packages groff)
40 #:use-module (gnu packages libedit)
41 #:use-module (gnu packages libevent)
42 #:use-module (gnu packages libunwind)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages multiprecision)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages protobuf)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages qt)
49 #:use-module (gnu packages texinfo)
50 #:use-module (gnu packages textutils)
51 #:use-module (gnu packages tls)
52 #:use-module (gnu packages upnp)
53 #:use-module (gnu packages web)
54 #:use-module (gnu packages xml)
55 #:use-module (gnu packages gnuzilla))
56
57 (define-public bitcoin-core
58 (package
59 (name "bitcoin-core")
60 (version "0.15.0.1")
61 (source (origin
62 (method url-fetch)
63 (uri
64 (string-append "https://bitcoin.org/bin/bitcoin-core-"
65 version "/bitcoin-" version ".tar.gz"))
66 (sha256
67 (base32
68 "16si3skhm6jhw1pkniv2b9y1kkdhjmhj392palphir0qc1srwzmm"))))
69 (build-system gnu-build-system)
70 (native-inputs
71 `(("pkg-config" ,pkg-config)
72 ("python" ,python) ; for the tests
73 ("util-linux" ,util-linux) ; provides the hexdump command for tests
74 ("qttools" ,qttools)))
75 (inputs
76 `(("bdb" ,bdb-5.3) ; with 6.2.23, there is an error: ambiguous overload
77 ("boost" ,boost)
78 ("libevent" ,libevent)
79 ("miniupnpc" ,miniupnpc)
80 ("openssl" ,openssl)
81 ("protobuf" ,protobuf)
82 ("qtbase" ,qtbase)))
83 (arguments
84 `(#:configure-flags
85 (list
86 ;; We use a bdb version newer than 4.8.
87 "--with-incompatible-bdb"
88 ;; Boost is not found unless specified manually.
89 (string-append "--with-boost="
90 (assoc-ref %build-inputs "boost"))
91 ;; XXX: The configure script looks up Qt paths by
92 ;; `pkg-config --variable=host_bins Qt5Core`, which fails to pick
93 ;; up executables residing in 'qttools', so we specify them here.
94 (string-append "ac_cv_path_LRELEASE="
95 (assoc-ref %build-inputs "qttools")
96 "/bin/lrelease")
97 (string-append "ac_cv_path_LUPDATE="
98 (assoc-ref %build-inputs "qttools")
99 "/bin/lupdate"))
100 #:phases
101 (modify-phases %standard-phases
102 (add-before 'check 'set-home
103 (lambda _
104 (setenv "HOME" (getenv "TMPDIR"))))))) ; Tests write to $HOME.
105 (home-page "https://bitcoin.org/en/")
106 (synopsis "Bitcoin peer-to-peer client")
107 (description
108 "Bitcoin is a digital currency that enables instant payments to anyone
109 anywhere in the world. It uses peer-to-peer technology to operate without
110 central authority: managing transactions and issuing money are carried out
111 collectively by the network. Bitcoin Core is the reference implementation
112 of the bitcoin protocol. This package provides the Bitcoin Core command
113 line client and a client based on Qt.")
114 (license license:expat)))
115
116 (define-public ledger
117 (package
118 (name "ledger")
119 (version "3.1.1")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append
123 "https://github.com/ledger/ledger/archive/v"
124 version ".tar.gz"))
125 (file-name (string-append name "-" version ".tar.gz"))
126 (sha256
127 (base32
128 "12jlv3gsjhrja25q9hrwh73cdacd2l3c2yyn8qnijav9mdhnbw4h"))))
129 (build-system cmake-build-system)
130 (arguments
131 `(#:modules ((guix build cmake-build-system)
132 (guix build utils)
133 (guix build emacs-utils))
134 #:imported-modules (,@%cmake-build-system-modules
135 (guix build emacs-utils))
136 #:configure-flags
137 `("-DBUILD_DOCS:BOOL=ON"
138 "-DBUILD_WEB_DOCS:BOOL=ON"
139 "-DBUILD_EMACSLISP:BOOL=ON"
140 "-DUSE_PYTHON:BOOL=ON"
141 "-DCMAKE_INSTALL_LIBDIR:PATH=lib"
142 ,(string-append "-DUTFCPP_INCLUDE_DIR:PATH="
143 (assoc-ref %build-inputs "utfcpp")
144 "/include"))
145 #:phases
146 (modify-phases %standard-phases
147 (add-before 'configure 'install-examples
148 (lambda* (#:key outputs #:allow-other-keys)
149 (let ((examples (string-append (assoc-ref outputs "out")
150 "/share/doc/ledger/examples")))
151 (install-file "test/input/sample.dat" examples)
152 (install-file "test/input/demo.ledger" examples))
153 #t))
154 (add-after 'build 'build-doc
155 (lambda _ (zero? (system* "make" "doc"))))
156 (add-before 'check 'check-setup
157 ;; One test fails if it can't set the timezone.
158 (lambda* (#:key inputs #:allow-other-keys)
159 (setenv "TZDIR"
160 (string-append (assoc-ref inputs "tzdata")
161 "/share/zoneinfo"))
162 #t))
163 (add-after 'install 'relocate-elisp
164 (lambda* (#:key outputs #:allow-other-keys)
165 (let* ((site-dir (string-append (assoc-ref outputs "out")
166 "/share/emacs/site-lisp"))
167 (guix-dir (string-append site-dir "/guix.d"))
168 (orig-dir (string-append site-dir "/ledger-mode"))
169 (dest-dir (string-append guix-dir "/ledger-mode")))
170 (mkdir-p guix-dir)
171 (rename-file orig-dir dest-dir)
172 (emacs-generate-autoloads ,name dest-dir))
173 #t)))))
174 (inputs
175 `(("boost" ,boost)
176 ("gmp" ,gmp)
177 ("libedit" ,libedit)
178 ("mpfr" ,mpfr)
179 ("python" ,python-2)
180 ("tzdata" ,tzdata)
181 ("utfcpp" ,utfcpp)))
182 (native-inputs
183 `(("emacs" ,emacs-minimal)
184 ("groff" ,groff)
185 ("texinfo" ,texinfo)))
186 (home-page "http://ledger-cli.org/")
187 (synopsis "Command-line double-entry accounting program")
188 (description
189 "Ledger is a powerful, double-entry accounting system that is
190 accessed from the UNIX command-line. This may put off some users, since
191 there is no flashy UI, but for those who want unparalleled reporting
192 access to their data there are few alternatives.
193
194 Ledger uses text files for input. It reads the files and generates
195 reports; there is no other database or stored state. To use Ledger,
196 you create a file of your account names and transactions, run from the
197 command line with some options to specify input and requested reports, and
198 get output. The output is generally plain text, though you could generate
199 a graph or html instead. Ledger is simple in concept, surprisingly rich
200 in ability, and easy to use.")
201 ;; There are some extra licenses in files which do not presently get
202 ;; installed when you build this package. Different versions of the GPL
203 ;; are used in the contrib and python subdirectories. The bundled version
204 ;; of utfcpp is under the Boost 1.0 license. Also the file
205 ;; `tools/update_copyright_year` has an Expat license.
206 (license (list license:bsd-3
207 license:asl2.0 ; src/strptime.cc
208 (license:non-copyleft
209 "file://src/wcwidth.cc"
210 "See src/wcwidth.cc in the distribution.")
211 license:gpl2+)))) ; lisp/*
212
213 (define-public geierlein
214 (package
215 (name "geierlein")
216 (version "0.9.5")
217 (source
218 (origin
219 (method url-fetch)
220 (uri (string-append "https://github.com/stesie/geierlein"
221 "/archive/V" version ".tar.gz"))
222 (file-name (string-append name "-" version ".tar.gz"))
223 (sha256
224 (base32
225 "0b11fq8v5w8nxjb20jl4dsfhv76xky6n3sq3k3fbb0m2sq9ikikw"))))
226 (build-system gnu-build-system)
227 (arguments
228 `(#:tests? #f ; would require npm, python and a lot more
229 #:phases
230 (modify-phases %standard-phases
231 (delete 'configure)
232 (add-after 'unpack 'override-target-directory-and-tool-paths
233 (lambda* (#:key inputs outputs #:allow-other-keys)
234 (substitute* "Makefile"
235 (("prefix := .*")
236 (string-append "prefix := " (assoc-ref outputs "out") "\n"))
237 ;; Required for tests, unused for now:
238 ;;(("PYTHON := .*")
239 ;; (string-append (which "python") "\n")))
240 (("INSTALL := .*")
241 (string-append "INSTALL := " (which "install") "\n")))
242 (substitute* "bin/xgeierlein.in"
243 ;; Use icecat as XULRUNNER
244 (("^for search ")
245 (string-append "XULRUNNER=" (which "icecat") "\n"
246 "for search ")))
247 #t)))))
248 (inputs
249 `(("icecat" ,icecat)))
250 (home-page "http://stesie.github.io/geierlein/")
251 (synopsis "Free Elster client, for sending Germany VAT declarations")
252 (description
253 "Geierlein is a free Elster client, i.e. an application that
254 allows to send VAT declarations to Germany's fiscal authorities.
255
256 Currently it is *not* possible to send returns that are due annually
257 (especially the income tax return) since the fiscal authority doesn't
258 allow to do that off the ERiC library (which is proprietary however).
259 It's not clear at the moment whether one day it will be possible to
260 do so.")
261 (license license:agpl3+)))
262
263 (define-public electrum
264 (package
265 (name "electrum")
266 (version "2.9.3")
267 (source
268 (origin
269 (method url-fetch)
270 (uri (string-append "https://download.electrum.org/"
271 version "/Electrum-"
272 version ".tar.gz"))
273 (sha256
274 (base32
275 "0d0fzb653g7b8ka3x90nl21md4g3n1fv11czdxpdq3s9yr6js6f2"))
276 (modules '((guix build utils)))
277 (snippet
278 '(begin
279 ;; Delete the bundled dependencies.
280 (delete-file-recursively "packages")
281 #t))))
282 (build-system python-build-system)
283 (inputs
284 `(("python-pyaes" ,python2-pyaes)
285 ("python-pysocks" ,python2-pysocks)
286 ("python-sip" ,python2-sip)
287 ("python-pyqt" ,python2-pyqt-4)
288 ("python-ecdsa" ,python2-ecdsa)
289 ("python-pbkdf2" ,python2-pbkdf2)
290 ("python-requests" ,python2-requests)
291 ("python-qrcode" ,python2-qrcode)
292 ("python-protobuf" ,python2-protobuf)
293 ("python-dnspython" ,python2-dnspython)
294 ("python-jsonrpclib" ,python2-jsonrpclib)))
295 (arguments
296 `(#:python ,python-2
297 #:phases
298 (modify-phases %standard-phases
299 (add-before 'build 'patch-home
300 (lambda* (#:key outputs #:allow-other-keys)
301 (substitute* "setup.py"
302 (("~/.local/share")
303 (string-append (assoc-ref outputs "out") "/local/share"))))))))
304 (home-page "https://electrum.org/")
305 (synopsis "Bitcoin wallet")
306 (description
307 "Electrum is a lightweight Bitcoin client, based on a client-server
308 protocol. It supports Simple Payment Verification (SPV) and deterministic key
309 generation from a seed. Your secret keys are encrypted and are never sent to
310 other machines/servers. Electrum does not download the Bitcoin blockchain.")
311 (license license:expat)))
312
313 (define-public monero
314 ;; This package bundles easylogging++ and lmdb.
315 ;; The bundled easylogging++ is modified, and the changes will not be upstreamed.
316 ;; The devs deem the lmdb driver too critical a consenus component, to use
317 ;; the system's dynamically linked library.
318 (package
319 (name "monero")
320 (version "0.11.0.0")
321 (source
322 (origin
323 (method url-fetch)
324 (uri (string-append "https://github.com/monero-project/monero/archive/v"
325 version ".tar.gz"))
326 (file-name (string-append name "-" version ".tar.gz"))
327 (modules '((guix build utils)))
328 (snippet
329 '(begin
330 ;; Delete bundled dependencies.
331 (for-each
332 delete-file-recursively
333 '("external/miniupnpc" "external/rapidjson"
334 "external/unbound"))
335 #t))
336 (sha256
337 (base32
338 "083w40a553c0r3i18020jcrv5s0b64vx3d8xrn9nwkb2237ighlk"))))
339 (build-system cmake-build-system)
340 (native-inputs
341 `(("doxygen" ,doxygen)
342 ("googletest" ,googletest)
343 ("graphviz" ,graphviz)
344 ("pkg-config" ,pkg-config)))
345 (inputs
346 `(("bind" ,isc-bind)
347 ("boost" ,boost)
348 ("expat" ,expat)
349 ("libunwind" ,libunwind)
350 ("lmdb" ,lmdb)
351 ("miniupnpc" ,miniupnpc)
352 ("openssl" ,openssl)
353 ("rapidjson" ,rapidjson)
354 ("unbound" ,unbound)))
355 (arguments
356 `(#:out-of-source? #t
357 #:configure-flags '("-DBUILD_TESTS=ON"
358 ,@(if (string=? "aarch64-linux" (%current-system))
359 '("-DARCH=armv8-a")
360 '())
361 "-DBUILD_GUI_DEPS=ON")
362 #:phases
363 (modify-phases %standard-phases
364 ;; tests/core_tests need a valid HOME
365 (add-before 'configure 'set-home
366 (lambda _
367 (setenv "HOME" (getcwd))
368 #t))
369 (add-after 'set-home 'fix-wallet-path-for-unit-tests
370 (lambda _
371 (substitute* "tests/unit_tests/serialization.cpp"
372 (("\\.\\./\\.\\./\\.\\./\\.\\./") "../../"))
373 #t))
374 (add-after 'fix-wallet-path-for-unit-tests 'change-log-path
375 (lambda _
376 (substitute* "contrib/epee/src/mlog.cpp"
377 (("epee::string_tools::get_current_module_folder\\(\\)")
378 "\".bitmonero\""))
379 (substitute* "contrib/epee/src/mlog.cpp"
380 (("return \\(") "return ((std::string(getenv(\"HOME\"))) / "))
381 #t))
382 (replace 'check
383 (lambda _
384 (zero?
385 (system* "make" "ARGS=-E 'unit_tests|libwallet_api_tests'"
386 "test"))))
387 ;; The excluded unit tests need network access
388 (add-after 'check 'unit-tests
389 (lambda _
390 (let ((excluded-unit-tests
391 (string-join
392 '("AddressFromURL.Success"
393 "AddressFromURL.Failure"
394 "DNSResolver.IPv4Success"
395 "DNSResolver.DNSSECSuccess"
396 "DNSResolver.DNSSECFailure"
397 "DNSResolver.GetTXTRecord")
398 ":")))
399 (zero?
400 (system* "tests/unit_tests/unit_tests"
401 (string-append "--gtest_filter=-"
402 excluded-unit-tests))))))
403 (add-after 'install 'install-blockchain-import-export
404 (lambda* (#:key outputs #:allow-other-keys)
405 (let* ((out (assoc-ref outputs "out"))
406 (bin (string-append out "/bin")))
407 (install-file "bin/monero-blockchain-import" bin)
408 (install-file "bin/monero-blockchain-export" bin)))))))
409 (home-page "https://getmonero.org/")
410 (synopsis "Command-line interface to the Monero currency")
411 (description
412 "Monero is a secure, private, untraceable currency. This package provides the
413 Monero command line client and daemon.")
414 (license license:bsd-3)))
415
416 (define-public monero-core
417 (package
418 (name "monero-core")
419 (version "0.11.0.0")
420 (source
421 (origin
422 (method url-fetch)
423 (uri (string-append "https://github.com/monero-project/monero-core/archive/v"
424 version ".tar.gz"))
425 (file-name (string-append name "-" version ".tar.gz"))
426 (sha256
427 (base32
428 "0hnrkgwb1sva67pcjym2gvb4zifp2s849dfbnjzbxk3yczpcyqzg"))))
429 (build-system gnu-build-system)
430 (native-inputs
431 `(("doxygen" ,doxygen)
432 ("graphviz" ,graphviz)
433 ("pkg-config" ,pkg-config)))
434 (inputs
435 `(("boost" ,boost)
436 ("libunwind" ,libunwind)
437 ("openssl" ,openssl)
438 ("qt" ,qt)
439 ("unbound" ,unbound)))
440 (propagated-inputs
441 `(("monero" ,monero)))
442 (arguments
443 `(#:phases
444 (modify-phases %standard-phases
445 (delete 'configure)
446 (delete 'check)
447 (add-before 'build 'fix-makefile-vars
448 (lambda _
449 (substitute* "src/zxcvbn-c/makefile"
450 (("\\?=") "="))
451 #t))
452 (add-after 'fix-makefile-vars 'fix-library-paths
453 (lambda* (#:key inputs #:allow-other-keys)
454 (substitute* "monero-wallet-gui.pro"
455 (("-L/usr/local/lib") "")
456 (("-L/usr/local/opt/openssl/lib")
457 (string-append "-L"
458 (assoc-ref inputs "openssl")
459 "/lib"))
460 (("-L/usr/local/opt/boost/lib")
461 (string-append "-L"
462 (assoc-ref inputs "boost")
463 "/lib")))
464 #t))
465 (add-after 'fix-library-paths 'fix-monerod-path
466 (lambda* (#:key inputs #:allow-other-keys)
467 (substitute* "src/daemon/DaemonManager.cpp"
468 (("QApplication::applicationDirPath\\(\\) \\+ \"/monerod")
469 (string-append "\""(assoc-ref inputs "monero")
470 "/bin/monerod")))
471 #t))
472 (replace 'build
473 (lambda _
474 (zero? (system* "./build.sh"))))
475 (add-after 'build 'fix-install-path
476 (lambda* (#:key outputs #:allow-other-keys)
477 (substitute* "build/Makefile"
478 (("/opt/monero-wallet-gui")
479 (assoc-ref outputs "out")))
480 #t))
481 (add-before 'install 'change-dir
482 (lambda _
483 (chdir "build"))))))
484 (home-page "https://getmonero.org/")
485 (synopsis "Graphical user interface for the Monero currency")
486 (description
487 "Monero is a secure, private, untraceable currency. This package provides the
488 Monero GUI client.")
489 (license license:bsd-3)))