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