[libvirt PATCH 324/351] meson: docs: build *.html files from *.rst files

Pavel Hrdina phrdina at redhat.com
Thu Jul 16 09:59:20 UTC 2020


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 docs/Makefile.am |  3 ---
 docs/meson.build | 61 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/docs/Makefile.am b/docs/Makefile.am
index 4e69f9ae7fa..f1ac68f1d50 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -281,10 +281,7 @@ manpages_DATA = $(manpages_html)
 dot_html_generated_in = \
   hvsupport.html.in \
   $(NULL)
-dot_rst = \
-  $(notdir $(wildcard $(srcdir)/*.rst))
 dot_rst_html_in = \
-  $(dot_rst:%.rst=%.html.in) \
   news.html.in \
   $(NULL)
 dot_html = \
diff --git a/docs/meson.build b/docs/meson.build
index 36fd2388b69..2da051e75ed 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -105,6 +105,27 @@ docs_html_in_files = [
   'windows',
 ]
 
+docs_rst_files = [
+  'advanced-tests',
+  'best-practices',
+  'ci',
+  'coding-style',
+  'committer-guidelines',
+  'daemons',
+  'developer-tooling',
+  'formatbackup',
+  'formatcheckpoint',
+  'hacking',
+  'libvirt-go',
+  'libvirt-go-xml',
+  'newreposetup',
+  'pci-addresses',
+  'platforms',
+  'programming-languages',
+  'styleguide',
+  'submitting-patches',
+]
+
 install_data(docs_assets, install_dir: docs_html_dir)
 
 aclperms_gen = custom_target(
@@ -188,3 +209,43 @@ foreach name : docs_html_in_files
     install_dir: docs_html_dir,
   )
 endforeach
+
+
+# docs_html_in_gen:
+#   each entry is a dictionary with following items:
+#   name - base file name (required)
+#   file - generated file (required)
+docs_html_in_gen = []
+
+foreach name : docs_rst_files
+  rst_file = '@0 at .rst'.format(name)
+  docs_html_in_gen += {
+    'name': name,
+    'file': docs_rst2html_gen.process(rst_file),
+  }
+endforeach
+
+foreach data : docs_html_in_gen
+  html_file = '@0 at .html'.format(data['name'])
+
+  custom_target(
+    html_file,
+    input: data['file'],
+    output: html_file,
+    command: [
+      meson_python_prog,
+      meson_html_gen_prog,
+      xsltproc_prog.path(),
+      xmllint_prog.path(),
+      meson.build_root(),
+      docs_timestamp,
+      site_xsl,
+      '@INPUT@',
+      '@OUTPUT@',
+    ],
+    depends: [ aclperms_gen ],
+    depend_files: [ page_xsl ],
+    install: true,
+    install_dir: docs_html_dir,
+  )
+endforeach
-- 
2.26.2




More information about the libvir-list mailing list