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 qa9FGz5qEGFhJAEAgWs5BA (envelope-from ) for ; Mon, 09 Aug 2021 01:35:26 +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 ECQ4Fj5qEGEWEwAAB5/wlQ (envelope-from ) for ; Sun, 08 Aug 2021 23:35:26 +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 0B7F4D1B9 for ; Mon, 9 Aug 2021 01:35:26 +0200 (CEST) Received: from localhost ([::1]:41972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCsKD-0008Oe-0u for larch@yhetil.org; Sun, 08 Aug 2021 19:35:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCsJu-0007qN-VJ for guix-patches@gnu.org; Sun, 08 Aug 2021 19:35:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43467) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mCsJu-00064N-OT for guix-patches@gnu.org; Sun, 08 Aug 2021 19:35:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mCsJu-0000vD-M2 for guix-patches@gnu.org; Sun, 08 Aug 2021 19:35:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH 11/31] gnu: Add tree-sitter-c. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 08 Aug 2021 23:35:06 +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.16284656753368 (code B ref 49946); Sun, 08 Aug 2021 23:35:06 +0000 Received: (at 49946) by debbugs.gnu.org; 8 Aug 2021 23:34:35 +0000 Received: from localhost ([127.0.0.1]:54985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCsJP-0000sA-0g for submit@debbugs.gnu.org; Sun, 08 Aug 2021 19:34:35 -0400 Received: from mout.gmx.net ([212.227.17.20]:33727) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mCsJG-0000p2-8u for 49946@debbugs.gnu.org; Sun, 08 Aug 2021 19:34:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628465660; bh=Bn/ZfJ1pMr7RtZSRK/RQa5qPa1DQ/pNKmpSA/pOMIsY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=YOhQ2GA3zXfjvLsA0msfCD3W7AJtaA/rUlBS5ZoEANIp3zOmHjGhR7PZOjpcKMHNW qbhvARzthkgTkY2pldeOUQy4uaFKt6qCKk2VjnBDufJ/s9rnYfi8jtN857kVTzz+u+ ruV4TWkrZ/Vv48/ssd4XaiiEBAL147u0P+Yu7cjc= 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 1MNKlu-1mSlWg1rZK-00Oogp; Mon, 09 Aug 2021 01:34:20 +0200 From: Pierre Langlois Date: Mon, 9 Aug 2021 00:33:34 +0100 Message-Id: <20210808233354.6745-11-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210808233354.6745-1-pierre.langlois@gmx.com> References: <87h7fztt60.fsf@gmx.com> <20210808233354.6745-1-pierre.langlois@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:DshNbg/inGyMHopiW2vQGA+kfKPDjgNZYevtXonudnoMNiu5R8R 9fKMN7EWLHqgYcIiQLMRnlsSNIuZE7SsPxUkAzZuvkJyh23Uj9W25S04oVSwfsIzS7y5+RO 5LEFx9D6d4KfRzJ8lQfMsLYfn3lrovA5UjnZkIsGADhekU8Bg+sVYEEpkFiLJStaJzVGvCY 7oxdwv1ngCpm0QZyaWU7Q== X-UI-Out-Filterresults: notjunk:1;V03:K0:jkq+sfHkCz8=:5GfvNC9JI2ckVtnAk/gsQ8 z+CVW23doos62rcD1W4ulBDsPK35IwXIT6q4HwX86p/RYAZ328cT50HF5ZXw7Ssu3Pk5msvjS PT1A/QtGtkzoxJiaBm02T/n2yIHtB9Ez1ieqfRqrkgTOG0HUozoPKS7z3UxmiBGxLrUiDK50E sTOvmN66bveKU8cIOLaAKTQBaYyk2+l7BF1mbotAVlU66XqHLRCqBysOJrSKIY6YOJMim4ZeG y4Heb7BPgjCBFg18SIhedVZA/5HToPDyMoU2t7eHkBhPLUJb/WnKbfysm8opgrwkyKgvsj0Ir 29XSc0vrWnO0vIxqle3HPmCxgYQqxuqaZyTtYAxWpR4itNv8HyWsGAwDSdsXgcXN2nGUvCIbZ Nlvza3Mq6GkD5Kpdse5Ibl0a7Up6abY8zV9cpztu/5qSD3ne36zpvawK6R9W6xPtFrSVw1FpL VCcV9Nxybhk6BDMnJMFC9rGbG38fA89NoXheGoLkCrrtAdSCd/eamqoEokBWEDKZluElhA16R DuRYgFkPWl/eHzrUKje8TE/pobf2pteQvnjeTOcRWkie2y77XY/8qMNGzAIHyejURH6fh78rz VNvLCl6+GuiPs0jbCHn6ypSZARbR1VyQ56EHCO50kydnpDf+rg9kLADzqMdxbI7CK4eC/KYW8 mts7xyv0rsNERm+rbNLzFGh9XwyTSLoMDLgZhLX19psEOhaTjRo9EyzC+7YvhzeC8FIpy7I/x biVNc218CDhjHZyhnxWrx/f7Rs1BW1LjFpaOS/XekLvGw8HKV6iQit+7gbGChd0VS1tampJ2i TxNThDKxCfiT7S9s0fxP3OzIiP3WX2aOV2rftXp62okWL4RKfDE5A6FOiogLheWNpaILwY06w sZSuTL5bPB5sRx106cMzuZ/1BBRg8EDp6tathx5rNbYrHhXvnyLH3+E3QE+ACyELnDd2LyS/i 4DCa7pbxa9ZS/+QWFrIdpmDQRwroDBVy7fpobYW1DziRzw7SePGsUvhWDszZQfnvrA+TfI9go 9oPiz2UdQlCw+Ubqiggtr8WuLzqGnbnoEWnvwQ4VL6uuGMesfFHJJXKkEUkizF9QtCuqJa95t oVm69xcTB1zJPEFE3iISgbdqzD8xhSFrERYItkFxmzO5ee6gzCb/ft1Yg== 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=1628465726; 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=w7JatxZKeO3b2YvxgE+dFtNgmM1hBIM+kHhYrkP583U=; b=P+RtDv8pr8H3BF8NspSzzQ7Jpg6eSpJuNpHZErDV6ApKsXtQ5GeXqZT9BphhZir9n1hoxc 4S/DFXTODwh1eb4vtqVy4sHS9778BprsGgIE7xUbyRGhkfg5TKuYEksDIsp9CWzq2zHDrc W6OXjjz6Ll4dPm8xJo5wA39agbXWf2JXeQbGe8I8kdMQ9MDF0eACFbB8PmUOKICllTTVdY 1tnQyywToXbQ7piXqxrUsSMOUvzxlT6ftLGdldMaWYXJnsgI3NZ56/lmQfcn/TZ5GKBHO2 miGlihdDetzluay5phlTD2k2OxxySIHHl98fSDLUevSrhIMBrU/OUF0kxtVIFQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628465726; a=rsa-sha256; cv=none; b=TDkCTjDQUvpVGqqOhIaFlB5WAppP7JzUeQtdXQPc+vLUXhO/OiBI8xkaO33d7/UhAXsd83 3V9Y4WutcBOFsf1bEsHQeFNedR2xt9NeOsWxRLuKXEqbKRpLPJDTbedjYPOB+3Dzz07Z98 R1B21vspnntN5E+Zoil2O4BC+3ZxeRPrpfhZqSmWaShDxAIAf7rZ5z7x6ccdDn79GScnfq si10oh4/W5lnGTVeWeerXYlj0BgR+gtOyEEfyIi9VVnh2LNaDV13sjsRtX/PtiO/i2L0vc jWL0ZXOVOxnA6VVToxOo29DDZDR3ELiLh5LbVNn3SGF2/li18PQ0wR27yUE4iA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=YOhQ2GA3; 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.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmx.net header.s=badeba3b8450 header.b=YOhQ2GA3; 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: 0B7F4D1B9 X-Spam-Score: 2.19 X-Migadu-Scanner: scn1.migadu.com X-TUID: fpb5ipwqJOF2 * 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 2c749dc0a8..c855cba347 100644 =2D-- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -19,10 +19,12 @@ (define-module (gnu packages tree-sitter) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system cargo) + #:use-module (guix build-system node) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (gnu packages crates-io) - #:use-module (gnu packages crates-graphics)) + #:use-module (gnu packages crates-graphics) + #:use-module (gnu packages node-xyz)) (define-public tree-sitter (package @@ -96,3 +98,62 @@ can be embedded in any application. This package includes the @command{tree-sitter} tool as well as the runti= me library.") (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" ,tree-sitter) + ("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" "gcc"))) + (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.32.0