diff options
author | Sam James <sam@gentoo.org> | 2023-02-11 04:24:06 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-02-11 04:24:06 +0000 |
commit | 164c0cdd484ca9fcdfcc8b6a2cba98ffd77e689b (patch) | |
tree | a3fd3b24ee15484a56ea88b4caa99fbd2a7b2989 | |
parent | sys-boot/netboot: fix configure w/ clang 16 (diff) | |
download | gentoo-164c0cdd484ca9fcdfcc8b6a2cba98ffd77e689b.tar.gz gentoo-164c0cdd484ca9fcdfcc8b6a2cba98ffd77e689b.tar.bz2 gentoo-164c0cdd484ca9fcdfcc8b6a2cba98ffd77e689b.zip |
dev-perl/Tk: fix configure w/ clang 16, backport other crash fixes
But still doesn't build w/ clang 16.
Bug: https://bugs.gentoo.org/883391
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | dev-perl/Tk/Tk-804.36.0-r1.ebuild | 69 | ||||
-rw-r--r-- | dev-perl/Tk/files/Tk-804.036-configure-clang16.patch | 40 | ||||
-rw-r--r-- | dev-perl/Tk/files/Tk-804.036-crash.patch | 167 |
3 files changed, 276 insertions, 0 deletions
diff --git a/dev-perl/Tk/Tk-804.36.0-r1.ebuild b/dev-perl/Tk/Tk-804.36.0-r1.ebuild new file mode 100644 index 000000000000..e7ee25baa373 --- /dev/null +++ b/dev-perl/Tk/Tk-804.36.0-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2023 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 ~sparc-solaris ~x86-solaris" +IUSE="" + +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 +) + +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-configure-clang16.patch b/dev-perl/Tk/files/Tk-804.036-configure-clang16.patch new file mode 100644 index 000000000000..6d16a0505947 --- /dev/null +++ b/dev-perl/Tk/files/Tk-804.036-configure-clang16.patch @@ -0,0 +1,40 @@ +https://github.com/eserte/perl-tk/pull/79 +https://github.com/eserte/perl-tk/pull/80 + +From f7565b07f40e0cc3820e8fb0c3d2e7b5abb5eeeb Mon Sep 17 00:00:00 2001 +From: Christopher Chavez <chrischavez@gmx.us> +Date: Fri, 12 Mar 2021 07:24:18 -0600 +Subject: [PATCH] Fix some implicit function declarations + +Hstrdup.c: missing stdlib.h for exit() +Hstrtoul.c: missing string.h for strcmp() +--- a/pTk/config/Hstrdup.c ++++ b/pTk/config/Hstrdup.c +@@ -1,3 +1,4 @@ ++#include <stdlib.h> + #include <string.h> + + #define STRING "Whatever" +--- a/pTk/config/Hstrtoul.c ++++ b/pTk/config/Hstrtoul.c +@@ -1,4 +1,5 @@ + #include <stdlib.h> ++#include <string.h> + + int main() + {char *e; + +From 47219864d6ef3fe0c5616cada78e3008447a96a1 Mon Sep 17 00:00:00 2001 +From: Christopher Chavez <chrischavez@gmx.us> +Date: Fri, 12 Mar 2021 07:28:22 -0600 +Subject: [PATCH] signedchar.c: use int main to avoid C99 warning + +--- a/config/signedchar.c ++++ b/config/signedchar.c +@@ -1,4 +1,4 @@ +-main() ++int main() + { + signed char x = 'a'; + return (x - 'a'); + diff --git a/dev-perl/Tk/files/Tk-804.036-crash.patch b/dev-perl/Tk/files/Tk-804.036-crash.patch new file mode 100644 index 000000000000..f83b8103fdb8 --- /dev/null +++ b/dev-perl/Tk/files/Tk-804.036-crash.patch @@ -0,0 +1,167 @@ +https://github.com/eserte/perl-tk/pull/48 +https://github.com/eserte/perl-tk/pull/89 + +From e7c5041b4fff6210bc0348c72b538efae32aede3 Mon Sep 17 00:00:00 2001 +From: Karl Williamson <khw@cpan.org> +Date: Thu, 28 Mar 2019 22:59:17 -0500 +Subject: [PATCH 1/3] Fix segfaults due to parameter size mismatch + +See: https://rt.cpan.org/Ticket/Display.html?id=128955 +As also done upstream: https://core.tcl-lang.org/tk/info/0d9c0d50f9 +--- a/pTk/mTk/generic/tkCanvText.c ++++ b/pTk/mTk/generic/tkCanvText.c +@@ -1234,8 +1234,7 @@ GetTextIndex(interp, canvas, itemPtr, obj, indexPtr) + * index. */ + { + TextItem *textPtr = (TextItem *) itemPtr; +- size_t length; +- int c; ++ int c, length; + TkCanvas *canvasPtr = (TkCanvas *) canvas; + Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; + char *string; +--- a/pTk/mTk/generic/tkFrame.c ++++ b/pTk/mTk/generic/tkFrame.c +@@ -493,8 +493,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName) + CONST char *className, *screenName, *colormapName, *arg; + Tcl_Obj *visualName; + Tcl_Obj *useOption; +- int i, c, depth; +- size_t length; ++ int i, c, depth, length; + unsigned int mask; + Colormap colormap; + Visual *visual; +@@ -749,8 +748,7 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) + }; + register Frame *framePtr = (Frame *) clientData; + int result = TCL_OK, index; +- size_t length; +- int c, i; ++ int c, i, length; + Tcl_Obj *objPtr; + + if (objc < 2) { + +From 2bba8c45fcbcd9f3d45b7bc5f290e324d7c01a13 Mon Sep 17 00:00:00 2001 +From: Christopher Chavez <chrischavez@gmx.us> +Date: Fri, 12 Feb 2021 11:28:48 -0600 +Subject: [PATCH 2/3] tkFrame.c: remove redundant casts + +--- a/pTk/mTk/generic/tkFrame.c ++++ b/pTk/mTk/generic/tkFrame.c +@@ -522,7 +522,7 @@ CreateFrame(clientData, interp, objc, objv, type, appName) + visualName = NULL; + colormap = None; + for (i = 2; i < objc; i += 2) { +- arg = Tcl_GetStringFromObj(objv[i], (int *) &length); ++ arg = Tcl_GetStringFromObj(objv[i], &length); + if (length < 2) { + continue; + } +@@ -796,7 +796,7 @@ FrameWidgetObjCmd(clientData, interp, objc, objv) + */ + + for (i = 2; i < objc; i++) { +- char *arg = Tcl_GetStringFromObj(objv[i], (int *) &length); ++ char *arg = Tcl_GetStringFromObj(objv[i], &length); + if (length < 2) { + continue; + } + +From 3dd0956e92df84ec0e788368ff0214e527d28dd8 Mon Sep 17 00:00:00 2001 +From: Christopher Chavez <chrischavez@gmx.us> +Date: Fri, 12 Feb 2021 11:29:16 -0600 +Subject: [PATCH 3/3] tkImgPhoto.c: fix instances of RT #128955 + +Remove unnecessary casts to (int *) +As done upstream: https://core.tcl-lang.org/tk/info/0d9c0d50f9 +--- a/pTk/mTk/generic/tkImgPhoto.c ++++ b/pTk/mTk/generic/tkImgPhoto.c +@@ -676,10 +676,9 @@ ImgPhotoCmd(clientData, interp, objc, objv) + XColor color; + Tk_PhotoImageFormat *imageFormat; + int imageWidth, imageHeight; +- int matched; ++ int length, matched; + Tcl_Channel chan; + Tk_PhotoHandle srcHandle; +- size_t length; + Tcl_Obj *obj; + int c; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) +@@ -723,7 +722,7 @@ ImgPhotoCmd(clientData, interp, objc, objv) + Tcl_WrongNumArgs(interp, 2, objv, "option"); + return TCL_ERROR; + } +- arg = Tcl_GetStringFromObj(objv[2], (int *) &length); ++ arg = Tcl_GetStringFromObj(objv[2], &length); + if (strncmp(arg,"-data", length) == 0) { + if (masterPtr->dataString) { + Tcl_SetObjResult(interp, masterPtr->dataString); +@@ -768,7 +767,7 @@ ImgPhotoCmd(clientData, interp, objc, objv) + return TCL_OK; + } + if (objc == 3) { +- char *arg = Tcl_GetStringFromObj(objv[2], (int *) &length); ++ char *arg = Tcl_GetStringFromObj(objv[2], &length); + if (!strncmp(arg, "-data", length)) { + Tcl_Obj *subobj = Tcl_NewStringObj("-data {} {} {}", 14); + if (masterPtr->dataString) { +@@ -5753,8 +5752,8 @@ PhotoOptionFind(interp, obj) + Tcl_Interp *interp; /* Interpreter that is being deleted. */ + Tcl_Obj *obj; /* Name of option to be found. */ + { +- size_t length; +- char *name = Tcl_GetStringFromObj(obj, (int *) &length); ++ int length; ++ char *name = Tcl_GetStringFromObj(obj, &length); + OptionAssocData *list; + char *prevname = NULL; + Tcl_ObjCmdProc *proc = (Tcl_ObjCmdProc *) NULL; + +From 0cc1fd7c599fc6b7050fcd7442f10824b032c462 Mon Sep 17 00:00:00 2001 +From: "jan.nijtmans" <nijtmans@users.sourceforge.net> +Date: Thu, 3 Jan 2019 20:53:24 +0000 +Subject: [PATCH] Fix for conflicting symbols in X.h and Windows.h + +Backported from Tcl/Tk 8.6.10: +see https://core.tcl-lang.org/tk/info/9e31fd944934 + +Fixes #87 +--- a/pTk/mTk/xlib/X11/X.h ++++ b/pTk/mTk/xlib/X11/X.h +@@ -73,7 +73,9 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs + * RESERVED RESOURCE AND CONSTANT DEFINITIONS + *****************************************************************/ + +-#define None 0L /* universal null resource or null atom */ ++#ifndef _WIN32 ++# define None 0L /* See bug [9e31fd9449] and below */ ++#endif + + #define ParentRelative 1L /* background pixmap in CreateWindow + and ChangeWindowAttributes */ +@@ -179,13 +181,20 @@ are reserved in the protocol for errors and replies. */ + + #define ShiftMask (1<<0) + #define LockMask (1<<1) +-#define ControlMask (1<<2) ++#ifndef _WIN32 ++# define ControlMask (1<<2) /* See bug [9e31fd9449] and below */ ++#endif + #define Mod1Mask (1<<3) + #define Mod2Mask (1<<4) + #define Mod3Mask (1<<5) + #define Mod4Mask (1<<6) + #define Mod5Mask (1<<7) + ++/* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */ ++#ifdef _WIN32 ++enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) }; ++#endif ++ + /* modifier names. Used to build a SetModifierMapping request or + to read a GetModifierMapping request. These correspond to the + masks defined above. */ + |