summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/watch/package.py
blob: 5b8712599f2d43a48aae570e23ea10ca29ee89c7 (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
# Copyright 2013-2024 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 *


class Watch(AutotoolsPackage):
    """Executes a program periodically, showing output fullscreen."""

    # Note: there is a separate procps package, but it doesn't build on macOS.
    # This package only contains the `watch` program, a subset of procps which
    # does build on macOS.
    # https://github.com/NixOS/nixpkgs/issues/18929#issuecomment-249388571
    homepage = "https://gitlab.com/procps-ng/procps"
    git = "https://gitlab.com/procps-ng/procps.git"

    license("GPL-2.0-or-later")

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

    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("gettext", type="build")
    depends_on("ncurses")

    # https://github.com/Homebrew/homebrew-core/blob/master/Formula/watch.rb
    def autoreconf(self, spec, prefix):
        sh = which("sh")
        sh("autogen.sh")

    def configure_args(self):
        return [
            "--with-ncurses",
            # Required to avoid libintl linking errors
            "--disable-nls",
        ]

    def build(self, spec, prefix):
        make("watch")

    def install(self, spec, prefix):
        mkdirp(prefix.bin)
        mkdirp(prefix.man.man1)

        install("watch", prefix.bin)
        install("watch.1", prefix.man.man1)