guix-commits
[Top][All Lists]
Advanced

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

07/84: squash! gnu: Add libc-for-target and glibc/hurd.


From: guix-commits
Subject: 07/84: squash! gnu: Add libc-for-target and glibc/hurd.
Date: Wed, 14 Jun 2023 06:23:54 -0400 (EDT)

janneke pushed a commit to branch wip-hurd
in repository guix.

commit 1d3b66230f7d5730ce50b654f4b3a83cc28859e7
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Jun 14 11:36:40 2023 +0200

    squash! gnu: Add libc-for-target and glibc/hurd.
    
    This part fixes
    
        https://issues.guix.gnu.org/63641#25
    
    * gnu/packages/commencement.scm (%final-inputs):Change to memoized lambda
    taking "system".
    * gnu/packages/commencement.scm (canonical-package): Likewise, and update
    user, passing (%current-system).
    (make-gcc-toolchain): Update user, passing (%current-system).
    * gnu/packages/base.scm (%final-inputs): Likewise.
    * guix/scripts/refresh.scm (options->update-specs): Likewise.
    * guix/build-system/gnu.scm (standard-packages): Add optional "system"
    parameter.
    (lower): Update caller.
    
    Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/packages/base.scm         |  2 +-
 gnu/packages/commencement.scm | 84 +++++++++++++++++++++++--------------------
 guix/build-system/gnu.scm     |  6 ++--
 guix/scripts/refresh.scm      |  3 +-
 4 files changed, 51 insertions(+), 44 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 59c9632551..ce6063c179 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1629,6 +1629,6 @@ package needs iconv ,@(libiconv-if-needed) should be 
added."
   "Return the list of \"final inputs\"."
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let ((iface (resolve-interface '(gnu packages commencement))))
-    (module-ref iface '%final-inputs)))
+    ((module-ref iface '%final-inputs) (%current-system))))
 
 ;;; base.scm ends here
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index 97a6f392ba..1f0992f07b 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -3357,45 +3357,49 @@ exec ~a/bin/~a-~a -B~a/lib -Wl,-dynamic-linker 
-Wl,~a/~a \"$@\"~%"
     (package/inherit sed (native-inputs `(("perl" ,perl-boot0))))))
 
 (define-public %final-inputs
-  ;; Final derivations used as implicit inputs by 'gnu-build-system'.  We
-  ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
-  ;; used for origins that have patches, thereby avoiding circular
-  ;; dependencies.
-  (let ((finalize (compose with-boot6
-                           package-with-bootstrap-guile)))
-    `(,@(map (match-lambda
-               ((name package)
-                (list name (finalize package))))
-             `(("tar" ,tar)
-               ("gzip" ,gzip)
-               ("bzip2" ,bzip2)
-               ("file" ,file)
-               ("diffutils" ,diffutils)
-               ("patch" ,patch)
-               ("findutils" ,findutils)
-               ("gawk" ,gawk)))
-      ("sed" ,sed-final)
-      ("grep" ,grep-final)
-      ("xz" ,xz-final)
-      ("coreutils" ,coreutils-final)
-      ("make" ,gnu-make-final)
-      ("bash" ,bash-final)
-      ("ld-wrapper" ,ld-wrapper)
-      ("binutils" ,binutils-final)
-      ("gcc" ,gcc-final)
-      ("libc" ,glibc-final)
-      ("libc:static" ,glibc-final "static")
-      ("locales" ,glibc-utf8-locales-final))))
+  ;; The 'glibc-final' package is not the same depending on what system is
+  ;; targeted, so this whole list must be parameterized.
+  (mlambda (system)
+    ;; Final derivations used as implicit inputs by 'gnu-build-system'.  We
+    ;; still use 'package-with-bootstrap-guile' so that the bootstrap tools are
+    ;; used for origins that have patches, thereby avoiding circular
+    ;; dependencies.
+    (let ((finalize (compose with-boot6
+                             package-with-bootstrap-guile)))
+      `(,@(map (match-lambda
+                 ((name package)
+                  (list name (finalize package))))
+               `(("tar" ,tar)
+                 ("gzip" ,gzip)
+                 ("bzip2" ,bzip2)
+                 ("file" ,file)
+                 ("diffutils" ,diffutils)
+                 ("patch" ,patch)
+                 ("findutils" ,findutils)
+                 ("gawk" ,gawk)))
+        ("sed" ,sed-final)
+        ("grep" ,grep-final)
+        ("xz" ,xz-final)
+        ("coreutils" ,coreutils-final)
+        ("make" ,gnu-make-final)
+        ("bash" ,bash-final)
+        ("ld-wrapper" ,ld-wrapper)
+        ("binutils" ,binutils-final)
+        ("gcc" ,gcc-final)
+        ("libc" ,glibc-final)
+        ("libc:static" ,glibc-final "static")
+        ("locales" ,glibc-utf8-locales-final)))))
 
 (define-public canonical-package
-  (let ((name->package (fold (lambda (input result)
-                               (match input
-                                 ((_ package . outputs)
-                                  (vhash-cons (package-full-name package)
-                                              package result))))
-                             vlist-null
-                             `(("guile" ,guile-final)
-                               ,@%final-inputs))))
+  (let ((name->package (mlambda (system)
+                         (fold (lambda (input result)
+                                 (match input
+                                   ((_ package . outputs)
+                                    (vhash-cons (package-full-name package)
+                                                package result))))
+                               vlist-null
+                               `(("guile" ,guile-final)
+                                 ,@(%final-inputs system))))))
     (lambda (package)
       "Return the 'canonical' variant of PACKAGE---i.e., if PACKAGE is one of
 the implicit inputs of 'gnu-build-system', return that one, otherwise return
@@ -3405,7 +3409,8 @@ The goal is to avoid duplication in cases like 
GUILE-FINAL vs. GUILE-2.2,
 COREUTILS-FINAL vs. COREUTILS, etc."
       ;; XXX: This doesn't handle dependencies of the final inputs, such as
       ;; libunistring, GMP, etc.
-      (match (vhash-assoc (package-full-name package) name->package)
+      (match (vhash-assoc (package-full-name package)
+                          (name->package (%current-system)))
         ((_ . canon)
          ;; In general we want CANON, except if we're cross-compiling: CANON
          ;; uses explicit inputs, so it is "anchored" in the bootstrapped
@@ -3487,7 +3492,8 @@ is the GNU Compiler Collection.")
       ;; install everything that we need, and (2) to make sure ld-wrapper comes
       ;; before Binutils' ld in the user's profile.
       (inputs `(("gcc" ,gcc)
-                ("ld-wrapper" ,(car (assoc-ref %final-inputs "ld-wrapper")))
+                ("ld-wrapper" ,(car (assoc-ref (%final-inputs 
(%current-system))
+                                               "ld-wrapper")))
                 ("binutils" ,binutils-final)
                 ("libc" ,libc)
                 ("libc-debug" ,libc "debug")
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 3308302472..c1aa187c42 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -266,13 +266,13 @@ listed in REFS."
       p))
 
 
-(define (standard-packages)
+(define* (standard-packages #:optional (system (%current-system)))
   "Return the list of (NAME PACKAGE OUTPUT) or (NAME PACKAGE) tuples of
 standard packages used as implicit inputs of the GNU build system."
 
   ;; Resolve (gnu packages commencement) lazily to hide circular dependency.
   (let ((distro (resolve-module '(gnu packages commencement))))
-    (module-ref distro '%final-inputs)))
+    ((module-ref distro '%final-inputs) system)))
 
 (define* (lower name
                 #:key source inputs native-inputs outputs target
@@ -303,7 +303,7 @@ standard packages used as implicit inputs of the GNU build 
system."
                           (standard-cross-packages target 'host)
                           '())
                     ,@(if implicit-inputs?
-                          (standard-packages)
+                          (standard-packages system)
                           '())))
     (host-inputs (if target inputs '()))
 
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 9676271542..02716abc12 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -228,7 +228,8 @@ options like '--recursive'."
     (let* ((input->package (match-lambda
                              ((name (? package? package) _ ...) package)
                              (_ #f)))
-           (final-inputs   (map input->package %final-inputs))
+           (final-inputs   (map input->package
+                                (%final-inputs (%current-system))))
            (core           (append final-inputs
                                    (append-map (compose (cut filter-map 
input->package <>)
                                                         
package-transitive-inputs)



reply via email to

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