From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oBPgIMliQ2LinQAAgWs5BA (envelope-from ) for ; Tue, 29 Mar 2022 21:49:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IFGEHsliQ2LMDwAA9RJhRA (envelope-from ) for ; Tue, 29 Mar 2022 21:49:29 +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 2FD812992F for ; Tue, 29 Mar 2022 21:49:29 +0200 (CEST) Received: from localhost ([::1]:41102 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZHqK-0000Ev-CD for larch@yhetil.org; Tue, 29 Mar 2022 15:49:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZHpw-00008G-JC for guix-patches@gnu.org; Tue, 29 Mar 2022 15:49:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZHpu-0002gO-Qd for guix-patches@gnu.org; Tue, 29 Mar 2022 15:49:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZHpu-0005Ag-Ov for guix-patches@gnu.org; Tue, 29 Mar 2022 15:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v5 25/27] gnu: Add emacs-tree-sitter-core. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Mar 2022 19:49:02 +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.164858333719853 (code B ref 49946); Tue, 29 Mar 2022 19:49:02 +0000 Received: (at 49946) by debbugs.gnu.org; 29 Mar 2022 19:48:57 +0000 Received: from localhost ([127.0.0.1]:33663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZHpo-0005A8-SL for submit@debbugs.gnu.org; Tue, 29 Mar 2022 15:48:57 -0400 Received: from mout.gmx.net ([212.227.17.20]:39889) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZHpk-00059a-At for 49946@debbugs.gnu.org; Tue, 29 Mar 2022 15:48:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648583326; bh=lnLefxr28oNN5KkWKmP+eUv66ANT0Mn/Q8jQDHSnL7g=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Mt9l/Myo/fPFInoeG5OcFw+YvafWaxEY5Pa7+tDSu77fett9uT3SdtQNvGrXSZaNc 6nEAjZOgyCspyfR9Hd/nS4aT1VCimvw9YXYkoR+vvtnXPggXVpNas3pRAt+h577olf +mDPkMQL3QS4CNRR+fV7VU4yNA2W335ivulc1e/s= 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 1Mplbx-1oOq7D0eXV-00q8Zh; Tue, 29 Mar 2022 21:43:46 +0200 From: Pierre Langlois Date: Tue, 29 Mar 2022 20:43:16 +0100 Message-Id: <20220329194318.6106-26-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220329194318.6106-1-pierre.langlois@gmx.com> References: <877d9s2qa9.fsf@gmx.com> <20220329194318.6106-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:jN/TM8HsYLxGnXzaxcleU1IQTTDhIYS+psEqT1tMWM+su6f72z0 N/ULHSSjlsxerQV7oFK4tVkXvsHNaPCQdagtDTI29V0tgnN0oxjyaygPwqRL+6iWehKj54S 5a17vtGfa5IRP/Rm4I6qdTKlJWFkIH6pMsh2HC2+iJWGtQRYo5BwTc3K9eGPAqMjhYHRgvj qCPnifRQoDeni3hN/7CTA== X-UI-Out-Filterresults: notjunk:1;V03:K0:JgJz8NEqWYk=:HZ/cmy2gqhJNkjI0l+p8KV OwtWkaFNQsPOgmHC7rS6r8kopVI+LdQlxZw1z6ViEITiMTfBlHurmuvWHIfm5424A3fV9fUpN 3GjonI5mky8NSSHZsZXa3wocmgx6iVf4xRpTD5lAsaC+JyrZpCgvLvGO/5kyi40BhMGFp2o4F Cb3mIe3JkkZUYQpYKGs/CvITd7Uu9m5o/tlgHlPxh4/ONn5xRpPVCJd5ojDnBKATnRby/dh3d Th0ps+xm4bBUjLUYR9yBIBNJeecTE7+WYGmgZouoUqaFSXUfYuyUfXIu+hAMc7Y+fhXmfVdQ5 101LiFjhkrnZWgQPQ7LRoBnO94b1CabDies7o2Pak/aGhbXPVwZ/qL8gwAKh0OuU0ycnShGoM Yi6TyiWnABFJBeKGk/DU6oILUGjNGK/miL7xSehZ4EGZ8RkQKY58nyECyztc96NBz7uk/gAYY QFIss58R1EYdkcMt/hwx7eEOqTaBBVOXmoTjhSILUGs4s2Bbxd9QRZsR9jOWfgTiRRo3MqRGP FTKSo3L5FfQ8eMdGQEZR5468HCNvxDr3DPw675mGtMD7wvUT3lTLFNSSBO2EtrATpTbAFcXH2 hMMs5g/waa1P/krA4U1Bbmm4JZuaILy5JnYrcJOjlRFdW2o0Kid6mzbTV8Iv12WNE4M7vH+rw P96wVw2j/JEfVQK4+5k94umcmyGLdssC0O9q64CbVbY290HU8WFVM1HqpsT3cr+XCS1AHnplJ 0MUAwPE4hTbyg8yprHjMJmr+Brb7yBpaAoEjrh7NDq3vmNCONvBfHZdpIwgGHKXymqK3aa48B mOhmH5mOr/3FWcbhf48IFa3YkaZQfMlWf63TYd4GOtGIg7OtZePgI0UmEp06+OHYddoe7cleA WUGdGYb4IgbFvJCGzC1VBUr7XrymC2y0c35pEHoPXWMDUv85CpGBkW9ExMJj4iLHA6PNxYXY2 ECURaRN7rL1PTpukpjLh4T5eagVHIlAeAFJM0n3R5cMU/Nk2dgGAd9UngS2Z3MoyelhsPPWPK PS2YeXP9+HjqXbts1k29m6ArKF89DKlIoyLPQaaaFbmHqfSQT+BL4najJ+4ouQyPDefJQ6zvM 1+rBTnVKQ+ACaU= 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=1648583369; 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=KTNLUnL5T53tAkFaeCLIk3Oemja5KOYL0l31ISACDOU=; b=HYpayKPXj/rLdZMuh6Bex3OfpLI7tpzkR6FgFsKU6m/0XbJ+TrDy/oMtqOA9NjuNc/uJG4 BWmbFdqTQYRvqPUPs+Q7KantyfEQY1vrKEs974u4kNh4iYGjFvpDn9bGXiD6/GL1Ryos1g yvPytZx6PyjjnGx8yRnHpK+k1a2jP7HFajpu8aNb06wGQQUVaMdo8wzRxv+gcSZMhaxtbS YJv/JwCEp8mK2aGYTUBrzcdxdjjrR10R3yN5jBIPVVe3njxSjMknlu1kUjHGY5B6MZz8P7 xeHm79R6RK59WS7M1Y7WOfqUXZXWa5ve0Q8NBv5tY1CuAe4Wc1jMYaoMv9NVJQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1648583369; a=rsa-sha256; cv=none; b=ZQPRNWnx2ivRtflZpR7rNxTxiHCud7utd0xawfBP1kkme7jEOonyCpY3J2VHMcLcmnKMvy /wUpAl7fXAZly5MLkUd0e3gLUz1PSGTWpcq+MwEeIbrL1vaB8SCkh5Xo4t2T+HrmL3vKU/ ygs7ThF/85Vula4PG0JSv+I8nWMcK4qzI3B/4JpGj8uaoULeAIW6OI96d30mHGFq7YYaf8 ANMrEeIun5sqChIHTWTSsZ5n3lhnrlZ00Q4rxdb86CarNRjGkM/OgtkhoQ91VwrH8thrno a8XvKIBnINHWELINJaJ8c3FBiJNNHfyjwQEQgzJbIUxanhVSJIivQmafJCKbsg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b="Mt9l/Myo"; 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: 6.63 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b="Mt9l/Myo"; 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: 2FD812992F X-Spam-Score: 6.63 X-Migadu-Scanner: scn0.migadu.com X-TUID: XgOMBTorkVJI * 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 | 78 ++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 5209876431..fb3d13b3c7 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) @@ -688,3 +689,80 @@ (define-public tree-sitter-typescript "This package provides Typescript and TSX grammars for the Tree-si= tter 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"))= ) + (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 + (list 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 the version number in this file prevents the pa= ckage + ;; from trying to download the module from the internet. + (call-with-output-file (string-append elpa "/DYN-VERSION") + (lambda (port) (display ,version 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.34.0