From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YAhfLnwdgWI77gAAbAwnHQ (envelope-from ) for ; Sun, 15 May 2022 17:34:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id kIszLnwdgWJMawEAauVa8A (envelope-from ) for ; Sun, 15 May 2022 17:34:20 +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 5767124FC8 for ; Sun, 15 May 2022 17:34:20 +0200 (CEST) Received: from localhost ([::1]:53000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqGGA-0003la-RV for larch@yhetil.org; Sun, 15 May 2022 11:34:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqGFu-0003k1-3c for guix-patches@gnu.org; Sun, 15 May 2022 11:34:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56561) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqGFt-0002qc-Pu for guix-patches@gnu.org; Sun, 15 May 2022 11:34:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nqGFt-0008FQ-NV for guix-patches@gnu.org; Sun, 15 May 2022 11:34:01 -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: Sun, 15 May 2022 15:34:01 +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.165262880331660 (code B ref 49946); Sun, 15 May 2022 15:34:01 +0000 Received: (at 49946) by debbugs.gnu.org; 15 May 2022 15:33:23 +0000 Received: from localhost ([127.0.0.1]:50458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqGFG-0008EY-Nj for submit@debbugs.gnu.org; Sun, 15 May 2022 11:33:23 -0400 Received: from mout.gmx.net ([212.227.17.22]:44345) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nqGFD-0008EL-Vb for 49946@debbugs.gnu.org; Sun, 15 May 2022 11:33:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1652628793; bh=mPXL+UX3fAupcpwH5V5NwNW6tUmLhysuXphWhOjoWx8=; h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to; b=VooIYaBYaTK8ttlbrHfbmps3+V1kBH+U89/0+An2DVX/fYYGIyrbOFYt8FiwBl9Tp c0HqKwRgI4kOPQq4h9715XIC1OteXPMFJrOZdGr/BhM7nyM7euCw4dxiQzi7QCV5ec RYQlP2mNvLFWNtayinP6HbrI85l7WgKo7by4Doqw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MHoRK-1o57nz25oM-00Ewu3; Sun, 15 May 2022 17:33:13 +0200 References: <877d9s2qa9.fsf@gmx.com> <20220329194318.6106-1-pierre.langlois@gmx.com> <20220329194318.6106-26-pierre.langlois@gmx.com> User-agent: mu4e 1.6.10; emacs 28.1 From: Pierre Langlois Date: Sun, 15 May 2022 16:22:31 +0100 In-reply-to: <20220329194318.6106-26-pierre.langlois@gmx.com> Message-ID: <87o7zy24lm.fsf@gmx.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Provags-ID: V03:K1:1pFs3lUs9EOmiESS/clSUkDLd2UmoDnWUwmHyCAJjfvTOnFOBdK rB1mZvy3Ihu4wNQbk6cygYiOkXgXHUhAvB85KuFYILEzHLP1wsw2S9T2uoiD1FTe2udDW0j M4JsCazOy2MqQ1q9wV1DoYkx5VSo8RxMj3WjpeiOeNVpvGdMHabpbQCqPGH2MHMdwF0hSCx SRBybpP+1HzDMrYi1MHFw== X-UI-Out-Filterresults: notjunk:1;V03:K0:P1310ly+KSw=:G5vSqJw6fnyjRz2mi8002A qVDmASTwgi4B+ukjUEGkWVPzJv/PKGgrt20Y1NOHRVvZr0y9YHPuuStG8vQmiw3GYjJwEFERk eNiFjzCP9R5sGgkfnCqWyY7hg3qhW/YsSb0yJ7p2nDc88incIH87hl+N7KMVpV1787C7K24M+ RsntxEU9WRIi/LUTPgbdzXsuVaZgOhTtCmv21//rbYCS2k25pNirdW9tWwoha6r8wAO+f9AA1 AH02xH+P96JdJgFAGYDSjw6OCWG3me6mry68ioeQrVEwTBvba7vUDRcEMoXBwGNuEls6EhEng CRrG8vIt9B18vJZ6kCeHbrlEHubg/W+mIv4RIzv1RSVWg0jWod0eXH+PsKhvbgsi3c+QlOgtC gbsb8+0rwIsx/mNdpA7IP94lSGRBYdl+n/1llBjrRUyngySvc+3/MhwFyg20I5NzEMP2Aca3S wE8Cc7k4OT0cLWpSD08otZt5bByuI2zqVtIJkEl4vJkH02KxJcm2k9WkCHsYyddEkOHuDUu2f v379kn9pwC14aVBpdWvr0AZQaUnriuC26n99UYUiDzQARPWXgBbxJK4ZyBflwneo68R3Cxe1J HHNsfk8HLBUaQ4K8dWVQvI5IFKDZs8JQUePIAXQTgkcSHQVYsqqC1rX1korrCk8n+ZeHUj+dN EwXzv/6aEQsnYP/wcIfzFCFS93xIaO01pYTIoLXEZlV479ZqEwIZv2L+1NfDXFuvGRV+0+S8q TVz66hFLIxbUDKBq9O+9R2i9FzTtb5WOk5Hl8EV5fM6SD51WtbrOPalECVgGkVeSB5mvSnjG4 A39n8JakTnTus9sII2+HS/T+2dQ6dRig6Vb2uJQxN4IApCSM9D4KSVrthtwFfs8Sl6gK5F+y7 YQ2lctBpZWLeZ5Xtaff6xGvW0hojbiiSvznLsEC62t34KHgKJNSbOVq5pCjbEn4bCeiZ1NiXw VLol6+UNyE1cofBAY7I7YEIc+6Tt/KC2FrCAHbwr5158LieTvqUTk9jOPH5ayHAqcmIA+5wGt NIe63cBJtgyHixnjJ1Y5lclUHUDPDjPRMIdEGPvHHp93ap2l0EdtSXJ8c9KYY2NLaOVMwtrq5 C2HYiua3wXq+eQ= 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=1652628860; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: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=s62zARVpxja7pTJYzKrvS6Cyv4rMQI7MrtbfZPX1EqA=; b=cDjMrZ2rFCTIvzwad7JGRkyc8REgtoqqvobXNRmwXfSdtNrpV25POjzPcUjfM9XDGDWG45 PkMWT1gX04w3wqAZvoDbe71fZzusFjFiWzhnPYVNH7jveqRSc3lQS3rvLTbXEhd1nZ1WBq N1D38oCGHrP80gTQoG8TCGgIlaEYaeHsHSxGY/aL5y+95KlApiMbk0WpGD8X8070QWxw07 l50dh1zPnbId/yABrP56YNFWn1i1vOE6EC1G8Di/S9s0SqFrRZJOlkP7vx0N45oOLB8wY9 QJhZbzNh1xj8TLxyEjeL5uNF6e29tfqbA4cKa3s5hCc3hEcSFMY8bfPRqnxzkw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652628860; a=rsa-sha256; cv=none; b=bjGZrGWdaTgOdgay69zRccqyrvNpx5i6ip2MEV+8u1eQbimHYfgNgTgKBSKHexEPzvgPta BxvklOzws4/4pkHKaaomM8FzVzGoiCSnbD2Aqk9d7ZKjqGOQkPVZEONs/lQQeuDXoK9Fqd lS2m3W36yrOOeb0iWkR/w4sTuCfX1cd7XxslK3X2/gC8fKRzETiXlnBsAPOQaBMkosJxly orxTHjko2dQd8VyQPni6k0NXS0vcZtJwmlmGhWfEpfge1pOILUOw+WfOvuB2oZ9BWxYa5i aXep8v91AdIckwkDhaP4TkS5peGJ6E69XdDgcWIAeqk5AmClki4wyp+kc7rYhw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=VooIYaBY; 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: 3.77 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=VooIYaBY; 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: 5767124FC8 X-Spam-Score: 3.77 X-Migadu-Scanner: scn0.migadu.com X-TUID: sLDubnA7UYuV --=-=-= Content-Type: text/plain Pierre Langlois writes: > * gnu/packages/tree-sitter.scm (tree-sitter-emacs-module): New local variable. > (emacs-tree-sitter-core): New variable. > --- > 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 > --- 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-sitter > 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 = .*") "")))) > + (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 package > + ;; 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 "\""))) note to self: We can use emacs-subsitute-variables here. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmKBHTUYHHBpZXJyZS5s YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UaMAH/Au2klug6iBs0luGllQavrBs zIFwaDek1AvCzkm4RmH0TSxNf1ScrLIFuxjaaFo8BpSFbwwVScy7AZIUQC144Rc3 o0g4IaHVaiBjH6Q0gX6pBVWcNTeKkqjv5SuoFNjJnk12kePcPoslHraRXQ+I+rBL EapYY/8jUnP+/p8qO97XOyZs33IFiH8HH6+wxY6Xll5xjfrLF6A/28x+clSGtq0Y skMFqUmEank5128VDzzEjQFTyRIqPor5y2ICRkRhAilP9xvFn9K2e5mHiBAMNV4c RmGuxjYudeph6V//NwGOJMh/vv9+Fcx2SMzNwetSA5b33Q6edI/K1qksfzB7jLQ= =Nw7b -----END PGP SIGNATURE----- --=-=-=--