meson: add rule to build and install only web documentation

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-07-23 18:40:12 +02:00
parent 18c729d83f
commit 70629df0c2
10 changed files with 67 additions and 13 deletions

View 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

View 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(

View 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

View 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

View 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

View 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

View 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

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

10
scripts/meson-install-web.py Executable file
View File

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

View 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',