;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2014 Taylan Ulrich Bayirli/Kammer ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Mark H Weaver ;;; Copyright © 2014, 2015, 2016, 2017 Alex Kost ;;; Copyright © 2016, 2018 Arun Isaac ;;; Copyright © 2016 Federico Beffa ;;; Copyright © 2016 David Thompson ;;; Copyright © 2016 Nikita ;;; Copyright © 2017 Marius Bakke ;;; Copyright © 2017, 2019, 2020 Maxim Cournoyer ;;; Copyright © 2017 Alex Vong ;;; Copyright © 2017, 2018 Ricardo Wurmus ;;; Copyright © 2017 Jan Nieuwenhuizen ;;; Copyright © 2018 Efraim Flashner ;;; Copyright © 2018 Mathieu Othacehe ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2019 Jesse John Gildersleve ;;; Copyright © 2019 Valentin Ignatev ;;; Copyright © 2019 Leo Prikler ;;; Copyright © 2019 Amin Bandali ;;; Copyright © 2020 Jack Hill ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. S
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages hyperledger)
  #:use-module (ice-9 match)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system go)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix licenses)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages check)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages docker)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages logging)
  #:use-module (gnu packages machine-learning)
  #:use-module (gnu packages popt)
  #:use-module (gnu packages pretty-print)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages rpc)
  #:use-module (gnu packages tbb)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages web))

(define-public hyperledger-fabric
  (package
    (name "hyperledger-fabric")
    (version "1.4.0")
    ;; While the GitHub repository is supposed to be "just a mirror," the Go
    ;; imports refer to it explicitly.
    (home-page "https://github.com/hyperledger/fabric")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    ;; ‘release-…’ are branches, and move. ‘v…’ are the tags.
                    (commit (string-append "v" version))))
              (sha256
               (base32
                "0nmg24ishwddxm1i2vh5ah5ylmmcg0apnjbgv1hljvhl48k4pzxq"))
              (file-name (git-file-name name version))))
    (build-system go-build-system)
    (native-inputs
     (list which docker-cli git curl))
    (arguments
     `(#:import-path "github.com/hyperledger/fabric"
       #:unpack-path "github.com/hyperledger/fabric"
       ;; We don't need to install the source code for end-user applications.
       #:install-source? #f
       ;; TODO: Tests require a running Docker daemon.
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'build
           (lambda _
             ;; Only linux-amd64 and linux-ppc64le seem to be supported at the moment.
             (invoke "make"
                     "-j" (number->string (parallel-job-count))
                     "-C" "src/github.com/hyperledger/fabric"
                     "release/linux-amd64")))
         (add-after 'install 'install-commands
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (src "src/github.com/hyperledger/fabric/"))
               (with-directory-excursion src
                 (copy-recursively
                  "release/linux-amd64/bin"
                  (string-append out "/bin"))
                 (install-file "LICENSE"
                               (string-append out "/share/licenses"))
                 (install-file "README.md"
                               (string-append out "/share/doc"))
                 (copy-recursively "sampleconfig"
                                   (string-append out "/etc/hyperledger/fabric"))))
             #t)))))
    (supported-systems '("x86_64-linux"))
    (synopsis "Platform for distributed ledger solutions")
    (description "Hyperledger Fabric is a platform for distributed ledger
solutions, underpinned by a modular architecture focusing on confidentiality
and resiliency.  It is designed to support pluggable implementations of
different components.")
    (license asl2.0)))

(define-public hyperledger-iroha-ed25519
  (package
    (name "hyperledger-iroha-ed25519")
    (version "2.0.2")
    (home-page "https://github.com/hyperledger/iroha-ed25519")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0kr1zwah8mhnpfrpk3h6hdafyqdl3ixhs7czdfscqv6vxqfiabc4"))))
    (build-system cmake-build-system)
    (native-inputs
     (list googletest))
    (arguments
     `(#:tests? #f      ; Tests don't build because CMake cannot find GTest main.
       #:configure-flags '("-DHUNTER_ENABLED=OFF"
                           "-DBUILD=SHARED"
                           ;; TODO: x86_64 should use amd64-64-24k-pic but it
                           ;; fails to link when built as a shared library.
                           "-DEDIMPL=ref10"
                           "-DHASH=sha3_brainhub")))
    (synopsis "Ed25519 digital signature algorithm")
    (description "This repository aims to provide modularized implementation
of the Ed25519 digital signature algorithm which is is described in
RFC8032 (@url{https://tools.ietf.org/html/rfc8032}).

Originally Ed25519 consists of three modules:

@itemize
@item digital signature algorithm itself
@item SHA512 hash function
@item random number generator, to generate key pairs
@end itemize

This project offers at least two different C implementations for every
module.  Every implementation can be replaced with another one at
link-time.  New implementations can be added as well.")
    (license asl2.0)))

(define-public hyperledger-iroha
  (package
    (name "hyperledger-iroha")
    (version "1.1.1")
    (home-page "https://github.com/hyperledger/iroha")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                     (url home-page)
                     (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "014mbwq059yxwihw0mq8zgns53fsw8ckczi1lw8q9pz3pk86pa9b"))
              (modules '((guix build utils)))
              (snippet
               '(begin
                  ;; https://github.com/hyperledger/iroha/commit/4dc710d2e9a067af866771318f673c7392797e48
                  ;; Backport unversioned fmt dependency, remove next update:
                  (substitute* "libs/logger/logger.hpp"
                    (("fmt::v5") "fmt"))))))
    (build-system cmake-build-system)
    (arguments
     `(#:configure-flags
       '("-DTESTING=OFF"    ; The tests fail to link correctly to googletest.
         ;; Don't install the shared libraries of the dependencies:
         "-DENABLE_LIBS_PACKAGING=OFF")
       #:tests? #f
       ;; https://iroha.readthedocs.io/en/latest/build/index.html#running-tests-optional
       #:test-target "."))
    ;; https://github.com/hyperledger/iroha/blob/master/vcpkg/VCPKG_DEPS_LIST
    (native-inputs
     (list fmt-8
           googletest
           rapidjson
           rxcpp
           spdlog))
    (inputs
     (list boost
           gflags
           grpc-1.16.1
           hyperledger-iroha-ed25519
           postgresql
           protobuf
           soci
           tbb))
    (synopsis "Simple, decentralized ledger")
    (description "Iroha is a distributed ledger technology (DLT).  Iroha has
essential functionality for your asset, information and identity management
needs, at the same time being a crash fault-tolerant tool.

Iroha has the following features:

@itemize
@item Creation and management of custom fungible assets, such as currencies,
kilos of gold, etc.
@item Management of user accounts
@item Taxonomy of accounts based on domains in the system
@item The system of rights and verification of user permissions for the
execution of transactions and queries in the system
@item Validation of business rules for transactions and queries in the system
@item Multisignature transactions
@end itemize\n")
    (license asl2.0)))
ersion revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://git.savannah.gnu.org/git/emacs.git") (commit commit))) (sha256 (base32 "0mlrg2npy1r79laahkgzhxd1qassfcdz8qk1cpw7mqgf6y5x505h")) (file-name (git-file-name name version)) (patches (search-patches "emacs27-exec-path.patch" "emacs-fix-scheme-indent-function.patch" "emacs-source-date-epoch.patch")) (modules (origin-modules (package-source emacs))) ;; TODO: once the snippet for `emacs' is changed to not fail when ;; eshell/esh-groups.el does not exist, replace this snippet with ;; (snippet (origin-snippet (package-source emacs))))). (snippet '(with-directory-excursion "lisp" ;; Make sure Tramp looks for binaries in the right places on ;; remote Guix System machines, where 'getconf PATH' returns ;; something bogus. (substitute* "net/tramp-sh.el" ;; Patch the line after "(defcustom tramp-remote-path". (("\\(tramp-default-remote-path") (format #f "(tramp-default-remote-path ~s ~s ~s ~s " "~/.guix-profile/bin" "~/.guix-profile/sbin" "/run/current-system/profile/bin" "/run/current-system/profile/sbin"))) ;; Make sure Man looks for C header files in the right ;; places. (substitute* "man.el" (("\"/usr/local/include\"" line) (string-join (list line "\"~/.guix-profile/include\"" "\"/var/guix/profiles/system/profile/include\"") " "))) #t)))) (arguments (substitute-keyword-arguments (package-arguments emacs) ((#:configure-flags flags) `(cons* "--with-harfbuzz" ,flags)) ((#:phases phases) `(modify-phases ,phases ;; The 'reset-gzip-timestamps phase will throw a ;; permission error if gzip files aren't writable then (add-before 'reset-gzip-timestamps 'make-compressed-files-writable (lambda _ (for-each make-file-writable (find-files %output ".*\\.t?gz$")) #t)) ;; restore the dump file that Emacs installs somewhere in ;; libexec/ to its original state (add-after 'glib-or-gtk-wrap 'restore-emacs-pdmp (lambda* (#:key outputs target #:allow-other-keys) (let* ((libexec (string-append (assoc-ref outputs "out") "/libexec")) ;; each of these find-files should return one file (pdmp (find-files libexec "^emacs\\.pdmp$")) (pdmp-real (find-files libexec "^\\.emacs\\.pdmp-real$"))) (for-each (lambda (wrapper real) (delete-file wrapper) (rename-file real wrapper)) pdmp pdmp-real) #t))))))) (inputs `(("jansson" ,jansson) ("harfbuzz" ,harfbuzz) ;; Emacs no longer uses ImageMagick by default ;; https://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-27.0.91&id=c36c5a3dedbb2e0349be1b6c3b7567ea7b594f1c#n102 ,@(alist-delete "imagemagick" (package-inputs emacs)))) (native-inputs `(("autoconf" ,autoconf) ; needed when building from trunk ,@(package-native-inputs emacs))) ;; TODO: consider changing `emacs' to use a more robust way of ;; specifying version for "EMACSLOADPATH", so as to avoid having to ;; duplicate native-search-paths here. (native-search-paths (list (search-path-specification (variable "EMACSLOADPATH") ;; The versioned entry is for the Emacs' builtin libraries. (files (list "share/emacs/site-lisp" (string-append "share/emacs/" emacs-version "/lisp")))) (search-path-specification (variable "INFOPATH") (files '("share/info")))))))) (define-public emacs-minimal ;; This is the version that you should use as an input to packages that just ;; need to byte-compile .el files. (package (inherit emacs) (name "emacs-minimal") (synopsis "The extensible text editor (used only for byte-compilation)") (build-system gnu-build-system) (arguments (substitute-keyword-arguments (package-arguments emacs) ((#:configure-flags flags ''()) `(list "--with-gnutls=no" "--disable-build-details")))) (inputs `(("guix-emacs.el" ,(search-auxiliary-file "emacs/guix-emacs.el")) ("ncurses" ,ncurses))) (native-inputs `(("pkg-config" ,pkg-config))))) (define-public emacs-xwidgets (package (inherit emacs) (name "emacs-xwidgets") (synopsis "The extensible, customizable, self-documenting text editor (with xwidgets support)") (build-system gnu-build-system) (arguments (substitute-keyword-arguments (package-arguments emacs) ((#:configure-flags flags ''()) `(cons "--with-xwidgets" ,flags)))) (inputs `(("webkitgtk" ,webkitgtk) ("libxcomposite" ,libxcomposite) ,@(package-inputs emacs))))) (define-public emacs-no-x (package (inherit emacs) (name "emacs-no-x") (synopsis "The extensible, customizable, self-documenting text editor (console only)") (build-system gnu-build-system) (inputs (fold alist-delete (package-inputs emacs) '("libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg" "imagemagick" "libpng" "librsvg" "libxpm" "libice" "libsm" ;; These depend on libx11, so remove them as well. "libotf" "m17n-lib" "dbus"))))) (define-public emacs-no-x-toolkit (package (inherit emacs) (name "emacs-no-x-toolkit") (synopsis "The extensible, customizable, self-documenting text editor (without an X toolkit)" ) (build-system gnu-build-system) (inputs (append `(("inotify-tools" ,inotify-tools)) (alist-delete "gtk+" (package-inputs emacs)))) (arguments `(,@(substitute-keyword-arguments (package-arguments emacs) ((#:configure-flags cf) `(cons "--with-x-toolkit=no" ,cf))))))) (define-public emacs-wide-int (package (inherit emacs) (name "emacs-wide-int") (synopsis "The extensible, customizable, self-documenting text editor (with wide ints)" ) (arguments (substitute-keyword-arguments (package-arguments emacs) ((#:configure-flags flags) `(cons "--with-wide-int" ,flags)))))) (define-public guile-emacs (let ((commit "41120e0f595b16387eebfbf731fff70481de1b4b") (revision "0")) (package (inherit emacs) (name "guile-emacs") (version (git-version "0.0.0" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://git.hcoop.net/git/bpt/emacs.git") (commit commit))) (file-name (git-file-name name version)) (patches (search-patches "guile-emacs-fix-configure.patch")) (sha256 (base32 "0lvcvsz0f4mawj04db35p1dvkffdqkz8pkhc0jzh9j9x2i63kcz6")))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) ("guile" ,guile-for-guile-emacs) ,@(package-native-inputs emacs))) (arguments (substitute-keyword-arguments `(;; Build fails if we allow parallel build. #:parallel-build? #f ;; Tests aren't passing for now. #:tests? #f ,@(package-arguments emacs)) ((#:phases phases) `(modify-phases ,phases (add-after 'unpack 'autogen (lambda _ (invoke "sh" "autogen.sh"))) ;; Build sometimes fails: deps/dispnew.d: No such file or directory (add-before 'build 'make-deps-dir (lambda _ (invoke "mkdir" "-p" "src/deps")))))))))) (define-public m17n-db (package (name "m17n-db") (version "1.8.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/m17n/m17n-db-" version ".tar.gz")) (sha256 (base32 "0vfw7z9i2s9np6nmx1d4dlsywm044rkaqarn7akffmb6bf1j6zv5")))) (build-system gnu-build-system) (inputs `(("gettext" ,gettext-minimal))) (arguments `(#:configure-flags (list (string-append "--with-charmaps=" (assoc-ref %build-inputs "libc") "/share/i18n/charmaps")))) ;; With `guix lint' the home-page URI returns a small page saying ;; that your browser does not handle frames. This triggers the "URI ;; returns suspiciously small file" warning. (home-page "https://www.nongnu.org/m17n/") (synopsis "Multilingual text processing library (database)") (description "The m17n library realizes multilingualization of many aspects of applications. The m17n library represents multilingual text as an object named M-text. M-text is a string with attributes called text properties, and designed to substitute for string in C. Text properties carry any information required to input, display and edit the text. This package contains the library database.") (license license:lgpl2.1+))) (define-public m17n-lib (package (name "m17n-lib") (version "1.8.0") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/m17n/m17n-lib-" version ".tar.gz")) (sha256 (base32 "0jp61y09xqj10mclpip48qlfhniw8gwy8b28cbzxy8hq8pkwmfkq")))) (build-system gnu-build-system) (inputs `(("fribidi" ,fribidi) ("gd" ,gd) ("libotf" ,libotf) ("libxft" ,libxft) ("libxml2" ,libxml2) ("m17n-db" ,m17n-db))) (arguments `(#:parallel-build? #f)) ;; With `guix lint' the home-page URI returns a small page saying ;; that your browser does not handle frames. This triggers the "URI ;; returns suspiciously small file" warning. (home-page "https://www.nongnu.org/m17n/") (synopsis "Multilingual text processing library (runtime)") (description "The m17n library realizes multilingualization of many aspects of applications. The m17n library represents multilingual text as an object named M-text. M-text is a string with attributes called text properties, and designed to substitute for string in C. Text properties carry any information required to input, display and edit the text. This package contains the library runtime.") (license license:lgpl2.1+)))