summaryrefslogtreecommitdiffstats
path: root/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi_git.bb
blob: 45cf71ff6415b72c633fff510845c19f161fe0e2 (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
SUMMARY = "Kaldi Speech Recognition Toolkit"
HOMEPAGE = "http://kaldi-asr.org/"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://../COPYING;md5=a10e448a64dbd3723ff3fb2f397fba2e \
                    file://doc/legal.dox;md5=3cba845003f27e67da70faa5da924c1e"

SRC_URI = "git://github.com/alphacep/kaldi.git;protocol=https;branch=vosk \
           file://0001-Fixes-for-shared-library-compilation.patch \
           "

PV = "1.0+git${SRCPV}"
SRCREV = "76cd51d44c0a61e3905c35cadb2ec5f54f3e42d1"

S = "${WORKDIR}/git/src"

DEPENDS += "openblas vosk-openfst"
inherit python3native

ALLOW_EMPTY_${PN} = "1"

MYCONF = "--mathlib=OPENBLAS --static --shared --use-cuda=no --fst-root=${STAGING_INCDIR}/../ --fst-version=1.8.0 --openblas-root=${STAGING_INCDIR}/../ "

# remove x86-specific optimizations
do_configure:prepend:aarch64(){

sed -i -e "s#-msse -msse2##g" ${S}/makefiles/linux_openblas.mk

}

do_configure:prepend:arm(){

sed -i -e "s#-msse -msse2##g" ${S}/makefiles/linux_openblas.mk

}


do_configure() {

  ./configure ${MYCONF}

}

do_compile() {

  make ${PARALLEL_MAKE}

}

do_install() {

  install -d ${D}${libdir}

  for i in lib/*.so ; do
    install -m 0644 ${i} ${D}${libdir}/
  done

  for i in */*.a ; do
    install -m 0644 ${i} ${D}${libdir}/
  done

  for j in base chain decoder feat fstext gmm gst-plugin hmm itf ivector kws lat lm matrix nnet nnet2 nnet3 online online2 rnnlm sgmm2 tfrnnlm transform tree util cudadecoder  cudadecoderbin  cudafeat  cudamatrix ; do
    install -d ${D}${includedir}/kaldi/$j
    for i in $j/*.h ; do 
      install -m 0644 $i ${D}${includedir}/kaldi/$j/
    done
  done

  # make sure we have the package vosk-kaldi

  install -d ${D}/usr/share/kaldi
  echo "This is vosk-kaldi" > ${D}/usr/share/kaldi/README

}

FILES:${PN} += " /usr/share/kaldi  /usr/share/kaldi/README"
ERROR_QA:remove = "rpaths"
ERROR_QA:remove = "dev-elf"