From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AAGbNu9mK2FMcgAAgWs5BA (envelope-from ) for ; Sun, 29 Aug 2021 12:52:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aH8sMu9mK2ErKQAAbx9fmQ (envelope-from ) for ; Sun, 29 Aug 2021 10:52:31 +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 8FAFDFABA for ; Sun, 29 Aug 2021 12:52:31 +0200 (CEST) Received: from localhost ([::1]:41124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKIQQ-0007nl-Ja for larch@yhetil.org; Sun, 29 Aug 2021 06:52:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKILK-00067K-IT for guix-patches@gnu.org; Sun, 29 Aug 2021 06:47:18 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44074) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKILK-0001jS-8u for guix-patches@gnu.org; Sun, 29 Aug 2021 06:47:14 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKILK-0000IS-6E for guix-patches@gnu.org; Sun, 29 Aug 2021 06:47:14 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v2 31/33] gnu: Add emacs-tree-sitter-core. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Aug 2021 10:47:14 +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.16302340271023 (code B ref 49946); Sun, 29 Aug 2021 10:47:14 +0000 Received: (at 49946) by debbugs.gnu.org; 29 Aug 2021 10:47:07 +0000 Received: from localhost ([127.0.0.1]:55604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKILD-0000GL-2m for submit@debbugs.gnu.org; Sun, 29 Aug 2021 06:47:07 -0400 Received: from mout.gmx.net ([212.227.17.20]:59067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKIKq-0000BR-G6 for 49946@debbugs.gnu.org; Sun, 29 Aug 2021 06:46:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630233998; bh=ekxmQybdBqyVUVcjavI4JewqbFzZX0D4i05H1DDD9Iw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=VnLCFrlJ1c8snHMG8tGbSZB7i+zKPXO8fQp9PVpLxpPpgi7ghpwsjoynLeEP/nmeG xnO3rrFErLQky8LFd3GruPqsPYQ5vaCZ52F1p7jbpLzySRXbA9sAqGmasVtQF5Lbby DVbeiWTRGs1JwQEMfxMKRnais7b2fnN/EILHyn4U= 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 1Msq6C-1n8y6o2Xou-00tEXt; Sun, 29 Aug 2021 12:46:38 +0200 From: Pierre Langlois Date: Sun, 29 Aug 2021 11:46:06 +0100 Message-Id: <20210829104608.3103-31-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210829104608.3103-1-pierre.langlois@gmx.com> References: <87czpwzg9e.fsf@gmx.com> <20210829104608.3103-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Tp4T2nrZzIkE4Ho59QCwYRGisP1lgY6Lt7s0bZpLyvQWORcUrsP w/9SKClutN49HzJRjebQkx0o02AawfKaLg5xhxHLSASXRRVrHhVbOoD3GAd34zR4tsT+VYL 7b9iitanL/ch1R7XEgC+B5b1M3IENAoySd3Az+wTJSB5RVtcP7DjjKfrZpv5BM5s2NvPvIF A2enLC4sl3Awjj24ZeOfQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:yq6sdGMPA6Y=:eo2kdBVixVECXKfh6wbCzV XiWz2iKJ2nSOtL4Aecfd9X/eEdaNh9Q66IDzz2XkO+sWC16GUSvkpeRiDxSS4HWJYFnIiJk6f E1DSOwJqUX1xYun4k4RL/bsFtZRzGwRQGnW0uWJZGDkp7tTN8N/iiYBghmqRsXLv+Kjq2sUIn +CC4Rj25NK40qRsr8PMDhDAz4bKq2NQ1EkQlATLss3NYKBjE/JyvMsJsM9QUXVf3+EuAyAASk dZX0cGelWSulcHbH+9gO/PX2DIE/ZI+oEdl3igWb8l7mO5Ha77TTESRju68w4yPV/+1viQqzK +3fhks7421rf+vkvCug/vRzfGBUb7BwTHI9mUFbDRCO4YYqH+Qb2SJSBvHOQUyX8WerlekXmK bMvq5QrAzecAMMSgLCV6A9GwgoyTDIRy9QZ0lYq0H4v2Of/IvSRwgV3cYGuSWQ66LlGEMxhM/ TKxJCFhUzY1ZjvdvdlW0GiWd+h19jpDPruXMbDTVLVZ7agdxIntEr6GW7pcK18akLHEgUb7Mu CTKtrFM6cTBZt3SuS7WpY8VwwXAtRqC9OnPIKKL9MP6BgNsH9NObXLJ2X3OYYPRQHmkFeppIE G2BB0YXW9RkMB6/2FjdrQioy81CtLdLozkSZuM8lBd6UrymEupNaYO/HPyllY9BE1nrB/SmH4 sBhHafUowEcqnLIvHq25DZ5unyaXFKf2RpSXsG73EMEbc6QDqjIAdbr5NvhiMt1mEybWqlIBp aJ3gON8BvK8Q0FWwpT4F376i3cu+sm9fUxDsJDzohahrfr83YDEFlSpD/LTlZ3gGyt0/QVCai D1uwN+YoieRsAdeFr0IhOMAGbkIpJdsjGZYETTybHftjeMGoqWJ9xaky3bCilu9FeimkCCr4B o3nT1o5tMlr24rB3ctm5Wdg4y1Oo5T/b5M0IJUWlNr/F4fSccki/uwW8JXjHb+/o1e6JbRDnu pE2eVh/4B3/ssWz30dtraeWnANI6StmrEUH26iRx3CIhEiJFB6jSlwR+7dxFQ/KfMy9koLtgn ukq/uEi0NJKaKoJjHGKX3MkeQMyLJalfxKxTQYfeTasQeV0m8HjV6dYSMgJYBXWnns2RJkkWP 6+m/a5dJ+FwVRxAusq1JXVWBV6vVyrj3GeH38y+ykzZkopuX7jeHxqjfw== 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=1630234351; 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=AIcdCF7/QQn5PmeiW9Q9FSfST+0PTKJYX+fRm83NJ7w=; b=Q42qf/HNPqGYjRo7L1aDcpMxHvgwDHikU5uxRDEnR+hhAVq++BOhm+nLIE/GrAXW/SRYyA 2ZXphyatJYcYK8hN4TqnCswpUEWH1VhkrBAEECtAxSJR/heWCfqgHtshLSxZuqAkV/IDAT scbL5zPwglkhLezlp1TnJGBMFHcuw8ux6W6a3v48vkAhfMy4FjndSvB7JFNb4UwemWsdaF LuXl2+0f5HcDSlxymRkdslVqgZYKHIA4+ZHVtcHUjlzxWgmsQyoQey5mJRTMQYjWpnAEwu YnezYaYQ8zPAYA7i8lAs8gKO49UOifLxywsIP9RN1zCiu1NV4poocY7Jqpfu/A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630234351; a=rsa-sha256; cv=none; b=DeDvju3h6IaMI/sP209C2XYPKv43o8HRBMYLMoC1/yoX7sf39Vepbs4K012y+UqXmkY1h2 ktHqaVQQBqLp18n2yf6bsrcSMRoZ7FDPr1nDTUC/1ZCdLa1EpJfBraX5NcCA/FWMacQ7n6 s4wWlrasvr6sYoy9Y3YwSATZo9mIvPBpJMsz8I7+2sIXqFs6Qckw78qRAmAqYDPNvius+b zzpiYr71dNX/nY/hyuCE/Nil13Dt+ZRvLu67ak/hl5m78XMslzpOlUQvfFI+SyCQP91gQV rwD1rExrxkeOFXNu8o/662YHb2RoXP+ZAn528jgmIw52GXBt0Gz5XC5CHTGMmA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=VnLCFrlJ; 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.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=VnLCFrlJ; 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: 8FAFDFABA X-Spam-Score: 2.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: asoB7DsQPvo/ * 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 3357fce4a5..13f7a63acc 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 gnu) #:use-module (guix build-system node) #:use-module (guix download) @@ -28,6 +29,7 @@ #:use-module (gnu packages algebra) #:use-module (gnu packages crates-graphics) #:use-module (gnu packages crates-io) + #:use-module (gnu packages llvm) #:use-module (gnu packages node-xyz)) (define-public tree-sitter @@ -603,3 +605,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.33.0