From patchwork Thu Feb 15 20:26:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 60365 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 B47FE27BBE9; Thu, 15 Feb 2024 20:28:05 +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=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=no 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 8EEC327BBE2 for ; Thu, 15 Feb 2024 20:28:04 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raiKg-0007I2-2y; Thu, 15 Feb 2024 15:27:46 -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 1raiKf-0007Hl-1j for guix-patches@gnu.org; Thu, 15 Feb 2024 15:27:45 -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 1raiKe-0007r5-PA for guix-patches@gnu.org; Thu, 15 Feb 2024 15:27:44 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1raiKx-0007Dz-HK; Thu, 15 Feb 2024 15:28:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69170] [PATCH rust-team 01/46] build-system: cargo: Add #:cargo-native-inputs argument. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Thu, 15 Feb 2024 20:28:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69170 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69170@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Efraim Flashner X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by 69170-submit@debbugs.gnu.org id=B69170.170802885627438 (code B ref 69170); Thu, 15 Feb 2024 20:28:03 +0000 Received: (at 69170) by debbugs.gnu.org; 15 Feb 2024 20:27:36 +0000 Received: from localhost ([127.0.0.1]:57212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1raiKV-00078N-Hs for submit@debbugs.gnu.org; Thu, 15 Feb 2024 15:27:36 -0500 Received: from wolfsden.cz ([37.205.8.62]:36066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1raiKT-000786-E6 for 69170@debbugs.gnu.org; Thu, 15 Feb 2024 15:27:34 -0500 Received: by wolfsden.cz (Postfix, from userid 104) id C067828CEC0; Thu, 15 Feb 2024 20:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1708028833; bh=uVKcm2mXlYB/7CQ8hzIm9tCfBQ3A6sw10FkMEOCAudY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Df8EULbLDtdZifxBQ8DlwCjkaiZAkY75sQ8fQfu5Tumf7Ulkg2N8sCPm29h4vDoWr tzW5xYZJT0+ob+pGUSyU7xz1gHKoHs6UV0uudTLMD9QnGc3Y/tE+kN3EljkAXWIbUh lJlA8j9ovpMIFQlzkhYLcRvkECdccollGwkLVLOMwWWw0JHXRD+tTcb7Xrs8jc3hMx pzSViF9mlxthCjWrEsWbM7QtT70O32qkbkIUYCB8vTWKFhzhLI78FQNb6yMKmRA8av D7oDPfychpgui0ZXhRRk6AJnMfuBIjKrvF4h6IMxL3ntWk6MUmeXQPc/mg9Yu25Lcx G5fK4QJj3SYVcP/UjzHMEE6VyH8Z7g+AvDJufv4KmSvlHFViDjkIYxKQBKkpnONLKM 4R299+a7xwYsNMRRwbPbLySzpJepvdWnubcc1lbe6fn2Kimdo6K+zEHrgiZXfJLA63 SawvloG7paoBz0vCXaaQpxVosiK1+fH6rTmpNM15kxPPMDG8r8IznuJAHIAEqwwt0h 6DxJEnaX/Dpk3Q9t79fs+FPfWiC2wwjpW28wTbOU9OdSkBj4ayRCqg7CEuGGW4cSML xgbihkeqpQSKoiMZ6rKxepcRGvb3qJoXeapSF/60mYj9zyERRbZGnngzC5q4BXyzyW q8gRJLaeNnwZbruv3zTKec24= Received: from localhost (unknown [193.32.127.154]) by wolfsden.cz (Postfix) with ESMTPSA id 6092528DC16; Thu, 15 Feb 2024 20:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1708028833; bh=uVKcm2mXlYB/7CQ8hzIm9tCfBQ3A6sw10FkMEOCAudY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Df8EULbLDtdZifxBQ8DlwCjkaiZAkY75sQ8fQfu5Tumf7Ulkg2N8sCPm29h4vDoWr tzW5xYZJT0+ob+pGUSyU7xz1gHKoHs6UV0uudTLMD9QnGc3Y/tE+kN3EljkAXWIbUh lJlA8j9ovpMIFQlzkhYLcRvkECdccollGwkLVLOMwWWw0JHXRD+tTcb7Xrs8jc3hMx pzSViF9mlxthCjWrEsWbM7QtT70O32qkbkIUYCB8vTWKFhzhLI78FQNb6yMKmRA8av D7oDPfychpgui0ZXhRRk6AJnMfuBIjKrvF4h6IMxL3ntWk6MUmeXQPc/mg9Yu25Lcx G5fK4QJj3SYVcP/UjzHMEE6VyH8Z7g+AvDJufv4KmSvlHFViDjkIYxKQBKkpnONLKM 4R299+a7xwYsNMRRwbPbLySzpJepvdWnubcc1lbe6fn2Kimdo6K+zEHrgiZXfJLA63 SawvloG7paoBz0vCXaaQpxVosiK1+fH6rTmpNM15kxPPMDG8r8IznuJAHIAEqwwt0h 6DxJEnaX/Dpk3Q9t79fs+FPfWiC2wwjpW28wTbOU9OdSkBj4ayRCqg7CEuGGW4cSML xgbihkeqpQSKoiMZ6rKxepcRGvb3qJoXeapSF/60mYj9zyERRbZGnngzC5q4BXyzyW q8gRJLaeNnwZbruv3zTKec24= From: Tomas Volf <~@wolfsden.cz> Date: Thu, 15 Feb 2024 21:26:14 +0100 Message-ID: <3142134916e56f2b51bf3f496c3b2d9d3a4ac541.1708028701.git.~@wolfsden.cz> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches If crate A used by application B needs some package (for example protobuf in my case) during a build, there was no way to propagate the information. The application B would need to explicitly add (native-inputs). And each user of crate A would need to do that. I think that is not optimal, therefore this commit adds new #:cargo-native-inputs argument to the cargo-build-system. It allows propagating native dependencies to users of the crates. * guix/build-system/cargo.scm (package-cargo-native-inputs): New procedure. (lower): New keyword argument cargo-native-inputs. (lower)[private-keywords]: Add #:cargo-native-inputs. (lower)[bag]: Use cargo-native-inputs. * doc/guix.texi: Document it. Change-Id: I39c35db4d17842cd7633cf2c1b7d90b74de07679 --- doc/guix.texi | 4 +++- guix/build-system/cargo.scm | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index bb0af26d93..3d43ed6dd5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9428,7 +9428,9 @@ Build Systems evaluate to a path to a gzipped tarball which includes a @code{Cargo.toml} file at its root, or it will be ignored. Similarly, cargo dev-dependencies should be added to the package definition via the -@code{#:cargo-development-inputs} parameter. +@code{#:cargo-development-inputs} parameter. Additionally, if some +native dependencies are required during a build of a dependent package, +you can use @code{#:cargo-native-inputs} to specify such packages. In its @code{configure} phase, this build system will make any source inputs specified in the @code{#:cargo-inputs} and @code{#:cargo-development-inputs} diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index c029cc1dda..170a1f70b6 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -207,6 +207,12 @@ (define (package-cargo-development-inputs p) cargo-development-inputs) (package-arguments p))) +(define (package-cargo-native-inputs p) + (apply + (lambda* (#:key (cargo-native-inputs '()) #:allow-other-keys) + cargo-native-inputs) + (package-arguments p))) + (define (crate-closure inputs) "Return the closure of INPUTS when considering the 'cargo-inputs' and 'cargod-dev-deps' edges. Omit duplicate inputs, except for those @@ -308,13 +314,14 @@ (define* (lower name (rust-sysroot (default-rust-sysroot target)) (cargo-inputs '()) (cargo-development-inputs '()) + (cargo-native-inputs '()) #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords `(#:rust #:inputs #:native-inputs #:outputs - #:cargo-inputs #:cargo-development-inputs + #:cargo-inputs #:cargo-development-inputs #:cargo-native-inputs #:rust-sysroot ,@(if target '() '(#:target)))) @@ -338,6 +345,14 @@ (define* (lower name ,@(if target '() inputs) ;,@inputs + ,@(apply append + cargo-native-inputs + (map (match-lambda + ((tag pkg) + (package-cargo-native-inputs pkg))) + (crate-closure (append cargo-inputs + cargo-development-inputs)))) + ,@(if target ;; Use the standard cross inputs of ;; 'gnu-build-system'.