From patchwork Thu Feb 23 20:17:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: jgart X-Patchwork-Id: 47243 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9008F16BD5; Thu, 23 Feb 2023 20:45:37 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 776E91684B for ; Thu, 23 Feb 2023 20:45:33 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVIRh-0002sa-2B; Thu, 23 Feb 2023 15:44:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVIRe-0002pq-D8 for guix-patches@gnu.org; Thu, 23 Feb 2023 15:44:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVIRe-0007Sr-4J for guix-patches@gnu.org; Thu, 23 Feb 2023 15:44:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVIRd-0002l7-KS for guix-patches@gnu.org; Thu, 23 Feb 2023 15:44:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61724] [PATCH v2 1/2] gnu: Add nlohmann-json. References: In-Reply-To: Resent-From: jgart Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Feb 2023 20:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61724 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61724@debbugs.gnu.org Cc: jgart , Liliana Marie Prikler Received: via spool by 61724-submit@debbugs.gnu.org id=B61724.167718498310521 (code B ref 61724); Thu, 23 Feb 2023 20:44:01 +0000 Received: (at 61724) by debbugs.gnu.org; 23 Feb 2023 20:43:03 +0000 Received: from localhost ([127.0.0.1]:35448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVIQg-0002jQ-2X for submit@debbugs.gnu.org; Thu, 23 Feb 2023 15:43:03 -0500 Received: from mx2.dismail.de ([159.69.191.136]:5411) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVIQe-0002j5-37 for 61724@debbugs.gnu.org; Thu, 23 Feb 2023 15:43:01 -0500 Received: from mx2.dismail.de (localhost [127.0.0.1]) by mx2.dismail.de (OpenSMTPD) with ESMTP id a059b362; Thu, 23 Feb 2023 21:42:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=dismail.de; h=from:to:cc :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=20190914; bh=ucLEhKd1G1GWroF6N1AU6 KD3lQpgYvzg/XFKs9rRBMo=; b=FcC7urOurRTwcVvHsfAVMINqXELxpm7FqF+rL QZc43dorolv7epRxaHh4YQSqeD98ZB2p3eLAIbDHpxDwGPCs+IavmwB6jMgOJyYD 2GRLHhMbd9yMw9jT67LQTzR5zv7H6Cfyy/85ZJMTK1x5a/N2mW+untCt5Rg941sp USkBJaul+20vePMacsHqk1SE0NRUA4YcVm0p1svOMDfT4lqiTMFcXxEW7cxhuhR3 fPy1qj2AmBIw0fk/e/NGsznS0Gwmz6M7lcUTbxXFo3rCwdQon19dTCefNZvfX3W+ 8pv2Vu2PxB89gN8sp95/YtMfDG9t+riKt1C8V6MfMh5+6sZvA== Received: from smtp2.dismail.de ( [10.240.26.12]) by mx2.dismail.de (OpenSMTPD) with ESMTP id 3f68a59d; Thu, 23 Feb 2023 21:42:51 +0100 (CET) Received: from smtp2.dismail.de (localhost [127.0.0.1]) by smtp2.dismail.de (OpenSMTPD) with ESMTP id 16419195; Thu, 23 Feb 2023 21:42:51 +0100 (CET) Received: by dismail.de (OpenSMTPD) with ESMTPSA id 8c7814b1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 23 Feb 2023 21:42:45 +0100 (CET) Date: Thu, 23 Feb 2023 21:17:24 +0100 Message-Id: <20230223201724.28695-1-jgart@dismail.de> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: jgart X-ACL-Warn: , jgart via Guix-patches X-Patchwork-Original-From: jgart via Guix-patches via From: jgart Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2021 Guillaume Le Vaillant ;;; Copyright © 2021 Nikolay Korotkiy -;;; Copyright © 2021 jgart +;;; Copyright © 2021, 2023 jgart ;;; Copyright © 2021 Julien Lepiller ;;; Copyright © 2021 Disseminate Dissent ;;; Copyright © 2022 Efraim Flashner @@ -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 ")) - (with-directory-excursion "test/src" - (let ((files (find-files "." "\\.cpp$"))) - (substitute* files - (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp) - (string-append - "#include "))))))))) + (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