mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
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
This commit is contained in:
parent
04e3eb46e3
commit
527d43d701
@ -6,7 +6,13 @@ subdir('rules')
|
|||||||
# TODO: add regeneration rule:
|
# TODO: add regeneration rule:
|
||||||
# python3 tools/make-man-rules.py --meson man/*xml > man/rules/meson.build
|
# 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 = [
|
xsltproc_flags = [
|
||||||
'--nonet',
|
'--nonet',
|
||||||
'--xinclude',
|
'--xinclude',
|
||||||
@ -19,13 +25,16 @@ xsltproc_flags = [
|
|||||||
'@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())]
|
'@0@:@1@'.format(meson.current_build_dir(), meson.current_source_dir())]
|
||||||
|
|
||||||
custom_man_xsl = files('custom-man.xsl')
|
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(
|
custom_entities_ent = configure_file(
|
||||||
input : 'custom-entities.ent.in',
|
input : 'custom-entities.ent.in',
|
||||||
output : 'custom-entities.ent',
|
output : 'custom-entities.ent',
|
||||||
configuration : conf)
|
configuration : conf)
|
||||||
|
|
||||||
|
man_pages = []
|
||||||
|
html_pages = []
|
||||||
|
source_xml_files = []
|
||||||
foreach tuple : manpages
|
foreach tuple : manpages
|
||||||
stem = tuple[0]
|
stem = tuple[0]
|
||||||
section = tuple[1]
|
section = tuple[1]
|
||||||
@ -45,36 +54,37 @@ foreach tuple : manpages
|
|||||||
|
|
||||||
mandirn = get_option('mandir') + '/man' + section
|
mandirn = get_option('mandir') + '/man' + section
|
||||||
|
|
||||||
install = condition == '' or conf.get(condition, 0) == 1
|
have = condition == '' or conf.get(condition, 0) == 1
|
||||||
|
|
||||||
custom_target(
|
if have
|
||||||
|
p1 = custom_target(
|
||||||
man,
|
man,
|
||||||
input : xml,
|
input : xml,
|
||||||
output : [man] + manaliases,
|
output : [man] + manaliases,
|
||||||
command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
|
command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
|
||||||
depend_files : custom_entities_ent,
|
depend_files : custom_entities_ent,
|
||||||
install : install,
|
install : want_man,
|
||||||
install_dir : mandirn)
|
install_dir : mandirn)
|
||||||
|
man_pages += [p1]
|
||||||
|
|
||||||
custom_target(
|
p2 = custom_target(
|
||||||
html,
|
html,
|
||||||
input : xml,
|
input : xml,
|
||||||
output : [html] + htmlaliases,
|
output : [html] + htmlaliases,
|
||||||
command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'],
|
command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_html_xsl, '@INPUT@'],
|
||||||
depend_files : custom_entities_ent)
|
depend_files : custom_entities_ent,
|
||||||
|
install : want_html,
|
||||||
|
install_dir : docdir + '/html')
|
||||||
|
html_pages += [p2]
|
||||||
|
|
||||||
if not install
|
source_xml_files += files(tuple[0] + '.xml')
|
||||||
message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, install))
|
else
|
||||||
|
message('Skipping @0@.@1@ because @2@ is @3@'.format(stem, section, condition, have))
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
|
|
||||||
source_xml_files = files()
|
|
||||||
foreach tuple : manpages
|
|
||||||
source_xml_files += files(tuple[0] + '.xml')
|
|
||||||
endforeach
|
|
||||||
|
|
||||||
systemd_directives_xml = custom_target(
|
systemd_directives_xml = custom_target(
|
||||||
'systemd.directives.xml',
|
'systemd.directives.xml',
|
||||||
input : source_xml_files,
|
input : source_xml_files,
|
||||||
@ -99,17 +109,31 @@ foreach tuple : [['systemd.directives', '7', systemd_directives_xml],
|
|||||||
|
|
||||||
mandirn = get_option('mandir') + '/man' + section
|
mandirn = get_option('mandir') + '/man' + section
|
||||||
|
|
||||||
custom_target(
|
p1 = custom_target(
|
||||||
man,
|
man,
|
||||||
input : xml,
|
input : xml,
|
||||||
output : man,
|
output : man,
|
||||||
command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
|
command : [xsltproc, '-o', '@OUTPUT0@'] + xsltproc_flags + [custom_man_xsl, '@INPUT@'],
|
||||||
install : install,
|
install : want_man,
|
||||||
install_dir : mandirn)
|
install_dir : mandirn)
|
||||||
|
man_pages += [p1]
|
||||||
|
|
||||||
custom_target(
|
p2 = custom_target(
|
||||||
html,
|
html,
|
||||||
input : xml,
|
input : xml,
|
||||||
output : html,
|
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
|
endforeach
|
||||||
|
|
||||||
|
custom_target('man',
|
||||||
|
depends : man_pages,
|
||||||
|
output : ['man'],
|
||||||
|
command : ['echo'])
|
||||||
|
|
||||||
|
custom_target('html',
|
||||||
|
depends : html_pages,
|
||||||
|
output : ['html'],
|
||||||
|
command : ['echo'])
|
||||||
|
@ -76,6 +76,11 @@ option('hwdb', type : 'boolean',
|
|||||||
description : 'support for the hardware database')
|
description : 'support for the hardware database')
|
||||||
option('rfkill', type : 'boolean',
|
option('rfkill', type : 'boolean',
|
||||||
description : 'support for the rfkill tools')
|
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',
|
option('certificate-root', type : 'string', value : '/etc/ssl',
|
||||||
description : 'the prefix for TLS certificates')
|
description : 'the prefix for TLS certificates')
|
||||||
|
Loading…
Reference in New Issue
Block a user