Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: libvosk-0.3.43
@ 2022-08-31 21:38 JohnGebbie
  2022-09-02  7:33 ` JohnGebbie
                   ` (132 more replies)
  0 siblings, 133 replies; 134+ messages in thread
From: JohnGebbie @ 2022-08-31 21:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1049 bytes --]

There is a new pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: libvosk-0.3.43
WORK IN PROGRESS

#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures:
	- x86_64-musL

The other architectures seem to have problems.

Vosk is a dependency of a program I'd like to package, but Vosk is the hard bit and I was wondering if this template using prebuilt binaries was acceptable.
Thank you.

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 1314 bytes --]

From de81b36f793e44ac70dcd8e0412f53cfaa40ac4c Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Wed, 31 Aug 2022 22:16:21 +0100
Subject: [PATCH] New package: libvosk-0.3.43

---
 srcpkgs/libvosk/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/libvosk/template

diff --git a/srcpkgs/libvosk/template b/srcpkgs/libvosk/template
new file mode 100644
index 000000000000..d50493f942e6
--- /dev/null
+++ b/srcpkgs/libvosk/template
@@ -0,0 +1,22 @@
+# Template file for 'libvosk'
+pkgname=libvosk
+version=0.3.43
+revision=1
+archs="aarch64 aarch64-musl armv7l armv7l-musl x86_64 x86_64-musl"
+wrksrc="vosk-linux-$(arch)-$version"
+short_desc="Offline speech recognition library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/releases/download/v$version/$wrksrc.zip"
+declare -A _sums=(
+[aarch64]=14acc86898e9430f0aff32207a45445761aabc48feca0e381c65c91db634414b
+[armv7l]=cf3dd76d8433a77840599a766039e31ba91df49e12285fa07f8892fff3ee3b4b
+[x86_64]=75a92b73507df4f7fa0746d16f9ba9266ad6656fdf02aab3c6d1e91aa7bb9803
+)
+checksum="${_sums[$(arch)]}"
+
+do_install() {
+	vinstall libvosk.so 644 usr/lib
+	vinstall vosk_api.h 644 usr/include
+}

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: libvosk-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
@ 2022-09-02  7:33 ` JohnGebbie
  2022-09-02  9:01 ` JohnGebbie
                   ` (131 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-02  7:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1235168599

Comment:
I'm guessing my template's no good, and I'm trying to write one that does all the compiling.

Vosk has a bunch of dependencies that have been modified for itself and wouldn't make packages of their own.
How do I write a template with multiple things to build?
What happens with multiple distfiles, when I `ls` in the template, it just seems to be the files of one of them?
Can you have multiple buid_styles?


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: libvosk-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
  2022-09-02  7:33 ` JohnGebbie
@ 2022-09-02  9:01 ` JohnGebbie
  2022-09-02 18:59 ` JohnGebbie
                   ` (130 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-02  9:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1235168599

Comment:
I'm guessing my template's no good, and I'm trying to write one that does all the compiling.

Vosk has a bunch of dependencies that have been modified for itself and wouldn't make packages of their own.
How do I write a template with multiple things to build?
How do multiple distfiles work with build_styles, the order of the distfiles doesn't seem to make a difference?


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: libvosk-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
  2022-09-02  7:33 ` JohnGebbie
  2022-09-02  9:01 ` JohnGebbie
@ 2022-09-02 18:59 ` JohnGebbie
  2022-09-03 12:04 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (129 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-02 18:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 522 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1235168599

Comment:
I'm guessing my template's no good, and I'm trying to write one that does all the compiling.

Vosk has a bunch of dependencies that have been modified for itself and wouldn't make packages of their own.
How do I write a template with multiple things to build?
How do multiple distfiles work with build_styles, the order of the distfiles doesn't seem to make a difference?


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: libvosk-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (2 preceding siblings ...)
  2022-09-02 18:59 ` JohnGebbie
@ 2022-09-03 12:04 ` JohnGebbie
  2022-09-03 12:11 ` New package: vosk-api-0.3.43 JohnGebbie
                   ` (128 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 12:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: libvosk-0.3.43
WORK IN PROGRESS

#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures:
	- x86_64-musL

The other architectures seem to have problems.

Vosk is a dependency of a program I'd like to package, but Vosk is the hard bit and I was wondering if this template using prebuilt binaries was acceptable.
Thank you.

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 3414 bytes --]

From 1a7d477b5268eecbc8e9abd1f33820a0957dd721 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/template | 67 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 srcpkgs/vosk-api/template

diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..58c904f13232
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,67 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/xianyi/OpenBLAS/archive/v${_openblas_ver}/openblas-${_openblas_ver}.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8495c9affc536253648e942908e88e097f2ec7753ede55aca52e5dead3029e3c
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a"
+
+pre_build() {
+	cd "$XBPS_BUILDDIR"
+	ln -sf "../../OpenBLAS-${_openblas_ver}" "kaldi-${_kaldi_commit}/tools/OpenBLAS"
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	make -C "OpenBLAS-${_openblas_ver}" ONLY_CBLAS=1 DYNAMIC_ARCH=1 TARGET=NEHALEM USE_LOCKING=1 USE_THREAD=0 all
+	make -C "OpenBLAS-${_openblas_ver}" PREFIX="${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install" install
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (3 preceding siblings ...)
  2022-09-03 12:04 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-03 12:11 ` JohnGebbie
  2022-09-03 14:11 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (127 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 12:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236107476

Comment:
I think that's it there, except I'll try to update it to use the openblas package.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (4 preceding siblings ...)
  2022-09-03 12:11 ` New package: vosk-api-0.3.43 JohnGebbie
@ 2022-09-03 14:11 ` JohnGebbie
  2022-09-03 14:12 ` JohnGebbie
                   ` (126 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 14:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 3414 bytes --]

From b6e25c23770ef8531b4d5d3b25ac19f39c5820df Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/template | 67 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 srcpkgs/vosk-api/template

diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..58c904f13232
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,67 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/xianyi/OpenBLAS/archive/v${_openblas_ver}/openblas-${_openblas_ver}.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8495c9affc536253648e942908e88e097f2ec7753ede55aca52e5dead3029e3c
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a"
+
+pre_build() {
+	cd "$XBPS_BUILDDIR"
+	ln -sf "../../OpenBLAS-${_openblas_ver}" "kaldi-${_kaldi_commit}/tools/OpenBLAS"
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	make -C "OpenBLAS-${_openblas_ver}" ONLY_CBLAS=1 DYNAMIC_ARCH=1 TARGET=NEHALEM USE_LOCKING=1 USE_THREAD=0 all
+	make -C "OpenBLAS-${_openblas_ver}" PREFIX="${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install" install
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (5 preceding siblings ...)
  2022-09-03 14:11 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-03 14:12 ` JohnGebbie
  2022-09-03 14:13 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (125 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 14:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236128112

Comment:
That's it ready.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (6 preceding siblings ...)
  2022-09-03 14:12 ` JohnGebbie
@ 2022-09-03 14:13 ` JohnGebbie
  2022-09-03 14:14 ` JohnGebbie
                   ` (124 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 14:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 3496 bytes --]

From 74ec7888caf6191050e0880a8f5e3afef097c8d9 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/template | 69 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 srcpkgs/vosk-api/template

diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..998bace88dd1
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,69 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/xianyi/OpenBLAS/archive/v${_openblas_ver}/openblas-${_openblas_ver}.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8495c9affc536253648e942908e88e097f2ec7753ede55aca52e5dead3029e3c
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a"
+
+# I tried using the openblas package (version 0.3.21) but it was incompatible.
+
+pre_build() {
+	cd "$XBPS_BUILDDIR"
+	ln -sf "../../OpenBLAS-${_openblas_ver}" "kaldi-${_kaldi_commit}/tools/OpenBLAS"
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	make -C "OpenBLAS-${_openblas_ver}" ONLY_CBLAS=1 DYNAMIC_ARCH=1 TARGET=NEHALEM USE_LOCKING=1 USE_THREAD=0 all
+	make -C "OpenBLAS-${_openblas_ver}" PREFIX="${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install" install
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (7 preceding siblings ...)
  2022-09-03 14:13 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-03 14:14 ` JohnGebbie
  2022-09-03 14:14 ` JohnGebbie
                   ` (123 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 14:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236128364

Comment:
That's it ready.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (8 preceding siblings ...)
  2022-09-03 14:14 ` JohnGebbie
@ 2022-09-03 14:14 ` JohnGebbie
  2022-09-03 20:52 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (122 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 14:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236128112

Comment:
That's it ready.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (9 preceding siblings ...)
  2022-09-03 14:14 ` JohnGebbie
@ 2022-09-03 20:52 ` JohnGebbie
  2022-09-04  8:26 ` JohnGebbie
                   ` (121 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-03 20:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 4204 bytes --]

From 9df768c9fdd3f04276e23e765bed26c0e7a71041 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/template      | 79 ++++++++++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us |  1 +
 2 files changed, 80 insertions(+)
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..99c712e74194
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/xianyi/OpenBLAS/archive/v${_openblas_ver}/openblas-${_openblas_ver}.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8495c9affc536253648e942908e88e097f2ec7753ede55aca52e5dead3029e3c
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+
+# I tried using the openblas package (version 0.3.21) but it was incompatible.
+
+pre_build() {
+	cd "$XBPS_BUILDDIR"
+	ln -sf "../../OpenBLAS-${_openblas_ver}" "kaldi-${_kaldi_commit}/tools/OpenBLAS"
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	make -C "OpenBLAS-${_openblas_ver}" ONLY_CBLAS=1 DYNAMIC_ARCH=1 TARGET=NEHALEM USE_LOCKING=1 USE_THREAD=0 all
+	make -C "OpenBLAS-${_openblas_ver}" PREFIX="${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install" install
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/OpenBLAS-${_openblas_ver}/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${XBPS_BUILDDIR}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (10 preceding siblings ...)
  2022-09-03 20:52 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-04  8:26 ` JohnGebbie
  2022-09-17 13:05 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (120 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-04  8:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236287727

Comment:
I'll work on the other architectures but do you know why the top one failed at the "Compare to previous" step?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (11 preceding siblings ...)
  2022-09-04  8:26 ` JohnGebbie
@ 2022-09-17 13:05 ` JohnGebbie
  2022-09-17 13:09 ` JohnGebbie
                   ` (119 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-17 13:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7204 bytes --]

From 117a6c59102045d0250183fb4d947817617d9f2d Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++++
 srcpkgs/vosk-api/template              | 78 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 134 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..e74d7f4214b0
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,78 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 ../kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+pre_build() {
+	cd "${XBPS_BUILDDIR}"
+
+	mkdir -p "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${XBPS_BUILDDIR}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (12 preceding siblings ...)
  2022-09-17 13:05 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-17 13:09 ` JohnGebbie
  2022-09-18 11:00 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (118 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-17 13:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1250068342

Comment:
That's it working with the `openblas-devel` package. I still need to work on the other architectures.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (13 preceding siblings ...)
  2022-09-17 13:09 ` JohnGebbie
@ 2022-09-18 11:00 ` JohnGebbie
  2022-09-21 15:53 ` JohnGebbie
                   ` (117 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-18 11:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7289 bytes --]

From a893804c96c45f342a16b36387d7b8fada9b83a4 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++++
 srcpkgs/vosk-api/template              | 79 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 135 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..cf04e6052752
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 ../kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+pre_build() {
+	cd "${XBPS_BUILDDIR}"
+
+	mkdir -p "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libopenblas.so "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${XBPS_BUILDDIR}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (14 preceding siblings ...)
  2022-09-18 11:00 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-21 15:53 ` JohnGebbie
  2022-09-22  8:53 ` JohnGebbie
                   ` (116 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-21 15:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7289 bytes --]

From 66e1722fe1a806c10c2a653b34766813427c742e Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++++
 srcpkgs/vosk-api/template              | 79 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 135 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..cf04e6052752
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1
+build_style="gnu-makefile"
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/clapack/archive/v${_clapack_ver}/clapack-${_clapack_ver}.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+8d8ff8259454cae392bb58bc4971fef1db632c9fb5cdf61255cd495bd6d6ac4d
+4f50b51d0596970b0c1e1356c6a3e791810d1fbc75f2024cd30e818b7b299382
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 ../kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+pre_build() {
+	cd "${XBPS_BUILDDIR}"
+
+	mkdir -p "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libopenblas.so "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+
+	ln -sf "../../clapack-${_clapack_ver}" "kaldi-${_kaldi_commit}/tools/clapack"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+	autoreconf -fi "openfst-${_openfst_commit}"
+
+	cmake -S "clapack-${_clapack_ver}" -B "build-clapack-${_clapack_ver}"
+	make -C "build-clapack-${_clapack_ver}/F2CLIBS"
+	make -C "build-clapack-${_clapack_ver}/BLAS"
+	make -C "build-clapack-${_clapack_ver}/SRC"
+	find "build-clapack-${_clapack_ver}" -name "*.a" | xargs cp -t "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${XBPS_BUILDDIR}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (15 preceding siblings ...)
  2022-09-21 15:53 ` JohnGebbie
@ 2022-09-22  8:53 ` JohnGebbie
  2022-09-22  9:26 ` [PR REVIEW] " paper42
                   ` (115 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22  8:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7086 bytes --]

From a799e90b8f30af4c1deb7047d7958716cbc36bd4 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++++
 srcpkgs/vosk-api/template              | 78 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 134 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..fb57c2c975f9
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,78 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-configure
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 ../kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${XBPS_BUILDDIR}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${XBPS_BUILDDIR}"
+	mkdir -p "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libopenblas.so "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/liblapack.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${XBPS_BUILDDIR}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (17 preceding siblings ...)
  2022-09-22  9:26 ` [PR REVIEW] " paper42
@ 2022-09-22  9:26 ` paper42
  2022-09-22 14:39 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (113 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-09-22  9:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r977419127

Comment:
could it work with system packages?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (16 preceding siblings ...)
  2022-09-22  8:53 ` JohnGebbie
@ 2022-09-22  9:26 ` paper42
  2022-09-22  9:26 ` paper42
                   ` (114 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-09-22  9:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r977420046

Comment:
use create_wrksrc to contain all of the extracted distfiles in one directory and fix cleaning

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (18 preceding siblings ...)
  2022-09-22  9:26 ` paper42
@ 2022-09-22 14:39 ` JohnGebbie
  2022-09-22 14:43 ` JohnGebbie
                   ` (112 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 14:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7086 bytes --]

From 027aa90d1a69d1eb571c4e42d87218f49c4c883b Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++++
 srcpkgs/vosk-api/template              | 78 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 134 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..fb57c2c975f9
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,78 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+_openblas_ver=0.3.20
+_clapack_ver=3.2.1
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-configure
+make_use_env=yes
+make_build_args="-C src KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 ../kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${XBPS_BUILDDIR}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${XBPS_BUILDDIR}"
+	mkdir -p "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libopenblas.so "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/liblapack.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libblas.a "kaldi-${_kaldi_commit}/tools/OpenBLAS/install/lib"
+	ln -sf "../../openfst-${_openfst_commit}" "kaldi-${_kaldi_commit}/tools/openfst"
+
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${XBPS_BUILDDIR}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${XBPS_BUILDDIR}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${XBPS_BUILDDIR}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (19 preceding siblings ...)
  2022-09-22 14:39 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-22 14:43 ` JohnGebbie
  2022-09-22 15:19 ` [PR REVIEW] " JohnGebbie
                   ` (111 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 14:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 6929 bytes --]

From 5d31a66849149474921b4f801201fde932f7c8ba Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++++
 srcpkgs/vosk-api/template              | 79 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 135 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..625dbcdc9854
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p "tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libopenblas.so "tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/liblapack.a "tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libblas.a "tools/OpenBLAS/install/lib"
+	ln -sf "../../openfst-${_openfst_commit}" "tools/openfst"
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	./configure --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall src/vosk_api.h 644 usr/include
+	vinstall src/libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (20 preceding siblings ...)
  2022-09-22 14:43 ` JohnGebbie
@ 2022-09-22 15:19 ` JohnGebbie
  2022-09-22 18:16 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (110 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 15:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 486 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r977789547

Comment:
Thanks paper42.
I'd forgotten to remove the openblas and clapack variables, which have been replaced with system packages.
The version of kaldi is vosk specific so I think it's best as it is.
I tried packaging openfst separately but the newer version wasn't compatible (and there's vosk specific changes but I didn't get that far).


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (21 preceding siblings ...)
  2022-09-22 15:19 ` [PR REVIEW] " JohnGebbie
@ 2022-09-22 18:16 ` JohnGebbie
  2022-09-22 19:32 ` JohnGebbie
                   ` (109 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 18:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7060 bytes --]

From fdc9a88fd8a78fddfbb20c4700fd0091afb9a824 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++++
 srcpkgs/vosk-api/template              | 81 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 137 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..88d7c79bb8be
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,81 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p "tools/OpenBLAS/install/lib"
+	ln -sf /usr/include/openblas "tools/OpenBLAS/install/include"
+	ln -sf /usr/lib/libopenblas.a "tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libopenblas.so "tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/liblapack.a "tools/OpenBLAS/install/lib"
+	ln -sf /usr/lib/libblas.a "tools/OpenBLAS/install/lib"
+	ln -sf "../../openfst-${_openfst_commit}" "tools/openfst"
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (22 preceding siblings ...)
  2022-09-22 18:16 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-22 19:32 ` JohnGebbie
  2022-09-22 19:38 ` JohnGebbie
                   ` (108 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 19:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1255462689

Comment:
It works for x86_64, but for aarch64 Kaldi errors saying there's no libopenblas.so.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (23 preceding siblings ...)
  2022-09-22 19:32 ` JohnGebbie
@ 2022-09-22 19:38 ` JohnGebbie
  2022-09-22 20:31 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (107 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 19:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1255462689

Comment:
It works for x86_64, but for aarch64 Kaldi errors saying there's no libopenblas.so. I think it needs $xbps_cross_base.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (24 preceding siblings ...)
  2022-09-22 19:38 ` JohnGebbie
@ 2022-09-22 20:31 ` JohnGebbie
  2022-09-22 20:33 ` JohnGebbie
                   ` (106 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 20:31 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7190 bytes --]

From ee2aaf84f043eb6b80adee584b46ab5b27e19a93 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++++
 srcpkgs/vosk-api/template              | 82 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 138 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..0245a98d3fdc
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,82 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (25 preceding siblings ...)
  2022-09-22 20:31 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-22 20:33 ` JohnGebbie
  2022-09-22 20:50 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (105 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 20:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1255520427

Comment:
I think that's it :)

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (26 preceding siblings ...)
  2022-09-22 20:33 ` JohnGebbie
@ 2022-09-22 20:50 ` JohnGebbie
  2022-09-22 20:50 ` JohnGebbie
                   ` (104 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 20:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7420 bytes --]

From b3673cfa4b84ebd95f41bbaa2b40d02fb230a38e Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++
 srcpkgs/vosk-api/template              | 90 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 146 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..37582c552de6
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,90 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v$version/vosk-api-$version.tar.gz
+https://github.com/alphacep/kaldi/archive/$_kaldi_commit.tar.gz
+https://github.com/alphacep/openfst/archive/$_openfst_commit.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${PKGDESTDIR}/usr/share/vosk-models/small-en-us" model
+	ln -sf ../python/example/test.wav .
+	make
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (27 preceding siblings ...)
  2022-09-22 20:50 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-22 20:50 ` JohnGebbie
  2022-09-23  8:55 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (103 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-22 20:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1255535690

Comment:
Added do_check().

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (28 preceding siblings ...)
  2022-09-22 20:50 ` JohnGebbie
@ 2022-09-23  8:55 ` JohnGebbie
  2022-09-23  9:14 ` JohnGebbie
                   ` (102 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-23  8:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7442 bytes --]

From cba751405788444782072bae34e3114310723b99 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 ++++++++++++++++
 srcpkgs/vosk-api/template              | 90 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 146 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..2a99ada6c54e
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,90 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${PKGDESTDIR}/usr/share/vosk-models/small-en-us" model
+	ln -sf ../python/example/test.wav .
+	make
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (29 preceding siblings ...)
  2022-09-23  8:55 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-23  9:14 ` JohnGebbie
  2022-09-23 11:30 ` JohnGebbie
                   ` (101 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-23  9:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7524 bytes --]

From 44e2fd907ad5ba47bcacac5652f693e149533196 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 94 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 150 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..f253309faf28
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,94 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${PKGDESTDIR}/usr/share/vosk-models/small-en-us" model
+	ln -sf ../python/example/test.wav .
+	make
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (30 preceding siblings ...)
  2022-09-23  9:14 ` JohnGebbie
@ 2022-09-23 11:30 ` JohnGebbie
  2022-09-23 17:21 ` JohnGebbie
                   ` (100 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-23 11:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1256096727

Comment:
That should work.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (31 preceding siblings ...)
  2022-09-23 11:30 ` JohnGebbie
@ 2022-09-23 17:21 ` JohnGebbie
  2022-09-23 18:23 ` JohnGebbie
                   ` (99 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-23 17:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 162 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1256096727

Comment:
That should work.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (32 preceding siblings ...)
  2022-09-23 17:21 ` JohnGebbie
@ 2022-09-23 18:23 ` JohnGebbie
  2022-09-26 22:16 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (98 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-23 18:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1256533493

Comment:
I think it's ready. I've tested x86_64, i686 and aarch64-musl.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (33 preceding siblings ...)
  2022-09-23 18:23 ` JohnGebbie
@ 2022-09-26 22:16 ` JohnGebbie
  2022-09-26 22:18 ` JohnGebbie
                   ` (97 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-26 22:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7524 bytes --]

From c50b92266b78934dc56ecef02271df7200bf3c95 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 94 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 150 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..f253309faf28
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,94 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${PKGDESTDIR}/usr/share/vosk-models/small-en-us" model
+	ln -sf ../python/example/test.wav .
+	make
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (34 preceding siblings ...)
  2022-09-26 22:16 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-26 22:18 ` JohnGebbie
  2022-09-28 15:44 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (96 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-26 22:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1258701987

Comment:
just git pulling it up to date.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (35 preceding siblings ...)
  2022-09-26 22:18 ` JohnGebbie
@ 2022-09-28 15:44 ` JohnGebbie
  2022-09-28 15:44 ` JohnGebbie
                   ` (95 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-28 15:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7622 bytes --]

From ddd775fafa173ceec2e68828d0b6e5fdda5604ba Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 94 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 150 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..abb51e8a8c49
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,94 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	CXXFLAGS="$CXXFLAGS -msse -mfpmath=sse" ./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (36 preceding siblings ...)
  2022-09-28 15:44 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-28 15:44 ` JohnGebbie
  2022-09-28 15:53 ` JohnGebbie
                   ` (94 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-28 15:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7622 bytes --]

From 45d8d9848bb407eabc3889365bb192ff1c4da1e1 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 94 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 150 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..abb51e8a8c49
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,94 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	CXXFLAGS="$CXXFLAGS -msse -mfpmath=sse" ./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (37 preceding siblings ...)
  2022-09-28 15:44 ` JohnGebbie
@ 2022-09-28 15:53 ` JohnGebbie
  2022-09-29 20:24 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (93 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-28 15:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1261115117

Comment:
I added the compile options the i686 ci mentioned it's error message, and it worked on my machine but it did before too. I also added a fix in do_check for x86_64, I didn't clean and recompile but `./xbps-src check` worked, so I hope it works.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (38 preceding siblings ...)
  2022-09-28 15:53 ` JohnGebbie
@ 2022-09-29 20:24 ` JohnGebbie
  2022-09-29 20:30 ` JohnGebbie
                   ` (92 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-29 20:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7613 bytes --]

From b157fdf48450d811d9c7250cd20c7b3de15a4246 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 95 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 151 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..0e9bcad08910
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,95 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (39 preceding siblings ...)
  2022-09-29 20:24 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-29 20:30 ` JohnGebbie
  2022-09-30  9:15 ` JohnGebbie
                   ` (91 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-29 20:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1262782111

Comment:
Pushed a fix. I think the problem was the lack of --build and maybe why it only worked on my machine. openfst piled for i686 and x86_64.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (40 preceding siblings ...)
  2022-09-29 20:30 ` JohnGebbie
@ 2022-09-30  9:15 ` JohnGebbie
  2022-09-30 14:27 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (90 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30  9:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263321681

Comment:
Could i get a run of i686 please?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (41 preceding siblings ...)
  2022-09-30  9:15 ` JohnGebbie
@ 2022-09-30 14:27 ` JohnGebbie
  2022-09-30 14:27 ` JohnGebbie
                   ` (89 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 14:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7643 bytes --]

From 5c226ddf468b6be329d62de571ad0e5c9c67b7ac Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 96 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 152 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..93d6fe83bd92
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,96 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (42 preceding siblings ...)
  2022-09-30 14:27 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-30 14:27 ` JohnGebbie
  2022-09-30 14:30 ` JohnGebbie
                   ` (88 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 14:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7643 bytes --]

From 7ec701619095cf63eef7b6a21b98a5ee36c2d8d3 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff | 55 +++++++++++++++
 srcpkgs/vosk-api/template              | 96 ++++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |  1 +
 3 files changed, 152 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..93d6fe83bd92
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,96 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (43 preceding siblings ...)
  2022-09-30 14:27 ` JohnGebbie
@ 2022-09-30 14:30 ` JohnGebbie
  2022-09-30 19:14 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (87 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 14:30 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263652019

Comment:
I added --host="${XBPS_TRIPLET}" for when not cross compiling. i686 is still cross compiling successfully on my machine. I also git pulled to to update my branch.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (44 preceding siblings ...)
  2022-09-30 14:30 ` JohnGebbie
@ 2022-09-30 19:14 ` JohnGebbie
  2022-09-30 19:21 ` JohnGebbie
                   ` (86 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 19:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7825 bytes --]

From e3ea943d8444e153d306bf669d840efe6e5f24d4 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff |  55 ++++++++++++++
 srcpkgs/vosk-api/template              | 101 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 3 files changed, 157 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..d726662558de
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,101 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}"
+	autoreconf -fi "openfst-${_openfst_commit}"
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (45 preceding siblings ...)
  2022-09-30 19:14 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-30 19:21 ` JohnGebbie
  2022-09-30 19:47 ` JohnGebbie
                   ` (85 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 19:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263933045

Comment:
I pushed stopping it running tests in the configure phase when natively compiling and added -lexecinfo in do_check for musl.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (46 preceding siblings ...)
  2022-09-30 19:21 ` JohnGebbie
@ 2022-09-30 19:47 ` JohnGebbie
  2022-09-30 19:54 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (84 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 19:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263957955

Comment:
wait I made a mistake.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (47 preceding siblings ...)
  2022-09-30 19:47 ` JohnGebbie
@ 2022-09-30 19:54 ` JohnGebbie
  2022-09-30 21:15 ` JohnGebbie
                   ` (83 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 19:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7866 bytes --]

From 70595db207648605e41b43880d55e80bb27a9436 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 102 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 3 files changed, 158 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..44c6ca6fd0b8
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,102 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (48 preceding siblings ...)
  2022-09-30 19:54 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-09-30 21:15 ` JohnGebbie
  2022-10-01 10:26 ` JohnGebbie
                   ` (82 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-09-30 21:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1264030325

Comment:
Ok hopefully it passes the ci. i686 cross compiled on mine.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (49 preceding siblings ...)
  2022-09-30 21:15 ` JohnGebbie
@ 2022-10-01 10:26 ` JohnGebbie
  2022-10-02 16:27 ` JohnGebbie
                   ` (81 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-01 10:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1264319645

Comment:
Could we try the ci again? seems there was just a problem fetching a distfile.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (50 preceding siblings ...)
  2022-10-01 10:26 ` JohnGebbie
@ 2022-10-02 16:27 ` JohnGebbie
  2022-10-03 11:19 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (80 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-02 16:27 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1264681508

Comment:
Could I get the tests run please

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (51 preceding siblings ...)
  2022-10-02 16:27 ` JohnGebbie
@ 2022-10-03 11:19 ` JohnGebbie
  2022-10-03 11:21 ` JohnGebbie
                   ` (79 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-03 11:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **briefly**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7866 bytes --]

From 496076d3822c4d2df208f7bc21c939a03b652ab7 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 102 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 3 files changed, 158 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..44c6ca6fd0b8
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,102 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (52 preceding siblings ...)
  2022-10-03 11:19 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-03 11:21 ` JohnGebbie
  2022-10-03 12:39 ` JohnGebbie
                   ` (78 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-03 11:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1265295079

Comment:
just git pulled my branch up to date, still ready

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (53 preceding siblings ...)
  2022-10-03 11:21 ` JohnGebbie
@ 2022-10-03 12:39 ` JohnGebbie
  2022-10-04 19:17 ` JohnGebbie
                   ` (77 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-03 12:39 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1264681508

Comment:
Could I get the tests run please

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (54 preceding siblings ...)
  2022-10-03 12:39 ` JohnGebbie
@ 2022-10-04 19:17 ` JohnGebbie
  2022-10-08 12:13 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (76 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-04 19:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1267471129

Comment:
I think I should have added the .so to common/shlibs.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (55 preceding siblings ...)
  2022-10-04 19:17 ` JohnGebbie
@ 2022-10-08 12:13 ` JohnGebbie
  2022-10-08 12:15 ` JohnGebbie
                   ` (75 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 12:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 7866 bytes --]

From 36aff60f711932824350833d5ea64a338e006914 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 102 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 3 files changed, 158 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..44c6ca6fd0b8
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,102 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (56 preceding siblings ...)
  2022-10-08 12:13 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-08 12:15 ` JohnGebbie
  2022-10-08 12:21 ` JohnGebbie
                   ` (74 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 12:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8317 bytes --]

From fea3be13a4f353379030663b3027c5b083470432 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                          |   1 +
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 102 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 4 files changed, 159 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 57ab76436664..e701f569b112 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4184,3 +4184,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so.0 vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..44c6ca6fd0b8
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,102 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (57 preceding siblings ...)
  2022-10-08 12:15 ` JohnGebbie
@ 2022-10-08 12:21 ` JohnGebbie
  2022-10-08 14:32 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (73 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 12:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272306511

Comment:
All I just did was update the branch and add the SONAME to common/shlibs.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (58 preceding siblings ...)
  2022-10-08 12:21 ` JohnGebbie
@ 2022-10-08 14:32 ` JohnGebbie
  2022-10-08 15:52 ` JohnGebbie
                   ` (72 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 14:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8315 bytes --]

From 84c85c4d6893a3d6dbf7eb183faa034ece8c9e62 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                          |   1 +
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 102 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 4 files changed, 159 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 57ab76436664..c726363b8a72 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4184,3 +4184,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..44c6ca6fd0b8
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,102 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (59 preceding siblings ...)
  2022-10-08 14:32 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-08 15:52 ` JohnGebbie
  2022-10-08 16:24 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (71 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 15:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272346828

Comment:
Still a work in progress, for some reason `./xbps-src show-shlib-provides vosk-api` prints nothing.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (60 preceding siblings ...)
  2022-10-08 15:52 ` JohnGebbie
@ 2022-10-08 16:24 ` JohnGebbie
  2022-10-08 16:25 ` JohnGebbie
                   ` (70 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 16:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8315 bytes --]

From 535762fb6d874d3608f116b92f1e34c0f0e3a216 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                          |   1 +
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 102 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 4 files changed, 159 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 57ab76436664..c726363b8a72 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4184,3 +4184,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..44c6ca6fd0b8
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,102 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (61 preceding siblings ...)
  2022-10-08 16:24 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-08 16:25 ` JohnGebbie
  2022-10-08 16:33 ` JohnGebbie
                   ` (69 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 16:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8344 bytes --]

From a27ce9ef655c0fcfd55689937355166690c2563a Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                          |   1 +
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 103 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 4 files changed, 160 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 57ab76436664..c726363b8a72 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4184,3 +4184,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..ff64f8229a1c
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,103 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (62 preceding siblings ...)
  2022-10-08 16:25 ` JohnGebbie
@ 2022-10-08 16:33 ` JohnGebbie
  2022-10-09 10:37 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (68 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-08 16:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272354057

Comment:
The reason was `objdump -p libvosk.so` doesn't have SONAME so the hook ignores it, so I've added `shlib_provides="libvosk.so"`. The package should be ready, I'll try to use it for my program and report back.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (63 preceding siblings ...)
  2022-10-08 16:33 ` JohnGebbie
@ 2022-10-09 10:37 ` JohnGebbie
  2022-10-09 10:38 ` JohnGebbie
                   ` (67 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-09 10:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8438 bytes --]

From a82bf917d3c3f484348b1932a2e1b0558f7528c7 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                          |   1 +
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 106 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 4 files changed, 163 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 57ab76436664..c726363b8a72 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4184,3 +4184,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..7eca6df5329d
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,106 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't run tests during install.
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+
+	# Don't need Fortan to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (64 preceding siblings ...)
  2022-10-09 10:37 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-09 10:38 ` JohnGebbie
  2022-10-09 10:46 ` JohnGebbie
                   ` (66 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-09 10:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8439 bytes --]

From b8c592af906b4c874348ecc4262b49b1fa6ed2cc Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                          |   1 +
 srcpkgs/vosk-api/patches/openblas.diff |  55 +++++++++++++
 srcpkgs/vosk-api/template              | 106 +++++++++++++++++++++++++
 srcpkgs/vosk-model-small-en-us         |   1 +
 4 files changed, 163 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas.diff
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 57ab76436664..c726363b8a72 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4184,3 +4184,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas.diff b/srcpkgs/vosk-api/patches/openblas.diff
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas.diff
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..95e2113dc9cb
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,106 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't run tests during install.
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		make LDFLAGS="-lexecinfo -fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	else
+		make LDFLAGS="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	fi
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (65 preceding siblings ...)
  2022-10-09 10:38 ` JohnGebbie
@ 2022-10-09 10:46 ` JohnGebbie
  2022-10-26 15:57 ` JohnGebbie
                   ` (65 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-09 10:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272513791

Comment:
I've tested this with my program https://github.com/void-linux/void-packages/pull/39716 and it's working well (I'm using it to type this!). I'm happy with the template and think it's ready.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (66 preceding siblings ...)
  2022-10-09 10:46 ` JohnGebbie
@ 2022-10-26 15:57 ` JohnGebbie
  2022-10-26 15:57 ` JohnGebbie
                   ` (64 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236107476

Comment:
I think that's it there, except I'll try to update it to use the openblas package.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (67 preceding siblings ...)
  2022-10-26 15:57 ` JohnGebbie
@ 2022-10-26 15:57 ` JohnGebbie
  2022-10-26 15:57 ` JohnGebbie
                   ` (63 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236128364

Comment:
That's it ready.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (68 preceding siblings ...)
  2022-10-26 15:57 ` JohnGebbie
@ 2022-10-26 15:57 ` JohnGebbie
  2022-10-26 15:58 ` JohnGebbie
                   ` (62 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 255 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1236287727

Comment:
I'll work on the other architectures but do you know why the top one failed at the "Compare to previous" step?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (69 preceding siblings ...)
  2022-10-26 15:57 ` JohnGebbie
@ 2022-10-26 15:58 ` JohnGebbie
  2022-10-26 15:58 ` JohnGebbie
                   ` (61 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1255462689

Comment:
It works for x86_64, but for aarch64 Kaldi errors saying there's no libopenblas.so. I think it needs $xbps_cross_base.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (70 preceding siblings ...)
  2022-10-26 15:58 ` JohnGebbie
@ 2022-10-26 15:58 ` JohnGebbie
  2022-10-26 15:58 ` JohnGebbie
                   ` (60 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1255520427

Comment:
I think that's it :)

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (71 preceding siblings ...)
  2022-10-26 15:58 ` JohnGebbie
@ 2022-10-26 15:58 ` JohnGebbie
  2022-10-26 15:59 ` JohnGebbie
                   ` (59 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1258701987

Comment:
just git pulling it up to date.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (72 preceding siblings ...)
  2022-10-26 15:58 ` JohnGebbie
@ 2022-10-26 15:59 ` JohnGebbie
  2022-10-26 15:59 ` JohnGebbie
                   ` (58 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1261115117

Comment:
I added the compile options the i686 ci mentioned it's error message, and it worked on my machine but it did before too. I also added a fix in do_check for x86_64, I didn't clean and recompile but `./xbps-src check` worked, so I hope it works.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (73 preceding siblings ...)
  2022-10-26 15:59 ` JohnGebbie
@ 2022-10-26 15:59 ` JohnGebbie
  2022-10-26 15:59 ` JohnGebbie
                   ` (57 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 178 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263321681

Comment:
Could i get a run of i686 please?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (74 preceding siblings ...)
  2022-10-26 15:59 ` JohnGebbie
@ 2022-10-26 15:59 ` JohnGebbie
  2022-10-26 16:00 ` JohnGebbie
                   ` (56 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 15:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263933045

Comment:
I pushed stopping it running tests in the configure phase when natively compiling and added -lexecinfo in do_check for musl.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (75 preceding siblings ...)
  2022-10-26 15:59 ` JohnGebbie
@ 2022-10-26 16:00 ` JohnGebbie
  2022-10-26 16:00 ` JohnGebbie
                   ` (55 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 16:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 167 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1263957955

Comment:
wait I made a mistake.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (76 preceding siblings ...)
  2022-10-26 16:00 ` JohnGebbie
@ 2022-10-26 16:00 ` JohnGebbie
  2022-10-26 16:00 ` JohnGebbie
                   ` (54 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 16:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1264030325

Comment:
Ok hopefully it passes the ci. i686 cross compiled on mine.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (77 preceding siblings ...)
  2022-10-26 16:00 ` JohnGebbie
@ 2022-10-26 16:00 ` JohnGebbie
  2022-10-26 16:01 ` JohnGebbie
                   ` (53 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 16:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1265295079

Comment:
just git pulled my branch up to date, still ready

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (78 preceding siblings ...)
  2022-10-26 16:00 ` JohnGebbie
@ 2022-10-26 16:01 ` JohnGebbie
  2022-10-27  9:59 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (52 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-26 16:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272306511

Comment:
All I just did was update the branch and add the SONAME to common/shlibs.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (79 preceding siblings ...)
  2022-10-26 16:01 ` JohnGebbie
@ 2022-10-27  9:59 ` JohnGebbie
  2022-10-27 10:18 ` JohnGebbie
                   ` (51 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-27  9:59 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 8538 bytes --]

From 80f9d0da49ba13efe6b12982ed87240d158df29a Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Sat, 3 Sep 2022 13:02:48 +0100
Subject: [PATCH] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../vosk-api/patches/openblas-to-0.3.21.patch |  55 +++++++++
 srcpkgs/vosk-api/template                     | 107 ++++++++++++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 4 files changed, 164 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 0ecf4f7437f7..22c0aaf3f876 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..6f3250aad0ba
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,107 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://github.com/alphacep/openfst/archive/${_openfst_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+a7bac90acb9a12fdfe50c240c9bb730a7bcb5c3b3ac32017c4d27177b059680a
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-Np1 kaldi-${_kaldi_commit}/src/matrix/cblas-wrappers.h"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+# The openfst required to build Kaldi for Vosk is an old and vendored version.
+# The Kaldi is also a slightly vendored version.
+
+post_extract() {
+	# Don't run tests during install.
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	vsed -i configure.ac -e '152,184 d'
+
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}"
+	mkdir -p tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" tools/OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libopenblas.so" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/liblapack.a" tools/OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/libblas.a" tools/OpenBLAS/install/lib
+	ln -sf "../../openfst-${_openfst_commit}" tools/openfst
+}
+
+pre_build() {
+	cd "${wrksrc}/openfst-${_openfst_commit}"
+	autoreconf -fi
+	./configure \
+		--host="${XBPS_TRIPLET}" \
+		${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} \
+		--build="${XBPS_TRIPLET}" \
+		--prefix="${wrksrc}/kaldi-${_kaldi_commit}/tools/openfst" \
+		--enable-static \
+		--enable-shared \
+		--enable-far \
+		--enable-ngram-fsts \
+		--enable-lookahead-fsts \
+		--with-pic \
+		--disable-bin
+	make
+	make install
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (80 preceding siblings ...)
  2022-10-27  9:59 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-27 10:18 ` JohnGebbie
  2022-10-27 21:37 ` JohnGebbie
                   ` (50 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-27 10:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272513791

Comment:
I've tested this with my program https://github.com/void-linux/void-packages/pull/39716 and it's working well (I'm using it to type this!). I'm happy with the template and think it's ready.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (81 preceding siblings ...)
  2022-10-27 10:18 ` JohnGebbie
@ 2022-10-27 21:37 ` JohnGebbie
  2022-10-28  8:33 ` JohnGebbie
                   ` (49 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-27 21:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1294094041

Comment:
Is there hope? I've tried to make it as nice as possible and I've got it using as many system packages for the dependencies as I could.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (82 preceding siblings ...)
  2022-10-27 21:37 ` JohnGebbie
@ 2022-10-28  8:33 ` JohnGebbie
  2022-10-28  9:43 ` JohnGebbie
                   ` (48 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28  8:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1272354057

Comment:
The reason was `objdump -p libvosk.so` doesn't have SONAME so the hook ignores it, so I've added `shlib_provides="libvosk.so"`. The package should be ready, I'll try to use it for my program and report back.

EDIT: works good!

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (83 preceding siblings ...)
  2022-10-28  8:33 ` JohnGebbie
@ 2022-10-28  9:43 ` JohnGebbie
  2022-10-28 17:01 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (47 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28  9:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1294777126

Comment:
I'm going to try again to get it working with the latest version of openfst, so openfst could be packaged separately.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (84 preceding siblings ...)
  2022-10-28  9:43 ` JohnGebbie
@ 2022-10-28 17:01 ` JohnGebbie
  2022-10-28 18:49 ` JohnGebbie
                   ` (46 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28 17:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 17866 bytes --]

From 283cf9c6c52f888ed89d0ef765d07e7216c69ad7 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 44 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..ee13b1c7241c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,44 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run tests during install.
+	vsed -i configure.ac -e '152,184 d'
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From e2df6928108183d238017a8f1d6747517df1a590 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-openblas-to-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-openfst-to-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  80 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 318 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..e35d7dd5a03c
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,80 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (85 preceding siblings ...)
  2022-10-28 17:01 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-10-28 18:49 ` JohnGebbie
  2022-10-28 20:15 ` JohnGebbie
                   ` (45 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28 18:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 17902 bytes --]

From f83fe20d85f5d12e908eb13fd9c8b8affc4c4c79 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 45 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..71710a3de294
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,45 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="automake texinfo"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run tests during install.
+	vsed -i configure.ac -e '152,184 d'
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From a0461d0dd2e919c8de2a2e53ba9cb7752fbb3b33 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-openblas-to-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-openfst-to-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  80 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 318 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..e35d7dd5a03c
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,80 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (86 preceding siblings ...)
  2022-10-28 18:49 ` JohnGebbie
@ 2022-10-28 20:15 ` JohnGebbie
  2022-10-28 20:45 ` JohnGebbie
                   ` (44 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28 20:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 17943 bytes --]

From 709e4a3d7a92f5a020622c0a680121de7da5c190 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 49 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..e7d3946323e8
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,49 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="automake texinfo"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run tests during install.
+	vsed -i configure.ac -e '152,184 d'
+}
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 94b77f89fd49a1327e5fc2feaf6e151217c10f53 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-openblas-to-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-openfst-to-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  80 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 318 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..e35d7dd5a03c
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,80 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+hostmakedepends="autoconf automake cmake libtool"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (87 preceding siblings ...)
  2022-10-28 20:15 ` JohnGebbie
@ 2022-10-28 20:45 ` JohnGebbie
  2022-10-28 21:42 ` JohnGebbie
                   ` (43 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28 20:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 17909 bytes --]

From b698fd2151ab026d9045907cd9299a29b0ea3943 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 49 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..b5b9fbdebf2b
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,49 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool texinfo"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run tests during install.
+	vsed -i configure.ac -e '152,184 d'
+}
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From d324784e941a4460398a2be42d5b0b8ddaa432e1 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-openblas-to-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-openfst-to-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  79 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 317 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..ecd601306c3b
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (88 preceding siblings ...)
  2022-10-28 20:45 ` JohnGebbie
@ 2022-10-28 21:42 ` JohnGebbie
  2022-10-29  8:41 ` JohnGebbie
                   ` (42 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-28 21:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 18002 bytes --]

From a1c676c0fabf355250e2bd9f51b2600ed8bb095e Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 51 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..816a909e7fec
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,51 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool texinfo"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run tests during install.
+	vsed -i configure.ac -e '152,184 d'
+	# Remove -msse check that breaks i686.
+	vsed -i src/include/fst/float-weight.h -e '120 d'
+}
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 17a60d4f0129a4aed03fa4653cbcfef385dd6a99 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-openblas-to-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-openfst-to-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  79 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 317 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..ecd601306c3b
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (89 preceding siblings ...)
  2022-10-28 21:42 ` JohnGebbie
@ 2022-10-29  8:41 ` JohnGebbie
  2022-10-29 11:45 ` JohnGebbie
                   ` (41 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-29  8:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 18091 bytes --]

From eb3cd2fb4318ec74684280f00dcad201d82cb86f Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 54 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..f1b571d4bd54
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,54 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool texinfo"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run test during build.
+	vsed -i configure.ac -e '152,184 d'
+	# Remove -msse check confused by cross compiling.
+	vsed -i src/include/fst/float-weight.h -e '120 d'
+}
+
+pre_configure() {
+	if [ "${XBPS_TARGET_MACHINE%%-musl}" = i686 ]; then
+		CXXFLAGS+=" -msse"
+	fi
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 81bdb74b7f0cc2ea0cd2bf551ddf8af45bc4e178 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-openblas-to-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-openfst-to-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  79 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 317 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openblas-to-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-openfst-to-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..ecd601306c3b
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (90 preceding siblings ...)
  2022-10-29  8:41 ` JohnGebbie
@ 2022-10-29 11:45 ` JohnGebbie
  2022-10-29 12:07 ` JohnGebbie
                   ` (40 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-29 11:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 18256 bytes --]

From 1f1d97fa8bb141763de491474e7f9206baf4a10e Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 59 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index c1b969e9d0b4..e34a7fce17ed 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4191,3 +4191,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..8d8da32dcbb4
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,59 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool texinfo"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+post_extract() {
+	# Don't run test during build.
+	vsed -i configure.ac -e '152,184 d'
+	# Remove -msse check confused by cross compiling.
+	vsed -i src/include/fst/float-weight.h -e '120 d'
+}
+
+pre_configure() {
+	if [ "${XBPS_TARGET_MACHINE%%-musl}" = i686 ]; then
+		CXXFLAGS+=" -msse"
+	fi
+	autoreconf -fi
+}
+
+pre_check() {
+	# Remove -msse test confused by cross compiling.
+	vsed -i src/test/Makefile.am -e '/check_PROGRAMS/ s/weight_test//; /weight_test_SOURCES/ d'
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" -- development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 3d846739edb520d23eb4e22bdf0e4e1e39cbb656 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  79 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 317 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index e34a7fce17ed..36bf4b749805 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4192,3 +4192,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..ecd601306c3b
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,79 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_openfst_commit=7dfd808194105162f20084bb4d8e4ee4b65266d5
+_kaldi_commit=6417ac1dece94783e80dfbac0148604685d27579
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}
+	OPENFST_ROOT=../../kaldi-${_kaldi_commit}/tools/openfst
+	OPENBLAS_ROOT=../../kaldi-${_kaldi_commit}/tools/OpenBLAS/install"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+4e5c08c9c61bbc995e0620321feb0973bb0321442f1bd8f08b47497f55efadda
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e '/libblas\.a \\/ {N; s/ \\.*//}'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmkdir usr/share/vosk-models
+		mv "${wrksrc}/vosk-model-small-en-us-0.15" "${PKGDESTDIR}/usr/share/vosk-models/small-en-us"
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (91 preceding siblings ...)
  2022-10-29 11:45 ` JohnGebbie
@ 2022-10-29 12:07 ` JohnGebbie
  2022-10-29 14:09 ` JohnGebbie
                   ` (39 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-29 12:07 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1294094041

Comment:
Is there hope? I've tried to make it as nice as possible and I've got it using as many system packages for the dependencies as I could.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (92 preceding siblings ...)
  2022-10-29 12:07 ` JohnGebbie
@ 2022-10-29 14:09 ` JohnGebbie
  2022-11-09 17:33 ` JohnGebbie
                   ` (38 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-10-29 14:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 169 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1295847711

Comment:
That's it ready to merge

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (93 preceding siblings ...)
  2022-10-29 14:09 ` JohnGebbie
@ 2022-11-09 17:33 ` JohnGebbie
  2022-11-14 22:54 ` [PR REVIEW] " paper42
                   ` (37 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-09 17:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 233 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1309102668

Comment:
what do you think @paper42?
here's a video of me using it: https://numen.johngebbie.com

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (94 preceding siblings ...)
  2022-11-09 17:33 ` JohnGebbie
@ 2022-11-14 22:54 ` paper42
  2022-11-14 22:54 ` paper42
                   ` (36 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022138995

Comment:
I don't see this used anywhere, is this here from when openfst was vendored in this package?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (97 preceding siblings ...)
  2022-11-14 22:54 ` paper42
@ 2022-11-14 22:54 ` paper42
  2022-11-14 22:54 ` paper42
                   ` (33 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 251 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022144996

Comment:
I would prefer this to be in `do_install()` and this subpackage's `pkg_install()` would just `vmove` it

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (95 preceding siblings ...)
  2022-11-14 22:54 ` [PR REVIEW] " paper42
@ 2022-11-14 22:54 ` paper42
  2022-11-14 22:54 ` paper42
                   ` (35 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 203 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022133758

Comment:
```suggestion
	short_desc+=" - development files"
```

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (100 preceding siblings ...)
  2022-11-14 22:54 ` paper42
@ 2022-11-14 22:54 ` paper42
  2022-11-15 11:04 ` JohnGebbie
                   ` (30 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022133016

Comment:
specifying which lines should be deleted is very fragile, I think a patch would be better.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (99 preceding siblings ...)
  2022-11-14 22:54 ` paper42
@ 2022-11-14 22:54 ` paper42
  2022-11-14 22:54 ` paper42
                   ` (31 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022141729

Comment:
Would it be possible to instead add  -I and -L to the build system?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (98 preceding siblings ...)
  2022-11-14 22:54 ` paper42
@ 2022-11-14 22:54 ` paper42
  2022-11-14 22:54 ` paper42
                   ` (32 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022143030

Comment:
This is $build_wrksrc, so I think this cd shouldn't be necessary, you should already be there. I might be wrong.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (96 preceding siblings ...)
  2022-11-14 22:54 ` paper42
@ 2022-11-14 22:54 ` paper42
  2022-11-14 22:54 ` paper42
                   ` (34 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-11-14 22:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022140625

Comment:
I think this should also be a patch.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (101 preceding siblings ...)
  2022-11-14 22:54 ` paper42
@ 2022-11-15 11:04 ` JohnGebbie
  2022-11-15 13:38 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (29 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-15 11:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 227 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1309102668

Comment:
what do you think @paper42?
here's a video of me using it: https://numenvoice.com

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (102 preceding siblings ...)
  2022-11-15 11:04 ` JohnGebbie
@ 2022-11-15 13:38 ` JohnGebbie
  2022-11-15 14:23 ` [PR REVIEW] " JohnGebbie
                   ` (28 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-15 13:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 17725 bytes --]

From 7a3fcf7712b1aa18629f75ed253b90e03fa256e1 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs            |  1 +
 srcpkgs/openfst-devel    |  1 +
 srcpkgs/openfst/template | 43 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 481250d5c924..7aaf659eff49 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4197,3 +4197,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..4a1206cc8d5b
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,43 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From a4275e13c5e3c580ed620a0ecb773ce02c776efd Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  77 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 315 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 7aaf659eff49..534041071d48 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4198,3 +4198,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..9000f6cd824a
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,77 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e 's:\$(OPENBLAS_ROOT)/lib/libf2c.a::'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (103 preceding siblings ...)
  2022-11-15 13:38 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-11-15 14:23 ` JohnGebbie
  2022-11-15 14:24 ` JohnGebbie
                   ` (27 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-15 14:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022850366

Comment:
I didn't make this into patches but I improved the second last vsed, making it explicit and less fragile.
I can still make it into patches if you'd prefer that.


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (104 preceding siblings ...)
  2022-11-15 14:23 ` [PR REVIEW] " JohnGebbie
@ 2022-11-15 14:24 ` JohnGebbie
  2022-11-15 14:44 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (26 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-15 14:24 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022851665

Comment:
I found the kaldi ./configure has --openblas-root and --fst-root options but I think I'd still need have the headers and objects in the same directory.
But I also found vosk also uses these kaldi directories by default and simplified the build args.


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (105 preceding siblings ...)
  2022-11-15 14:24 ` JohnGebbie
@ 2022-11-15 14:44 ` JohnGebbie
  2022-11-15 14:54 ` [PR REVIEW] " JohnGebbie
                   ` (25 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-15 14:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 18956 bytes --]

From 21d92752e7524c89a80b384d9dbb7d260e462efd Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 481250d5c924..7aaf659eff49 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4197,3 +4197,4 @@ libabsl_strings.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 5de2fe3e984e489cc38d5406ad65a2e1582775f0 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 181 ++++++++++++++++++
 srcpkgs/vosk-api/template                     |  77 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 5 files changed, 315 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index 7aaf659eff49..534041071d48 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4198,3 +4198,4 @@ libabsl_throw_delegate.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_time_zone.so.2206.0.0 abseil-cpp-20220623.1_1
 libabsl_spinlock_wait.so.2206.0.0 abseil-cpp-20220623.1_1
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..7bfb73cb5de8
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,181 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/src/makefiles/linux_clapack.mk b/src/makefiles/linux_clapack.mk
+index e6f4f541d..15292fed1 100644
+--- a/src/makefiles/linux_clapack.mk
++++ b/src/makefiles/linux_clapack.mk
+@@ -15,7 +15,7 @@ endif
+ 
+ CLAPACKLIBS = $(CLAPACKROOT)/CLAPACK-3.2.1/lapack.a $(CLAPACKROOT)/CLAPACK-3.2.1/libcblaswr.a \
+ 	      $(CLAPACKROOT)/CBLAS/lib/cblas.a \
+-	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a $(CLAPACKROOT)/libf2c/libf2c.a
++	      $(CLAPACKROOT)/f2c_BLAS-3.8.0/blas.a
+ 
+ CXXFLAGS = -std=c++17 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
+            -Wall -Wno-sign-compare -Wno-unused-local-typedefs \
diff --git a/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..9000f6cd824a
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,77 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit}"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-d kaldi-${_kaldi_commit} -Np1"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	# Don't need Fortran to C, we have lapack not clapack.
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	vsed -i configure -e 's/ -l:libf2c\.a//'
+	cd "${wrksrc}/vosk-api-${version}/src"
+	vsed -i Makefile -e 's:\$(OPENBLAS_ROOT)/lib/libf2c.a::'
+	vsed -i Makefile -e 's/ -lf2c//'
+
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_CLAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (106 preceding siblings ...)
  2022-11-15 14:44 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-11-15 14:54 ` JohnGebbie
  2022-12-03 18:32 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (24 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-11-15 14:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1022893076

Comment:
Thank you so much, made me very happy seeing you'd reviewed!

I added a patch to allow cross compiling, but a test about float equality fails when natively compiling i686, so I have limited the template to x86_64* and aarch64* with a comment to the issue I've opened, until it is resolved.

I see they're doing the same on alpine: https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/41097


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (107 preceding siblings ...)
  2022-11-15 14:54 ` [PR REVIEW] " JohnGebbie
@ 2022-12-03 18:32 ` JohnGebbie
  2022-12-03 18:37 ` JohnGebbie
                   ` (23 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 22580 bytes --]

From c92646ddcc4f683e60de8da6a026baf66b28e004 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 8fd417267d4d..fd6908601c80 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4206,3 +4206,4 @@ libtracefs.so.1 libtracefs-1.4.2_1
 libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 9405342b39eed38129b96d6be08a370a03fe0a9a Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 srcpkgs/vosk-api/patches/kaldi-lapack.patch   |  44 +++++
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 168 ++++++++++++++++++
 srcpkgs/vosk-api/patches/series               |   0
 srcpkgs/vosk-api/patches/vosk-lapack.patch    |  40 +++++
 srcpkgs/vosk-api/template                     |  76 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 8 files changed, 385 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/patches/series
 create mode 100644 srcpkgs/vosk-api/patches/vosk-lapack.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index fd6908601c80..56b35351516f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4207,3 +4207,4 @@ libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-lapack.patch b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
new file mode 100644
index 000000000000..a8e4250bf438
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
@@ -0,0 +1,44 @@
+From 0a2594f67b3eab3e972f699282e13ce7d7ae94fc Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:59:32 +0000
+Subject: [PATCH] Add OPENBLAS_LAPACK math library option
+
+---
+ src/configure | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index ed62daa5017..3a59c92d610 100755
+--- a/src/configure
++++ b/src/configure
+@@ -834,7 +834,7 @@ auto_lib=             # Deduced lib name, used when $MATHLIB is not set.
+ 
+ # Validate the (optionally) provided MATHLIB value.
+ case $MATHLIB in
+-  ''|ATLAS|CLAPACK|MKL|OPENBLAS|OPENBLAS_CLAPACK) : ;;
++  ''|ATLAS|CLAPACK|MKL|OPENBLAS|OPENBLAS_CLAPACK|OPENBLAS_LAPACK) : ;;
+   *) failure "Unknown --mathlib='${MATHLIB}'. Supported libs: ATLAS CLAPACK MKL OPENBLAS" ;;
+ esac
+ 
+@@ -1301,7 +1301,7 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+     esac >> kaldi.mk
+ 
+     echo "Successfully configured for Linux with OpenBLAS from $OPENBLASROOT"
+-  elif [ "$MATHLIB" == "OPENBLAS_CLAPACK" ]; then
++  elif [ "$MATHLIB" == "OPENBLAS_CLAPACK" ] || [ "$MATHLIB" == "OPENBLAS_LAPACK" ]; 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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+       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/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..6f2e1a343b2a
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,168 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/srcpkgs/vosk-api/patches/series b/srcpkgs/vosk-api/patches/series
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/srcpkgs/vosk-api/patches/vosk-lapack.patch b/srcpkgs/vosk-api/patches/vosk-lapack.patch
new file mode 100644
index 000000000000..90908d51d93c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/vosk-lapack.patch
@@ -0,0 +1,40 @@
+From e124d0d93a2fb6f797f418e955d560b741631344 Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:53:21 +0000
+Subject: [PATCH] Add OPENBLAS_LAPACK math library option
+
+---
+ src/Makefile | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index cd697b15..41b91eb0 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,6 +7,7 @@ CUDA_ROOT?=/usr/local/cuda
+ USE_SHARED?=0
+ # Math libraries
+ HAVE_OPENBLAS_CLAPACK?=1
++HAVE_OPENBLAS_LAPACK?=0
+ HAVE_MKL?=0
+ HAVE_ACCELERATE=0
+ HAVE_CUDA?=0
+@@ -80,6 +81,18 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+     endif
+ endif
+ 
++ifeq ($(HAVE_OPENBLAS_LAPACK), 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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..41633ec99969
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,76 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit} HAVE_OPENBLAS_LAPACK=1 HAVE_OPENBLAS_CLAPACK=0"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+
+do_patch() {
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-lapack.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openblas-0.3.21.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openfst-1.8.2.patch"
+	patch -Np1 -d "${wrksrc}/vosk-api-${version}" < "${PATCHESDIR}/vosk-lapack.patch"
+}
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_LAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (108 preceding siblings ...)
  2022-12-03 18:32 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-12-03 18:37 ` JohnGebbie
  2022-12-03 18:38 ` [PR REVIEW] " JohnGebbie
                   ` (22 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 22676 bytes --]

From c92646ddcc4f683e60de8da6a026baf66b28e004 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 8fd417267d4d..fd6908601c80 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4206,3 +4206,4 @@ libtracefs.so.1 libtracefs-1.4.2_1
 libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From b36a7fca0bd6200ec6040707dd449ec0effb24c0 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 srcpkgs/vosk-api/patches/kaldi-lapack.patch   |  44 +++++
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 168 ++++++++++++++++++
 srcpkgs/vosk-api/patches/series               |   0
 srcpkgs/vosk-api/patches/vosk-lapack.patch    |  40 +++++
 srcpkgs/vosk-api/template                     |  78 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 8 files changed, 387 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/patches/series
 create mode 100644 srcpkgs/vosk-api/patches/vosk-lapack.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index fd6908601c80..56b35351516f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4207,3 +4207,4 @@ libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-lapack.patch b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
new file mode 100644
index 000000000000..a8e4250bf438
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
@@ -0,0 +1,44 @@
+From 0a2594f67b3eab3e972f699282e13ce7d7ae94fc Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:59:32 +0000
+Subject: [PATCH] Add OPENBLAS_LAPACK math library option
+
+---
+ src/configure | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index ed62daa5017..3a59c92d610 100755
+--- a/src/configure
++++ b/src/configure
+@@ -834,7 +834,7 @@ auto_lib=             # Deduced lib name, used when $MATHLIB is not set.
+ 
+ # Validate the (optionally) provided MATHLIB value.
+ case $MATHLIB in
+-  ''|ATLAS|CLAPACK|MKL|OPENBLAS|OPENBLAS_CLAPACK) : ;;
++  ''|ATLAS|CLAPACK|MKL|OPENBLAS|OPENBLAS_CLAPACK|OPENBLAS_LAPACK) : ;;
+   *) failure "Unknown --mathlib='${MATHLIB}'. Supported libs: ATLAS CLAPACK MKL OPENBLAS" ;;
+ esac
+ 
+@@ -1301,7 +1301,7 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+     esac >> kaldi.mk
+ 
+     echo "Successfully configured for Linux with OpenBLAS from $OPENBLASROOT"
+-  elif [ "$MATHLIB" == "OPENBLAS_CLAPACK" ]; then
++  elif [ "$MATHLIB" == "OPENBLAS_CLAPACK" ] || [ "$MATHLIB" == "OPENBLAS_LAPACK" ]; 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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+       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/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..6f2e1a343b2a
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,168 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/srcpkgs/vosk-api/patches/series b/srcpkgs/vosk-api/patches/series
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/srcpkgs/vosk-api/patches/vosk-lapack.patch b/srcpkgs/vosk-api/patches/vosk-lapack.patch
new file mode 100644
index 000000000000..90908d51d93c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/vosk-lapack.patch
@@ -0,0 +1,40 @@
+From e124d0d93a2fb6f797f418e955d560b741631344 Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:53:21 +0000
+Subject: [PATCH] Add OPENBLAS_LAPACK math library option
+
+---
+ src/Makefile | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index cd697b15..41b91eb0 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,6 +7,7 @@ CUDA_ROOT?=/usr/local/cuda
+ USE_SHARED?=0
+ # Math libraries
+ HAVE_OPENBLAS_CLAPACK?=1
++HAVE_OPENBLAS_LAPACK?=0
+ HAVE_MKL?=0
+ HAVE_ACCELERATE=0
+ HAVE_CUDA?=0
+@@ -80,6 +81,18 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+     endif
+ endif
+ 
++ifeq ($(HAVE_OPENBLAS_LAPACK), 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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..68fba97681f7
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,78 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit} HAVE_OPENBLAS_LAPACK=1 HAVE_OPENBLAS_CLAPACK=0"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+
+do_patch() {
+	# https://github.com/alphacep/kaldi/pull/5
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-lapack.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openblas-0.3.21.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openfst-1.8.2.patch"
+	# https://github.com/alphacep/vosk-api/pull/1215
+	patch -Np1 -d "${wrksrc}/vosk-api-${version}" < "${PATCHESDIR}/vosk-lapack.patch"
+}
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_LAPACK --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (109 preceding siblings ...)
  2022-12-03 18:37 ` JohnGebbie
@ 2022-12-03 18:38 ` JohnGebbie
  2022-12-03 18:43 ` JohnGebbie
                   ` (21 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038818412

Comment:
I have now made them patches and put links to my pull requests in the template

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (110 preceding siblings ...)
  2022-12-03 18:38 ` [PR REVIEW] " JohnGebbie
@ 2022-12-03 18:43 ` JohnGebbie
  2022-12-03 18:44 ` JohnGebbie
                   ` (20 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038818911

Comment:
I still think this is the best way as vosk and kaldi book look to these directories by default and it keeps things simple

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (111 preceding siblings ...)
  2022-12-03 18:43 ` JohnGebbie
@ 2022-12-03 18:44 ` JohnGebbie
  2022-12-03 18:47 ` JohnGebbie
                   ` (19 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 272 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038818911

Comment:
I still think this is the best way as vosk and kaldi both look to these directories by default and it keeps things simple

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (112 preceding siblings ...)
  2022-12-03 18:44 ` JohnGebbie
@ 2022-12-03 18:47 ` JohnGebbie
  2022-12-03 18:48 ` JohnGebbie
                   ` (18 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:47 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336217135

Comment:
Still ready to merge. I made the vseds into patches and put links to the pull requests in the template as requested.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (113 preceding siblings ...)
  2022-12-03 18:47 ` JohnGebbie
@ 2022-12-03 18:48 ` JohnGebbie
  2022-12-03 20:52 ` JohnGebbie
                   ` (17 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 18:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336217135

Comment:
Still ready to merge. I made the vseds into patches and put links to their pull requests in the template as requested.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (114 preceding siblings ...)
  2022-12-03 18:48 ` JohnGebbie
@ 2022-12-03 20:52 ` JohnGebbie
  2022-12-03 21:22 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (16 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 20:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336255841

Comment:
Hold the phone, might be able to simplify and remove a patch.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (115 preceding siblings ...)
  2022-12-03 20:52 ` JohnGebbie
@ 2022-12-03 21:22 ` JohnGebbie
  2022-12-03 21:26 ` JohnGebbie
                   ` (15 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 21:22 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 20072 bytes --]

From c92646ddcc4f683e60de8da6a026baf66b28e004 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 8fd417267d4d..fd6908601c80 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4206,3 +4206,4 @@ libtracefs.so.1 libtracefs-1.4.2_1
 libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 894a51e693d9cc858f7cb8ec097dd6472b1d0b71 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 168 ++++++++++++++++++
 srcpkgs/vosk-api/patches/series               |   0
 srcpkgs/vosk-api/patches/vosk-lapack.patch    |  40 +++++
 srcpkgs/vosk-api/template                     |  76 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 7 files changed, 341 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/patches/series
 create mode 100644 srcpkgs/vosk-api/patches/vosk-lapack.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index fd6908601c80..56b35351516f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4207,3 +4207,4 @@ libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..6f2e1a343b2a
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,168 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/srcpkgs/vosk-api/patches/series b/srcpkgs/vosk-api/patches/series
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/srcpkgs/vosk-api/patches/vosk-lapack.patch b/srcpkgs/vosk-api/patches/vosk-lapack.patch
new file mode 100644
index 000000000000..90908d51d93c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/vosk-lapack.patch
@@ -0,0 +1,40 @@
+From e124d0d93a2fb6f797f418e955d560b741631344 Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:53:21 +0000
+Subject: [PATCH] Add OPENBLAS_LAPACK math library option
+
+---
+ src/Makefile | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index cd697b15..41b91eb0 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,6 +7,7 @@ CUDA_ROOT?=/usr/local/cuda
+ USE_SHARED?=0
+ # Math libraries
+ HAVE_OPENBLAS_CLAPACK?=1
++HAVE_OPENBLAS_LAPACK?=0
+ HAVE_MKL?=0
+ HAVE_ACCELERATE=0
+ HAVE_CUDA?=0
+@@ -80,6 +81,18 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+     endif
+ endif
+ 
++ifeq ($(HAVE_OPENBLAS_LAPACK), 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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..60df26058c3e
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,76 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit} HAVE_OPENBLAS_LAPACK=1 HAVE_OPENBLAS_CLAPACK=0"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+
+do_patch() {
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openblas-0.3.21.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openfst-1.8.2.patch"
+	# https://github.com/alphacep/vosk-api/pull/1215
+	patch -Np1 -d "${wrksrc}/vosk-api-${version}" < "${PATCHESDIR}/vosk-lapack.patch"
+}
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (116 preceding siblings ...)
  2022-12-03 21:22 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-12-03 21:26 ` JohnGebbie
  2022-12-04  8:19 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (14 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-03 21:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336261075

Comment:
There we go, simplified it slightly by using --mathlib=OPENBLAS which works with lapack out of the box.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (117 preceding siblings ...)
  2022-12-03 21:26 ` JohnGebbie
@ 2022-12-04  8:19 ` JohnGebbie
  2022-12-04  8:21 ` JohnGebbie
                   ` (13 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04  8:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 22676 bytes --]

From c92646ddcc4f683e60de8da6a026baf66b28e004 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 8fd417267d4d..fd6908601c80 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4206,3 +4206,4 @@ libtracefs.so.1 libtracefs-1.4.2_1
 libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 9a5023eaff12c2002a909d90799d03126f6572a8 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 srcpkgs/vosk-api/patches/kaldi-lapack.patch   |  44 +++++
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../patches/kaldi-to-openfst-1.8.2.patch      | 168 ++++++++++++++++++
 srcpkgs/vosk-api/patches/series               |   0
 srcpkgs/vosk-api/patches/vosk-lapack.patch    |  40 +++++
 srcpkgs/vosk-api/template                     |  78 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 8 files changed, 387 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/patches/series
 create mode 100644 srcpkgs/vosk-api/patches/vosk-lapack.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index fd6908601c80..56b35351516f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4207,3 +4207,4 @@ libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-lapack.patch b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
new file mode 100644
index 000000000000..e40117beef5c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
@@ -0,0 +1,44 @@
+From 5f70761ecdf497cf55ca730187ab6ab38589ef0f Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:59:32 +0000
+Subject: [PATCH] Add OPENBLAS_NO_F2C math library option
+
+---
+ src/configure | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index ed62daa5017..1d78489d55e 100755
+--- a/src/configure
++++ b/src/configure
+@@ -834,7 +834,7 @@ auto_lib=             # Deduced lib name, used when $MATHLIB is not set.
+ 
+ # 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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+     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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+       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/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..6f2e1a343b2a
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,168 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/srcpkgs/vosk-api/patches/series b/srcpkgs/vosk-api/patches/series
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/srcpkgs/vosk-api/patches/vosk-lapack.patch b/srcpkgs/vosk-api/patches/vosk-lapack.patch
new file mode 100644
index 000000000000..8751f3c77d9c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/vosk-lapack.patch
@@ -0,0 +1,40 @@
+From 6c28207334bb1281d98a94f799757fdfa8f6b336 Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:53:21 +0000
+Subject: [PATCH] Add OPENBLAS_NO_F2C math library option
+
+---
+ src/Makefile | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index cd697b15..97654883 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,6 +7,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 +81,18 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+     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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..b3100d2f151a
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,78 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi-${_kaldi_commit} HAVE_OPENBLAS_NO_F2C=1 HAVE_OPENBLAS_CLAPACK=0"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+
+do_patch() {
+	# https://github.com/alphacep/kaldi/pull/5
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-lapack.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openblas-0.3.21.patch"
+	patch -Np1 -d "${wrksrc}/kaldi-${_kaldi_commit}" < "${PATCHESDIR}/kaldi-to-openfst-1.8.2.patch"
+	# https://github.com/alphacep/vosk-api/pull/1215
+	patch -Np1 -d "${wrksrc}/vosk-api-${version}" < "${PATCHESDIR}/vosk-lapack.patch"
+}
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi-${_kaldi_commit}/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_NO_F2C --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (118 preceding siblings ...)
  2022-12-04  8:19 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-12-04  8:21 ` JohnGebbie
  2022-12-04 10:25 ` JohnGebbie
                   ` (12 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04  8:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336347866

Comment:
I reverted back to my pull request patches as they're still an improvement.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (119 preceding siblings ...)
  2022-12-04  8:21 ` JohnGebbie
@ 2022-12-04 10:25 ` JohnGebbie
  2022-12-04 12:46 ` [PR REVIEW] " paper42
                   ` (11 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04 10:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336370708

Comment:
ready to merge

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (123 preceding siblings ...)
  2022-12-04 12:46 ` paper42
@ 2022-12-04 12:46 ` paper42
  2022-12-04 12:46 ` paper42
                   ` (7 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 12:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038961158

Comment:
```suggestion
 39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
 30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
```

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (122 preceding siblings ...)
  2022-12-04 12:46 ` paper42
@ 2022-12-04 12:46 ` paper42
  2022-12-04 12:46 ` paper42
                   ` (8 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 12:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038962902

Comment:
This can be replaced by `patch_args="-Np1 -d ${pkgname}-${version}"` and `patches/kaldi-*.patch.args` files containing `-Np1 -d kaldi`. The kaldi directory currently contains version in its name like I suggest in a comment in `post_extract`. Then patches/series can be removed.

Not overriding do_patch is more consistent with other packages and gets rid of one unnecessary step when adding a patch.
Also a nitpick that's not important if we modify it this way, we usually try to follow keep the order of build steps in sync with order of functions, patch runs after extract, so do_patch should be after do_extract.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (121 preceding siblings ...)
  2022-12-04 12:46 ` [PR REVIEW] " paper42
@ 2022-12-04 12:46 ` paper42
  2022-12-04 12:46 ` paper42
                   ` (9 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 12:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038961080

Comment:
```suggestion
 https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
 https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
```

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (120 preceding siblings ...)
  2022-12-04 10:25 ` JohnGebbie
@ 2022-12-04 12:46 ` paper42
  2022-12-04 12:46 ` paper42
                   ` (10 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 12:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038961420

Comment:
Could you add a comment about where we can find this commit?

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (124 preceding siblings ...)
  2022-12-04 12:46 ` paper42
@ 2022-12-04 12:46 ` paper42
  2022-12-04 13:52 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (6 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 12:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038963063

Comment:
so we can easily use patch.args
```suggestion
	mv kaldi-${_kaldi_commit} kaldi
	cd "${wrksrc}/kaldi/tools"
```

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (125 preceding siblings ...)
  2022-12-04 12:46 ` paper42
@ 2022-12-04 13:52 ` JohnGebbie
  2022-12-04 13:55 ` [PR REVIEW] " JohnGebbie
                   ` (5 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04 13:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 23596 bytes --]

From c92646ddcc4f683e60de8da6a026baf66b28e004 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 8fd417267d4d..fd6908601c80 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4206,3 +4206,4 @@ libtracefs.so.1 libtracefs-1.4.2_1
 libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 88aee16daaa237849577397d11bb99a3c515a152 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 srcpkgs/vosk-api/patches/kaldi-lapack.patch   |  44 +++++
 .../vosk-api/patches/kaldi-lapack.patch.args  |   1 +
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../kaldi-to-openblas-0.3.21.patch.args       |   1 +
 .../patches/kaldi-to-openfst-1.8.2.patch      | 168 ++++++++++++++++++
 .../patches/kaldi-to-openfst-1.8.2.patch.args |   1 +
 srcpkgs/vosk-api/patches/vosk-lapack.patch    |  40 +++++
 srcpkgs/vosk-api/template                     |  78 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 10 files changed, 390 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch.args
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args
 create mode 100644 srcpkgs/vosk-api/patches/vosk-lapack.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index fd6908601c80..56b35351516f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4207,3 +4207,4 @@ libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-lapack.patch b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
new file mode 100644
index 000000000000..e40117beef5c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
@@ -0,0 +1,44 @@
+From 5f70761ecdf497cf55ca730187ab6ab38589ef0f Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:59:32 +0000
+Subject: [PATCH] Add OPENBLAS_NO_F2C math library option
+
+---
+ src/configure | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index ed62daa5017..1d78489d55e 100755
+--- a/src/configure
++++ b/src/configure
+@@ -834,7 +834,7 @@ auto_lib=             # Deduced lib name, used when $MATHLIB is not set.
+ 
+ # 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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+     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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+       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/srcpkgs/vosk-api/patches/kaldi-lapack.patch.args b/srcpkgs/vosk-api/patches/kaldi-lapack.patch.args
new file mode 100644
index 000000000000..b5c52a09e494
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch.args
@@ -0,0 +1 @@
+-Np1 -d kaldi
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args
new file mode 100644
index 000000000000..b5c52a09e494
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args
@@ -0,0 +1 @@
+-Np1 -d kaldi
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..6f2e1a343b2a
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,168 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args
new file mode 100644
index 000000000000..b5c52a09e494
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args
@@ -0,0 +1 @@
+-Np1 -d kaldi
diff --git a/srcpkgs/vosk-api/patches/vosk-lapack.patch b/srcpkgs/vosk-api/patches/vosk-lapack.patch
new file mode 100644
index 000000000000..8751f3c77d9c
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/vosk-lapack.patch
@@ -0,0 +1,40 @@
+From 6c28207334bb1281d98a94f799757fdfa8f6b336 Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:53:21 +0000
+Subject: [PATCH] Add OPENBLAS_NO_F2C math library option
+
+---
+ src/Makefile | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index cd697b15..97654883 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,6 +7,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 +81,18 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+     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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..6c14e10b1101
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,78 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+# Vosk is built with their own vendored version of Kaldi which has no releases
+# of its own, so the commit must be determined by the date of the vosk release.
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi HAVE_OPENBLAS_NO_F2C=1 HAVE_OPENBLAS_CLAPACK=0"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+ https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+ https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+ 39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+ 30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-Np1 -d ${pkgname}-${version}"
+
+# srcpkgs/vosk-api/patches/kaldi-lapack.patch:
+#  https://github.com/alphacep/kaldi/pull/5
+# srcpkgs/vosk-api/patches/vosk-lapack.patch:
+#  https://github.com/alphacep/vosk-api/pull/1215
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	mv "kaldi-${_kaldi_commit}" kaldi
+	cd "${wrksrc}/kaldi/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_NO_F2C --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (126 preceding siblings ...)
  2022-12-04 13:52 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-12-04 13:55 ` JohnGebbie
  2022-12-04 14:04 ` paper42
                   ` (4 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04 13:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

New review comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038975289

Comment:
Thank you! that is better.

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR REVIEW] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (127 preceding siblings ...)
  2022-12-04 13:55 ` [PR REVIEW] " JohnGebbie
@ 2022-12-04 14:04 ` paper42
  2022-12-04 14:33 ` [PR PATCH] [Updated] " JohnGebbie
                   ` (3 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 14:04 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

New review comment by paper42 on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#discussion_r1038976696

Comment:
these comments can be put before the first lines of the patches

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Updated] New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (128 preceding siblings ...)
  2022-12-04 14:04 ` paper42
@ 2022-12-04 14:33 ` JohnGebbie
  2022-12-04 16:09 ` JohnGebbie
                   ` (2 subsequent siblings)
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04 14:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]

There is an updated pull request by JohnGebbie against master on the void-packages repository

https://github.com/JohnGebbie/void-packages libvosk
https://github.com/void-linux/void-packages/pull/39015

New package: vosk-api-0.3.43
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


A patch file from https://github.com/void-linux/void-packages/pull/39015.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvosk-39015.patch --]
[-- Type: text/x-diff, Size: 23493 bytes --]

From c92646ddcc4f683e60de8da6a026baf66b28e004 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:44:34 +0100
Subject: [PATCH 1/2] New package: openfst-1.8.2

---
 common/shlibs                               |  1 +
 srcpkgs/openfst-devel                       |  1 +
 srcpkgs/openfst/patches/cross-compile.patch | 23 ++++++++++
 srcpkgs/openfst/template                    | 47 +++++++++++++++++++++
 4 files changed, 72 insertions(+)
 create mode 120000 srcpkgs/openfst-devel
 create mode 100644 srcpkgs/openfst/patches/cross-compile.patch
 create mode 100644 srcpkgs/openfst/template

diff --git a/common/shlibs b/common/shlibs
index 8fd417267d4d..fd6908601c80 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4206,3 +4206,4 @@ libtracefs.so.1 libtracefs-1.4.2_1
 libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
+libfst.so.25 openfst-1.8.2_1
diff --git a/srcpkgs/openfst-devel b/srcpkgs/openfst-devel
new file mode 120000
index 000000000000..b4e86ac8d61f
--- /dev/null
+++ b/srcpkgs/openfst-devel
@@ -0,0 +1 @@
+openfst
\ No newline at end of file
diff --git a/srcpkgs/openfst/patches/cross-compile.patch b/srcpkgs/openfst/patches/cross-compile.patch
new file mode 100644
index 000000000000..4014f51dba38
--- /dev/null
+++ b/srcpkgs/openfst/patches/cross-compile.patch
@@ -0,0 +1,23 @@
+From 256f83e52112a5cd37e37a34beff2c4f0eae4660 Mon Sep 17 00:00:00 2001
+From: Nickolay Shmyrev <nshmyrev@gmail.com>
+Date: Tue, 16 Jun 2020 15:22:19 +0200
+Subject: [PATCH] Don't fail on cross-compile
+
+---
+ configure.ac | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d52ed02..0f53b4d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -180,7 +180,8 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
+               [AC_MSG_FAILURE(m4_normalize([
+                    Test float equality failed!
+                    Compile with -msse -mfpmath=sse if using g++.
+-              ]))])
++              ]))],
++              [echo "Ignoring test for cross-compilation"])
+ 
+ AC_CHECK_LIB([dl], dlopen, [DL_LIBS=-ldl])
+ AC_SUBST([DL_LIBS])
diff --git a/srcpkgs/openfst/template b/srcpkgs/openfst/template
new file mode 100644
index 000000000000..1e62d249f83c
--- /dev/null
+++ b/srcpkgs/openfst/template
@@ -0,0 +1,47 @@
+# Template file for 'openfst'
+pkgname=openfst
+version=1.8.2
+revision=1
+# Limiting archs until resolved why a test fails when natively compiling i686:
+# https://github.com/kaldi-asr/kaldi/issues/4808
+archs="x86_64* aarch64*"
+build_style=gnu-configure
+configure_args="
+	--disable-bin
+	--disable-dependency-tracking
+	--enable-compact-fsts
+	--enable-compress
+	--enable-const-fsts
+	--enable-far
+	--enable-linear-fsts
+	--enable-lookahead-fsts
+	--enable-mpdt
+	--enable-ngram-fsts
+	--enable-pdt
+	--enable-shared
+	--enable-static
+	--with-pic
+"
+hostmakedepends="autoconf automake libtool"
+short_desc="Finite-state transducers library"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://www.openfst.org"
+distfiles="https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-$version.tar.gz"
+checksum=de987bf3624721c5d5ba321af95751898e4f4bb41c8a36e2d64f0627656d8b42
+
+pre_configure() {
+	autoreconf -fi
+}
+
+openfst-devel_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development files"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.a"
+		vmove "usr/lib/*.so"
+		vmove "usr/lib/fst/*.a"
+		vmove "usr/lib/fst/*.so"
+	}
+}

From 64234e09657cc95b8e472fbcbbe79ba7ca7cb866 Mon Sep 17 00:00:00 2001
From: John Gebbie <me@johngebbie.com>
Date: Fri, 28 Oct 2022 17:57:26 +0100
Subject: [PATCH 2/2] New package: vosk-api-0.3.43

---
 common/shlibs                                 |   1 +
 srcpkgs/vosk-api/patches/kaldi-lapack.patch   |  45 +++++
 .../vosk-api/patches/kaldi-lapack.patch.args  |   1 +
 .../patches/kaldi-to-openblas-0.3.21.patch    |  55 ++++++
 .../kaldi-to-openblas-0.3.21.patch.args       |   1 +
 .../patches/kaldi-to-openfst-1.8.2.patch      | 168 ++++++++++++++++++
 .../patches/kaldi-to-openfst-1.8.2.patch.args |   1 +
 srcpkgs/vosk-api/patches/vosk-lapack.patch    |  41 +++++
 srcpkgs/vosk-api/template                     |  73 ++++++++
 srcpkgs/vosk-model-small-en-us                |   1 +
 10 files changed, 387 insertions(+)
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-lapack.patch.args
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
 create mode 100644 srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args
 create mode 100644 srcpkgs/vosk-api/patches/vosk-lapack.patch
 create mode 100644 srcpkgs/vosk-api/template
 create mode 120000 srcpkgs/vosk-model-small-en-us

diff --git a/common/shlibs b/common/shlibs
index fd6908601c80..56b35351516f 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -4207,3 +4207,4 @@ libtracecmd.so.1 libtracecmd-3.1.2_1
 libkshark.so.2 libkshark-2.1.1_1
 libcpp-hocon.so.0.3.0 cpp-hocon-0.3.0_5
 libfst.so.25 openfst-1.8.2_1
+libvosk.so vosk-api-0.3.43_1
diff --git a/srcpkgs/vosk-api/patches/kaldi-lapack.patch b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
new file mode 100644
index 000000000000..9fdd3a11eb65
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch
@@ -0,0 +1,45 @@
+https://github.com/alphacep/kaldi/pull/5
+From 5f70761ecdf497cf55ca730187ab6ab38589ef0f Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:59:32 +0000
+Subject: [PATCH] Add OPENBLAS_NO_F2C math library option
+
+---
+ src/configure | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/configure b/src/configure
+index ed62daa5017..1d78489d55e 100755
+--- a/src/configure
++++ b/src/configure
+@@ -834,7 +834,7 @@ auto_lib=             # Deduced lib name, used when $MATHLIB is not set.
+ 
+ # 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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+     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 @@ or try another math library, e.g. --mathlib=OPENBLAS (Kaldi may be slower)."
+       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/srcpkgs/vosk-api/patches/kaldi-lapack.patch.args b/srcpkgs/vosk-api/patches/kaldi-lapack.patch.args
new file mode 100644
index 000000000000..b5c52a09e494
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-lapack.patch.args
@@ -0,0 +1 @@
+-Np1 -d kaldi
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
new file mode 100644
index 000000000000..4ae3aac80393
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch
@@ -0,0 +1,55 @@
+--- a/src/matrix/cblas-wrappers.h
++++ b/src/matrix/cblas-wrappers.h
+@@ -383,10 +383,10 @@ inline void mul_elements(
+ // 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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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 @@ inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args
new file mode 100644
index 000000000000..b5c52a09e494
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openblas-0.3.21.patch.args
@@ -0,0 +1 @@
+-Np1 -d kaldi
diff --git a/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
new file mode 100644
index 000000000000..6f2e1a343b2a
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch
@@ -0,0 +1,168 @@
+diff --git a/src/base/kaldi-types.h b/src/base/kaldi-types.h
+index 7ebf4f853..c376604a4 100644
+--- a/src/base/kaldi-types.h
++++ b/src/base/kaldi-types.h
+@@ -39,24 +39,21 @@ typedef float   BaseFloat;
+ // 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,5 @@ namespace kaldi {
+   typedef float    float32;
+   typedef double   double64;
+ }  // end namespace kaldi
+-*/
+ 
+ #endif  // KALDI_BASE_KALDI_TYPES_H_
+diff --git a/src/configure b/src/configure
+index c74d67af8..84286da01 100755
+--- a/src/configure
++++ b/src/configure
+@@ -929,7 +929,7 @@ fi
+ 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 --git a/src/fstext/kaldi-fst-io-inl.h b/src/fstext/kaldi-fst-io-inl.h
+index f7bb3a7c2..01047919c 100644
+--- a/src/fstext/kaldi-fst-io-inl.h
++++ b/src/fstext/kaldi-fst-io-inl.h
+@@ -99,7 +99,7 @@ void ReadFstKaldi(std::istream &is, bool binary,
+     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 --git a/src/fstext/lattice-weight.h b/src/fstext/lattice-weight.h
+index 7637c4d1c..2d82c5647 100644
+--- a/src/fstext/lattice-weight.h
++++ b/src/fstext/lattice-weight.h
+@@ -396,8 +396,8 @@ inline bool ApproxEqual(const LatticeWeightTpl<FloatType> &w1,
+ 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 @@ inline std::ostream &operator <<(std::ostream &strm, const LatticeWeightTpl<Floa
+ 
+ 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 @@ inline CompactLatticeWeightTpl<WeightType, IntType> Divide(const CompactLatticeW
+ 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 @@ inline std::istream &operator >>(std::istream &strm, CompactLatticeWeightTpl<Wei
+   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 --git a/src/fstext/trivial-factor-weight.h b/src/fstext/trivial-factor-weight.h
+index d1c679f7f..90bab80db 100644
+--- a/src/fstext/trivial-factor-weight.h
++++ b/src/fstext/trivial-factor-weight.h
+@@ -390,7 +390,7 @@ class ArcIterator< TrivialFactorWeightFst<A, F> >
+ 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 --git a/src/lat/kaldi-lattice.cc b/src/lat/kaldi-lattice.cc
+index 648e67115..70fde5acf 100644
+--- a/src/lat/kaldi-lattice.cc
++++ b/src/lat/kaldi-lattice.cc
+@@ -114,7 +114,7 @@ class LatticeReader {
+     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 --git a/src/lat/lattice-functions-transition-model.cc b/src/lat/lattice-functions-transition-model.cc
+index 6172610dc..a8cd7b7e2 100644
+--- a/src/lat/lattice-functions-transition-model.cc
++++ b/src/lat/lattice-functions-transition-model.cc
+@@ -248,13 +248,13 @@ bool TestWordAlignedLattice(const WordAlignLatticeLexiconInfo &lexicon_info,
+   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/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args
new file mode 100644
index 000000000000..b5c52a09e494
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/kaldi-to-openfst-1.8.2.patch.args
@@ -0,0 +1 @@
+-Np1 -d kaldi
diff --git a/srcpkgs/vosk-api/patches/vosk-lapack.patch b/srcpkgs/vosk-api/patches/vosk-lapack.patch
new file mode 100644
index 000000000000..1b2fd6bd6c1d
--- /dev/null
+++ b/srcpkgs/vosk-api/patches/vosk-lapack.patch
@@ -0,0 +1,41 @@
+https://github.com/alphacep/vosk-api/pull/1215
+From 6c28207334bb1281d98a94f799757fdfa8f6b336 Mon Sep 17 00:00:00 2001
+From: John Gebbie <me@johngebbie.com>
+Date: Sat, 3 Dec 2022 17:53:21 +0000
+Subject: [PATCH] Add OPENBLAS_NO_F2C math library option
+
+---
+ src/Makefile | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/Makefile b/src/Makefile
+index cd697b15..97654883 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -7,6 +7,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 +81,18 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1)
+     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/srcpkgs/vosk-api/template b/srcpkgs/vosk-api/template
new file mode 100644
index 000000000000..b86c74452b95
--- /dev/null
+++ b/srcpkgs/vosk-api/template
@@ -0,0 +1,73 @@
+# Template file for 'vosk-api'
+pkgname=vosk-api
+version=0.3.43
+revision=1
+create_wrksrc=yes
+build_wrksrc="vosk-api-${version}/src"
+# Vosk is built with their own vendored version of Kaldi which has no releases
+# of its own, so the commit must be determined by the date of the vosk release.
+_kaldi_commit=ecb4b47159501ef0d67888633e65b8fc0c1f79d1
+build_style=gnu-makefile
+make_use_env=yes
+make_build_args="KALDI_ROOT=../../kaldi HAVE_OPENBLAS_NO_F2C=1 HAVE_OPENBLAS_CLAPACK=0"
+makedepends="blas-devel lapack-devel openblas-devel libgomp-devel openfst-devel"
+short_desc="Offline speech recognition toolkit"
+maintainer="John Gebbie <me@johngebbie.com>"
+license="Apache-2.0"
+homepage="https://alphacephei.com/vosk"
+distfiles="https://github.com/alphacep/vosk-api/archive/v${version}/vosk-api-${version}.tar.gz
+ https://github.com/alphacep/kaldi/archive/${_kaldi_commit}.tar.gz
+ https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip"
+checksum="50fa82bfbfe3fc5be868237c84ac180eb55da0b65b1803bf022899673afda024
+ 39cadd5a351a5513e3e4e1f71ac4b4f018a592a856a55f1d32c159e22e799f64
+ 30f26242c4eb449f948e42cb302dd7a686cb29a3423a8367f99ff41780942498"
+shlib_provides="libvosk.so"
+patch_args="-Np1 -d ${pkgname}-${version}"
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	makedepends+=" libexecinfo-devel"
+fi
+
+post_extract() {
+	mv "kaldi-${_kaldi_commit}" kaldi
+	cd "${wrksrc}/kaldi/tools"
+	mkdir -p OpenBLAS/install/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/openblas" OpenBLAS/install/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* OpenBLAS/install/lib
+	mkdir -p openfst/include openfst/lib
+	ln -sf "${XBPS_CROSS_BASE}/usr/include/fst" openfst/include
+	ln -sf "${XBPS_CROSS_BASE}/usr/lib/"* openfst/lib
+}
+
+pre_build() {
+	cd "${wrksrc}/kaldi/src"
+	./configure ${CROSS_BUILD:+--host="${XBPS_CROSS_TRIPLET}"} --mathlib=OPENBLAS_NO_F2C --shared --use-cuda=no
+	make online2 lm rnnlm
+}
+
+do_install() {
+	vinstall vosk_api.h 644 usr/include
+	vinstall libvosk.so 644 usr/lib
+
+	vmkdir usr/share/vosk-models
+	mv "${wrksrc}/vosk-model-small-en-us-0.15" "${DESTDIR}/usr/share/vosk-models/small-en-us"
+}
+
+do_check() {
+	cd "${wrksrc}/vosk-api-${version}/c"
+	ln -sf "${wrksrc}/vosk-model-small-en-us-0.15" model
+	ln -sf ../python/example/test.wav .
+	ldflags="-fopenmp -L../src -lvosk -ldl -lpthread -Wl,-rpath,../src"
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		ldflags+=" -lexecinfo"
+	fi
+	make LDFLAGS="$ldflags"
+	./test_vosk | grep -q '"text" : "zero one eight zero three"'
+}
+
+vosk-model-small-en-us_package() {
+	short_desc="Lightweight english language model"
+	pkg_install() {
+		vmove usr/share/vosk-models
+	}
+}
diff --git a/srcpkgs/vosk-model-small-en-us b/srcpkgs/vosk-model-small-en-us
new file mode 120000
index 000000000000..db9953d33676
--- /dev/null
+++ b/srcpkgs/vosk-model-small-en-us
@@ -0,0 +1 @@
+vosk-api
\ No newline at end of file

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (129 preceding siblings ...)
  2022-12-04 14:33 ` [PR PATCH] [Updated] " JohnGebbie
@ 2022-12-04 16:09 ` JohnGebbie
  2022-12-04 16:10 ` [PR PATCH] [Merged]: " paper42
  2022-12-04 16:11 ` JohnGebbie
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04 16:09 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 181 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336453569

Comment:
Tested numen using this and all well

^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: [PR PATCH] [Merged]: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (130 preceding siblings ...)
  2022-12-04 16:09 ` JohnGebbie
@ 2022-12-04 16:10 ` paper42
  2022-12-04 16:11 ` JohnGebbie
  132 siblings, 0 replies; 134+ messages in thread
From: paper42 @ 2022-12-04 16:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]

There's a merged pull request on the void-packages repository

New package: vosk-api-0.3.43
https://github.com/void-linux/void-packages/pull/39015

Description:
#### Testing the changes
- I tested the changes in this PR: **YES**

#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

Closes https://github.com/void-linux/void-packages/issues/39009

This speech recognition library is a dependency of my assistive voice input program (https://github.com/void-linux/void-packages/pull/39716).
The build requires building their forked version of Kaldi which has different dependencies and a different process from the upstream.
I've patched it to use the latest version of openblas that's already packaged, and the latest version of openfst which I've also committed a template for.


^ permalink raw reply	[flat|nested] 134+ messages in thread

* Re: New package: vosk-api-0.3.43
  2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
                   ` (131 preceding siblings ...)
  2022-12-04 16:10 ` [PR PATCH] [Merged]: " paper42
@ 2022-12-04 16:11 ` JohnGebbie
  132 siblings, 0 replies; 134+ messages in thread
From: JohnGebbie @ 2022-12-04 16:11 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 163 bytes --]

New comment by JohnGebbie on void-packages repository

https://github.com/void-linux/void-packages/pull/39015#issuecomment-1336453851

Comment:
Thank you! :)))))!

^ permalink raw reply	[flat|nested] 134+ messages in thread

end of thread, other threads:[~2022-12-04 16:11 UTC | newest]

Thread overview: 134+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 21:38 [PR PATCH] New package: libvosk-0.3.43 JohnGebbie
2022-09-02  7:33 ` JohnGebbie
2022-09-02  9:01 ` JohnGebbie
2022-09-02 18:59 ` JohnGebbie
2022-09-03 12:04 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-03 12:11 ` New package: vosk-api-0.3.43 JohnGebbie
2022-09-03 14:11 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-03 14:12 ` JohnGebbie
2022-09-03 14:13 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-03 14:14 ` JohnGebbie
2022-09-03 14:14 ` JohnGebbie
2022-09-03 20:52 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-04  8:26 ` JohnGebbie
2022-09-17 13:05 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-17 13:09 ` JohnGebbie
2022-09-18 11:00 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-21 15:53 ` JohnGebbie
2022-09-22  8:53 ` JohnGebbie
2022-09-22  9:26 ` [PR REVIEW] " paper42
2022-09-22  9:26 ` paper42
2022-09-22 14:39 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-22 14:43 ` JohnGebbie
2022-09-22 15:19 ` [PR REVIEW] " JohnGebbie
2022-09-22 18:16 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-22 19:32 ` JohnGebbie
2022-09-22 19:38 ` JohnGebbie
2022-09-22 20:31 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-22 20:33 ` JohnGebbie
2022-09-22 20:50 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-22 20:50 ` JohnGebbie
2022-09-23  8:55 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-23  9:14 ` JohnGebbie
2022-09-23 11:30 ` JohnGebbie
2022-09-23 17:21 ` JohnGebbie
2022-09-23 18:23 ` JohnGebbie
2022-09-26 22:16 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-26 22:18 ` JohnGebbie
2022-09-28 15:44 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-28 15:44 ` JohnGebbie
2022-09-28 15:53 ` JohnGebbie
2022-09-29 20:24 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-29 20:30 ` JohnGebbie
2022-09-30  9:15 ` JohnGebbie
2022-09-30 14:27 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-30 14:27 ` JohnGebbie
2022-09-30 14:30 ` JohnGebbie
2022-09-30 19:14 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-30 19:21 ` JohnGebbie
2022-09-30 19:47 ` JohnGebbie
2022-09-30 19:54 ` [PR PATCH] [Updated] " JohnGebbie
2022-09-30 21:15 ` JohnGebbie
2022-10-01 10:26 ` JohnGebbie
2022-10-02 16:27 ` JohnGebbie
2022-10-03 11:19 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-03 11:21 ` JohnGebbie
2022-10-03 12:39 ` JohnGebbie
2022-10-04 19:17 ` JohnGebbie
2022-10-08 12:13 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-08 12:15 ` JohnGebbie
2022-10-08 12:21 ` JohnGebbie
2022-10-08 14:32 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-08 15:52 ` JohnGebbie
2022-10-08 16:24 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-08 16:25 ` JohnGebbie
2022-10-08 16:33 ` JohnGebbie
2022-10-09 10:37 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-09 10:38 ` JohnGebbie
2022-10-09 10:46 ` JohnGebbie
2022-10-26 15:57 ` JohnGebbie
2022-10-26 15:57 ` JohnGebbie
2022-10-26 15:57 ` JohnGebbie
2022-10-26 15:58 ` JohnGebbie
2022-10-26 15:58 ` JohnGebbie
2022-10-26 15:58 ` JohnGebbie
2022-10-26 15:59 ` JohnGebbie
2022-10-26 15:59 ` JohnGebbie
2022-10-26 15:59 ` JohnGebbie
2022-10-26 16:00 ` JohnGebbie
2022-10-26 16:00 ` JohnGebbie
2022-10-26 16:00 ` JohnGebbie
2022-10-26 16:01 ` JohnGebbie
2022-10-27  9:59 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-27 10:18 ` JohnGebbie
2022-10-27 21:37 ` JohnGebbie
2022-10-28  8:33 ` JohnGebbie
2022-10-28  9:43 ` JohnGebbie
2022-10-28 17:01 ` [PR PATCH] [Updated] " JohnGebbie
2022-10-28 18:49 ` JohnGebbie
2022-10-28 20:15 ` JohnGebbie
2022-10-28 20:45 ` JohnGebbie
2022-10-28 21:42 ` JohnGebbie
2022-10-29  8:41 ` JohnGebbie
2022-10-29 11:45 ` JohnGebbie
2022-10-29 12:07 ` JohnGebbie
2022-10-29 14:09 ` JohnGebbie
2022-11-09 17:33 ` JohnGebbie
2022-11-14 22:54 ` [PR REVIEW] " paper42
2022-11-14 22:54 ` paper42
2022-11-14 22:54 ` paper42
2022-11-14 22:54 ` paper42
2022-11-14 22:54 ` paper42
2022-11-14 22:54 ` paper42
2022-11-14 22:54 ` paper42
2022-11-15 11:04 ` JohnGebbie
2022-11-15 13:38 ` [PR PATCH] [Updated] " JohnGebbie
2022-11-15 14:23 ` [PR REVIEW] " JohnGebbie
2022-11-15 14:24 ` JohnGebbie
2022-11-15 14:44 ` [PR PATCH] [Updated] " JohnGebbie
2022-11-15 14:54 ` [PR REVIEW] " JohnGebbie
2022-12-03 18:32 ` [PR PATCH] [Updated] " JohnGebbie
2022-12-03 18:37 ` JohnGebbie
2022-12-03 18:38 ` [PR REVIEW] " JohnGebbie
2022-12-03 18:43 ` JohnGebbie
2022-12-03 18:44 ` JohnGebbie
2022-12-03 18:47 ` JohnGebbie
2022-12-03 18:48 ` JohnGebbie
2022-12-03 20:52 ` JohnGebbie
2022-12-03 21:22 ` [PR PATCH] [Updated] " JohnGebbie
2022-12-03 21:26 ` JohnGebbie
2022-12-04  8:19 ` [PR PATCH] [Updated] " JohnGebbie
2022-12-04  8:21 ` JohnGebbie
2022-12-04 10:25 ` JohnGebbie
2022-12-04 12:46 ` [PR REVIEW] " paper42
2022-12-04 12:46 ` paper42
2022-12-04 12:46 ` paper42
2022-12-04 12:46 ` paper42
2022-12-04 12:46 ` paper42
2022-12-04 13:52 ` [PR PATCH] [Updated] " JohnGebbie
2022-12-04 13:55 ` [PR REVIEW] " JohnGebbie
2022-12-04 14:04 ` paper42
2022-12-04 14:33 ` [PR PATCH] [Updated] " JohnGebbie
2022-12-04 16:09 ` JohnGebbie
2022-12-04 16:10 ` [PR PATCH] [Merged]: " paper42
2022-12-04 16:11 ` JohnGebbie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).