mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 07:02:34 +02:00

Use sphinx (sphinx-doc.org) to generate the UNIX man page from an reStructuredText file instead of dealing with plain groff. Use `meson setup -Dman-pages=enabled` to build the man page, and `meson setup -Ddocumentation=enabled` to build the web documentation explicitly. Both are enabled automatically if sphinx-build is found. The man page will be installed as `<meson_mandir>/man8/flashrom.8` and The html documentation in <meson_datadir>/doc/flashrom/html`. The Makefile builds only the man-page format. Increase the minimum version of meson from 0.53.0 to 0.57.0 to be able to pass environment variables to the custom_target() command. That is needed to pass the FLASHROM_VERSION to the documentation. Change-Id: Iee9f1164c5913e47385e6f7d51dc7775a58b5a67 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/72619 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Alexander Goncharov <chat@joursoir.net>
39 lines
1.2 KiB
Meson
39 lines
1.2 KiB
Meson
|
|
sphinx = find_program('sphinx-build', native : true, required : get_option('man-pages').enabled() or get_option('documentation').enabled())
|
|
|
|
man_pages = [
|
|
'flashrom.8'
|
|
]
|
|
|
|
if sphinx.found()
|
|
if get_option('man-pages').auto() or get_option('man-pages').enabled()
|
|
man_outputs = []
|
|
foreach page : man_pages
|
|
man_outputs += 'man' + page.substring(-1)
|
|
endforeach
|
|
|
|
custom_target(
|
|
'man-pages',
|
|
command : [sphinx, '-b', 'man', '-q', '-d', '@PRIVATE_DIR@', '@CURRENT_SOURCE_DIR@', '@OUTDIR@'],
|
|
env : {'FLASHROM_VERSION' : meson.project_version() },
|
|
build_always_stale : true, # sphinx handles rebuilds
|
|
output : man_outputs,
|
|
install : true,
|
|
install_dir : get_option('mandir'),
|
|
)
|
|
endif
|
|
|
|
if get_option('documentation').auto() or get_option('documtation').enabled()
|
|
custom_target(
|
|
'documentation',
|
|
command : [sphinx, '-b', 'html', '-q', '-d', '@PRIVATE_DIR@', '@CURRENT_SOURCE_DIR@', '@OUTDIR@/html'],
|
|
env : {'FLASHROM_VERSION' : meson.project_version() },
|
|
build_always_stale : true, # sphinx handles rebuilds
|
|
output : 'html',
|
|
install : true,
|
|
install_dir : get_option('datadir') + '/doc/flashrom'
|
|
)
|
|
endif
|
|
|
|
endif
|