summary refs log tree commit diff
path: root/gnu/packages/cpp.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2020-07-28 18:01:46 +0200
committerMarius Bakke <marius@gnu.org>2020-07-30 00:57:26 +0200
commit295b4f7e17e76d0fea929047287e0e84bdca890b (patch)
treed76a2f7eba4ab09220a2a14095354036cabcad47 /gnu/packages/cpp.scm
parent4146cf8605a25d96fbc571bbb1d7f0fea9863654 (diff)
downloadguix-295b4f7e17e76d0fea929047287e0e84bdca890b.tar.gz
gnu: json-modern-cxx: Update to 3.9.0.
* gnu/packages/cpp.scm (json-modern-cxx): Update to 3.9.0.
[arguments]: New field.
[native-inputs]: Add "json_test_data" origin.
Diffstat (limited to 'gnu/packages/cpp.scm')
-rw-r--r--gnu/packages/cpp.scm48
1 files changed, 44 insertions, 4 deletions
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 5f0eae9673..5e83bb69f6 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -246,7 +247,7 @@ as ordering relation.")
 (define-public json-modern-cxx
   (package
     (name "json-modern-cxx")
-    (version "3.7.3")
+    (version "3.9.0")
     (home-page "https://github.com/nlohmann/json")
     (source
      (origin
@@ -255,7 +256,7 @@ as ordering relation.")
                            (commit (string-append "v" version))))
        (sha256
         (base32
-         "04rry1xzis71z5gj1ylcj8b4li5q18zxhcwaviwvi3hx0frzxl9w"))
+         "06wmbnwbisbq3rqdbmi297hidvq6q8vs6j4z0a9qpr4sm721lwa6"))
        (file-name (git-file-name name version))
        (modules '((guix build utils)))
        (snippet
@@ -278,12 +279,51 @@ as ordering relation.")
                   (string-append
                    "#include <fifo_map/" fifo-map-hpp ">")))))
            #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 'fix-pkg-config-install
+                    (lambda _
+                      ;; This phase can be removed for versions >= 3.9.1.
+                      (substitute* "CMakeLists.txt"
+                        ;; Look for the generated .pc in the right place ...
+                        (("\\$\\{CMAKE_BINARY_DIR\\}/\\$\\{PROJECT_NAME\\}\\.pc")
+                        "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
+                        ;; ... and install it to the libdir.
+                        (("DESTINATION lib/pkgconfig")
+                         "DESTINATION \"${CMAKE_INSTALL_LIBDIR}/pkgconfig\""))
+                      #t))
+                  ;; XXX: When tests are enabled, the install phase will cause
+                  ;; a needless rebuild without the given configure flags,
+                  ;; ultimately creating both $out/lib and $out/lib64.  Move
+                  ;; the check phase after install to work around it.
+                  (delete 'check)
+                  (add-after 'install 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (if tests?
+                          ;; Some tests need git and a full checkout, skip those.
+                          (invoke "ctest" "-LE" "git_required")
+                          (format #t "test suite not run~%"))
+                      #t)))))
     (native-inputs
      `(("amalgamate" ,amalgamate)
-       ("doctest" ,doctest)))
+       ("doctest" ,doctest)
+       ("json_test_data"
+        ,(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
      `(("fifo-map" ,fifo-map)))
-    (build-system cmake-build-system)
     (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.")