summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/hypre/package.py
blob: 242ee100d7a071ed7825973310754ce5d2185c21 (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
from spack import *
import os

class Hypre(Package):
    """Hypre is a library of high performance preconditioners that
       features parallel multigrid methods for both structured and
       unstructured grid problems."""

    homepage = "http://computation.llnl.gov/project/linear_solvers/software.php"
    url      = "http://computation.llnl.gov/project/linear_solvers/download/hypre-2.10.0b.tar.gz"

    version('2.10.1', 'dc048c4cabb3cd549af72591474ad674')
    version('2.10.0b', '768be38793a35bb5d055905b271f5b8e')

    variant('shared', default=True, description="Build shared library version (disables static library)")

    depends_on("mpi")
    depends_on("blas")
    depends_on("lapack")

    def install(self, spec, prefix):
        blas_dir = spec['blas'].prefix
        lapack_dir = spec['lapack'].prefix
        mpi_dir = spec['mpi'].prefix

        os.environ['CC'] = os.path.join(mpi_dir, 'bin', 'mpicc')
        os.environ['CXX'] = os.path.join(mpi_dir, 'bin', 'mpicxx')
        os.environ['F77'] = os.path.join(mpi_dir, 'bin', 'mpif77')


        configure_args = [
                "--prefix=%s" % prefix,
                "--with-lapack-libs=lapack",
                "--with-lapack-lib-dirs=%s/lib" % lapack_dir,
                "--with-blas-libs=blas",
                "--with-blas-lib-dirs=%s/lib" % blas_dir]
        if '+shared' in self.spec:
            configure_args.append("--enable-shared")

        # Hypre's source is staged under ./src so we'll have to manually
        # cd into it.
        with working_dir("src"):
            configure(*configure_args)

            make()
            make("install")