Repository navigation
Expand file tree
/
Copy pathmeson.build
More file actions
170 lines (152 loc) · 5.49 KB
/
Copy pathmeson.build
File metadata and controls
170 lines (152 loc) · 5.49 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
project('orca',
version: '52.alpha',
meson_version: '>= 1.0.0',
)
python = import('python')
gnome = import('gnome')
i18n = import('i18n')
python_minimum_version = '3.10'
python3 = python.find_installation('python3', required: true)
if not python3.language_version().version_compare(f'>= @python_minimum_version@')
error(f'Python @python_minimum_version@ or newer is required.')
endif
# Hard dependencies (checked via pkg-config)
dependency('atspi-2', version: '>= 2.58.6')
dependency('atk-bridge-2.0', version: '>= 2.58.6')
dependency('pygobject-3.0', version: '>= 3.18')
# Verify the AT-SPI Python overrides are installed. See at-spi2-core#172.
libdir = python3.get_path('purelib').replace(python3.get_path('data'), get_option('prefix'))
atspi_override_command = ' '.join([
'import sys;',
'sys.path.insert(1, "' + libdir + '");',
'import gi;',
'gi.require_version("Atspi", "2.0");',
'from gi.repository import Atspi;',
'sys.exit(0 if Atspi.Accessible.__hash__.__module__ == "gi.overrides.Atspi" else 1)',
])
atspi_override_test = run_command(python3, '-c', atspi_override_command, check: false)
if atspi_override_test.returncode() != 0
error('AT-SPI Python overrides (gi/overrides/Atspi.py) are not installed. '
+ 'Rebuild at-spi2-core with Python available at configure time.')
endif
# Hard Python module dependencies
dasbus_result = python.find_installation('python3', modules:['dasbus'], required: false)
if not dasbus_result.found()
error('dasbus is required for D-Bus remote controller interface')
endif
# End users might not have the Gtk development libraries installed, making pkg-config fail.
# Therefore, check this dependency via python.
gtk_major_version = '3'
gtk_minor_version = '24'
gtk_command = ' '.join([
'import gi; gi.require_version("Gtk", "3.0"); from gi.repository import Gtk;',
'print(f"{Gtk.get_major_version()}.{Gtk.get_minor_version()}.{Gtk.get_micro_version()}");',
f'failed = Gtk.get_major_version() != @gtk_major_version@ or Gtk.get_minor_version() < @gtk_minor_version@;',
'exit(failed)'
])
gtk_test = run_command(python3, '-c', gtk_command, check: false)
description = f'GTK @gtk_major_version@.@gtk_minor_version@'
version = gtk_test.stdout().strip()
if gtk_test.returncode() != 0
error(f'@description@ failed (found @version@)')
endif
# Optional python modules with their descriptions
optional_modules = {
'babel': 'language display names',
'brlapi': 'braille output',
'louis': 'contracted braille',
'psutil': 'system information commands',
'gi.repository.Wnck': 'mouse review',
}
summary = {}
foreach module, description : optional_modules
result = python.find_installation('python3', modules:[module], required: false)
if result.found()
summary += {description: f'yes (found @module@)'}
else
summary += {description: f'no (missing @module@)'}
endif
endforeach
# MathCAT support for presentation of math in speech and braille
mathcat_rules_dir = ''
if get_option('mathcat')
cargo = find_program('cargo', required: false)
if not cargo.found()
error('MathML support comes from MathCAT. Install cargo or run setup with -Dmathcat=false.')
endif
subproject('mathcat-py')
mathcat_rules_dir = get_option('prefix') / get_option('datadir') / 'mathcat' / 'Rules'
summary += {'mathcat': 'yes (found cargo, building MathCATForPython)'}
else
summary += {'mathcat': 'no (disabled)'}
endif
# Optional synthesizer services
speech_output = []
if python.find_installation('python3', modules:['speechd'], required: false).found()
speech_output += ['speechd']
endif
# Experimental (checked via pkg-config)
if get_option('spiel')
dependency('spiel-1.0',
version: '>= 1.0.1',
fallback: ['spiel', 'spiel_lib_dep'],
default_options: [
'docs=false',
'tests=false',
'werror=false',
],
)
speech_output += ['spiel']
endif
if speech_output.length() > 0
summary += {'speech output': 'yes (found @0@)'.format(', '.join(speech_output))}
else
summary += {'speech output': 'no (missing speechd, spiel)'}
endif
# Integration with session startup
systemd = dependency('systemd', required: false)
systemd_user_unit_dir = systemd.get_variable(
'systemd_user_unit_dir',
pkgconfig_define: ['prefix', get_option('prefix')],
default_value: get_option('prefix') / 'lib' / 'systemd' / 'user'
)
install_data(
'orca.service',
install_dir: systemd_user_unit_dir
)
i18n.merge_file(
input: 'orca.desktop.in',
output: '@BASENAME@',
type: 'desktop',
po_dir: meson.project_source_root() / 'po',
install: true,
install_dir: get_option('datadir') / 'applications',
)
i18n.merge_file(
input: 'orca-autostart.desktop.in',
output: '@BASENAME@',
type: 'desktop',
po_dir: meson.project_source_root() / 'po',
install: true,
install_dir: get_option('sysconfdir') / 'xdg' / 'autostart',
)
gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
)
summary += {'Install dir': python.find_installation('python3').get_install_dir()}
subdir('docs')
subdir('help')
subdir('icons')
subdir('po')
subdir('src')
# The schemas generated in data depend on the list of library sources defined in src.
subdir('data')
subdir('tests')
summary(summary)
# This may be removed once Spiel is widely available
if get_option('force_fallback_for').contains('spiel')
warning('Spiel is being built as a subproject that may need to be updated.\n\n' +
' See the README.md in this directory or in the Orca repository at:\n' +
' https://gitlab.gnome.org/GNOME/orca/blob/main/README.md#experimental-features\n')
endif