summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/pfapack/package.py
blob: e225add627497b7e6a3c09f8d43e3ae3c95e70d9 (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-2020 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 import *


class Pfapack(MakefilePackage):
    """A library for numerically computing the Pfaffian of
       a real or complex skew-symmetric matrix. This is based on
       computing the tridiagonal form of the matrix under
       unitary congruence transformations."""

    homepage = "https://michaelwimmer.org/downloads.html"
    url      = "https://michaelwimmer.org/pfapack.tgz"

    version('2014-09-17', sha256='b68fc35dda23ee24c358641b1a92ef701c4ffa0b3f0b0808b24e68afeb58ef07')

    depends_on('lapack')
    depends_on('blas')
    depends_on('python', type=('build', 'run'))
    depends_on('py-numpy', type=('build', 'run'))
    depends_on('py-scipy', type=('build', 'run'))

    def edit(self, spec, prefix):
        filter_file('FORT =.*', 'FORT = {0}'.format(spack_fc),
                    join_path('fortran', 'makefile'))
        filter_file('CC =.*', 'CC = {0}'.format(spack_cc),
                    join_path('c_interface', 'makefile'))

    def build(self, spec, prefix):
        source_directory = self.stage.source_path
        with working_dir(join_path(source_directory, 'fortran')):
            make()
        with working_dir(join_path(source_directory, 'c_interface')):
            make()

    def install(self, spec, prefix):
        source_directory = self.stage.source_path
        mkdirp(prefix.fortran)
        install(join_path(source_directory, 'fortran', 'libpfapack.a'),
                prefix.fortran)
        install(join_path(source_directory, 'fortran', '*.mod'),
                prefix.fortran)
        install_tree(join_path(source_directory, 'fortran', 'EXAMPLES'),
                     prefix.fortran.EXAMPLES)
        install_tree(join_path(source_directory, 'fortran', 'TESTING'),
                     prefix.fortran.TESTING)
        mkdirp(prefix.c_interface)
        install(join_path(source_directory, 'c_interface', 'libcpfapack.a'),
                prefix.c_interface)
        install(join_path(source_directory, 'c_interface', 'fortran.h'),
                prefix.c_interface)
        install(join_path(source_directory, 'c_interface',
                          'fortran_pfapack.h'),
                prefix.c_interface)
        install(join_path(source_directory, 'c_interface', 'pfapack.h'),
                prefix.c_interface)
        install_tree(join_path(source_directory, 'c_interface', 'EXAMPLES'),
                     prefix.c_interface.EXAMPLES)
        install_tree(join_path(source_directory, 'c_interface', 'TESTING'),
                     prefix.c_interface.TESTING)
        install_tree(join_path(source_directory, 'python'), prefix.python)