summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: dce32b7343af7f571aed03ec1e594e37e1abeb56 (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: Renato Caldas <renato@calgera.com>
# Contributor: Carlos Aznarán <caznaranl@uni.pe>
pkgname=('basix-git' 'python-fenics-basix-git')
#pkgbase='python-fenics-basix-git'
pkgdesc='FEniCS finite element basis evaluation library'
pkgver="0.7.0.dev0"_r934.571d504
pkgrel=1
arch=('x86_64')
url='https://fenicsproject.org'
license=('MIT')
groups=('dolfinx-git')
makedepends=('git' 'cmake' 'python-build' 'python-installer' 'python-wheel'
        'python-setuptools' 'pybind11' 'python-scikit-build-core' 'chrpath')
conflicts=('basix' 'fenics-basix-git' 'python-fenics-basix' 'python-basix-git')
source=('git+https://github.com/FEniCS/basix')
sha512sums=('SKIP')

pkgver()  {
    cd "$srcdir/basix"
    # The main repo unfortunately has no meaningful tags..
    printf "%s_r%s.%s" "$(sed -n -e 's/^version *= *\(.*\)/\1/p' pyproject.toml)" \
        "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)"
}

prepare() {
    git -C "${srcdir}/basix" clean -dfx
}

build() {
    cd "$srcdir/basix"

    # Build c++ library
    cmake -DCMAKE_BUILD_TYPE="Release" \
        -S cpp \
        -B build \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -Wno-dev
    cmake --build build

    # HACK: Install to temporary dir, required for building the wheel
    export DESTDIR="$srcdir/tmp"
    cmake --install build

    # Build the python wheel
    export CMAKE_PREFIX_PATH="$srcdir/tmp/usr"
    python -m build --wheel --no-isolation "$srcdir/basix/python"
}

package_basix-git() {
    depends=('blas' 'lapack')

    cd "$srcdir/basix"
    DESTDIR="$pkgdir" cmake --install build
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/basix-git/LICENSE"
}

package_python-fenics-basix-git() {
    depends=('basix-git' 'python-fenics-ufl-git' 'python-numpy')
    optdepends=('python-numba: for Numba helper function support')

    cd "$srcdir/basix/python"
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -Dm644 ../LICENSE "$pkgdir/usr/share/licenses/python-fenics-basix-git/LICENSE"

    # Remove insecure runpath
    find "$pkgdir" -iname "_basixcpp*so" | xargs chrpath --delete
}