guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#51885] [PATCH v2 3/4] gnu: Add json.


From: Raghav Gururajan
Subject: [bug#51885] [PATCH v2 3/4] gnu: Add json.
Date: Thu, 9 Dec 2021 05:52:11 -0500

* gnu/packages/cpp.scm (json): New variable.

Co-authored-by: jgart <jgart@dismail.de>
---
 gnu/packages/cpp.scm | 63 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index a579c47ad9..28705d5bb6 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -77,6 +77,69 @@ (define-module (gnu packages cpp)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml))
 
+(define-public json
+  (package
+    (name "json")
+    (version "3.10.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/nlohmann/json";)
+         (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "17kxwxl6515s8nb5x7zy69c8qy4gswac66fp15261x1g6sa2jnkx"))
+       (modules '((guix build utils)
+                  (ice-9 ftw)
+                  (srfi srfi-1)))
+       (snippet
+        `(begin
+           (delete-file-recursively "third_party")
+           (let ((keep
+                  ;; Custom forks which are incompatible with the ones in Guix.
+                  '("doctest" "fifo_map")))
+             (with-directory-excursion "test/thirdparty"
+               (for-each delete-file-recursively
+                         (lset-difference string=?
+                                          (scandir ".")
+                                          (cons* "." ".." keep)))))
+             #t))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list
+        (string-append "-DJSON_TestDataDirectory="
+                       (assoc-ref %build-inputs "json_test_data")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-failing-tests
+           (lambda _
+             (substitute* "test/CMakeLists.txt"
+               ;; Requires network connection.
+               (("add_subdirectory\\(cmake_fetch_content\\)") "")))))))
+    (native-inputs
+     `(("json_test_data"
+        ,(origin
+           (method git-fetch)
+           (uri
+            (git-reference
+             (url "https://github.com/nlohmann/json_test_data";)
+             (commit "v3.0.0")))
+           (file-name
+            (git-file-name "json_test_data" "3.0.0"))
+           (sha256
+            (base32 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv"))))
+       ("python" ,python-wrapper)))
+    (home-page "https://json.nlohmann.me/";)
+    (synopsis "JSON for C++")
+    (description "@code{json} is a C++ json library for converting to and from
+C++ data structures.  It's design goals emphasize intuitive syntax, trivial
+integration via a single header file, and serious test coverage involving all 
of
+the codebase.")
+    (license license:expat)))
+
 (define-public argagg
   (let ((commit "79e4adfa2c6e2bfbe63da05cc668eb9ad5596748")
         (revision "0"))
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]