commit:     af217418e5e0905eb688273cc2548d6b81c07967
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 14 06:31:58 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 14 06:33:16 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=af217418

dev-perl/Tk: further Modern C fixes

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

 dev-perl/Tk/Tk-804.36.0-r4.ebuild               | 73 +++++++++++++++++++++++++
 dev-perl/Tk/files/Tk-804.036-c99-old_warn.patch | 38 +++++++++++++
 dev-perl/Tk/files/Tk-804.036-c99-pregcomp.patch | 20 +++++++
 dev-perl/Tk/files/Tk-804.036-c99.patch          | 56 +++++++++++++++++++
 4 files changed, 187 insertions(+)

diff --git a/dev-perl/Tk/Tk-804.36.0-r4.ebuild 
b/dev-perl/Tk/Tk-804.36.0-r4.ebuild
new file mode 100644
index 000000000000..dae9c9bf25eb
--- /dev/null
+++ b/dev-perl/Tk/Tk-804.36.0-r4.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DIST_AUTHOR=SREZIC
+DIST_VERSION=804.036
+DIST_EXAMPLES=("examples/*")
+inherit perl-module virtualx
+
+DESCRIPTION="A Perl Module for Tk"
+
+LICENSE+=" tcltk BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+
+DEPEND="
+       media-libs/freetype
+       media-libs/libjpeg-turbo:=
+       >=media-libs/libpng-1.4:0
+       x11-libs/libX11
+       x11-libs/libXft
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-804.034-xorg.patch
+       "${FILESDIR}"/${PN}-804.036-configure-clang16.patch
+       "${FILESDIR}"/${PN}-804.036-crash.patch
+       "${FILESDIR}"/${PN}-804.036-incompatible-function-pointer-types.patch
+       
"${FILESDIR}"/${PN}-804.036-Fix-STRLEN-vs-int-pointer-confusion-in-Tcl_GetByteAr.patch
+       "${FILESDIR}"/${PN}-804.036-c99.patch
+       "${FILESDIR}"/${PN}-804.036-c99-pregcomp.patch
+       "${FILESDIR}"/${PN}-804.036-c99-old_warn.patch
+)
+
+PERL_RM_FILES=( "t/pod.t" )
+
+src_prepare() {
+       myconf=( X11ROOT="${EPREFIX}"/usr XFT=1 -I"${EPREFIX}"/usr/include/ 
-l"${EPREFIX}"/usr/$(get_libdir) )
+       mydoc="ToDo VERSIONS"
+
+       perl-module_src_prepare
+       # fix detection logic for Prefix, bug #385621
+       sed -i -e "s:/usr:${EPREFIX}/usr:g" myConfig || die
+       # having this around breaks with perl-module and a case-IN-sensitive fs
+       rm build_ptk || die
+
+       # Remove all bundled libs, fixes #488194
+       local BUNDLED="PNG/libpng \
+                                       PNG/zlib \
+                                       JPEG/jpeg"
+
+       # Move files required for tests temporarily
+
+       mkdir -p "${T}/stash" || die "can't create temporary stash"
+       mv "${S}/JPEG/jpeg/testimg.jpg" "${T}/stash/testimg.jpg" || die "can't 
move testimg.jpg"
+
+       for dir in ${BUNDLED}; do
+               einfo "Removing bundled: ${dir}"
+               rm -r "${S}/${dir}" || die "Can't remove bundle"
+               # Makefile.PL can copy files to ${S}/${dir}, so recreate them 
back.
+               mkdir -p "${S}/${dir}" || die "Can't restore bundled dir"
+               sed -i "\#^${dir}#d" "${S}"/MANIFEST || die 'Can not remove 
bundled libs from MANIFEST'
+       done
+
+       # Restore test files
+       mv "${T}/stash/testimg.jpg" "${S}/JPEG/jpeg/testimg.jpg" || die "can't 
restore testimg.jpg"
+}
+
+src_test() {
+       virtx perl-module_src_test
+}

diff --git a/dev-perl/Tk/files/Tk-804.036-c99-old_warn.patch 
b/dev-perl/Tk/files/Tk-804.036-c99-old_warn.patch
new file mode 100644
index 000000000000..976a6a6dfefd
--- /dev/null
+++ b/dev-perl/Tk/files/Tk-804.036-c99-old_warn.patch
@@ -0,0 +1,38 @@
+https://src.fedoraproject.org/rpms/perl-Tk/blob/rawhide/f/perl-Tk-Avoid-using-incompatible-pointer-type-for-old_warn.patch
+
+From c4cd966ed0997e2acb1fdcaf112c55a78ed50847 Mon Sep 17 00:00:00 2001
+From: Christopher Chavez <[email protected]>
+Date: Mon, 19 Feb 2024 14:18:43 -0600
+Subject: [PATCH] Avoid using incompatible pointer type for `old_warn`
+
+See https://github.com/eserte/perl-tk/issues/98#issuecomment-1944054296
+--- a/Event/Event.xs
++++ b/Event/Event.xs
+@@ -1532,7 +1532,7 @@ PROTOTYPES: DISABLE
+ BOOT:
+  {
+ #ifdef pWARN_NONE
+-  SV *old_warn = PL_curcop->cop_warnings;
++  void *old_warn = PL_curcop->cop_warnings;
+   PL_curcop->cop_warnings = pWARN_NONE;
+ #endif
+   newXS("Tk::Event::INIT", XS_Tk__Event_INIT, file);
+--- a/tkGlue.c
++++ b/tkGlue.c
+@@ -5543,13 +5543,8 @@ _((pTHX))
+  char *XEventMethods = "abcdfhkmopstvwxyABDEKNRSTWXY#";
+  char buf[128];
+  CV *cv;
+-#if PERL_REVISION > 5 || (PERL_REVISION == 5 && PERL_VERSION >= 9)
+-#define COP_WARNINGS_TYPE STRLEN*
+-#else
+-#define COP_WARNINGS_TYPE SV*
+-#endif
+ #ifdef pWARN_NONE
+- COP_WARNINGS_TYPE old_warn = PL_curcop->cop_warnings;
++ void *old_warn = PL_curcop->cop_warnings;
+  PL_curcop->cop_warnings = pWARN_NONE;
+ #endif
+ 
+-- 
+2.43.0

diff --git a/dev-perl/Tk/files/Tk-804.036-c99-pregcomp.patch 
b/dev-perl/Tk/files/Tk-804.036-c99-pregcomp.patch
new file mode 100644
index 000000000000..6ec56b6905ab
--- /dev/null
+++ b/dev-perl/Tk/files/Tk-804.036-c99-pregcomp.patch
@@ -0,0 +1,20 @@
+https://bugs.gentoo.org/920309
+https://src.fedoraproject.org/rpms/perl-Tk/blob/rawhide/f/perl-Tk-pregcomp2.c-Avoid-using-incompatible-pointer-type.patch
+
+From 5c646b1cc55e18648918f101961afd1589a58168 Mon Sep 17 00:00:00 2001
+From: Christopher Chavez <[email protected]>
+Date: Mon, 19 Feb 2024 13:50:44 -0600
+Subject: [PATCH] pregcomp2.c: Avoid using incompatible pointer type
+
+See https://github.com/eserte/perl-tk/issues/98#issuecomment-1948125587
+--- a/config/pregcomp2.c
++++ b/config/pregcomp2.c
+@@ -4,5 +4,5 @@
+ 
+ int main() {
+     SV* sv = newSViv(0);
+-    regexp* rx = pregcomp(sv, 0);
++    void* rx = pregcomp(sv, 0);
+ }
+-- 
+2.43.0

diff --git a/dev-perl/Tk/files/Tk-804.036-c99.patch 
b/dev-perl/Tk/files/Tk-804.036-c99.patch
new file mode 100644
index 000000000000..357d6f13f3c1
--- /dev/null
+++ b/dev-perl/Tk/files/Tk-804.036-c99.patch
@@ -0,0 +1,56 @@
+https://bugs.gentoo.org/919179
+https://src.fedoraproject.org/rpms/perl-Tk/raw/rawhide/f/perl-Tk-c99.patch
+https://github.com/eserte/perl-tk/pull/91
+--- a/config/unsigned.c
++++ b/config/unsigned.c
+@@ -1,15 +1,16 @@
++#include <stdio.h>
+ int main()
+ {
+  char x[] = "\377";
+  if (x[0] > 0)
+   {
+    printf("char is unsigned type\n");
+-   exit(0);
++   return 0;
+   }
+  else
+   {
+    printf("char is signed type\n");
+-   exit(1);
++   return 1;
+   }
+ }
+ 
+--- a/pTk/config/Hstrdup.c
++++ b/pTk/config/Hstrdup.c
+@@ -7,7 +7,7 @@ int main()
+ {char *e;
+  char *p = strdup(STRING);
+  if (!p || strcmp(p,STRING))
+-  exit(1);
++  return 1;
+  return 0;
+ }
+ 
+--- a/pTk/mTk/generic/tkEvent.c
++++ b/pTk/mTk/generic/tkEvent.c
+@@ -1153,6 +1153,7 @@ TkEventDeadWindow(winPtr)
+ Time
+ TkCurrentTime(dispPtr, fallbackCurrent)
+     TkDisplay *dispPtr;               /* Display for which the time is 
desired. */
++    int fallbackCurrent;
+ {
+     register XEvent *eventPtr;
+     ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+--- a/pTk/mTk/generic/tkImage.c
++++ b/pTk/mTk/generic/tkImage.c
+@@ -1083,6 +1083,8 @@ int x;
+ int y;
+ int width;
+ int height;
++int imgWidth;
++int imgHeight;
+ {
+     Tk_Tile tile = (Tk_Tile) clientData;
+     Tk_TileChange *handler;

Reply via email to