xref: /aosp_15_r20/external/angle/build/config/linux/atspi2/BUILD.gn (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# Copyright 2018 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/linux/pkg_config.gni")
6import("//build/config/ui.gni")
7
8# These packages should _only_ be expected when building for a target.
9assert(current_toolchain == default_toolchain)
10
11if (use_atk) {
12  pkg_config("atspi2") {
13    packages = [ "atspi-2" ]
14    atspi_version = exec_script(pkg_config_script,
15                                common_pkg_config_args + pkg_config_args + [
16                                      "atspi-2",
17                                      "--version-as-components",
18                                    ],
19                                "value")
20    major = atspi_version[0]
21    minor = atspi_version[1]
22    micro = atspi_version[2]
23
24    # These aren't necessarily used if atspi is not old enough to require them.
25    # Also, gn considers variables unused if the only use of them is
26    # short-circuited away, so for example if major == 2 and minor == 48, micro
27    # would be unused.
28    not_needed([
29                 "major",
30                 "minor",
31                 "micro",
32               ])
33
34    # ATSPI 2.49.90 now defines these for us and it's an error for us to
35    # redefine them on the compiler command line.
36    # See ATSPI 927344a34cd5bf81fc64da4968241735ecb4f03b
37    if (major < 2 || (major == 2 && minor < 49) ||
38        (major == 2 && minor == 49 && micro < 90)) {
39      defines = [
40        "ATSPI_MAJOR_VERSION=$major",
41        "ATSPI_MINOR_VERSION=$minor",
42        "ATSPI_MICRO_VERSION=$micro",
43      ]
44    }
45  }
46}
47