unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: jgart via Guix-patches via <guix-patches@gnu.org>
To: 61724@debbugs.gnu.org.
Cc: jgart <jgart@dismail.de>,
	Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: [bug#61724] [PATCH v2 1/2] gnu: Add nlohmann-json.
Date: Thu, 23 Feb 2023 21:17:24 +0100	[thread overview]
Message-ID: <20230223201724.28695-1-jgart@dismail.de> (raw)
In-Reply-To: <e2966b2334223744777f0fd2636442ec@dismail.de>

* 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(-)

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
-- 
2.39.1





  parent reply	other threads:[~2023-02-23 20:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23  5:06 [bug#61724] [PATCH 1/3] gnu: Add nlohmann-json jgart via Guix-patches via
2023-02-23  5:11 ` jgart via Guix-patches via
2023-02-23  5:12   ` [bug#61724] [PATCH 2/3] gnu: json-modern-cxx: Remove deprecated package jgart via Guix-patches via
2023-02-23  5:12   ` [bug#61724] [PATCH 3/3] gnu: Refactor packages to use new nlohmann-json variable jgart via Guix-patches via
2023-02-23 17:57   ` [bug#61724] [PATCH 1/3] gnu: Add nlohmann-json Liliana Marie Prikler
2023-02-23 20:17 ` jgart via Guix-patches via [this message]
2023-02-23 20:17   ` [bug#61724] [PATCH v2 2/2] gnu: Refactor packages to use new nlohmann-json variable jgart via Guix-patches via
2023-02-23 20:59   ` [bug#61724] [PATCH v2 1/2] gnu: Add nlohmann-json Liliana Marie Prikler
2023-03-10  1:58   ` jgart via Guix-patches via
2023-03-10  5:18     ` Liliana Marie Prikler
2023-04-27 18:57 ` [bug#61724] [PATCH v3 1/3] gnu: Rename json-modern-cxx to nlohmann-json Liliana Marie Prikler
2023-04-27 18:57 ` [bug#61724] [PATCH v4 1/7] " Liliana Marie Prikler
2023-04-28 19:50   ` [bug#61724] [PATCH v4 2/7] gnu: nlohmann-json: Update to 3.11.2 Liliana Marie Prikler
2023-04-28 19:55   ` [bug#61724] [PATCH v4 3/7] gnu: nlohmann-json: Improve package style Liliana Marie Prikler
2023-05-07 16:50     ` [bug#61724] [PATCH v4 3/3] gnu: nlohmann-json: Improve package style. (was [PATCH v4 3/7] gnu: nlohmann-json: Improve package style.) Liliana Marie Prikler
2023-05-11 12:53   ` [bug#61724] [PATCH v4 1/7] gnu: Rename json-modern-cxx to nlohmann-json Simon Tournier
2023-05-11 18:48     ` Liliana Marie Prikler
2023-05-14 10:24       ` bug#61724: " Liliana Marie Prikler
2023-04-28 19:50 ` [bug#61724] [PATCH v3 2/3] gnu: nlohmann-json: Update to 3.11.2 Liliana Marie Prikler
2023-04-29  0:15   ` jgart via Guix-patches via
2023-04-28 19:55 ` [bug#61724] [PATCH v3 3/3] gnu: nlohmann-json: Improve package style Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230223201724.28695-1-jgart@dismail.de \
    --to=guix-patches@gnu.org \
    --cc=61724@debbugs.gnu.org. \
    --cc=jgart@dismail.de \
    --cc=liliana.prikler@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).