summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/procps/package.py
blob: c7d9983693e7c4c148c33a867ac1336a4d1c6497 (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
# 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)

from spack.package import *
from spack.util.environment import is_system_path


class Procps(AutotoolsPackage):
    """Command line and full screen utilities for browsing procfs, a "pseudo"
    file system dynamically generated by the kernel to provide information
    about the status of entries in its process table."""

    homepage = "https://gitlab.com/procps-ng/procps"
    git = "https://gitlab.com/procps-ng/procps.git"

    version("master", branch="master")
    version("3.3.15", tag="v3.3.15")

    variant("nls", default=True, description="Enable Native Language Support.")

    depends_on("autoconf", type="build")
    depends_on("automake", type="build")
    depends_on("libtool", type="build")
    depends_on("m4", type="build")
    depends_on("pkgconfig@0.9.0:", type="build")
    depends_on("dejagnu", type="test")
    depends_on("iconv")
    depends_on("gettext", type="build")
    depends_on("gettext", when="+nls")
    depends_on("ncurses")

    conflicts("platform=darwin", msg="procps is linux-only")

    # Need to tell the build to use the tools it already has to find
    # libintl (if appropriate).
    patch("libintl.patch")

    def autoreconf(self, spec, prefix):
        sh = which("sh")
        sh("autogen.sh")

    def configure_args(self):
        spec = self.spec
        args = ["--with-ncurses"]

        if "+nls" in spec:
            args.append("--enable-nls")
            if "intl" not in spec["gettext"].libs.names:
                args.append("--without-libintl-prefix")
            elif not is_system_path(spec["gettext"].prefix):
                args.append("--with-libintl-prefix=" + spec["gettext"].prefix)
        else:
            args.append("--disable-nls")

        if spec["iconv"].name == "libc":
            args.append("--without-libiconv-prefix")
        elif not is_system_path(spec["iconv"].prefix):
            args.append("--with-libiconv-prefix={0}".format(spec["iconv"].prefix))

        return args