From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gD6yDD6xD2L5uQAAgWs5BA (envelope-from ) for ; Fri, 18 Feb 2022 15:46:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +JgFCj6xD2KsJgEA9RJhRA (envelope-from ) for ; Fri, 18 Feb 2022 15:46:22 +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 78A2025A23 for ; Fri, 18 Feb 2022 15:46:21 +0100 (CET) Received: from localhost ([::1]:36888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nL4Wa-00022M-EN for larch@yhetil.org; Fri, 18 Feb 2022 09:46:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nL4Ra-0005jb-Cz for guix-patches@gnu.org; Fri, 18 Feb 2022 09:41:10 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59937) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nL4Ra-0005UT-1l for guix-patches@gnu.org; Fri, 18 Feb 2022 09:41:10 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nL4Ra-00004w-0c for guix-patches@gnu.org; Fri, 18 Feb 2022 09:41:10 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v4 29/31] gnu: Add emacs-tree-sitter-core. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Feb 2022 14:41:09 +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.164519524432589 (code B ref 49946); Fri, 18 Feb 2022 14:41:09 +0000 Received: (at 49946) by debbugs.gnu.org; 18 Feb 2022 14:40:44 +0000 Received: from localhost ([127.0.0.1]:53814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL4RA-0008TT-D3 for submit@debbugs.gnu.org; Fri, 18 Feb 2022 09:40:44 -0500 Received: from mout.gmx.net ([212.227.17.20]:46321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL4Qb-0008Oj-1W for 49946@debbugs.gnu.org; Fri, 18 Feb 2022 09:40:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645195203; bh=cukqLcW6uKn3dPWx96V13WQFcXG12qWspdYi4xGzZJA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=NR/0FHex2OGX8JS7GaFsyLh1qMpRZ6+psT2r/mSq3KdFygj8t91QSsig6oIB5e1jC Zqc+7rbBHrdh0uFA8PRFQcmyw4mwXT43BFLkKKFcrsQSiv8Dv8zRfsSfiGlFpB8IHX kwkttkb459/lOwrG6o39KxnOOO4rvyzXH4oEtvys= 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 1MVvPJ-1nk7fS0WG5-00RtGK; Fri, 18 Feb 2022 15:40:03 +0100 From: Pierre Langlois Date: Fri, 18 Feb 2022 14:39:46 +0000 Message-Id: <20220218143948.28989-29-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220218143948.28989-1-pierre.langlois@gmx.com> References: <877d9s2qa9.fsf@gmx.com> <20220218143948.28989-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:MYZF7sULy9f7dK8yq+UxzRTIGIF/jrw1rlSglA7w/OdCgo0zELl dFe3w240l3CDkT27HPPMfnARsc5F5abfCR/ohf1TWNZ2c5/RjznYnbXg3/RZ2rzhJwYu8Fp 7ykBO24i1RA9zOKdq1Ey8OeJiuEyvLw5jrKLITpnp2WOy4Wowcn/RUztG7ZtBuhLmQSMtFM nLFBqOMX+105qN8eso/Vg== X-UI-Out-Filterresults: notjunk:1;V03:K0:AvfX5kt2c/U=:AdpzBRw1B7pHoby8XWgQrZ /V+YDmkaX+V8oK2T/wRab2yTRDUyQ3ugfPfmKuqcjbGiPCng+HznTI1gW+hvcZ6MqDp4xvsEf gzZpEHm/vHQihkxlSdATUNVirmwBM2GD5b0rY1Ql5Pyldl43O5br5mR3xfTmTwtgFFs6xiZgk KAYoY8Kzw1BTq+xnvRkR5YHzEv1HCm5r0hzH+4ANfsnP5ocW97SScevXyiOppH80Ig/26kWIq Gxue8qzvEd0OLn0Gg5rmeJCjitNoJE2sb0efDuPmQqfYKldKpzWuAiSB314eEkQZAbaBYX9OH j/0m5GoyMxGaIhc47vfemcJrycJdgRfijBMTZx/nSqEZTAWoj65ERkgs4noOrFt5JhW1XmvBz DXLn4manQ2ovaZO6viutCTmHMyGS7WIabxHLB7ooby/OqmVec85RbsKJx00eCw4m3dmHOHIN5 GeXtFecfWPZ8dV4WOw2aLk/K3ctb/1JPrLGFA4Mc93JpNjEFDRVni7S4Zp3zgyatKt6+nk8Cw mJRLsfYJdeahQMxU7twk8x1IT5rxWfDCkmYIS0FIKkfUJ5Rmv/Jxv/bIDMkAhiAl6hLj3jFqE u4Iu/SIDHHVw54vdwKUAdAgugeqnDa0LBMPLDzbhxuOYC9OXkNvIloMuk2YtZXqdG1iHPvw2x K1nOBJ91JVvidU273kVSab4j59XOEVyVq1lse5cn69G53/GUhdtY+Q/5OzY+s5U61V5lpervE G8/MWYrlEEN5zOX9ggdtLixW186rID+7fA3+CCUxkk0qQQMqNz4uQPz2Lbkpy5bNvvZgEjhNp 9WngKbmiIbtq0uf4Cu8B8xrNYEbwvVUw6nDi//p4YFgQ9lzPuj3KtSEPY1iQkaFkWjhlRx4AU LGZA1R/ZCZLKnNF+oNOPGhFMVfExo1kJ4z4mMLFmPIN0ZeH0s6SwaZTLLTB6mV3Wto1BWAyxK 0qH+16PbVR+Vd8VbhEI/peTMf8Qt+qBpEHIzygk7XylDAsDt6HMGLL8KjpYPy4r2AJCo/NuSL QyCz6Nqfbi4bQhtFfKmqCi24N2m6HONcMRZ8ErTwd94R10OlnFgQFCJIfFox4eWQGDMpW5OVV Wa/Fplhjpw1PHI= 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645195581; 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=sOGRuNNcIt2k3dnjFTWXPx7jcG7byGcCfeEFqItEoO0=; b=Edp2r9ta6f0Tj27I3UHsClJRj23aM/8VDJzwnnNDOWFOP69H2b84tpXRRfZ4rEE1GgJidg FAYNi60q5Ub8YJsm+ZnrByUajByyU+jN1/cNWRG2ZGzAnCOtLHiaCwO91FPya/rRbN8uwN VQk6O53VTKxibbAiyE4w2Y0tSegzKrOZO34kG+c0adYguP9GhY7CiCWDLN/jpRArYzJeYW FpH/odZGe1uT2TZoh/sHYBose9f5M+RMaQAtGCNmQVwVyaAXZihR0ofVLQUp3dJoTsM9IY /H7jiLB2FRxwfvVjpbIqyUn77rQyXZjUFnnXpyQA/kYLoEwCnf674nKJOdHDKQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645195581; a=rsa-sha256; cv=none; b=d0DE/PomIMmuSKPoe6RRN55AJnztmlF3Z/OE152bZ/a/Pi/lHFfN+PomNB6V/180W9UCrv M564nz/3E8ZtIxKpBRnpTNrFtygN56mw4ZDjq7fKNc3cHiy4h/eyWzHMoyCcvZRuJ4StuM elNAeaEi3Ssc/5ThJl+Qxn3CE4X32Hop1rYUW3zmotMi9wB71ZJ70bMVTmZegYnrNC/Zte mCkA9S0OOcxk+67q+Qg0122XSDB8FmjfyPWrVu8HOdFnkbI8H7GIZyGgldrnjAnL3zYQG5 uX+dnRJqSVIpX1I8XfkyxqqesUOAuveW/dTu5ivMPi0gSFK6bf0ll5rurI7uVw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b="NR/0FHex"; 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: -1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b="NR/0FHex"; 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: 78A2025A23 X-Spam-Score: -1.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: HiNImLSiCMYc * 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 3c8b4588c4..e2af7cff5a 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -20,6 +20,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 node) #:use-module (guix download) @@ -845,3 +846,80 @@ (define-public tree-sitter-typescript "This package provides Typescript and TSX grammars for the Tree-s= itter 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