time: fix build on non-glibc

This commit is contained in:
matthewcroughan
2025-10-16 22:51:45 +01:00
parent 34ee2cf8df
commit 78d9efbbe8
2 changed files with 32 additions and 4 deletions
+2 -4
View File
@@ -17,11 +17,9 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
# fixes cross-compilation to riscv64-linux
./time-1.9-implicit-func-decl-clang.patch
# https://lists.gnu.org/archive/html/bug-time/2025-10/msg00000.html
# fix compilation with gcc15
(fetchpatch {
url = "https://src.fedoraproject.org/rpms/time/raw/191440912c2e9a63af87802e507ca3ccb923e805/f/time-1.9-Fix-compiling-with-GCC15.patch";
hash = "sha256-4Qp3mV8XuCmz518GPtrW52gyaPOb+97RE6FDPKNCyJw=";
})
./time-1.9-fix-sighandler-prototype-for-c23.patch
];
meta = {
@@ -0,0 +1,30 @@
In C23 functions with empty argument list in the prototype are treated
as taking no arguments. This means that the `int` argument of the
sighandler must be specified explicitly or the code will fail to
compile due to mismatched function type.
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
---
This fixes the same issue as
<https://lists.gnu.org/archive/html/bug-time/2025-01/msg00000.html> and
<https://lists.gnu.org/archive/html/bug-time/2025-03/msg00000.html> but does not
rely on `sighandler_t` which is a GNU extension.
src/time.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/time.c b/src/time.c
index 7b401bc..88287dd 100644
--- a/src/time.c
+++ b/src/time.c
@@ -77,7 +77,7 @@ enum
/* A Pointer to a signal handler. */
-typedef RETSIGTYPE (*sighandler) ();
+typedef RETSIGTYPE (*sighandler) (int);
/* msec = milliseconds = 1/1,000 (1*10e-3) second.
usec = microseconds = 1/1,000,000 (1*10e-6) second. */
--
2.51.0