summaryrefslogtreecommitdiffstats
path: root/meta-offline-voice-agent/recipes-vosk/vosk-kaldi/vosk-kaldi_git.bb
blob: 0630abcb4373bc48082ce03ca8cf203c36813630 (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
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 \
           file://0001-Fixup-wrappers-for-compilation-with-openblas-0.3.27.patch;patchdir=.. \
           "

PV = "1.0+git${SRCPV}"
SRCREV = "a25f216f5ce4eec5e45a6ab7651e20c9840a05cd"
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"