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 <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2025-10-28 00:36:53 +01:00
parent 59c79dee21
commit 0fd33fe1fa
38 changed files with 138 additions and 164 deletions

View file

@ -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

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before After
Before After

View file

@ -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

View file

@ -0,0 +1,36 @@
digraph arch_wayland {
edge[
fontname="DejaVu Sans",
dir="both",
arrowtail="dot",
arrowsize=.5,
fontname="DejaVu Sans",
fontsize="18",
]
node[
color=none,
margin=0,
fontname="DejaVu Sans",
fontsize="18",
]
c1 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>Wayland Client</TD></TR></TABLE>>, URL="#c1"]
c2 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>Wayland Client</TD></TR></TABLE>>, URL="#c2"]
comp [tooltip="Wayland Compositor", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD><BR/>Wayland<BR/>Compositor<BR/><BR/></TD></TR></TABLE>>, URL="#comp"]
impl [tooltip="KMS evdev Kernel", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>KMS</TD><TD>evdev</TD></TR><TR><TD COLSPAN="2">Kernel</TD></TR></TABLE>>, URL="#impl"]
c1 -> comp [taillabel="③", labeldistance=2.5, URL="#step_3"];
c2 -> comp;
comp -> c1 [label="②", URL="#step_2"];
comp -> c2;
comp -> impl [xlabel = "④", URL="#step_4"];
comp -> impl [style = invis, label=" "];
impl -> comp [xlabel = "①", URL="#step_1"];
c1 -> c2 [style=invis];
}

View file

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Before After
Before After

View file

@ -0,0 +1,53 @@
digraph arch_x {
edge[
fontname="DejaVu Sans",
dir="both",
arrowtail="dot",
arrowsize=.5,
fontname="DejaVu Sans",
fontsize="18",
]
node[
shape="none",
color=none,
margin=0,
fontname="DejaVu Sans",
fontsize="18",
]
{
rank=same;
c1 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>X Client</TD></TR></TABLE>>, URL="#c1"]
c3 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>X Client</TD></TR></TABLE>>, URL="#c3"]
}
c2 [label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>X Client</TD></TR></TABLE>>, URL="#c2"]
{
rank=same;
xserver [tooltip="X Server", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD><BR/>X Server<BR/><BR/></TD></TR></TABLE>>, URL="#xserver"]
comp [tooltip="Compositor", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD><BR/>Compositor<BR/><BR/></TD></TR></TABLE>>, URL="#comp"]
}
impl [tooltip="KMS evdev Kernel", label=<<TABLE STYLE="rounded" BGCOLOR="#ffbc00"><TR><TD>KMS</TD><TD>evdev</TD></TR><TR><TD COLSPAN="2">Kernel</TD></TR></TABLE>>, URL="#impl"]
c1 -> xserver [taillabel="③", labeldistance=2, URL="#step_3"];
c2 -> xserver;
c3 -> xserver;
xserver -> c1 [taillabel="②", labeldistance=2, URL="#step_2"];
xserver -> c2;
xserver -> c3;
xserver -> impl [taillabel="⑥", labeldistance=1.75, URL="#step_6"];
xserver -> impl [style=invis, label=" "];
impl -> xserver [taillabel="①", labeldistance=1.75, URL="#step_1"];
xserver -> comp [style=invis];
xserver -> comp [taillabel="④", labeldistance=1.75, labelangle=-45, URL="#step_4"];
comp -> xserver [taillabel="⑤", URL="#step_5"];
comp -> xserver [style=invis]
c1 -> c2 [style=invis];
c3 -> c2 [style=invis];
}

View file

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Before After
Before After

View file

@ -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,
)

View file

@ -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')
)