summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d84cfb09c1317b0eb2ac17c1c8aaf50a3b1577a3 (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
# Maintainer: Jonas Heinrich <onny@project-insanity.org>
# Contributor: Jonas Heinrich <onny@project-insanity.org>

pkgname=deepspeech-git
_pkgname=DeepSpeech
pkgver=0.1.1
pkgrel=4
pkgdesc="A TensorFlow implementation of Baidu's DeepSpeech architecture"
arch=('x86_64')
url="https://github.com/mozilla/DeepSpeech"
license=('MPL2')
depends=('sox')
makedepends=('bazel' 'python' 'sox')
source=("git+https://github.com/mozilla/DeepSpeech.git"
	"git+https://github.com/mozilla/tensorflow.git")
sha512sums=('SKIP'
	    'SKIP')

#pkgver() {
#  cd "$_pkgname"
#  git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
#}

prepare() {
  cd "$srcdir/tensorflow"
  # These environment variables influence the behavior of the configure call below.
  export PYTHON_BIN_PATH=/usr/bin/python
  export USE_DEFAULT_PYTHON_LIB_PATH=1
  export TF_NEED_JEMALLOC=1
  export TF_NEED_KAFKA=0
  export TF_NEED_OPENCL_SYCL=0
  export TF_NEED_GCP=0
  export TF_NEED_HDFS=0
  export TF_NEED_S3=0
  export TF_ENABLE_XLA=1
  export TF_NEED_GDR=0
  export TF_NEED_VERBS=0
  export TF_NEED_OPENCL=0
  export TF_NEED_MPI=0
  export TF_NEED_TENSORRT=0
  export TF_SET_ANDROID_WORKSPACE=0
  export TF_DOWNLOAD_CLANG=0
  ln -sf ../DeepSpeech/native_client ./
}

build() {
  cd "$srcdir/tensorflow"

  export CC_OPT_FLAGS="-march=native"
  export TF_NEED_CUDA=0
  ./configure
  bazel build -c opt --copt=-O3 //native_client:libctc_decoder_with_kenlm.so
  bazel build --config=monolithic -c opt --copt=-O3 --copt=-fvisibility=hidden //native_client:libdeepspeech.so //native_client:deepspeech_utils //native_client:generate_trie

  cd "${srcdir}/DeepSpeech/native_client"
  TFDIR="${srcdir}/tensorflow" make deepspeech
}

package() {
  cd "${srcdir}/DeepSpeech/native_client"
  TFDIR="${srcdir}/tensorflow" PREFIX="${pkgdir}/usr" make install
}