summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f181d3b36641f107484448787769179aabef508c (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
# Maintainer: Tyler Veness <calcmogul at gmail dot com>

pkgname=sleipnirgroup-sleipnir-git
pkgver=0.0.1.r254.g791d6a0
pkgrel=1
pkgdesc="A sparsity and linearity-exploiting interior-point solver, now with readable internals"
arch=('x86_64')
url='https://github.com/SleipnirGroup/Sleipnir'
depends=('eigen-git' 'python-numpy' 'python-scipy')
makedepends=('cmake' 'nanobind' 'python-build' 'python-installer' 'python-py-build-cmake')
checkdepends=('python-pytest')
license=('BSD')
options=('!strip' 'staticlibs')
source=('git+https://github.com/SleipnirGroup/Sleipnir')
md5sums=('SKIP')

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

prepare() {
  cd "$srcdir"/Sleipnir
  ./tools/update_version.py
}

build() {
  cmake -B build -S "Sleipnir" \
    -DUSE_SYSTEM_EIGEN=ON \
    -DUSE_SYSTEM_NANOBIND=ON \
    -DCMAKE_INSTALL_PREFIX='/usr'
  cmake --build build

  cd "$srcdir"/Sleipnir
  python -m build --wheel --no-isolation
}

check() {
  ctest --test-dir build

  cd "$srcdir"/Sleipnir
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  cp .py-build-cmake_cache/cp${python_version}-cp${python_version}-linux_$CARCH/_jormungandr.cpython-${python_version}-$CARCH-linux-gnu.so jormungandr
  PYTHONPATH=. pytest
}

package() {
  cmake --install build --prefix "$pkgdir"/usr

  cd "$srcdir"/Sleipnir
  python -m installer --destdir="$pkgdir" dist/*.whl
}