diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-04-06 04:46:03 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-04-24 03:47:26 +0200 |
commit | 527d43d7012d9f9a33be18b51306487edfe5ae57 (patch) | |
tree | 43c609fa1d0e355334b8bcc036b45ca76f609ba6 | |
parent | meson: add rule to generate custom-entities.ent (diff) | |
download | systemd-527d43d7012d9f9a33be18b51306487edfe5ae57.tar.xz systemd-527d43d7012d9f9a33be18b51306487edfe5ae57.zip |
meson: add custom targets man/man and man/html
This provides functionality similar to the ./configure --disable-manpages
switch. Man pages are built by default (if xsltproc is found), html pages
are not. Those default can be changed with -Dman=no, -Dhtml=yes/auto.
It is still possible to build one or the either, even if not configured, with
ninja-build man/man and ninja-build man/html.
v2:
- obey conditionals in index/directives list
-rw-r--r-- | man/meson.build | 86 | ||||
-rw-r--r-- | meson_options.txt | 5 |
2 files changed, 60 insertions, 31 deletions
diff --git a/man/meson.build b/man/meson.build index c78c24d3e6..691750c466 100644 --- a/man/meson.build +++ b/man/meson.build @@ -6,7 +6,13 @@ subdir('rules') # TODO: add regeneration rule: # python3 tools/make-man-rules.py --meson man/*xml > man/rules/meson.build -xsltproc = find_program('xsltproc') +want_man = get_option('man') +want_html = get_option('html') +xsltproc = find_program('xsltproc', + required : want_man == 'yes' or want_html == 'yes') +want_man = want_man != 'no' and xsltproc.found() +want_html = want_html != 'no' and xsltproc.found() + xsltproc_flags = [ '--nonet', '--xinclude', @@ -19,13 +25,16 @@ xsltproc_flags = [ '@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())] custom_man_xsl = files('custom-man.xsl') -custom_html_xsl = files('custom-man.xsl') +custom_html_xsl = files('custom-html.xsl') custom_entities_ent = configure_file( input : 'custom-entities.ent.in', output : 'custom-entities.ent', configuration : conf) +man_pages = [] +html_pages = [] +source_xml_files = [] foreach tuple : manpages stem = tuple[0] section = tuple[1] @@ -45,36 +54,37 @@ foreach tuple : manpages mandirn = get_option('mandir') + '/man' + section - install = condition == '' or conf.get(condition, 0) == 1 - - custom_target( - man, - input : xml, - output : [man] + manaliases, - command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'], - depend_files : custom_entities_ent, - install : install, - install_dir : mandirn) - - custom_target( - html, - input : xml, - output : [html] + htmlaliases, - command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'], - depend_files : custom_entities_ent) - - if not install - message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, install)) + have = condition == '' or conf.get(condition, 0) == 1 + + if have + p1 = custom_target( + man, + input : xml, + output : [man] + manaliases, + command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'], + depend_files : custom_entities_ent, + install : want_man, + install_dir : mandirn) + man_pages += [p1] + + p2 = custom_target( + html, + input : xml, + output : [html] + htmlaliases, + command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'], + depend_files : custom_entities_ent, + install : want_html, + install_dir : docdir + '/html') + html_pages += [p2] + + source_xml_files += files(tuple[0] + '.xml') + else + message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, have)) endif endforeach ############################################################ -source_xml_files = files() -foreach tuple : manpages - source_xml_files += files(tuple[0] + '.xml') -endforeach - systemd_directives_xml = custom_target( 'systemd.directives.xml', input : source_xml_files, @@ -99,17 +109,31 @@ foreach tuple : [['systemd.directives', '7', systemd_directives_xml], mandirn = get_option('mandir') + '/man' + section - custom_target( + p1 = custom_target( man, input : xml, output : man, command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'], - install : install, + install : want_man, install_dir : mandirn) + man_pages += [p1] - custom_target( + p2 = custom_target( html, input : xml, output : html, - command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@']) + command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'], + install : want_html, + install_dir : docdir + '/html') + html_pages += [p2] endforeach + +custom_target('man', + depends : man_pages, + output : ['man'], + command : ['echo']) + +custom_target('html', + depends : html_pages, + output : ['html'], + command : ['echo']) diff --git a/meson_options.txt b/meson_options.txt index 8a08852983..cc93310679 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -76,6 +76,11 @@ option('hwdb', type : 'boolean', description : 'support for the hardware database') option('rfkill', type : 'boolean', description : 'support for the rfkill tools') +option('man', type : 'combo', choices : ['auto', 'yes', 'no'], + description : 'build and install man pages') +option('html', type : 'combo', choices : ['auto', 'yes', 'no'], + value : 'no', + description : 'build and install html pages') option('certificate-root', type : 'string', value : '/etc/ssl', description : 'the prefix for TLS certificates') |