Generate man pages

This commit is contained in:
Simon Ser 2019-06-01 13:14:36 +03:00
parent 4b16771942
commit 689c989b92
3 changed files with 38 additions and 0 deletions

View File

@ -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

View File

@ -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

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')