From patchwork Mon Apr 28 16:23:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42117 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 BBBED27BC4B; Mon, 28 Apr 2025 17:34:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, 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 7078027BC49 for ; Mon, 28 Apr 2025 17:34:06 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPs-0007wL-01; Mon, 28 Apr 2025 12:33:12 -0400 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 1u9RPG-0007f5-Gk for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:40 -0400 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 1u9RPB-0004SH-CH for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:30 -0400 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=K+GMPUslI8JVXY3GgZ84SbrXXz+H35rj4shnrcvSzFU=; b=ZP8jCPLbA5b7DsUoHpYtXNTbTLH8Ww6OQHWrdRIisoV9+Q+4Z4/McHlgwTVGlpzaVfwhWP2LKhdhTA+gsgECcyNpTZhof9FKpmL39uB8cvLhckMDsyiS2x3rNttlw8QeI6FxLPDxpI/ONXv7tIegA3Jbec9GkmO4y0QBJGthkKPjCrhfL/cPayzawyVJdPSeiTW5vN39i5ZII56aTzZsuRXWNJSRFc+r8VXGS+0VvHyWhNvQiA5FfWqC2Z2Th6RyAVLX2/jReAhQ65y2nier8vACGcZ4BCmUv3sBAGrxh48qGLrPhqyRg1TjoMO/qXO4ooWDL2WYR0coSXbe+RF+Dg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9RP8-0003N3-S4; Mon, 28 Apr 2025 12:32:26 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 20/22] build/cargo: Accept rust-sysroot from native-inputs. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: divya@subvertising.org, efraim@flashner.co.il, hako@ultrarare.space, steve@futurile.net, guix-patches@gnu.org Resent-Date: Mon, 28 Apr 2025 16:32:26 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik , Efraim Flashner , Hilton Chain , Steve George Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174585793712794 (code B ref 77093); Mon, 28 Apr 2025 16:32:26 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:32:17 +0000 Received: from localhost ([127.0.0.1]:32939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROy-0003K0-SQ for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:32:17 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:51876) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9ROd-0003E7-0q for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:55 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K+GMPUslI8JVXY3GgZ84SbrXXz+H35rj4shnrcvSzFU=; b=McsLSwIpZNPfwY6H+toY8jWb5Gc4JTR1RvPXECtzQ11mdx36tV2JfWgqYEYFq4kxWj7hb3 NbjYknBnefoKP3tS6DxzwKE/uexo26GWdcmhf1yEZQSrOJey8m8O3upTGQcgOanZn4mEHX 1Mulb5ie0bqAl5xsDDMOM51gtG9DuYlOeqNvr5c1lqNWu0Kwt3PUQG9PimXVtqaKHGh/Iy YbVMpKeXw5aZfT+XIkdb1DBNruNuXCnc5TMpwwcL/BxV+2j1t8eqoMn9W3Ftbu711itVRT J9LlIkCLXfnzMNM974YSiKi2UsZEEpSy+/hq8QP9pLV4Ov070mKq8PRaWWa/bA== Date: Tue, 29 Apr 2025 00:23:17 +0800 Message-ID: <6a0e3149cc9bb548174abb513cab0339b00a6c7f.1745855744.git.hako@ultrarare.space> 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 This is a workaround to support Rust cross-compilation in build systems other than cargo-build-system. Since there's no interface for target-inputs, using native-inputs makes most sense. * guix/build-system/cargo.scm (lower)[bag]: Label rust-sysroot with its package name. * guix/build/cargo-build-system.scm (configure): Use it. When cross-compiling, accept rust-sysroot from native-inputs if there's none in inputs. Change-Id: I5cb63c8c815d3a2c9f0ece01857254f6d0090dd1 --- guix/build-system/cargo.scm | 3 ++- guix/build/cargo-build-system.scm | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm index 045809874c..d2d9a075b9 100644 --- a/guix/build-system/cargo.scm +++ b/guix/build-system/cargo.scm @@ -430,7 +430,8 @@ (define* (lower name ;; This provides a separate sysroot for the regular rustc ,@(if target - `(("rust-sysroot" ,(rust-sysroot target))) + `((,(string-append "rust-sysroot-for-" target) + ,(rust-sysroot target))) '()))) (outputs outputs) (build (if target cargo-cross-build cargo-build)) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index edc4e0d836..45b17df6ff 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -156,7 +156,7 @@ (define* (check-for-pregenerated-files #:key parallel-build? #:allow-other-keys) (format #t "error: Possible pre-generated file found: ~a~%" file))) (find-files "." (negate empty-file?))))) -(define* (configure #:key source inputs +(define* (configure #:key source inputs native-inputs target system (cargo-target #f) (vendor-dir "guix-vendor") @@ -193,9 +193,16 @@ (define* (configure #:key source inputs ;; For cross-building (when target (setenv "CARGO_BUILD_TARGET" cargo-target) - (setenv "RUSTFLAGS" (string-append - (or (getenv "RUSTFLAGS") "") - " --sysroot " (assoc-ref inputs "rust-sysroot"))) + (setenv "RUSTFLAGS" + (string-append + (or (getenv "RUSTFLAGS") "") + " --sysroot " + (assoc-ref + (append inputs + ;; Workaround for other build systems, as no interface + ;; is available for target-inputs. + (or native-inputs '())) + (string-append "rust-sysroot-for-" target)))) (setenv "PKG_CONFIG" (string-append target "-pkg-config"))