Toggle diff (457 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 17b07a1102..2a09d44506 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1248,6 +1248,10 @@ dist_patch_DATA = \
%D%/packages/patches/glibc-hidden-visibility-ldconfig.patch \
%D%/packages/patches/glibc-hurd-clock_gettime_monotonic.patch \
%D%/packages/patches/glibc-2.31-hurd-clock_gettime_monotonic.patch \
+ %D%/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch \
+ %D%/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch \
+ %D%/packages/patches/glibc-2.37-ldd-x86_64.patch \
+ %D%/packages/patches/glibc-2.37-versioned-locpath.patch \
%D%/packages/patches/glibc-hurd-clock_t_centiseconds.patch \
%D%/packages/patches/glibc-hurd-gettyent.patch \
%D%/packages/patches/glibc-hurd-mach-print.patch \
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)))
diff --git a/gnu/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch b/gnu/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch
new file mode 100644
index 0000000000..27db59ec40
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.37-hurd-clock_t_centiseconds.patch
@@ -0,0 +1,59 @@
+Some applications assume centisecond precision, or at most millisecond precision
+(e.g. guile). This is a work-around for them.
+
+---
+ getclktck.c | 5 ++---
+ setitimer.c | 2 +-
+ times.c | 2 +-
+ 4 files changed, 8 insertions(+), 9 deletions(-)
+commit d57f2f9b4bd007846af2fb4217486ea572579010
+Author: Richard Braun <rbraun@sceen.net>
+Date: Tue Aug 27 11:35:31 2013 +0200
+
+ Express CPU time (clock_t of times(2)) in centiseconds
+
+diff --git a/sysdeps/mach/hurd/getclktck.c b/sysdeps/mach/hurd/getclktck.c
+index 69be2cc..5f7d946 100644
+--- a/sysdeps/mach/hurd/getclktck.c
++++ b/sysdeps/mach/hurd/getclktck.c
+@@ -18,12 +18,11 @@
+
+ #include <time.h>
+
+-/* Return frequency of `times'.
+- Since Mach reports CPU times in microseconds, we always use 1 million. */
++/* Return frequency of `times'. */
+ int
+ __getclktck (void)
+ {
+- return 1000000;
++ return 100;
+ }
+
+ /* Before glibc 2.2, the Hurd actually did this differently, so we
+diff --git a/sysdeps/mach/hurd/setitimer.c b/sysdeps/mach/hurd/setitimer.c
+index 39b6b16..4992c89 100644
+--- a/sysdeps/mach/hurd/setitimer.c
++++ b/sysdeps/mach/hurd/setitimer.c
+@@ -42,7 +42,7 @@ quantize_timeval (struct timeval *tv)
+ static time_t quantum = -1;
+
+ if (quantum == -1)
+- quantum = 1000000 / __getclktck ();
++ quantum = 100 / __getclktck ();
+
+ tv->tv_usec = ((tv->tv_usec + (quantum - 1)) / quantum) * quantum;
+ if (tv->tv_usec >= 1000000)
+diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c
+index 9e13a75..593c33a 100644
+--- a/sysdeps/mach/hurd/times.c
++++ b/sysdeps/mach/hurd/times.c
+@@ -29,7 +29,7 @@
+ static inline clock_t
+ clock_from_time_value (const time_value_t *t)
+ {
+- return t->seconds * 1000000 + t->microseconds;
++ return t->seconds * 100 + t->microseconds / 10000;
+ }
+
+ /* Store the CPU time used by this process and all its
diff --git a/gnu/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch b/gnu/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch
new file mode 100644
index 0000000000..3207a94550
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.37-hurd-local-clock_gettime_MONOTONIC.patch
@@ -0,0 +1,133 @@
+Use the realtime clock for the monotonic clock. This is of course not a proper
+implementation (which is being done in Mach), but will permit to fix at least
+the iceweasel stack.
+
+vlc however doesn't build when _POSIX_CLOCK_SELECTION is enabled but
+_POSIX_TIMERS is not, and they refuse to fix that (see #765578), so disable the
+former.
+
+---
+ sysdeps/mach/hurd/bits/posix_opt.h | 2 +-
+ sysdeps/unix/clock_gettime.c | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+Index: glibc-2.27/sysdeps/mach/clock_gettime.c
+===================================================================
+--- glibc-2.27.orig/sysdeps/mach/clock_gettime.c
++++ glibc-2.27/sysdeps/mach/clock_gettime.c
+@@ -31,6 +31,10 @@ __clock_gettime (clockid_t clock_id, str
+ switch (clock_id) {
+
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
++ case CLOCK_MONOTONIC_RAW:
++ case CLOCK_REALTIME_COARSE:
++ case CLOCK_MONOTONIC_COARSE:
+ {
+ /* __host_get_time can only fail if passed an invalid host_t.
+ __mach_host_self could theoretically fail (producing an
+Index: glibc-2.27/rt/timer_create.c
+===================================================================
+--- glibc-2.27.orig/rt/timer_create.c
++++ glibc-2.27/rt/timer_create.c
+@@ -48,7 +48,7 @@ timer_create (clockid_t clock_id, struct
+ return -1;
+ }
+
+- if (clock_id != CLOCK_REALTIME)
++ if (clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_MONOTONIC_RAW && clock_id != CLOCK_REALTIME_COARSE && clock_id != CLOCK_MONOTONIC_COARSE)
+ {
+ __set_errno (EINVAL);
+ return -1;
+Index: glibc-2.27/sysdeps/mach/hurd/bits/posix_opt.h
+===================================================================
+--- glibc-2.27.orig/sysdeps/mach/hurd/bits/posix_opt.h
++++ glibc-2.27/sysdeps/mach/hurd/bits/posix_opt.h
+@@ -163,10 +163,10 @@
+ #define _POSIX_THREAD_PROCESS_SHARED -1
+
+ /* The monotonic clock might be available. */
+-#define _POSIX_MONOTONIC_CLOCK 0
++#define _POSIX_MONOTONIC_CLOCK 200809L
+
+-/* The clock selection interfaces are available. */
+-#define _POSIX_CLOCK_SELECTION 200809L
++/* The clock selection interfaces are not really available yet. */
++#define _POSIX_CLOCK_SELECTION -1
+
+ /* Advisory information interfaces could be available in future. */
+ #define _POSIX_ADVISORY_INFO 0
+Index: glibc-upstream/sysdeps/posix/clock_getres.c
+===================================================================
+--- glibc-upstream.orig/sysdeps/posix/clock_getres.c
++++ glibc-upstream/sysdeps/posix/clock_getres.c
+@@ -52,6 +52,10 @@ __clock_getres (clockid_t clock_id, stru
+ switch (clock_id)
+ {
+ case CLOCK_REALTIME:
++ case CLOCK_MONOTONIC:
++ case CLOCK_MONOTONIC_RAW:
++ case CLOCK_REALTIME_COARSE:
++ case CLOCK_MONOTONIC_COARSE:
+ retval = realtime_getres (res);
+ break;
+
+--- ./sysdeps/mach/clock_nanosleep.c.original 2020-07-21 00:31:35.226113142 +0200
++++ ./sysdeps/mach/clock_nanosleep.c 2020-07-21 00:31:49.026185761 +0200
+@@ -62,7 +62,7 @@
+ __clock_nanosleep (clockid_t clock_id, int flags, const struct timespec *req,
+ struct timespec *rem)
+ {
+- if (clock_id != CLOCK_REALTIME
++ if ((clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC && clock_id != CLOCK_MONOTONIC_RAW && clock_id != CLOCK_REALTIME_COARSE && clock_id != CLOCK_MONOTONIC_COARSE)
+ || !valid_nanoseconds (req->tv_nsec)
+ || (flags != 0 && flags != TIMER_ABSTIME))
+ return EINVAL;
+Index: glibc-2.32/hurd/hurdlock.c
+===================================================================
+--- glibc-2.32.orig/hurd/hurdlock.c
++++ glibc-2.32/hurd/hurdlock.c
+@@ -47,7 +47,7 @@ int
+ __lll_abstimed_wait (void *ptr, int val,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ int mlsec = compute_reltime (tsp, clk);
+@@ -59,7 +59,7 @@ int
+ __lll_abstimed_wait_intr (void *ptr, int val,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ int mlsec = compute_reltime (tsp, clk);
+@@ -79,7 +79,7 @@ int
+ __lll_abstimed_xwait (void *ptr, int lo, int hi,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ int mlsec = compute_reltime (tsp, clk);
+@@ -91,7 +91,7 @@ int
+ __lll_abstimed_lock (void *ptr,
+ const struct timespec *tsp, int flags, int clk)
+ {
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ if (__lll_trylock (ptr) == 0)
+@@ -177,7 +177,7 @@ __lll_robust_abstimed_lock (void *ptr,
+ int wait_time = 25;
+ unsigned int val;
+
+- if (clk != CLOCK_REALTIME)
++ if (clk != CLOCK_REALTIME && clk != CLOCK_MONOTONIC)
+ return EINVAL;
+
+ while (1)
diff --git a/gnu/packages/patches/glibc-2.37-ldd-x86_64.patch b/gnu/packages/patches/glibc-2.37-ldd-x86_64.patch
new file mode 100644
index 0000000000..078cb38bd0
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.37-ldd-x86_64.patch
@@ -0,0 +1,8 @@
+By default, 'RTDLLIST' in 'ldd' refers to 'lib64/ld-linux-x86-64.so', whereas
+it's in 'lib/' for us. This patch fixes that.
+
+--- glibc-2.17/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed 2012-12-25 04:02:13.000000000 +0100
++++ glibc-2.17/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed 2013-09-15 23:08:03.000000000 +0200
+@@ -1,1 +1,1 @@
+-s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_
++s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \2\4-x86-64\6 \2x32\4-x32\6"_
diff --git a/gnu/packages/patches/glibc-2.37-versioned-locpath.patch b/gnu/packages/patches/glibc-2.37-versioned-locpath.patch
new file mode 100644
index 0000000000..1964be4b4b
--- /dev/null
+++ b/gnu/packages/patches/glibc-2.37-versioned-locpath.patch
@@ -0,0 +1,247 @@
+From d73ba2caa10b8e9f51ff4239cc32eeb4e0de4279 Mon Sep 17 00:00:00 2001
+Message-Id: <d73ba2caa10b8e9f51ff4239cc32eeb4e0de4279.1683980025.git.dev@jpoiret.xyz>
+From: Josselin Poiret <dev@jpoiret.xyz>
+Date: Sat, 13 May 2023 14:10:43 +0200
+Subject: [PATCH] Add versioned locpath
+
+From: Josselin Poiret <dev@jpoiret.xyz>
+
+---
+ locale/newlocale.c | 15 ++--------
+ locale/setlocale.c | 68 +++++++++++++++++++++++++++++++++++++-------
+ string/Makefile | 1 +
+ string/argz-suffix.c | 56 ++++++++++++++++++++++++++++++++++++
+ string/argz.h | 10 +++++++
+ 5 files changed, 127 insertions(+), 23 deletions(-)
+ create mode 100644 string/argz-suffix.c
+
+diff --git a/locale/newlocale.c b/locale/newlocale.c
+index 108d2428bf..6218e0fa77 100644
+--- a/locale/newlocale.c
++++ b/locale/newlocale.c
+@@ -29,6 +29,7 @@
+ /* Lock for protecting global data. */
+ __libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
+
++extern error_t compute_locale_search_path (char **, size_t *);
+
+ /* Use this when we come along an error. */
+ #define ERROR_RETURN \
+@@ -47,7 +48,6 @@ __newlocale (int category_mask, const char *locale, locale_t base)
+ locale_t result