git: 234e9bc8df96 - main - audio/py-espeakng-loader: New port: Shared library loader for eSpeak NG

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 17 Mar 2026 07:52:54 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=234e9bc8df96bc1fca99958fe6c1b028360f37e8

commit 234e9bc8df96bc1fca99958fe6c1b028360f37e8
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-03-16 18:16:49 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-03-17 07:52:49 +0000

    audio/py-espeakng-loader: New port: Shared library loader for eSpeak NG
---
 audio/Makefile                                     |  1 +
 audio/py-espeakng-loader/Makefile                  | 30 ++++++++++++++++++++++
 audio/py-espeakng-loader/distinfo                  |  3 +++
 .../patch-src_espeakng__loader_____init____.py     | 20 +++++++++++++++
 audio/py-espeakng-loader/pkg-descr                 |  5 ++++
 5 files changed, 59 insertions(+)

diff --git a/audio/Makefile b/audio/Makefile
index 8385f0b74b3e..b704070acc7b 100644
--- a/audio/Makefile
+++ b/audio/Makefile
@@ -632,6 +632,7 @@
     SUBDIR += py-auditok
     SUBDIR += py-discid
     SUBDIR += py-discogs-client
+    SUBDIR += py-espeakng-loader
     SUBDIR += py-essentia
     SUBDIR += py-eyed3
     SUBDIR += py-fmoo-audiotools
diff --git a/audio/py-espeakng-loader/Makefile b/audio/py-espeakng-loader/Makefile
new file mode 100644
index 000000000000..c2563051edfc
--- /dev/null
+++ b/audio/py-espeakng-loader/Makefile
@@ -0,0 +1,30 @@
+PORTNAME=	espeakng_loader
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.2.4
+CATEGORIES=	audio python
+#MASTER_SITES=	PYPI # no latest version on PyPI
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Shared library loader for eSpeak NG
+WWW=		https://github.com/thewh1teagle/espeakng-loader
+
+LICENSE=	MIT
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}hatchling>0:devel/py-hatchling@${PY_FLAVOR}
+RUN_DEPENDS=	espeak-ng>0:audio/espeak-ng
+
+USES=		python
+USE_PYTHON=	pep517 autoplist
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	thewh1teagle
+GH_PROJECT=	espeakng-loader
+GH_TAGNAME=	0ddc87adf77e5850d7eeb542ac8a87d421b64daa
+
+NO_ARCH=	yes
+
+post-patch: # patch to change %%PREFIX%% in __init__.py to the actual prefix
+	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/src/espeakng_loader/__init__.py
+
+.include <bsd.port.mk>
diff --git a/audio/py-espeakng-loader/distinfo b/audio/py-espeakng-loader/distinfo
new file mode 100644
index 000000000000..8377c43f26c6
--- /dev/null
+++ b/audio/py-espeakng-loader/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1773682274
+SHA256 (thewh1teagle-espeakng-loader-v0.2.4-0ddc87adf77e5850d7eeb542ac8a87d421b64daa_GH0.tar.gz) = c52fde6a08f790dc9f150b68205a35d3ce0aa95dbd5fa8be7b22989b26d1ba09
+SIZE (thewh1teagle-espeakng-loader-v0.2.4-0ddc87adf77e5850d7eeb542ac8a87d421b64daa_GH0.tar.gz) = 4595
diff --git a/audio/py-espeakng-loader/files/patch-src_espeakng__loader_____init____.py b/audio/py-espeakng-loader/files/patch-src_espeakng__loader_____init____.py
new file mode 100644
index 000000000000..947a634e1340
--- /dev/null
+++ b/audio/py-espeakng-loader/files/patch-src_espeakng__loader_____init____.py
@@ -0,0 +1,20 @@
+--- src/espeakng_loader/__init__.py.orig	2026-03-16 18:06:28 UTC
++++ src/espeakng_loader/__init__.py
+@@ -4,15 +4,10 @@ def get_library_path():
+ import os
+ 
+ def get_library_path():
+-    ext = ".dll" if platform.system() == "Windows" else ".so" if platform.system() == "Linux" else ".dylib"
+-    lib_name = "espeak-ng" + ext if platform.system() == "Windows" else 'libespeak-ng' + ext
+-    return str(Path(__file__).parent / lib_name)
++    return f"%%PREFIX%%/lib/libespeak-ng.so"
+ 
+ def get_data_path():
+-    data_path = Path(__file__).parent / 'espeak-ng-data'
+-    if not data_path.exists():
+-        raise RuntimeError(f'data path not exists at {data_path}')
+-    return str(data_path)
++    return f"%%PREFIX%%/share/espeak-ng/espeak-ng-data"
+ 
+ def load_library():
+     """
diff --git a/audio/py-espeakng-loader/pkg-descr b/audio/py-espeakng-loader/pkg-descr
new file mode 100644
index 000000000000..1a9b3ec0a1ea
--- /dev/null
+++ b/audio/py-espeakng-loader/pkg-descr
@@ -0,0 +1,5 @@
+espeakng_loader is a Python package that provides a shared library loader for
+eSpeak NG.
+
+This package helps locate and load the eSpeak NG shared library across different
+platforms, making it easier to use eSpeak NG from Python applications.