From 0853a1671f74f9869ca6c75d6086092354783a99 Mon Sep 17 00:00:00 2001 From: bdunahu Date: Thu, 23 Apr 2026 19:54:32 -0400 Subject: gnu: Add nlohmann-json-no-char8-t. * gnu/packages/patches/nlohmann_json_fix_char8_t.patch: New file. * gnu/local.mk: (dist_patch_DATA): Register it. * gnu/packages/cpp.scm (nlohmann-json-no-char8-t): New variable. Change-Id: I8b47d345cd82718d1a2bd40009c480aca7c2c5b3 Signed-off-by: Liliana Marie Prikler --- gnu/packages/cpp.scm | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'gnu/packages/cpp.scm') diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 40d16fc5dc7..d2a86bfc97a 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1434,6 +1434,9 @@ data transfer object.") (define-public nlohmann-json (package (name "nlohmann-json") + ;; XXX: Merge related package `nlohmann-json-no-char8-t' back into here when + ;; updating from 3.12.0, as the unique patch it applies will already be + ;; incorporated in. (version "3.12.0") (home-page "https://github.com/nlohmann/json") (source @@ -1507,6 +1510,46 @@ intuitive syntax and trivial integration.") (define-deprecated-package json-modern-cxx nlohmann-json) +(define-public nlohmann-json-no-char8-t + (package + ;; XXX: Version 3.12.0 does not work without char8_t support. + ;; OpenRCT2 compiles with -fno-char8_t, and thus requires this patch. + ;; See https://github.com/nlohmann/json/pull/4736 + (inherit nlohmann-json) + (name "nlohmann-json-no-char8-t") + (version "3.12.0") + (source + (origin + (method git-fetch) + (uri (git-reference (url "https://github.com/nlohmann/json") + (commit (string-append "v" version)))) + (sha256 + (base32 "09nqq56ighr3lghhn3fs399lkllghz717j0xyp87x0giw86ayh3h")) + (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 "./tests/thirdparty/doctest/doctest_compatibility.h" + "/tmp") + (delete-file-recursively "./tests/thirdparty") + (install-file "/tmp/doctest_compatibility.h" + "./tests/thirdparty/doctest") + + ;; Adjust for the unbundled fifo_map and doctest. + (substitute* (find-files "./tests/" "\\.h(pp)?") + (("#include \"doctest\\.h\"") "#include ") + (("#include ") "#include ")) + (with-directory-excursion "tests/src" + (let ((files (find-files "." "\\.cpp$"))) + (substitute* files + (("#include ?\"(fifo_map.hpp)\"" all fifo-map-hpp) + (string-append + "#include "))))))) + (patches + (search-patches "nlohmann_json_fix_char8_t.patch")))))) + (define-public jthread (let ((commit "0fa8d394254886c555d6faccd0a3de819b7d47f8") (revision "0")) -- cgit v1.2.3