Subject: [bug#72643] [PATCH core-updates 1/6] gnu: make-bootstrap: Fix cross-compilation of ‘%glibc-stripped’.

From: Ludovic Courtès <[email-masked]>
Date: Thu, 15 Aug 2024 18:58:29 +0200

Previously, ‘guix build bootstrap-tarballs --target=aarch64-linux-gnu’
or similar would construct a cross-libc where ‘%current-target-system’
is set.  This would lead to a failure in the
‘add-cross-binutils-to-PATH’ phase, which assumes that
‘%current-target-system’ is #f; indeed, ‘cross-libc’ already returns a
cross libc and so ‘%current-target-system’ must be set to #f.

* gnu/packages/make-bootstrap.scm (%glibc-stripped)[inputs]: Move libc to…
[native-inputs]: … here.

Change-Id: Ifbf5e519ba3198940f4de4a36075d5302e923172
---
 gnu/packages/make-bootstrap.scm | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index d5b6b818b3..679aa46d60 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -448,19 +448,20 @@ (define (%glibc-stripped)
            (make-stripped-libc (assoc-ref %outputs "out")
                                (assoc-ref %build-inputs "libc")
                                (assoc-ref %build-inputs "kernel-headers")))))
-      (inputs `(("kernel-headers"
-                 ,(if (or (and (%current-target-system)
-                               (target-hurd? (%current-target-system)))
-                          (string-suffix? "-hurd" (%current-system)))
-                      gnumach-headers
-                      linux-libre-headers))
-                ("libc" ,(let ((target (%current-target-system)))
-                           (if target
-                               (glibc-for-bootstrap
-                                (parameterize ((%current-target-system #f))
-                                  (cross-libc target)))
-                               glibc)))))
-      (native-inputs '())
+      (native-inputs
+       `(("libc" ,(let ((target (%current-target-system)))
+                    (if target
+                        (glibc-for-bootstrap
+                         (parameterize ((%current-target-system #f))
+                           (cross-libc target)))
+                        glibc)))))
+      (inputs
+       `(("kernel-headers"
+          ,(if (or (and (%current-target-system)
+                        (target-hurd? (%current-target-system)))
+                   (string-suffix? "-hurd" (%current-system)))
+               gnumach-headers
+               linux-libre-headers))))
       (propagated-inputs '())
 
       ;; Only one output.
-- 
2.45.2