The package rpms/vosk-api.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s): https://src.fedoraproject.org/cgit/rpms/vosk-api.git/commit/?id=358a4c0d14c9....
Change: +ExclusiveArch: x86_64 aarch64 ppc64le
Thanks.
Full change: ============
commit 358a4c0d14c98890836bd88b813e74eff771f58a Author: matiwari matiwari@redhat.com Date: Wed Dec 18 12:24:32 2024 +0530
Initial import (fedora#2303960).
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40096ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/93ef0019b847272a239fbb485ef97f29feb1d587.tar.gz +/vosk-api-0.3.45.tar.gz diff --git a/kaldi-fst.patch b/kaldi-fst.patch new file mode 100644 index 0000000..9d2a010 --- /dev/null +++ b/kaldi-fst.patch @@ -0,0 +1,162 @@ +diff -ur vosk-api-0.3.45.orig/kaldi/src/base/kaldi-types.h vosk-api-0.3.45/kaldi/src/base/kaldi-types.h +--- vosk-api-0.3.45.orig/kaldi/src/base/kaldi-types.h 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/base/kaldi-types.h 2024-07-29 17:56:36.472446440 +0530 +@@ -39,24 +39,21 @@ + // we find in the future lacks stdint.h + #include <stdint.h> + +-// for discussion on what to do if you need compile kaldi +-// without OpenFST, see the bottom of this this file +-#include <fst/types.h> ++#include <cstdlib> // for ssize_t. ++#include <cstdint> // for ?int*_t. + +-namespace kaldi { +- using ::int16; +- using ::int32; +- using ::int64; +- using ::uint16; +- using ::uint32; +- using ::uint64; +- typedef float float32; +- typedef double double64; +-} // end namespace kaldi ++using int8 = int8_t; ++using int16 = int16_t; ++using int32 = int32_t; ++using int64 = int64_t; + ++using uint8 = uint8_t; ++using uint16 = uint16_t; ++using uint32 = uint32_t; ++using uint64 = uint64_t; + // In a theoretical case you decide compile Kaldi without the OpenFST + // comment the previous namespace statement and uncomment the following +-/* ++ + namespace kaldi { + typedef int8_t int8; + typedef int16_t int16; +@@ -70,6 +67,6 @@ + typedef float float32; + typedef double double64; + } // end namespace kaldi +-*/ ++ + + #endif // KALDI_BASE_KALDI_TYPES_H_ +diff -ur vosk-api-0.3.45.orig/kaldi/src/configure vosk-api-0.3.45/kaldi/src/configure +--- vosk-api-0.3.45.orig/kaldi/src/configure 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/configure 2024-07-29 18:06:59.370087996 +0530 +@@ -933,7 +933,7 @@ + OPENFST_VER=${OPENFST_VER:-$(grep 'PACKAGE_VERSION' $FSTROOT/Makefile | sed -e 's:.*= ::')} + OPENFST_VER_NUM=$(echo $OPENFST_VER | sed 's/./ /g' | xargs printf "%d%02d%02d") + if [ $OPENFST_VER_NUM -lt 10600 ]; then +- failure "OpenFst-$OPENFST_VER is not supported. You need OpenFst >= 1.6.0.)" ++ : + fi + echo "OPENFSTINC = $FSTROOT/include" >> kaldi.mk + if $static_fst ; then +diff -ur vosk-api-0.3.45.orig/kaldi/src/fstext/kaldi-fst-io-inl.h vosk-api-0.3.45/kaldi/src/fstext/kaldi-fst-io-inl.h +--- vosk-api-0.3.45.orig/kaldi/src/fstext/kaldi-fst-io-inl.h 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/fstext/kaldi-fst-io-inl.h 2024-07-29 18:11:03.346500252 +0530 +@@ -99,7 +99,7 @@ + fst->DeleteStates(); + string line; + size_t nline = 0; +- string separator = FLAGS_fst_field_separator + "\r\n"; ++ string separator = FST_FLAGS_fst_field_separator + "\r\n"; + while (std::getline(is, line)) { + nline++; + vector<string> col; +diff -ur vosk-api-0.3.45.orig/kaldi/src/fstext/lattice-weight.h vosk-api-0.3.45/kaldi/src/fstext/lattice-weight.h +--- vosk-api-0.3.45.orig/kaldi/src/fstext/lattice-weight.h 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/fstext/lattice-weight.h 2024-07-29 18:20:58.390880865 +0530 +@@ -396,8 +396,8 @@ + template <class FloatType> + inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<FloatType> &w) { + LatticeWeightTpl<FloatType>::WriteFloatType(strm, w.Value1()); +- CHECK(FLAGS_fst_weight_separator.size() == 1); +- strm << FLAGS_fst_weight_separator[0]; // comma by default; ++ CHECK(FST_FLAGS_fst_weight_separator.size() == 1); ++ strm << FST_FLAGS_fst_weight_separator[0]; // comma by default; + // may or may not be settable from Kaldi programs. + LatticeWeightTpl<FloatType>::WriteFloatType(strm, w.Value2()); + return strm; +@@ -405,9 +405,9 @@ + + template <class FloatType> + inline std::istream &operator >>(std::istream &strm, LatticeWeightTpl<FloatType> &w1) { +- CHECK(FLAGS_fst_weight_separator.size() == 1); ++ CHECK(FST_FLAGS_fst_weight_separator.size() == 1); + // separator defaults to ',' +- return w1.ReadNoParen(strm, FLAGS_fst_weight_separator[0]); ++ return w1.ReadNoParen(strm, FST_FLAGS_fst_weight_separator[0]); + } + + +@@ -728,8 +728,8 @@ + template <class WeightType, class IntType> + inline std::ostream &operator <<(std::ostream &strm, const CompactLatticeWeightTpl<WeightType, IntType> &w) { + strm << w.Weight(); +- CHECK(FLAGS_fst_weight_separator.size() == 1); +- strm << FLAGS_fst_weight_separator[0]; // comma by default. ++ CHECK(FST_FLAGS_fst_weight_separator.size() == 1); ++ strm << FST_FLAGS_fst_weight_separator[0]; // comma by default. + for(size_t i = 0; i < w.String().size(); i++) { + strm << w.String()[i]; + if (i+1 < w.String().size()) +@@ -745,8 +745,8 @@ + if (strm.fail()) { + return strm; + } +- CHECK(FLAGS_fst_weight_separator.size() == 1); +- size_t pos = s.find_last_of(FLAGS_fst_weight_separator); // normally "," ++ CHECK(FST_FLAGS_fst_weight_separator.size() == 1); ++ size_t pos = s.find_last_of(FST_FLAGS_fst_weight_separator); // normally "," + if (pos == std::string::npos) { + strm.clear(std::ios::badbit); + return strm; +diff -ur vosk-api-0.3.45.orig/kaldi/src/fstext/trivial-factor-weight.h vosk-api-0.3.45/kaldi/src/fstext/trivial-factor-weight.h +--- vosk-api-0.3.45.orig/kaldi/src/fstext/trivial-factor-weight.h 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/fstext/trivial-factor-weight.h 2024-07-29 18:24:27.314958419 +0530 +@@ -390,7 +390,7 @@ + template <class A, class F> + inline void TrivialFactorWeightFst<A, F>::InitStateIterator( + StateIteratorData<A> *data) const { +- data->base = fst::make_unique<StateIterator<TrivialFactorWeightFst<A, F> > >(*this); ++ data->base = std::make_unique<StateIterator<TrivialFactorWeightFst<A, F> > >(*this); + } + + +diff -ur vosk-api-0.3.45.orig/kaldi/src/lat/kaldi-lattice.cc vosk-api-0.3.45/kaldi/src/lat/kaldi-lattice.cc +--- vosk-api-0.3.45.orig/kaldi/src/lat/kaldi-lattice.cc 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/lat/kaldi-lattice.cc 2024-07-29 18:27:40.742797294 +0530 +@@ -114,7 +114,7 @@ + CompactLattice *cfst = new CompactLattice(); + string line; + size_t nline = 0; +- string separator = FLAGS_fst_field_separator + "\r\n"; ++ string separator = FST_FLAGS_fst_field_separator + "\r\n"; + while (std::getline(is, line)) { + nline++; + vector<string> col; +diff -ur vosk-api-0.3.45.orig/kaldi/src/lat/lattice-functions-transition-model.cc vosk-api-0.3.45/kaldi/src/lat/lattice-functions-transition-model.cc +--- vosk-api-0.3.45.orig/kaldi/src/lat/lattice-functions-transition-model.cc 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/lat/lattice-functions-transition-model.cc 2024-07-29 18:30:17.735011144 +0530 +@@ -248,13 +248,13 @@ + int32 num_paths = 5, seed = Rand(), max_path_length = -1; + BaseFloat delta = 0.2; // some lattices have large costs -> use large delta. + +- FLAGS_v = GetVerboseLevel(); // set the OpenFst verbose level to the Kaldi ++ FST_FLAGS_v = GetVerboseLevel(); // set the OpenFst verbose level to the Kaldi + // verbose level. + if (!RandEquivalent(clat, aligned_clat, num_paths, delta, seed, max_path_length)) { + KALDI_WARN << "Equivalence test failed during lattice alignment."; + return false; + } +- FLAGS_v = 0; ++ FST_FLAGS_v = 0; + + return (num_err == 0); + } diff --git a/kaldi-lapack.patch b/kaldi-lapack.patch new file mode 100644 index 0000000..a189d13 --- /dev/null +++ b/kaldi-lapack.patch @@ -0,0 +1,34 @@ +diff -ur vosk-api-0.3.45.orig/kaldi/src/configure vosk-api-0.3.45/kaldi/src/configure +--- vosk-api-0.3.45.orig/kaldi/src/configure 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/configure 2024-07-31 15:14:28.465723341 +0530 +@@ -834,7 +834,7 @@ + + # Validate the (optionally) provided MATHLIB value. + case $MATHLIB in +- ''|ATLAS|CLAPACK|MKL|OPENBLAS|OPENBLAS_CLAPACK) : ;; ++ ''|ATLAS|CLAPACK|MKL|OPENBLAS|OPENBLAS_CLAPACK|OPENBLAS_NO_F2C) : ;; + *) failure "Unknown --mathlib='${MATHLIB}'. Supported libs: ATLAS CLAPACK MKL OPENBLAS" ;; + esac + +@@ -1301,7 +1301,7 @@ + esac >> kaldi.mk + + echo "Successfully configured for Linux with OpenBLAS from $OPENBLASROOT" +- elif [ "$MATHLIB" == "OPENBLAS_CLAPACK" ]; then ++ elif [ "$MATHLIB" == "OPENBLAS_CLAPACK" ] || [ "$MATHLIB" == "OPENBLAS_NO_F2C" ]; then + if [[ ! $OPENBLASROOT ]]; then + # Either the user specified --mathlib=OPENBLAS or we've autodetected the + # system where OpenBLAS is the preferred option (the parser for +@@ -1345,7 +1345,11 @@ + OPENBLASINCDIR="/usr/include" + fi + echo "Your math library seems to be OpenBLAS from $OPENBLASROOT. Configuring appropriately." +- OPENBLASLIBS="-L$OPENBLASLIBDIR -l:libopenblas.a -l:libblas.a -l:liblapack.a -l:libf2c.a" ++ if [ "$MATHLIB" == "OPENBLAS_CLAPACK" ]; then ++ OPENBLASLIBS="-L$OPENBLASLIBDIR -l:libopenblas.a -l:libblas.a -l:liblapack.a -l:libf2c.a" ++ else ++ OPENBLASLIBS="-L$OPENBLASLIBDIR -l:libopenblas.a -l:libblas.a -l:liblapack.a" ++ fi + echo "OPENBLASINC = $OPENBLASINCDIR" >> kaldi.mk + echo "OPENBLASLIBS = $OPENBLASLIBS" >> kaldi.mk + echo >> kaldi.mk diff --git a/kaldi-openblas.patch b/kaldi-openblas.patch new file mode 100644 index 0000000..5e33529 --- /dev/null +++ b/kaldi-openblas.patch @@ -0,0 +1,56 @@ +diff -ur vosk-api-0.3.45.orig/kaldi/src/matrix/cblas-wrappers.h vosk-api-0.3.45/kaldi/src/matrix/cblas-wrappers.h +--- vosk-api-0.3.45.orig/kaldi/src/matrix/cblas-wrappers.h 2022-11-19 05:23:44.000000000 +0530 ++++ vosk-api-0.3.45/kaldi/src/matrix/cblas-wrappers.h 2024-07-31 15:33:39.183853122 +0530 +@@ -383,10 +383,10 @@ + // add clapack here + #if !defined(HAVE_ATLAS) + inline void clapack_Xtptri(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *result) { +- stptri_(const_cast<char *>("U"), const_cast<char *>("N"), num_rows, Mdata, result); ++ stptri_(const_cast<char *>("U"), const_cast<char *>("N"), num_rows, Mdata, result, 1, 1); + } + inline void clapack_Xtptri(KaldiBlasInt *num_rows, double *Mdata, KaldiBlasInt *result) { +- dtptri_(const_cast<char *>("U"), const_cast<char *>("N"), num_rows, Mdata, result); ++ dtptri_(const_cast<char *>("U"), const_cast<char *>("N"), num_rows, Mdata, result, 1, 1); + } + // + inline void clapack_Xgetrf2(KaldiBlasInt *num_rows, KaldiBlasInt *num_cols, +@@ -420,7 +420,7 @@ + sgesvd_(v, u, + num_cols, num_rows, Mdata, stride, + sv, Vdata, vstride, Udata, ustride, +- p_work, l_work, result); ++ p_work, l_work, result, 1, 1); + } + inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols, + KaldiBlasInt *num_rows, double *Mdata, KaldiBlasInt *stride, +@@ -430,25 +430,25 @@ + dgesvd_(v, u, + num_cols, num_rows, Mdata, stride, + sv, Vdata, vstride, Udata, ustride, +- p_work, l_work, result); ++ p_work, l_work, result, 1, 1); + } + // + void inline clapack_Xsptri(KaldiBlasInt *num_rows, float *Mdata, + KaldiBlasInt *ipiv, float *work, KaldiBlasInt *result) { +- ssptri_(const_cast<char *>("U"), num_rows, Mdata, ipiv, work, result); ++ ssptri_(const_cast<char *>("U"), num_rows, Mdata, ipiv, work, result, 1); + } + void inline clapack_Xsptri(KaldiBlasInt *num_rows, double *Mdata, + KaldiBlasInt *ipiv, double *work, KaldiBlasInt *result) { +- dsptri_(const_cast<char *>("U"), num_rows, Mdata, ipiv, work, result); ++ dsptri_(const_cast<char *>("U"), num_rows, Mdata, ipiv, work, result, 1); + } + // + void inline clapack_Xsptrf(KaldiBlasInt *num_rows, float *Mdata, + KaldiBlasInt *ipiv, KaldiBlasInt *result) { +- ssptrf_(const_cast<char *>("U"), num_rows, Mdata, ipiv, result); ++ ssptrf_(const_cast<char *>("U"), num_rows, Mdata, ipiv, result, 1); + } + void inline clapack_Xsptrf(KaldiBlasInt *num_rows, double *Mdata, + KaldiBlasInt *ipiv, KaldiBlasInt *result) { +- dsptrf_(const_cast<char *>("U"), num_rows, Mdata, ipiv, result); ++ dsptrf_(const_cast<char *>("U"), num_rows, Mdata, ipiv, result, 1); + } + #else + inline void clapack_Xgetrf(MatrixIndexT num_rows, MatrixIndexT num_cols, diff --git a/sources b/sources new file mode 100644 index 0000000..bd0a485 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (93ef0019b847272a239fbb485ef97f29feb1d587.tar.gz) = 8ee5c146befcf9ba7f9e0bc5daf373cb9470a783d6fa9f8aa3d0f49b37a3d6e5ca5817bed0ae2b0e00db32002568fd601f2597cc7ae19e8e6cdc963c8ac9dde3 +SHA512 (vosk-api-0.3.45.tar.gz) = cf55ddb4abf078c1a16a5ae149d3ac141da9fd88ccd9bed018df5f5c0fd489517ffe0a1dc9b20b4f5b07738cfac771f9c08637c9e92e8d494727124b76772eb1 diff --git a/vosk-api.spec b/vosk-api.spec new file mode 100644 index 0000000..fd14047 --- /dev/null +++ b/vosk-api.spec @@ -0,0 +1,88 @@ +# vosk-api-devel primarily consists of header and shared lib +# with no significant executable content requiring debugging. +%global debug_package %{nil} +%global kaldi_commit 93ef0019b847272a239fbb485ef97f29feb1d587 +Name: vosk-api +Version: 0.3.45 +Release: 1%{?dist} +Summary: Offline speech recognition toolkit +# vosk-api depends on Kaldi, which itself relies on OpenFST that uses +# floating-point optimizations specific to 64-bit systems +ExclusiveArch: x86_64 aarch64 ppc64le +License: Apache-2.0 +URL: https://alphacephei.com/vosk +Source0: https://github.com/alphacep/vosk-api/archive/v%%7Bversion%7D/vosk-api-%%7Bve... +Source1: https://github.com/alphacep/kaldi/archive/%%7Bkaldi_commit%7D.tar.gz + +# These patches improve Kaldi's OpenFST, OpenBLAS, and LAPACK compatibility. +Patch0: kaldi-fst.patch +Patch1: kaldi-lapack.patch +Patch2: kaldi-openblas.patch +Patch3: vosk-lapack.patch +Patch4: vosk-lib_fst.patch + +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: make +BuildRequires: blas-static +BuildRequires: lapack-static +BuildRequires: openblas-static +BuildRequires: openfst-tools +BuildRequires: blas-devel +BuildRequires: lapack-devel +BuildRequires: openblas-devel +BuildRequires: openfst-devel +BuildRequires: unzip + +%description +Vosk is an offline open source speech recognition toolkit. + +%package devel +Summary: Development libraries of vosk-api + +%description devel +The vosk-api-devel package contains the header and shared library + +%prep +%setup -q -a1 +tar -xzf %{SOURCE1} + +# Move and setup Kaldi +mv kaldi-%{kaldi_commit} kaldi + +%patch -P0 -p1 +%patch -P1 -p1 +%patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 + +cd kaldi/tools +mkdir -p OpenBLAS/install/lib +ln -sf %{_includedir}/openblas OpenBLAS/install/include +ln -sf %{_libdir}/* OpenBLAS/install/lib +mkdir -p openfst/include openfst/lib +ln -sf %{_includedir}/fst openfst/include +ln -sf %{_libdir}/* openfst/lib + +%build +cd kaldi/src +./configure --mathlib=OPENBLAS_NO_F2C --shared --use-cuda=no +%make_build online2 lm rnnlm + +cd %{_builddir}/vosk-api-%{version}/src +%make_build KALDI_ROOT=../kaldi HAVE_OPENBLAS_NO_F2C=1 HAVE_OPENBLAS_CLAPACK=0 + +%install +# Install vosk-api headers and library +install -Dpm 644 %{_builddir}/vosk-api-%{version}/src/vosk_api.h %{buildroot}%{_includedir}/vosk_api.h +install -Dpm 755 %{_builddir}/vosk-api-%{version}/src/libvosk.so %{buildroot}%{_libdir}/libvosk.so + +%files devel +%license COPYING +%doc README.md +%{_includedir}/vosk_api.h +%{_libdir}/libvosk.so + +%changelog +* Mon Jul 29 2024 Manish Tiwari matiwari@redhat.com - 0.3.45-1 +- Initial package release diff --git a/vosk-lapack.patch b/vosk-lapack.patch new file mode 100644 index 0000000..df9acd8 --- /dev/null +++ b/vosk-lapack.patch @@ -0,0 +1,31 @@ +diff -ur vosk-api-0.3.45.orig/src/Makefile vosk-api-0.3.45/src/Makefile +--- vosk-api-0.3.45.orig/src/Makefile 2022-12-14 22:28:40.000000000 +0530 ++++ vosk-api-0.3.45/src/Makefile 2024-07-31 15:45:47.999776381 +0530 +@@ -6,7 +6,7 @@ + CUDA_ROOT?=/usr/local/cuda + USE_SHARED?=0 + # Math libraries +-HAVE_OPENBLAS_CLAPACK?=1 ++HAVE_OPENBLAS_NO_F2C?=0 + HAVE_MKL?=0 + HAVE_ACCELERATE=0 + HAVE_CUDA?=0 +@@ -80,6 +80,18 @@ + endif + endif + ++ifeq ($(HAVE_OPENBLAS_NO_F2C), 1) ++ CFLAGS += -I$(OPENBLAS_ROOT)/include ++ ifeq ($(USE_SHARED), 0) ++ LIBS += \ ++ $(OPENBLAS_ROOT)/lib/libopenblas.a \ ++ $(OPENBLAS_ROOT)/lib/liblapack.a \ ++ $(OPENBLAS_ROOT)/lib/libblas.a ++ else ++ LDFLAGS += -lopenblas -llapack -lblas ++ endif ++endif ++ + ifeq ($(HAVE_MKL), 1) + CFLAGS += -DHAVE_MKL=1 -I$(MKL_ROOT)/include + LDFLAGS += -L$(MKL_ROOT)/lib/intel64 -Wl,-rpath=$(MKL_ROOT)/lib/intel64 -lmkl_rt -lmkl_intel_lp64 -lmkl_core -lmkl_sequential diff --git a/vosk-lib_fst.patch b/vosk-lib_fst.patch new file mode 100644 index 0000000..705a8fa --- /dev/null +++ b/vosk-lib_fst.patch @@ -0,0 +1,14 @@ +diff -ur vosk-api-0.3.45.orig/src/Makefile vosk-api-0.3.45/src/Makefile +--- vosk-api-0.3.45.orig/src/Makefile 2022-12-14 22:28:40.000000000 +0530 ++++ vosk-api-0.3.45/src/Makefile 2024-07-31 20:39:57.170294213 +0530 +@@ -56,8 +56,8 @@ + $(KALDI_ROOT)/src/fstext/kaldi-fstext.a \ + $(KALDI_ROOT)/src/util/kaldi-util.a \ + $(KALDI_ROOT)/src/base/kaldi-base.a \ +- $(OPENFST_ROOT)/lib/libfst.a \ +- $(OPENFST_ROOT)/lib/libfstngram.a ++ $(OPENFST_ROOT)/lib/libfst.so \ ++ $(OPENFST_ROOT)/lib/libfstngram.so + else + LDFLAGS += \ + -L$(KALDI_ROOT)/libs \
arch-excludes@lists.fedoraproject.org