summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/reprimand/package.py
blob: 504924f6e3002f8c511b6319927428bb57d4f975 (plain) (blame)
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
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Reprimand(MesonPackage):
    """RePrimAnd: Recovery of Primitives And EOS framework

    RePrimAnd is a support library for numerical simulations of general
    relativistic magnetohydrodynamics. It provides methods for recovering
    primitive variables like pressure and velocity from the variables evolved
    in quasi-conservative formulations. Further, it provides a general
    framework for handling matter equations of state."""

    homepage = "https://wokast.github.io/RePrimAnd/index.html"
    url = "https://github.com/wokast/RePrimAnd/archive/refs/tags/v1.3.tar.gz"

    maintainers("eschnett")

    license("CC-BY-NC-SA-4.0")

    version("develop", git="https://github.com/wokast/RePrimAnd", branch="public")
    version("1.5", sha256="bc71030c1ae337c3631cfc7e46270260b0663e4ad73129148bf443c9220afb86")
    version("1.4", sha256="260730696175fa21d35d1a92df2c68b69243bb617083c82616efcb4720d557e8")
    version("1.3", sha256="8e9f05b1f065a876d1405562285a9f64d1b31c4a436d5a6bb1f023212b40314e")

    # Add missing #include statments; see
    # <https://github.com/wokast/RePrimAnd/issues/3>
    patch("include.patch", when="@1.3")

    variant("python", default=False, description="Enable Python bindings")
    variant("shared", default=True, description="Build shared library")

    depends_on("boost +json +math +test")
    depends_on("gsl")
    depends_on("hdf5")
    depends_on("python", when="+python")
    depends_on("py-matplotlib", when="+python")
    depends_on("py-pybind11 @2.6.0:", when="+python")

    extends("python", when="+python")

    def setup_build_environment(self, env):
        env.set("CXXFLAGS", self.compiler.cxx11_flag)
        env.set("BOOST_ROOT", self.spec["boost"].prefix)

    def meson_args(self):
        args = []
        if self.spec.satisfies("@:1.4"):
            args.extend(
                [
                    "-Dbuild_documentation=false",
                    "-Dbuild_python_api={0}".format(str("+python" in self.spec).lower()),
                ]
            )
        return args

    @property
    def libs(self):
        shared = "+shared" in self.spec
        return find_libraries("libRePrimAnd*", root=self.prefix, shared=shared, recursive=True)