archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / tensorboard / trunk / PKGBUILD
blobc7f8034bae6b6363354f247feb50a8812309403d
1 # Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
2 # Contributor: Konstantin Gizdov <arch at kge dot pw>
4 pkgname=tensorboard
5 pkgver=2.12.1
6 pkgrel=2
7 pkgdesc="TensorFlow's Visualization Toolkit"
8 url='https://github.com/tensorflow/tensorboard'
9 arch=('x86_64')
10 license=('APACHE')
11 depends=('python' 'python-werkzeug' 'python-numpy' 'python-bleach' 'python-wheel' 'python-markdown'
12          'python-html5lib' 'python-protobuf' 'python-grpcio' 'python-google-auth-oauthlib'
13          'python-tensorboard_plugin_wit' 'absl-py')
14 makedepends=('bazel' 'python-setuptools' 'tree' 'rust' 'python-build' 'python-installer' 'python-wheel' 'git')
15 optdepends=('python-tensorflow: advanced features for TensorBoard')
16 source=(
17   "${pkgname}-${pkgver}.tar.gz::https://github.com/tensorflow/tensorboard/archive/${pkgver}.tar.gz"
18   https://github.com/bazelbuild/bazel/releases/download/5.4.0/bazel_nojdk-5.4.0-linux-x86_64
20 options=('!lto')
21 sha512sums=('74571e442ff3488724ab41d8fb6fe76d976b1a56e5f68285567b9f9144cef45fa53b2b08caf765f823949184b70406ffca4b4c34c239038c7db99739e78aeffc'
22             'e2adb747cd1fe3c90686831703618af3f8bc8197a96d9e1e90e66db38dbc4e7a94d88dac755b25e288002983a87fcffbfb0d7c2e356d979d4635301c3daf9281')
24 prepare() {
25   # Since tensorboard is currently imcompatible with Bazel 6, we're going to use
26   # a local Bazel 5 to fix that. Stupid problems call for stupid solutions.
27   install -Dm755 "${srcdir}"/bazel_nojdk-5.4.0-linux-x86_64 bazel/bazel
28   export PATH="${srcdir}/bazel:$PATH"
29   bazel --version
31   cd "$pkgname-$pkgver"
33   # Remove fixed version requirements as we usually ship more up-to-date
34   # versions than are specified and it tends to work fine anyhow.
35   sed -i "s/[<>=].*//" tensorboard/pip_package/requirements.txt
38 build() {
39   cd "$pkgname-$pkgver"
41   PYTHONWARNINGS=ignore bazel build //tensorboard
42   bazel build //tensorboard/pip_package:build_pip_package
44   cd tensorboard/data/server
45   cargo build --release
46   python pip_package/build.py --server-binary target/release/rustboard --out-dir /tmp
47   cd "$srcdir/$pkgname-$pkgver"
49   mkdir pypackage
50   cp -R bazel-bin/tensorboard/pip_package/build_pip_package.runfiles/org_tensorflow_tensorboard/external pypackage
51   cp -R bazel-bin/tensorboard/pip_package/build_pip_package.runfiles/org_tensorflow_tensorboard/tensorboard pypackage
52   cp tensorboard/pip_package/{README.rst,MANIFEST.in,setup.py,requirements.txt} pypackage
53   cp README.md pypackage
54   cd pypackage
55   python -m build --wheel --no-isolation
58 package() {
59   local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
61   cd "$pkgname-$pkgver"
63   install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
65   python -m installer --destdir="$pkgdir" /tmp/*.whl
67   cd pypackage
68   python -m installer --destdir="$pkgdir" dist/*.whl
70   rm -r "$pkgdir/$site_packages/external/"
73 # vim:set ts=2 sw=2 et: