]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: add rule to build and install only web documentation
authorPavel Hrdina <phrdina@redhat.com>
Thu, 23 Jul 2020 16:40:12 +0000 (18:40 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Mon, 3 Aug 2020 07:27:06 +0000 (09:27 +0200)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
docs/fonts/meson.build
docs/html/meson.build
docs/internals/meson.build
docs/js/meson.build
docs/kbase/meson.build
docs/logos/meson.build
docs/manpages/meson.build
docs/meson.build
scripts/meson-install-web.py [new file with mode: 0755]
scripts/meson.build

index 8c0a2f1554d30218465872461380afc598487365..e4109c6e7dc432c3b02dd456ea25030ba80ce13a 100644 (file)
@@ -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
index c87cc9f7ea29e77ba72d1bcb6c13c21de55075ae..e194b5942c264e0f019cfd1e90fc3e027cbed403 100644 (file)
@@ -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(
index 2d6fa42ee94573796bc2d716fc934075ef4664a7..169cc5d5f067de076b4ddfd6ea161ae46e34ede2 100644 (file)
@@ -9,7 +9,7 @@ foreach name : internals_in_files
   html_in_file = '@0@.html.in'.format(name)
   html_file = '@0@.html'.format(name)
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: html_in_file,
     output: html_file,
@@ -31,4 +31,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
index da90cbf96e1351f19ebbe8d3eda52010fb3536ca..cbf2dc2633c529a3e42e592d6c1f4d86b074dc42 100644 (file)
@@ -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
index 98b12e4c62788f91c4489e6edd654ff4778a959f..f72e42622304678ffcb865732820d6d534ec1a9d 100644 (file)
@@ -21,7 +21,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,
@@ -43,4 +43,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
index da92c397cde6a692d47e9e4275cd9544882d3b2f..70ba67d71c7cf8e08edefe33f9013d7a27f91f0f 100644 (file)
@@ -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
index fb4e254a8f83bdb92f51b9b2e25b9132c502f56c..e9d9ac8069a5265562656b7d671351446dc7e3a7 100644 (file)
@@ -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,
@@ -125,4 +125,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
index 687305bd71b529f39de7ab4ac4fadafede9eb4f9..c2d7fd1bf4cee2ac9e1473ef5e8d868754b6ed2d 100644 (file)
@@ -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(
@@ -192,7 +196,7 @@ foreach name : docs_html_in_files
   html_in_file = '@0@.html.in'.format(name)
   html_file = '@0@.html'.format(name)
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: html_in_file,
     output: html_file,
@@ -214,6 +218,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
 
 
@@ -267,7 +274,7 @@ foreach data : docs_html_in_gen
   html_file = '@0@.html'.format(data['name'])
   rst_in_file = '@0@.rst'.format(data['name'])
 
-  custom_target(
+  out_file = custom_target(
     html_file,
     input: data['file'],
     output: html_file,
@@ -289,6 +296,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')
@@ -301,8 +311,19 @@ 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, python3_prog.path(), 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 (executable)
index 0000000..a03f852
--- /dev/null
@@ -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])
index 39b0e899f43180b6251584232fced5490ad7f544..59b3c9bacdad80618dcb754ebd9f4c783f2baec0 100644 (file)
@@ -25,6 +25,7 @@ scripts = [
   'meson-html-gen.py',
   'meson-install-dirs.py',
   'meson-install-symlink.py',
+  'meson-install-web.py',
   'meson-python.sh',
   'meson-timestamp.py',
   'mock-noinline.py',