guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/04: gnu: make-rust-sysroot: Accept other mingw targets.


From: guix-commits
Subject: 02/04: gnu: make-rust-sysroot: Accept other mingw targets.
Date: Thu, 5 Dec 2024 13:16:26 -0500 (EST)

efraim pushed a commit to branch master
in repository guix.

commit be53521d4cc9fb1adbbb97f00ae7a809710b4c79
Author: Efraim Flashner <efraim@flashner.co.il>
AuthorDate: Thu Dec 5 13:20:18 2024 +0200

    gnu: make-rust-sysroot: Accept other mingw targets.
    
    * gnu/packages/rust.scm (make-rust-sysroot/implementation)[arguments]:
    Adjust the custom 'patch-for-mingw phase to generate the name of the
    mingw input package based on the target architecture.
    [inputs, native-inputs]: Use make-mingw-w64 to choose the mingw package
    for the target.
    
    Change-Id: I48638095a504675753e65fdb6f0286c31cebde66
---
 gnu/packages/rust.scm | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index e6efd094e9..345d61dbf5 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -1487,24 +1487,23 @@ exec -a \"$0\" \"~a\" \"$@\""
               #$@(if (target-mingw? target)
                      `((add-after 'set-env 'patch-for-mingw
                          (lambda* (#:key inputs #:allow-other-keys)
-                           (setenv "LIBRARY_PATH"
-                                   (string-join
-                                    (delete
-                                     (string-append
-                                      (or (assoc-ref inputs 
"mingw-w64-i686-winpthreads")
-                                          (assoc-ref inputs 
"mingw-w64-x86_64-winpthreads"))
-                                      "/lib")
-                                     (string-split (getenv "LIBRARY_PATH") 
#\:))
-                                    ":"))
-                           (setenv "CPLUS_INCLUDE_PATH"
-                                   (string-join
-                                    (delete
-                                     (string-append
-                                      (or (assoc-ref inputs 
"mingw-w64-i686-winpthreads")
-                                          (assoc-ref inputs 
"mingw-w64-x86_64-winpthreads"))
-                                      "/include")
-                                     (string-split (getenv 
"CPLUS_INCLUDE_PATH") #\:))
-                                    ":"))
+                           (let* ((arch ,(string-take target
+                                                      (string-index target 
#\-)))
+                                  (mingw (assoc-ref inputs
+                                                    (string-append 
"mingw-w64-" arch
+                                                                   
"-winpthreads"))))
+                             (setenv "LIBRARY_PATH"
+                                     (string-join
+                                       (delete
+                                         (string-append mingw "/lib")
+                                         (string-split (getenv "LIBRARY_PATH") 
#\:))
+                                       ":"))
+                             (setenv "CPLUS_INCLUDE_PATH"
+                                     (string-join
+                                       (delete
+                                         (string-append mingw "/include")
+                                         (string-split (getenv 
"CPLUS_INCLUDE_PATH") #\:))
+                                       ":")))
                            ;; When building a rust-sysroot this crate is only 
used for
                            ;; the rust-installer.
                            (substitute* '("vendor/num_cpus-1.13.0/src/linux.rs"
@@ -1610,9 +1609,9 @@ ar = \"" (search-input-file inputs (string-append "/bin/" 
#$(ar-for-target targe
        (if (target-mingw? target)
            (modify-inputs (package-propagated-inputs base-rust)
              (prepend
-              (if (string=? "i686-w64-mingw32" target)
-                  mingw-w64-i686-winpthreads
-                  mingw-w64-x86_64-winpthreads)))
+              (make-mingw-w64
+                (string-take target (string-index target #\-))
+                #:with-winpthreads? #t)))
            (package-propagated-inputs base-rust)))
       (native-inputs
        (if (target-mingw? target)
@@ -1620,9 +1619,9 @@ ar = \"" (search-input-file inputs (string-append "/bin/" 
#$(ar-for-target targe
              (prepend (cross-gcc target
                                  #:libc (cross-libc target))
                       (cross-binutils target)
-                      (if (string=? "i686-w64-mingw32" target)
-                          mingw-w64-i686-winpthreads
-                          mingw-w64-x86_64-winpthreads)))
+                      (make-mingw-w64
+                        (string-take target (string-index target #\-))
+                        #:with-winpthreads? #t)))
            (modify-inputs (package-native-inputs base-rust)
              (prepend (cross-gcc target
                                  #:libc (cross-libc target))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]