Subject: [bug#44978] [PATCH 3/3] gnu: vlang: Use system cJSON.

From: Ryan Prior <[email-masked]>
Date: Tue, 01 Dec 2020 04:15:28 +0000

* gnu/packages/vlang.scm (vlang): Use system cJSON.
---
 gnu/packages/vlang.scm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index 83bacfc6c3..334901ffb6 100644
--- a/gnu/packages/vlang.scm
+++ b/gnu/packages/vlang.scm
@@ -27,6 +27,7 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages valgrind)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages web)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system gnu)
   #:use-module (guix git-download)
@@ -62,7 +63,8 @@
      (snippet
       '(begin
          ;; Eventually remove the whole thirdparty directory.
-         (delete-file-recursively "thirdparty/bignum")))))
+         (delete-file-recursively "thirdparty/bignum")
+         (delete-file-recursively "thirdparty/cJSON")))))
    (build-system gnu-build-system)
    (arguments
     `(#:make-flags
@@ -83,7 +85,10 @@
               (("rm -rf") "true"))
             (substitute* "vlib/math/big/big.v"
               (("@VROOT/thirdparty/bignum")
-               (string-append (assoc-ref inputs "tiny-bignum") "/share")))))
+               (string-append (assoc-ref inputs "tiny-bignum") "/share")))
+            (substitute* "vlib/json/json_primitives.v"
+              (("@VROOT/thirdparty/cJSON")
+               (assoc-ref inputs "cJSON")))))
         (add-before 'build 'patch-cc
           (lambda _
             (let* ((bin "tmp/bin")
@@ -138,7 +143,8 @@
               (copy-file "v.mod" vmod)))))))
    (inputs
     `(("glib" ,glib)
-      ("tiny-bignum" ,tiny-bignum)))
+      ("tiny-bignum" ,tiny-bignum)
+      ("cJSON" ,(package-source cjson))))
    (native-inputs
     `(("vc"
        ;; Versions are not consistently tagged, but the matching commit will
-- 
2.29.2