summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/dyninst/package.py
blob: 8a18b999403526cb906da1212f5e38eabc426690 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
##############################################################################
# Copyright (c) 2013-2017, 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/spack/spack
# Please also see the NOTICE and LICENSE files 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
##############################################################################
from spack import *


class Dyninst(Package):
    """API for dynamic binary instrumentation.  Modify programs while they
    are executing without recompiling, re-linking, or re-executing."""

    homepage = "https://paradyn.org"
    url = "https://github.com/dyninst/dyninst/archive/v9.2.0.tar.gz"
    list_url = "http://www.dyninst.org/downloads/dyninst-8.x"

    version('9.3.2', 'a2bf03b6d1d424853e80d39b13e9c229')
    version('9.3.0', 'edde7847dc673ca69bd59412af572450')
    version('9.2.0', 'ad023f85e8e57837ed9de073b59d6bab',
            url="https://github.com/dyninst/dyninst/archive/v9.2.0.tar.gz")
    version('9.1.0', '5c64b77521457199db44bec82e4988ac',
            url="http://www.paradyn.org/release9.1.0/DyninstAPI-9.1.0.tgz")
    version('8.2.1', 'abf60b7faabe7a2e4b54395757be39c7',
            url="http://www.paradyn.org/release8.2/DyninstAPI-8.2.1.tgz")
    version('8.1.2', 'bf03b33375afa66fe0efa46ce3f4b17a',
            url="http://www.paradyn.org/release8.1.2/DyninstAPI-8.1.2.tgz")
    version('8.1.1', 'd1a04e995b7aa70960cd1d1fac8bd6ac',
            url="http://www.paradyn.org/release8.1/DyninstAPI-8.1.1.tgz")

    variant('stat_dysect', default=False,
            description="patch for STAT's DySectAPI")

    depends_on("elf@0", type='link', when='@:9.2.99')
    depends_on("elf@1", type='link', when='@9.3.0:')
    depends_on("libdwarf")
    depends_on("boost@1.42:")
    depends_on('cmake', type='build')

    patch('stat_dysect.patch', when='+stat_dysect')
    patch('stackanalysis_h.patch', when='@9.2.0')

    # new version uses cmake
    def install(self, spec, prefix):
        if spec.satisfies('@:8.1'):
            configure("--prefix=" + prefix)
            make()
            make("install")
            return

        libelf = spec['elf'].prefix
        libdwarf = spec['libdwarf'].prefix

        with working_dir('spack-build', create=True):
            args = ['..',
                    '-DBoost_INCLUDE_DIR=%s'    % spec['boost'].prefix.include,
                    '-DBoost_LIBRARY_DIR=%s'    % spec['boost'].prefix.lib,
                    '-DBoost_NO_SYSTEM_PATHS=TRUE',
                    '-DLIBELF_INCLUDE_DIR=%s'   % join_path(
                        libelf.include, 'libelf'),
                    '-DLIBELF_LIBRARIES=%s'     % join_path(
                        libelf.lib, 'libelf.so'),
                    '-DLIBDWARF_INCLUDE_DIR=%s' % libdwarf.include,
                    '-DLIBDWARF_LIBRARIES=%s'   % join_path(
                        libdwarf.lib, 'libdwarf.so')]
            if spec.satisfies('arch=linux-redhat7-ppc64le'):
                args.append('-Darch_ppc64_little_endian=1')
            args += std_cmake_args
            cmake(*args)
            make()
            make("install")

    @when('@:8.1')
    def install(self, spec, prefix):
        configure("--prefix=" + prefix)
        make()
        make("install")