gnu: python-deepmerge: Use pyproject-build-system.
[jackhill/guix/guix.git] / gnu / packages / serialization.scm
index 4ef74c2..79c55e2 100644 (file)
@@ -1,15 +1,17 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2017, 2019, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox.org>
 ;;; Copyright © 2016 David Craven <david@craven.ch>
-;;; Copyright © 2016, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
-;;; Copyright © 2016, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2019, 2020, 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2016, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Corentin Bocquillon <corentin@nybble.fr>
 ;;; Copyright © 2017 Gregor Giesen <giesen@zaehlwerk.net>
 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
 ;;; Copyright © 2017 Nikita <nikita@n0.is>
-;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017–2019, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
+;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
+;;; Copyright © 2020 Alexandros Theodotou <alex@zrythm.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 (define-module (gnu packages serialization)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
   #:use-module (guix download)
+  #:use-module (guix hg-download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
@@ -45,6 +52,7 @@
   #:use-module (gnu packages databases)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
@@ -70,8 +78,7 @@
          (add-after 'unpack 'chdir
            (lambda _ (chdir "lang/c++"))))))
     (inputs
-     `(("boost" ,boost)
-       ("snappy" ,snappy)))
+     (list boost snappy))
     (home-page "https://avro.apache.org/")
     (synopsis "Data serialization system")
     (description "Apache Avro is a data serialization system.  Avro provides:
@@ -87,10 +94,46 @@ Code generation is not required to read or write data files nor to use or
 implement RPC protocols.")
     (license license:asl2.0)))
 
+(define-public avro-cpp-1.9-for-irods
+  (package
+    (inherit avro-cpp-1.9)
+    (properties `((hidden? . #true)))
+    (arguments
+     `(#:configure-flags
+       '("-DCMAKE_CXX_COMPILER=clang++"
+         "-DCMAKE_CXX_FLAGS=-stdlib=libc++"
+         "-DCMAKE_EXE_LINKER_FLAGS=-lc++abi -lz")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda _ (chdir "lang/c++")))
+         (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((gcc (assoc-ref inputs  "gcc")))
+               (setenv "CPLUS_INCLUDE_PATH"
+                       (string-join
+                        (cons* (search-input-directory inputs "include/c++/v1")
+                               ;; Hide GCC's C++ headers so that they do not interfere with
+                               ;; the Clang headers.
+                               (delete (string-append gcc "/include/c++")
+                                       (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                                     #\:)))
+                        ":"))
+               (format #true
+                       "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
+                       (getenv "CPLUS_INCLUDE_PATH"))))))))
+    (inputs
+     `(("boost" ,boost-for-irods)
+       ("clang" ,clang-toolchain-6)
+       ("libcxx+libcxxabi" ,libcxx+libcxxabi-6)
+       ("libcxxabi" ,libcxxabi-6)
+       ("snappy" ,snappy-with-clang6)
+       ("zlib" ,zlib)))))
+
 (define-public cereal
   (package
     (name "cereal")
-    (version "1.2.1")
+    (version "1.3.2")
     (source
      (origin
        (method git-fetch)
@@ -99,49 +142,74 @@ implement RPC protocols.")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1vxkrsnxkiblzi1z61vfix167c184fy868sgwj2dxxgbgjcq2nrh"))))
+        (base32
+         "02sd90ynya7wg013zwzjr79fsv4bzqgfg9l2mapd4j38rv06gahx"))))
     (build-system cmake-build-system)
     (arguments
-     `(;; The only included tests are portability tests requiring
-       ;; cross-compilation and boost.  Since we are building cereal on more
-       ;; platforms anyway, there is no compelling reason to build the tests.
-       #:tests? #f
-       #:out-of-source? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (replace 'build
-          (lambda _
-            (substitute* "doc/doxygen.in"
-              (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
-            (invoke "doxygen" "doc/doxygen.in")
-            #t))
-         ;; There is no "install" target, so we have to provide our own
-         ;; "install" phase.
-         (replace 'install
-          (lambda* (#:key outputs #:allow-other-keys)
-            (let* ((out     (assoc-ref outputs "out"))
-                   (doc     (string-append out "/share/cereal/docs"))
-                   (include (string-append out "/include/cereal")))
-              (mkdir-p doc)
-              (mkdir-p include)
-              (copy-recursively "include/cereal" include)
-              (copy-recursively "doc/html" doc))
-            #t)))))
+     (list
+      #:configure-flags #~'("-DSKIP_PORTABILITY_TEST=ON"
+                            ;; Don't bother building the sandbox examples.
+                            "-DSKIP_PERFORMANCE_COMPARISON=ON"
+                            "-DBUILD_SANDBOX=OFF")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'install 'install-doc
+            (lambda _
+              (let ((doc (string-append #$output "/share/doc/html")))
+                (invoke "make" "doc")
+                (mkdir-p doc)
+                (copy-recursively "doc/html" doc)))))))
     (native-inputs
-     `(("doxygen" ,doxygen)))
+     (list doxygen))
     (home-page "https://uscilab.github.io/cereal/")
     (synopsis "C++11 library for serialization")
     (description
      "Cereal is a header-only C++11 serialization library.  Cereal takes
 arbitrary data types and reversibly turns them into different representations,
 such as compact binary encodings, XML, or JSON.")
-    (license license:bsd-3)))
+    ;; Note: Cereal bundles forked versions of rapidxml and rapidjson
+    ;; (see include/cereal/external/), so list their licenses too.
+    (license (list license:bsd-3        ;Cereal itself
+                   ;; The bundled RapidXML is dual Boost/Expat (users choice).
+                   ;; RapidJSON is Expat licensed, and further bundles a
+                   ;; stdint.h with BSD-3.
+                   license:boost1.0 license:expat
+                   ;; Finally, include/cereal/external/base64.hpp has a
+                   ;; home-grown BSD-like license.
+                   (license:non-copyleft
+                    "file://include/cereal/external/LICENSE")))))
+
+;; Some packages fail with the latest version.  Remove this variable
+;; when unused.
+(define-public cereal-1.3.0
+  (package
+    (inherit cereal)
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/USCiLab/cereal")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name "cereal" version))
+       (sha256
+        (base32
+         "0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments cereal)
+       ((#:configure-flags flags #~'())
+        #~'("-DSKIP_PORTABILITY_TEST=ON"))
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (add-before 'configure 'skip-sandbox
+              (lambda _
+                (substitute* "CMakeLists.txt"
+                  (("add_subdirectory\\(sandbox\\)") ""))))))))))
 
 (define-public msgpack
   (package
     (name "msgpack")
-    (version "3.2.1")
+    (version "3.3.0")
     (source
      (origin
        (method url-fetch)
@@ -156,13 +224,12 @@ such as compact binary encodings, XML, or JSON.")
            (close-output-port p)
            #t))
        (sha256
-        (base32 "1ljqmgscdb0f8w8kx2lnswnisyxchcmijbjbmswkv0g187bvqg23"))))
+        (base32 "0yzhq50ijvwrfkr97knhvn54lj3f4hr3zy39yq8wpf6xll94s4bf"))))
     (build-system cmake-build-system)
     (native-inputs
-     `(("googletest" ,googletest-1.8)
-       ("pkg-config" ,pkg-config)))
+     (list googletest-1.8 pkg-config))
     (propagated-inputs
-     `(("zlib" ,zlib))) ;; Msgpack installs two headers (zbuffer.h,
+     (list zlib)) ;; Msgpack installs two headers (zbuffer.h,
     ;; zbuffer.hpp) which #include <zlib.h>.  However, 'guix gc --references'
     ;; does not detect a store reference to zlib since these headers are not
     ;; compiled.
@@ -195,7 +262,7 @@ serialization.")
        (modify-phases %standard-phases
          (delete 'configure))))
     (native-inputs
-     `(("libtool" ,libtool)))
+     (list libtool))
     (home-page "https://github.com/tarruda/libmpack")
     (synopsis "Small binary serialization library")
     (description "Libmpack is a small binary serialization and RPC library
@@ -247,7 +314,7 @@ that implements both the msgpack and msgpack-rpc specifications.")
                                "mpack-src")
              #t)))))
     (inputs
-     `(("lua" ,lua)))
+     (list lua))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("libmpack" ,(package-source libmpack))))
@@ -294,6 +361,71 @@ that implements both the msgpack and msgpack-rpc specifications.")
     (inputs
      `(("lua" ,lua-5.2)))))
 
+(define-public libyaml
+  (package
+    (name "libyaml")
+    (version "0.2.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://pyyaml.org/download/libyaml/yaml-"
+                           version ".tar.gz"))
+       (sha256
+        (base32
+         "1x4fcw13r3lqy8ndydr3ili87wicplw2awbcv6r21qgyfndswhn6"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:configure-flags '("--disable-static")))
+    (home-page "https://pyyaml.org/wiki/LibYAML")
+    (synopsis "YAML 1.1 parser and emitter written in C")
+    (description
+     "LibYAML is a YAML 1.1 parser and emitter written in C.")
+    (license license:expat)))
+
+(define-public libyaml+static
+  (package
+    (inherit libyaml)
+    (name "libyaml+static")
+    (arguments
+     '(#:configure-flags '("--enable-static")))))
+
+(define-public libcyaml
+  (package
+    (name "libcyaml")
+    (version "1.3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/tlsa/libcyaml")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (patches (search-patches "libcyaml-libyaml-compat.patch"))
+       (sha256
+        (base32 "0gvf3h8r8300wdwfjgxw3nzlj7w14q63m67p8wdm5fvpha017n4y"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             (string-append "CC=" ,(cc-for-target)))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))))         ; no configure script
+    (inputs
+     (list libyaml))
+    (native-inputs
+     (list pkg-config))
+    (synopsis "C library for reading and writing YAML")
+    (description
+     "LibCYAML is a C library written in ISO C11 for reading and writing
+structured YAML documents.  The fundamental idea behind CYAML is to allow
+applications to construct schemas which describe both the permissible
+structure of the YAML documents to read/write, and the C data structure(s)
+in which the loaded data is arranged in memory.")
+    (home-page "https://github.com/tlsa/libcyaml")
+    (license license:isc)))
+
 (define-public yaml-cpp
   (package
     (name "yaml-cpp")
@@ -311,7 +443,7 @@ that implements both the msgpack and msgpack-rpc specifications.")
     (arguments
      '(#:configure-flags '("-DYAML_BUILD_SHARED_LIBS=ON")))
     (native-inputs
-     `(("python" ,python)))
+     (list python))
     (home-page "https://github.com/jbeder/yaml-cpp")
     (synopsis "YAML parser and emitter in C++")
     (description "YAML parser and emitter in C++ matching the YAML 1.2 spec.")
@@ -320,16 +452,17 @@ that implements both the msgpack and msgpack-rpc specifications.")
 (define-public jsoncpp
   (package
     (name "jsoncpp")
-    (version "1.9.2")
+    (version "1.9.4")
     (home-page "https://github.com/open-source-parsers/jsoncpp")
     (source (origin
               (method git-fetch)
               (uri (git-reference (url home-page) (commit version)))
               (file-name (git-file-name name version))
-              (patches (search-patches "jsoncpp-fix-inverted-case.patch"))
+              (patches
+               (search-patches "jsoncpp-pkg-config-version.patch"))
               (sha256
                (base32
-                "037d1b1qdmn3rksmn1j71j26bv4hkjv7sn7da261k853xb5899sg"))))
+                "0qnx5y6c90fphl9mj9d20j2dfgy6s5yr5l0xnzid0vh71zrp6jwv"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
@@ -363,6 +496,51 @@ it a convenient format to store user input files.")
                (base32
                 "1180ln8blrb0mwzpcf78k49hlki6di65q77rsvglf83kfcyh4d7z"))))))
 
+(define-public json.sh
+  (let ((commit "0d5e5c77365f63809bf6e77ef44a1f34b0e05840") ;no releases
+        (revision "1"))
+    (package
+      (name "json.sh")
+      (version (git-version "0.0.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/dominictarr/JSON.sh")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "14lxvp5xbdk0dcwkjbdp098z1108j8z48zaibndh4i731kkcz43i"))))
+      (build-system copy-build-system)
+      (arguments
+       `(#:install-plan '(("JSON.sh" "bin/"))
+         #:phases
+         (modify-phases %standard-phases
+           (add-before 'install 'check
+             (lambda* (#:key tests? #:allow-other-keys)
+               (when tests? (invoke "./all-tests.sh"))
+               #t))
+           (add-after 'install 'wrap-program
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (wrap-program (string-append (assoc-ref outputs "out") "/bin/JSON.sh")
+                 `("PATH" ":" prefix
+                   (,(string-join
+                     (map (lambda (in) (string-append (assoc-ref inputs in) "/bin"))
+                          '("grep" "sed"))
+                      ":"))))
+                #t)))))
+      (inputs
+       (list bash-minimal grep sed))
+      (synopsis "Pipeable JSON parser written in shell")
+      (description
+        "This package provides a JSON parser written in shell, compatible with
+ash, Bash, Dash and Zsh.  Pipe JSON to it, and it traverses the JSON objects
+and prints out the path to the current object (as a JSON array) and then the
+object, without whitespace.")
+      (home-page "https://github.com/dominictarr/JSON.sh")
+      (license (list license:expat license:asl2.0))))) ;dual-licensed
+
 (define-public capnproto
   (package
     (name "capnproto")
@@ -385,9 +563,9 @@ it a convenient format to store user input files.")
              ;; /etc/services, which is not present in build environment.
              (substitute* "src/kj/async-io-test.c++" ((":http") ":80"))
              #t))
-         (add-before 'check 'use-tmp-for-tempory-files
+         (add-before 'check 'use-tmp-for-temporary-files
            (lambda _
-             ;; Use /tmp for tempory files, as the default /var/tmp directory
+             ;; Use /tmp for temporary files, as the default /var/tmp directory
              ;; doesn't exist.
              (substitute* "src/kj/filesystem-disk-test.c++"
                (("VAR\\_TMP \"/var/tmp\"")
@@ -413,7 +591,7 @@ RPC system.  Think JSON, except binary.  Or think Protocol Buffers, except faste
          (base32
           "1fj4554msq0rrz14snbj908dzqj46gh7jg9w9j0akn2b7q911m5a"))))
     (build-system gnu-build-system)
-    (native-inputs `(("perl" ,perl)))
+    (native-inputs (list perl))
     (home-page "http://mongoc.org/libbson/current/index.html")
     (synopsis "C BSON library")
     (description "Libbson can create and parse BSON documents.  It can also
@@ -424,21 +602,23 @@ it is comparable to protobuf.")
 (define-public python-ruamel.yaml
   (package
     (name "python-ruamel.yaml")
-    (version "0.15.83")
+    (version "0.16.13")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "ruamel.yaml" version))
        (sha256
         (base32
-         "0p4i8ad28cbbbjja8b9274irkhnphhvhap3aym6yb8xfp1d72kpw"))))
+         "0hm9yg785f46bkrgqknd6fdvmkby9dpzjnm0b63qf0i748acaj5v"))))
     (build-system python-build-system)
     (native-inputs
-     `(("python-pytest" ,python-pytest)))
+     (list python-pytest))
+    (propagated-inputs
+     (list python-ruamel.yaml.clib))
     (arguments
      `(;; TODO: Tests require packaging "ruamel.std.pathlib".
        #:tests? #f))
-    (home-page "https://bitbucket.org/ruamel/yaml")
+    (home-page "https://sourceforge.net/projects/ruamel-yaml/")
     (synopsis "YAML 1.2 parser/emitter")
     (description
      "This package provides YAML parser/emitter that supports roundtrip
@@ -448,8 +628,43 @@ and has round-trip loaders and dumpers.  It supports comments.  Block
 style and key ordering are kept, so you can diff the source.")
     (license license:expat)))
 
-(define-public python2-ruamel.yaml
-  (package-with-python2 python-ruamel.yaml))
+(define-public python-ruamel.yaml.clib
+  (package
+    (name "python-ruamel.yaml.clib")
+    (version "0.2.6")
+    (source
+      (origin
+        ;; pypi release code has cythonized code without corresponding source.
+        (method hg-fetch)
+        (uri (hg-reference
+               (url "http://hg.code.sf.net/p/ruamel-yaml-clib/code")
+               (changeset version)))
+        (file-name (string-append name "-" version "-checkout"))
+        (sha256
+         (base32
+          "05m3y7pjfbaarqbbgw1k6gs6cnnmxnwadjipxvw1aaaqk3s236cs"))
+        (modules '((guix build utils)))
+        (snippet
+         '(begin
+            (delete-file "_ruamel_yaml.c")))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f  ; This package is split from python-ruamel.yaml and
+                    ; depends on modules from it for the test suite.
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'sanity-check) ; Depends on python-ruamel.yaml
+         (add-after 'unpack 'cythonize-code
+           (lambda _
+             (invoke "cython" "_ruamel_yaml.pyx"))))))
+    (native-inputs
+     (list python-cython))
+    (home-page "https://sourceforge.net/p/ruamel-yaml-clib/code/ci/default/tree")
+    (synopsis "C version of reader, parser and emitter for ruamel.yaml")
+    (description
+     "This package provides a C version of the reader, parser and emitter for
+@code{ruamel.yaml} derived from libyaml.")
+    (license license:expat)))
 
 (define-public python-cbor
   (package
@@ -476,22 +691,28 @@ to generate and parse.  The two primary functions are @code{cbor.loads} and
 (define-public flatbuffers
   (package
     (name "flatbuffers")
-    (version "1.10.0")
+    (version "2.0.0")
     (source
       (origin
-        (method url-fetch)
-        (uri (string-append "https://github.com/google/flatbuffers/archive/v"
-                            version ".tar.gz"))
-        (file-name (string-append name "-" version ".tar.gz"))
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/google/flatbuffers")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
         (sha256
          (base32
-          "0z4swldxs0s31hnkqdhsbfmc8vx3p7zsvmqaw4l31r2iikdy651p"))))
+          "1zbf6bdpps8369r1ql00irxrp58jnalycc8jcapb8iqg654vlfz8"))))
     (build-system cmake-build-system)
     (arguments
      '(#:build-type "Release"
        #:configure-flags
-       (list (string-append "-DCMAKE_INSTALL_LIBDIR="
-                            (assoc-ref %outputs "out") "/lib"))))
+       (list "-DFLATBUFFERS_BUILD_SHAREDLIB=ON"
+             (string-append "-DCMAKE_INSTALL_LIBDIR="
+                            (assoc-ref %outputs "out") "/lib"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'make-writable
+           (lambda _ (for-each make-file-writable (find-files ".")))))))
     (home-page "https://google.github.io/flatbuffers/")
     (synopsis "Memory-efficient serialization library")
     (description "FlatBuffers is a cross-platform serialization library for C++,
@@ -512,8 +733,7 @@ game development and other performance-critical applications.")
           "00w9hwz7sj3fkdjc378r066vdy6lpxmn6vfac3qx956k8lvpxxj5"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-pandas" ,python-pandas)
-       ("python-pyarrow" ,python-pyarrow)))
+     (list python-pandas python-pyarrow))
     (home-page "https://github.com/wesm/feather")
     (synopsis "Python wrapper to the Feather file format")
     (description "This package provides a Python wrapper library to the