From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 kKB8AltJgWKaZwEAbAwnHQ (envelope-from ) for ; Sun, 15 May 2022 20:41:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id kF94AVtJgWLUYAEAG6o9tA (envelope-from ) for ; Sun, 15 May 2022 20:41:31 +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 8368912268 for ; Sun, 15 May 2022 20:41:30 +0200 (CEST) Received: from localhost ([::1]:46648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqJBJ-0005DO-OX for larch@yhetil.org; Sun, 15 May 2022 14:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqJ97-0001pi-1f for guix-patches@gnu.org; Sun, 15 May 2022 14:39:13 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqJ96-0000CE-NJ for guix-patches@gnu.org; Sun, 15 May 2022 14:39:12 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqJ96-0006fH-LL for guix-patches@gnu.org; Sun, 15 May 2022 14:39:12 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v6 25/27] gnu: Add emacs-tree-sitter-core. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 15 May 2022 18:39:12 +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.165263994825539 (code B ref 49946); Sun, 15 May 2022 18:39:12 +0000 Received: (at 49946) by debbugs.gnu.org; 15 May 2022 18:39:08 +0000 Received: from localhost ([127.0.0.1]:50704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqJ91-0006db-KL for submit@debbugs.gnu.org; Sun, 15 May 2022 14:39:08 -0400 Received: from mout.gmx.net ([212.227.17.20]:33919) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqJ8j-0006Y6-PV for 49946@debbugs.gnu.org; Sun, 15 May 2022 14:38:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652639924; bh=xHOSSWPINNYi0eI7mVvQieRMCRpqcVSb2xGp9ucsqeQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=S1YcqnRAPreeK27xwtA0yI/zGMVhBk1O3qsCIucxW1UeBYOQZLWBuEQFVDBrb+0J4 JZJlvEwS/mQgdyp3DrmGe2Ner9mogmotZJwfdxM7rVlPZK8/ocXlaNPb9jNiLMZeiK uIjkjqBy7Jaz2YwGPjCLOXdBVlhsJRi9063SHDA0= 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 1MHoRK-1o5DMb47oU-00EvF6; Sun, 15 May 2022 20:38:44 +0200 From: Pierre Langlois Date: Sun, 15 May 2022 19:38:32 +0100 Message-Id: <20220515183834.18771-25-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:tZY4NKm3Xfe5xiEq01Ayivu6b2xDwf8iCVbZjzE5WScCyYx+hW/ FeOgTYp07RK/aaXSxcrqqS80RWIcneF4XwuPC2e0yKzSdx/S6iBZe8MCfoT2N5/cXensOKv IGRtzcXzEQlEweZLiqSWS3O0yf5/1kaktR8bunI+SPjPjxGXn10z8NZtA21zstncNV4cXfd b2A3DlgEibx64sGiJn1Mg== X-UI-Out-Filterresults: notjunk:1;V03:K0:le14dKRT1Nw=:M4YmfSA/l3BgnYl6r2M6bT BF0T15OKO1Nb7SeNCkqHOtEloxeEvr1N9VF/uZXOnYv5GaFOEMX7lWRmg7koZ4xnyNDMPgJ2M c3BH2Ut6QQ4Ejt3r4+NZGIreqkRQYgcSNCtdn/WOlpPLEvblNyILxCkeviWzmnmvOLJT2O825 gcs/76SF+j8U9HzVzlCwqqPTOp1NGpp+4Rv/sxacj/ysKVG3E1EJxcxkT1UsAFQpRhZ57Y8K1 JBkC27U85zn1qsekj8uNB3qaaZdNlRZr2ptGuU8Cucx4ydK6oHOTgDhGzoWPU2enjBr+D3zpP 6RfC1JlKGqd0jXQZkmM1RpCQkyfxFLPqO0xHMFad2ubqgJuRantMIjL0SwRXfJhfStcPBlCz9 FfeF8QhfSP2fL0BbnDyz4SVHL0pdx8SoKECyHaciNk2whpX280FnkUh9Q2xs91lTXRXGkdqFQ rUtBPTmmTYe4SoDRp8azjiqAyNyiV9OL/70r2lqofcJpj2lEjxrZBTSz0MhbUjdYPq+OX7V/L o0quPFox6dp/bS9BmFVy0Hskif1JzMjmlYSUwCBHXVck/x+DN/UgokzXtzPHf4EX/ri8/52a0 j4Zo9XeY47LJZY5cyEPx6EogSqaauAsFHRSUCPu1GnrZpU8OqlXhOTSJwe3f4L3YfXlKh45W7 O3xSi8t577myhECFfTez/Bm2AOVU7ZMGTI3OaVHMaOjKSKBCokmH/PBZjFP23h+048c8MMDui oqDAnoVD6lKVcprt9o917JJXk01HbyOfTRPXmOzJZOKE6LouBQWhiGIOmmhWJdt953HqFvNED 4W1nIz1x0sVG8k8XXMLpvFkkbxZ8KYC2ToIpiHPCpiyzB7vN8zGhKPgEpGQeA4RpPY0sRapJI 5hPeL/1LhNeKsj4qOhZX4O1K5kF7JJj4MzOqzFzEMaYcJ+8JsTycpV921wyLEZ4TbGK0tesZ9 0KugFc9/ZwBsDHaSd3tYVA5nA1AmjgrYYBzBcl5/t7/i0EzRqZWksdfEbiUgFYzcws8g+XcXr Ny6LMfDdMdkRYRY6AC0q+/jVUqS/G22+OPQd52E80j/kSrwswpFhO2/sOuzW4Un9TAOxWALVa Nkk2FqI+vP0IeA= 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=1652640090; 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=8u9TFAzvWimMyEWlPHVBwRAiINnilnserdO8+i1Zwxo=; b=UPpjYOgo/GNvc46LR+W8v5hg1eQLjK7NYHUUPIy+etAQGL1Fv6X2knEbX3Ej7RPcv1bqZz YNlC0yfikl70DJWKGH7oNIW/NV22GY+kqg7Zs5MA2adiyG2YgEAg42FYeYX3DgxTiHryzS vU8qlqxYTPfVdNqikLY9CrZ7v78yNE8XCh1m4JcVY9xMOY/WLnx4VMc6ygsveKIeTTNaK4 PHFENKJZbTjw29SjYOPAUqXJCml3+Dtxl2tHRvA1M3Y3DZeydSMVp7BcmsaQHqpQwFinmR JGv8R3ZKvH8psyVmQeq4fLAqzKCaAZKzsYxWqxR1k6ScNmWfjOvZMSnnhq5YIg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652640090; a=rsa-sha256; cv=none; b=NFcccZNXmZ6XXtb+6hh2rYE2mSNDVdbNhjnyv9zrA946C8D5J0jxzo4Uk6RbcvgVhOE/kD cEXRoFmR6uPQLJ9mJAJhaJlZ5gEKFrcIybXn1vMDZyEvnk615M/W6OmniXnZw/7Ro7wYtU a3x/Corde5Xm+uyenmsGS4Qu0yEwUo+/7EwgMBy52GfqKEfO7fC2E1wVGZf2WkiCeD9IMi QyVZn7LQuOOw5pzymY4goDBnz7NmRn2VSgP/gYjt0dCXp0pHiJ21c38MCm4zcjwvsAbcKj GH6BK/Hui+ZfoI/mn5wK8NH0DsENOyN04zgH0BgVY9S3MraeqsN5sVhQeWxFsA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=S1YcqnRA; 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=S1YcqnRA; 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: 8368912268 X-Spam-Score: 7.37 X-Migadu-Scanner: scn1.migadu.com X-TUID: aVNMbNcssLAo * gnu/packages/tree-sitter.scm (tree-sitter-emacs-module): New local varia= ble. (emacs-tree-sitter-core): New variable. =2D-- gnu/packages/tree-sitter.scm | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 4d1d3b2177..3e01474285 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -21,6 +21,7 @@ (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 emacs) #:use-module (guix build-system gnu) #:use-module (guix build-system tree-sitter) #:use-module (guix download) @@ -686,3 +687,86 @@ (define-public tree-sitter-typescript "This package provides Typescript and TSX grammars for the Tree-sitt= er library.") (license license:expat))) + +;; Local package definition solely for building the native emacs module +;; written in Rust. +(define tree-sitter-emacs-module + (package + (name "tree-sitter-emacs-module") + (version "0.18.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/emacs-tree-sitter/elisp-tree= -sitter") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1sdvz827v436qijs6xafakkfw2d16bvp8frymd818rppjc7a9dif")))= ) + (build-system cargo-build-system) + (inputs + (list tree-sitter)) + (arguments + `(#:cargo-inputs + (("rust-anyhow" ,rust-anyhow-1) + ("rust-emacs" ,rust-emacs-0.18) + ("rust-libloading" ,rust-libloading-0.7) + ("rust-once-cell" ,rust-once-cell-1) + ("rust-tree-sitter" ,rust-tree-sitter-for-emacs)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "core"))) + (add-after 'chdir 'delete-cargo.lock + (lambda _ (delete-file "Cargo.lock"))) + (add-after 'delete-cargo.lock 'do-not-fetch-from-github + (lambda _ + (substitute* "Cargo.toml" + (("\\[patch.*") "") + (("git =3D .*") "")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (string-append (assoc-ref outputs "out") "/lib"))= ) + (mkdir-p lib) + (copy-file "target/release/libtsc_dyn.so" + (string-append lib "/tsc-dyn.so")))))))) + (home-page #f) + (synopsis #f) + (description #f) + (license license:expat))) + +(define-public emacs-tree-sitter-core + (package + (name "emacs-tree-sitter-core") + (version (package-version tree-sitter-emacs-module)) + (source (package-source tree-sitter-emacs-module)) + (build-system emacs-build-system) + (native-inputs + (list tree-sitter-emacs-module)) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "core"))) + (add-before 'install 'find-tsc-dyn + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((elpa (elpa-directory (assoc-ref outputs "out"))) + (module (search-input-file inputs "/lib/tsc-dyn.so"))) + ;; Install the tsc-dyn module in site-lisp and the current + ;; directory for test to pass. + (install-file module elpa) + (copy-file module "tsc-dyn.so") + ;; We replace the tsc-dyn-get.el file with an empty stub t= o + ;; prevent the code from downloading the module. + (call-with-output-file "tsc-dyn-get.el" + (lambda (port) + (for-each + (lambda (sexp) (write sexp port)) + '((defun tsc-dyn-get-ensure (requested) + nil) + (provide 'tsc-dyn-get))))))))))) + (home-page "https://github.com/emacs-tree-sitter/elisp-tree-sitter") + (synopsis "Tree-sitter bindings for Emacs Lisp, core library") + (description "This package provides core APIs of the Emacs binding fo= r +Tree-sitter, an incremental parsing system.") + (license license:expat))) =2D- 2.36.0