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 ms5.migadu.com with LMTPS id KL+0MWB172O7QAEAbAwnHQ (envelope-from ) for ; Fri, 17 Feb 2023 13:38:56 +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 6D/EMWB172MiPwEA9RJhRA (envelope-from ) for ; Fri, 17 Feb 2023 13:38:56 +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 7816929C04 for ; Fri, 17 Feb 2023 13:38:56 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pT009-0003ns-CW; Fri, 17 Feb 2023 07:38:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pT003-0003ez-VE for guix-patches@gnu.org; Fri, 17 Feb 2023 07:38:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pT003-0000zl-Lm for guix-patches@gnu.org; Fri, 17 Feb 2023 07:38:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pT003-0001IT-Hp for guix-patches@gnu.org; Fri, 17 Feb 2023 07:38:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v8 5/7] gnu: Add emacs-tree-sitter-core. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Feb 2023 12:38:03 +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.16766374604894 (code B ref 49946); Fri, 17 Feb 2023 12:38:03 +0000 Received: (at 49946) by debbugs.gnu.org; 17 Feb 2023 12:37:40 +0000 Received: from localhost ([127.0.0.1]:38705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSzzg-0001Gm-1K for submit@debbugs.gnu.org; Fri, 17 Feb 2023 07:37:40 -0500 Received: from mout.gmx.net ([212.227.17.21]:46231) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pSzzX-0001FI-GM for 49946@debbugs.gnu.org; Fri, 17 Feb 2023 07:37:33 -0500 Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1N5mGB-1oUo0c2l5P-017Huj; Fri, 17 Feb 2023 13:37:25 +0100 From: Pierre Langlois Date: Fri, 17 Feb 2023 12:37:20 +0000 Message-Id: <20230217123722.15143-6-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230217123722.15143-1-pierre.langlois@gmx.com> References: <20221125012142.22579-1-pierre.langlois@gmx.com> <20230217123722.15143-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:kqMHkrXCjaKeEDViNS/Ve88rziqhX1+bNq0uBm01oG4CHs+SEDF S1t6rZ/0Jig6rYLi88wGrEVWIqcBb25JHZnHitnOBuqcF0auBwxMLbCV9hqX0MUhMO/UVZc kt2wfalxRESxqJ+qdkCt+DjmlwfbJNwu+pcXBZuwX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vpFb6jwx9Y4tmakZgv/8s= 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1676637536; a=rsa-sha256; cv=none; b=SKg/0yyXD+6bt4mvZZPZIUEo9C5a+kyIo5iXbPlQAJCjloTY3gqsEsbFtica34BvNXJjBw vYD7Z48c8PdNGq7lTd3LiCevn0kUD9ZKwSTt4BHzng39yk1fn9pJ0mHzU8hnfBI1ecD6/w IHqtyVRFLtuBbXegwL6FSv0hearVFnwLOYgcNMshwTQFpD6CvhnRpI0j6WwxfD6TnKml07 zNz3YyxxZVa/VlpijXKu3/jsb6aPOtVUjKye4SB4VC2eGMdCv4xa/CThFQ2RJoKGxazmSH 9RdE90mAtrucF2bV7dXtPCLH0lfEUe9xD464tbwOdtP5TWDlHXK2GsiGHQsC7w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1676637536; 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; bh=i49EpslJM/JWhlt1PfuGKjiaRmMjUQ/sHLJeJqzyzjg=; b=nCmGrzoaXqXG6lJrL4ZTqYXUaHM4uHeMm29Md0RttfFP4EZIvu21tWLzP7lG1SNKEW5eHV Z06f6SexLBe7vaSn0zt8T/PRZhaCPCkw+YhXk1H9Y4/TUNxHyu6p1gxqw6pourm403pA4e qO16OzSEbif6b/pGOvKHwzW7ua0vNYKCS2Z93EbgZmbU7d2lvqDrP8Zop+7g75/+Ohijro z3jgRdtD0zBKf1exVu8UxT9I7HA+zzxpZ6zF7MgZP+YgPoUiEudGEBohh9UOqoM9LG5hKv 5eoKqvdRuDgZxqSQKNbODEbogJjmuFjI4713K6KvNyqw+dK+DZfkw6ws3vsBkw== X-Migadu-Spam-Score: -1.63 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" 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: 7816929C04 X-Migadu-Scanner: scn1.migadu.com X-Spam-Score: -1.63 X-TUID: MD1lDhhcL6bD * gnu/packages/tree-sitter.scm (tree-sitter-emacs-module): New local variable. (emacs-tree-sitter-core): New variable. --- gnu/packages/tree-sitter.scm | 85 ++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index bb9972cb00..12f2d108d9 100644 --- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -29,6 +29,7 @@ (define-module (gnu packages tree-sitter) #:use-module (gnu packages icu4c) #:use-module (gnu packages node) #: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) @@ -538,3 +539,87 @@ (define-public tree-sitter-racket (git-version "0.1.0" revision commit) #:repository-url "https://github.com/6cdh/tree-sitter-racket" #:commit commit))) + +;; 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 + (list + #: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 _ + (let ((lib (string-append #$output "/lib"))) + (mkdir-p lib) + (copy-file "target/release/libtsc_dyn.so" + (string-append lib "/tsc-dyn.so")))))))) + (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 + (list + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "core"))) + (add-before 'install 'find-tsc-dyn + (lambda* (#:key inputs #:allow-other-keys) + (let ((module (search-input-file inputs "/lib/tsc-dyn.so"))) + ;; Install the tsc-dyn module in site-lisp and the current + ;; directory for test to pass. + (install-file module (elpa-directory #$output)) + (copy-file module "tsc-dyn.so") + ;; We replace the tsc-dyn-get.el file with an empty stub to + ;; prevent the code from downloading the module. + (call-with-output-file "tsc-dyn-get.el" + (lambda (port) + (for-each + (lambda (sexp) (write sexp port)) + '((defun tsc-dyn-get-ensure (requested) + nil) + (provide 'tsc-dyn-get))))))))))) + (home-page "https://emacs-tree-sitter.github.io") + (synopsis "Tree-sitter bindings for Emacs Lisp, core library") + (description "This package provides core APIs of the Emacs binding for +Tree-sitter, an incremental parsing system.") + (license license:expat))) -- 2.39.1