summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/libxkbcommon/package.py
blob: a705e9660fc4efa2d7ea930b5e7f51bda247b12b (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 spack.build_systems.autotools
import spack.build_systems.meson
from spack.package import *


class Libxkbcommon(MesonPackage, AutotoolsPackage):
    """xkbcommon is a library to handle keyboard descriptions, including
    loading them from disk, parsing them and handling their state. It's mainly
    meant for client toolkits, window systems, and other system
    applications."""

    homepage = "https://xkbcommon.org/"
    url = "https://xkbcommon.org/download/libxkbcommon-0.8.2.tar.xz"

    build_system(
        conditional("meson", when="@0.9:"), conditional("autotools", when="@:0.8"), default="meson"
    )

    version("1.5.0", sha256="560f11c4bbbca10f495f3ef7d3a6aa4ca62b4f8fb0b52e7d459d18a26e46e017")
    version("1.4.1", sha256="943c07a1e2198026d8102b17270a1f406e4d3d6bbc4ae105b9e1b82d7d136b39")
    version("1.4.0", sha256="106cec5263f9100a7e79b5f7220f889bc78e7d7ffc55d2b6fdb1efefb8024031")
    version(
        "0.8.2",
        sha256="7ab8c4b3403d89d01898066b72cb6069bddeb5af94905a65368f671a026ed58c",
        deprecated=True,
    )
    version(
        "0.8.0",
        sha256="e829265db04e0aebfb0591b6dc3377b64599558167846c3f5ee5c5e53641fe6d",
        deprecated=True,
    )
    version(
        "0.7.1",
        sha256="ba59305d2e19e47c27ea065c2e0df96ebac6a3c6e97e28ae5620073b6084e68b",
        deprecated=True,
    )

    variant("wayland", default=False, description="Enable Wayland support")

    depends_on("meson@0.41:", type="build", when="@0.9:")
    depends_on("meson@0.49:", type="build", when="@1.0:")
    depends_on("meson@0.51:", type="build", when="@1.5:")
    depends_on("pkgconfig@0.9.0:", type="build")
    depends_on("bison", type="build")
    depends_on("util-macros")
    depends_on("xkbdata")
    depends_on("libxcb@1.10:")
    depends_on("libxml2", when="@1:")

    depends_on("wayland@1.2.0:", when="+wayland")
    depends_on("wayland-protocols@1.7:", when="+wayland")


class MesonBuilder(spack.build_systems.meson.MesonBuilder):
    def meson_args(self):
        return [
            "-Dxkb-config-root={0}".format(self.spec["xkbdata"].prefix),
            "-Denable-docs=false",
            "-Denable-wayland=" + str(self.spec.satisfies("+wayland")),
        ]


class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):
    def configure_args(self):
        """Configure arguments are passed using meson_args functions"""
        return [
            "--with-xkb-config-root={0}".format(self.spec["xkbdata"].prefix),
            "--disable-docs",
        ] + self.enable_or_disable("wayland")