From e9aadf32a0da5f9af2b495833f7ead74ee4b65a3 Mon Sep 17 00:00:00 2001
From: mio <miyopan@e.email>
Date: Fri, 23 Aug 2024 18:13:20 +0000
Subject: [PATCH] community/ckermit: fix build with gcc 14

---
 community/ckermit/APKBUILD    |  12 ++--
 community/ckermit/gcc14.patch | 102 ++++++++++++++++++++++++++++++++++
 2 files changed, 110 insertions(+), 4 deletions(-)
 create mode 100644 community/ckermit/gcc14.patch

diff --git a/community/ckermit/APKBUILD b/community/ckermit/APKBUILD
index 2bd2564ca86d..80630904200c 100644
--- a/community/ckermit/APKBUILD
+++ b/community/ckermit/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Francesco Colista <fcolista@alpinelinux.org>
 pkgname=ckermit
 pkgver=9.0.302
-pkgrel=5
+pkgrel=6
 pkgdesc="Portable scriptable network and serial communication software"
 url="http://www.columbia.edu/kermit/ck90.html"
 arch="all"
@@ -11,7 +11,8 @@ options="!check" #no test avail
 makedepends="ncurses-dev"
 subpackages="$pkgname-doc"
 source="http://www.kermitproject.org/ftp/kermit/archives/cku${pkgver/9.0./}.tar.gz
-	makefile.patch"
+	makefile.patch
+	gcc14.patch"
 builddir="$srcdir"
 
 build() {
@@ -29,5 +30,8 @@ package() {
 	install -m 755 _tmp.ini $pkgdir/usr/bin/ckermit.ini
 }
 
-sha512sums="2cfc264e5262d29618fdf218fd3407fd9049b16110972cdddb03d114703b7a0ea13c4b0a354f50c2a9f70d4727732fe4d1920b5c656f969bc56c1eb9dc3c43fa  cku302.tar.gz
-aa23587ba85ac26e0ad5c4e0ed82d07174c67a00c76995055574b521e5f7d1d7b99696ee976b5c1943b0dc6cd837b83a94be19a38624963ea38be58e6bf7559a  makefile.patch"
+sha512sums="
+2cfc264e5262d29618fdf218fd3407fd9049b16110972cdddb03d114703b7a0ea13c4b0a354f50c2a9f70d4727732fe4d1920b5c656f969bc56c1eb9dc3c43fa  cku302.tar.gz
+aa23587ba85ac26e0ad5c4e0ed82d07174c67a00c76995055574b521e5f7d1d7b99696ee976b5c1943b0dc6cd837b83a94be19a38624963ea38be58e6bf7559a  makefile.patch
+f816dfe03b6eeff915ab4db6351f0718b17fa4ca4d677a211bb6e26abd46131427497bbf2db385db6b9f8420475031b4be6d10862d766e21f305b861c50d8328  gcc14.patch
+"
diff --git a/community/ckermit/gcc14.patch b/community/ckermit/gcc14.patch
new file mode 100644
index 000000000000..7107c5077d50
--- /dev/null
+++ b/community/ckermit/gcc14.patch
@@ -0,0 +1,102 @@
+--- ckermit-9.0.302-origin/ckcmai.c
++++ ckermit-9.0.302/ckcmai.c
+@@ -67,6 +67,9 @@
+ static char sccsid[] = "@(#)C-Kermit 9.0.302";
+ #endif /* UNIX */
+ 
++/* For time() */
++#include <time.h>
++
+ /*
+   The C-Kermit Version number is major.minor.edit (integers).
+   Major version always goes up.
+--- ckermit-9.0.302-origin/ckucmd.h
++++ ckermit-9.0.302/ckucmd.h
+@@ -280,9 +280,7 @@
+ _PROTOTYP( int cmdgquo, (void) );
+ _PROTOTYP( char * ckcvtdate, (char *, int) );
+ _PROTOTYP( int cmdgetc, (int));
+-#ifndef NOARROWKEYS
+ _PROTOTYP( int cmdconchk, (void) );
+-#endif /* NOARROWKEYS */
+ 
+ #ifdef CK_RECALL
+ _PROTOTYP( char * cmgetcmd, (char *) );
+--- ckermit-9.0.302-origin/ckufio.c
++++ ckermit-9.0.302/ckufio.c
+@@ -5040,13 +5040,15 @@
+             }
+             tmx += n;
+         }
+-        time_stamp = localtime(&tmx);
++        time_t tm = tmx;
++        time_stamp = localtime(&tm);
+         debug(F101,"zstrdt tmx 1","",tmx);
+         if (!time_stamp)
+           return(-1);
+ #ifdef COMMENT
+         /* Why was this here? */
+-        time_stamp = localtime(&tmx);
++        time_t tm = tmx;
++        time_stamp = localtime(&tm);
+         debug(F101,"zstrdt tmx 2","",tmx);
+ #endif /* COMMENT */
+ #ifdef BSD44
+@@ -5260,7 +5262,8 @@
+   be able to feed it to localtime() and have it converted to a struct tm
+   representing the local time equivalent of the given UTC time.
+ */
+-        time_stamp = localtime(&tmx);
++        time_t tm = tmx;
++        time_stamp = localtime(&tm);
+         if (!time_stamp)
+           return(NULL);
+     }
+--- ckermit-9.0.302-origin/ckupty.c
++++ ckermit-9.0.302/ckupty.c
+@@ -682,6 +682,8 @@
+     return(0);
+ }
+ 
++/* For openpty() */
++#include <pty.h>
+ long
+ pty_getpty(fd, slave, slavelength) int slavelength; int *fd; char *slave; {
+     char *cp;
+--- ckermit-9.0.302-origin/ckutio.c
++++ ckermit-9.0.302/ckutio.c
+@@ -14123,6 +14123,8 @@
+ #endif	/* PTY_NO_NDELAY */
+ #endif	/* O_NDELAY */
+ 
++/* For openpty() */
++#include <pty.h>
+ #ifndef HAVE_OPENPTY
+ #ifndef USE_CKUPTY_C
+ #define USE_CKUPTY_C
+--- ckermit-9.0.302-origin/ckuusx.c
++++ ckermit-9.0.302/ckuusx.c
+@@ -5877,12 +5877,10 @@
+ #endif /* MYCURSES */
+ #endif /* VMS */
+ 
+-#ifdef BUG999
+ _PROTOTYP(int tgetent,(char *, char *));
+ _PROTOTYP(char *tgetstr,(char *, char **));
+ _PROTOTYP(int tputs,(char *, int, int (*)()));
+ _PROTOTYP(char *tgoto,(const char *, int, int));
+-#endif	/* BUG999 */
+ 
+ #endif /* CK_CURSES */
+ 
+--- ckermit-9.0.302-origin/ckwart.c
++++ ckermit-9.0.302/ckwart.c
+@@ -528,7 +528,7 @@
+ #endif /* CK_SCOV5 */
+ #endif /* MAINTYPE */
+ #endif /* STRATUS */
+-main(argc,argv) int argc; char **argv; {
++void main(argc,argv) int argc; char **argv; {
+     trans head;
+     int state,c;
+     FILE *infile,*outfile;
-- 
GitLab