diff mbox series

[bug#49823] gnu: Add jsonnet.

Message ID 87y2981e8x.fsf@planete-kraus.eu
State Accepted
Headers show
Series [bug#49823] gnu: Add jsonnet. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Vivien Kraus Aug. 11, 2021, 10:12 a.m. UTC
Ludovic Courtès writes:
>> OK. Should I keep the bundled MD5 implementation then?
>
> Yeah, I think so.  Clearly it’s a gray area, there are pros and cons,
> but I’d lean towards minimal changes to upstream source.

Here you go :)
diff mbox series

Patch

From 8ce461001ed14c3267d839334e4853feaed69b50 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Mon, 2 Aug 2021 16:07:08 +0200
Subject: [PATCH] gnu: Add jsonnet.

* gnu/packages/cpp.scm (jsonnet): New variable.
---
 gnu/packages/cpp.scm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 42e9d50687..870c02dac3 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -45,6 +45,7 @@ 
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix modules)
+  #:use-module (guix gexp)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
@@ -1211,3 +1212,43 @@  of reading and writing XML.")
     ;; incompatible with the GPL v2.  Refer to the file named FLOSSE for the
     ;; details.
     (license license:gpl2+)))
+
+(define-public jsonnet
+  (package
+    (name "jsonnet")
+    (version "0.17.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/google/jsonnet")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1ddz14699v5lqx3dh0mb7hfffr6fk5zhmzn3z8yxkqqvriqnciim"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            (rename-file "third_party/md5" ".md5")
+            (delete-file-recursively "third_party")
+            (delete-file-recursively "doc/third_party")
+            (substitute*
+                '("core/vm.cpp")
+              (("#include \"json.hpp\"") "#include <nlohmann/json.hpp>"))
+            (mkdir "third_party")
+            (rename-file ".md5" "third_party/md5")))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags '("-DUSE_SYSTEM_GTEST=ON" "-DUSE_SYSTEM_JSON=ON")))
+    (propagated-inputs
+     '())
+    (native-inputs
+     `(("googletest" ,googletest)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("json-modern-cxx" ,json-modern-cxx)))
+    (home-page "https://jsonnet.org/")
+    (synopsis "Data templating language")
+    (description "Jsonnet is a templating language extending JSON
+syntax with variables, conditions, functions and more.")
+    (license license:asl2.0)))
-- 
2.32.0