fix(subsync): make build using 5prealpha sphinx
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
88489d4a43
commit
3bc5011e6a
5 changed files with 64 additions and 91 deletions
|
@ -24,8 +24,8 @@ in
|
|||
buildInputs = [
|
||||
ffmpeg
|
||||
pkg-config
|
||||
pocketsphinx
|
||||
sphinxbase
|
||||
pocketsphinx
|
||||
];
|
||||
|
||||
nativeBuildInputs = with python3Packages; [
|
||||
|
@ -45,10 +45,7 @@ in
|
|||
utils
|
||||
];
|
||||
|
||||
patches = [
|
||||
./patches/cmd_ln.patch
|
||||
./patches/cstdint.patch
|
||||
];
|
||||
patches = [./patches/cstdint.patch];
|
||||
|
||||
# The tests are for the GUI
|
||||
doCheck = false;
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
diff --git a/gizmo/media/speechrec.h b/gizmo/media/speechrec.h
|
||||
index de7a932..076c8fe 100644
|
||||
--- a/gizmo/media/speechrec.h
|
||||
+++ b/gizmo/media/speechrec.h
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "text/words.h"
|
||||
#include <pocketsphinx.h>
|
||||
#include <string>
|
||||
+#include <util/cmd_ln.h>
|
||||
|
||||
|
||||
class SpeechRecognition : public AVOutput
|
||||
|
||||
diff --git a/gizmo/media/speechrec.cpp b/gizmo/media/speechrec.cpp
|
||||
index 4fe0bf7..fd041b9 100644
|
||||
--- a/gizmo/media/speechrec.cpp
|
||||
+++ b/gizmo/media/speechrec.cpp
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "general/exception.h"
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
+#include <util/cmd_ln.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -30,28 +31,13 @@ SpeechRecognition::~SpeechRecognition()
|
||||
|
||||
void SpeechRecognition::setParam(const string &key, const string &val)
|
||||
{
|
||||
- arg_t const *args = ps_args();
|
||||
+ ps_arg_t const *args = ps_args();
|
||||
|
||||
for (size_t i = 0; args[i].name != NULL; i++)
|
||||
{
|
||||
if (key == args[i].name)
|
||||
{
|
||||
- int type = args[i].type;
|
||||
- if (type & ARG_INTEGER)
|
||||
- cmd_ln_set_int_r(m_config, key.c_str(), atol(val.c_str()));
|
||||
- else if (type & ARG_FLOATING)
|
||||
- cmd_ln_set_float_r(m_config, key.c_str(), atof(val.c_str()));
|
||||
- else if (type & ARG_STRING)
|
||||
- cmd_ln_set_str_r(m_config, key.c_str(), val.c_str());
|
||||
- else if (type & ARG_BOOLEAN)
|
||||
- cmd_ln_set_boolean_r(m_config, key.c_str(),
|
||||
- !(val.empty() || val == "0"));
|
||||
- else
|
||||
- throw EXCEPTION("invalid parameter type")
|
||||
- .module("SpeechRecognition", "setParameter")
|
||||
- .add("parameter", key)
|
||||
- .add("value", val)
|
||||
- .add("type", type);
|
||||
+ cmd_ln_set_str_extra_r(m_config, key.c_str(), val.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -89,7 +75,7 @@ void SpeechRecognition::start(const AVStream *stream)
|
||||
throw EXCEPTION("can't init Sphinx engine")
|
||||
.module("SpeechRecognition", "ps_init");
|
||||
|
||||
- int32_t frate = cmd_ln_int32_r(m_config, "-frate");
|
||||
+ int32_t frate = ((cmd_ln_access_r(m_config, "-frate"))->val).fl;
|
||||
m_framePeriod = 1.0 / (double)frate;
|
||||
|
||||
if (frate == 0)
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4
|
||||
index 59a2ff09..af64eab2 100644
|
||||
--- a/m4/ax_python_devel.m4
|
||||
+++ b/m4/ax_python_devel.m4
|
||||
@@ -132,21 +132,6 @@ variable to configure. See ``configure --help'' for reference.
|
||||
fi
|
||||
fi
|
||||
|
||||
- #
|
||||
- # Check if you have distutils, else fail
|
||||
- #
|
||||
- AC_MSG_CHECKING([for the distutils Python package])
|
||||
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
|
||||
- if test -z "$ac_distutils_result"; then
|
||||
- AC_MSG_RESULT([yes])
|
||||
- else
|
||||
- AC_MSG_RESULT([no])
|
||||
- AC_MSG_ERROR([cannot import Python module "distutils".
|
||||
-Please check your Python installation. The error was:
|
||||
-$ac_distutils_result])
|
||||
- PYTHON_VERSION=""
|
||||
- fi
|
||||
-
|
||||
#
|
||||
# Check for Python include path
|
||||
#
|
|
@ -1,29 +1,40 @@
|
|||
{
|
||||
cmake,
|
||||
autoreconfHook,
|
||||
fetchFromGitHub,
|
||||
pkg-config,
|
||||
pocketsphinx-src,
|
||||
python3,
|
||||
sphinxbase,
|
||||
stdenv,
|
||||
swig2,
|
||||
...
|
||||
}: let
|
||||
pyproject =
|
||||
(
|
||||
fromTOML (
|
||||
builtins.readFile "${pocketsphinx-src}/pyproject.toml"
|
||||
)
|
||||
)
|
||||
.project;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "pocketsphinx";
|
||||
inherit (pyproject) version;
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "pocketsphinx";
|
||||
version = "5prealpha";
|
||||
|
||||
src = pocketsphinx-src;
|
||||
src = fetchFromGitHub {
|
||||
owner = "cmusphinx";
|
||||
repo = "pocketsphinx";
|
||||
rev = "5da71f0a05350c923676b02a69423d1291825d5b";
|
||||
hash = "sha256-YZwuVYg8Uqt1gOYXeYC8laRj+IObbuO9f/BjcQKRwkY=";
|
||||
};
|
||||
|
||||
buildInputs = [pkg-config];
|
||||
nativeBuildInputs = [cmake sphinxbase];
|
||||
patches = [./patches/distutils.patch];
|
||||
|
||||
postFixup = ''
|
||||
cp -ar ${src}/src/util $out/include
|
||||
'';
|
||||
}
|
||||
autoreconfPhase = ''
|
||||
./autogen.sh
|
||||
'';
|
||||
nativeBuildInputs = [
|
||||
autoreconfHook
|
||||
pkg-config
|
||||
swig2
|
||||
python3
|
||||
];
|
||||
propagatedBuildInputs = [
|
||||
sphinxbase
|
||||
];
|
||||
|
||||
postFixup = ''
|
||||
cp $out/include/pocketsphinx/* $out/include
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -25,4 +25,8 @@ stdenv.mkDerivation {
|
|||
rev = "617e53691889336a482631380f75b453445d0dae";
|
||||
hash = "sha256-w/Huz4+crTzdiSyQVAx0h3lhtTTrtPyKp3xpQD5EG9g=";
|
||||
};
|
||||
|
||||
postFixup = ''
|
||||
cp $out/include/sphinxbase/* $out/include/
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue