guix_mirror_bot pushed a commit to branch core-packages-team
in repository guix.

commit c525967692977794f34be217622bea0eee5ef05d
Author: Nicolas Graves <[email protected]>
AuthorDate: Sat Feb 21 12:13:10 2026 +0100

    gnu: boostrap glibcs: Drop input labels.
    
    * gnu/packages/base.scm (glibc)[arguments]
    <#:configure-flags>: Avoid assoc-ref to drop modules, and...
    <#:phases>: In phase 'pre-configure, avoid assoc-ref similarly, and...
    <#:modules>: ...add necessary modules to do so.
    
    * gnu/packages/commencement.scm (glibc-final-with-bootstrap-bash)
    [propagated-inputs, inputs]: Drop input lables.
    (glibc-final): Likewise.
    
    Change-Id: I359623b6e4e69f693701d74749f340c0b55ec775
    Signed-off-by: Ludovic Courtès <[email protected]>
---
 gnu/packages/base.scm         | 39 ++++++++++++++++++++++++++++----------
 gnu/packages/commencement.scm | 44 +++++++++++++++++++++++--------------------
 2 files changed, 53 insertions(+), 30 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 2af053702d..e55c889f9c 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -968,8 +968,10 @@ the store.")
      #:validate-runpath? #f
 
      #:modules `((ice-9 ftw)
+                 (ice-9 match)
                  (srfi srfi-1)
                  (srfi srfi-26)
+                 (guix build gremlin)
                  (guix build utils)
                  (guix build gnu-build-system))
 
@@ -998,12 +1000,22 @@ the store.")
              (string-append "libc_cv_complocaledir=/run/current-system/locale/"
                             #$(version-major+minor version))
 
-             (string-append "--with-headers="
-                            (assoc-ref #$(if (%current-target-system)
-                                             #~%build-target-inputs
-                                             #~%build-inputs)
-                                       "kernel-headers")
-                            "/include")
+             ;; Here we need to refer to kernel headers and not glibc-mesboot
+             (string-append
+              "--with-headers="
+              (and=>
+               (find
+                (match-lambda
+                  ((label . input)
+                   (and (file-exists?
+                         (string-append input "/include/asm/ioctl.h"))
+                        ;; Ensure we're not refering to another libc.
+                        (not (file-exists?
+                              (string-append input "/include/locale.h"))))))
+                #$(if (%current-target-system)
+                      #~%build-target-inputs
+                      #~%build-inputs))
+               cdr) "/include")
 
              ;; This is the default for most architectures as of GNU libc 2.26,
              ;; but we specify it explicitly for clarity and consistency.  See
@@ -1026,10 +1038,17 @@ the store.")
          (add-before 'configure 'pre-configure
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (let* ((bin (string-append #$output "/bin"))
-                    ;; FIXME: Normally we would look it up only in INPUTS
-                    ;; but cross-base uses it as a native input.
-                    (bash (or (assoc-ref inputs "bash-static")
-                              (assoc-ref native-inputs "bash-static"))))
+                    (bash (find
+                           (match-lambda
+                             ((label . input)
+                              (let ((sh (string-append input "/bin/sh")))
+                                (and (file-exists? sh)
+                                     ;; Is it bash-static specifically? The
+                                     ;; label can't be used because of
+                                     ;; bash-mesboot during the bootstrap.
+                                     (not (file-dynamic-info sh))))))
+                           inputs))
+                    (bash (and=> bash cdr)))
                ;; Install the rpc data base file under `$out/etc/rpc'.
                (substitute* "inet/Makefile"
                  (("^\\$\\(inst_sysconfdir\\)/rpc(.*)$" _ suffix)
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index dce2f454d0..e992dde1a6 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2997,7 +2997,8 @@ memoized as a function of '%current-system'."
   ;; store path has no dependencies.  Actually, the really-final libc is
   ;; built just below; the only difference is that this one uses the
   ;; bootstrap Bash.
-  (let ((libc (libc-for-target (%current-system))))
+  (let ((libc (libc-for-target (%current-system)))
+        (kernel-headers (kernel-headers-boot0)))
     (package
       (inherit libc)
       (name "glibc-intermediate")
@@ -3034,25 +3035,27 @@ memoized as a function of '%current-system'."
                                                                   
"/lib/libihash.a")
                                                "\n"))))
                           #~()))))))))
-      (propagated-inputs `(("kernel-headers" ,(kernel-headers-boot0))))
+      (propagated-inputs (list kernel-headers))
       (native-inputs
        (list bison-boot0
              perl-boot0
              python-boot0
              texinfo-boot0))
       (inputs
-       `( ;; The boot inputs.  That includes the bootstrap libc.  We don't want
-         ;; it in $CPATH, hence the 'pre-configure' phase above.
-         ,@(%boot1-inputs)
-
-         ;; A native MiG is needed to build Glibc on Hurd.
-         ,@(if (system-hurd?)
-               `(("mig" ,mig-boot0))
-               '())
-
-         ;; Here, we use the bootstrap Bash, which is not satisfactory
-         ;; because we don't want to depend on bootstrap tools.
-         ("bash-static" ,bash-mesboot))))))
+       (append
+        ;; Order matters here, as glibc-mesboot also contains the same
+        ;; header files.
+        (list kernel-headers)
+        ;; The boot inputs, including the bootstrap libc.  We don't
+        ;; want it in $CPATH, hence the 'pre-configure' phase above.
+        (map cadr (%boot1-inputs))
+        ;; A native MiG is needed to build Glibc on Hurd.
+        (if (system-hurd?)
+            (list mig-boot0)
+            '())
+        ;; TODO Here, we use the bootstrap Bash, which is not satisfactory
+        ;; because we don't want to depend on bootstrap tools.
+        (list bash-mesboot))))))
 
 (define (cross-gcc-wrapper gcc binutils glibc bash)
   "Return a wrapper for the pseudo-cross toolchain GCC/BINUTILS/GLIBC
@@ -3179,14 +3182,15 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker 
-Wl,~a/~a \"$@\"~%"
     (package/inherit libc
       (name "glibc")
       (source (bootstrap-origin (package-source libc)))
-      (inputs `(("bash-static" ,static-bash-for-glibc)
-                ,@(alist-delete
-                   "bash-static"
-                   (package-inputs glibc-final-with-bootstrap-bash))))
+      (inputs
+       (modify-inputs (package-inputs glibc-final-with-bootstrap-bash)
+         (delete "bash-mesboot")
+         (append static-bash-for-glibc)))
 
       ;; This time we need 'msgfmt' to install all the libc.mo files.
-      (native-inputs `(,@(package-native-inputs 
glibc-final-with-bootstrap-bash)
-                       ("gettext" ,gettext-boot0)))
+      (native-inputs
+       (modify-inputs (package-native-inputs glibc-final-with-bootstrap-bash)
+         (append gettext-boot0)))
 
       (propagated-inputs
        (package-propagated-inputs glibc-final-with-bootstrap-bash))

Reply via email to