From 6738962073008e2067e11be3082c19048d46a0cb Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Tue, 31 May 2022 20:03:49 +0200 Subject: [PATCH] meson: Build manpage with rst2man Closes #457 --- doc/meson.build | 16 ++++++++++++++++ meson_options.txt | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/doc/meson.build b/doc/meson.build index d7d728a..39d6e8f 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -44,3 +44,19 @@ gnome.gtkdoc('calls', install: true) endif + +rst2man = find_program('rst2man', 'rst2man.py', required: false) +if get_option('manpages') and not rst2man.found() + error('No rst2man found, but man pages were explicitly enabled') +endif + +if get_option('manpages') and rst2man.found() + custom_target('man-gnome-calls', + input: 'gnome-calls.rst', + output: 'gnome-calls.1', + command: [rst2man, '@INPUT@'], + capture: true, + install: true, + install_dir: get_option('mandir') / 'man1', + ) +endif diff --git a/meson_options.txt b/meson_options.txt index 41f2046..141ed30 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,3 +5,7 @@ option('gtk_doc', option('tests', type: 'boolean', value: true, description: 'Whether to compile unit tests') + +option('manpages', + type: 'boolean', value: true, + description: 'Whether to generate man pages')