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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
57 (define-public bitcoin-core
64 (string-append "https://bitcoin.org/bin/bitcoin-core-"
65 version "/bitcoin-" version ".tar.gz"))
68 "16si3skhm6jhw1pkniv2b9y1kkdhjmhj392palphir0qc1srwzmm"))))
69 (build-system gnu-build-system)
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)))
76 `(("bdb" ,bdb-5.3) ; with 6.2.23, there is an error: ambiguous overload
78 ("libevent" ,libevent)
79 ("miniupnpc" ,miniupnpc)
81 ("protobuf" ,protobuf)
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")
97 (string-append "ac_cv_path_LUPDATE="
98 (assoc-ref %build-inputs "qttools")
101 (modify-phases %standard-phases
102 (add-before 'check 'set-home
104 (setenv "HOME" (getenv "TMPDIR"))))))) ; Tests write to $HOME.
105 (home-page "https://bitcoin.org/en/")
106 (synopsis "Bitcoin peer-to-peer client")
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)))
116 (define-public ledger
123 "https://github.com/ledger/ledger/archive/v"
125 (file-name (string-append name "-" version ".tar.gz"))
128 "12jlv3gsjhrja25q9hrwh73cdacd2l3c2yyn8qnijav9mdhnbw4h"))))
129 (build-system cmake-build-system)
131 `(#:modules ((guix build cmake-build-system)
133 (guix build emacs-utils))
134 #:imported-modules (,@%cmake-build-system-modules
135 (guix build emacs-utils))
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")
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))
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)
160 (string-append (assoc-ref inputs "tzdata")
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")))
171 (rename-file orig-dir dest-dir)
172 (emacs-generate-autoloads ,name dest-dir))
183 `(("emacs" ,emacs-minimal)
185 ("texinfo" ,texinfo)))
186 (home-page "http://ledger-cli.org/")
187 (synopsis "Command-line double-entry accounting program")
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.
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/*
213 (define-public geierlein
220 (uri (string-append "https://github.com/stesie/geierlein"
221 "/archive/V" version ".tar.gz"))
222 (file-name (string-append name "-" version ".tar.gz"))
225 "0b11fq8v5w8nxjb20jl4dsfhv76xky6n3sq3k3fbb0m2sq9ikikw"))))
226 (build-system gnu-build-system)
228 `(#:tests? #f ; would require npm, python and a lot more
230 (modify-phases %standard-phases
232 (add-after 'unpack 'override-target-directory-and-tool-paths
233 (lambda* (#:key inputs outputs #:allow-other-keys)
234 (substitute* "Makefile"
236 (string-append "prefix := " (assoc-ref outputs "out") "\n"))
237 ;; Required for tests, unused for now:
239 ;; (string-append (which "python") "\n")))
241 (string-append "INSTALL := " (which "install") "\n")))
242 (substitute* "bin/xgeierlein.in"
243 ;; Use icecat as XULRUNNER
245 (string-append "XULRUNNER=" (which "icecat") "\n"
249 `(("icecat" ,icecat)))
250 (home-page "http://stesie.github.io/geierlein/")
251 (synopsis "Free Elster client, for sending Germany VAT declarations")
253 "Geierlein is a free Elster client, i.e. an application that
254 allows to send VAT declarations to Germany's fiscal authorities.
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
261 (license license:agpl3+)))
263 (define-public electrum
270 (uri (string-append "https://download.electrum.org/"
275 "0d0fzb653g7b8ka3x90nl21md4g3n1fv11czdxpdq3s9yr6js6f2"))
276 (modules '((guix build utils)))
279 ;; Delete the bundled dependencies.
280 (delete-file-recursively "packages")
282 (build-system python-build-system)
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)))
298 (modify-phases %standard-phases
299 (add-before 'build 'patch-home
300 (lambda* (#:key outputs #:allow-other-keys)
301 (substitute* "setup.py"
303 (string-append (assoc-ref outputs "out") "/local/share"))))))))
304 (home-page "https://electrum.org/")
305 (synopsis "Bitcoin wallet")
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)))
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.
324 (uri (string-append "https://github.com/monero-project/monero/archive/v"
326 (file-name (string-append name "-" version ".tar.gz"))
327 (modules '((guix build utils)))
330 ;; Delete bundled dependencies.
332 delete-file-recursively
333 '("external/miniupnpc" "external/rapidjson"
338 "083w40a553c0r3i18020jcrv5s0b64vx3d8xrn9nwkb2237ighlk"))))
339 (build-system cmake-build-system)
341 `(("doxygen" ,doxygen)
342 ("googletest" ,googletest)
343 ("graphviz" ,graphviz)
344 ("pkg-config" ,pkg-config)))
349 ("libunwind" ,libunwind)
351 ("miniupnpc" ,miniupnpc)
353 ("rapidjson" ,rapidjson)
354 ("unbound" ,unbound)))
356 `(#:out-of-source? #t
357 #:configure-flags '("-DBUILD_TESTS=ON"
358 ,@(if (string=? "aarch64-linux" (%current-system))
361 "-DBUILD_GUI_DEPS=ON")
363 (modify-phases %standard-phases
364 ;; tests/core_tests need a valid HOME
365 (add-before 'configure 'set-home
367 (setenv "HOME" (getcwd))
369 (add-after 'set-home 'fix-wallet-path-for-unit-tests
371 (substitute* "tests/unit_tests/serialization.cpp"
372 (("\\.\\./\\.\\./\\.\\./\\.\\./") "../../"))
374 (add-after 'fix-wallet-path-for-unit-tests 'change-log-path
376 (substitute* "contrib/epee/src/mlog.cpp"
377 (("epee::string_tools::get_current_module_folder\\(\\)")
379 (substitute* "contrib/epee/src/mlog.cpp"
380 (("return \\(") "return ((std::string(getenv(\"HOME\"))) / "))
385 (system* "make" "ARGS=-E 'unit_tests|libwallet_api_tests'"
387 ;; The excluded unit tests need network access
388 (add-after 'check 'unit-tests
390 (let ((excluded-unit-tests
392 '("AddressFromURL.Success"
393 "AddressFromURL.Failure"
394 "DNSResolver.IPv4Success"
395 "DNSResolver.DNSSECSuccess"
396 "DNSResolver.DNSSECFailure"
397 "DNSResolver.GetTXTRecord")
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")
412 "Monero is a secure, private, untraceable currency. This package provides the
413 Monero command line client and daemon.")
414 (license license:bsd-3)))
416 (define-public monero-core
423 (uri (string-append "https://github.com/monero-project/monero-core/archive/v"
425 (file-name (string-append name "-" version ".tar.gz"))
428 "0hnrkgwb1sva67pcjym2gvb4zifp2s849dfbnjzbxk3yczpcyqzg"))))
429 (build-system gnu-build-system)
431 `(("doxygen" ,doxygen)
432 ("graphviz" ,graphviz)
433 ("pkg-config" ,pkg-config)))
436 ("libunwind" ,libunwind)
439 ("unbound" ,unbound)))
441 `(("monero" ,monero)))
444 (modify-phases %standard-phases
447 (add-before 'build 'fix-makefile-vars
449 (substitute* "src/zxcvbn-c/makefile"
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")
458 (assoc-ref inputs "openssl")
460 (("-L/usr/local/opt/boost/lib")
462 (assoc-ref inputs "boost")
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")
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")))
481 (add-before 'install 'change-dir
484 (home-page "https://getmonero.org/")
485 (synopsis "Graphical user interface for the Monero currency")
487 "Monero is a secure, private, untraceable currency. This package provides the
489 (license license:bsd-3)))