summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cf7aadfec813a0cfb6d895579a424bb357ebb402 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Maintainer: Joelton D. Brandão <joeltondbrandao at freedxm dot com>
# Maintainer: Ruben Di Battista  <rubendibattista at gmail dot com>
# Contributor: Tobias M. Baust <tobias.baust at tutanota dot com>

_pkgname=cantera
pkgname="${_pkgname}"
pkgver=3.2.0
pkgrel=5
pkgdesc='suite of tools for kinetics, thermodynamics, and transport processes'
arch=('x86_64')
url='https://cantera.org/'
license=('custom:Cantera Developers' 
         'custom:Sandia Corporation Contract AC04-94AL85000'
         'custom:California Institute of Technology')
depends=('python-numpy' 'openmp' 'yaml-cpp' 'fmt' 'boost-libs' 'sundials-seq' 'python' 'hdf5')
makedepends=('scons' 'git' 'gcc' 'doxygen' 'cython' 'eigen' 'boost' 'python-pip' 'python-setuptools' 'patch' 'highfive') 
checkdepends=('gtest' 'gmock' 'python-ruamel-yaml' 'python-pytest')
conflicts=('cantera-git')
provides=('libcantera_shared.so=2-64')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/Cantera/cantera/archive/v${pkgver}.tar.gz"
        "cantera-example-data-${pkgver}.tar.gz::https://github.com/Cantera/cantera-example-data/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('f01e25e33f9d5e37db7ababe5af36b60caabff52dba04bb221d53e44735f60ec'
            '1b52e0d4e90c3b90213d71893167d13a27fec2790c9d79fbd6f3e71e0f778e4a')

prepare() {
    mv "${_pkgname}-${pkgver}" "${_pkgname}"
    rm -rf "${_pkgname}/data/example_data"
    mv "cantera-example-data-${pkgver}" "${_pkgname}/data/example_data"

    cd "$_pkgname"
    sed -i 's/self._selected_species.resize(len(species))/self._selected_species = np.empty(len(species), dtype=np.uint64)/' \
        interfaces/cython/cantera/solutionbase.pyx
}

build() {
    cd "$_pkgname"
    scons -j $(nproc) build \
        prefix="/usr" \
        debug='n' \
        system_eigen='y' \
        system_sundials='y' \
        system_fmt='y' \
        googletest='system' \
        hdf_support='y' \
        system_highfive='y' \
        system_yamlcpp='y' \
        system_blas_lapack='y' \
        python_package='y'
    scons doxygen
    scons samples
}

check() {
    cd "$_pkgname"
    scons -j $(nproc) test
    scons test-clean
}

package() {
  cd "$_pkgname"
  _python_v=$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
  install -Dm644 License.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  scons install prefix=/usr stage_dir="$pkgdir"
  chmod 755 "$pkgdir/usr/lib/python${_python_v}/site-packages"

  # Fix pkg-config file, because of conflits with install in the /usr dir
  pcfile="$pkgdir/usr/lib/pkgconfig/cantera.pc"
  cat > "$pcfile" <<EOF
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: Cantera
Description: Cantera library
URL: https://cantera.org
Version: ${pkgver}

Libs: -L${libdir} -lcantera_shared -lfmt -lpthread
Cflags: -std=c++17 -pthread
EOF
}