summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 108c07db03067dd65736c0fc8d5ce7755c113bec (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
# Maintainer: Pieter Robyns <pieter.robyns@uhasselt.be>
# Upstream URL: https://github.com/tensorflow/tensorflow

pkgname=tensorflow-git
pkgver=0.5.0.r14.g1d76583
pkgrel=1
pkgdesc="Open source software library for numerical computation using data flow graphs."
arch=('i686' 'x86_64')
url="https://tensorflow.org/"
license=('Apache2')
provides=('tensorflow')
conflicts=('tensorflow' 'python2-tensorflow')
depends=('python2-numpy' 'swig' 'python2-wheel')
makedepends=('git' 'python2-pip' 'bazel')
source=("git+https://github.com/tensorflow/tensorflow"
        "git+https://github.com/google/protobuf")
md5sums=('SKIP' 'SKIP')

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

prepare() {
  # Config submodules
  cd "$srcdir/tensorflow"
  git submodule init
  git config submodule.google/protobuf.url $srcdir/protobuf
  git submodule update

  # Set up some things for building
  export PYTHON=python2
  mkdir -p "$srcdir/tmp"
}

build() {
  echo "Make sure your .bazelrc points to the correct workspace, e.g. %workspace%:/opt/bazel/base_workspace."

  # Build tensorflow
  cd "$srcdir/tensorflow"

  ./configure
  bazel build --jobs 2 -c opt //tensorflow/tools/pip_package:build_pip_package

  sed -i 's/python/python2/g' bazel-bin/tensorflow/tools/pip_package/build_pip_package
  bazel-bin/tensorflow/tools/pip_package/build_pip_package $srcdir/tmp
}

package() {
  cd "$srcdir/tensorflow"

  TMP_PKG=`find $srcdir/tmp -name "tensor*.whl"`
  pip2 install --upgrade --root $pkgdir/ $TMP_PKG --no-dependencies
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}