Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-accessibility/speech-tools/, app-accessibility/speech-tools/files/
Date: Fri, 24 Jun 2022 23:54:38
Message-Id: 1656114026.aa9db8863d577f8e34d67a19dd57c8596c9a5b80.sam@gentoo
1 commit: aa9db8863d577f8e34d67a19dd57c8596c9a5b80
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 24 23:40:23 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 24 23:40:26 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa9db886
7
8 app-accessibility/speech-tools: fix build w/ newer ncurses; fix strict-aliasing
9
10 Closes: https://bugs.gentoo.org/837800
11 Closes: https://bugs.gentoo.org/854051
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 .../files/speech-tools-2.5.0-drop-curses.patch | 43 ++++++
15 .../files/speech-tools-2.5.0-warnings.patch | 35 +++++
16 .../speech-tools/speech-tools-2.5.0-r1.ebuild | 150 +++++++++++++++++++++
17 3 files changed, 228 insertions(+)
18
19 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
20 new file mode 100644
21 index 000000000000..30b5448e820a
22 --- /dev/null
23 +++ b/app-accessibility/speech-tools/files/speech-tools-2.5.0-drop-curses.patch
24 @@ -0,0 +1,43 @@
25 +We already force in the correct detection via another patch and this
26 +logic (being dropped in this patch) assumes no -ltinfo.
27 +
28 +https://bugs.gentoo.org/837800
29 +--- a/configure.in
30 ++++ b/configure.in
31 +@@ -42,12 +42,6 @@ AC_CHECK_TOOL(AR, ar)
32 +
33 + AC_C_BIGENDIAN
34 +
35 +-AC_CHECK_LIB(ncurses, tputs, [TERMCAPLIB=-lncurses], [TERMCAPLIB=-lcurses])
36 +-dnl if test "$TERMCAPLIB" != "-ltermcap"; then
37 +-dnl AC_CHECK_LIB(termcap, tputs, [TERMCAPLIB=-ltermcap], [TERMCAPLIB=-lncurses])
38 +-dnl
39 +-AC_SUBST(TERMCAPLIB)
40 +-
41 + dnl Which version of GCC do we have here
42 + COMPILERTYPE=gcc
43 + AC_TRY_COMPILE([#include <stdio.h>],
44 +diff --git a/config/config.in b/config/config.in
45 +index c7a268a..6c7f16a 100644
46 +--- a/config/config.in
47 ++++ b/config/config.in
48 +@@ -98,7 +98,6 @@ LINUXAUDIO = @LINUXAUDIO@
49 + ## It may not work under all systems, so may be optionally omitted.
50 + INCLUDE_MODULES += EDITLINE
51 +
52 +-TERMCAPLIB = @TERMCAPLIB@
53 + # speech recognition
54 + #INCLUDE_MODULES += ASR
55 +
56 +diff --git a/config/modules/editline.mak b/config/modules/editline.mak
57 +index fe83c37..2d48b39 100644
58 +--- a/config/modules/editline.mak
59 ++++ b/config/modules/editline.mak
60 +@@ -43,7 +43,6 @@ INCLUDE_EDITLINE=1
61 + MOD_DESC_EDITLINE=Use editline for command line editing and history
62 +
63 + IO_DEFINES += -DSUPPORT_EDITLINE $(MODULE_EDITLINE_OPTIONS:%=-DEDITLINE_%)
64 +-MODULE_LIBS += $(TERMCAPLIB)
65 +
66 + ifeq ($(DIRNAME),siod)
67 + CSRCS := $(CSRCS) el_complete.c editline.c el_sys_unix.c
68
69 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
70 new file mode 100644
71 index 000000000000..4242700e6c2d
72 --- /dev/null
73 +++ b/app-accessibility/speech-tools/files/speech-tools-2.5.0-warnings.patch
74 @@ -0,0 +1,35 @@
75 +https://github.com/festvox/speech_tools/commit/4b677d6f3bc560248da369a86d5f2ec17c116da5
76 +(Just the strict aliasing hunk.)
77 +
78 +From 4b677d6f3bc560248da369a86d5f2ec17c116da5 Mon Sep 17 00:00:00 2001
79 +From: Sergio Oller <sergioller@×××××.com>
80 +Date: Sat, 29 Aug 2020 19:14:47 +0200
81 +Subject: [PATCH] Compile with gcc-9 without warnings (-Wall)
82 +
83 +--- a/speech_class/esps_utils.cc
84 ++++ b/speech_class/esps_utils.cc
85 +@@ -1050,7 +1050,7 @@ enum EST_read_status read_esps_hdr(esps_hdr *uhdr,FILE *fd)
86 + hdr->field_name[0] = wstrdup("samples");
87 + fseek(fd,hdr->hdr_size,SEEK_SET);
88 + /* In this cases its just in the header as a float */
89 +- sd_sample_rate = *((float *)(void *)&fhdr.fil4[0]);
90 ++ memcpy(&sd_sample_rate, &fhdr.fil4[0], sizeof(float));
91 + add_fea_d(hdr,"record_freq",0,(double)sd_sample_rate);
92 + *uhdr = hdr;
93 + return format_ok;
94 +@@ -1215,11 +1215,13 @@ enum EST_write_status write_esps_hdr(esps_hdr hdr,FILE *fd)
95 + fhdr.thirteen = 13; /* must be for luck */
96 + fhdr.sdr_size = 0;
97 + fhdr.magic = ESPS_MAGIC;
98 +- strncpy(fhdr.date,ctime(&tx),26);
99 ++ strncpy(fhdr.date,ctime(&tx),25);
100 ++ fhdr.date[25] = 0;
101 + sprintf(fhdr.version,"1.91"); /* that's what all the others have */
102 + sprintf(fhdr.prog,"EDST");
103 + sprintf(fhdr.vers,"0.1");
104 +- strncpy(fhdr.progcompdate,ctime(&tx),26);
105 ++ strncpy(fhdr.progcompdate,ctime(&tx),25);
106 ++ fhdr.progcompdate[25] = 0;
107 + fhdr.num_samples = hdr->num_records;
108 + fhdr.filler = 0;
109 + /* in each record */
110
111 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
112 new file mode 100644
113 index 000000000000..76fc1ff30431
114 --- /dev/null
115 +++ b/app-accessibility/speech-tools/speech-tools-2.5.0-r1.ebuild
116 @@ -0,0 +1,150 @@
117 +# Copyright 1999-2022 Gentoo Authors
118 +# Distributed under the terms of the GNU General Public License v2
119 +
120 +EAPI=8
121 +
122 +inherit autotools toolchain-funcs
123 +
124 +MY_P=${P/speech-/speech_}
125 +PATCHSET="r3"
126 +
127 +DESCRIPTION="Speech tools for Festival Text to Speech engine"
128 +HOMEPAGE="http://www.cstr.ed.ac.uk/projects/speech_tools/"
129 +SRC_URI="http://www.festvox.org/packed/festival/$(ver_cut 1-2)/${MY_P}-release.tar.gz
130 + https://dev.gentoo.org/~neurogeek/${PN}/speech_tools-2.1-${PATCHSET}-patches.tar.gz"
131 +S="${WORKDIR}/speech_tools"
132 +
133 +LICENSE="FESTIVAL HPND BSD rc regexp-UofT"
134 +SLOT="0"
135 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
136 +IUSE="nas openmp X"
137 +
138 +RDEPEND="
139 + media-libs/alsa-lib
140 + sys-libs/ncurses:=
141 + nas? ( media-libs/nas )
142 + X? (
143 + x11-libs/libX11
144 + x11-libs/libXt
145 + )
146 +"
147 +DEPEND="${RDEPEND}"
148 +BDEPEND="virtual/pkgconfig"
149 +
150 +DOCS=( README.md lib/cstrutt.dtd lib/example_data )
151 +
152 +PATCHES=(
153 + "${WORKDIR}/patch/02_all_gcc42.patch"
154 + "${WORKDIR}/patch/03_all_GentooLinux.patch"
155 + "${WORKDIR}/patch/05_all_sharedlib.patch"
156 + "${WORKDIR}/patch/06_all_gcc43-include.patch"
157 + "${WORKDIR}/patch/09_all_remove-shared-refs.patch"
158 + "${WORKDIR}/patch/10_all_base_class.patch"
159 + "${WORKDIR}/patch/81_all_etcpath.patch"
160 + "${WORKDIR}/patch/91_all_gentoo-config.patch"
161 + "${WORKDIR}/patch/92_all_ldflags_fix.patch"
162 + "${WORKDIR}/patch/94_all_ncurses_tinfo.patch"
163 +
164 + # Fix underlinking, bug #493204
165 + "${FILESDIR}/${PN}-2.1-underlinking.patch"
166 + "${FILESDIR}/${PN}-2.5.0-fno-common.patch"
167 + "${FILESDIR}/${PN}-2.5.0-drop-curses.patch"
168 + "${FILESDIR}/${P}-warnings.patch"
169 +)
170 +
171 +pkg_pretend() {
172 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
173 +}
174 +
175 +pkg_setup() {
176 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
177 +}
178 +
179 +src_prepare() {
180 + default
181 +
182 + sed -i -e '/^CXXFLAGS =/s|CC_OTHER_FLAGS|CXX_OTHER_FLAGS|' \
183 + config/compilers/gcc_defaults.mak || die
184 +
185 + sed -i -e 's,{{HORRIBLELIBARCHKLUDGE}},"/usr/$(get_libdir)",' \
186 + main/siod_main.cc || die
187 +
188 + # bug #309983
189 + sed -i -e "s:\(GCC_SYSTEM_OPTIONS =\).*:\1:" \
190 + "${S}"/config/systems/sparc_SunOS5.mak || die
191 +
192 + sed -i -e "s|\$(OMP_OPTS)|$(use openmp && echo -fopenmp)|g" \
193 + -e "s|\$(OMP_DEFS)|$(use openmp && echo -DOMP_WAGON=1)|g" \
194 + -e "/MAKE_SHARED_LIB =/s|-shared|$(use openmp && echo -fopenmp) -shared|" \
195 + config/compilers/gcc_defaults.mak || die
196 +
197 + eautoreconf
198 +}
199 +
200 +src_configure() {
201 + local CONFIG=config/config.in
202 +
203 + sed -i -e 's/@COMPILERTYPE@/gcc42/' ${CONFIG} || die
204 +
205 + if use nas; then
206 + sed -i -e "s/#.*\(INCLUDE_MODULES += NAS_AUDIO\)/\1/" \
207 + ${CONFIG} || die
208 + fi
209 +
210 + if ! use X; then
211 + sed -i -e "s/-lX11 -lXt//" config/modules/esd_audio.mak || die
212 + fi
213 +
214 + econf
215 +}
216 +
217 +src_compile() {
218 + emake -j1 \
219 + CC="$(tc-getCC)" \
220 + CXX="$(tc-getCXX)" \
221 + CC_OTHER_FLAGS="${CFLAGS}" \
222 + CXX_OTHER_FLAGS="${CXXFLAGS}" \
223 + LDFLAGS="${LDFLAGS}" \
224 + AR="$(tc-getAR)" \
225 + RANLIB="$(tc-getRANLIB)"
226 +}
227 +
228 +src_install() {
229 + default
230 +
231 + dolib.so lib/libest*.so*
232 +
233 + insinto /usr/share/speech-tools
234 + doins -r config base_class
235 +
236 + insinto /usr/share/speech-tools/lib
237 + doins -r lib/siod
238 +
239 + mv include speech-tools || die
240 + doheader -r speech-tools
241 + dosym ../../include/speech-tools /usr/share/speech-tools/include
242 +
243 + for file in bin/*; do
244 + [ "${file}" = "bin/Makefile" ] && continue
245 + dobin ${file}
246 + dstfile="${ED}/usr/${file}"
247 + sed -i -e "s:${S}/testsuite/data:/usr/share/speech-tools/testsuite:g" \
248 + ${dstfile} || die
249 + sed -i -e "s:${S}/bin:/usr/$(get_libdir)/speech-tools:g" \
250 + ${dstfile} || die
251 + sed -i -e "s:${S}/main:/usr/$(get_libdir)/speech-tools:g" \
252 + ${dstfile} || die
253 +
254 + # This just changes LD_LIBRARY_PATH
255 + sed -i -e "s:${S}/lib:/usr/$(get_libdir):g" ${dstfile} || die
256 + done
257 +
258 + exeinto /usr/$(get_libdir)/speech-tools
259 + for file in `find main -perm /111 -type f`; do
260 + doexe ${file}
261 + done
262 +
263 + # Remove bcat (only useful for testing on windows, see bug #418301).
264 + rm "${ED}/usr/bin/bcat" || die
265 + rm "${ED}/usr/$(get_libdir)/speech-tools/bcat" || die
266 +}