From 72575ccadb235c6636ef0e10519caee5dc2a4ffd Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 24 Mar 2019 13:39:47 +0200 Subject: Use scdoc to generate manpages --- doc/meson.build | 56 ++++++++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 34 deletions(-) (limited to 'doc/meson.build') diff --git a/doc/meson.build b/doc/meson.build index 26175ce..95ca486 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,42 +1,30 @@ -asciidoctor = find_program('asciidoctor', required: get_option('manpage'), disabler: true) +scdoc = find_program('scdoc', required: get_option('manpage'), disabler: true) +sh = find_program('sh', required: get_option('manpage'), native: true, disabler: true) -custom_target('manpage.7', - # list depend_files so the output can be updated if any of them are changed - depend_files: ['smolbote.7.asciidoc', 'Usage/CommandLine.asciidoc', 'Usage/Configuration.asciidoc', 'Usage/Profile.asciidoc', 'Usage/Plugins.asciidoc', 'Usage/Filter.asciidoc'], - - input: 'smolbote.7.asciidoc', - output: 'smolbote.7', +man_files = ['man/smolbote.1.scd', 'man/smolbote.5.scd'] - command: [asciidoctor, '--backend=manpage', '--out-file=@OUTPUT@', '@INPUT@'], +foreach input : man_files + topic = input.split('/')[-1].split('.')[-3] + section = input.split('.')[-2] + output = '@0@.@1@'.format(topic, section) - build_by_default: get_option('manpage').enabled(), - install: get_option('manpage').enabled(), - install_dir: join_paths(get_option('mandir'), 'man7') -) + message('creating manpage target ' + output) + custom_target(output, + build_by_default: true, -custom_target('manpage.5', - # list of files this target depends on - depend_files: ['smolbote.5.asciidoc'], + input: input, + output: output, - input: 'smolbote.5.asciidoc', - output: 'smolbote.5', + # scdoc takes input from stdin, and prints its output to stdout + # meson uses 'capture' to store stdout to output, but there is no stdin toggle + #command: [scdoc], + #capture: true, - command: [asciidoctor, '--backend=manpage', '--out-file=@OUTPUT@', '@INPUT@'], + # workaround using sh + command: [sh, '-c', '@0@ < @INPUT0@ > @OUTPUT0@'.format(scdoc.path())], - build_by_default: get_option('manpage').enabled(), - install: get_option('manpage').enabled(), - install_dir: get_option('mandir') / 'man5' -) - -custom_target('manual', - depend_files: ['smolbote.asciidoc'], - - input: 'smolbote.asciidoc', - output: 'manual.html', - - command: [asciidoctor, '-a', 'imagesdir=images', '--out-file=@OUTPUT@', '@INPUT@'], - - build_by_default: false, - install: false -) + install: true, + install_dir: '@0@/man@1@'.format(get_option('mandir'), section) + ) +endforeach -- cgit v1.2.1