meson: add install-{docs,doc-html,doc-man} targets
authorAndres Freund <andres@anarazel.de>
Fri, 24 Mar 2023 04:20:18 +0000 (21:20 -0700)
committerAndres Freund <andres@anarazel.de>
Fri, 24 Mar 2023 04:20:18 +0000 (21:20 -0700)
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com

doc/src/sgml/meson.build
meson.build

index e6fe124c7bc90e5ec649ec0454fda703e4764659..b728948af9eb6db73420391d9c53ea544d3bb01e 100644 (file)
@@ -1,6 +1,7 @@
 # Copyright (c) 2022-2023, PostgreSQL Global Development Group
 
 docs = []
+installdocs = []
 alldocs = []
 doc_generated = []
 
@@ -120,8 +121,19 @@ if xsltproc_bin.found()
   )
   alldocs += html
 
-  # build multi-page html docs as part of docs target
+  install_doc_html = custom_target('install-html',
+    output: 'install-html',
+    command: [
+      python, install_files, '--prefix', dir_prefix,
+      '--install-dir-contents', dir_doc_html, html],
+    build_always_stale: true, build_by_default: false,
+  )
+  alias_target('install-doc-html', install_doc_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 +220,19 @@ if xsltproc_bin.found()
     build_by_default: false,
   )
   alldocs += man
+
+  install_doc_man = custom_target('install-man',
+    output: 'install-man',
+    command: [
+      python, install_files, '--prefix', dir_prefix,
+      '--install-dirs', dir_man, man],
+    build_always_stale: true, build_by_default: false,
+  )
+  alias_target('install-doc-man', install_doc_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 +291,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
index 84fe2c3d4c337567de3b7938b28734d8b1fd9411..33dd5b43ed55c2c9ef1d9a4357d7bb2c179aaec2 100644 (file)
@@ -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')