meson: Implement developer documentation build

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas 2021-08-05 22:43:54 +03:00
parent 722da1c62c
commit 18d3131f9a
8 changed files with 243 additions and 1 deletions

64
doc/dtrace/meson.build Normal file
View File

@ -0,0 +1,64 @@
if build_docs
basename = 'Xserver-DTrace'
input_xml = basename + '.xml'
custom_target(
basename + '.html',
output: basename + '.html',
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-xhtml.xsl'),
'--stringparam', 'target.database.document=' + join_paths(doc_sgml_path, 'X11/dbs/masterdb.html.xml'),
'--stringparam', 'current.docid=' + basename,
'-o', meson.current_build_dir(),
'xhtml-nochunks', '@INPUT0@'],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc/xorg-server'),
)
if build_docs_pdf
foreach format : ['ps', 'pdf']
output_fn = basename + '.' + format
custom_target(
output_fn,
output: output_fn,
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-fo.xsl'),
'--stringparam', 'img.src.path=' + meson.current_build_dir(),
'--stringparam', 'target.database.document=' + join_paths(doc_sgml_path, 'X11/dbs/masterdb.pdf.xml'),
'--stringparam', 'current.docid=' + basename,
'-o', meson.current_build_dir(),
'--with-fop', format, '@INPUT0@'],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc/xorg-server'),
)
endforeach
endif
foreach format_data : [['html', 'xorg-xhtml.xsl'], ['pdf', 'xorg-fo.xsl']]
format = format_data[0]
stylesheet = format_data[1]
output_fn = basename + '.' + format + '.db'
custom_target(
output_fn,
output: output_fn,
input: [input_xml],
command: [xsltproc] + docs_xslt_search_flags + [
'--stringparam', 'targets.filename', output_fn,
'--stringparam', 'collect.xref.targets', 'only',
'--stringparam', 'olink.base.uri', basename + '.' + format,
'--nonet',
'--output', join_paths(meson.current_build_dir(), output_fn),
'--xinclude', join_paths(doc_stylesheet_srcdir, stylesheet),
'@INPUT0@'],
build_by_default: true,
install: true,
install_dir: join_paths(get_option('datadir'), 'doc/xorg-server'),
)
endforeach
endif

39
doc/meson.build Normal file
View File

@ -0,0 +1,39 @@
if build_docs_devel
foreach basename : ['Xserver-spec', 'Xinput']
input_xml = basename + '.xml'
custom_target(
basename + '.html',
output: basename + '.html',
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-xhtml.xsl'),
'-o', meson.current_build_dir(),
'xhtml-nochunks', '@INPUT0@'],
build_by_default: true,
install: false,
)
if build_docs_pdf
foreach format : ['ps', 'pdf']
output_fn = basename + '.' + format
custom_target(
output_fn,
output: output_fn,
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-fo.xsl'),
'--stringparam', 'img.src.path=' + meson.current_build_dir(),
'-o', meson.current_build_dir(),
'--with-fop', format, '@INPUT0@'],
build_by_default: true,
install: false,
)
endforeach
endif
endforeach
endif
subdir('dtrace')

37
hw/dmx/doc/meson.build Normal file
View File

@ -0,0 +1,37 @@
if build_docs_devel
foreach basename : ['dmx', 'scaled']
input_xml = basename + '.xml'
custom_target(
basename + '.html',
output: basename + '.html',
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-xhtml.xsl'),
'-o', meson.current_build_dir(),
'xhtml-nochunks', '@INPUT0@'],
build_by_default: true,
install: false,
)
if build_docs_pdf
foreach format : ['ps', 'pdf']
output_fn = basename + '.' + format
custom_target(
output_fn,
output: output_fn,
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-fo.xsl'),
'--stringparam', 'img.src.path=' + meson.current_build_dir(),
'-o', meson.current_build_dir(),
'--with-fop', format, '@INPUT0@'],
build_by_default: true,
install: false,
)
endforeach
endif
endforeach
endif

View File

@ -27,7 +27,7 @@ srcs = [
subdir('config')
subdir('input')
subdir('examples')
# XXX: subdir('doc')
subdir('doc')
# XXX: subdir('doxygen')
install_man(configure_file(

View File

@ -0,0 +1,35 @@
if build_docs_devel
basename = 'ddxDesign'
input_xml = basename + '.xml'
custom_target(
basename + '.html',
output: basename + '.html',
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-xhtml.xsl'),
'-o', meson.current_build_dir(),
'xhtml-nochunks', '@INPUT0@'],
build_by_default: true,
install: false,
)
if build_docs_pdf
foreach format : ['ps', 'pdf']
output_fn = basename + '.' + format
custom_target(
output_fn,
output: output_fn,
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-fo.xsl'),
'--stringparam', 'img.src.path=' + meson.current_build_dir(),
'-o', meson.current_build_dir(),
'--with-fop', format, '@INPUT0@'],
build_by_default: true,
install: false,
)
endforeach
endif
endif

View File

@ -230,3 +230,5 @@ install_man(configure_file(
output: 'gtf.1',
configuration: manpage_config,
))
subdir('doc')

View File

@ -6,6 +6,8 @@ project('xserver', 'c',
version: '21.0.99.1',
meson_version: '>= 0.47.0',
)
release_date = '2021-07-05'
add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc'])
cc = meson.get_compiler('c')
@ -689,6 +691,50 @@ manpage_config.set('modulepath', module_dir)
manpage_config.set('suid_wrapper_dir', join_paths(get_option('prefix'), 'libexec'))
manpage_config.set('default_font_path', default_font_path)
require_docs = get_option('docs') == 'true'
require_devel_docs = get_option('devel-docs') == 'true'
require_docs_pdf = (require_docs or require_devel_docs) and get_option('docs-pdf') == 'true'
sgml_doctools_dep = dependency('xorg-sgml-doctools',
required: require_docs or require_devel_docs)
xmlto = find_program('xmlto', required: require_docs or require_devel_docs)
xsltproc = find_program('xsltproc', required: require_docs or require_devel_docs)
fop = find_program('fop', required: require_docs_pdf)
build_docs = (get_option('docs') != 'false' and
sgml_doctools_dep.found() and
xmlto.found())
build_docs_devel = (get_option('devel-docs') != 'false' and
sgml_doctools_dep.found() and
xmlto.found())
build_docs_pdf = (get_option('docs-pdf') != 'false' and
(build_docs or build_docs_devel) and
fop.found())
if build_docs or build_docs_devel
doc_sgml_path = sgml_doctools_dep.get_pkgconfig_variable('sgmlrootdir')
doc_stylesheet_srcdir = join_paths(doc_sgml_path, 'X11')
# once we bump meson dependency to 0.56.0 we can use
# meson.project_build_root() instead of meson.build_root()
# Meson does not and will not support functions so we are copy-pasting
# documentation build code around which is unfortunate
# See https://mesonbuild.com/FAQ.html#why-doesnt-meson-have-user-defined-functionsmacros
docs_xmlto_search_flags = [
'--searchpath', doc_stylesheet_srcdir,
'--searchpath', meson.build_root(),
]
docs_xslt_search_flags = [
'--path', doc_stylesheet_srcdir,
'--path', meson.build_root(),
]
endif
# Include must come first, as it sets up dix-config.h
subdir('include')
@ -728,6 +774,7 @@ endif
if build_xorg or get_option('xephyr')
subdir('exa')
endif
subdir('doc')
# Common static libraries of all X servers
libxserver = [
@ -825,3 +872,14 @@ if build_xorg
install_data('xorg-server.m4',
install_dir: join_paths(get_option('datadir'), 'aclocal'))
endif
if build_docs or build_docs_devel
docxmlconfig = configuration_data()
docxmlconfig.set('PACKAGE_VERSION', meson.project_version())
docxmlconfig.set('RELEASE_DATE', release_date)
configure_file(
input: 'xserver.ent.in',
output: 'xserver.ent',
configuration: docxmlconfig
)
endif

View File

@ -131,3 +131,10 @@ option('libunwind', type: 'boolean', value: false,
description: 'Use libunwind for backtrace reporting')
option('xwayland-path', type: 'string', description: 'Directory containing Xwayland executable')
option('docs', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Build documentation')
option('devel-docs', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Build development documentation')
option('docs-pdf', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto',
description: 'Whether to build PDF version of documentation. Setting is ignored if documentation is not built.')