summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b1c290c9cf69adca7a52790b6cb9b30d12afbe7e (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
# Maintainer: Carlos Aznarán <caznaranl@uni.pe>
pkgbase=opm-common
pkgname=("${pkgbase}" python-"${pkgbase}")
_dunever=2.10.0
pkgver=2024.10
pkgrel=1
pkgdesc="Open Porous Media Initiative shared infrastructure"
arch=(x86_64)
url="https://github.com/OPM/${pkgbase}"
license=(GPL-3.0-or-later)
makedepends=("dune-common>=${_dunever}" boost fmt10 cjson suitesparse texlive-basic doxygen graphviz
  pybind11 python-scikit-build python-setuptools-scm python-pytest-runner)
options=(!emptydirs)
source=(${pkgbase}-release-${pkgver}-final.tar.gz::${url}/archive/release/${pkgver}/final.tar.gz)
sha512sums=('4e9eaa455e1eb417deceae0f5da8c93c89f23ce72705c5ab7c152ee36382f8377b119035ef793f1f386e6e5b2e0c0aed549901816515292da175d876df6cab57')

# prepare() {
#   # I guess, patches are required if fmt>=11
#   sed -i '57 a #include <fmt/ranges.h>' ${pkgbase}-release-${pkgver}-final/opm/input/eclipse/EclipseState/EclipseState.cpp
#   sed -i '24 a #include <fmt/ranges.h>' ${pkgbase}-release-${pkgver}-final/opm/input/eclipse/EclipseState/Grid/FaceDir.cpp
#   sed -i '37 a #include <fmt/ranges.h>' ${pkgbase}-release-${pkgver}-final/opm/input/eclipse/Schedule/Action/ASTNode.cpp
#   sed -i '50 a #include <fmt/ranges.h>' ${pkgbase}-release-${pkgver}-final/opm/input/eclipse/Schedule/Well/WellKeywordHandlers.cpp
# }

build() {
  cmake \
    -S ${pkgbase}-release-${pkgver}-final \
    -B build-cmake \
    -DCMAKE_BUILD_TYPE=None \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DBUILD_SHARED_LIBS=1 \
    -DCMAKE_CXX_STANDARD=17 \
    -DCMAKE_C_COMPILER=gcc \
    -DCMAKE_CXX_COMPILER=g++ \
    -DCMAKE_C_FLAGS='-Wall -fdiagnostics-color=always' \
    -DCMAKE_CXX_FLAGS="-Wall -fdiagnostics-color=always -mavx" \
    -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
    -DUSE_MPI=1 \
    -DOPM_ENABLE_PYTHON=ON \
    -DOPM_ENABLE_EMBEDDED_PYTHON=OFF \
    -DOPM_INSTALL_PYTHON=OFF \
    -DBUILD_EXAMPLES=OFF \
    -Wno-dev
  cmake --build build-cmake --target opmcommon_python
}

package_opm-common() {
  depends=("dune-common>=${_dunever}" boost fmt cjson)
  provides=('arraylist' 'co2brinepvt' 'compareECL' 'convertECL' 'opmhash' 'opmi' 'opmpack' 'rewriteEclFile' 'rst_deck' 'summary')
  optdepends=('bash-completion: for completion when using bash'
    'man-db: manual pages for compareECL, convertECL, opmhash, opmpack, rst_deck and summary')
  DESTDIR="${pkgdir}" cmake --build build-cmake --target install install-html
  install -Dm644 ${pkgbase}-release-${pkgver}-final/LICENSE "${pkgdir}/usr/share/licenses/${pkgbase}/LICENSE"
  cd "${pkgdir}"
  rm -r usr/build-cmake
}

package_python-opm-common() {
  depends=("opm-common>=${pkgver}" python-numpy)
  pkgdesc+=" (python bindings)"
  cd build-cmake/python
  PYTHONPYCACHEPREFIX="${PWD}/.cache/cpython/" python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1 --skip-build
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  mv opm ${pkgdir}/${site_packages}/opm
}