blob: 9381d065cb4fe7de03f1c01d90be51d7f388f980 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
pkgbase=stt
pkgname=('stt' 'python-stt')
_pkgname=STT
pkgver=1.4.0
pkgrel=1
pkgdesc="Coqui-STT for inference"
arch=('x86_64' 'aarch64' 'armv7' 'amd64')
url="https://github.com/coqui-ai/STT"
license=('MPL2')
makedepends=('gcc' 'cmake' 'bazel' 'git' 'sox' 'wget' 'swig')
depends=('python' 'sox')
source=("${_pkgname}-${pkgver}::git+https://github.com/coqui-ai/STT.git#tag=main")
sha256sums=('SKIP')
prepare()
{
python -m ensurepip --upgrade --default-pip
pip install -U wheel numpy
cd "$srcdir/${_pkgname}-${pkgver}"
git submodule sync tensorflow/
git submodule update --init tensorflow/
cd tensorflow
ln -sf ../native_client
}
build() {
cd "$srcdir/${_pkgname}-${pkgver}/tensorflow"
export PYTHON_BIN_PATH=/usr/bin/python
export USE_DEFAULT_PYTHON_LIB_PATH=1
export TF_NEED_OPENCL_SYCL=0
export TF_ENABLE_XLA=1
export TF_NEED_MPI=0
export TF_SET_ANDROID_WORKSPACE=0
export TF_NEED_ROCM=0
export TF_DOWNLOAD_CLANG=0
export TF_NEED_CUDA=0
export CC_OPT_FLAGS="-march=${arch}"
#rm .bazelversion
./configure
if [[ $arch == "x86_64" ]]; then
bazel build \
--workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" \
-c opt \
--copt=-mtune=generic \
--copt=-march=x86-64 \
--copt=-msse \
--copt=-msse2 \
--copt=-msse3 \
--copt=-msse4.1 \
--copt=-msse4.2 \
--copt=-mavx \
--config=noaws \
--config=nogcp \
--config=nohdfs \
--config=nonccl \
--copt=-fvisibility=hidden \
--verbose_failures \
//native_client:libstt.so
elif [[ $arch == "aarch64" ]]; then
bazel build \
--workspace_status_command="bash native_client/bazel_workspace_status_cmd.sh" \
--config=monolithic \
-c opt \
--config=rpi3-armv8_opt
--verbose_failures \
//native_client:libstt.so
fi;
cd "${srcdir}/${_pkgname}-${pkgver}/native_client"
if [[ $arch == "x86_64" ]]; then
make stt SOX_LDFLAGS="-lsox -Wl,-no-undefined"
elif [[ $arch == "aarch64" ]]; then
make TARGET=rpi3-armv8 stt SOX_LDFLAGS="-lsox -Wl,-no-undefined"
fi;
make bindings -C python
make bindings -C ctcdecode
}
package_stt() {
depends=('sox' 'python-libclang' 'tensorflow-io-gcs-filesystem' 'protobuf')
cd "${srcdir}/${_pkgname}-${pkgver}/native_client"
PREFIX="${pkgdir}"/usr make install
}
package_python-stt() {
pkgdesc="Coqui STT Python bindings"
depends=('stt' 'python-numpy')
cd "${srcdir}/${_pkgname}-${pkgver}/native_client"
PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps python/dist/stt-*.whl
#PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps ctcdecode/dist/*.whl
#mv "$pkgdir/usr/bin/stt" "$pkgdir/usr/bin/stt_python"
cp -rv "${srcdir}/${_pkgname}-${pkgver}/training/coqui_stt_training" "$pkgdir"`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
}
|