From patchwork Mon Feb 17 23:43:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 38801 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1A6F627BBEA; Mon, 17 Feb 2025 23:49:40 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8549A27BBE2 for ; Mon, 17 Feb 2025 23:49:39 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tkArN-0004oU-Sm; Mon, 17 Feb 2025 18:49: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 1tkArK-0004nH-GI for guix-patches@gnu.org; Mon, 17 Feb 2025 18:49:06 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tkArK-0005Eb-6l for guix-patches@gnu.org; Mon, 17 Feb 2025 18:49:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=Vra8WAq1j6qzaPMCDbbdU2NdjSAblGFPm6cIzgyzoZU=; b=uPZAD4vmCUIwSLfCVqos2YozZV261+lic7euovcnbc4F1QYTVFswkoVOv/5ivJr+pP207YA96C06JFSDdDghfYwfFELbZ/4CpK6h2Q+Dc8vaj+6qeJ2uNgtd176mWYmBJZpP8KtKabYvzIk4KX/Gw3kvmXKbx+QYFIxPbHO0pyqKAqyH7E85wdvJwdjx44xXXSu0Vt28sulu8e+O24nPbgNyFismLUyG9eLxFM/6QzI/ye4ij34XF7d1Cu0PJVFVmjAO1+1O7Ejs1Trllt5t46slmqX8Ww6hFTIZ1LIF95r9c7k3U5K5Ex7/YERg+imP6irb48XOjTFxH/pPUNUlHw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tkArJ-0007Q0-Vr for guix-patches@gnu.org; Mon, 17 Feb 2025 18:49:06 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74900] [PATCH v2 6/6] build-system/tree-sitter: Add guile-json extension. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 17 Feb 2025 23:49:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74900 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74900@debbugs.gnu.org Cc: Nicolas Graves , jlicht@fsfe.org, d.khodabakhsh@gmail.com Received: via spool by 74900-submit@debbugs.gnu.org id=B74900.173983613728426 (code B ref 74900); Mon, 17 Feb 2025 23:49:05 +0000 Received: (at 74900) by debbugs.gnu.org; 17 Feb 2025 23:48:57 +0000 Received: from localhost ([127.0.0.1]:51179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tkArA-0007OI-CH for submit@debbugs.gnu.org; Mon, 17 Feb 2025 18:48:57 -0500 Received: from 15.mo584.mail-out.ovh.net ([91.121.62.11]:41615) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tkAqp-0007Lk-Nk for 74900@debbugs.gnu.org; Mon, 17 Feb 2025 18:48:37 -0500 Received: from director3.ghost.mail-out.ovh.net (unknown [10.109.176.110]) by mo584.mail-out.ovh.net (Postfix) with ESMTP id 4YxfVp0Sfdz1T8H for <74900@debbugs.gnu.org>; Mon, 17 Feb 2025 23:48:34 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-6drgp (unknown [10.110.168.167]) by director3.ghost.mail-out.ovh.net (Postfix) with ESMTPS id BA2391FE07; Mon, 17 Feb 2025 23:48:33 +0000 (UTC) Received: from ngraves.fr ([37.59.142.114]) by ghost-submission-5b5ff79f4f-6drgp with ESMTPSA id oyuPJdHKs2dLKwUA2IquHA (envelope-from ); Mon, 17 Feb 2025 23:48:33 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-114S008c8064da6-5d25-4593-afdc-bd86a47d139d, C3652AECFC9F6A3CBC46B0867312B59102225E78) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 90.92.117.144 Date: Tue, 18 Feb 2025 00:43:57 +0100 Message-ID: <20250217234823.10533-7-ngraves@ngraves.fr> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250217234823.10533-1-ngraves@ngraves.fr> References: <20250217234823.10533-1-ngraves@ngraves.fr> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14614743743081079522 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdehleejjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeelffejteeutefhfeekfffffedvudekjeekgfeludeitdfhkeevhfeivdfhffeggeenucfkphepuddvjedrtddrtddruddpledtrdelvddruddujedrudeggedpfeejrdehledrudegvddruddugeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjeegledttdesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheekgegmpdhmohguvgepshhmthhpohhuth DKIM-Signature: a=rsa-sha256; bh=Vra8WAq1j6qzaPMCDbbdU2NdjSAblGFPm6cIzgyzoZU=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1739836114; v=1; b=U+mzLTnOxb7mKVGNy+box/KhYELm/cL5qb2uRnLSpajniOKkm1HwubkSHkTTlqI6WbDxE5SK QGhteFSw/ZphXAnk7izCbjqF3vOkNB3wWnsKTHmYm/Je/nCSQArluy/l8I1O/5xpzbnbK3GoBAz VS2iyemFllO/kJjdjz94YnSHKb+dle1ZFC19OIQvYlaUiz3x29hvzLr6Ml1ASrz9osTCfog/Ol7 7f+5RUW4dJ8iPnycVi8zrEocCohvvT70cxFB1HRCfdOCtogO+lEHNhfKokMcP8x0etFV+yzxN0V /Ur1MuF4QBIxL1qEhIAAYhsk9WweAr5IlQgIuni39E2IQ== 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: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/build-system/tree-sitter.scm (default-guile-json): New variable. (tree-sitter-cross-build, tree-sitter-build): Use guile-json extension. --- guix/build-system/tree-sitter.scm | 101 ++++++++++++++++-------------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/guix/build-system/tree-sitter.scm b/guix/build-system/tree-sitter.scm index 21c4eb35b2..f59a255307 100644 --- a/guix/build-system/tree-sitter.scm +++ b/guix/build-system/tree-sitter.scm @@ -36,6 +36,12 @@ (define %tree-sitter-build-system-modules `((guix build tree-sitter-build-system) ,@%node-build-system-modules)) +(define (default-guile-json) + "Return the default guile-json package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((mod (resolve-interface '(gnu packages guile)))) + (module-ref mod 'guile-json-4))) + (define* (lower name #:key source inputs native-inputs outputs system target #:allow-other-keys @@ -98,26 +104,27 @@ (define* (tree-sitter-build name inputs (outputs '("out" "js")) (search-paths '()) (system (%current-system)) - (guile #f) + (guile-json (default-guile-json)) (imported-modules %tree-sitter-build-system-modules) (modules '((guix build utils) (guix build tree-sitter-build-system)))) (define builder - (with-imported-modules imported-modules - #~(begin - (use-modules #$@(sexp->gexp modules)) - (tree-sitter-build #:name #$name - #:source #+source - #:system #$system - #:phases #$phases - #:tests? #$tests? - #:grammar-directories '#$grammar-directories - #:outputs #$(outputs->gexp outputs) - #:search-paths - '#$(sexp->gexp - (map search-path-specification->sexp - search-paths)) - #:inputs #$(input-tuples->gexp inputs))))) + (with-extensions (list guile-json) + (with-imported-modules imported-modules + #~(begin + (use-modules #$@(sexp->gexp modules)) + (tree-sitter-build #:name #$name + #:source #+source + #:system #$system + #:phases #$phases + #:tests? #$tests? + #:grammar-directories '#$grammar-directories + #:outputs #$(outputs->gexp outputs) + #:search-paths + '#$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:inputs #$(input-tuples->gexp inputs)))))) (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) system #:graft? #f))) @@ -137,6 +144,7 @@ (define* (tree-sitter-cross-build name (search-paths '()) (native-search-paths '()) (system (%current-system)) + (guile-json (default-guile-json)) (build (nix-system->gnu-triplet system)) (imported-modules %tree-sitter-build-system-modules) @@ -144,40 +152,41 @@ (define* (tree-sitter-cross-build name '((guix build utils) (guix build tree-sitter-build-system)))) (define builder - (with-imported-modules imported-modules - #~(begin - (use-modules #$@(sexp->gexp modules)) + (with-extensions (list guile-json) + (with-imported-modules imported-modules + #~(begin + (use-modules #$@(sexp->gexp modules)) - (define %build-host-inputs - #+(input-tuples->gexp build-inputs)) + (define %build-host-inputs + #+(input-tuples->gexp build-inputs)) - (define %build-target-inputs - (append #$(input-tuples->gexp host-inputs) - #+(input-tuples->gexp target-inputs))) + (define %build-target-inputs + (append #$(input-tuples->gexp host-inputs) + #+(input-tuples->gexp target-inputs))) - (define %build-inputs - (append %build-host-inputs %build-target-inputs)) + (define %build-inputs + (append %build-host-inputs %build-target-inputs)) - (tree-sitter-build #:name #$name - #:source #+source - #:system #$system - #:build #$build - #:target #$target - #:phases #$phases - #:tests? #$tests? - #:grammar-directories '#$grammar-directories - #:outputs #$(outputs->gexp outputs) - #:inputs %build-target-inputs - #:native-inputs %build-host-inputs - #:search-paths ' - #$(sexp->gexp - (map search-path-specification->sexp - search-paths)) - #:native-search-paths - '#$(sexp->gexp - (map - search-path-specification->sexp - native-search-paths)))))) + (tree-sitter-build #:name #$name + #:source #+source + #:system #$system + #:build #$build + #:target #$target + #:phases #$phases + #:tests? #$tests? + #:grammar-directories '#$grammar-directories + #:outputs #$(outputs->gexp outputs) + #:inputs %build-target-inputs + #:native-inputs %build-host-inputs + #:search-paths ' + #$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:native-search-paths + '#$(sexp->gexp + (map + search-path-specification->sexp + native-search-paths))))))) (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) system #:graft? #f)))