Skip to content

Commit 9d28090

Browse files
committed
build: Move computing gtk-doc module paths to the check place
A checks and an application of extra directories for gtkdoc-fixxref were computed independetly. This patch removes the code duplication. It also adds the discovered path to a "meson setup" summary output.
1 parent 903408a commit 9d28090

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

meson.build

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,21 @@ sed = find_program('sed')
6767
test = find_program('test')
6868

6969
with_docs = get_option('with_docs')
70+
gtk_doc_referred_paths = []
7071
if with_docs
7172
gtkdoc = dependency('gtk-doc')
7273
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
7374

74-
glib_index_path = join_paths(glib_docpath, 'glib/index.html')
75-
ret = run_command ([test, '-e', glib_index_path],
76-
check: false)
77-
if ret.returncode() != 0
78-
error('Missing documentation for GLib: @0@'.format(glib_index_path))
79-
endif
80-
81-
gobject_index_path = join_paths(glib_docpath, 'gobject/index.html')
82-
ret = run_command ([test, '-e', gobject_index_path],
83-
check: false)
84-
if ret.returncode() != 0
85-
error('Missing documentation for GObject: @0@'.format(gobject_index_path))
86-
endif
75+
foreach referred_module : [ 'glib', 'gobject' ]
76+
doc_module_path = join_paths(glib_docpath, referred_module)
77+
doc_index_file = join_paths(doc_module_path, 'index.html')
78+
ret = run_command ([test, '-e', doc_index_file],
79+
check: false)
80+
if ret.returncode() != 0
81+
error('Missing GTK documentation for @0@: @1@'.format(referred_module, doc_index_file))
82+
endif
83+
gtk_doc_referred_paths += [ doc_module_path ]
84+
endforeach
8785
endif
8886

8987
# Keep with_manpages option a tristate feature for backward compatibility.
@@ -198,6 +196,7 @@ summary({'prefix': get_option('prefix'),
198196
'datadir': get_option('datadir'),
199197
'Python 2 GObject Overrides': gobject_overrides_dir_py2,
200198
'Python 3 GObject Overrides': gobject_overrides_dir_py3,
199+
'GTK-Doc Referred Paths': gtk_doc_referred_paths,
201200
}, section: 'Directories')
202201

203202
summary({'Custom Python': get_option('python_name'),

modulemd/meson.build

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ configure_file(
256256
# --- Documenatation --- #
257257

258258
if with_docs
259+
fixxref_args = []
260+
foreach path : gtk_doc_referred_paths
261+
fixxref_args += [ '--extra-dir=@0@'.format(path) ]
262+
endforeach
259263
gnome.gtkdoc(
260264
'modulemd-2.0',
261265
install_dir: 'modulemd-2.0',
@@ -265,10 +269,7 @@ if with_docs
265269
dependencies : [
266270
modulemd_dep,
267271
],
268-
fixxref_args: [
269-
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
270-
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
271-
],
272+
fixxref_args: [ fixxref_args ],
272273
install : true,
273274
)
274275
endif

0 commit comments

Comments
 (0)