summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0141d80275f1ee010c6207deb9c41d80d24ec70a (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
# Maintainer: aimileus <me at aimileus dot nl>
pkgname=('python-snowboy-git' 'python2-snowboy-git')
pkgbase=python-snowboy-git
_pkgname=snowboy
pkgver=v1.3.0.r31.g797a17e
pkgrel=1
pkgdesc="A hotword detection engine - Python bindings"
arch=('x86_64')
url="https://snowboy.kitt.ai/"
license=('Apache')
makedepends=(
  'git'
  'python-setuptools'
  'python2-setuptools'
  'swig'
  'cblas'
)
source=("git+https://github.com/Kitt-AI/snowboy.git")
md5sums=('SKIP')

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

prepare() {
  cp -a "${_pkgname}"{,-py2}

  sed -i -e "s|-lf77blas -lcblas -llapack -latlas|-lcblas|g" \
    -e 's| -shared| -Wl,-O1,--as-needed\0|g' \
    "${_pkgname}/swig/Python3/Makefile"
  sed -i -e "s|-lf77blas -lcblas -llapack -latlas|-lcblas|g" \
    -e 's| -shared| -Wl,-O1,--as-needed\0|g' \
    "${_pkgname}-py2/swig/Python/Makefile"
}

build() {
  cd "$srcdir/${_pkgname}"
  python setup.py build

  cd "$srcdir/${_pkgname}-py2"
  python2 setup.py build
}

package_python-snowboy-git() {
  conflicts=('python-snowboy')
  provides=('python-snowboy')
  depends=('cblas' 'python-pyaudio')

  cd "${_pkgname}"
  python setup.py install \
	  --root="$pkgdir" \
	  --optimize=1 \
	  --skip-build
}

package_python2-snowboy-git() {
  conflicts=('python2-snowboy')
  provides=('python2-snowboy')
  depends=('cblas' 'python2-pyaudio')

  cd "$_pkgname-py2"
  python2 setup.py install \
	  --root="$pkgdir" \
	  --optimize=1 \
	  --skip-build
}