# Maintainer: Daniel Bershatsky <bepshatsky@yandex.ru> pkgname=python-jaxlib pkgver=0.5.3 pkgrel=1 pkgdesc='XLA library for JAX' arch=('x86_64') url='https://github.com/jax-ml/jax/' license=('Apache-2.0') groups=('jax') depends=('python-absl' 'python-ml-dtypes>=0.4.0' 'python-numpy' 'python-scipy') makedepends=('clang18' 'python-build' 'python-installer' 'python-setuptools' 'python-wheel') _bazel_ver=7.4.1 source=("jax-${pkgver}.tar.gz::$url/archive/refs/tags/jax-v${pkgver}.tar.gz" "bazel-${_bazel_ver}-linux-x86_64::https://github.com/bazelbuild/bazel/releases/download/${_bazel_ver}/bazel-${_bazel_ver}-linux-x86_64") sha256sums=('1094581a30ec069965f4e3e67d60262570cc3dd016adc62073bc24347b14270c' 'c97f02133adce63f0c28678ac1f21d65fa8255c80429b588aeeba8a1fac6202b') prepare() { ln -sf $(readlink bazel-${_bazel_ver}-linux-x86_64) $srcdir/jax-jax-v${pkgver}/build chmod +x $srcdir/bazel-${_bazel_ver}-linux-x86_64 } build() { # Override default version. export JAXLIB_RELEASE=$pkgver cd $srcdir/jax-jax-v$pkgver python build/build.py build \ --wheels=jaxlib \ --bazel_path="$srcdir/bazel-${_bazel_ver}-linux-x86_64" \ --bazel_startup_options="--output_user_root=$srcdir/bazel"\ --bazel_options='--action_env=JAXLIB_RELEASE' \ --use_clang --clang_path='/usr/lib/llvm18/bin/clang' \ --target_cpu_features=release \ --verbose } package() { cd jax-jax-v$pkgver install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" python -m installer --compile-bytecode=1 --destdir=$pkgdir \ dist/jaxlib-$pkgver-*.whl }