espeak-ng: 1.51.1 -> 1.52.0

Migrates the build to cmake/ninja. The old `speak-ng` executable is now
gone.
This commit is contained in:
Martin Weinelt
2025-09-15 18:22:23 +02:00
parent 1b25416104
commit 73c79f9dae
3 changed files with 91 additions and 53 deletions
+40 -47
View File
@@ -2,42 +2,46 @@
stdenv,
lib,
fetchFromGitHub,
fetchpatch,
replaceVars,
# build system
autoconf,
automake,
which,
cmake,
libtool,
makeWrapper,
ninja,
pkg-config,
ronn,
replaceVars,
buildPackages,
mbrolaSupport ? true,
mbrola,
pcaudiolibSupport ? true,
pcaudiolib,
sonicSupport ? true,
sonic,
which,
# dependencies
alsa-plugins,
makeWrapper,
asyncSupport ? true,
klattSupport ? true,
mbrola,
mbrolaSupport ? true,
pcaudiolib,
pcaudiolibSupport ? true,
sonic,
sonicSupport ? true,
speechPlayerSupport ? true,
}:
stdenv.mkDerivation rec {
pname = "espeak-ng";
version = "1.51.1";
version = "1.52.0";
src = fetchFromGitHub {
owner = "espeak-ng";
repo = "espeak-ng";
rev = version;
hash = "sha256-aAJ+k+kkOS6k835mEW7BvgAIYGhUHxf7Q4P5cKO8XTk=";
tag = version;
hash = "sha256-mmh5QPSVD5YQ0j16R+bEL5vcyWLtTNOJ/irBNzWY3ro=";
};
patches = [
# Fix build with Clang 16.
(fetchpatch {
url = "https://github.com/espeak-ng/espeak-ng/commit/497c6217d696c1190c3e8b992ff7b9110eb3bedd.patch";
hash = "sha256-KfzqnRyQfz6nuMKnsHoUzb9rn9h/Pg54mupW1Cr+Zx0=";
})
# https://github.com/espeak-ng/espeak-ng/pull/2274
./libsonic.patch
]
++ lib.optionals mbrolaSupport [
# Hardcode correct mbrola paths.
@@ -49,11 +53,13 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
autoconf
automake
which
cmake
libtool
ninja
pkg-config
ronn
makeWrapper
which
];
buildInputs =
@@ -61,30 +67,17 @@ stdenv.mkDerivation rec {
++ lib.optional pcaudiolibSupport pcaudiolib
++ lib.optional sonicSupport sonic;
# touch ChangeLog to avoid below error on darwin:
# Makefile.am: error: required file './ChangeLog.md' not found
preConfigure =
lib.optionalString stdenv.hostPlatform.isDarwin ''
touch ChangeLog
''
+ ''
./autogen.sh
'';
configureFlags = [
"--with-mbrola=${if mbrolaSupport then "yes" else "no"}"
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
(lib.cmakeBool "USE_ASYNC" asyncSupport)
(lib.cmakeBool "USE_KLATT" klattSupport)
(lib.cmakeBool "USE_LIBPCAUDIO" pcaudiolibSupport)
(lib.cmakeBool "USE_LIBSONIC" sonicSupport)
(lib.cmakeBool "USE_MBROLA" mbrolaSupport)
(lib.cmakeBool "USE_SPEECHPLAYER" speechPlayerSupport)
];
# ref https://github.com/void-linux/void-packages/blob/3cf863f894b67b3c93e23ac7830ca46b697d308a/srcpkgs/espeak-ng/template#L29-L31
postConfigure = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
substituteInPlace Makefile \
--replace 'ESPEAK_DATA_PATH=$(CURDIR) src/espeak-ng' 'ESPEAK_DATA_PATH=$(CURDIR) ${lib.getExe buildPackages.espeak-ng}' \
--replace 'espeak-ng-data/%_dict: src/espeak-ng' 'espeak-ng-data/%_dict: ${lib.getExe buildPackages.espeak-ng}' \
--replace '../src/espeak-ng --compile' "${lib.getExe buildPackages.espeak-ng} --compile"
'';
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/espeak-ng)" $out/bin/speak-ng
wrapProgram $out/bin/espeak-ng \
--set ALSA_PLUGIN_DIR ${alsa-plugins}/lib/alsa-lib
'';
@@ -93,13 +86,13 @@ stdenv.mkDerivation rec {
inherit mbrolaSupport;
};
meta = with lib; {
description = "Open source speech synthesizer that supports over 70 languages, based on eSpeak";
meta = {
description = "Speech synthesizer that supports more than hundred languages and accents";
homepage = "https://github.com/espeak-ng/espeak-ng";
changelog = "https://github.com/espeak-ng/espeak-ng/blob/${version}/CHANGELOG.md";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ aske ];
platforms = platforms.all;
changelog = "https://github.com/espeak-ng/espeak-ng/blob/${src.tag}/ChangeLog.md";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ aske ];
platforms = lib.platforms.all;
mainProgram = "espeak-ng";
};
}
@@ -0,0 +1,41 @@
diff --git a/cmake/deps.cmake b/cmake/deps.cmake
index b63ced21..2cd1727b 100644
--- a/cmake/deps.cmake
+++ b/cmake/deps.cmake
@@ -13,20 +13,22 @@ endif(PTHREAD_LIB)
if (MBROLA_BIN)
set(HAVE_MBROLA ON)
endif(MBROLA_BIN)
-if (SONIC_LIB AND SONIC_INC)
- set(HAVE_LIBSONIC ON)
-else()
- FetchContent_Declare(sonic-git
- GIT_REPOSITORY https://github.com/waywardgeek/sonic.git
- GIT_TAG fbf75c3d6d846bad3bb3d456cbc5d07d9fd8c104
- )
- FetchContent_MakeAvailable(sonic-git)
- FetchContent_GetProperties(sonic-git)
- add_library(sonic OBJECT ${sonic-git_SOURCE_DIR}/sonic.c)
- target_include_directories(sonic PUBLIC ${sonic-git_SOURCE_DIR})
- set(HAVE_LIBSONIC ON)
- set(SONIC_LIB sonic)
- set(SONIC_INC ${sonic-git_SOURCE_DIR})
+if (USE_LIBSONIC)
+ if (SONIC_LIB AND SONIC_INC)
+ set(HAVE_LIBSONIC ON)
+ else()
+ FetchContent_Declare(sonic-git
+ GIT_REPOSITORY https://github.com/waywardgeek/sonic.git
+ GIT_TAG fbf75c3d6d846bad3bb3d456cbc5d07d9fd8c104
+ )
+ FetchContent_MakeAvailable(sonic-git)
+ FetchContent_GetProperties(sonic-git)
+ add_library(sonic OBJECT ${sonic-git_SOURCE_DIR}/sonic.c)
+ target_include_directories(sonic PUBLIC ${sonic-git_SOURCE_DIR})
+ set(HAVE_LIBSONIC ON)
+ set(SONIC_LIB sonic)
+ set(SONIC_INC ${sonic-git_SOURCE_DIR})
+ endif()
endif()
if (PCAUDIO_LIB AND PCAUDIO_INC)
set(HAVE_LIBPCAUDIO ON)
+10 -6
View File
@@ -1,22 +1,26 @@
diff --git a/src/libespeak-ng/mbrowrap.c b/src/libespeak-ng/mbrowrap.c
index e3e4b702..de06dd21 100644
--- a/src/libespeak-ng/mbrowrap.c
+++ b/src/libespeak-ng/mbrowrap.c
@@ -205,7 +205,7 @@
@@ -209,7 +209,7 @@ static int start_mbrola(const char *voice_path)
signal(SIGTERM, SIG_IGN);
snprintf(charbuf, sizeof(charbuf), "%g", mbr_volume);
- execlp("mbrola", "mbrola", "-e", "-v", charbuf,
+ execlp("@mbrola@/bin/mbrola", "mbrola", "-e", "-v", charbuf,
+ execlp("@mbrola/bin/mbrola@", "mbrola", "-e", "-v", charbuf,
voice_path, "-", "-.wav", (char *)NULL);
/* if execution reaches this point then the exec() failed */
snprintf(mbr_errorbuf, sizeof(mbr_errorbuf),
diff --git a/src/libespeak-ng/synth_mbrola.c b/src/libespeak-ng/synth_mbrola.c
index 5f9b0458..26a05635 100644
--- a/src/libespeak-ng/synth_mbrola.c
+++ b/src/libespeak-ng/synth_mbrola.c
@@ -85,7 +85,7 @@
@@ -95,7 +95,7 @@ espeak_ng_STATUS LoadMbrolaTable(const char *mbrola_voice, const char *phtrans,
if (!load_MBR())
return ENS_MBROLA_NOT_FOUND;
- sprintf(path, "%s/mbrola/%s", path_home, mbrola_voice);
+ sprintf(path, "@mbrola@/share/mbrola/voices/%s/%s", mbrola_voice, mbrola_voice);
#ifdef PLATFORM_POSIX
+ sprintf(path, "%s/@mbrola@/%s", path_home, mbrola_voice);
#if PLATFORM_POSIX
// if not found, then also look in
// usr/share/mbrola/xx, /usr/share/mbrola/xx/xx, /usr/share/mbrola/voices/xx
// $data_dir/mbrola/xx, $data_dir/mbrola/xx/xx, $data_dir/mbrola/voices/xx