summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/eq-r/package.py
blob: ab79ff0e51d284a7b339dcdb50752b20a486ad4f (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
# Copyright 2013-2021 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)

import os

from spack import *


class EqR(AutotoolsPackage):
    """
    EMEWS Queues for R (EQ/R)
    Installs EQ/R.
    """

    homepage = "http://emews.org"
    url      = "https://github.com/emews/EQ-R/archive/1.0.tar.gz"
    git      = "https://github.com/emews/EQ-R.git"

    version('master', branch='master')

    version('1.0', sha256='68047cb0edf088eaaefc5e36cefda9818292e5c832593e10a1dd9c73c27661b6')

    depends_on('autoconf', type='build')
    depends_on('automake', type='build')
    depends_on('libtool',  type='build')
    depends_on('m4',       type='build')
    depends_on('mpi')
    depends_on('r-rinside')
    depends_on('r-rcpp')
    depends_on('r')
    depends_on('tcl')
    depends_on('swig')

    configure_directory = 'src'

    def setup_build_environment(self, env):
        spec = self.spec
        env.set('CC', spec['mpi'].mpicc)
        env.set('CXX', spec['mpi'].mpicxx)
        env.set('CXXLD', spec['mpi'].mpicxx)

    def configure_args(self):
        args = ['--with-tcl=' + self.spec['tcl'].prefix]
        r_location = '{0}/rlib/R'.format(self.spec['r'].prefix)
        if not os.path.exists(r_location):
            rscript = which('Rscript')
            if rscript is not None:
                r_location = rscript('-e', 'cat(R.home())', output=str)
            else:
                msg = 'couldn\'t locate Rscript on your PATH'
                raise RuntimeError(msg)
        args.append('--with-r={0}'.format(r_location))
        return args