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