From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0F7IOkJnK2EmdAAAgWs5BA (envelope-from ) for ; Sun, 29 Aug 2021 12:53:54 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id oDBsNkJnK2EjHwAAB5/wlQ (envelope-from ) for ; Sun, 29 Aug 2021 10:53:54 +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 9341550EA for ; Sun, 29 Aug 2021 12:53:54 +0200 (CEST) Received: from localhost ([::1]:44510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKIRl-0001mU-Jm for larch@yhetil.org; Sun, 29 Aug 2021 06:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKILH-000679-EY for guix-patches@gnu.org; Sun, 29 Aug 2021 06:47:15 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKILG-0001gY-RC for guix-patches@gnu.org; Sun, 29 Aug 2021 06:47:11 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKILG-0000HV-PH for guix-patches@gnu.org; Sun, 29 Aug 2021 06:47:10 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v2 12/33] gnu: Add tree-sitter-c. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 29 Aug 2021 10:47:10 +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.1630234024935 (code B ref 49946); Sun, 29 Aug 2021 10:47:10 +0000 Received: (at 49946) by debbugs.gnu.org; 29 Aug 2021 10:47:04 +0000 Received: from localhost ([127.0.0.1]:55583 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKIL9-0000En-Ed for submit@debbugs.gnu.org; Sun, 29 Aug 2021 06:47:03 -0400 Received: from mout.gmx.net ([212.227.17.22]:39841) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKIKl-0000AJ-6Y for 49946@debbugs.gnu.org; Sun, 29 Aug 2021 06:46:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630233992; bh=DSoJwaIBQi5yJ8i2s90mTQ96yHRoG2wAxhHJ8eocWqM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=dmUE3MNDuL95M82f7aKPr58/bfs6spvbvAJcHszOR8SrFr+B4Ef5NulEPn0iw7PGa wI7p7qSUXR3Zn3rNfgEmQt9RCLpY3hwCqoDvQlD/24Ykkf+pF6hIGm1IjqR2vvQLyH 827UoDealNFqz0apjakNkXPWOwulQCBwnairopG8= 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 1MulmF-1nAKt9176x-00rqnd; Sun, 29 Aug 2021 12:46:32 +0200 From: Pierre Langlois Date: Sun, 29 Aug 2021 11:45:47 +0100 Message-Id: <20210829104608.3103-12-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:ZAXptjxI7eeP8gQ/T4vK/mVdZb8sENma7UVrionjj6vkjUwGHLP l8KJz0f0tzj8slVTeNk3Lb4Pxx1w6OYbBDqLlmrMPIsYIUT8BGm/sxreK2YAhPP2kwL2YES cFlT9HHKOopWG8+4IktSzmn9i3x57DZMw+sGSoOKQzq0qdxyDm4bEYoW6xNpd8WyUS8mR+R O1z1as8fuHJfnivhuepnw== X-UI-Out-Filterresults: notjunk:1;V03:K0:jRo8doZA86o=:+hKxO57hE6NM9a9U344RLe /Wv4C+x1xi+pPe2tWzDv4bbqrTVAVlefTogQrbblrQHH36WZDMolNS5ps0vA4pfZGtqymz7Kz J5gKMOlfo74Y5T+1WzEo4y6F1jxLUib5Grl8gBNuZownon75ftp6YBMAdN3NF2XkshtmlrHG/ hT0KX3ugXFQyIHKtHKSr99d84BAMHaRIfHB/cME9MuTomTqrrrQYAabPs4ioMBeI01LFIpM3N k5igJjVYT8RCojIVi57kMx51FmWYuo/vp7R5iJURUNQ7NyIwue2tkBVEDAZr2kKh3OTyudGQM 8LJsGFEYhrAzOBz6O7aaZLMOOI7jCLn+CbJwDz96Va5tJWVtjN5bNOhX15QGciP+rWn1+ck2D vRHDon5n/bsoMvTP8eobKyXRJKYOfUr7H7uzZ5jYLDFSl/Zsvf+04NuOyFCnkLU4RTc8FEMrE DmAjRHjErWDJd6xj4amXOYrqRRvtRm99+aBzWySgm5Y6JoLL1mQjXteH76ekBOi2+9gXR27k1 Y0to6NpqqmmZGSFE51IBwpiivrbxtq/lpiZt3qwTAL9CKbLDf0JRuK48ZZm3mkkGcpYbHJ2B2 tDXNg0Vtq6nSsN+0ToXrsVQ6JuG9QEWs1TeCS9nCbQWU4AW+e055pvcU0ea59rvlt3ZkIZ2ay Gq+5IF9X3Sy9mkZBEuxhEHNcmphPvPmj1kfVdPcvckONhrioDwJ+IKB18zVzBgZPBxc2Jfvk9 iscJG21IgTmk/HdRJAdrQrjVZ2k8p6YH5QcHtIpb9qGHPyFZn8pDJRH8LfjWDHHiA1wKfQ2p1 jVsuRCvtpUyXADb+NMCzlytVbKVx3PGGN4ytq6rF95CjygUIUJgdzIyAwrG8yrQtgKlZTwh46 34hRvFmV6g61aGj7nhXIo/CJHGrbKLF6XLKd47fu+x2B0na5gFdJtr+eYgRyWFU8Epz4o0re4 ddbI1H1EecdtpjiEaRicFZW1kR6obJimXEyNTEZIGIJBU7wK0qxxwwO1V28H5VX+/UJslw2PY FVe+z43dYsizWEH5NIDDwokvQ00KhP+qqdUCDOP5ygq9VmwjgEnmb2+Dvg/i6fFR2Q8058ab5 NFcHZw/oXTQMG+IBfjvOUEE7M3BnNa5hg1x2jTjWpIYVkFvtIfkmaCbkg== 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=1630234434; 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=WOzJEqKkt/HVXVxuuoG2u+jbZIzW5QfvAnycTqw3DgU=; b=sbXG6dY7jEICuiuYDgebp9RnI0ytNCL2hM5QbFTjuWvAIvvlICpDNThfu6PkU6O8tm2fQU kIyau6KhnW2Vl85ZK+qh8Wu5Z2iVltbByzq4BnH0IBPjRG5NaR5/WfgTtJ9UvTTrZgUrpF Vl/KFOleTGBpF6uq+m9rh8FYgpkb1yXlUyRq07pLOsSBvweJC5+Xm/GsnSlUf2N5aG9x06 KKXWSblBFgwrNJjO5kKE2tVs5i0AChcy00jWFNGii78PdpoQz7/0e37IMiHRcXxeZ9TaOm au+g0BYZcNI3SP6KVF09dav7BTqNH4MHwJGun2iwgWYgdVMEFLxHGgkhj6X8LQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630234434; a=rsa-sha256; cv=none; b=b3JQukpjo6EmjxPBKOVI9PxzBvHVw+KrObPmw4q9jEiZLsruANQqkdHEdFvUrnHQvVu5K1 Cp4y4SV19BXGWHplypMtsGulVfRx8nSIgcLW+buRAyIUtswLBUZuPAvIxRa7tTnmXgAAXH 3N0U8vuVgTPYqpwR9BF0cXR6zmpA7SNgXL13ooYNwm1XXdYRgV0252gearvOosuyYJXq1H tF3KWcMYmhIF8HvPWfcYYzNXxgGY/YPON4nqG9Nscb96eo260NLfZIzbxHJgASC6kS18OJ rMATns9uwVIYeFW/tKCTQyeyoKWneqCHIEVh4OteIODG/knDwgyXPxLAzf7HIg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=dmUE3MND; 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-Spam-Score: 2.17 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=dmUE3MND; 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: 9341550EA X-Spam-Score: 2.17 X-Migadu-Scanner: scn0.migadu.com X-TUID: EuIUyK2Jmldv * gnu/packages/tree-sitter.scm (tree-sitter-c): New variable. =2D-- gnu/packages/tree-sitter.scm | 63 +++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index d8d4a305da..bc04a4a5a7 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -20,11 +20,13 @@ #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) + #:use-module (guix build-system node) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages crates-graphics) - #:use-module (gnu packages crates-io)) + #:use-module (gnu packages crates-io) + #:use-module (gnu packages node-xyz)) (define-public tree-sitter (package @@ -130,3 +132,62 @@ can be embedded in any application. This package includes the @command{tree-sitter} command-line tool.") (license license:expat))) + +(define-public tree-sitter-c + (package + (name "tree-sitter-c") + (version "0.19.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tree-sitter/tree-sitter-c") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1diys8yigvhm4ppbmp3a473yxjg2d5lk11y0ay7qprcz7233lakv")))) + (build-system node-build-system) + (native-inputs + `(("tree-sitter-cli" ,tree-sitter-cli) + ("node-nan" ,node-nan))) + (arguments + `(#:phases + (modify-phases %standard-phases + ;; tree-sitter-cli is listed as a Node.js dependency, however th= e + ;; node tree-sitter-cli package is just a wrapper which download= s a + ;; tree-sitter binary, see + ;; https://github.com/tree-sitter/tree-sitter/tree/master/cli/np= m + ;; Instead we remove it as a dependency so that we can use our o= wn + ;; tree-sitter package. + (add-after 'unpack 'fix-configure + (lambda _ + (with-atomic-file-replacement "package.json" + (lambda (in out) + (use-modules ((guix build json))) + (let ((package-meta (read-json in))) + (assoc-remove! (assoc-ref package-meta "devDependencie= s") + "tree-sitter-cli") + (write-json package-meta out)))))) + (add-before 'build 'set-cc + (lambda _ + (setenv "CC" ,(cc-for-target)))) + (add-before 'build 'make-files-writable + (lambda _ + (for-each make-file-writable (find-files "src" ".*")))) + (add-after 'install 'install-native-lib + (lambda* (#:key outputs #:allow-other-keys) + (let ((lib (string-append (assoc-ref outputs "out") + "/lib/tree-sitter"))) + ;; Invoking `tree-sitter test' loads the grammar which + ;; compiles it to a .so binary that we install. + (invoke "tree-sitter" "test") + (mkdir-p lib) + (copy-recursively (string-append (getenv "HOME") + "/.tree-sitter/bin") + lib))))))) + (home-page "https://github.com/tree-sitter/tree-sitter-c") + (synopsis "Tree-sitter C grammar") + (description + "This package provides a C grammar for the Tree-sitter library.") + (license license:expat))) =2D- 2.33.0