[libvirt PATCH 344/351] meson: add rule to build and install only web documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 docs/fonts/meson.build       |  6 ++++--
 docs/html/meson.build        |  7 +++++++
 docs/internals/meson.build   |  5 ++++-
 docs/js/meson.build          |  6 ++++--
 docs/kbase/meson.build       |  5 ++++-
 docs/logos/meson.build       |  6 ++++--
 docs/manpages/meson.build    |  5 ++++-
 docs/meson.build             | 26 ++++++++++++++++++++++----
 scripts/meson-install-web.py | 10 ++++++++++
 scripts/meson.build          |  1 +
 10 files changed, 64 insertions(+), 13 deletions(-)
 create mode 100755 scripts/meson-install-web.py

diff --git a/docs/fonts/meson.build b/docs/fonts/meson.build
index 8c0a2f1554d..e4109c6e7dc 100644
--- a/docs/fonts/meson.build
+++ b/docs/fonts/meson.build
@@ -15,8 +15,10 @@ fonts = [
 
 install_data(fonts, install_dir: docs_html_dir / 'fonts')
 
-# This hack enables us to view the web pages
-# from within the uninstalled build tree
 foreach file : fonts
+  # This hack enables us to view the web pages
+  # from within the uninstalled build tree
   configure_file(input: file, output: file, copy: true)
+
+  install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'fonts')
 endforeach
diff --git a/docs/html/meson.build b/docs/html/meson.build
index c87cc9f7ea2..e194b5942c2 100644
--- a/docs/html/meson.build
+++ b/docs/html/meson.build
@@ -7,6 +7,10 @@ apipng = [
 
 install_data(apipng, install_dir: docs_html_dir / 'html')
 
+foreach file : apipng
+  install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'html')
+endforeach
+
 docs_html_gen = []
 docs_html_dep = []
 
@@ -80,8 +84,11 @@ endforeach
 
 docs_html_paths = []
 
+install_web_deps += docs_html_dep
+
 foreach file : docs_html_gen
   docs_html_paths += file.full_path()
+  install_web_files += '@0@:@1@'.format(file.full_path(), docs_html_dir / 'html')
 endforeach
 
 test(
diff --git a/docs/internals/meson.build b/docs/internals/meson.build
index 944903ae27f..e600c84af60 100644
--- a/docs/internals/meson.build
+++ b/docs/internals/meson.build
@@ -9,7 +9,7 @@ foreach name : internals_in_files
   html_in_file = '@0@xxxxxxxx'.format(name)
   html_file = '@0@.html'.format(name)
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: html_in_file,
     output: html_file,
@@ -29,4 +29,7 @@ foreach name : internals_in_files
     install: true,
     install_dir: docs_html_dir / 'internals',
   )
+
+  install_web_deps += out_file
+  install_web_files += '@0@:@1@'.format(out_file.full_path(), docs_html_dir / 'internals')
 endforeach
diff --git a/docs/js/meson.build b/docs/js/meson.build
index da90cbf96e1..cbf2dc2633c 100644
--- a/docs/js/meson.build
+++ b/docs/js/meson.build
@@ -4,8 +4,10 @@ docs_js_files = [
 
 install_data(docs_js_files, install_dir: docs_html_dir / 'js')
 
-# This hack enables us to view the web pages
-# from within the uninstalled build tree
 foreach file : docs_js_files
+  # This hack enables us to view the web pages
+  # from within the uninstalled build tree
   configure_file(input: file, output: file, copy: true)
+
+    install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'js')
 endforeach
diff --git a/docs/kbase/meson.build b/docs/kbase/meson.build
index 6a17d674436..d46289245b2 100644
--- a/docs/kbase/meson.build
+++ b/docs/kbase/meson.build
@@ -18,7 +18,7 @@ foreach name : docs_kbase_files
 
   html_in = docs_rst2html_gen.process(rst_file)
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: html_in,
     output: html_file,
@@ -38,4 +38,7 @@ foreach name : docs_kbase_files
     install: true,
     install_dir: docs_html_dir / 'kbase',
   )
+
+  install_web_deps += out_file
+  install_web_files += '@0@:@1@'.format(out_file.full_path(), docs_html_dir / 'kbase')
 endforeach
diff --git a/docs/logos/meson.build b/docs/logos/meson.build
index da92c397cde..70ba67d71c7 100644
--- a/docs/logos/meson.build
+++ b/docs/logos/meson.build
@@ -22,8 +22,10 @@ docs_logo_files = [
 
 install_data(docs_logo_files, install_dir: docs_html_dir / 'logos')
 
-# This hack enables us to view the web pages
-# from within the uninstalled build tree
 foreach file : docs_logo_files
+  # This hack enables us to view the web pages
+  # from within the uninstalled build tree
   configure_file(input: file, output: file, copy: true)
+
+  install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir / 'logos')
 endforeach
diff --git a/docs/manpages/meson.build b/docs/manpages/meson.build
index 72d362e92d8..c53109c8d29 100644
--- a/docs/manpages/meson.build
+++ b/docs/manpages/meson.build
@@ -103,7 +103,7 @@ foreach data : docs_man_files
     capture: true,
   )
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: html_in,
     output: html_file,
@@ -123,4 +123,7 @@ foreach data : docs_man_files
     install: true,
     install_dir: docs_html_dir / 'manpages',
   )
+
+  install_web_deps += out_file
+  install_web_files += '@0@:@1@'.format(out_file.full_path(), docs_html_dir / 'manpages')
 endforeach
diff --git a/docs/meson.build b/docs/meson.build
index 6d3d002fd7c..773e127ca74 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -129,6 +129,10 @@ docs_rst_files = [
   'submitting-patches',
 ]
 
+# list of web targets to build for docs/web rule
+install_web_deps = []
+install_web_files = []
+
 install_data(docs_assets, install_dir: docs_html_dir)
 
 aclperms_gen = custom_target(
@@ -191,7 +195,7 @@ foreach name : docs_html_in_files
   html_in_file = '@0@xxxxxxxx'.format(name)
   html_file = '@0@.html'.format(name)
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: html_in_file,
     output: html_file,
@@ -211,6 +215,9 @@ foreach name : docs_html_in_files
     install: true,
     install_dir: docs_html_dir,
   )
+
+  install_web_deps += out_file
+  install_web_files += '@0@:@1@'.format(out_file.full_path(), docs_html_dir)
 endforeach
 
 
@@ -262,7 +269,7 @@ docs_html_in_gen += {
 foreach data : docs_html_in_gen
   html_file = '@0@.html'.format(data['name'])
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: data['file'],
     output: html_file,
@@ -282,6 +289,9 @@ foreach data : docs_html_in_gen
     install: true,
     install_dir: docs_html_dir,
   )
+
+  install_web_deps += out_file
+  install_web_files += '@0@:@1@'.format(out_file.full_path(), docs_html_dir)
 endforeach
 
 subdir('fonts')
@@ -294,8 +304,16 @@ subdir('manpages')
 subdir('schemas')
 
 
-# This hack enables us to view the web pages
-# from within the uninstalled build tree
 foreach file : docs_assets
+  # This hack enables us to view the web pages
+  # from within the uninstalled build tree
   configure_file(input: file, output: file, copy: true)
+
+  install_web_files += '@0@:@1@'.format(meson.current_source_dir() / file, docs_html_dir)
 endforeach
+
+run_target(
+  'install-web',
+  command: [ meson_python_prog, meson_install_web_prog.path(), install_web_files ],
+  depends: install_web_deps,
+)
diff --git a/scripts/meson-install-web.py b/scripts/meson-install-web.py
new file mode 100755
index 00000000000..a03f8523cd9
--- /dev/null
+++ b/scripts/meson-install-web.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import sys
+
+for desc in sys.argv[1:]:
+    inst = desc.split(':')
+    os.makedirs(inst[1], exist_ok=True)
+    shutil.copy(inst[0], inst[1])
diff --git a/scripts/meson.build b/scripts/meson.build
index fa2ed57c99d..2f46ece59fb 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -26,6 +26,7 @@ scripts = [
   'meson-dist.sh',
   'meson-gen-authors.sh',
   'meson-html-gen.py',
+  'meson-install-web.py',
   'meson-python.sh',
   'meson-timestamp.sh',
   'mock-noinline.py',
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux