diff --git a/audio/festival/Makefile b/audio/festival/Makefile index 3c143deffb14..05001c346ef7 100644 --- a/audio/festival/Makefile +++ b/audio/festival/Makefile @@ -1,111 +1,111 @@ PORTNAME= festival PORTVERSION= 2.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio accessibility MASTER_SITES= FESTIVAL DISTFILES= ${DISTNAME}-release.tar.gz \ speech_tools-${PORTVERSION}-release.tar.gz DIST_SUBDIR= festival PATCHFILES= src_modules_diphone_diphone.h.diff?id=b58a836:debian \ src_modules_diphone_di_io.cc.diff?id=b58a836:debian \ src_modules_diphone_diphone.cc.diff?id=b58a836:debian \ src_modules_donovan_t2s.h.diff?id=b58a836:debian \ src_modules_UniSyn_diphone_UniSyn_diphone.cc.diff?id=b58a836:debian \ festival_el_utf8.diff?id=b58a836:debian \ lintianspellpatch.diff?id=b58a836:debian \ hts21compat.diff?id=b58a836:debian \ languagespatch.diff?id=b58a836:debian \ ${SPT_PATCHES:C/.*/patch-speech__tools_\0:netbsd/} PATCH_SITES= ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/audio/festival/patches/:netbsd \ https://salsa.debian.org/tts-team/festival/-/raw/b58a836b84ff9a9afa82eb0283bac19bf9c22e71/debian/patches/:debian MAINTAINER= mi@aldan.algebra.com COMMENT= Multi-lingual speech synthesis system WWW= https://www.cstr.ed.ac.uk/projects/festival/ OPTIONS_DEFINE= NAS OPTIONS_DEFAULT=NAS -CXXFLAGS+= -DFTLIBDIR=${LOCALBASE}/share/festival/lib +CXXFLAGS+= -DFTLIBDIR=${LOCALBASE}/share/festival/lib -fno-delete-null-pointer-checks CONFIGURE_WRKSRC=${WRKDIR}/festival USES= gmake SPEECHTOOLS= ${WRKSRC}/speech_tools FESTIVAL= ${WRKSRC}/festival -MAKE_ARGS+= CC="${CC}" GCC="${CC}" \ - CXX="${CXX}" GXX="${CXX}" \ +MAKE_ARGS+= CC="${CCACHE_BIN} ${CC}" GCC="${CCACHE_BIN} ${CC}" \ + CXX="${CCACHE_BIN} ${CXX}" GXX="${CCACHE_BIN} ${CXX}" \ EST_HOME=${SPEECHTOOLS} WRKSRC= ${WRKDIR} SPT_PATCHES= include_ling__class_EST__FeatureFunctionPackage.h \ include_unix_EST__socket__unix.h do-build: .for d in speech_tools festival ${MAKE_CMD} -C ${WRKDIR}/$d ${MAKE_FLAGS} Makefile ${MAKE_ARGS} .endfor # Can not make test in `festival', because the voices may not be installed # XXX: this should fail, if the verdict is not "CORRECT"... post-build test: ${MAKE_CMD} -C ${WRKDIR}/speech_tools test # The below is needed, because Debian's patches expect a different # directory-name pre-patch: ${LN} -s festival ${WRKSRC}/festival-2.1~release ${LN} -s festival ${WRKSRC}/b post-patch:: ${REINPLACE_CMD} -e 's,/usr/X11R6,${LOCALBASE},g' \ ${WRKSRC}/*/config/systems/default.mak .for m in nas ${m:tu}_LIB_DEPENDS= lib${m:nas=audio}.so:audio/${m} post-patch-${m:tu}-on: ${REINPLACE_CMD} -e 's,# INCLUDE_MODULES += ${m:tu}_AUDIO,INCLUDE_MODULES += ${m:tu}_AUDIO,' \ ${WRKDIR}/*/config/config.in ${m:tu}_CONFIGURE_ENABLE=${m} .endfor do-configure: .for d in speech_tools festival @cd ${WRKDIR}/$d && \ if ! ${SETENV} CC="${CC}" CPP="${CPP}" CXX="${CXX}" \ CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \ ${CONFIGURE_ENV} ./configure ${CONFIGURE_ARGS}; then \ ${ECHO_CMD} "===> configuration script for $d failed."; \ ${FALSE}; \ fi # This step helps non-i386 systems and is harmless on i386 -${LN} -s ix86_FreeBSD.mak ${WRKDIR}/$d/config/systems/${MACHINE}_unknown.mak .endfor @${REINPLACE_CMD} \ -e '/^CFLAGS *=/s|$$| ${CFLAGS}|' \ -e '/^CXXFLAGS *=/s|$$| ${CXXFLAGS}|' \ -e 's,^OPTIMI,#OPTIMI,' \ ${WRKSRC}/speech_tools/config/compilers/gcc*.mak do-install: @${MKDIR} ${STAGEDIR}${DATADIR} ${CHMOD} -R u+w,a+r,og-w ${FESTIVAL}/lib ${FIND} ${FESTIVAL}/lib -type d -print0 | ${XARGS} -0 ${CHMOD} 755 ${FIND} ${FESTIVAL} -type f -name *.orig -delete ${CP} -pPR ${FESTIVAL}/lib ${FESTIVAL}/examples ${STAGEDIR}${DATADIR} ${RM} -r ${STAGEDIR}${DATADIR}/lib/etc/Makefile ${STAGEDIR}${DATADIR}/lib/etc/*FreeBSD* \ ${STAGEDIR}${DATADIR}/lib/etc/*unknown ${INSTALL_PROGRAM} ${FESTIVAL}/lib/etc/*/audsp ${STAGEDIR}${PREFIX}/libexec ${INSTALL_PROGRAM} ${FESTIVAL}/src/main/festival ${STAGEDIR}${PREFIX}/libexec/festival.naked ${INSTALL_PROGRAM} ${FESTIVAL}/src/main/festival_client ${STAGEDIR}${PREFIX}/libexec/festival_client.naked for n in festival.sh festival_client.sh sitevars.scm; \ do {\ ${SED} "s%@PKG_FESTIVAL_LOCATION@%${DATADIR}%; \ s%@PKG_PREFIX@%${PREFIX}%" <${FILESDIR}/$$n > ${WRKDIR}/$$n ;} \ done ${INSTALL_SCRIPT} ${WRKDIR}/festival.sh ${STAGEDIR}${PREFIX}/bin/festival ${INSTALL_SCRIPT} ${WRKDIR}/festival_client.sh ${STAGEDIR}${PREFIX}/bin/festival_client ${INSTALL_DATA} ${WRKDIR}/sitevars.scm ${STAGEDIR}${DATADIR}/lib/sitevars.scm ${INSTALL_MAN} ${FESTIVAL}/doc/festival.1 ${STAGEDIR}${PREFIX}/man/man1/festival.1 ${INSTALL_MAN} ${FESTIVAL}/doc/festival_client.1 ${STAGEDIR}${PREFIX}/man/man1/festival_client.1 .include diff --git a/audio/festival/files/patch-hts-buffer-bounds-check b/audio/festival/files/patch-hts-buffer-bounds-check new file mode 100644 index 000000000000..0cb94a0aa357 --- /dev/null +++ b/audio/festival/files/patch-hts-buffer-bounds-check @@ -0,0 +1,313 @@ +Obtained from Debian. Original description follows: + +Description: HTS engine does not check buffer bounds in some functions. +This patch adds bounds checking to prevent writing past the end of the buffer. + +Author: Peter Drysdale + +--- festival/src/modules/hts_engine/HTS_engine.c ++++ festival/src/modules/hts_engine/HTS_engine.c +@@ -467,7 +467,7 @@ + } + + /* HTS_Engine_synthesize_from_strings: synthesize speech from strings */ +-HTS_Boolean HTS_Engine_synthesize_from_strings(HTS_Engine * engine, char **lines, size_t num_lines) ++HTS_Boolean HTS_Engine_synthesize_from_strings(HTS_Engine * engine, const char **lines, size_t num_lines) + { + HTS_Engine_refresh(engine); + HTS_Label_load_from_strings(&engine->label, engine->condition.sampling_frequency, engine->condition.fperiod, lines, num_lines); +--- festival/src/modules/hts_engine/HTS_engine.h ++++ festival/src/modules/hts_engine/HTS_engine.h +@@ -427,7 +427,7 @@ + HTS_Boolean HTS_Engine_synthesize_from_fn(HTS_Engine * engine, const char *fn); + + /* HTS_Engine_synthesize_from_strings: synthesize speech from string list */ +-HTS_Boolean HTS_Engine_synthesize_from_strings(HTS_Engine * engine, char **lines, size_t num_lines); ++HTS_Boolean HTS_Engine_synthesize_from_strings(HTS_Engine * engine, const char **lines, size_t num_lines); + + /* HTS_Engine_save_information: save trace information */ + void HTS_Engine_save_information(HTS_Engine * engine, FILE * fp); +--- festival/src/modules/hts_engine/HTS_hidden.h ++++ festival/src/modules/hts_engine/HTS_hidden.h +@@ -117,16 +117,16 @@ + size_t HTS_fwrite_little_endian(const void *buf, size_t size, size_t n, FILE * fp); + + /* HTS_get_pattern_token: get pattern token (single/double quote can be used) */ +-HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff); ++HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff, size_t bufflen); + + /* HTS_get_token: get token from file pointer (separators are space,tab,line break) */ +-HTS_Boolean HTS_get_token_from_fp(HTS_File * fp, char *buff); ++HTS_Boolean HTS_get_token_from_fp(HTS_File * fp, char *buff, size_t bufflen); + + /* HTS_get_token: get token from file pointer with specified separator */ + HTS_Boolean HTS_get_token_from_fp_with_separator(HTS_File * fp, char *buff, char separator); + + /* HTS_get_token_from_string: get token from string (separator are space,tab,line break) */ +-HTS_Boolean HTS_get_token_from_string(const char *string, size_t * index, char *buff); ++HTS_Boolean HTS_get_token_from_string(const char *string, size_t * index, char *buff, size_t bufflen); + + /* HTS_get_token_from_string_with_separator: get token from string with specified separator */ + HTS_Boolean HTS_get_token_from_string_with_separator(const char *str, size_t * index, char *buff, char separator); +@@ -248,7 +248,7 @@ + void HTS_Label_load_from_fn(HTS_Label * label, size_t sampling_rate, size_t fperiod, const char *fn); + + /* HTS_Label_load_from_strings: load label list from string list */ +-void HTS_Label_load_from_strings(HTS_Label * label, size_t sampling_rate, size_t fperiod, char **lines, size_t num_lines); ++void HTS_Label_load_from_strings(HTS_Label * label, size_t sampling_rate, size_t fperiod, const char **lines, size_t num_lines); + + /* HTS_Label_get_size: get number of label string */ + size_t HTS_Label_get_size(HTS_Label * label); +--- festival/src/modules/hts_engine/HTS_misc.c ++++ festival/src/modules/hts_engine/HTS_misc.c +@@ -333,7 +333,7 @@ + } + + /* HTS_get_pattern_token: get pattern token (single/double quote can be used) */ +-HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff) ++HTS_Boolean HTS_get_pattern_token(HTS_File * fp, char *buff, size_t bufflen) + { + char c; + size_t i; +@@ -369,7 +369,7 @@ + } + + i = 0; +- while (1) { ++ while (istring = HTS_strdup(buff); + + /* get pattern list */ +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + HTS_Question_clear(question); + return FALSE; + } +@@ -207,7 +207,7 @@ + last_pattern = NULL; + if (strcmp(buff, "{") == 0) { + while (1) { +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + HTS_Question_clear(question); + return FALSE; + } +@@ -218,7 +218,7 @@ + question->head = pattern; + pattern->string = HTS_strdup(buff); + pattern->next = NULL; +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + HTS_Question_clear(question); + return FALSE; + } +@@ -358,7 +358,7 @@ + if (tree == NULL || fp == NULL) + return FALSE; + +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + HTS_Tree_clear(tree); + return FALSE; + } +@@ -367,14 +367,14 @@ + tree->root = last_node = node; + + if (strcmp(buff, "{") == 0) { +- while (HTS_get_pattern_token(fp, buff) == TRUE && strcmp(buff, "}") != 0) { ++ while (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == TRUE && strcmp(buff, "}") != 0) { + node = HTS_Node_find(last_node, atoi(buff)); + if (node == NULL) { + HTS_error(0, "HTS_Tree_load: Cannot find node %d.\n", atoi(buff)); + HTS_Tree_clear(tree); + return FALSE; + } +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + HTS_Tree_clear(tree); + return FALSE; + } +@@ -389,7 +389,7 @@ + HTS_Node_initialize(node->yes); + HTS_Node_initialize(node->no); + +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + node->quest = NULL; + free(node->yes); + free(node->no); +@@ -403,7 +403,7 @@ + node->no->next = last_node; + last_node = node->no; + +- if (HTS_get_pattern_token(fp, buff) == FALSE) { ++ if (HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN) == FALSE) { + node->quest = NULL; + free(node->yes); + free(node->no); +@@ -495,7 +495,7 @@ + win->coefficient = (double **) HTS_calloc(win->size, sizeof(double *)); + /* set delta coefficents */ + for (i = 0; i < win->size; i++) { +- if (HTS_get_token_from_fp(fp[i], buff) == FALSE) { ++ if (HTS_get_token_from_fp(fp[i], buff, HTS_MAXBUFLEN) == FALSE) { + result = FALSE; + fsize = 1; + } else { +@@ -508,7 +508,7 @@ + /* read coefficients */ + win->coefficient[i] = (double *) HTS_calloc(fsize, sizeof(double)); + for (j = 0; j < fsize; j++) { +- if (HTS_get_token_from_fp(fp[i], buff) == FALSE) { ++ if (HTS_get_token_from_fp(fp[i], buff, HTS_MAXBUFLEN) == FALSE) { + result = FALSE; + win->coefficient[i][j] = 0.0; + } else { +@@ -610,7 +610,7 @@ + last_question = NULL; + last_tree = NULL; + while (!HTS_feof(fp)) { +- HTS_get_pattern_token(fp, buff); ++ HTS_get_pattern_token(fp, buff, HTS_MAXBUFLEN); + /* parse questions */ + if (strcmp(buff, "QS") == 0) { + question = (HTS_Question *) HTS_calloc(1, sizeof(HTS_Question)); +--- festival/src/modules/hts_engine/HTS_label.c ++++ festival/src/modules/hts_engine/HTS_label.c +@@ -117,5 +117,5 @@ + + /* parse label file */ +- while (HTS_get_token_from_fp(fp, buff)) { ++ while (HTS_get_token_from_fp(fp, buff, HTS_MAXBUFLEN)) { + if (!isgraph((int) buff[0])) + break; +@@ -130,9 +130,9 @@ + } + if (isdigit_string(buff)) { /* has frame infomation */ + start = atof(buff); +- HTS_get_token_from_fp(fp, buff); ++ HTS_get_token_from_fp(fp, buff, HTS_MAXBUFLEN); + end = atof(buff); +- HTS_get_token_from_fp(fp, buff); ++ HTS_get_token_from_fp(fp, buff, HTS_MAXBUFLEN); + lstring->start = rate * start; + lstring->end = rate * end; + } else { +@@ -154,7 +154,7 @@ + } + + /* HTS_Label_load_from_strings: load label from strings */ +-void HTS_Label_load_from_strings(HTS_Label * label, size_t sampling_rate, size_t fperiod, char **lines, size_t num_lines) ++void HTS_Label_load_from_strings(HTS_Label * label, size_t sampling_rate, size_t fperiod, const char **lines, size_t num_lines) + { + char buff[HTS_MAXBUFLEN]; + HTS_LabelString *lstring = NULL; +@@ -182,11 +182,11 @@ + } + data_index = 0; + if (isdigit_string(lines[i])) { /* has frame infomation */ +- HTS_get_token_from_string(lines[i], &data_index, buff); ++ HTS_get_token_from_string(lines[i], &data_index, buff, HTS_MAXBUFLEN); + start = atof(buff); +- HTS_get_token_from_string(lines[i], &data_index, buff); ++ HTS_get_token_from_string(lines[i], &data_index, buff, HTS_MAXBUFLEN); + end = atof(buff); +- HTS_get_token_from_string(lines[i], &data_index, buff); ++ HTS_get_token_from_string(lines[i], &data_index, buff, HTS_MAXBUFLEN); + lstring->name = HTS_strdup(buff); + lstring->start = rate * start; + lstring->end = rate * end; diff --git a/audio/festival/files/patch-warnings b/audio/festival/files/patch-warnings new file mode 100644 index 000000000000..228b3a270848 --- /dev/null +++ b/audio/festival/files/patch-warnings @@ -0,0 +1,76 @@ +Address some of the warnings flagged by either compiler or valgrind. + + -mi +--- speech_tools/stats/EST_Discrete.cc 2010-11-05 10:12:43.000000000 -0400 ++++ speech_tools/stats/EST_Discrete.cc 2023-02-20 22:17:06.842236000 -0500 +@@ -152,5 +152,5 @@ + for (i=0; i