git: e54088787fef - main - audio/espeak-ng: import upstream patch for support of "Piper"

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Tue, 03 Jun 2025 06:58:24 UTC
The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e54088787fef40c1848d98a07a39ae3438d87fc4

commit e54088787fef40c1848d98a07a39ae3438d87fc4
Author:     Kenneth Raplee <kenrap@kennethraplee.com>
AuthorDate: 2025-06-03 06:46:34 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2025-06-03 06:57:49 +0000

    audio/espeak-ng: import upstream patch for support of "Piper"
    
    This patch imports the upstream pull request #2127 that has been
    accepted on 2025-03-04.
    
    It adds the espeak_TextToPhonemesWithTerminator() function to the
    library, which is required by the Piper text to speech software.
    
    PR:             287241
---
 audio/espeak-ng/Makefile                           |  1 +
 .../files/patch-src_include_espeak-ng_speak__lib.h | 15 ++++++++++++
 .../files/patch-src_libespeak-ng_speech.c          | 28 ++++++++++++++++++++++
 3 files changed, 44 insertions(+)

diff --git a/audio/espeak-ng/Makefile b/audio/espeak-ng/Makefile
index 46597c996dfd..27b3fd73af93 100644
--- a/audio/espeak-ng/Makefile
+++ b/audio/espeak-ng/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	espeak-ng
 PORTVERSION=	1.52.0
+PORTREVISION=	1
 CATEGORIES=	audio
 #MASTER_SITES=	https://github.com/espeak-ng/${PORTNAME}/releases/download/${PORTVERSION}/
 
diff --git a/audio/espeak-ng/files/patch-src_include_espeak-ng_speak__lib.h b/audio/espeak-ng/files/patch-src_include_espeak-ng_speak__lib.h
new file mode 100644
index 000000000000..df152b5b6eb9
--- /dev/null
+++ b/audio/espeak-ng/files/patch-src_include_espeak-ng_speak__lib.h
@@ -0,0 +1,15 @@
+--- src/include/espeak-ng/speak_lib.h.orig	2024-12-12 13:28:01 UTC
++++ src/include/espeak-ng/speak_lib.h
+@@ -544,6 +544,12 @@ extern "C"
+ #ifdef __cplusplus
+ extern "C"
+ #endif
++ESPEAK_API const char *espeak_TextToPhonemesWithTerminator(const void **textptr, int textmode, int phonememode, int *terminator);
++/* Version of espeak_TextToPhonemes that also returns the clause terminator (e.g., CLAUSE_INTONATION_FULL_STOP) */
++
++#ifdef __cplusplus
++extern "C"
++#endif
+ ESPEAK_API void espeak_CompileDictionary(const char *path, FILE *log, int flags);
+ /* Compile pronunciation dictionary for a language which corresponds to the currently
+    selected voice.  The required voice should be selected before calling this function.
diff --git a/audio/espeak-ng/files/patch-src_libespeak-ng_speech.c b/audio/espeak-ng/files/patch-src_libespeak-ng_speech.c
new file mode 100644
index 000000000000..36ea86f6e328
--- /dev/null
+++ b/audio/espeak-ng/files/patch-src_libespeak-ng_speech.c
@@ -0,0 +1,28 @@
+--- src/libespeak-ng/speech.c.orig	2024-12-12 13:28:01 UTC
++++ src/libespeak-ng/speech.c
+@@ -850,7 +850,7 @@ ESPEAK_API void espeak_SetPhonemeTrace(int phonememode
+ 		f_trans = stderr;
+ }
+ 
+-ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
++ESPEAK_API const char* espeak_TextToPhonemesWithTerminator(const void** textptr, int textmode, int phonememode, int* terminator)
+ {
+ 	/* phoneme_mode
+ 	    bit 1:   0=eSpeak's ascii phoneme names, 1= International Phonetic Alphabet (as UTF-8 characters).
+@@ -864,10 +864,15 @@ ESPEAK_API const char *espeak_TextToPhonemes(const voi
+ 	if (text_decoder_decode_string_multibyte(p_decoder, *textptr, translator->encoding, textmode) != ENS_OK)
+ 		return NULL;
+ 
+-	TranslateClause(translator, NULL, NULL);
++	TranslateClauseWithTerminator(translator, NULL, NULL, terminator);
+ 	*textptr = text_decoder_get_buffer(p_decoder);
+ 
+ 	return GetTranslatedPhonemeString(phonememode);
++}
++
++ESPEAK_API const char *espeak_TextToPhonemes(const void **textptr, int textmode, int phonememode)
++{
++	return espeak_TextToPhonemesWithTerminator(textptr, textmode, phonememode, NULL);
+ }
+ 
+ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_Cancel(void)