Subject: [PATCH v1 3/5] wip: meson: add install-{docs,doc-html,doc-man} targets

From: Andres Freund <[email-masked]>
Date: Wed, 15 Mar 2023 16:43:40 -0700

---
 meson.build              |  2 +-
 doc/src/sgml/meson.build | 27 ++++++++++++++++++++++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index b4b87f1a9fc..0ffeffa9edc 100644
--- a/meson.build
+++ b/meson.build
@@ -504,7 +504,7 @@ dir_man = get_option('mandir')
 
 # FIXME: These used to be separately configurable - worth adding?
 dir_doc = get_option('datadir') / 'doc' / 'postgresql'
-dir_doc_html = dir_doc
+dir_doc_html = dir_doc / 'html'
 
 dir_locale = get_option('localedir')
 
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index e6fe124c7bc..2da737c8af4 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -1,6 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 docs = []
+installdocs = []
 alldocs = []
 doc_generated = []
 
@@ -120,8 +121,16 @@ if xsltproc_bin.found()
   )
   alldocs += html
 
-  # build multi-page html docs as part of docs target
+  install_doc_html = run_target('install-doc-html',
+    command: [
+      python, install_files, '--prefix', dir_prefix,
+      '--install-dir-contents', dir_doc_html, html.full_path()],
+    depends: html)
+
+  # build and install multi-page html docs as part of docs target
   docs += html
+  installdocs += install_doc_html
+
 
   htmlhelp = custom_target('htmlhelp',
     input: ['stylesheet-hh.xsl', postgres_full_xml],
@@ -208,6 +217,21 @@ if xsltproc_bin.found()
     build_by_default: false,
   )
   alldocs += man
+
+  mans = []
+  foreach man_n : man.to_list()
+    mans += man_n.full_path()
+  endforeach
+
+  install_doc_man = run_target('install-doc-man',
+    command: [
+      python, install_files, '--prefix', dir_prefix,
+      '--install-dirs', dir_man, mans],
+    depends: man)
+
+  # even though we don't want to build man pages as part of 'docs', we do want
+  # to install them as part of install-docs
+  installdocs += install_doc_man
 endif

@@ -266,6 +290,7 @@ if docs.length() == 0
   run_target('docs', command: [missing, 'xsltproc'])
 else
   alias_target('docs', docs)
+  alias_target('install-docs', installdocs)
 endif
 
 if alldocs.length() == 0
-- 
2.38.0

--vw474qzskdrrkpyy
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="v1-0004-docs-html-copy-images-to-output-as-part-of-xslt-b.patch"