guix-patches
[Top][All Lists]
Advanced

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

[bug#63641] [PATCH 5/8] gnu: Add libc-for-target and glibc/hurd.


From: Josselin Poiret
Subject: [bug#63641] [PATCH 5/8] gnu: Add libc-for-target and glibc/hurd.
Date: Mon, 22 May 2023 11:04:15 +0200

From: Josselin Poiret <dev@jpoiret.xyz>

* gnu/packages/base.scm (glibc/hurd, libc-for-target): New variables.
(glibc/hurd-headers): Use glibc/hurd.
* gnu/packages/commencement.scm (glibc-final-with-bootstrap-bash,
glibc-final): Use libc-for-target.
* gnu/packages/cross-base.scm (cross-libc/deprecated, cross-libc*): Use
libc-for-target.
---
 gnu/packages/base.scm         | 38 ++++++++++++++++++--
 gnu/packages/commencement.scm | 66 +++++++++++++++++------------------
 gnu/packages/cross-base.scm   |  4 +--
 3 files changed, 70 insertions(+), 38 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index f944ab5d47..59c9632551 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -75,6 +75,7 @@ (define-module (gnu packages base)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (glibc
+            libc-for-target
             make-ld-wrapper
             libiconv-if-needed))
 
@@ -1415,20 +1416,42 @@ (define-public which
 command.")
     (license gpl3+))) ; some files are under GPLv2+
 
+(define-public glibc/hurd
+  (package/inherit glibc
+    (name "glibc-hurd")
+    (version "2.37")
+    (source (origin
+            (method url-fetch)
+            (uri (string-append "mirror://gnu/glibc/glibc-" version ".tar.xz"))
+            (sha256
+             (base32
+              "0hqsp4dzrjx0iga6jv0magjw26dh82pxlmk8yis5v0d127qyymr2"))
+            (patches (search-patches "glibc-ldd-powerpc.patch"
+                                     "glibc-2.37-ldd-x86_64.patch"
+                                     "glibc-dl-cache.patch"
+                                     "glibc-2.37-versioned-locpath.patch"
+                                     "glibc-reinstate-prlimit64-fallback.patch"
+                                     "glibc-supported-locales.patch"
+                                     
"glibc-2.37-hurd-clock_t_centiseconds.patch"
+                                     
"glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch"
+                                     "glibc-hurd-mach-print.patch"
+                                     "glibc-hurd-gettyent.patch"))))
+    (supported-systems %hurd-systems)))
+
 (define-public glibc/hurd-headers
-  (package (inherit glibc)
+  (package/inherit glibc/hurd
     (name "glibc-hurd-headers")
     (outputs '("out"))
     (propagated-inputs (list gnumach-headers hurd-headers))
     (native-inputs
-     (modify-inputs (package-native-inputs glibc)
+     (modify-inputs (package-native-inputs glibc/hurd)
        (prepend (if (%current-target-system)
                    (let* ((cross-base (resolve-interface '(gnu packages 
cross-base)))
                           (cross-mig (module-ref cross-base 'cross-mig)))
                      (cross-mig (%current-target-system)))
                    mig))))
     (arguments
-     (substitute-keyword-arguments (package-arguments glibc)
+     (substitute-keyword-arguments (package-arguments glibc/hurd)
        ;; We just pass the flags really needed to build the headers.
        ((#:configure-flags flags)
         `(list "--enable-add-ons"
@@ -1449,6 +1472,15 @@ (define-public glibc/hurd-headers
            (delete 'build)))))                  ; nothing to build
     (supported-systems %hurd-systems)))
 
+(define* (libc-for-target #:optional
+                          (target (or (%current-target-system)
+                                      (%current-system))))
+  (match target
+    ((? target-hurd?)
+     glibc/hurd)
+    (_
+     glibc)))
+
 (define-public tzdata
   (package
     (name "tzdata")
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index ab07fb37ab..a24c60ebf8 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -2816,13 +2816,13 @@ (define (%boot1-inputs)
     ("binutils-cross" ,binutils-boot0)
     ,@(alist-delete "binutils" (%boot0-inputs))))
 
-(define glibc-final-with-bootstrap-bash
+(define/system-dependent glibc-final-with-bootstrap-bash
   ;; The final libc, "cross-built".  If everything went well, the resulting
   ;; 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.
   (package
-    (inherit glibc)
+    (inherit (libc-for-target))
     (name "glibc-intermediate")
     (outputs (delete "debug" (package-outputs glibc)))
     (source (bootstrap-origin (package-source glibc)))
@@ -2991,39 +2991,39 @@ (define gettext-boot0
                         (("^PROGRAMS =.*$")
                          "PROGRAMS =\n")))))))))
 
-(define glibc-final
+(define/system-dependent glibc-final
   ;; The final glibc, which embeds the statically-linked Bash built above.
   ;; Use 'package/inherit' so we get the 'replacement' of 'glibc', if any.
-  (package/inherit
-   glibc
-   (name "glibc")
-   (source (bootstrap-origin (package-source glibc)))
-   (inputs `(("static-bash" ,static-bash-for-glibc)
-             ,@(alist-delete
-                "static-bash"
-                (package-inputs glibc-final-with-bootstrap-bash))))
-
-   ;; 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)))
-
-   (propagated-inputs
-    (package-propagated-inputs glibc-final-with-bootstrap-bash))
-
-   ;; The final libc only refers to itself, but the 'debug' output contains
-   ;; references to GCC-BOOT0 and to the Linux headers.  XXX: Would be great
-   ;; if 'allowed-references' were per-output.
-   (arguments
-    `(#:allowed-references
-      (,(gexp-input gcc-boot0 "lib")
-       ,(kernel-headers-boot0)
-       ,static-bash-for-glibc
-       ,@(if (hurd-system?)
-             `(,gnumach-headers-boot0
-               ,hurd-headers-boot0)
-             '())
-       ,@(package-outputs glibc-final-with-bootstrap-bash))
-      ,@(package-arguments glibc-final-with-bootstrap-bash)))))
+  (let ((libc (libc-for-target)))
+    (package/inherit libc
+      (name "glibc")
+      (source (bootstrap-origin (package-source glibc)))
+      (inputs `(("static-bash" ,static-bash-for-glibc)
+                ,@(alist-delete
+                   "static-bash"
+                   (package-inputs glibc-final-with-bootstrap-bash))))
+
+      ;; 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)))
+
+      (propagated-inputs
+       (package-propagated-inputs glibc-final-with-bootstrap-bash))
+
+      ;; The final libc only refers to itself, but the 'debug' output contains
+      ;; references to GCC-BOOT0 and to the Linux headers.  XXX: Would be great
+      ;; if 'allowed-references' were per-output.
+      (arguments
+       `(#:allowed-references
+         (,(gexp-input gcc-boot0 "lib")
+          ,(kernel-headers-boot0)
+          ,static-bash-for-glibc
+          ,@(if (hurd-system?)
+                `(,gnumach-headers-boot0
+                  ,hurd-headers-boot0)
+                '())
+          ,@(package-outputs glibc-final-with-bootstrap-bash))
+         ,@(package-arguments glibc-final-with-bootstrap-bash))))))
 
 (define/system-dependent gcc-boot0-wrapped
   ;; Make the cross-tools GCC-BOOT0 and BINUTILS-BOOT0 available under the
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 01c2295853..b2823c73c5 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -577,7 +577,7 @@ (define* (cross-libc . args)
 
 (define* (cross-libc/deprecated target
                                 #:optional
-                                (libc glibc)
+                                (libc (libc-for-target target))
                                 (xgcc (cross-gcc target))
                                 (xbinutils (cross-binutils target))
                                 (xheaders (cross-kernel-headers target)))
@@ -590,7 +590,7 @@ (define* (cross-libc/deprecated target
 
 (define* (cross-libc* target
                       #:key
-                      (libc glibc)
+                      (libc (libc-for-target target))
                       (xgcc (cross-gcc target))
                       (xbinutils (cross-binutils target))
                       (xheaders (cross-kernel-headers target)))
-- 
2.40.1






reply via email to

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