summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/tix/package.py
blob: 10a5b851e142822f417f7bc895e6d62d919d8034 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# 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

from spack.package import *


class Tix(AutotoolsPackage):
    """Tix, the Tk Interface eXtension, is a powerful set of user interface components
    that expands the capabilities of your Tcl/Tk and Python applications. Using Tix
    together with Tk will greatly enhance the appearance and functionality of your
    application."""

    homepage = "https://sourceforge.net/projects/tix/"
    url = "https://sourceforge.net/projects/tix/files/tix/8.4.3/Tix8.4.3-src.tar.gz/download"

    license("TCL")

    version("8.4.3", sha256="562f040ff7657e10b5cffc2c41935f1a53c6402eb3d5f3189113d734fd6c03cb")

    extends("tcl", type=("build", "link", "run"))
    depends_on("tk", type=("build", "link", "run"))

    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/panic.patch",
        sha256="1be1a1c7453f6ab8771f90d7e7c0f8959490104752a16a8755bbb7287a841a96",
        level=0,
    )
    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/implicit.patch",
        sha256="8a2720368c7757896814684147029d8318b9aa3b0914b3f37dd5e8a8603a61d3",
        level=0,
    )
    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/patch-generic-tixGrSort.c.diff",
        sha256="99b33cc307f71bcf9cc6f5a44b588f22956884ce3f1e4c716ad64c79cf9c5f41",
        level=0,
    )
    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/patch-missing-headers.diff",
        sha256="d9f789dcfe5f4c5ee4589a18f9f410cdf162e41d35d00648c1ef37831f4a2b2b",
        level=0,
    )
    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/patch-tk_x11.diff",
        sha256="1e28d8eee1aaa956a00571cf495a4775e72a993958dff1cabfbc5f102e327a6f",
        level=0,
    )
    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/patch-tk_aqua.diff",
        sha256="41a717f5d95f61b4b8196ca6f14ece8f4764d4ba58fb2e1ae15e3240ee5ac534",
        level=0,
        when="platform=darwin",
    )
    patch(
        "https://raw.githubusercontent.com/macports/macports-ports/v2.7.0-archive/x11/tix/files/patch-dyld_variable.diff",
        sha256="719eb2e4d8c5d6aae897e5f676cf5ed1a0005c1bd07fd9b18705d81a005f592b",
        level=0,
        when="platform=darwin",
    )

    def configure_args(self):
        spec = self.spec
        args = [
            "--with-tcl={0}".format(spec["tcl"].libs.directories[0]),
            "--with-tk={0}".format(spec["tk"].libs.directories[0]),
            "--exec-prefix={0}".format(self.prefix),
        ]
        return args

    @run_after("install")
    def darwin_fix(self):
        # The shared library is not installed correctly on Darwin; fix this
        if "platform=darwin" in self.spec:
            fix_darwin_install_name(self.prefix.lib.Tix + str(self.version))

    def test(self):
        test_data_dir = self.test_suite.current_test_data_dir
        test_file = test_data_dir.join("test.tcl")
        self.run_test(
            self.spec["tcl"].command.path, test_file, purpose="test that tix can be loaded"
        )

    @property
    def libs(self):
        return find_libraries(["libTix{0}".format(self.version)], root=self.prefix, recursive=True)

    def setup_run_environment(self, env):
        """Set TIX_LIBRARY to the directory containing Tix.tcl.

        For further info, see:

        * http://tix.sourceforge.net/docs/pdf/TixUser.pdf
        """
        # When using tkinter.tix from within spack provided python+tkinter+tix,
        # python will not be able to find Tix unless TIX_LIBRARY is set.
        env.set("TIX_LIBRARY", os.path.dirname(find(self.prefix, "Tix.tcl")[0]))

    def setup_dependent_build_environment(self, env, dependent_spec):
        """Set TIX_LIBRARY to the directory containing Tix.tcl.

        For further info, see:

        * http://tix.sourceforge.net/docs/pdf/TixUser.pdf
        """
        env.set("TIX_LIBRARY", os.path.dirname(find(self.prefix, "Tix.tcl")[0]))