summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-10-29 10:53:09 +0100
committerSam James <sam@gentoo.org>2022-10-29 10:53:14 +0100
commit16b3367c82277bbf64257c5e8b7763d17d15b667 (patch)
tree6bac870b4a4c4641a9a0384db879352682915937 /app-accessibility
parentsys-kernel/vanilla-sources: add 6.0.6, drop 6.0.5 (diff)
downloadgentoo-16b3367c82277bbf64257c5e8b7763d17d15b667.tar.gz
gentoo-16b3367c82277bbf64257c5e8b7763d17d15b667.tar.bz2
gentoo-16b3367c82277bbf64257c5e8b7763d17d15b667.zip
app-accessibility/speech-dispatcher: fix module loading via dlopen
Closes: https://bugs.gentoo.org/877339 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-accessibility')
-rw-r--r--app-accessibility/speech-dispatcher/files/speech-dispatcher-0.11.3-fix-dlopen.patch93
-rw-r--r--app-accessibility/speech-dispatcher/speech-dispatcher-0.11.3-r1.ebuild123
2 files changed, 216 insertions, 0 deletions
diff --git a/app-accessibility/speech-dispatcher/files/speech-dispatcher-0.11.3-fix-dlopen.patch b/app-accessibility/speech-dispatcher/files/speech-dispatcher-0.11.3-fix-dlopen.patch
new file mode 100644
index 000000000000..f520fdc6adfb
--- /dev/null
+++ b/app-accessibility/speech-dispatcher/files/speech-dispatcher-0.11.3-fix-dlopen.patch
@@ -0,0 +1,93 @@
+https://github.com/brailcom/speechd/commit/db21e5fe4b3155734f60a67c8ab5da6b53174e1b
+https://github.com/brailcom/speechd/pull/783
+https://bugs.gentoo.org/877339
+
+From db21e5fe4b3155734f60a67c8ab5da6b53174e1b Mon Sep 17 00:00:00 2001
+From: Bernard Cafarelli <bernard.cafarelli@gmail.com>
+Date: Mon, 17 Oct 2022 15:28:37 +0200
+Subject: [PATCH] Fix audio plugin loading with dlopen
+
+dlopen needs the full name including .so extension
+Set SPD_AUDIO_PLUGIN_ENTRY to correct name (ltdl adds a prefix)
+--- a/src/audio/alsa.c
++++ b/src/audio/alsa.c
+@@ -37,7 +37,11 @@
+ #include <alsa/asoundlib.h>
+ #include <alsa/pcm.h>
+
++#ifdef USE_DLOPEN
++#define SPD_AUDIO_PLUGIN_ENTRY spd_audio_plugin_get
++#else
+ #define SPD_AUDIO_PLUGIN_ENTRY spd_alsa_LTX_spd_audio_plugin_get
++#endif
+ #include <spd_audio_plugin.h>
+
+ typedef struct {
+--- a/src/audio/libao.c
++++ b/src/audio/libao.c
+@@ -32,7 +32,11 @@
+ #include <glib.h>
+ #include <ao/ao.h>
+
++#ifdef USE_DLOPEN
++#define SPD_AUDIO_PLUGIN_ENTRY spd_audio_plugin_get
++#else
+ #define SPD_AUDIO_PLUGIN_ENTRY spd_libao_LTX_spd_audio_plugin_get
++#endif
+ #include <spd_audio_plugin.h>
+
+ /* send a packet of XXX bytes to the sound device */
+--- a/src/audio/nas.c
++++ b/src/audio/nas.c
+@@ -32,7 +32,11 @@
+
+ #include <pthread.h>
+
++#ifdef USE_DLOPEN
++#define SPD_AUDIO_PLUGIN_ENTRY spd_audio_plugin_get
++#else
+ #define SPD_AUDIO_PLUGIN_ENTRY spd_nas_LTX_spd_audio_plugin_get
++#endif
+ #include <spd_audio_plugin.h>
+
+ typedef struct {
+--- a/src/audio/oss.c
++++ b/src/audio/oss.c
+@@ -39,7 +39,11 @@
+
+ #include <sys/soundcard.h>
+
++#ifdef USE_DLOPEN
++#define SPD_AUDIO_PLUGIN_ENTRY spd_audio_plugin_get
++#else
+ #define SPD_AUDIO_PLUGIN_ENTRY spd_oss_LTX_spd_audio_plugin_get
++#endif
+ #include <spd_audio_plugin.h>
+
+ typedef struct {
+--- a/src/audio/pulse.c
++++ b/src/audio/pulse.c
+@@ -51,7 +51,11 @@
+ #include <pulse/simple.h>
+ #include <pulse/error.h>
+
++#ifdef USE_DLOPEN
++#define SPD_AUDIO_PLUGIN_ENTRY spd_audio_plugin_get
++#else
+ #define SPD_AUDIO_PLUGIN_ENTRY spd_pulse_LTX_spd_audio_plugin_get
++#endif
+ #include <spd_audio_plugin.h>
+
+ typedef struct {
+--- a/src/common/spd_audio.c
++++ b/src/common/spd_audio.c
+@@ -120,7 +120,7 @@ AudioID *spd_audio_open(const char *name, void **pars, char **error)
+ plugin_dir = PLUGIN_DIR;
+
+ #ifdef USE_DLOPEN
+- libname = g_strdup_printf("%s/" SPD_AUDIO_LIB_PREFIX "%s", plugin_dir, name);
++ libname = g_strdup_printf("%s/" SPD_AUDIO_LIB_PREFIX "%s.so", plugin_dir, name);
+ dlhandle = dlopen(libname, RTLD_NOW | RTLD_GLOBAL);
+
+ g_free(libname);
+
diff --git a/app-accessibility/speech-dispatcher/speech-dispatcher-0.11.3-r1.ebuild b/app-accessibility/speech-dispatcher/speech-dispatcher-0.11.3-r1.ebuild
new file mode 100644
index 000000000000..93309e5e9e06
--- /dev/null
+++ b/app-accessibility/speech-dispatcher/speech-dispatcher-0.11.3-r1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..11} )
+inherit python-r1 systemd
+
+DESCRIPTION="Speech synthesis interface"
+HOMEPAGE="https://freebsoft.org/speechd"
+SRC_URI="https://github.com/brailcom/speechd/releases/download/${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="alsa ao espeak +espeak-ng flite nas pulseaudio python"
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="python? ( ${PYTHON_DEPS} )
+ >=dev-libs/dotconf-1.3
+ >=dev-libs/glib-2.36:2
+ >=media-libs/libsndfile-1.0.2
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ espeak? ( app-accessibility/espeak )
+ espeak-ng? ( app-accessibility/espeak-ng )
+ flite? ( app-accessibility/flite )
+ nas? ( media-libs/nas )
+ pulseaudio? ( media-sound/pulseaudio )"
+RDEPEND="${DEPEND}
+ python? ( dev-python/pyxdg[${PYTHON_USEDEP}] )"
+BDEPEND="
+ sys-apps/help2man
+ >=sys-devel/gettext-0.19.8
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.11.1-include-pthread_h.patch
+ "${FILESDIR}"/${P}-fix-dlopen.patch
+)
+
+src_configure() {
+ # bug 573732
+ export GIT_CEILING_DIRECTORIES="${WORKDIR}"
+
+ local myeconfargs=(
+ --disable-ltdl
+ --disable-python
+ --disable-static
+ --with-baratinoo=no
+ --with-ibmtts=no
+ --with-kali=no
+ --with-pico=no
+ --with-voxin=no
+ $(use_with alsa)
+ $(use_with ao libao)
+ $(use_with espeak)
+ $(use_with espeak-ng)
+ $(use_with flite)
+ $(use_with nas)
+ $(use_with pulseaudio pulse)
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
+ )
+ econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+ use python && python_copy_sources
+
+ emake
+
+ if use python; then
+ building() {
+ cd src/api/python || die
+ emake \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)"
+ }
+ python_foreach_impl run_in_build_dir building
+ fi
+}
+
+src_install() {
+ default
+
+ if use python; then
+ installation() {
+ cd src/api/python || die
+ emake \
+ DESTDIR="${D}" \
+ pyexecdir="$(python_get_sitedir)" \
+ pythondir="$(python_get_sitedir)" \
+ install
+ }
+ python_foreach_impl run_in_build_dir installation
+ python_replicate_script "${ED}"/usr/bin/spd-conf
+ python_foreach_impl python_optimize
+ fi
+
+ find "${D}" -name '*.la' -type f -delete || die
+}
+
+pkg_postinst() {
+ local editconfig="n"
+ if ! use espeak-ng; then
+ ewarn "You have disabled espeak-ng, which is speech-dispatcher's"
+ ewarn "default speech synthesizer."
+ ewarn
+ editconfig="y"
+ fi
+ if ! use pulseaudio; then
+ ewarn "You have disabled pulseaudio support."
+ ewarn "pulseaudio is speech-dispatcher's default audio subsystem."
+ ewarn
+ editconfig="y"
+ fi
+ if [[ "${editconfig}" == "y" ]]; then
+ ewarn "You must edit ${EROOT}/etc/speech-dispatcher/speechd.conf"
+ ewarn "and make sure the settings there match your system."
+ ewarn
+ fi
+}