commit:     aa9db8863d577f8e34d67a19dd57c8596c9a5b80
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 24 23:40:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 24 23:40:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa9db886

app-accessibility/speech-tools: fix build w/ newer ncurses; fix strict-aliasing

Closes: https://bugs.gentoo.org/837800
Closes: https://bugs.gentoo.org/854051
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/speech-tools-2.5.0-drop-curses.patch     |  43 ++++++
 .../files/speech-tools-2.5.0-warnings.patch        |  35 +++++
 .../speech-tools/speech-tools-2.5.0-r1.ebuild      | 150 +++++++++++++++++++++
 3 files changed, 228 insertions(+)

diff --git 
a/app-accessibility/speech-tools/files/speech-tools-2.5.0-drop-curses.patch 
b/app-accessibility/speech-tools/files/speech-tools-2.5.0-drop-curses.patch
new file mode 100644
index 000000000000..30b5448e820a
--- /dev/null
+++ b/app-accessibility/speech-tools/files/speech-tools-2.5.0-drop-curses.patch
@@ -0,0 +1,43 @@
+We already force in the correct detection via another patch and this
+logic (being dropped in this patch) assumes no -ltinfo.
+
+https://bugs.gentoo.org/837800
+--- a/configure.in
++++ b/configure.in
+@@ -42,12 +42,6 @@ AC_CHECK_TOOL(AR, ar)
+ 
+ AC_C_BIGENDIAN
+ 
+-AC_CHECK_LIB(ncurses, tputs, [TERMCAPLIB=-lncurses], [TERMCAPLIB=-lcurses])
+-dnl if test "$TERMCAPLIB" != "-ltermcap"; then
+-dnl    AC_CHECK_LIB(termcap, tputs, [TERMCAPLIB=-ltermcap], 
[TERMCAPLIB=-lncurses])
+-dnl 
+-AC_SUBST(TERMCAPLIB)
+-
+ dnl Which version of GCC do we have here
+ COMPILERTYPE=gcc
+ AC_TRY_COMPILE([#include <stdio.h>],
+diff --git a/config/config.in b/config/config.in
+index c7a268a..6c7f16a 100644
+--- a/config/config.in
++++ b/config/config.in
+@@ -98,7 +98,6 @@ LINUXAUDIO = @LINUXAUDIO@
+ ## It may not work under all systems, so may be optionally omitted.
+ INCLUDE_MODULES += EDITLINE
+ 
+-TERMCAPLIB = @TERMCAPLIB@
+ # speech recognition
+ #INCLUDE_MODULES += ASR
+ 
+diff --git a/config/modules/editline.mak b/config/modules/editline.mak
+index fe83c37..2d48b39 100644
+--- a/config/modules/editline.mak
++++ b/config/modules/editline.mak
+@@ -43,7 +43,6 @@ INCLUDE_EDITLINE=1
+ MOD_DESC_EDITLINE=Use editline for command line editing and history
+ 
+ IO_DEFINES   += -DSUPPORT_EDITLINE $(MODULE_EDITLINE_OPTIONS:%=-DEDITLINE_%)
+-MODULE_LIBS  += $(TERMCAPLIB)
+ 
+ ifeq ($(DIRNAME),siod)
+     CSRCS := $(CSRCS) el_complete.c editline.c el_sys_unix.c

diff --git 
a/app-accessibility/speech-tools/files/speech-tools-2.5.0-warnings.patch 
b/app-accessibility/speech-tools/files/speech-tools-2.5.0-warnings.patch
new file mode 100644
index 000000000000..4242700e6c2d
--- /dev/null
+++ b/app-accessibility/speech-tools/files/speech-tools-2.5.0-warnings.patch
@@ -0,0 +1,35 @@
+https://github.com/festvox/speech_tools/commit/4b677d6f3bc560248da369a86d5f2ec17c116da5
+(Just the strict aliasing hunk.)
+
+From 4b677d6f3bc560248da369a86d5f2ec17c116da5 Mon Sep 17 00:00:00 2001
+From: Sergio Oller <sergiol...@gmail.com>
+Date: Sat, 29 Aug 2020 19:14:47 +0200
+Subject: [PATCH] Compile with gcc-9 without warnings (-Wall)
+
+--- a/speech_class/esps_utils.cc
++++ b/speech_class/esps_utils.cc
+@@ -1050,7 +1050,7 @@ enum EST_read_status read_esps_hdr(esps_hdr *uhdr,FILE 
*fd)
+       hdr->field_name[0] = wstrdup("samples");
+       fseek(fd,hdr->hdr_size,SEEK_SET);
+       /* In this cases its just in the header as a float */
+-      sd_sample_rate = *((float *)(void *)&fhdr.fil4[0]);
++      memcpy(&sd_sample_rate, &fhdr.fil4[0], sizeof(float));
+       add_fea_d(hdr,"record_freq",0,(double)sd_sample_rate);
+       *uhdr = hdr;
+       return format_ok;
+@@ -1215,11 +1215,13 @@ enum EST_write_status write_esps_hdr(esps_hdr hdr,FILE 
*fd)
+     fhdr.thirteen = 13;      /* must be for luck */
+     fhdr.sdr_size = 0;
+     fhdr.magic = ESPS_MAGIC;
+-    strncpy(fhdr.date,ctime(&tx),26);
++    strncpy(fhdr.date,ctime(&tx),25);
++    fhdr.date[25] = 0;
+     sprintf(fhdr.version,"1.91");  /* that's what all the others have */
+     sprintf(fhdr.prog,"EDST");
+     sprintf(fhdr.vers,"0.1");
+-    strncpy(fhdr.progcompdate,ctime(&tx),26);
++    strncpy(fhdr.progcompdate,ctime(&tx),25);
++    fhdr.progcompdate[25] = 0;
+     fhdr.num_samples = hdr->num_records;
+     fhdr.filler = 0;
+     /* in each record */

diff --git a/app-accessibility/speech-tools/speech-tools-2.5.0-r1.ebuild 
b/app-accessibility/speech-tools/speech-tools-2.5.0-r1.ebuild
new file mode 100644
index 000000000000..76fc1ff30431
--- /dev/null
+++ b/app-accessibility/speech-tools/speech-tools-2.5.0-r1.ebuild
@@ -0,0 +1,150 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools toolchain-funcs
+
+MY_P=${P/speech-/speech_}
+PATCHSET="r3"
+
+DESCRIPTION="Speech tools for Festival Text to Speech engine"
+HOMEPAGE="http://www.cstr.ed.ac.uk/projects/speech_tools/";
+SRC_URI="http://www.festvox.org/packed/festival/$(ver_cut 
1-2)/${MY_P}-release.tar.gz
+       
https://dev.gentoo.org/~neurogeek/${PN}/speech_tools-2.1-${PATCHSET}-patches.tar.gz";
+S="${WORKDIR}/speech_tools"
+
+LICENSE="FESTIVAL HPND BSD rc regexp-UofT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="nas openmp X"
+
+RDEPEND="
+       media-libs/alsa-lib
+       sys-libs/ncurses:=
+       nas? ( media-libs/nas )
+       X? (
+               x11-libs/libX11
+               x11-libs/libXt
+       )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+DOCS=( README.md lib/cstrutt.dtd lib/example_data )
+
+PATCHES=(
+       "${WORKDIR}/patch/02_all_gcc42.patch"
+       "${WORKDIR}/patch/03_all_GentooLinux.patch"
+       "${WORKDIR}/patch/05_all_sharedlib.patch"
+       "${WORKDIR}/patch/06_all_gcc43-include.patch"
+       "${WORKDIR}/patch/09_all_remove-shared-refs.patch"
+       "${WORKDIR}/patch/10_all_base_class.patch"
+       "${WORKDIR}/patch/81_all_etcpath.patch"
+       "${WORKDIR}/patch/91_all_gentoo-config.patch"
+       "${WORKDIR}/patch/92_all_ldflags_fix.patch"
+       "${WORKDIR}/patch/94_all_ncurses_tinfo.patch"
+
+       # Fix underlinking, bug #493204
+       "${FILESDIR}/${PN}-2.1-underlinking.patch"
+       "${FILESDIR}/${PN}-2.5.0-fno-common.patch"
+       "${FILESDIR}/${PN}-2.5.0-drop-curses.patch"
+       "${FILESDIR}/${P}-warnings.patch"
+)
+
+pkg_pretend() {
+       [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+       [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+src_prepare() {
+       default
+
+       sed -i -e '/^CXXFLAGS  =/s|CC_OTHER_FLAGS|CXX_OTHER_FLAGS|' \
+               config/compilers/gcc_defaults.mak || die
+
+       sed -i -e 's,{{HORRIBLELIBARCHKLUDGE}},"/usr/$(get_libdir)",' \
+               main/siod_main.cc || die
+
+       # bug #309983
+       sed -i -e "s:\(GCC_SYSTEM_OPTIONS =\).*:\1:" \
+               "${S}"/config/systems/sparc_SunOS5.mak || die
+
+       sed -i -e "s|\$(OMP_OPTS)|$(use openmp && echo -fopenmp)|g" \
+               -e "s|\$(OMP_DEFS)|$(use openmp && echo -DOMP_WAGON=1)|g" \
+               -e "/MAKE_SHARED_LIB =/s|-shared|$(use openmp && echo -fopenmp) 
-shared|" \
+               config/compilers/gcc_defaults.mak || die
+
+       eautoreconf
+}
+
+src_configure() {
+       local CONFIG=config/config.in
+
+       sed -i -e 's/@COMPILERTYPE@/gcc42/' ${CONFIG} || die
+
+       if use nas; then
+               sed -i -e "s/#.*\(INCLUDE_MODULES += NAS_AUDIO\)/\1/" \
+                       ${CONFIG} || die
+       fi
+
+       if ! use X; then
+               sed -i -e "s/-lX11 -lXt//" config/modules/esd_audio.mak || die
+       fi
+
+       econf
+}
+
+src_compile() {
+       emake -j1 \
+               CC="$(tc-getCC)" \
+               CXX="$(tc-getCXX)" \
+               CC_OTHER_FLAGS="${CFLAGS}" \
+               CXX_OTHER_FLAGS="${CXXFLAGS}" \
+               LDFLAGS="${LDFLAGS}" \
+               AR="$(tc-getAR)" \
+               RANLIB="$(tc-getRANLIB)"
+}
+
+src_install() {
+       default
+
+       dolib.so lib/libest*.so*
+
+       insinto /usr/share/speech-tools
+       doins -r config base_class
+
+       insinto /usr/share/speech-tools/lib
+       doins -r lib/siod
+
+       mv include speech-tools || die
+       doheader -r speech-tools
+       dosym ../../include/speech-tools /usr/share/speech-tools/include
+
+       for file in bin/*; do
+               [ "${file}" = "bin/Makefile" ] && continue
+               dobin ${file}
+               dstfile="${ED}/usr/${file}"
+               sed -i -e 
"s:${S}/testsuite/data:/usr/share/speech-tools/testsuite:g" \
+                       ${dstfile} || die
+               sed -i -e "s:${S}/bin:/usr/$(get_libdir)/speech-tools:g" \
+                       ${dstfile} || die
+               sed -i -e "s:${S}/main:/usr/$(get_libdir)/speech-tools:g" \
+                       ${dstfile} || die
+
+               # This just changes LD_LIBRARY_PATH
+               sed -i -e "s:${S}/lib:/usr/$(get_libdir):g" ${dstfile} || die
+       done
+
+       exeinto /usr/$(get_libdir)/speech-tools
+       for file in `find main -perm /111 -type f`; do
+               doexe ${file}
+       done
+
+       # Remove bcat (only useful for testing on windows, see bug #418301).
+       rm "${ED}/usr/bin/bcat" || die
+       rm "${ED}/usr/$(get_libdir)/speech-tools/bcat" || die
+}

Reply via email to