Debian Codegraph @

doc/user/meson.build

raw
1 # Sphinx build
2 sphinx = find_program('sphinx-build-3', 'sphinx-build', required : false)
3 if not sphinx.found()
4 error('Program "sphinx-build" not found or not executable. Try building with -Ddocumentation=false')
5 endif
6
7 yq = find_program('yq', required : false)
8 if not yq.found()
9 warning('Program "yq" not found or not executable. Dependency list will not be built.')
10 endif
11
12 sphinx_config = configuration_data()
13 sphinx_config.set('PROJECT_NAME', meson.project_name())
14 sphinx_config.set('PROJECT_VERSION', meson.project_version())
15 sphinx_config.set('BUILDDIR', meson.current_build_dir())
16 sphinx_config.set('HTTP_DOC_LINK', doc_url)
17
18 git_version_page = vcs_tag(command : ['git', 'log', '-1', '--format=%H'],
19 fallback : 'unknown',
20 input : 'git_version.py.in',
21 output : 'git_version.py',
22 replace_string: '__GIT_VERSION__')
23
24 sphinx_conf_py = configure_file(input : 'conf.py.in',
25 output : 'conf.py',
26 configuration : sphinx_config)
27
28 # 404 replacements for old URLs
29 # The switch to sphinx caused a few pages to be renamed, sphinx uses
30 # filename.html whereas doxygen used whatever the @page foo was. So old docs
31 # *mostly* used underscores, now we're consistent with dashes.
32 # We can't use htaccess on the server, so let's auto-generate a 404 list
33 # with a basic page telling users that the link has moved. This can be
34 # removed in a few months, towards the end of 2018.
35 #
36 # File list is: [current-sphinx-input-file, old-generated-page]
37 # If they're the same they'll be ignored.
38 src_404s = [
39 [ 'absolute-axes.rst', 'absolute_axes.html'],
40 [ 'absolute-coordinate-ranges.rst', 'absolute_coordinate_ranges.html'],
41 [ 'architecture.rst', 'architecture.html'],
42 [ 'building.rst', 'building_libinput.html'],
43 [ 'button-debouncing.rst', 'button_debouncing.html'],
44 [ 'clickpad-softbuttons.rst', 'clickpad_softbuttons.html'],
45 [ 'configuration.rst', 'config_options.html'],
46 [ 'contributing.rst', 'contributing.html'],
47 [ 'development.rst', 'development.html'],
48 [ 'device-configuration-via-udev.rst', 'udev_config.html'],
49 [ 'device-quirks.rst', 'device-quirks.html'],
50 [ 'faqs.rst', 'faq.html'],
51 [ 'features.rst', 'features.html'],
52 [ 'gestures.rst', 'gestures.html'],
53 [ 'incorrectly-enabled-hires.rst', 'incorrectly-enabled-hires.html'],
54 [ 'middle-button-emulation.rst', 'middle_button_emulation.html'],
55 [ 'normalization-of-relative-motion.rst', 'motion_normalization.html'],
56 [ 'palm-detection.rst', 'palm_detection.html'],
57 [ 'pointer-acceleration.rst', 'pointer-acceleration.html'],
58 [ 'reporting-bugs.rst', 'reporting_bugs.html'],
59 [ 'scrolling.rst', 'scrolling.html'],
60 [ 'seats.rst', 'seats.html'],
61 [ 'switches.rst', 'switches.html'],
62 [ 't440-support.rst', 't440_support.html'],
63 [ 'tablet-support.rst', 'tablet-support.html'],
64 [ 'tapping.rst', 'tapping.html'],
65 [ 'test-suite.rst', 'test-suite.html'],
66 [ 'timestamps.rst', 'timestamps.html'],
67 [ 'tools.rst', 'tools.html'],
68 [ 'touchpad-jitter.rst', 'touchpad_jitter.html'],
69 [ 'touchpad-jumping-cursors.rst', 'touchpad_jumping_cursor.html'],
70 [ 'touchpad-pressure.rst', 'touchpad_pressure.html'],
71 [ 'touchpads.rst', 'touchpads.html'],
72 [ 'trackpoints.rst', 'trackpoints.html'],
73 [ 'troubleshooting.rst', 'troubleshooting.html'],
74 [ 'what-is-libinput.rst', 'what_is_libinput.html'],
75 ]
76
77 dst_404s = []
78 foreach s404 : src_404s
79 target = s404[0]
80 oldpage = s404[1]
81 tname = target.split('.rst')[0]
82 oname = oldpage.split('.html')[0]
83
84 if tname != oname
85 config_404 = configuration_data()
86 config_404.set('TARGET', '@[email protected]'.format(tname))
87 c = configure_file(input : '404.rst',
88 output : '@[email protected]'.format(oname),
89 configuration : config_404)
90 dst_404s += [c]
91 endif
92 endforeach
93
94 src_rst = files(
95 # dot drawings
96 'dot/seats-sketch.gv',
97 'dot/seats-sketch-libinput.gv',
98 'dot/libinput-contexts.gv',
99 'dot/libinput-stack-wayland.gv',
100 'dot/libinput-stack-xorg.gv',
101 'dot/libinput-stack-gnome.gv',
102 'dot/evemu.gv',
103 'dot/libinput-record.gv',
104 'dot/plugin-stack.gv',
105 # svgs
106 'svg/button-debouncing-wave-diagram.svg',
107 'svg/button-scrolling.svg',
108 'svg/clickfinger.svg',
109 'svg/clickfinger-distance.svg',
110 'svg/edge-scrolling.svg',
111 'svg/gesture-2fg-ambiguity.svg',
112 'svg/palm-detection.svg',
113 'svg/pinch-gestures.svg',
114 'svg/pinch-gestures-softbuttons.svg',
115 'svg/ptraccel-custom.svg',
116 'svg/ptraccel-linear.svg',
117 'svg/ptraccel-low-dpi.svg',
118 'svg/ptraccel-touchpad.svg',
119 'svg/ptraccel-trackpoint.svg',
120 'svg/software-buttons.svg',
121 'svg/software-buttons-conditions.svg',
122 'svg/software-buttons-thumbpress.svg',
123 'svg/software-buttons-visualized.svg',
124 'svg/swipe-gestures.svg',
125 'svg/tablet-area.svg',
126 'svg/tablet-axes.svg',
127 'svg/tablet-cintiq24hd-modes.svg',
128 'svg/tablet-eraser-invert.svg',
129 'svg/tablet-eraser-button.svg',
130 'svg/tablet-interfaces.svg',
131 'svg/tablet-intuos-modes.svg',
132 'svg/tablet-left-handed.svg',
133 'svg/tablet-out-of-bounds.svg',
134 'svg/tablet.svg',
135 'svg/tap-n-drag.svg',
136 'svg/thumb-detection.svg',
137 'svg/top-software-buttons.svg',
138 'svg/touchscreen-gestures.svg',
139 'svg/trackpoint-delta-illustration.svg',
140 'svg/twofinger-scrolling.svg',
141 # rst files
142 'absolute-axes.rst',
143 'absolute-coordinate-ranges.rst',
144 'architecture.rst',
145 'building.rst',
146 'button-debouncing.rst',
147 'clickpad-softbuttons.rst',
148 'clickpad-with-right-button.rst',
149 'contributing.rst',
150 'device-configuration-via-udev.rst',
151 'device-quirks.rst',
152 'drag-3fg.rst',
153 'faqs.rst',
154 'gestures.rst',
155 'incorrectly-enabled-hires.rst',
156 'ignoring-devices.rst',
157 'middle-button-emulation.rst',
158 'normalization-of-relative-motion.rst',
159 'palm-detection.rst',
160 'lua-plugins.rst',
161 'pointer-acceleration.rst',
162 'reporting-bugs.rst',
163 'scrolling.rst',
164 'seats.rst',
165 'switches.rst',
166 't440-support.rst',
167 'tablet-support.rst',
168 'tapping.rst',
169 'test-suite.rst',
170 'timestamps.rst',
171 'tablet-debugging.rst',
172 'tools.rst',
173 'touchpad-jumping-cursors.rst',
174 'touchpad-pressure.rst',
175 'touchpad-pressure-debugging.rst',
176 'touchpad-jitter.rst',
177 'touchpad-thumb-detection.rst',
178 'touchpads.rst',
179 'trackpoints.rst',
180 'trackpoint-configuration.rst',
181 'what-is-libinput.rst',
182 'wheel-api.rst',
183 'features.rst',
184 'development.rst',
185 'troubleshooting.rst',
186 'configuration.rst',
187 )
188
189 src_sphinx = []
190 foreach f : src_rst
191 sf = configure_file(input: f,
192 output: '@PLAINNAME@',
193 copy : true)
194 src_sphinx += [ sf ]
195 endforeach
196
197 configure_file(input: 'index.rst',
198 output: 'index.rst',
199 configuration: sphinx_config)
200
201 dependencies_config = configuration_data()
202 if yq.found()
203 distributions = ['fedora', 'ubuntu', 'debian', 'arch', 'alpine']
204 foreach distro : distributions
205 yq_filter = '.distributions[] | select(.name == "@0@") | .packages | join(" ")'.format(distro)
206 deps = run_command(yq, '-r', yq_filter,
207 dir_gitlab_ci / 'config.yml',
208 check: true).stdout()
209 dependencies_config.set('@0@_PACKAGES'.format(distro.to_upper()), deps)
210 endforeach
211 endif
212 configure_file(input: 'dependencies.rst',
213 output: 'dependencies.rst',
214 configuration: dependencies_config)
215
216 # do not use -j, it breaks on Ubuntu
217 sphinx_output_dir = 'Documentation'
218 custom_target('sphinx',
219 input : [ sphinx_conf_py, git_version_page ] + src_sphinx + dst_404s,
220 output : [ sphinx_output_dir ],
221 command : [ sphinx, '-q', '-b', 'html',
222 '-d', meson.current_build_dir() / 'doctrees',
223 meson.current_build_dir(), sphinx_output_dir],
224 build_by_default : true)