summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/r-nloptr/package.py
blob: 9607bd1faab4e9f423b5a82a8a9738cbd4bcd400 (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
# Copyright 2013-2019 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 RNloptr(RPackage):
    """nloptr is an R interface to NLopt. NLopt is a free/open-source
    library for nonlinear optimization, providing a common interface
    for a number of different free optimization routines available
    online as well as original implementations of various other
    algorithms. See http://ab-initio.mit.edu/wiki/index.php/NLopt
    _Introduction for more information on the available algorithms.
    During installation on Unix the NLopt code is downloaded and
    compiled from the NLopt website."""

    homepage = "https://cloud.r-project.org/package=nloptr"
    url      = "https://cloud.r-project.org/src/contrib/nloptr_1.0.4.tar.gz"
    list_url = "https://cloud.r-project.org/src/contrib/Archive/nloptr"

    version('1.2.1', sha256='1f86e33ecde6c3b0d2098c47591a9cd0fa41fb973ebf5145859677492730df97')
    version('1.0.4', sha256='84225b993cb1ef7854edda9629858662cc8592b0d1344baadea4177486ece1eb')

    depends_on('nlopt')

    def configure_args(self):
        include_flags = self.spec['nlopt'].headers.include_flags
        libs = self.spec['nlopt'].libs.libraries[0]
        args = [
            '--with-nlopt-cflags={0}'.format(include_flags),
            '--with-nlopt-libs={0}'.format(libs)
        ]
        return args