summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/perl/package.py
blob: d71a7492bad7b2f5c9d6a9ee865c63c1a4922a7c (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
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
#
# Author: George Hartzell <hartzell@alerce.com>
# Date: July 21, 2016
# Author: Justin Too <justin@doubleotoo.com>
# Date: September 6, 2015
#
from spack import *


class Perl(Package):
    """Perl 5 is a highly capable, feature-rich programming language with over
       27 years of development."""
    homepage = "http://www.perl.org"
    url      = "http://www.cpan.org/src/5.0/perl-5.22.2.tar.gz"

    version('5.24.0', 'c5bf7f3285439a2d3b6a488e14503701')
    version('5.22.2', '5767e2a10dd62a46d7b57f74a90d952b')
    version('5.20.3', 'd647d0ea5a7a8194c34759ab9f2610cd')
    # 5.18.4 fails with gcc-5
    # https://rt.perl.org/Public/Bug/Display.html?id=123784
    # version('5.18.4' , '1f9334ff730adc05acd3dd7130d295db')

    # Installing cpanm alongside the core makes it safe and simple for
    # people/projects to install their own sets of perl modules.  Not
    # having it in core increases the "energy of activation" for doing
    # things cleanly.
    variant('cpanm', default=True,
            description='Optionally install cpanm with the core packages.')

    resource(
        name="cpanm",
        url="http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7042.tar.gz",
        md5="e87f55fbcb3c13a4754500c18e89219f",
        destination="cpanm",
        placement="cpanm"
    )

    def install(self, spec, prefix):
        configure = Executable('./Configure')
        configure("-des", "-Dprefix=" + prefix)
        make()
        if self.run_tests:
            make("test")
        make("install")

        if '+cpanm' in spec:
            with working_dir(join_path('cpanm', 'cpanm')):
                perl = Executable(join_path(prefix.bin, 'perl'))
                perl('Makefile.PL')
                make()
                make('install')