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() if get_option('man-pages').enabled()
manpages = ['gapplication', 'gio-querymodules', 'glib-compile-schemas', foreach page: gio_manpages
'glib-compile-resources', 'gsettings', 'gresource', 'gdbus',
'gio', 'gdbus-codegen']
foreach page : manpages
custom_target(page + '-man', custom_target(page + '-man',
input: page + '.rst', input: page + '.rst',
output: page + '.1', output: page + '.1',
@ -19,6 +28,25 @@ if get_option('man-pages').enabled()
endforeach endforeach
endif 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 if get_option('documentation') and enable_gir
expand_content_files = [ expand_content_files = [
'dbus-error.md', 'dbus-error.md',

View File

@ -1,7 +1,7 @@
glib_manpages = ['glib-gettextize', 'gtester', 'gtester-report']
if get_option('man-pages').enabled() if get_option('man-pages').enabled()
manpages = ['glib-gettextize', 'gtester', 'gtester-report'] foreach page: glib_manpages
foreach page : manpages
custom_target(page + '-man', custom_target(page + '-man',
input: page + '.rst', input: page + '.rst',
output: page + '.1', output: page + '.1',
@ -20,37 +20,49 @@ endif
if get_option('documentation') if get_option('documentation')
# GVariant specification is currently standalone # GVariant specification is currently standalone
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: false) spec_path = docs_dir / 'glib-2.0'
man_html_path = docs_dir / 'glib-2.0'
if rst2html5.found() figures = files(
spec_path = docs_dir / 'glib-2.0' 'gvariant-byte-boundaries.svg',
'gvariant-integer-and-string-structure.svg',
'gvariant-integer-array.svg',
'gvariant-string-array.svg',
)
figures = files( custom_target('gvariant-specification-1.0',
'gvariant-byte-boundaries.svg', input: 'gvariant-specification-1.0.rst',
'gvariant-integer-and-string-structure.svg', output: 'gvariant-specification-1.0.html',
'gvariant-integer-array.svg', command: [
'gvariant-string-array.svg', rst2html5,
) '@INPUT@',
],
capture: true,
install: true,
install_dir: spec_path,
install_tag: 'doc',
depend_files: figures,
)
custom_target('gvariant-specification-1.0', install_data(figures,
input: 'gvariant-specification-1.0.rst', install_dir: spec_path,
output: 'gvariant-specification-1.0.html', install_tag: 'doc',
)
foreach page: glib_manpages
custom_target(
input: page + '.rst',
output: page + '.html',
command: [ command: [
rst2html5, rst2html5,
'@INPUT@', '@INPUT@',
], ],
capture: true, capture: true,
install: true, install: true,
install_dir: spec_path, install_dir: man_html_path,
install_tag: 'doc', install_tag: 'doc',
depend_files: figures,
) )
endforeach
install_data(figures,
install_dir : spec_path,
install_tag : 'doc',
)
endif
endif endif
if get_option('documentation') and enable_gir 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() if get_option('man-pages').enabled()
manpages = ['glib-mkenums', 'glib-genmarshal', 'gobject-query'] foreach page: gobject_manpages
foreach page : manpages
custom_target(page + '-man', custom_target(page + '-man',
input: page + '.rst', input: page + '.rst',
output: page + '.1', output: page + '.1',
@ -17,6 +18,25 @@ if get_option('man-pages').enabled()
endforeach endforeach
endif 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 if get_option('documentation') and enable_gir
expand_content_files = [ expand_content_files = [
'boxed.md', 'boxed.md',

View File

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