summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/h5z-zfp/package.py
blob: f90a244ed8f83207e76a6b294ea16bcd82cdeab3 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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 H5zZfp(MakefilePackage):
    """A highly flexible floating point and integer compression plugin for the
    HDF5 library using ZFP compression."""

    homepage = "https://h5z-zfp.readthedocs.io/en/latest"
    git = "https://github.com/LLNL/H5Z-ZFP.git"
    url = "https://github.com/LLNL/H5Z-ZFP/archive/refs/tags/v1.1.1.tar.gz"

    maintainers("markcmiller86", "brtnfld", "byrnHDF")

    version("develop", branch="master")
    version("1.1.1", sha256="921af7b9d1c8c46c036b46544f2785f69d405c0701abe1c1ce3aca2bd5899171")
    version("1.1.0", sha256="48a81e69d1f3b61d9a1eb07e868164fadf3b88690ec930efd849f5889681a893")
    version("1.0.1", sha256="b9ed91dab8e2ef82dc6706b4242c807fb352875e3b21c217dd00782dd1a22b24")
    version("0.8.0", sha256="a5eb089191369a5e929c51ec9e5da107afaee39c6ab3b7ad693c454319ab9217")
    version("0.7.0", sha256="f728b0bcb9e9cf8bafe05909ab02fec39415635d275e98b661176f69d34f87b3")

    variant("fortran", default=True, description="Enable Fortran support")

    depends_on("hdf5+fortran", when="+fortran")
    depends_on("hdf5", when="~fortran")
    depends_on("mpi", when="^hdf5+mpi")
    depends_on("zfp bsws=8")

    patch(
        "https://github.com/LLNL/H5Z-ZFP/commit/983a1870cefff5fdb643898a14eda855c2c231e4.patch?full_index=1",
        sha256="07a53b8b0d4c1df62a3f9f21b30ad0eb90f26b38eb6cacc0de6482fd8f5daea2",
        when="@1.0.1",
    )
    patch("config.make.patch", when="@0.7.0:0.8.0")
    patch("config.make.0.7.0.patch", when="@0.7.0")
    patch("Makefile.0.7.0.patch", when="@0.7.0")
    patch("fj.patch", when="@0.7.0: %fj")

    @property
    def make_defs(self):
        cc = spack_cc
        fc = spack_fc
        if "^hdf5+mpi" in self.spec:
            cc = self.spec["mpi"].mpicc
            fc = self.spec["mpi"].mpifc
        make_defs = [
            "PREFIX=%s" % prefix,
            "CC=%s" % cc,
            "HDF5_HOME=%s" % self.spec["hdf5"].prefix,
            "ZFP_HOME=%s" % self.spec["zfp"].prefix,
        ]

        if "+fortran" in self.spec and fc:
            make_defs += ["FC=%s" % fc]
        else:
            make_defs += ["FC="]

        return make_defs

    @property
    def build_targets(self):
        targets = ["all"]
        return self.make_defs + targets

    @property
    def install_targets(self):
        make_args = ["install"]
        return make_args + self.make_defs

    @run_after("build")
    @on_package_attributes(run_tests=True)
    def check_build(self):
        make("check", *self.make_defs, parallel=False)