From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oA8REgAZgGPnqwAAbAwnHQ (envelope-from ) for ; Fri, 25 Nov 2022 02:23:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wPgMEgAZgGOKUgEAauVa8A (envelope-from ) for ; Fri, 25 Nov 2022 02:23:12 +0100 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 E5EB113003 for ; Fri, 25 Nov 2022 02:23:11 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyNQq-0005nI-BQ; Thu, 24 Nov 2022 20:23:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oyNQp-0005mF-6G for guix-patches@gnu.org; Thu, 24 Nov 2022 20:23:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oyNQo-0004Tc-TS for guix-patches@gnu.org; Thu, 24 Nov 2022 20:23:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oyNQo-0000P4-Q9 for guix-patches@gnu.org; Thu, 24 Nov 2022 20:23:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v7 05/32] gnu: Add tree-sitter-cli. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Nov 2022 01:23:06 +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.16693393491317 (code B ref 49946); Fri, 25 Nov 2022 01:23:06 +0000 Received: (at 49946) by debbugs.gnu.org; 25 Nov 2022 01:22:29 +0000 Received: from localhost ([127.0.0.1]:60805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oyNQC-0000L0-DX for submit@debbugs.gnu.org; Thu, 24 Nov 2022 20:22:29 -0500 Received: from mout.gmx.net ([212.227.17.21]:46285) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oyNQ5-0000Hs-CC for 49946@debbugs.gnu.org; Thu, 24 Nov 2022 20:22:22 -0500 Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MYeMt-1pU5Z60syJ-00VkHX; Fri, 25 Nov 2022 02:22:15 +0100 From: Pierre Langlois Date: Fri, 25 Nov 2022 01:21:15 +0000 Message-Id: <20221125012142.22579-6-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221125012142.22579-1-pierre.langlois@gmx.com> References: <87mtfi63ut.fsf@gmx.com> <20221125012142.22579-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:qoBq7buxWXVdHqvLlWZM8r/xXeCzIj+r3df4fB75cLkdNhbVEQ1 9DGXDm2NqqE+yZErpI+hB9t+nehat1bB+F7DN7mlyGbUPewsL7+aRNdMv9hXwuMpDsvIb48 Bhs2u/VP2eUTcf8finlwajZFjf9ASvHfb8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i48P/o EXPwF14I5nuYTTaKx8oR4ZNvPps= 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669339392; 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; bh=ivkL7lWe6L4MrVPai6+Syaqu6ljHEN1EKEMAkAEPJSo=; b=r3Eq6PZWnCA+6VmhHCr//h8LPlXMVcODdw/1Pnmhbj57C02laeBurrzBLHQEuk3BZ8KRpM X5Gr4W3rMWRHfAfeN3DwedHJUZPuqvJ56sCKC1eyhP18hAmk8R1yqnyZKRUxusN37+CZ+J EM1GQimxqOoqTPAx7pEQsDZChEww8EFaMNyL7UXjld23kUap05OId/YtkDK4m0QSQQkhcj Mald/RPVRCkZWNc8Rzk86eJRA/tIesittaDMbNq7RQRmmYngJ6QoVKCkF05FrsEMK3LAOJ J3vPsBv/D226qPCzrl/9LT8mBfhd4paEp7XBJms4+HtiJiYj5xyZWs6NduwJRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669339392; a=rsa-sha256; cv=none; b=r9AWZA0ONmTtXUM1WLY5lh3UZtMkg7vEz9NvIHpBLNV70FXoL6WOblKoxWLVgNgyeZQFZz XQrZa3M1t+fSn26Om/DPMTNkQ+iTrlNgAYWH4gRr63t3pQ441P4ve6TpTjRnoYFU0xAv8T FcVIdhQnmQ9B3uzT/gSJnULB/GDq+e7r9yyQDTAcSrkVIM5YkzFpG1jAU9stFmNsmE5e/z VeBSJweAmUiR1b0V0M+y3V+xVZzRSpPscsQ0qPnlhGu8YAOhje1hcqcWT/KUYpGJ22qnCn FiyKLRwKhl5sGVHA25Y0I92tOPqv2EbjOHQi12BS31KHV1hnyE/gQG0pSwqxTg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" 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: 3.00 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" 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: E5EB113003 X-Spam-Score: 3.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: bzob6C1qGG7Q * gnu/packages/tree-sitter.scm (tree-sitter-cli): New variable. --- gnu/packages/tree-sitter.scm | 80 ++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 8ef4e87e41..30bf17b79b 100644 --- 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,80 @@ (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=tree-sitter\");~@ + }~%"))) + #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 install + ;; 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-dirs" ,rust-dirs-3) + ("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 incremental +parsing library. It can build a concrete syntax tree for a source file and +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 syntax +errors. +@item Dependency-free so that the runtime library (which is written in pure C) +can be embedded in any application. +@end enumerate + +This package includes the @command{tree-sitter} command-line tool.") + (license license:expat))) -- 2.38.1