From bbb5fa66a7fe53c492e4cc2e616c4ada38712542 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 28 Oct 2025 00:36:53 +0100 Subject: [PATCH] doc: Refactor the build system for complete build dir docs By structuring things differently, it becomes possible to have a complete build of the docs in the build dir, without having to install anything. Signed-off-by: Sebastian Wick --- doc/doxygen/meson.build | 12 -- doc/doxygen/xml/Client/meson.build | 1 - doc/doxygen/xml/Server/meson.build | 1 - doc/doxygen/xml/meson.build | 20 --- doc/publican/{sources => }/Architecture.xml | 0 doc/publican/{sources => }/Author_Group.xml | 0 doc/publican/{sources => }/Book_Info.xml | 0 doc/publican/{sources => }/Client.xml | 0 doc/publican/{sources => }/Color.xml | 0 doc/publican/{sources => }/Compositors.xml | 0 doc/publican/{sources => }/Foreword.xml | 0 doc/publican/{sources => }/Introduction.xml | 0 doc/publican/{sources => }/Preface.xml | 0 doc/publican/{sources => }/Protocol.xml | 0 .../{sources => }/Revision_History.xml | 0 doc/publican/{sources => }/Server.xml | 0 doc/publican/{sources => }/Wayland.ent | 0 doc/publican/{sources => }/Wayland.xml | 0 doc/publican/{sources => }/Xwayland.xml | 0 doc/publican/{sources => html}/css/brand.css | 0 doc/publican/{sources => html}/css/common.css | 0 .../{sources => html}/css/default.css | 0 doc/publican/{sources => html}/css/epub.css | 0 doc/publican/html/css/meson.build | 14 +++ doc/publican/{sources => html}/css/print.css | 0 .../{sources => html}/images/icon.svg | 0 doc/publican/html/images/meson.build | 28 +++++ .../html/images}/wayland-architecture.gv | 0 .../{sources => html}/images/wayland.png | Bin .../html/images}/x-architecture.gv | 0 .../images/xwayland-architecture.png | Bin doc/publican/meson.build | 106 +++++++++++++--- doc/publican/sources/meson.build | 114 ------------------ .../{ => xsl}/doxygen-to-publican.xsl | 0 doc/publican/{ => xsl}/merge-mapcoords.xsl | 0 .../protocol-interfaces-to-docbook.xsl | 0 .../{ => xsl}/protocol-to-docbook.xsl | 0 meson.build | 6 +- 38 files changed, 138 insertions(+), 164 deletions(-) rename doc/publican/{sources => }/Architecture.xml (100%) rename doc/publican/{sources => }/Author_Group.xml (100%) rename doc/publican/{sources => }/Book_Info.xml (100%) rename doc/publican/{sources => }/Client.xml (100%) rename doc/publican/{sources => }/Color.xml (100%) rename doc/publican/{sources => }/Compositors.xml (100%) rename doc/publican/{sources => }/Foreword.xml (100%) rename doc/publican/{sources => }/Introduction.xml (100%) rename doc/publican/{sources => }/Preface.xml (100%) rename doc/publican/{sources => }/Protocol.xml (100%) rename doc/publican/{sources => }/Revision_History.xml (100%) rename doc/publican/{sources => }/Server.xml (100%) rename doc/publican/{sources => }/Wayland.ent (100%) rename doc/publican/{sources => }/Wayland.xml (100%) rename doc/publican/{sources => }/Xwayland.xml (100%) rename doc/publican/{sources => html}/css/brand.css (100%) rename doc/publican/{sources => html}/css/common.css (100%) rename doc/publican/{sources => html}/css/default.css (100%) rename doc/publican/{sources => html}/css/epub.css (100%) create mode 100644 doc/publican/html/css/meson.build rename doc/publican/{sources => html}/css/print.css (100%) rename doc/publican/{sources => html}/images/icon.svg (100%) create mode 100644 doc/publican/html/images/meson.build rename doc/{doxygen/dot => publican/html/images}/wayland-architecture.gv (100%) rename doc/publican/{sources => html}/images/wayland.png (100%) rename doc/{doxygen/dot => publican/html/images}/x-architecture.gv (100%) rename doc/publican/{sources => html}/images/xwayland-architecture.png (100%) delete mode 100644 doc/publican/sources/meson.build rename doc/publican/{ => xsl}/doxygen-to-publican.xsl (100%) rename doc/publican/{ => xsl}/merge-mapcoords.xsl (100%) rename doc/publican/{ => xsl}/protocol-interfaces-to-docbook.xsl (100%) rename doc/publican/{ => xsl}/protocol-to-docbook.xsl (100%) diff --git a/doc/doxygen/meson.build b/doc/doxygen/meson.build index 61126206..551bd4b4 100644 --- a/doc/doxygen/meson.build +++ b/doc/doxygen/meson.build @@ -1,16 +1,5 @@ # Here be dragons -dot_gv = { - 'wayland-architecture': files('dot/wayland-architecture.gv'), - 'x-architecture': files('dot/x-architecture.gv'), -} - -# This is a workaround for Meson's custom_target() directive, which -# currently does not support outputs pointing to a sub-directory -# XXX: try turning these into maps, so they can be indexed with picture name -dot_png = [] -dot_map = [] - doxygen_conf = configuration_data() doxygen_conf.set('VERSION', meson.project_version()) doxygen_conf.set('top_builddir', meson.project_build_root()) @@ -91,7 +80,6 @@ foreach f_name, sections: formats ], input: s_files, output: '@0@.stamp'.format(t_name), - depends: [dot_png, dot_map], build_by_default: true, ) endforeach diff --git a/doc/doxygen/xml/Client/meson.build b/doc/doxygen/xml/Client/meson.build index 849c30da..e51fccb6 100644 --- a/doc/doxygen/xml/Client/meson.build +++ b/doc/doxygen/xml/Client/meson.build @@ -11,7 +11,6 @@ tgt = custom_target( ], input: [ shared_files, client_files ], output: [ 'combine.xslt', 'index.xml' ], - depends: [dot_png, dot_map] ) doxygen_Client_combine_xslt = tgt[0] diff --git a/doc/doxygen/xml/Server/meson.build b/doc/doxygen/xml/Server/meson.build index 4792c1bc..5df97440 100644 --- a/doc/doxygen/xml/Server/meson.build +++ b/doc/doxygen/xml/Server/meson.build @@ -11,7 +11,6 @@ tgt = custom_target( ], input: [ shared_files, server_files ], output: [ 'combine.xslt', 'index.xml' ], - depends: [dot_png, dot_map] ) doxygen_Server_combine_xslt = tgt[0] diff --git a/doc/doxygen/xml/meson.build b/doc/doxygen/xml/meson.build index 6d55c53a..479af8e7 100644 --- a/doc/doxygen/xml/meson.build +++ b/doc/doxygen/xml/meson.build @@ -1,22 +1,2 @@ -# dot_png: list of PNG targets -# dot_map: list of MAP targets -foreach name, infile: dot_gv - dot_png += custom_target( - name + '.png', - command: [ dot, '-Tpng', '-o@OUTPUT@', '@INPUT@' ], - input: infile, - output: name + '.png', - install: true, - install_dir: join_paths(publican_install_prefix, publican_html_dir, 'images') - ) - - dot_map += custom_target( - name + '.map', - command: [ dot, '-Tcmapx_np', '-o@OUTPUT@', '@INPUT@' ], - input: infile, - output: name + '.map', - ) -endforeach - subdir('Client') subdir('Server') diff --git a/doc/publican/sources/Architecture.xml b/doc/publican/Architecture.xml similarity index 100% rename from doc/publican/sources/Architecture.xml rename to doc/publican/Architecture.xml diff --git a/doc/publican/sources/Author_Group.xml b/doc/publican/Author_Group.xml similarity index 100% rename from doc/publican/sources/Author_Group.xml rename to doc/publican/Author_Group.xml diff --git a/doc/publican/sources/Book_Info.xml b/doc/publican/Book_Info.xml similarity index 100% rename from doc/publican/sources/Book_Info.xml rename to doc/publican/Book_Info.xml diff --git a/doc/publican/sources/Client.xml b/doc/publican/Client.xml similarity index 100% rename from doc/publican/sources/Client.xml rename to doc/publican/Client.xml diff --git a/doc/publican/sources/Color.xml b/doc/publican/Color.xml similarity index 100% rename from doc/publican/sources/Color.xml rename to doc/publican/Color.xml diff --git a/doc/publican/sources/Compositors.xml b/doc/publican/Compositors.xml similarity index 100% rename from doc/publican/sources/Compositors.xml rename to doc/publican/Compositors.xml diff --git a/doc/publican/sources/Foreword.xml b/doc/publican/Foreword.xml similarity index 100% rename from doc/publican/sources/Foreword.xml rename to doc/publican/Foreword.xml diff --git a/doc/publican/sources/Introduction.xml b/doc/publican/Introduction.xml similarity index 100% rename from doc/publican/sources/Introduction.xml rename to doc/publican/Introduction.xml diff --git a/doc/publican/sources/Preface.xml b/doc/publican/Preface.xml similarity index 100% rename from doc/publican/sources/Preface.xml rename to doc/publican/Preface.xml diff --git a/doc/publican/sources/Protocol.xml b/doc/publican/Protocol.xml similarity index 100% rename from doc/publican/sources/Protocol.xml rename to doc/publican/Protocol.xml diff --git a/doc/publican/sources/Revision_History.xml b/doc/publican/Revision_History.xml similarity index 100% rename from doc/publican/sources/Revision_History.xml rename to doc/publican/Revision_History.xml diff --git a/doc/publican/sources/Server.xml b/doc/publican/Server.xml similarity index 100% rename from doc/publican/sources/Server.xml rename to doc/publican/Server.xml diff --git a/doc/publican/sources/Wayland.ent b/doc/publican/Wayland.ent similarity index 100% rename from doc/publican/sources/Wayland.ent rename to doc/publican/Wayland.ent diff --git a/doc/publican/sources/Wayland.xml b/doc/publican/Wayland.xml similarity index 100% rename from doc/publican/sources/Wayland.xml rename to doc/publican/Wayland.xml diff --git a/doc/publican/sources/Xwayland.xml b/doc/publican/Xwayland.xml similarity index 100% rename from doc/publican/sources/Xwayland.xml rename to doc/publican/Xwayland.xml diff --git a/doc/publican/sources/css/brand.css b/doc/publican/html/css/brand.css similarity index 100% rename from doc/publican/sources/css/brand.css rename to doc/publican/html/css/brand.css diff --git a/doc/publican/sources/css/common.css b/doc/publican/html/css/common.css similarity index 100% rename from doc/publican/sources/css/common.css rename to doc/publican/html/css/common.css diff --git a/doc/publican/sources/css/default.css b/doc/publican/html/css/default.css similarity index 100% rename from doc/publican/sources/css/default.css rename to doc/publican/html/css/default.css diff --git a/doc/publican/sources/css/epub.css b/doc/publican/html/css/epub.css similarity index 100% rename from doc/publican/sources/css/epub.css rename to doc/publican/html/css/epub.css diff --git a/doc/publican/html/css/meson.build b/doc/publican/html/css/meson.build new file mode 100644 index 00000000..699d70ef --- /dev/null +++ b/doc/publican/html/css/meson.build @@ -0,0 +1,14 @@ +foreach src : files([ + 'brand.css', + 'common.css', + 'default.css', + 'epub.css', + 'print.css', +]) + name = fs.name(src) + publican_inputs += fs.copyfile( + name, + install: true, + install_dir: publican_install_prefix + '/html/css', + ) +endforeach diff --git a/doc/publican/sources/css/print.css b/doc/publican/html/css/print.css similarity index 100% rename from doc/publican/sources/css/print.css rename to doc/publican/html/css/print.css diff --git a/doc/publican/sources/images/icon.svg b/doc/publican/html/images/icon.svg similarity index 100% rename from doc/publican/sources/images/icon.svg rename to doc/publican/html/images/icon.svg diff --git a/doc/publican/html/images/meson.build b/doc/publican/html/images/meson.build new file mode 100644 index 00000000..98e5b937 --- /dev/null +++ b/doc/publican/html/images/meson.build @@ -0,0 +1,28 @@ +foreach src : files([ + 'icon.svg', + 'wayland.png', +]) + name = fs.name(src) + publican_inputs += fs.copyfile( + name, + install: true, + install_dir: publican_install_prefix + '/html/images', + ) +endforeach + +foreach src : files([ + 'wayland-architecture.gv', + 'x-architecture.gv', +]) + input = fs.name(src) + output = fs.stem(src) + '.png' + + publican_inputs += custom_target( + input + '.png', + command: [ dot, '-Tpng', '-o@OUTPUT@', '@INPUT@' ], + input: input, + output: output, + install: true, + install_dir: publican_install_prefix + '/html/images', + ) +endforeach diff --git a/doc/doxygen/dot/wayland-architecture.gv b/doc/publican/html/images/wayland-architecture.gv similarity index 100% rename from doc/doxygen/dot/wayland-architecture.gv rename to doc/publican/html/images/wayland-architecture.gv diff --git a/doc/publican/sources/images/wayland.png b/doc/publican/html/images/wayland.png similarity index 100% rename from doc/publican/sources/images/wayland.png rename to doc/publican/html/images/wayland.png diff --git a/doc/doxygen/dot/x-architecture.gv b/doc/publican/html/images/x-architecture.gv similarity index 100% rename from doc/doxygen/dot/x-architecture.gv rename to doc/publican/html/images/x-architecture.gv diff --git a/doc/publican/sources/images/xwayland-architecture.png b/doc/publican/html/images/xwayland-architecture.png similarity index 100% rename from doc/publican/sources/images/xwayland-architecture.png rename to doc/publican/html/images/xwayland-architecture.png diff --git a/doc/publican/meson.build b/doc/publican/meson.build index eac3e9b2..83556f0d 100644 --- a/doc/publican/meson.build +++ b/doc/publican/meson.build @@ -1,6 +1,92 @@ -merge_mapcoords_xsl = files('merge-mapcoords.xsl') +proto_to_docboox_xsl = files('xsl/protocol-to-docbook.xsl') +proto_iface_to_docboox_xsl = files('xsl/protocol-interfaces-to-docbook.xsl') +merge_mapcoords_xsl = files('xsl/merge-mapcoords.xsl') +to_publican_xsl = files('xsl/doxygen-to-publican.xsl') -subdir('sources') +publican_inputs = [] + +foreach src : files([ + 'Wayland.xml', # must be first in publican_inputs + 'Wayland.ent', + 'Book_Info.xml', + 'Author_Group.xml', + 'Foreword.xml', + 'Preface.xml', + 'Revision_History.xml', + 'Protocol.xml', + 'Xwayland.xml', + 'Compositors.xml', + 'Color.xml', + 'Client.xml', + 'Server.xml', +]) + name = fs.name(src) + publican_inputs += fs.copyfile(name) +endforeach + +publican_inputs += custom_target( + 'ProtocolSpec.xml', + command: [ xsltproc, '-o', '@OUTPUT@', proto_to_docboox_xsl, '@INPUT@' ], + input: wayland_protocol_xml, + output: 'ProtocolSpec.xml' +) + +publican_inputs += custom_target( + 'ProtocolInterfaces.xml', + command: [ xsltproc, '-o', '@OUTPUT@', proto_iface_to_docboox_xsl, '@INPUT@' ], + input: wayland_protocol_xml, + output: 'ProtocolInterfaces.xml' +) + +ClientAPI_combined = custom_target( + 'ClientAPI-combined', + command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@' ], + input: [ doxygen_Client_combine_xslt, doxygen_Client_index_xml ], + output: 'ClientAPI-combined.xml' +) + +publican_inputs += custom_target( + 'ClientAPI.xml', + command: [ xsltproc, '-o', '@OUTPUT@', '--stringparam', 'which', 'Client', to_publican_xsl, '@INPUT@' ], + input: ClientAPI_combined, + output: 'ClientAPI.xml' +) + +ServerAPI_combined = custom_target( + 'ServerAPI-combined', + command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@' ], + input: [ doxygen_Server_combine_xslt, doxygen_Server_index_xml ], + output: 'ServerAPI-combined.xml' +) + +publican_inputs += custom_target( + 'ServerAPI.xml', + command: [ xsltproc, '-o', '@OUTPUT@', '--stringparam', 'which', 'Server', to_publican_xsl, '@INPUT@' ], + input: ServerAPI_combined, + output: 'ServerAPI.xml' +) + +foreach src : files([ + 'Architecture.xml', + 'Introduction.xml' +]) + name = fs.name(src) + publican_inputs += custom_target( + name, + command: [ + xsltproc, + '-o', '@OUTPUT@', + '--stringparam', 'basedir', '.', + merge_mapcoords_xsl, + '@INPUT@', + ], + input: [name], + output: [name], + ) +endforeach + +subdir('html/css') +subdir('html/images') custom_target( 'Wayland-docbook-html', @@ -14,19 +100,11 @@ custom_target( '--stringparam', 'html.stylesheet=css/default.css', '-o', '@OUTPUT@', 'html', - '@INPUT@' - ], - input: publican_processed_main, - output: publican_html_dir, - depend_files: publican_copied_sources, - depends: [ - publican_processed_targets, - ClientAPI_xml, - ServerAPI_xml, - ProtocolSpec_xml, - ProtocolInterfaces_xml + '@INPUT0@' ], + input: publican_inputs, + output: 'html', build_by_default: true, install: true, - install_dir: publican_install_prefix + install_dir: publican_install_prefix, ) diff --git a/doc/publican/sources/meson.build b/doc/publican/sources/meson.build deleted file mode 100644 index a53b3890..00000000 --- a/doc/publican/sources/meson.build +++ /dev/null @@ -1,114 +0,0 @@ -ProtocolSpec_xml = custom_target( - 'ProtocolSpec.xml', - command: [ xsltproc, '-o', '@OUTPUT@', files('../protocol-to-docbook.xsl'), '@INPUT@' ], - input: wayland_protocol_xml, - output: 'ProtocolSpec.xml' -) - -ProtocolInterfaces_xml = custom_target( - 'ProtocolInterfaces.xml', - command: [ xsltproc, '-o', '@OUTPUT@', files('../protocol-interfaces-to-docbook.xsl'), '@INPUT@' ], - input: wayland_protocol_xml, - output: 'ProtocolInterfaces.xml' -) - -ClientAPI_combined = custom_target( - 'ClientAPI-combined', - command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@' ], - input: [ doxygen_Client_combine_xslt, doxygen_Client_index_xml ], - output: 'ClientAPI-combined.xml' -) - -to_publican_xsl = files('../doxygen-to-publican.xsl') - -ClientAPI_xml = custom_target( - 'ClientAPI.xml', - command: [ xsltproc, '-o', '@OUTPUT@', '--stringparam', 'which', 'Client', to_publican_xsl, '@INPUT@' ], - input: ClientAPI_combined, - output: 'ClientAPI.xml' -) - -ServerAPI_combined = custom_target( - 'ServerAPI-combined', - command: [ xsltproc, '-o', '@OUTPUT@', '@INPUT@' ], - input: [ doxygen_Server_combine_xslt, doxygen_Server_index_xml ], - output: 'ServerAPI-combined.xml' -) - -ServerAPI_xml = custom_target( - 'ServerAPI.xml', - command: [ xsltproc, '-o', '@OUTPUT@', '--stringparam', 'which', 'Server', to_publican_xsl, '@INPUT@' ], - input: ServerAPI_combined, - output: 'ServerAPI.xml' -) - - -publican_sources = [ - 'Wayland.ent', - # 'Wayland.xml', # handled specially - 'Book_Info.xml', - 'Author_Group.xml', - 'Foreword.xml', - 'Preface.xml', - 'Revision_History.xml', - 'Protocol.xml', - 'Xwayland.xml', - 'Compositors.xml', - 'Color.xml', - 'Client.xml', - 'Server.xml' -] - -publican_processed_main = configure_file( - input: 'Wayland.xml', - output: 'Wayland.xml', - copy: true -) - -publican_copied_sources = [] -foreach src: publican_sources - publican_copied_sources += configure_file( - input: src, - output: src, - copy: true - ) -endforeach - -publican_processed_sources = [ - 'Architecture.xml', - 'Introduction.xml' -] - -publican_processed_targets = [] -foreach src: publican_processed_sources - publican_processed_targets += custom_target( - src, - command: [ xsltproc, '-o', '@OUTPUT@', '--stringparam', 'basedir', '.', merge_mapcoords_xsl, '@INPUT@' ], - input: src, - output: src - ) -endforeach - -publican_css_sources = files([ - 'css/brand.css', - 'css/common.css', - 'css/default.css', - 'css/epub.css', - 'css/print.css' -]) - -install_data( - publican_css_sources, - install_dir: join_paths(publican_install_prefix, publican_html_dir, 'css') -) - -publican_img_sources = files([ - 'images/icon.svg', - 'images/wayland.png', - 'images/xwayland-architecture.png' -]) - -install_data( - publican_img_sources, - install_dir: join_paths(publican_install_prefix, publican_html_dir, 'images') -) diff --git a/doc/publican/doxygen-to-publican.xsl b/doc/publican/xsl/doxygen-to-publican.xsl similarity index 100% rename from doc/publican/doxygen-to-publican.xsl rename to doc/publican/xsl/doxygen-to-publican.xsl diff --git a/doc/publican/merge-mapcoords.xsl b/doc/publican/xsl/merge-mapcoords.xsl similarity index 100% rename from doc/publican/merge-mapcoords.xsl rename to doc/publican/xsl/merge-mapcoords.xsl diff --git a/doc/publican/protocol-interfaces-to-docbook.xsl b/doc/publican/xsl/protocol-interfaces-to-docbook.xsl similarity index 100% rename from doc/publican/protocol-interfaces-to-docbook.xsl rename to doc/publican/xsl/protocol-interfaces-to-docbook.xsl diff --git a/doc/publican/protocol-to-docbook.xsl b/doc/publican/xsl/protocol-to-docbook.xsl similarity index 100% rename from doc/publican/protocol-to-docbook.xsl rename to doc/publican/xsl/protocol-to-docbook.xsl diff --git a/meson.build b/meson.build index c96ca29f..7ad5ac06 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,10 @@ project( 'c_std=c99', ] ) + +fs = import('fs') +pkgconfig = import('pkgconfig') + wayland_version = meson.project_version().split('.') config_h = configuration_data() @@ -106,8 +110,6 @@ configure_file( configuration: config_h, ) -pkgconfig = import('pkgconfig') - wayland_protocol_xml = files('protocol/wayland.xml') root_inc = include_directories('.')