From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +GVpGqFsEGF0KAEAgWs5BA (envelope-from ) for ; Mon, 09 Aug 2021 01:45:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id eOfkFaFsEGHVGgAAB5/wlQ (envelope-from ) for ; Sun, 08 Aug 2021 23:45:37 +0000 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 B485210ECD for ; Mon, 9 Aug 2021 01:45:36 +0200 (CEST) Received: from localhost ([::1]:46522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCsU3-0003ab-Mt for larch@yhetil.org; Sun, 08 Aug 2021 19:45:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCsTZ-0002yA-SB for guix-patches@gnu.org; Sun, 08 Aug 2021 19:45:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mCsTZ-0004hb-JW for guix-patches@gnu.org; Sun, 08 Aug 2021 19:45:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mCsTZ-0001F4-Ho for guix-patches@gnu.org; Sun, 08 Aug 2021 19:45:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH 29/31] gnu: Add emacs-tree-sitter-core. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 Aug 2021 23:45:05 +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.16284662664639 (code B ref 49946); Sun, 08 Aug 2021 23:45:05 +0000 Received: (at 49946) by debbugs.gnu.org; 8 Aug 2021 23:44:26 +0000 Received: from localhost ([127.0.0.1]:55052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCsSv-0001Ce-LW for submit@debbugs.gnu.org; Sun, 08 Aug 2021 19:44:26 -0400 Received: from mout.gmx.net ([212.227.17.22]:45303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCsSo-0001Ad-DT for 49946@debbugs.gnu.org; Sun, 08 Aug 2021 19:44:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628466252; bh=shRZoDOWrmuUCP0eFRbx/3IRBHzxDu5IwQ8E55n4Tg8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=U5Qp3d+MTZKQCtLvd79sRSbuXr1PORDYFQJUO1D1AcX7gqA2yMCpANUoO2v8TqjP+ QYn+y9Pu20hD3Qzj9mHbJ7imBB3InX42fTbDzK4vpR+RS55R3a0VWbK4eErPMv4jQN ZacGeo125sISYHxxFlT3ojlKyVVeA+C1Cz805V+U= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MeU0q-1mnJCy2KU0-00aYwG; Mon, 09 Aug 2021 01:44:12 +0200 From: Pierre Langlois Date: Mon, 9 Aug 2021 00:43:56 +0100 Message-Id: <20210808234358.7241-9-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210808234358.7241-1-pierre.langlois@gmx.com> References: <20210808233354.6745-20-pierre.langlois@gmx.com> <20210808234358.7241-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:JdM6uC038OvSgOPmM1gDwlmz6yWgeQvE9cOTcODMbzDuHVgY6gi N5W7jcmySGY2WTMnGGVA7ForejX1PG68KZ3oFYHSyGy8BZ/LeorzpA/ArMbTFQJZOHqMkRf hWRsiX2DpvX6dH5SB+gqRleIjeJCQcqs5qu5r3SXmGRR6xY/TZfXFfxbMXmX3c8RulkuR2D eY6yanlTQaZ9wsxLsf4bQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:z1HbeflHH54=:5zxr7ZL3RwBOo7uBCch5qp /iXR7UP/eaLjsqgkRCvccGlpc3GMP3qkjb953vz03q8SWqMzdPTXb17nRgpiqc6V9MTmobg31 A8CynvEBRN50z5RxFDEbdte7AdX9nGezF21yjwC9hMwRZSpimNPNtpbIfLAYDwgIvsfmVAFcT pRrJHujx3oHC5psBl4HM336vfdqOr7dn5B4lFT5Yg3ESWjKEMVuM10kdsWsMNSU+5glQqCYQL xXRlY4g7XS4Fils1TkZUYmght5QtGRfwx2QZYQmb5hFqZjKcnDByHB7RJ7Y7Rcpqu/S4R2sMY 3jtjJNnIGUxv0kANYl4WnHLxWuAWHZDxw0XyQZoj4D/uNRWQqJhPAQmvLrGxwIXgbjgrslmSX mhzpCSC4o5DhZol9laN+1cR4Q44ok5CRVQP/FmOtoClEXHYmK/xAyQmgIcbs56V/LuCCq3JjF jIQ2ZFSuERQ1w6Y3epXHdijDmjJl/kiVA0adNjA+3+E7TBLmXxrHZDPZvBCxzcvOItr3CWvQy SSyxSrPebEqb0VKBYwYM3k31AqsvO6ruVhF/wNSGm3uNa9oiZAoJXt9I1oUgFGVG1MgLg07My dvxQ9bokX0pHUpSpsFuhZKHl648ZeJUS3AWsYco7Ys9tuM9CX/IRp/3eSBoOEcYyj32/MgQk5 Uo83zK4qmywJx9VNHZQmmI+pZ58m4ST9oCDK9lkpzjLmu3MH0q9CBOSF+aVoK54NCKkxVUgvP bt1U8u5h05QBDA5Ik1pCGqjXdqxjkAvRqf96+NG/qtE9kx/UirKp5tleJCPhU6E4A4PzSiyLe PE1P5LkPguBNTwFO6KhcInTqUFaddFDuXNckpktGr5sUCxt8ks6lrBeZWqxuSDMhW1DCtbjjB wPa5i2Cn3lJ7gWXgz1wX6flWTtJM33w4noxL1sQY/PzHN2BsRnftMHv1BJ0VainZhnpbVK/qr Ecvcb4AsFeEOwapYlwu9jFIbjrA9iiOuyI3gagq2FQATFWflCYSbsy34dBpsfjosuq++E0xAV CjCAqSnP1gfZ/fGL4q0V5fPGythBdkActNAB9+jsg+bvkSI6nA6bhQvkgiYzehIJMoevIVqbV r2lZkVLB3Xzf8/RzT0OwertU+Heg9h35XVRkZyCJwsnq5mVj/7xMhNCKg== 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1628466336; 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=oC9DH3eJoJgKhWk+VTeNBb9q7sIYhhHa9nhxa3kTOXg=; b=gY4TXJBksLTNNZD8Znm3NxkjqR3Zrqta9+m1lGR/XOUpZzRU8zO6n8wUIHxCqf/KZn1jI/ Dx98WVDUCN4N60RRvI0RM4rfojq4ySuM+BnPnTLrpcScaSQZklXAPoo99CxypvydxK45RK ujKzfiTo9WsHZwRZV3lF9Llo/qo5mwBiy0wHd13x7D0h/XW2XJEMPipiZbfYAf/jGywXuZ wM/OZqQocALYLpMHFyYBLMjnvNrAkPT0nXlpBg/H5SZRCvBf32YiIWMzCqc3Gax3D2ngjM YLpJF9eb+VKApt/IQ0+H9/G1a25VCvYcJ/yKzc3rz1d8vf9leFU1f8+JkOf1tA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628466336; a=rsa-sha256; cv=none; b=HFzKlrYkcOj5xsUSYg0mT7UW0v2EcrN+4BX9ax/hnM4hpqKNOIclwJDwfkjpnRQD7KDAmm xMqDOG1H7IClS3+CftKpKEX2V/+ZgkwzcJcok5upZMuTj0qEVMNhQo+QFgOYYIDqHRjxC9 X5D+809NaUCGsL9kJm9f2b//c2vzf2f1y9wRnZPbWQI0ESXjc9fNll+IojuexbtQ4k01hC 1wXFBT1+i0Q3tzqQvN0QaofYvKdbn/ntjeBzOY4K/dxzw1L3D1ncKL+FkX2rsbFPlY82B0 nwQYmkGdKZQsehuQB/aD8cn+DfFTcCcXmXY/26HiwgDNf7PXQYQXw573LOdqmg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=U5Qp3d+M; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=U5Qp3d+M; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmx.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: B485210ECD X-Spam-Score: 2.19 X-Migadu-Scanner: scn1.migadu.com X-TUID: +n1A2BkV+HdH * 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 | 79 ++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 4817b293ce..a9c1714936 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -19,6 +19,7 @@ (define-module (gnu packages tree-sitter) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system cargo) + #:use-module (guix build-system emacs) #:use-module (guix build-system node) #:use-module (guix download) #:use-module (guix git-download) @@ -27,6 +28,7 @@ #:use-module (gnu packages algebra) #:use-module (gnu packages crates-io) #:use-module (gnu packages crates-graphics) + #:use-module (gnu packages llvm) #:use-module (gnu packages node-xyz)) (define-public tree-sitter @@ -529,3 +531,80 @@ library.") "This package provides Typescript and TSX grammars for the Tree-sit= ter 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.15.1") + (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 + "15y0wjnck8rbfhl0xrl71ci7clbcp11lhqil5l8ykprsdjv0c2as")))= ) + (build-system cargo-build-system) + (inputs + `(("clang" ,clang))) + (arguments + `(#:cargo-inputs + (("rust-anyhow" ,rust-anyhow-1) + ("rust-emacs" ,rust-emacs-0.17) + ("rust-libloading" ,rust-libloading-0.7) + ("rust-once-cell" ,rust-once-cell-1) + ("rust-tree-sitter" ,rust-tree-sitter-0.19)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack '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 .*") "")))) + (add-after 'do-not-fetch-from-github 'chdir + (lambda _ (chdir "core"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (string-append (assoc-ref outputs "out") "/lib"))= ) + (install-file "../target/release/libtsc_dyn.so" lib))))))) + (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 + `(("tree-sitter-emacs-module" ,tree-sitter-emacs-module))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "core"))) + (add-after 'install 'install-module + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((elpa (elpa-directory (assoc-ref outputs "out"))) + (module (string-append (assoc-ref inputs "tree-sitter-= emacs-module") + "/lib/libtsc_dyn.so"))) + ;; Writing "LOCAL" in this file prevents the package from + ;; trying to download the module from the internet. + (call-with-output-file (string-append elpa "/DYN-VERSION") + (lambda (port) (display "LOCAL" port))) + (substitute* "tsc-dyn-get.el" + (("defcustom tsc-dyn-dir tsc--dir") + (string-append "defcustom tsc-dyn-dir \"" elpa "\""))) + (copy-file module (string-append elpa "/tsc-dyn.so")))))))= ) + (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.32.0