diff --git a/srcpkgs/perl-Tk/patches/SvPV-incompatible-pointer-types.patch b/srcpkgs/perl-Tk/patches/SvPV-incompatible-pointer-types.patch new file mode 100644 index 00000000000..c1ca0eb4d12 --- /dev/null +++ b/srcpkgs/perl-Tk/patches/SvPV-incompatible-pointer-types.patch @@ -0,0 +1,47 @@ +Source: https://salsa.debian.org/georgesk/perl-tk/-/blob/f172ffdd2f7e59097c7f13028996c656019a061c/debian/patches/80-Fix-STRLEN-vs-int-pointer-confusion-in-Tcl_GetByteAr.patch + +From a26233c844c52f49ef9cca5f88dd9063aac60d0f Mon Sep 17 00:00:00 2001 +From: Niko Tyni +Date: Thu, 11 Jan 2024 18:28:58 +0000 +Subject: [PATCH] Fix STRLEN vs int pointer confusion in + Tcl_GetByteArrayFromObj() + +Perl 5.37.2, more precisely commit + + https://github.com/Perl/perl5/commit/1ef9039bccbfe64f47f201b6cfb7d6d23e0b08a7 + +changed the implementation of SvPV() et al., breaking t/balloon.t, +t/canvas2.t and t/photo.t on big-endian 64-bit architectures such as +ppc64 and s390x because StringMatchGIF() no longer recognized GIF files. + +This is because Tcl_GetByteArrayFromObj() was calling SvPV() with an int +pointer instead of a correct STRLEN pointer, and the new implementation +is more sensitive to this: it assigns the pointers as-is, resulting in +the int pointer pointing at the wrong end of the 64-bit length. + +Other functions taking a length pointer, at least Tcl_GetStringFromObj() +already seem to do things correctly, so presumably this is not a +systematic issue. +--- + objGlue.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/objGlue.c b/objGlue.c +index d4927ea..dbd6a50 100644 +--- a/objGlue.c ++++ b/objGlue.c +@@ -627,7 +627,10 @@ Tcl_GetByteArrayFromObj(Tcl_Obj * objPtr, int * lengthPtr) + sv_utf8_downgrade(objPtr, 0); + if (lengthPtr) + { +- return (unsigned char *) SvPV(objPtr, *lengthPtr); ++ STRLEN len; ++ unsigned char *s = SvPV(objPtr, len); ++ *lengthPtr = len; ++ return s; + } + else + { +-- +2.30.2 + diff --git a/srcpkgs/perl-Tk/patches/gcc14.patch b/srcpkgs/perl-Tk/patches/gcc14.patch new file mode 100644 index 00000000000..78d863795c3 --- /dev/null +++ b/srcpkgs/perl-Tk/patches/gcc14.patch @@ -0,0 +1,198 @@ +Source: https://gitlab.alpinelinux.org/alpine/aports/-/blob/48a858e7ec54d7c3dceeb520883e4a5f36b4f284/main/perl-tk/gcc14.patch + +--- config/signedchar.c ++++ ./config/signedchar.c +@@ -1,4 +1,4 @@ +-main() ++int main() + { + signed char x = 'a'; + return (x - 'a'); +--- config/unsigned.c ++++ ./config/unsigned.c +@@ -1,3 +1,5 @@ ++#include ++ + int main() + { + char x[] = "\377"; +--- pTk/config/Hstrdup.c ++++ ./pTk/config/Hstrdup.c +@@ -1,4 +1,5 @@ + #include ++#include + + #define STRING "Whatever" + +--- pTk/config/Hstrtoul.c ++++ ./pTk/config/Hstrtoul.c +@@ -1,3 +1,4 @@ ++#include + #include + + int main() +--- pTk/mTk/generic/tkEvent.c ++++ ./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 *) +--- pTk/mTk/generic/tkImage.c ++++ ./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; +--- Event/Event.xs ++++ ./Event/Event.xs +@@ -1532,7 +1532,7 @@ PROTOTYPES: DISABLE + BOOT: + { + #ifdef pWARN_NONE +- SV *old_warn = PL_curcop->cop_warnings; ++ char *old_warn = PL_curcop->cop_warnings; + PL_curcop->cop_warnings = pWARN_NONE; + #endif + newXS("Tk::Event::INIT", XS_Tk__Event_INIT, file); +--- config/pregcomp2.c ++++ ./config/pregcomp2.c +@@ -4,5 +4,5 @@ + + int main() { + SV* sv = newSViv(0); +- regexp* rx = pregcomp(sv, 0); ++ void *rx = (void *) pregcomp(sv, 0); + } +--- pTk/Xlib.t ++++ ./pTk/Xlib.t +@@ -331,7 +331,7 @@ VFUNC(int,XIntersectRegion,V_XIntersectR + #endif /* !DO_X_EXCLUDE */ + + #ifndef XKeycodeToKeysym +-VFUNC(KeySym,XKeycodeToKeysym,V_XKeycodeToKeysym,_ANSI_ARGS_((Display *, unsigned int, int))) ++VFUNC(KeySym,XKeycodeToKeysym,V_XKeycodeToKeysym,_ANSI_ARGS_((Display *, unsigned char, int))) + #endif /* #ifndef XKeycodeToKeysym */ + + #ifndef XKeysymToString +--- pTk/mTk/generic/tkCanvText.c ++++ ./pTk/mTk/generic/tkCanvText.c +@@ -1250,7 +1250,7 @@ GetTextIndex(interp, canvas, itemPtr, ob + goto doxy; + } + +- string = Tcl_GetStringFromObj(obj, &length); ++ string = Tcl_GetStringFromObj(obj, NULL); + c = string[0]; + length = strlen(string); + +--- tkGlue.c ++++ ./tkGlue.c +@@ -5549,7 +5549,7 @@ _((pTHX)) + #define COP_WARNINGS_TYPE SV* + #endif + #ifdef pWARN_NONE +- COP_WARNINGS_TYPE old_warn = PL_curcop->cop_warnings; ++ char *old_warn = PL_curcop->cop_warnings; + PL_curcop->cop_warnings = pWARN_NONE; + #endif + +From 061e4744c01dd2ed461fd0009cb1699c4f37f131 Mon Sep 17 00:00:00 2001 +From: Randy Eckenrode +Date: Thu, 7 Sep 2023 05:17:32 +0200 +Subject: [PATCH 1/2] jpeg: fix build with clang 16 + +The jpeg `configure` script fails to detect clang as a functioning C +compiler because it uses a test with a `main` that returns an implicit +`int`, which results in an error with clang 16. +--- + JPEG/jpeg/configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/JPEG/jpeg/configure b/JPEG/jpeg/configure +index 35c9db5c..ce76b557 100755 +--- a/JPEG/jpeg/configure ++++ b/JPEG/jpeg/configure +@@ -623,7 +623,7 @@ cross_compiling=$ac_cv_prog_cc_cross + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + +From 3c5126df9b06bd6c87211d762b081cc801368fa5 Mon Sep 17 00:00:00 2001 +From: Christopher Chavez +Date: Thu, 14 Sep 2023 06:27:52 -0500 +Subject: [PATCH 2/2] jpeg: more fixes for clang 16 + +--- + JPEG/jpeg/configure | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/JPEG/jpeg/configure b/JPEG/jpeg/configure +index ce76b557..c5593f2f 100755 +--- a/JPEG/jpeg/configure ++++ b/JPEG/jpeg/configure +@@ -1281,6 +1281,10 @@ else + #line 1282 "configure" + #include "confdefs.h" + ++#include ++#ifdef HAVE_STDLIB_H ++#include ++#endif + #ifdef HAVE_PROTOTYPES + int is_char_signed (int arg) + #else +@@ -1298,7 +1302,7 @@ int is_char_signed (arg) + return 1; /* assume char is signed otherwise */ + } + char signed_char_check = (char) (-67); +-main() { ++int main() { + exit(is_char_signed((int) signed_char_check)); + } + EOF +@@ -1327,6 +1331,10 @@ else + #line 1328 "configure" + #include "confdefs.h" + ++#include ++#ifdef HAVE_STDLIB_H ++#include ++#endif + #ifdef HAVE_PROTOTYPES + int is_shifting_signed (long arg) + #else +@@ -1350,7 +1358,7 @@ int is_shifting_signed (arg) + printf("I fear the JPEG software will not work at all.\n\n"); + return 0; /* try it with unsigned anyway */ + } +-main() { ++int main() { + exit(is_shifting_signed(-0x7F7E80B1L)); + } + EOF +@@ -1380,7 +1388,10 @@ else + #include "confdefs.h" + + #include +-main() { ++#ifdef HAVE_STDLIB_H ++#include ++#endif ++int main() { + if (fopen("conftestdata", "wb") != NULL) + exit(0); + exit(1); diff --git a/srcpkgs/perl-Tk/template b/srcpkgs/perl-Tk/template index 2dbd37952da..a7bf0f4e141 100644 --- a/srcpkgs/perl-Tk/template +++ b/srcpkgs/perl-Tk/template @@ -1,7 +1,7 @@ # Template file for 'perl-Tk' pkgname=perl-Tk version=804.036 -revision=3 +revision=4 build_style=perl-module configure_args="X11INC=${XBPS_CROSS_BASE}/usr/include X11LIB=${XBPS_CROSS_BASE}/usr/lib"