From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GJRuIdNIgWJ7EwAAbAwnHQ (envelope-from ) for ; Sun, 15 May 2022 20:39:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id QPNqINNIgWKb4wAAG6o9tA (envelope-from ) for ; Sun, 15 May 2022 20:39:15 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D42E8A832 for ; Sun, 15 May 2022 20:39:14 +0200 (CEST) Received: from localhost ([::1]:41386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqJ97-0001Yv-Uy for larch@yhetil.org; Sun, 15 May 2022 14:39:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqJ8z-0001VW-5Z for guix-patches@gnu.org; Sun, 15 May 2022 14:39:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqJ8x-0008Tg-9Q for guix-patches@gnu.org; Sun, 15 May 2022 14:39:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqJ8x-0006bc-6m for guix-patches@gnu.org; Sun, 15 May 2022 14:39:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v6 02/27] gnu: Add tree-sitter-cli. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 15 May 2022 18:39:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.165263993225320 (code B ref 49946); Sun, 15 May 2022 18:39:03 +0000 Received: (at 49946) by debbugs.gnu.org; 15 May 2022 18:38:52 +0000 Received: from localhost ([127.0.0.1]:50661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqJ8m-0006aE-3H for submit@debbugs.gnu.org; Sun, 15 May 2022 14:38:52 -0400 Received: from mout.gmx.net ([212.227.17.21]:54659) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqJ8c-0006XO-Oq for 49946@debbugs.gnu.org; Sun, 15 May 2022 14:38:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652639917; bh=6SFCEm0LtK0AgsP5BPXyPwkzDLNeUf+ymrXXihPZMIE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=QBhsx9jirW36u7C472o6XrAm55rWf7EyG9OiNg9ybnJXPid8uvYdrjOTNXqLIFQKm XWl8bOoD5zj1NzLpD3JmF7VXNWqslHnGVDgixASb3nr0hSAnmUV7/JFFtZXRhnZIZa MbHhtUU4KmYp4yKhUQhQ7D+NU7r/DmnqMmS5cvVY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MJE27-1oAJ7v3lF5-00Kgt5; Sun, 15 May 2022 20:38:37 +0200 From: Pierre Langlois Date: Sun, 15 May 2022 19:38:09 +0100 Message-Id: <20220515183834.18771-2-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220515183834.18771-1-pierre.langlois@gmx.com> References: <87mtfi63ut.fsf@gmx.com> <20220515183834.18771-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:yGGS110TQcSrO+WTzTemSjkS3YWIontOQL9Fejmt9U5JOTUCiDq TzcJMzcYU5Q79qje7TMtYXB1FxrpyyBc9htvl/1i+tL5+ILzICjB1FRmGIiy4O5nOIDh25G iPbrDRVKltlpKrEl974Sq8hFCofWRjRtlM1B8bgSOqJ4nDaEfXk6KuYW3tYaqoUWhIxL/VS POU+CLWokEM4thWHKokug== X-UI-Out-Filterresults: notjunk:1;V03:K0:pjSG98y1tic=:FnoUK60Y06R4J62ABjmYAI dAKOvLTK+z1urb2dG4T5gZ4M/4YYFsW6zfkXU61BMOXAe9J+N/PMyMJtUCFfS0drLGSn4K/qP VtKppcuBDu1P+xw8fWBCS0QYKxhhRSPd8QeB4CkVCPoXLh2HdZXElJpewFHqjMdGsmb6KsDjX wMDOqZpriURxDeu8pEDQG+R8LLOaxCDE2qXWntF83Gg+GWNNcnIWX/puyw+39BbXte6oibfRy YJM9rDZR9vN38eseKomxStoKKiyujkOUX0RUapy6qBH5vrhhB1YYgK6648VgFoIs2q6HNLnLk PqF7DDRYG3fFUZa9X6t16CiwxAG95Po6EqLTQr2bZ02PuB2K/eqB3QODM6FlugZJKdzmexlqw AOh8M+7xxndaRaybpV/2UY5KrNpHK8iISd+NxbklTvZVBenhNliAKpj5AoPbYe5zwYIeha2yI zznUBLR9evdKvm7VyZYk13wNy7C6bZzwBayQLSHsQBOIMMgVg8qxS/xB5gk4hC5gB8kk5MqVO HnB2lPeibWsQdOg6UD5A0Dh4QOkpxRudmw3cRLzdRbhE08F6WPogdjNOskZk5m9E2spDGhyCM dtCu3zHgdKXbQvlwGY5W93UWrxv+mKocNpDtq3j49mA9Rtoeb+xorb3Bo3JK0ivMA2LNP7Q1P 7S5qx3fFS2sDzoynUN3ZweSIYp6op4t+muQ/g4+wDAVZOSVLY/AYXXzxgEvPShEydMTtvKZCH pkibE2oRwGlT/86AaYVAzhXEKhQA1iu3/Ccom4Mrn6UDT8DdPuwa4BpHewMkCXBlPqceQ43Ql eIp8N16bL+cRmsdkktCq1Dxohnye4I/vcduejgybu6QGE9ewetz1ybyaIt3VWW8bsX93W342J 6jJz427Aasxg5ZFXFmJ8AeZwH91Vv1zn/D3n7lFeX75nnXxTLeZ0u9WbPV4uZ1fKJrHrv8He8 6Ya3lyipAJkvq2wFm9TtjBc7UfrI6qRW5Yohrffdzti9PUiOfOsuZbwaJPWl39UZKRYsr/BsF I+3CRr7y5JUHTxb1LuOCShH29OEKPdcI7UX3ZCTtbq9xYMmpwYS+BmvBYardh0lVCYkePaSgX O4beUxAiCb5EZU= 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1652639955; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=PRuWtLKMK1BzlJCcfFMne4FSYMNXVkd3dk8sadkpy0E=; b=nxtE+E3/Tz4KagRPaASGa1aev6hvvFnrr2wCTDJWVX17YwaKmoj6Y7uYZkwfzChtwzczYe v9y3Sd0KxrBeXmqYpXqRDu9GpQFwc+buxh1Le0bWrthQmTt1F47xMhYZ9bQ8JB+aTRUWzL XJ6GgvjUoJFUA78nJDzHnnJUgxiL0FLGNpwiXH6Wh/xF56qKsBdOItUqf86ldKzGsbsBLV BzuyJRQ/zsfnNj2t9U6vaJSdFHz1NMdsQDkHGtN4nBTHxN2FKpd7MJ+QQVjLf0VQxkyUpt eOZ5aHzaTRKgcQsPv/lTVwctawfaOKbb3MuL6l3akUghzTdYi/imscN4fN/fKQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652639955; a=rsa-sha256; cv=none; b=EMr/6dAANIJdzC9qkL+CSECPfY+r9gXijjiITbM3nXzbdXV3dJPgDN3VqbCvzlTKKmHBEZ nBWexolyXeEW5ZSaKuv6jnuL7mCQfGhnZwI8Jeoam7OUk6LMUN2DVK1Alnv7C3NKTWZFJa Cj6kykFgC/zXpdWtM3POjzqkZBlH3cLRiapKleW04qV2fOr9DVYEiWlxopF7IVdauDc8yc o2/lLkqUj4QVp+ZLRzK1jYenOGHoFew3c/f/9o7UGovksmVO/jhTMlFSjWLj9rPtlzrbCs Uyg6TMS9d6k2VD8Ju4OkvsIjqy/vTZtKwrIZ47tCp0gV2fIE7tVrgqGZcyxXSQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=QBhsx9ji; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 7.37 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=QBhsx9ji; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D42E8A832 X-Spam-Score: 7.37 X-Migadu-Scanner: scn1.migadu.com X-TUID: Oa5RxNpe2fta * gnu/packages/tree-sitter.scm (tree-sitter-cli): New variable. =2D-- gnu/packages/tree-sitter.scm | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 7116a10ed7..18c9fe0844 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -20,10 +20,13 @@ (define-module (gnu packages tree-sitter) #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) + #:use-module (gnu packages crates-graphics) + #:use-module (gnu packages crates-io) #:use-module (gnu packages icu4c)) (define-public tree-sitter @@ -76,3 +79,79 @@ (define-public tree-sitter This package includes the @code{libtree-sitter} runtime library. ") (license license:expat))) + +(define-public tree-sitter-cli + (package (inherit tree-sitter) + (name "tree-sitter-cli") + (source (origin + (inherit (package-source tree-sitter)) + (snippet + '(begin + ;; Remove the runtime library code and dynamically link= to + ;; it instead. + (delete-file-recursively "lib/src") + (delete-file "lib/binding_rust/build.rs") + (with-output-to-file "lib/binding_rust/build.rs" + (lambda _ + (format #t "fn main() {~@ + println!(\"cargo:rustc-link-lib=3Dtree-sitt= er\");~@ + }~%"))) + #t)))) + (build-system cargo-build-system) + (inputs (list tree-sitter)) + (arguments + `(;; Running test requires downloading fixtures, see the + ;; script/fetch-fixtures script. + #:tests? #f + ;; We're only packaging the CLI program so we do not need to insta= ll + ;; sources. + #:install-source? #f + #:cargo-inputs + (("rust-ansi-term" ,rust-ansi-term-0.12) + ("rust-anyhow" ,rust-anyhow-1) + ("rust-atty" ,rust-atty-0.2) + ("rust-clap" ,rust-clap-2) + ("rust-difference" ,rust-difference-2) + ("rust-html-escape" ,rust-html-escape-0.2) + ("rust-libloading" ,rust-libloading-0.7) + ("rust-rand" ,rust-rand-0.8) + ("rust-rustc-hash" ,rust-rustc-hash-1) + ("rust-semver" ,rust-semver-1) + ("rust-smallbitvec" ,rust-smallbitvec-2) + ("rust-thiserror" ,rust-thiserror-1) + ("rust-tiny-http" ,rust-tiny-http-0.8) + ("rust-toml" ,rust-toml-0.5) + ("rust-walkdir" ,rust-walkdir-2) + ("rust-webbrowser" ,rust-webbrowser-0.5) + ("rust-which" ,rust-which-4)) + #:cargo-development-inputs + (("rust-pretty-assertions" ,rust-pretty-assertions-0.7)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'delete-cargo.lock + (lambda _ (delete-file "Cargo.lock"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin")) + (lib (string-append out "/lib"))) + (mkdir-p bin) + (install-file "target/release/tree-sitter" bin))))))) + (synopsis "Incremental parsing system for programming tools") + (description "Tree-sitter is a parser generator tool and an increment= al +parsing library. It can build a concrete syntax tree for a source file a= nd +efficiently update the syntax tree as the source file is edited. + +Tree-sitter aims to be: + +@enumerate +@item General enough to parse any programming language. +@item Fast enough to parse on every keystroke in a text editor. +@item Robust enough to provide useful results even in the presence of syn= tax +errors. +@item Dependency-free so that the runtime library (which is written in pu= re C) +can be embedded in any application. +@end enumerate + +This package includes the @command{tree-sitter} command-line tool.") + (license license:expat))) =2D- 2.36.0