From 0140aa3cb7a15242a8eb9a50f0558506e120461c Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Mon, 28 Apr 2025 22:47:45 +0100 Subject: [PATCH] scsh: fix the build against `gcc-14` Without the change `scsh` build fails on `master` as https://hydra.nixos.org/build/294813946: c/syscalls.c: In function 'sleep_until': c/syscalls.c:711:18: error: implicit declaration of function 'time' [] 711 | time_t now = time(0); | ^~~~ --- pkgs/by-name/sc/scsh/gcc-14-p1.patch | 33 ++++++++++++++++++++++++++++ pkgs/by-name/sc/scsh/gcc-14-p2.patch | 31 ++++++++++++++++++++++++++ pkgs/by-name/sc/scsh/package.nix | 9 ++++++++ 3 files changed, 73 insertions(+) create mode 100644 pkgs/by-name/sc/scsh/gcc-14-p1.patch create mode 100644 pkgs/by-name/sc/scsh/gcc-14-p2.patch diff --git a/pkgs/by-name/sc/scsh/gcc-14-p1.patch b/pkgs/by-name/sc/scsh/gcc-14-p1.patch new file mode 100644 index 000000000000..30dfa6135267 --- /dev/null +++ b/pkgs/by-name/sc/scsh/gcc-14-p1.patch @@ -0,0 +1,33 @@ +https://github.com/scheme/scsh/pull/50.patch + +From edced224436fa70cd7d885fe65996b9c3cfd33d7 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Mon, 28 Apr 2025 22:40:31 +0100 +Subject: [PATCH] c/syscalls.c: add missing `` icnlude + +Without the change the build fails for me as: + + c/syscalls.c: In function 'sleep_until': + c/syscalls.c:711:18: error: implicit declaration of function 'time' [-Wimplicit-function-declaration] + 711 | time_t now = time(0); + | ^~~~ + c/syscalls.c:41:1: note: 'time' is defined in header ''; this is probably fixable by adding '#include ' + 40 | #include "syscalls.h" + +++ |+#include + 41 | +--- + c/syscalls.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/c/syscalls.c b/c/syscalls.c +index fe11e81..2be25a8 100644 +--- a/c/syscalls.c ++++ b/c/syscalls.c +@@ -5,6 +5,7 @@ + + #include + #include ++#include /* for time() */ + #include + #include + #include diff --git a/pkgs/by-name/sc/scsh/gcc-14-p2.patch b/pkgs/by-name/sc/scsh/gcc-14-p2.patch new file mode 100644 index 000000000000..c32793e6c60f --- /dev/null +++ b/pkgs/by-name/sc/scsh/gcc-14-p2.patch @@ -0,0 +1,31 @@ +https://github.com/scheme/scsh/pull/51.patch + +From b2934abb68d6adab448f24787192c047e46cf17c Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Mon, 28 Apr 2025 22:39:55 +0100 +Subject: [PATCH] configure.ac: add detection of `pty.h` + +Without the change the build on modern autoconf fails as: + + c/tty.c: In function 'allocate_master': + c/tty.c:398:14: error: implicit declaration of function 'openpty'; did you mean 'openat'? [-Wimplicit-function-declaration] + 398 | rc = openpty (&master_fd, &slave_fd, NULL, NULL, NULL); + | ^~~~~~~ + | openat +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 99779dc..1cd8b22 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -32,7 +32,7 @@ CPPFLAGS="$CPPFLAGS -I$S48DIR/include" + # Checks for libraries. + + # Checks for header files. +-AC_CHECK_HEADERS([fcntl.h limits.h netdb.h sgtty.h stdlib.h string.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utime.h]) ++AC_CHECK_HEADERS([fcntl.h limits.h netdb.h pty.h sgtty.h stdlib.h string.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utime.h]) + + dnl We need the scheme48.h headers, so bomb out if we can't find them. + AC_CHECK_HEADERS([scheme48.h], [], diff --git a/pkgs/by-name/sc/scsh/package.nix b/pkgs/by-name/sc/scsh/package.nix index d6d9d1a2ca22..7199980aa06a 100644 --- a/pkgs/by-name/sc/scsh/package.nix +++ b/pkgs/by-name/sc/scsh/package.nix @@ -19,6 +19,15 @@ stdenv.mkDerivation { fetchSubmodules = true; }; + patches = [ + # Fix the build against gcc-14: + # https://github.com/scheme/scsh/pull/50 + ./gcc-14-p1.patch + # Fix the build against gcc-14: + # https://github.com/scheme/scsh/pull/51 + ./gcc-14-p2.patch + ]; + nativeBuildInputs = [ autoreconfHook ]; buildInputs = [ scheme48 ]; configureFlags = [ "--with-scheme48=${scheme48}" ];