From 689c989b9282610275d0476e5c856009f7d0492f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 1 Jun 2019 13:14:36 +0300 Subject: [PATCH] Generate man pages --- README.md | 5 +++++ meson.build | 32 ++++++++++++++++++++++++++++++++ meson_options.txt | 1 + 3 files changed, 38 insertions(+) create mode 100644 meson_options.txt diff --git a/README.md b/README.md index b11bb2d..ae18d36 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,11 @@ Join the IRC channel: ##emersion on Freenode. ## Building +Dependencies: + +* wayland-client +* scdoc (optional, for man pages) + ```sh meson build ninja -C build diff --git a/meson.build b/meson.build index 1eaf864..7f13c8b 100644 --- a/meson.build +++ b/meson.build @@ -48,3 +48,35 @@ executable( dependencies: [wayland_client, client_protos], install: true, ) + +scdoc = dependency( + 'scdoc', + version: '>=1.9.2', + native: true, + required: get_option('man-pages'), +) +if scdoc.found() + scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) + sh = find_program('sh', native: true) + mandir = get_option('mandir') + man_files = [ + 'kanshi.1.scd', + 'kanshi.5.scd', + ] + foreach filename : man_files + topic = filename.split('.')[-3].split('/')[-1] + section = filename.split('.')[-2] + output = '@0@.@1@'.format(topic, section) + + custom_target( + output, + input: filename, + output: output, + command: [ + sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output) + ], + install: true, + install_dir: join_paths(mandir, section), + ) + endforeach +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..e40a23d --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')