Subject: [bug#77093] [PATCH v4 rust-team 19/22] build-system: cargo: Export ‘cargo-triplet’.

From: Hilton Chain <[email-masked]>
Date: Tue, 29 Apr 2025 00:23:16 +0800

This will make Rust cross compilation support in other build systems easier.

* guix/build-system/cargo.scm (cargo-triplet): Export.
Make ‘target’ argument optional.

Change-Id: I226bf4a7d8065eb7911da148d0cdf3352a47bde6
---
 guix/build-system/cargo.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scm
index 659ad95a35..045809874c 100644
--- a/guix/build-system/cargo.scm
+++ b/guix/build-system/cargo.scm
@@ -51,7 +51,8 @@ (define-module (guix build-system cargo)
             crate-name->package-name
             crate-source
             define-cargo-inputs
-            cargo-inputs))
+            cargo-inputs
+            cargo-triplet))
 
 (define %crate-base-url
   (make-parameter "https://crates.io"))
@@ -118,7 +119,9 @@ (define (default-rust-sysroot target)
   (let ((module (resolve-interface '(gnu packages rust))))
     (module-ref module 'make-rust-sysroot)))
 
-(define (cargo-triplet target)
+(define* (cargo-triplet #:optional
+                        (target (or (%current-target-system)
+                                    (%current-system))))
   (false-if-exception
     (platform-rust-target
       (lookup-platform-by-target-or-system target))))
-- 
2.49.0