diff mbox series

[bug#61724,v2,1/2] gnu: Add nlohmann-json.

Message ID 20230223201724.28695-1-jgart@dismail.de
State New
Headers show
Series [bug#61724,v2,1/2] gnu: Add nlohmann-json. | expand

Commit Message

jgart Feb. 23, 2023, 8:17 p.m. UTC
* gnu/packages/cpp.scm (nlohmann-json): New variable.
---

hi lilyp,

thanks for the review and tips!

wdyt of v2

all best,

jgart

 gnu/packages/cpp.scm | 98 +++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 61 deletions(-)

Comments

Liliana Marie Prikler Feb. 23, 2023, 8:59 p.m. UTC | #1
Am Donnerstag, dem 23.02.2023 um 21:17 +0100 schrieb jgart:
> wdyt of v2

Am Donnerstag, dem 23.02.2023 um 18:57 +0100 schrieb Liliana Marie
Prikler:
> Perform one logical change at a time:
> 1. Updating is a logical change.
> 2. Renaming and adjusting dependant packages is a logical change.
> When adding a deprecated alias, it should be done in the same commit
> as the rename (2).

Cheers
jgart March 10, 2023, 1:58 a.m. UTC | #2
Hi lilyp,

Is there anything else I need to do on my end for this patch before it gets pushed?

Any need for revision or ready?

all the best,

jgart
Liliana Marie Prikler March 10, 2023, 5:18 a.m. UTC | #3
Am Freitag, dem 10.03.2023 um 01:58 +0000 schrieb jgart:
> Hi lilyp,
> 
> Is there anything else I need to do on my end for this patch before
> it gets pushed?
> 
> Any need for revision or ready?
v2 1/2 mixes functional and stylistic changes in a rather
unconventional manner (reverting to old-style inputs).  Is there
nothing you can do about this to make the patch look nicer?

Cheers
diff mbox series

Patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index ed6ae69198..7091459d97 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -22,7 +22,7 @@ 
 ;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Nikolay Korotkiy <sikmir@disroot.org>
-;;; Copyright © 2021 jgart <jgart@dismail.de>
+;;; Copyright © 2021, 2023 jgart <jgart@dismail.de>
 ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2021 Disseminate Dissent <disseminatedissent@protonmail.com>
 ;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il>
@@ -595,74 +595,50 @@  (define-public json-dto
 data transfer object.")
     (license license:bsd-3)))
 
-(define-public json-modern-cxx
+(define-public nlohmann-json
   (package
-    (name "json-modern-cxx")
-    (version "3.10.5")
-    (home-page "https://github.com/nlohmann/json")
+    (name "nlohmann-json")
+    (version "3.11.2")
     (source
      (origin
        (method git-fetch)
-       (uri (git-reference (url home-page)
-                           (commit (string-append "v" version))))
-       (sha256
-        (base32 "1f9mi45ilwjc2w92grjc53sw038840bjpn8yjf6wc6bxs2nijfqd"))
+       (uri (git-reference
+             (url "https://github.com/nlohmann/json")
+             (commit (string-append "v" version))))
        (file-name (git-file-name name version))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Delete bundled software.  Preserve doctest_compatibility.h, which
-           ;; is a wrapper library added by this package.
-           (install-file "./test/thirdparty/doctest/doctest_compatibility.h" "/tmp")
-           (for-each delete-file-recursively
-                     '("./third_party" "./test/thirdparty"))
-           (install-file "/tmp/doctest_compatibility.h" "./test/thirdparty/doctest")
-
-           ;; Adjust for the unbundled fifo_map and doctest.
-           (substitute* "./test/thirdparty/doctest/doctest_compatibility.h"
-             (("#include \"doctest\\.h\"")
-              "#include <doctest/doctest.h>"))
-           (with-directory-excursion "test/src"
-             (let ((files (find-files "." "\\.cpp$")))
-               (substitute* files
-                 (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp)
-                  (string-append
-                   "#include <fifo_map/" fifo-map-hpp ">")))))))))
+       (sha256
+        (base32 "0g6rfsbkvrxmacchz4kbr741yybj7mls3r4hgyfdd3pdbqhn2is9"))))
     (build-system cmake-build-system)
     (arguments
-     '(#:configure-flags
-       (list "-DJSON_MultipleHeaders=ON" ; For json_fwd.hpp.
-             (string-append "-DJSON_TestDataDirectory="
-                            (dirname
-                             (search-input-directory %build-inputs
-                                                     "json_nlohmann_tests"))))
-       #:phases (modify-phases %standard-phases
-                  (replace 'check
-                    (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
-                      (if tests?
-                          ;; Some tests need git and a full checkout, skip those.
-                          (invoke "ctest" "-LE" "git_required"
-                                  "-j" (if parallel-tests?
-                                           (number->string (parallel-job-count))
-                                           "1"))
-                          (format #t "test suite not run~%")))))))
+      (list #:out-of-source? #t
+            #:configure-flags
+            #~(list "-DJSON_FastTests=ON"
+                    "-DJSON_MultipleHeaders=ON"
+                    "-DJSON_BuildTests=ON"
+                    (string-append "-DJSON_TestDataDirectory="
+                                   #$(this-package-native-input "json-test-data")))
+            #:phases
+            #~(modify-phases %standard-phases
+                (replace 'check
+                  (lambda* (#:key tests? #:allow-other-keys)
+                    ;; Skip tests that require git or modify “installed files”.
+                    (when tests?
+                      (invoke "make" "ARGS=-LE 'not_reproducible|git_required' --verbose")))))))
     (native-inputs
-     (list amalgamate
-           (let ((version "3.0.0"))
-             (origin
-               (method git-fetch)
-               (uri (git-reference
-                     (url "https://github.com/nlohmann/json_test_data")
-                     (commit (string-append "v" version))))
-               (file-name (git-file-name "json_test_data" version))
-               (sha256
-                (base32
-                 "0nzsjzlvk14dazwh7k2jb1dinb0pv9jbx5jsyn264wvva0y7daiv"))))))
-    (inputs
-     (list doctest fifo-map))
-    (synopsis "JSON parser and printer library for C++")
-    (description "JSON for Modern C++ is a C++ JSON library that provides
-intuitive syntax and trivial integration.")
+      `(("json-test-data"
+         ,(origin
+            (method git-fetch)
+            (uri (git-reference
+                  (url "https://github.com/nlohmann/json_test_data")
+                  (commit "v3.1.0")))
+            (sha256
+             (base32 "0nbirc428qx0lpi940p7y24fzdjbwl6xig3h5rdbihyymmdzhvbc"))
+            (file-name (git-file-name "vis-test" version))))))
+    (home-page "https://json.nlohmann.me/")
+    (synopsis "JSON for Modern C++")
+    (description "This package provides a JSON implementation with an
+intuitive syntax for C++, a single include header file, and with a
+codebase that has 100% code coverage.")
     (license license:expat)))
 
 (define-public xtl