Unverified Commit b3991179 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

scsh: fix the build against `gcc-14` (#402657)

parents b8f5fd33 0140aa3c
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
https://github.com/scheme/scsh/pull/50.patch

From edced224436fa70cd7d885fe65996b9c3cfd33d7 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
Date: Mon, 28 Apr 2025 22:40:31 +0100
Subject: [PATCH] c/syscalls.c: add missing `<time.h>` 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 '<time.h>'; this is probably fixable by adding '#include <time.h>'
       40 | #include "syscalls.h"
      +++ |+#include <time.h>
       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 <stdio.h>
 #include <stdlib.h>
+#include <time.h> /* for time() */
 #include <sys/signal.h>
 #include <signal.h>
 #include <sys/types.h>
+31 −0
Original line number Diff line number Diff line
https://github.com/scheme/scsh/pull/51.patch

From b2934abb68d6adab448f24787192c047e46cf17c Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyich@gmail.com>
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], [],
+9 −0
Original line number Diff line number Diff line
@@ -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}" ];