commit:     0af28746d5e07d8063d14b16d3c9aca4bcd17d75
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 04:13:23 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun  6 04:13:38 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0af28746

dev-perl/Term-ReadLine-Gnu: fix build w/ c23

Closes: https://bugs.gentoo.org/943894
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../Term-ReadLine-Gnu-1.460.0-r1.ebuild            | 41 ++++++++++++++++++++
 .../files/Term-ReadLine-Gnu-1.46-c23.patch         | 44 ++++++++++++++++++++++
 2 files changed, 85 insertions(+)

diff --git a/dev-perl/Term-ReadLine-Gnu/Term-ReadLine-Gnu-1.460.0-r1.ebuild 
b/dev-perl/Term-ReadLine-Gnu/Term-ReadLine-Gnu-1.460.0-r1.ebuild
new file mode 100644
index 000000000000..e7d51a7e5bf9
--- /dev/null
+++ b/dev-perl/Term-ReadLine-Gnu/Term-ReadLine-Gnu-1.460.0-r1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DIST_AUTHOR=HAYASHI
+DIST_VERSION=1.46
+DIST_EXAMPLES=("eg/*")
+inherit perl-module
+
+DESCRIPTION="Perl extension for the GNU Readline/History Library"
+
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 
~amd64-linux ~x86-linux"
+
+RDEPEND="
+       >=sys-libs/readline-6.2:=
+       sys-libs/ncurses:=
+"
+DEPEND="
+       ${RDEPEND}
+"
+# Newer MakeMaker needed for macOS at least
+BDEPEND="
+       ${RDEPEND}
+       >=virtual/perl-ExtUtils-MakeMaker-7.580.0
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.46-c23.patch
+)
+
+src_prepare() {
+       default
+
+       # search_termlib() selects termcap when sys-libs/libtermcap-compat is 
installed
+       # despite the absence of libtermcap.so symlink
+       sed -i -e \
+               "s/search_termlib()/search_lib('-ltinfo') || 
search_lib('-lncurses')/" \
+               Makefile.PL || die
+}

diff --git a/dev-perl/Term-ReadLine-Gnu/files/Term-ReadLine-Gnu-1.46-c23.patch 
b/dev-perl/Term-ReadLine-Gnu/files/Term-ReadLine-Gnu-1.46-c23.patch
new file mode 100644
index 000000000000..5d1ad4f123a4
--- /dev/null
+++ b/dev-perl/Term-ReadLine-Gnu/files/Term-ReadLine-Gnu-1.46-c23.patch
@@ -0,0 +1,44 @@
+https://bugs.gentoo.org/943894
+https://github.com/hirooih/perl-trg/commit/90ebd3f65652484994c838f5dc62944aee67a2a0
+
+From 90ebd3f65652484994c838f5dc62944aee67a2a0 Mon Sep 17 00:00:00 2001
+From: Paul Howarth <[email protected]>
+Date: Thu, 23 Jan 2025 10:33:01 +0000
+Subject: [PATCH] Fix for compilation in C23 mode
+
+This (-std=c23) is the default for gcc 15.
+
+Function pointer casts added as per many existing entries in the same
+table, and void parameter of XFunction() made explicit.
+---
+ Gnu.xs | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/Gnu.xs b/Gnu.xs
+index 557fb7a..9c70295 100644
+--- a/Gnu.xs
++++ b/Gnu.xs
+@@ -613,7 +613,7 @@ enum { STARTUP_HOOK, EVENT_HOOK, GETC_FN, REDISPLAY_FN,
+        SIG_EVT, INP_AVL, FN_STAT, TIMEOUT_EVENT,
+ };
+ 
+-typedef int XFunction ();
++typedef int XFunction (void);
+ static struct fn_vars {
+   XFunction **rlfuncp;          /* GNU Readline Library variable */
+   XFunction *defaultfn;         /* default function */
+@@ -622,7 +622,12 @@ static struct fn_vars {
+ } fn_tbl[] = {
+   { &rl_startup_hook,   NULL,   startup_hook_wrapper,   NULL }, /* 0 */
+   { &rl_event_hook,     NULL,   event_hook_wrapper,     NULL }, /* 1 */
+-  { &rl_getc_function,  rl_getc, getc_function_wrapper, NULL }, /* 2 */
++  {
++    (XFunction **)&rl_getc_function,                            /* 2 */
++    (XFunction *)rl_getc,
++    (XFunction *)getc_function_wrapper,
++    NULL
++  },
+   {
+     (XFunction **)&rl_redisplay_function,                       /* 3 */
+     (XFunction *)rl_redisplay,
+

Reply via email to