From patchwork Mon Aug 2 16:15:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vivien Kraus X-Patchwork-Id: 31745 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4655027BC78; Mon, 2 Aug 2021 17:20:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id A735D27BC6B for ; Mon, 2 Aug 2021 17:20:19 +0100 (BST) Received: from localhost ([::1]:52580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mAafq-00045h-Pe for patchwork@mira.cbaines.net; Mon, 02 Aug 2021 12:20:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAabi-00013a-7K for guix-patches@gnu.org; Mon, 02 Aug 2021 12:16:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mAabh-00070l-Uc for guix-patches@gnu.org; Mon, 02 Aug 2021 12:16:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mAabh-0005ii-R9 for guix-patches@gnu.org; Mon, 02 Aug 2021 12:16:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49823] Using texinfo for the description References: <71fbbaa57a2c1dba8f0d956ea162c2e15d332e0c.camel@planete-kraus.eu> In-Reply-To: <71fbbaa57a2c1dba8f0d956ea162c2e15d332e0c.camel@planete-kraus.eu> Resent-From: Vivien Kraus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Aug 2021 16:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49823 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49823@debbugs.gnu.org Received: via spool by 49823-submit@debbugs.gnu.org id=B49823.162792094621960 (code B ref 49823); Mon, 02 Aug 2021 16:16:01 +0000 Received: (at 49823) by debbugs.gnu.org; 2 Aug 2021 16:15:46 +0000 Received: from localhost ([127.0.0.1]:39123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAabR-0005i7-RF for submit@debbugs.gnu.org; Mon, 02 Aug 2021 12:15:46 -0400 Received: from planete-kraus.eu ([89.234.140.182]:39108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mAabN-0005ht-DX for 49823@debbugs.gnu.org; Mon, 02 Aug 2021 12:15:44 -0400 Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 0dd32a29 for <49823@debbugs.gnu.org>; Mon, 2 Aug 2021 16:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:date:content-type:mime-version; s=*; bh=SRrOJTKs6byz72iiDr8u4RYMihc=; b=O0VaaqGZEICg7HK6BC2/0fpT2KZB QHwnImcYJOuTmWTWiHZ4jcwNq6Guie59VK+4aavoBdu2P7VCRbpyHJBUfWA3de4F feSE/atYj3m7WrlBZ94VAbc+jvFBClAfYsJZYS4Tg0kQGRM2XaeJ+RfVQGwrO1jN 1vMBkfeZ1VVuOzU= Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id fb2690a8 (TLSv1.3:AEAD-CHACHA20-POLY1305-SHA256:256:NO) for <49823@debbugs.gnu.org>; Mon, 2 Aug 2021 16:15:32 +0000 (UTC) Message-ID: Date: Mon, 02 Aug 2021 18:15:17 +0200 User-Agent: Evolution 3.34.2 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Vivien Kraus X-ACL-Warn: , Vivien Kraus via Guix-patches X-Patchwork-Original-From: Vivien Kraus via Guix-patches via From: Vivien Kraus X-getmail-retrieved-from-mailbox: Patches 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 From 7fb706951904f58cb3dd8963885024f7d9383c0b Mon Sep 17 00:00:00 2001 From: Vivien Kraus 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 ")) + (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 + +// 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 +#include +#include +#include + +std::string +md5 (const std::string str) +{ + // Convert str to a byte array + std::vector 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 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