summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2948f158018f0143616abfcfed3f42d5022de01d (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
# Maintainer: Carlos Aznarán <caznaranl@uni.pe>
pkgname=dolfinx
pkgdesc="Next generation FEniCS problem solving environment"
pkgver=0.8.0
pkgrel=1
arch=(x86_64)
url="https://github.com/FEniCS/${pkgname}"
license=(LGPL-3.0-or-later GPL-3.0-or-later)
depends=(adios2 boost kahip parmetis-git pugixml python-fenics-ffcx scotch petsc) # slepc
makedepends=(cmake)
checkdepends=(catch2)
# optdepends=('adios2: for use ADIOS2 writer'
#   'kahip: for compute graph partition in parallel'
#   'parmetis: for parallel graph partitioning'
#   'slepc: for use SLEPc eigen solver')
source=(${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz)
sha512sums=('2f3ee72733f058bfa77548a3f5955fd43ad24a1d5643a26cf513b263c9ae089d73b7062bc8ebc9986baebc26804f9763a7ef8f957ff1b532605ad96310862d35')

prepare() {
  sed -i 's/^wheel.license-files/#wheel.license-files/' ${pkgname}-${pkgver}/cpp/CMakeLists.txt
}

build() {
  cmake \
    -S ${pkgname}-${pkgver}/cpp \
    -B build \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=TRUE \
    -DCMAKE_CXX_STANDARD=20 \
    -DCMAKE_C_COMPILER=gcc \
    -DCMAKE_CXX_COMPILER=g++ \
    -DDOLFINX_ENABLE_ADIOS2=ON \
    -DDOLFINX_ENABLE_PETSC=ON \
    -DDOLFINX_ENABLE_PARMETIS=ON \
    -DDOLFINX_ENABLE_SCOTCH=ON \
    -DDOLFINX_ENABLE_SLEPC=OFF \
    -DDOLFINX_ENABLE_KAHIP=ON \
    -DDOLFINX_SKIP_BUILD_TESTS=OFF \
    -Wno-dev
  cmake --build build --target all
}

check() {
  ffcx ${pkgname}-${pkgver}/cpp/test/poisson.py -o ${pkgname}-${pkgver}/cpp/test
  DESTDIR="${PWD}/tmp_install" cmake --build build --target install

  CMAKE_PREFIX_PATH="${srcdir}/tmp_install/usr/lib/cmake/${pkgname}" cmake \
    -S ${pkgname}-${pkgver}/cpp/test \
    -B build_test
  cmake --build build_test
  ctest --test-dir build_test

  CMAKE_PREFIX_PATH="${srcdir}/tmp_install/usr/lib/cmake/${pkgname}" cmake \
    -S ${pkgname}-${pkgver}/cpp/demo \
    -B build_demo
  cmake --build build_demo
  ctest -E "(demo_poisson_mpi_*|demo_hyperelasticity_mpi_*|demo_biharmonic_mpi_*)" --test-dir build_demo
}

package() {
  DESTDIR="${pkgdir}" cmake --build build --target install
  install -Dm 644 ${pkgname}-${pkgver}/COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}