Commit e05e900c authored by Martin Robinson's avatar Martin Robinson Committed by Commit Bot

Allow compilation against older atspi-2 versions

Since atspi-2 does not support getting version information at compile
time, we must do this manually with pkg-config. Add defines for the
versions of atspi-2 that we care about and guard newer enum values with
those defines.

Bug: 887908
Change-Id: I8eecb2eeada48cc2176117b764adbf77b26ce351
Reviewed-on: https://chromium-review.googlesource.com/c/1238437
Commit-Queue: Martin Robinson <mrobinson@igalia.com>
Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598863}
parent 93a95245
......@@ -103,6 +103,20 @@ if (use_glib) {
if (use_atk) {
pkg_config("atspi2") {
packages = [ "atspi-2" ]
atspi_version = exec_script(pkg_config_script,
pkg_config_args + [
"atspi-2",
"--version-as-components",
],
"value")
atspi_major_version = atspi_version[0]
atspi_minor_version = atspi_version[1]
atspi_micro_version = atspi_version[2]
defines = [
"ATSPI_MAJOR_VERSION=$atspi_major_version",
"ATSPI_MINOR_VERSION=$atspi_minor_version",
"ATSPI_MICRO_VERSION=$atspi_micro_version",
]
}
}
......
......@@ -124,6 +124,8 @@ def main():
dest='atleast_version', type='string')
parser.add_option('--libdir', action='store_true', dest='libdir')
parser.add_option('--dridriverdir', action='store_true', dest='dridriverdir')
parser.add_option('--version-as-components', action='store_true',
dest='version_as_components')
(options, args) = parser.parse_args()
# Make a list of regular expressions to strip out.
......@@ -151,6 +153,17 @@ def main():
print "false"
return 0
if options.version_as_components:
cmd = [options.pkg_config, "--modversion"] + args
try:
version_string = subprocess.check_output(cmd)
except:
sys.stderr.write('Error from pkg-config.\n')
return 1
print json.dumps(list(map(int, version_string.strip().split("."))))
return 0
if options.libdir:
cmd = [options.pkg_config, "--variable=libdir"] + args
if options.debug:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment