summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/fxt/package.py
blob: 90426c24f5fe7d3cda7c487c8c43b79c2d6aa59b (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
# Copyright 2013-2023 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
import subprocess

from spack.package import *


class Fxt(AutotoolsPackage):
    """Fast User/Kernel Tracing

    FxT stands for both FKT (Fast Kernel Tracing) and FUT (Fast User
    Tracing). This library provides efficient support for recording
    traces.
    """

    homepage = "http://savannah.nongnu.org/projects/fkt"
    url = "http://download.savannah.nongnu.org/releases/fkt/fxt-0.3.14.tar.gz"

    maintainers("nfurmento", "sthibaul")

    license("GPL-2.0-only")

    version("0.3.14", sha256="317d8d93175cd9f27ec43b8390b6d29dc66114f06aa74f2329847d49baaaebf2")
    version("0.3.5", sha256="3c0b33c82a01c4fb710c53ee9fc2c803314beba6fb60c397e13e874811e34a22")
    version("0.3.4", sha256="fcd35a5278ac0f10eba12fed4fa436dce79559897fde5b8176d5eee9081970f7")
    version("0.3.3", sha256="3f6fea5211cc242a54496e6242365c99522a5039916789cdbe25a58d05d6a626")

    variant(
        "moreparams",
        default=False,
        description="Increase the value of FXT_MAX_PARAMS (to allow longer task names).",
    )

    variant("static", default=False, description="Compile as a static library")

    depends_on("gawk", type="build")
    depends_on("autoconf", type="build")
    depends_on("automake", type="build")
    depends_on("libtool", type="build")
    depends_on("m4", type="build")

    parallel = False

    def patch(self):
        # Increase the value of FXT_MAX_PARAMS (to allow longer task names)
        if "+moreparams" in self.spec:
            filter_file("#define FXT_MAX_PARAMS.*", "#define FXT_MAX_PARAMS 16", "tools/fxt.h")

    def autoreconf(self, spec, prefix):
        if not os.path.isfile("./configure"):
            if os.path.isfile("./autogen.sh"):
                subprocess.call(["libtoolize", "--copy", "--force"], shell=False)
                subprocess.check_call("./autogen.sh")
            else:
                raise RuntimeError(
                    "Neither configure nor autogen.sh script exist.\
                FxT Cannot configure."
                )

    def configure_args(self):
        spec = self.spec
        config_args = []
        if spec.satisfies("+static"):
            config_args.extend(["--enable-static=yes", "--enable-shared=no"])
        return config_args

    def flag_handler(self, name, flags):
        if name == "cflags":
            flags.append(self.compiler.cc_pic_flag)
        return (flags, None, None)