From c279190b7d49bd4d74a2a637eb6d277424f791ce Mon Sep 17 00:00:00 2001 From: Yasuhiro Kimura Date: Tue, 4 Jul 2023 23:29:45 +0900 Subject: [PATCH] textproc/p5-SGML-Parser-OpenSP: Fix build with Perl 5.38 When 5.38 is default perl5 version, build of this port fails as following. --- OpenSP.c --- Warning: Found a 'CODE' section which seems to be using 'RETVAL' but no 'OUTPUT' section. in OpenSP.xs, line 1178 mv OpenSP.xsc OpenSP.c --- OpenSP.o --- c++ -c -I/usr/local/include -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DVERSION=\"0.994\" -DXS_VERSION=\"0.994\" -DPIC -fPIC "-I/usr/local/lib/perl5/5.38/mach/CORE" -DSP_MULTI_BYTE=1 OpenSP.c c++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] OpenSP.xs:165:17: error: use of undeclared identifier 'uvuni_to_utf8_flags' d = uvuni_to_utf8_flags(d, s.ptr[i], 0); ^ OpenSP.xs:174:17: error: use of undeclared identifier 'uvuni_to_utf8_flags' d = uvuni_to_utf8_flags(d + SvCUR(result), s.ptr[i], 0); ^ 2 errors generated. *** [OpenSP.o] Error code 1 make[1]: stopped in /usr0/freebsd/ports/work/usr/ports/textproc/p5-SGML-Parser-OpenSP/work/SGML-Parser-OpenSP-0.994 1 error make[1]: stopped in /usr0/freebsd/ports/work/usr/ports/textproc/p5-SGML-Parser-OpenSP/work/SGML-Parser-OpenSP-0.994 ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make: stopped in /usr/ports/textproc/p5-SGML-Parser-OpenSP In the perlintern(1) man pages of perl 5.36.1, there are sentences as following. "uvuni_to_utf8_flags" "DEPRECATED!" It is planned to remove "uvuni_to_utf8_flags" from a future release of Perl. Do not use it for new code; remove it from existing code. Instead you almost certainly want to use "uvchr_to_utf8" in perlapi or "uvchr_to_utf8_flags" in perlapi. This function is a deprecated synonym for "uvoffuni_to_utf8_flags", which itself, while not deprecated, should be used only in isolated circumstances. These functions were useful for code that wanted to handle both EBCDIC and ASCII platforms with Unicode properties, but starting in Perl v5.20, the distinctions between the platforms have mostly been made invisible to most code, so this function is quite unlikely to be what you want. U8* uvuni_to_utf8_flags(U8 *d, UV uv, UV flags) So it seems planned removal finally happend with 5.38. There are two occurrences of uvuni_to_utf8_flags in OpenSP.xs. So fix build by replacing them with uvchr_to_utf8_flags. PR: 272364 Approved by: maintainer MFH: 2023Q3 --- textproc/p5-SGML-Parser-OpenSP/Makefile | 2 +- .../files/patch-OpenSP.xs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs diff --git a/textproc/p5-SGML-Parser-OpenSP/Makefile b/textproc/p5-SGML-Parser-OpenSP/Makefile index a99f525b25a21..e4c513bbe2cad 100644 --- a/textproc/p5-SGML-Parser-OpenSP/Makefile +++ b/textproc/p5-SGML-Parser-OpenSP/Makefile @@ -1,6 +1,6 @@ PORTNAME= SGML-Parser-OpenSP PORTVERSION= 0.994 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= textproc perl5 MASTER_SITES= CPAN PKGNAMEPREFIX= p5- diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs b/textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs new file mode 100644 index 0000000000000..e9bcc872bb1db --- /dev/null +++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs @@ -0,0 +1,20 @@ +--- OpenSP.xs.orig 2023-07-04 14:18:21 UTC ++++ OpenSP.xs +@@ -162,7 +162,7 @@ SV* SgmlParserOpenSP::cs2sv(const SGMLApplication::Cha + { + d = m_temp; + for (i = 0; i < s.len; ++i) +- d = uvuni_to_utf8_flags(d, s.ptr[i], 0); ++ d = uvchr_to_utf8_flags(d, s.ptr[i], 0); + result = newSVpvn((const char*)m_temp, d - m_temp); + } + else +@@ -171,7 +171,7 @@ SV* SgmlParserOpenSP::cs2sv(const SGMLApplication::Cha + for (i = 0; i < s.len; ++i) + { + d = (U8 *)SvGROW(result, SvCUR(result) + UTF8_MAXLEN + 1); +- d = uvuni_to_utf8_flags(d + SvCUR(result), s.ptr[i], 0); ++ d = uvchr_to_utf8_flags(d + SvCUR(result), s.ptr[i], 0); + SvCUR_set(result, d - (U8 *)SvPVX(result)); + } + }