mirror of
https://github.com/OpenVoiceOS/OpenVoiceOS
synced 2025-06-05 22:19:21 +02:00
[WIP] Build vosk-api andits dependencies from source
This so we can use the same package for any architecture in the future.
This commit is contained in:
@ -0,0 +1,82 @@
|
||||
From 549711480bb21121a4744da2fecaa50ecc65c619 Mon Sep 17 00:00:00 2001
|
||||
From: j1nx <p.steenbergen@j1nx.nl>
|
||||
Date: Tue, 20 Dec 2022 14:41:57 +0100
|
||||
Subject: [PATCH 1/1] Minimize setup.py
|
||||
|
||||
---
|
||||
python/setup.py | 44 ++------------------------------------------
|
||||
1 file changed, 2 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/python/setup.py b/python/setup.py
|
||||
index dcfa5de..a1d1c70 100644
|
||||
--- a/python/setup.py
|
||||
+++ b/python/setup.py
|
||||
@@ -1,44 +1,5 @@
|
||||
import os
|
||||
import setuptools
|
||||
-import shutil
|
||||
-import glob
|
||||
-import platform
|
||||
-
|
||||
-# Figure out environment for cross-compile
|
||||
-vosk_source = os.getenv("VOSK_SOURCE", os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
- "..")))
|
||||
-system = os.environ.get('VOSK_SYSTEM', platform.system())
|
||||
-architecture = os.environ.get('VOSK_ARCHITECTURE', platform.architecture()[0])
|
||||
-machine = os.environ.get('VOSK_MACHINE', platform.machine())
|
||||
-
|
||||
-# Copy precompmilled libraries
|
||||
-for lib in glob.glob(os.path.join(vosk_source, "src/lib*.*")):
|
||||
- print ("Adding library", lib)
|
||||
- shutil.copy(lib, "vosk")
|
||||
-
|
||||
-# Create OS-dependent, but Python-independent wheels.
|
||||
-try:
|
||||
- from wheel.bdist_wheel import bdist_wheel
|
||||
-except ImportError:
|
||||
- cmdclass = {}
|
||||
-else:
|
||||
- class bdist_wheel_tag_name(bdist_wheel):
|
||||
- def get_tag(self):
|
||||
- abi = 'none'
|
||||
- if system == 'Darwin':
|
||||
- oses = 'macosx_10_6_universal2'
|
||||
- elif system == 'Windows' and architecture == '32bit':
|
||||
- oses = 'win32'
|
||||
- elif system == 'Windows' and architecture == '64bit':
|
||||
- oses = 'win_amd64'
|
||||
- elif system == 'Linux' and machine == 'aarch64' and architecture == '64bit':
|
||||
- oses = 'manylinux2014_aarch64'
|
||||
- elif system == 'Linux':
|
||||
- oses = 'linux_' + machine
|
||||
- else:
|
||||
- raise TypeError("Unknown build environment")
|
||||
- return 'py3', abi, oses
|
||||
- cmdclass = {'bdist_wheel': bdist_wheel_tag_name}
|
||||
|
||||
with open("README.md", "rb") as fh:
|
||||
long_description = fh.read().decode("utf-8")
|
||||
@@ -52,7 +13,6 @@ setuptools.setup(
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/alphacep/vosk-api",
|
||||
- packages=setuptools.find_packages(),
|
||||
package_data = {'vosk': ['*.so', '*.dll', '*.dyld']},
|
||||
entry_points = {
|
||||
'console_scripts': ['vosk-transcriber=vosk.transcriber.cli:main'],
|
||||
@@ -66,10 +26,10 @@ setuptools.setup(
|
||||
'Operating System :: MacOS :: MacOS X',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules'
|
||||
],
|
||||
- cmdclass=cmdclass,
|
||||
+ cmdclass={},
|
||||
python_requires='>=3',
|
||||
zip_safe=False, # Since we load so file from the filesystem, we can not run from zip file
|
||||
- setup_requires=['cffi>=1.0', 'requests', 'tqdm', 'srt', 'websockets'],
|
||||
+ setup_requires=['cffi>=1.0'],
|
||||
install_requires=['cffi>=1.0', 'requests', 'tqdm', 'srt', 'websockets'],
|
||||
cffi_modules=['vosk_builder.py:ffibuilder'],
|
||||
)
|
||||
--
|
||||
2.34.1
|
||||
|
15
buildroot-external/package/python-vosk-api/Config.in
Normal file
15
buildroot-external/package/python-vosk-api/Config.in
Normal file
@ -0,0 +1,15 @@
|
||||
config BR2_PACKAGE_PYTHON_VOSK_API
|
||||
bool "python-vosk-api"
|
||||
select BR2_PACKAGE_PYTHON_CFFI
|
||||
select BR2_PACKAGE_PYTHON_TQDM
|
||||
select BR2_PACKAGE_PYTHON_REQUESTS
|
||||
select BR2_PACKAGE_PYTHON_SRT
|
||||
select BR2_PACKAGE_PYTHON_WEBSOCKETS
|
||||
select BR2_PACKAGE_VOSK_API
|
||||
help
|
||||
Offline speech recognition API for Android, iOS,
|
||||
Raspberry Pi and servers with Python, Java, C#
|
||||
and Node.
|
||||
|
||||
https://github.com/alphacep/vosk-api.git
|
||||
|
@ -0,0 +1,2 @@
|
||||
# Locally computed
|
||||
sha256 51ec637e7b3ef42ed3df44530533a26b0798b0f0724e467eab85b6951f51c515 python-vosk-api-cf2560c9f8a49d3d366b433fdabd78c518231bec.tar.gz
|
@ -0,0 +1,23 @@
|
||||
################################################################################
|
||||
#
|
||||
# python-vosk-api
|
||||
#
|
||||
################################################################################
|
||||
|
||||
PYTHON_VOSK_API_VERSION = cf2560c9f8a49d3d366b433fdabd78c518231bec
|
||||
PYTHON_VOSK_API_SITE = $(call github,alphacep,vosk-api,$(PYTHON_VOSK_API_VERSION))
|
||||
PYTHON_VOSK_API_LICENSE = Apache License 2.0
|
||||
|
||||
PYTHON_VOSK_API_DEPENDENCIES = python-cffi python-tqdm python-requests \
|
||||
python-srt python-websockets vosk-api
|
||||
PYTHON_VOSK_API_SUBDIR = python
|
||||
PYTHON_VOSK_API_SETUP_TYPE = setuptools
|
||||
|
||||
PYTHON_VOSK_API_POST_INSTALL_TARGET_HOOKS = PYTHON_VOSK_API_LIBVOSK_SO
|
||||
|
||||
define PYTHON_VOSK_API_LIBVOSK_SO
|
||||
$(INSTALL) -D -m 755 $(TARGET_DIR)/usr/lib/libvosk.so \
|
||||
$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/vosk/
|
||||
endef
|
||||
|
||||
$(eval $(python-package))
|
Reference in New Issue
Block a user