Build HTML versions of the man pages

And install them in the same directory as the API reference, so it's
possible to link them.

Fixes: #2896
This commit is contained in:
Emmanuele Bassi 2024-06-02 15:15:31 +00:00 committed by Philip Withnall
parent c02f50f0ba
commit 10fd218666
4 changed files with 91 additions and 29 deletions

View File

@ -1,8 +1,17 @@
gio_manpages = [
'gapplication',
'gdbus-codegen',
'gdbus',
'gio-querymodules',
'gio',
'glib-compile-resources',
'glib-compile-schemas',
'gresource',
'gsettings',
]
if get_option('man-pages').enabled()
manpages = ['gapplication', 'gio-querymodules', 'glib-compile-schemas',
'glib-compile-resources', 'gsettings', 'gresource', 'gdbus',
'gio', 'gdbus-codegen']
foreach page : manpages
foreach page: gio_manpages
custom_target(page + '-man',
input: page + '.rst',
output: page + '.1',
@ -19,6 +28,25 @@ if get_option('man-pages').enabled()
endforeach
endif
if get_option('documentation')
man_html_path = docs_dir / 'gio-2.0'
foreach page: gio_manpages
custom_target(
input: page + '.rst',
output: page + '.html',
command: [
rst2html5,
'@INPUT@',
],
capture: true,
install: true,
install_dir: man_html_path,
install_tag: 'doc',
)
endforeach
endif
if get_option('documentation') and enable_gir
expand_content_files = [
'dbus-error.md',

View File

@ -1,7 +1,7 @@
glib_manpages = ['glib-gettextize', 'gtester', 'gtester-report']
if get_option('man-pages').enabled()
manpages = ['glib-gettextize', 'gtester', 'gtester-report']
foreach page : manpages
foreach page: glib_manpages
custom_target(page + '-man',
input: page + '.rst',
output: page + '.1',
@ -20,10 +20,8 @@ endif
if get_option('documentation')
# GVariant specification is currently standalone
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: false)
if rst2html5.found()
spec_path = docs_dir / 'glib-2.0'
man_html_path = docs_dir / 'glib-2.0'
figures = files(
'gvariant-byte-boundaries.svg',
@ -50,7 +48,21 @@ if get_option('documentation')
install_dir: spec_path,
install_tag: 'doc',
)
endif
foreach page: glib_manpages
custom_target(
input: page + '.rst',
output: page + '.html',
command: [
rst2html5,
'@INPUT@',
],
capture: true,
install: true,
install_dir: man_html_path,
install_tag: 'doc',
)
endforeach
endif
if get_option('documentation') and enable_gir

View File

@ -1,6 +1,7 @@
gobject_manpages = ['glib-mkenums', 'glib-genmarshal', 'gobject-query']
if get_option('man-pages').enabled()
manpages = ['glib-mkenums', 'glib-genmarshal', 'gobject-query']
foreach page : manpages
foreach page: gobject_manpages
custom_target(page + '-man',
input: page + '.rst',
output: page + '.1',
@ -17,6 +18,25 @@ if get_option('man-pages').enabled()
endforeach
endif
if get_option('documentation')
man_html_path = docs_dir / 'gobject-2.0'
foreach page: gobject_manpages
custom_target(
input: page + '.rst',
output: page + '.html',
command: [
rst2html5,
'@INPUT@',
],
capture: true,
install: true,
install_dir: man_html_path,
install_tag: 'doc',
)
endforeach
endif
if get_option('documentation') and enable_gir
expand_content_files = [
'boxed.md',

View File

@ -2648,9 +2648,11 @@ if rst2man.found()
rst2man_flags = [
'--syntax-highlight=none',
]
man1_dir = join_paths(glib_prefix, get_option('mandir'), 'man1')
man1_dir = glib_prefix / get_option('mandir') / 'man1'
endif
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
gnome = import('gnome')
subdir('docs/reference')