From: Vivien Kraus via Guix-patches via <guix-patches@gnu.org>
To: 49823@debbugs.gnu.org
Subject: [bug#49823] Using texinfo for the description
Date: Mon, 02 Aug 2021 18:15:17 +0200 [thread overview]
Message-ID: <b1abc32b7ea40f47e589a03fe3ac066f3e2ae228.camel@planete-kraus.eu> (raw)
In-Reply-To: <71fbbaa57a2c1dba8f0d956ea162c2e15d332e0c.camel@planete-kraus.eu>
[-- Attachment #1: Type: text/plain, Size: 459 bytes --]
maximed told me I could use texinfo in the description.
(I also removed a couple of lines in the C++ source because the
constant was not used.)
Also, I was advised to put the added source code in a local-file such
as what is done by gnuzilla, but I could not figure out how it was done
for gnuzilla (the package is quite large). If I go with a patch, there
are a lot of things that get deleted, so it makes a rather large patch.
What do you think?
Vivien
[-- Attachment #2: 0001-gnu-Add-jsonnet.patch --]
[-- Type: text/x-patch, Size: 4301 bytes --]
From 7fb706951904f58cb3dd8963885024f7d9383c0b 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 | 105 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 42e9d50687..318e387069 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -63,6 +63,7 @@
#:use-module (gnu packages llvm)
#:use-module (gnu packages logging)
#:use-module (gnu packages maths)
+ #:use-module (gnu packages nettle)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages perl)
#:use-module (gnu packages pkg-config)
@@ -1211,3 +1212,107 @@ 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
+ (delete-file-recursively "third_party")
+ (delete-file-recursively "doc/third_party")
+ (substitute*
+ '("core/vm.cpp")
+ (("#include \"json.hpp\"") "#include <nlohmann/json.hpp>"))
+ (mkdir-p "third_party/md5")
+ (call-with-output-file "third_party/md5/CMakeLists.txt"
+ (lambda (port)
+ (format port "add_library(md5 STATIC md5.cpp md5.h)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(NETTLE REQUIRED nettle)
+target_link_libraries(md5 ${NETTLE_LIBRARIES})
+target_include_directories(md5 PUBLIC ${NETTLE_INCLUDE_DIRS})
+")))
+ (call-with-output-file "third_party/md5/md5.h"
+ (lambda (port)
+ (format port "#ifndef BZF_MD5_H
+#define BZF_MD5_H
+#include <string>
+
+// Return the hexadecimal digest.
+std::string md5 (const std::string str);
+
+#endif
+")))
+ (call-with-output-file "third_party/md5/md5.cpp"
+ (lambda (port)
+ (format port "#include \"md5.h\"
+#include <nettle/md5.h>
+#include <nettle/base16.h>
+#include <string>
+#include <vector>
+
+std::string
+md5 (const std::string str)
+{
+ // Convert str to a byte array
+ std::vector<uint8_t> input (str.begin (), str.end ());
+
+ // Compute the digest
+ struct md5_ctx nettle_ctx;
+ md5_init (&nettle_ctx);
+ md5_update (&nettle_ctx, input.size (), input.data ());
+ uint8_t digest[MD5_DIGEST_SIZE];
+ md5_digest (&nettle_ctx, MD5_DIGEST_SIZE, digest);
+
+ // Encode it to base16
+ std::vector<char> encoded (BASE16_ENCODE_LENGTH (MD5_DIGEST_SIZE));
+ base16_encode_update (encoded.data (), MD5_DIGEST_SIZE, digest);
+ std::string final_digest (encoded.begin (), encoded.end ());
+ return final_digest;
+}
+")))))))
+ (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)
+ ;; jsonnet uses a md5 implementation claiming to be from
+ ;; https://www.bzflag.org/, but they don’t use it anymore. We
+ ;; replace it with md5 from nettle.
+ ("nettle" ,nettle)))
+ (home-page "https://jsonnet.org/")
+ (synopsis "The data templating language")
+ (description "A data templating language for app and tool developers:
+@itemize
+@item Generate config data
+@item Side-effect free
+@item Organize, simplify, unify
+@item Manage sprawling config
+@end itemize
+
+A simple extension of JSON:
+@itemize
+@item Open source (Apache 2.0)
+@item Familiar syntax
+@item Reformatter, linter
+@item Editor & IDE integrations
+@item Formally specified
+@end itemize
+")
+ (license license:asl2.0)))
--
2.32.0
next prev parent reply other threads:[~2021-08-02 16:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 15:01 [bug#49823] [PATCH] gnu: Add jsonnet Vivien Kraus via Guix-patches via
2021-08-02 16:15 ` Vivien Kraus via Guix-patches via [this message]
2021-08-02 16:35 ` [bug#49823] Using texinfo for the description Maxime Devos
2021-08-02 17:09 ` Vivien Kraus via Guix-patches via
2021-08-02 17:52 ` Leo Prikler
2021-08-02 23:21 ` Vivien Kraus via Guix-patches via
2021-08-10 12:58 ` [bug#49823] [PATCH] gnu: Add jsonnet Ludovic Courtès
2021-08-10 14:28 ` Vivien Kraus via Guix-patches via
2021-08-11 9:56 ` Ludovic Courtès
2021-08-11 10:12 ` Vivien Kraus via Guix-patches via
2021-08-12 7:53 ` bug#49823: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b1abc32b7ea40f47e589a03fe3ac066f3e2ae228.camel@planete-kraus.eu \
--to=guix-patches@gnu.org \
--cc=49823@debbugs.gnu.org \
--cc=vivien@planete-kraus.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.