meson documentation build open issues
I have identified several open issues with the documentation build under
Meson (approximately in priority order):
1. Image files are not handled at all, so they don't show up in the
final product.
2. Defaults to website stylesheet, no way to configure. This should be
adjusted to match the make build.
3. The various build targets and their combinations are mismatching and
incomplete. For example:
Top-level GNUmakefile has these targets:
- docs (builds html and man)
- html
- man
(Those are the formats that are part of a distribution build.)
doc/src/sgml/Makefile has these documented targets:
- default target is html
- all (builds html and man, maps to top-level "docs")
- html
- man
- postgres-A4.pdf
- postgres-US.pdf
- check
as well as (undocumented):
- htmlhelp
- postgres.html
- postgres.txt
- epub
- postgres.epub
- postgres.info
meson has the following documented targets:
- docs (builds only html)
- alldocs (builds all formats, including obscure ones)
as well as the following undocumented targets:
- html
- man
- html_help [sic]
- postgres-A4.pdf
- postgres-US.pdf
- postgres.epub
- [info is not implemented at all]
- [didn't find an equivalent of check]
As you can see, this is all over the place. I'd like to arrive at some
consistency across all build systems for handling each tier of
documentation formats, in terms of what is documented, what the targets
are named, and how they are grouped.
4. There doesn't appear to be a way to install the documentation.
(There are also some open questions in the top-level meson.build about
the installation directories, but I suppose if we can't install them
then exactly where to install them hasn't been thought about too
much.)
5. There doesn't appear to be an equivalent of "make world" and "make
install-world" that includes documentation builds.
Hi,
On 2023-03-15 08:14:09 +0100, Peter Eisentraut wrote:
I have identified several open issues with the documentation build under
Meson (approximately in priority order):1. Image files are not handled at all, so they don't show up in the final
product.
Hm. Somehow I thought I'd tackled that at some point. Ah. I got there for the
PDF output, but didn't realize it's also an issue for the html output.
For FO it sufficed to set the img.src.path param. For HTML that's not enough,
because that just adjusts the link to the file - but we don't want to link to
the source file. We actually solved this for the single-page html version - we
just embed the svg. I wonder if we should just do that as well.
Another way would be to emit the files into the desired place as part of the
stylesheet. While it requires touching xslt, it does seems somewhat more
elegant than just copying files around. I did implement that, curious what you
think.
2. Defaults to website stylesheet, no way to configure. This should be
adjusted to match the make build.
Should we add a meson option?
3. The various build targets and their combinations are mismatching and
incomplete. For example:Top-level GNUmakefile has these targets:
- docs (builds html and man)
- html
- man(Those are the formats that are part of a distribution build.)
doc/src/sgml/Makefile has these documented targets:
- default target is html
- all (builds html and man, maps to top-level "docs")
- html
- man
- postgres-A4.pdf
- postgres-US.pdf
- checkas well as (undocumented):
- htmlhelp
- postgres.html
- postgres.txt
- epub
- postgres.epub
- postgres.infomeson has the following documented targets:
- docs (builds only html)
- alldocs (builds all formats, including obscure ones)as well as the following undocumented targets:
- html
- man
- html_help [sic]
renamed in the attached patch.
- postgres-A4.pdf
- postgres-US.pdf
- postgres.epub
Note that these are actually named doc/src/sgml/{html,man,...}, not top-level
targets.
- [info is not implemented at all]
Would be easy to implement, but not sure it's worth doing.
- [didn't find an equivalent of check]
That's probably worth doing - should it be run as an actual test, or be a
target?
4. There doesn't appear to be a way to install the documentation.
(There are also some open questions in the top-level meson.build about
the installation directories, but I suppose if we can't install them
then exactly where to install them hasn't been thought about too
much.)
WIP patch for that attached. There's now
install-doc-man
install-doc-html
run targets and a
install-docs
alias target.
I did end up getting stuck when hacking on this, and ended up adding css
support for nochunk and support for the website style for htmlhelp and
nochunk, as well as obsoleting the need for copying the css files... But
perhaps that's a bit too much.
Greetings,
Andres Freund
Attachments:
v1-0001-meson-rename-html_help-target-to-htmlhelp.patchtext/x-diff; charset=us-asciiDownload
From e604a5c5acdaa840ede0c83205c9799a9edb2630 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 15:53:14 -0700
Subject: [PATCH v1 1/5] meson: rename html_help target to htmlhelp
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com
---
doc/src/sgml/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 38f1b8e7b17..e6fe124c7bc 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -123,7 +123,7 @@ if xsltproc_bin.found()
# build multi-page html docs as part of docs target
docs += html
- html_help = custom_target('html_help',
+ htmlhelp = custom_target('htmlhelp',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
depfile: 'htmlhelp.d',
@@ -131,7 +131,7 @@ if xsltproc_bin.found()
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
- alldocs += html_help
+ alldocs += htmlhelp
# single-page HTML
--
2.38.0
v1-0002-meson-make-install_test_files-more-generic-rename.patchtext/x-diff; charset=us-asciiDownload
From a739950d06678f28f08deb48d080939041dc5584 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:29:27 -0700
Subject: [PATCH v1 2/5] meson: make install_test_files more generic, rename to
install_files
Now it supports installing directories and directory contents as well. This
will be used in a subsequent patch to install doc contents.
---
meson.build | 5 ++-
src/tools/install_files | 71 ++++++++++++++++++++++++++++++++++++
src/tools/install_test_files | 33 -----------------
3 files changed, 74 insertions(+), 35 deletions(-)
create mode 100644 src/tools/install_files
delete mode 100644 src/tools/install_test_files
diff --git a/meson.build b/meson.build
index 2ebdf914c1b..b4b87f1a9fc 100644
--- a/meson.build
+++ b/meson.build
@@ -369,6 +369,8 @@ flex_cmd = [python, flex_wrapper,
wget = find_program('wget', required: false, native: true)
wget_flags = ['-O', '@OUTPUT0@', '--no-use-server-timestamps']
+install_files = files('src/tools/install_files')
+
###############################################################
@@ -2859,9 +2861,8 @@ testprep_targets += test_install_libs
# command to install files used for tests, which aren't installed by default
-install_test_files = files('src/tools/install_test_files')
install_test_files_args = [
- install_test_files,
+ install_files,
'--prefix', dir_prefix,
'--install', contrib_data_dir, test_install_data,
'--install', dir_lib_pkg, test_install_libs,
diff --git a/src/tools/install_files b/src/tools/install_files
new file mode 100644
index 00000000000..23ffd0aa2f7
--- /dev/null
+++ b/src/tools/install_files
@@ -0,0 +1,71 @@
+#!/usr/bin/env python3
+
+# Helper to install additional files into the temporary installation
+# for tests, beyond those that are installed by meson/ninja install.
+
+import argparse
+import shutil
+import os
+from pathlib import PurePath
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--destdir', type=str,
+ default=os.environ.get('DESTDIR', None))
+parser.add_argument('--prefix', type=str)
+parser.add_argument('--install', type=str, nargs='+',
+ action='append', default=[])
+parser.add_argument('--install-dirs', type=str, nargs='+',
+ action='append', default=[])
+parser.add_argument('--install-dir-contents', type=str, nargs='+',
+ action='append', default=[])
+
+args = parser.parse_args()
+
+
+def error_exit(msg: str):
+ if os.path.isdir(src):
+ error_exit(f"{src} is a directory")
+
+
+def create_target_dir(prefix: str, destdir: str, targetdir: str):
+ if not os.path.isabs(targetdir):
+ targetdir = os.path.join(prefix, targetdir)
+
+ if destdir is not None:
+ # copy of meson's logic for joining destdir and install paths
+ targetdir = str(PurePath(destdir, *PurePath(targetdir).parts[1:]))
+
+ os.makedirs(targetdir, exist_ok=True)
+
+ return targetdir
+
+
+def copy_files(targetdir: str, src_list: list):
+ for src in src_list:
+ shutil.copy2(src, targetdir)
+
+
+def copy_dirs(targetdir: str, src_list: list, contents: bool):
+ for src in src_list:
+ if not os.path.isdir(src):
+ error_exit('{0} is not a directory'.format(src))
+
+ if contents:
+ target = targetdir
+ else:
+ target = os.path.join(targetdir, os.path.split(src)[1])
+ shutil.copytree(src, target, dirs_exist_ok=True)
+
+
+for installs in args.install:
+ targetdir = create_target_dir(args.prefix, args.destdir, installs[0])
+ copy_files(targetdir, installs[1:])
+
+for installs in args.install_dirs:
+ targetdir = create_target_dir(args.prefix, args.destdir, installs[0])
+ copy_dirs(targetdir, installs[1:], contents=False)
+
+for installs in args.install_dir_contents:
+ targetdir = create_target_dir(args.prefix, args.destdir, installs[0])
+ copy_dirs(targetdir, installs[1:], contents=True)
diff --git a/src/tools/install_test_files b/src/tools/install_test_files
deleted file mode 100644
index 8e0b36a74d1..00000000000
--- a/src/tools/install_test_files
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python3
-
-# Helper to install additional files into the temporary installation
-# for tests, beyond those that are installed by meson/ninja install.
-
-import argparse
-import shutil
-import os
-from pathlib import PurePath
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument('--destdir', type=str, default=os.environ.get('DESTDIR', None))
-parser.add_argument('--prefix', type=str)
-parser.add_argument('--install', type=str, nargs='+', action='append')
-
-args = parser.parse_args()
-
-def copy_files(prefix: str, destdir: str, targetdir: str, src_list: list):
- if not os.path.isabs(targetdir):
- targetdir = os.path.join(prefix, targetdir)
-
- if destdir is not None:
- # copy of meson's logic for joining destdir and install paths
- targetdir = str(PurePath(destdir, *PurePath(targetdir).parts[1:]))
-
- os.makedirs(targetdir, exist_ok=True)
-
- for src in src_list:
- shutil.copy2(src, targetdir)
-
-for installs in args.install:
- copy_files(args.prefix, args.destdir, installs[0], installs[1:])
--
2.38.0
v1-0003-wip-meson-add-install-docs-doc-html-doc-man-targe.patchtext/x-diff; charset=us-asciiDownload
From 1ca73641bd0def58bbaedd2c3a5b1ae95918cd32 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:43:40 -0700
Subject: [PATCH v1 3/5] wip: meson: add install-{docs,doc-html,doc-man}
targets
---
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
v1-0004-docs-html-copy-images-to-output-as-part-of-xslt-b.patchtext/x-diff; charset=us-asciiDownload
From 679973341b9fb131034e9d7a7acafe761ecf9ff8 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:45:14 -0700
Subject: [PATCH v1 4/5] docs: html: copy images to output as part of xslt
build
---
doc/src/sgml/Makefile | 2 --
doc/src/sgml/stylesheet-common.xsl | 22 ++++++++++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 6 ++++++
doc/src/sgml/stylesheet.xsl | 7 ++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index b96c7cbf223..1b098f983ec 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -144,7 +144,6 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(ALL_IMAGES) html/
cp $(srcdir)/stylesheet.css html/
touch $@
@@ -152,7 +151,6 @@ htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(ALL_IMAGES) htmlhelp/
cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index 761484c7fef..d2928f86eb7 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -101,4 +101,26 @@
<xsl:apply-templates select="." mode="xref"/>
</xsl:template>
+
+<!--
+ Support for copying images to the output directory, so the output is self
+ contained.
+-->
+<xsl:template name="write-image">
+ <xsl:variable name="input_filename">
+ <xsl:value-of select="imagedata/@fileref"/>
+ </xsl:variable>
+
+ <!-- references images directly, without images/ -->
+ <xsl:variable name="output_filename">
+ <xsl:value-of select="concat($chunk.base.dir, substring-after($input_filename, '/'))"/>
+ </xsl:variable>
+
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename" select="$output_filename"/>
+ <xsl:with-param name="content" select="document($input_filename)"/>
+ </xsl:call-template>
+</xsl:template>
+
+
</xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 6f4b706dac6..568ccf36d2a 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -39,6 +39,12 @@
</xsl:template>
+<xsl:template match="imageobject">
+ <xsl:call-template name="write-image"/>
+ <!-- copy images to the output directory, so the output is self contained -->
+ <xsl:apply-templates select="imagedata"/>
+</xsl:template>
+
<!-- strip directory name from image filerefs -->
<xsl:template match="imagedata/@fileref">
<xsl:value-of select="substring-after(., '/')"/>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index b6141303abd..f9163e7d946 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -29,7 +29,12 @@
</xsl:param>
-<!-- strip directory name from image filerefs -->
+<xsl:template match="imageobject">
+ <xsl:call-template name="write-image"/>
+ <!-- copy images to the output directory, so the output is self contained -->
+ <xsl:apply-templates select="imagedata"/>
+</xsl:template>
+
<xsl:template match="imagedata/@fileref">
<xsl:value-of select="substring-after(., '/')"/>
</xsl:template>
--
2.38.0
v1-0005-wip-docs-copy-or-inline-css.patchtext/x-diff; charset=us-asciiDownload
From f5e081b911797fa6897a883b0f1f3e35daf170ad Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 20:49:47 -0700
Subject: [PATCH v1 5/5] wip: docs: copy or inline css
---
doc/src/sgml/Makefile | 4 +---
doc/src/sgml/meson.build | 2 +-
doc/src/sgml/stylesheet-common.xsl | 21 +++++++++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 10 +++++++++-
doc/src/sgml/stylesheet-html-nochunk.xsl | 20 ++++++++++++++++++++
doc/src/sgml/stylesheet.xsl | 15 ++++++---------
6 files changed, 58 insertions(+), 14 deletions(-)
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 1b098f983ec..3f971f6eb33 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -53,7 +53,7 @@ else
XSLTPROC = $(missing) xsltproc
endif
-override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
+override XSLTPROCFLAGS += --xincludestyle --stringparam pg.version '$(VERSION)'
GENERATED_SGML = version.sgml \
@@ -144,14 +144,12 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css html/
touch $@
htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
# single-page HTML
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 2da737c8af4..c581c7246f0 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -104,7 +104,7 @@ if xsltproc_bin.found()
xsltproc_flags = [
'--nonet',
'--stringparam', 'pg.version', pg_version,
- '--param', 'website.stylesheet', '1'
+ '--xincludestyle',
]
xsltproc = xmltools_wrapper + [
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index d2928f86eb7..23dea8f29bf 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -41,6 +41,8 @@
<xsl:param name="variablelist.term.break.after">1</xsl:param>
<xsl:param name="variablelist.term.separator"></xsl:param>
<xsl:param name="xref.with.number.and.title" select="0"></xsl:param>
+<!-- currently htmlhelp and other html have no common stylesheet -->
+<xsl:param name="website.stylesheet" select="0"/>
<!-- Change display of some elements -->
@@ -122,5 +124,24 @@
</xsl:call-template>
</xsl:template>
+<xsl:template name="stylesheet-reference">
+ <xsl:choose>
+ <xsl:when test="$website.stylesheet = 0">stylesheet.css
+ <xsl:variable name="styleout" select="concat($base.dir, 'stylesheet.css')"/>
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename" select="$styleout"/>
+ <xsl:with-param name="quiet" select="0"/> <!-- XXX: remove -->
+ <xsl:with-param name="omit-xml-declaration" select="'yes'"/>
+ <xsl:with-param name="content">
+ <!-- xinclude is only processed in toplevel stylesheet -->
+ <xsl:call-template name="stylesheet-contents"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ https://www.postgresql.org/media/css/docs-complete.css
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
</xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 568ccf36d2a..6f6c6c64626 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -1,5 +1,6 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/>
@@ -9,7 +10,6 @@
<xsl:param name="htmlhelp.use.hhk" select="'1'"/>
<xsl:param name="base.dir" select="'htmlhelp/'"></xsl:param>
-<xsl:param name="html.stylesheet" select="'stylesheet.css'"></xsl:param>
<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
<xsl:param name="manifest.in.base.dir" select="1"/>
<xsl:param name="make.valid.html" select="1"></xsl:param>
@@ -19,6 +19,14 @@
<xsl:param name="chunker.output.indent" select="'yes'"/>
<xsl:param name="chunk.quietly" select="1"></xsl:param>
+<xsl:param name="html.stylesheet">
+ <xsl:call-template name="stylesheet-reference"/>
+</xsl:param>
+
+<xsl:template name="stylesheet-contents">
+ <xi:include href="stylesheet.css" parse="text"/>
+</xsl:template>
+
<!-- Change display of some elements -->
diff --git a/doc/src/sgml/stylesheet-html-nochunk.xsl b/doc/src/sgml/stylesheet-html-nochunk.xsl
index 8167127b93a..560f6a0b0a7 100644
--- a/doc/src/sgml/stylesheet-html-nochunk.xsl
+++ b/doc/src/sgml/stylesheet-html-nochunk.xsl
@@ -1,5 +1,7 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns="http://www.w3.org/1999/xhtml"
version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
@@ -7,6 +9,24 @@
<xsl:include href="stylesheet-html-common.xsl" />
<xsl:include href="stylesheet-speedup-xhtml.xsl" />
+
+<xsl:param name="generate.css.header" select="1"/>
+<xsl:template name="generate.css.headers">
+ <xsl:choose>
+ <!-- inline css style sheet -->
+ <xsl:when test="$website.stylesheet = 0">
+ <style type="text/css">
+ <xi:include href="stylesheet.css" parse="text"/>
+ </style>
+ </xsl:when>
+ <!-- link to website -->
+ <xsl:otherwise>
+ <link rel="stylesheet" type="text/css" href="https://www.postgresql.org/media/css/docs-complete.css"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
<!-- embed SVG images into output file -->
<xsl:template match="imagedata[@format='SVG']">
<xsl:variable name="filename">
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index f9163e7d946..c551b9cd809 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -1,7 +1,8 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
- xmlns="http://www.w3.org/1999/xhtml">
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
<xsl:include href="stylesheet-common.xsl" />
@@ -17,17 +18,13 @@
<xsl:param name="chunk.quietly" select="1"></xsl:param>
<xsl:param name="admon.style"></xsl:param> <!-- handled by CSS stylesheet -->
-<xsl:param name="website.stylesheet" select="0"/>
-
<xsl:param name="html.stylesheet">
- <xsl:choose>
- <xsl:when test="$website.stylesheet = 0">stylesheet.css</xsl:when>
- <xsl:otherwise>
- https://www.postgresql.org/media/css/docs-complete.css
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="stylesheet-reference"/>
</xsl:param>
+<xsl:template name="stylesheet-contents">
+ <xi:include href="stylesheet.css" parse="text"/>
+</xsl:template>
<xsl:template match="imageobject">
<xsl:call-template name="write-image"/>
--
2.38.0
Hi,
On 2023-03-15 20:55:33 -0700, Andres Freund wrote:
WIP patch for that attached. There's now
install-doc-man
install-doc-html
run targets and a
install-docs
alias target.I did end up getting stuck when hacking on this, and ended up adding css
support for nochunk and support for the website style for htmlhelp and
nochunk, as well as obsoleting the need for copying the css files... But
perhaps that's a bit too much.
Updated set of patches attached. This one works in older meson versions too
and adds install-world and install-quiet targets.
I also ended up getting so frustrated at the docs build speed that I started
to hack a bit on that. I attached a patch shaving a few seconds off the
buildtime.
I think we can make the docs build in parallel and incrementally, by building
the different parts of the docs in parallel, using --stringparam rootid,
e.g. building each 'part' separately.
A very very rough draft attached:
parallel with parts:
real 0m10.831s
user 0m58.295s
sys 0m1.402s
normal:
real 0m32.215s
user 0m31.876s
sys 0m0.328s
1/3 of the build time at 2x the cost is nothing to sneeze at.
Greetings,
Andres Freund
Attachments:
v2-0001-meson-rename-html_help-target-to-htmlhelp.patchtext/x-diff; charset=us-asciiDownload
From 9313c2938265109b3a82f96697bae26ed3f74412 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 15:53:14 -0700
Subject: [PATCH v2 1/8] meson: rename html_help target to htmlhelp
Reported-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/3fc3bb9b-f7f8-d442-35c1-ec82280c564a@enterprisedb.com
---
doc/src/sgml/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 38f1b8e7b17..e6fe124c7bc 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -123,7 +123,7 @@ if xsltproc_bin.found()
# build multi-page html docs as part of docs target
docs += html
- html_help = custom_target('html_help',
+ htmlhelp = custom_target('htmlhelp',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
depfile: 'htmlhelp.d',
@@ -131,7 +131,7 @@ if xsltproc_bin.found()
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
- alldocs += html_help
+ alldocs += htmlhelp
# single-page HTML
--
2.38.0
v2-0002-meson-make-install_test_files-more-generic-rename.patchtext/x-diff; charset=us-asciiDownload
From 10fd8d20ae15889054e69e0b62a445e52b9afe2f Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:29:27 -0700
Subject: [PATCH v2 2/8] meson: make install_test_files more generic, rename to
install_files
Now it supports installing directories and directory contents as well. This
will be used in a subsequent patch to install doc contents.
---
meson.build | 5 ++-
src/tools/install_files | 72 ++++++++++++++++++++++++++++++++++++
src/tools/install_test_files | 33 -----------------
3 files changed, 75 insertions(+), 35 deletions(-)
create mode 100644 src/tools/install_files
delete mode 100644 src/tools/install_test_files
diff --git a/meson.build b/meson.build
index 7f76a101ecf..84fe2c3d4c3 100644
--- a/meson.build
+++ b/meson.build
@@ -369,6 +369,8 @@ flex_cmd = [python, flex_wrapper,
wget = find_program('wget', required: false, native: true)
wget_flags = ['-O', '@OUTPUT0@', '--no-use-server-timestamps']
+install_files = files('src/tools/install_files')
+
###############################################################
@@ -2845,9 +2847,8 @@ testprep_targets += test_install_libs
# command to install files used for tests, which aren't installed by default
-install_test_files = files('src/tools/install_test_files')
install_test_files_args = [
- install_test_files,
+ install_files,
'--prefix', dir_prefix,
'--install', contrib_data_dir, test_install_data,
'--install', dir_lib_pkg, test_install_libs,
diff --git a/src/tools/install_files b/src/tools/install_files
new file mode 100644
index 00000000000..0428316b67e
--- /dev/null
+++ b/src/tools/install_files
@@ -0,0 +1,72 @@
+#!/usr/bin/env python3
+
+# Helper to install additional files into the temporary installation
+# for tests, beyond those that are installed by meson/ninja install.
+
+import argparse
+import os
+import shutil
+import sys
+from pathlib import PurePath
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--destdir', type=str,
+ default=os.environ.get('DESTDIR', None))
+parser.add_argument('--prefix', type=str)
+parser.add_argument('--install', type=str, nargs='+',
+ action='append', default=[])
+parser.add_argument('--install-dirs', type=str, nargs='+',
+ action='append', default=[])
+parser.add_argument('--install-dir-contents', type=str, nargs='+',
+ action='append', default=[])
+
+args = parser.parse_args()
+
+
+def error_exit(msg: str):
+ print(msg, file=sys.stderr)
+ exit(1)
+
+
+def create_target_dir(prefix: str, destdir: str, targetdir: str):
+ if not os.path.isabs(targetdir):
+ targetdir = os.path.join(prefix, targetdir)
+
+ if destdir is not None:
+ # copy of meson's logic for joining destdir and install paths
+ targetdir = str(PurePath(destdir, *PurePath(targetdir).parts[1:]))
+
+ os.makedirs(targetdir, exist_ok=True)
+
+ return targetdir
+
+
+def copy_files(targetdir: str, src_list: list):
+ for src in src_list:
+ shutil.copy2(src, targetdir)
+
+
+def copy_dirs(targetdir: str, src_list: list, contents: bool):
+ for src in src_list:
+ if not os.path.isdir(src):
+ error_exit('{0} is not a directory'.format(src))
+
+ if contents:
+ target = targetdir
+ else:
+ target = os.path.join(targetdir, os.path.split(src)[1])
+ shutil.copytree(src, target, dirs_exist_ok=True)
+
+
+for installs in args.install:
+ targetdir = create_target_dir(args.prefix, args.destdir, installs[0])
+ copy_files(targetdir, installs[1:])
+
+for installs in args.install_dirs:
+ targetdir = create_target_dir(args.prefix, args.destdir, installs[0])
+ copy_dirs(targetdir, installs[1:], contents=False)
+
+for installs in args.install_dir_contents:
+ targetdir = create_target_dir(args.prefix, args.destdir, installs[0])
+ copy_dirs(targetdir, installs[1:], contents=True)
diff --git a/src/tools/install_test_files b/src/tools/install_test_files
deleted file mode 100644
index 8e0b36a74d1..00000000000
--- a/src/tools/install_test_files
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python3
-
-# Helper to install additional files into the temporary installation
-# for tests, beyond those that are installed by meson/ninja install.
-
-import argparse
-import shutil
-import os
-from pathlib import PurePath
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument('--destdir', type=str, default=os.environ.get('DESTDIR', None))
-parser.add_argument('--prefix', type=str)
-parser.add_argument('--install', type=str, nargs='+', action='append')
-
-args = parser.parse_args()
-
-def copy_files(prefix: str, destdir: str, targetdir: str, src_list: list):
- if not os.path.isabs(targetdir):
- targetdir = os.path.join(prefix, targetdir)
-
- if destdir is not None:
- # copy of meson's logic for joining destdir and install paths
- targetdir = str(PurePath(destdir, *PurePath(targetdir).parts[1:]))
-
- os.makedirs(targetdir, exist_ok=True)
-
- for src in src_list:
- shutil.copy2(src, targetdir)
-
-for installs in args.install:
- copy_files(args.prefix, args.destdir, installs[0], installs[1:])
--
2.38.0
v2-0003-wip-meson-add-install-docs-doc-html-doc-man-targe.patchtext/x-diff; charset=us-asciiDownload
From bb0756f88e3dba00bfc5f3efe90d9ab785f62831 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:43:40 -0700
Subject: [PATCH v2 3/8] wip: meson: add install-{docs,doc-html,doc-man}
targets
---
meson.build | 2 +-
doc/src/sgml/meson.build | 67 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 84fe2c3d4c3..33dd5b43ed5 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..f24acebb0fe 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,21 @@ 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', input: html,
+ command: [
+ python, install_files, '--prefix', dir_prefix,
+ '--install-dir-contents', dir_doc_html, '@INPUT@'],
+ depends: 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 +222,20 @@ if xsltproc_bin.found()
build_by_default: false,
)
alldocs += man
+
+ install_doc_man = custom_target('install-man',
+ output: 'install-man', input: man,
+ command: [
+ python, install_files, '--prefix', dir_prefix,
+ '--install-dirs', dir_man, '@INPUT@'],
+ 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
@@ -262,10 +290,47 @@ if pandoc.found() and xsltproc_bin.found()
alldocs += postgres_epub
endif
+
+##
+## Experimental Texinfo targets
+##
+
+db2x_xsltproc = find_program('db2x_xsltproc', native: true, required: false)
+db2x_texixml = find_program('db2x_texixml', native: true, required: false)
+makeinfo = find_program('makeinfo', native: true, required: false)
+
+if db2x_texixml.found() and db2x_xsltproc.found() and makeinfo.found()
+ postgres_texixml = custom_target('postgres.texixml',
+ input: postgres_full_xml,
+ output: 'postgres.texixml',
+ command: [db2x_xsltproc, '-s', 'texi',
+ '-g', 'output-file=postgres',
+ '@INPUT@', '-o', '@OUTPUT@'],
+ build_by_default: false,
+ )
+ postgres_texi = custom_target('postgres.texi',
+ input: postgres_texixml,
+ output: 'postgres.texi',
+ command: [db2x_texixml, '--encoding=utf-8', '@INPUT@',
+ '--output-dir=@OUTDIR@'],
+ build_by_default: false,
+ )
+ postgres_info = custom_target('postgres.info',
+ input: postgres_texi,
+ output: 'postgres.info',
+ command: [makeinfo, '--enable-encoding', '--no-split', '--no-validate',
+ '@INPUT@', '-o', '@OUTPUT0@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_info
+endif
+
+
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
v2-0004-meson-add-install-quiet-world-targets.patchtext/x-diff; charset=us-asciiDownload
From efc9cc54de401cb7e20e02d4edbe85384ecf01a2 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 19 Mar 2023 11:17:54 -0700
Subject: [PATCH v2 4/8] meson: add install-{quiet, world} targets
---
meson.build | 36 ++++++++++++++++++++++
src/backend/po/meson.build | 2 +-
src/bin/initdb/po/meson.build | 2 +-
src/bin/pg_amcheck/po/meson.build | 2 +-
src/bin/pg_archivecleanup/po/meson.build | 2 +-
src/bin/pg_basebackup/po/meson.build | 2 +-
src/bin/pg_checksums/po/meson.build | 2 +-
src/bin/pg_config/po/meson.build | 2 +-
src/bin/pg_controldata/po/meson.build | 2 +-
src/bin/pg_ctl/po/meson.build | 2 +-
src/bin/pg_dump/po/meson.build | 2 +-
src/bin/pg_resetwal/po/meson.build | 2 +-
src/bin/pg_rewind/po/meson.build | 2 +-
src/bin/pg_test_fsync/po/meson.build | 2 +-
src/bin/pg_test_timing/po/meson.build | 2 +-
src/bin/pg_upgrade/po/meson.build | 2 +-
src/bin/pg_verifybackup/po/meson.build | 2 +-
src/bin/pg_waldump/po/meson.build | 2 +-
src/bin/psql/po/meson.build | 2 +-
src/bin/scripts/po/meson.build | 2 +-
src/interfaces/libpq/po/meson.build | 2 +-
src/interfaces/libpq/test/meson.build | 4 +--
src/pl/plperl/po/meson.build | 2 +-
src/pl/plpgsql/src/po/meson.build | 2 +-
src/pl/plpython/po/meson.build | 2 +-
src/pl/tcl/po/meson.build | 2 +-
src/interfaces/ecpg/ecpglib/po/meson.build | 2 +-
src/interfaces/ecpg/preproc/po/meson.build | 2 +-
28 files changed, 64 insertions(+), 28 deletions(-)
diff --git a/meson.build b/meson.build
index 33dd5b43ed5..bd1c1bf9f1d 100644
--- a/meson.build
+++ b/meson.build
@@ -2543,6 +2543,7 @@ bin_targets = []
pl_targets = []
contrib_targets = []
testprep_targets = []
+nls_targets = []
# Define the tests to distribute them to the correct test styles later
@@ -3185,6 +3186,7 @@ if meson.version().version_compare('>=0.57')
endif
+
###############################################################
# Pseudo targets
###############################################################
@@ -3195,6 +3197,40 @@ alias_target('pl', pl_targets)
alias_target('contrib', contrib_targets)
alias_target('testprep', testprep_targets)
+# i18n.gettext() doesn't return the dependencies before 0.60 - but the gettext
+# generation happens during install, so that's not a real issue.
+nls_mo_targets = []
+if libintl.found() and meson.version().version_compare('>=0.60')
+ # use range() to avoid the flattening of the list that forech() would do
+ foreach off : range(0, nls_targets.length())
+ # i18n.gettext() list containing 1) list of built .mo files 2) maintainer
+ # -pot target 3) maintainer -pot target
+ nls_mo_targets += nls_targets[off][0]
+ endforeach
+ alias_target('nls', nls_mo_targets)
+endif
+
+all_built = [
+ backend_targets,
+ bin_targets,
+ libpq_st,
+ pl_targets,
+ contrib_targets,
+ nls_mo_targets,
+ testprep_targets,
+ ecpg_targets,
+]
+
+install_quiet = custom_target('install-quiet',
+ output: 'install-quiet',
+ build_always_stale: true,
+ build_by_default: false,
+ command: meson_args + ['install', '--quiet', '--no-rebuild'],
+ depends: all_built,
+)
+
+alias_target('install-world', install_quiet, installdocs)
+
###############################################################
diff --git a/src/backend/po/meson.build b/src/backend/po/meson.build
index 772399b0bd8..b3cb083eb2c 100644
--- a/src/backend/po/meson.build
+++ b/src/backend/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('postgres-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('postgres-' + pg_version_major.to_string())]
diff --git a/src/bin/initdb/po/meson.build b/src/bin/initdb/po/meson.build
index 6506c5264ee..ad193984175 100644
--- a/src/bin/initdb/po/meson.build
+++ b/src/bin/initdb/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('initdb-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('initdb-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_amcheck/po/meson.build b/src/bin/pg_amcheck/po/meson.build
index 9cb62eaaae2..618de4f4458 100644
--- a/src/bin/pg_amcheck/po/meson.build
+++ b/src/bin/pg_amcheck/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_amcheck-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_amcheck-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_archivecleanup/po/meson.build b/src/bin/pg_archivecleanup/po/meson.build
index 79957fa2b98..c6f33edcad1 100644
--- a/src/bin/pg_archivecleanup/po/meson.build
+++ b/src/bin/pg_archivecleanup/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_basebackup/po/meson.build b/src/bin/pg_basebackup/po/meson.build
index 437f7e0606f..2a39f5ffeba 100644
--- a/src/bin/pg_basebackup/po/meson.build
+++ b/src/bin/pg_basebackup/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_basebackup-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_basebackup-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_checksums/po/meson.build b/src/bin/pg_checksums/po/meson.build
index 273f55d9012..97b20f263cf 100644
--- a/src/bin/pg_checksums/po/meson.build
+++ b/src/bin/pg_checksums/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_checksums-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_checksums-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_config/po/meson.build b/src/bin/pg_config/po/meson.build
index 7e4629ffc4e..f515af816ea 100644
--- a/src/bin/pg_config/po/meson.build
+++ b/src/bin/pg_config/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_config-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_config-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_controldata/po/meson.build b/src/bin/pg_controldata/po/meson.build
index 73a77568b6f..685f1c167a7 100644
--- a/src/bin/pg_controldata/po/meson.build
+++ b/src/bin/pg_controldata/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_controldata-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_controldata-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_ctl/po/meson.build b/src/bin/pg_ctl/po/meson.build
index da7710090e0..3d35f7ad211 100644
--- a/src/bin/pg_ctl/po/meson.build
+++ b/src/bin/pg_ctl/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_ctl-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_ctl-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_dump/po/meson.build b/src/bin/pg_dump/po/meson.build
index 3b627711d73..cc9d3680119 100644
--- a/src/bin/pg_dump/po/meson.build
+++ b/src/bin/pg_dump/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_dump-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_dump-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_resetwal/po/meson.build b/src/bin/pg_resetwal/po/meson.build
index c82c6a4263f..fa75d287526 100644
--- a/src/bin/pg_resetwal/po/meson.build
+++ b/src/bin/pg_resetwal/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_resetwal-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_resetwal-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_rewind/po/meson.build b/src/bin/pg_rewind/po/meson.build
index b0ccd16bbb9..bffe7debea9 100644
--- a/src/bin/pg_rewind/po/meson.build
+++ b/src/bin/pg_rewind/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_rewind-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_rewind-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_test_fsync/po/meson.build b/src/bin/pg_test_fsync/po/meson.build
index b25a6d0f826..46d0ac587e2 100644
--- a/src/bin/pg_test_fsync/po/meson.build
+++ b/src/bin/pg_test_fsync/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_test_timing/po/meson.build b/src/bin/pg_test_timing/po/meson.build
index 918225a1cf5..7bc84d5c7ff 100644
--- a/src/bin/pg_test_timing/po/meson.build
+++ b/src/bin/pg_test_timing/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_test_timing-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_test_timing-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_upgrade/po/meson.build b/src/bin/pg_upgrade/po/meson.build
index b4ba67b1c5e..8531c3b31ef 100644
--- a/src/bin/pg_upgrade/po/meson.build
+++ b/src/bin/pg_upgrade/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_upgrade-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_upgrade-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_verifybackup/po/meson.build b/src/bin/pg_verifybackup/po/meson.build
index 092b8a95f31..181cf640e71 100644
--- a/src/bin/pg_verifybackup/po/meson.build
+++ b/src/bin/pg_verifybackup/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())]
diff --git a/src/bin/pg_waldump/po/meson.build b/src/bin/pg_waldump/po/meson.build
index 076dbcafb42..c4188032d71 100644
--- a/src/bin/pg_waldump/po/meson.build
+++ b/src/bin/pg_waldump/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pg_waldump-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pg_waldump-' + pg_version_major.to_string())]
diff --git a/src/bin/psql/po/meson.build b/src/bin/psql/po/meson.build
index da257154d4c..103ed93a789 100644
--- a/src/bin/psql/po/meson.build
+++ b/src/bin/psql/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('psql-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('psql-' + pg_version_major.to_string())]
diff --git a/src/bin/scripts/po/meson.build b/src/bin/scripts/po/meson.build
index a28ec9ed049..00a9f208acf 100644
--- a/src/bin/scripts/po/meson.build
+++ b/src/bin/scripts/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pgscripts-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pgscripts-' + pg_version_major.to_string())]
diff --git a/src/interfaces/libpq/po/meson.build b/src/interfaces/libpq/po/meson.build
index 5489b23b795..a7a1df87ae3 100644
--- a/src/interfaces/libpq/po/meson.build
+++ b/src/interfaces/libpq/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('libpq' + '5' + '-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('libpq' + '5' + '-' + pg_version_major.to_string())]
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
index b2a4b06fd23..d56b63e1186 100644
--- a/src/interfaces/libpq/test/meson.build
+++ b/src/interfaces/libpq/test/meson.build
@@ -10,7 +10,7 @@ if host_system == 'windows'
'--FILEDESC', 'libpq test program',])
endif
-executable('libpq_uri_regress',
+testprep_targets += executable('libpq_uri_regress',
libpq_uri_regress_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
@@ -29,7 +29,7 @@ if host_system == 'windows'
'--FILEDESC', 'libpq test program',])
endif
-executable('libpq_testclient',
+testprep_targets += executable('libpq_testclient',
libpq_testclient_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
diff --git a/src/pl/plperl/po/meson.build b/src/pl/plperl/po/meson.build
index 2c3cd190cd9..f1c8e7d00a1 100644
--- a/src/pl/plperl/po/meson.build
+++ b/src/pl/plperl/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('plperl-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('plperl-' + pg_version_major.to_string())]
diff --git a/src/pl/plpgsql/src/po/meson.build b/src/pl/plpgsql/src/po/meson.build
index 1fa97d6ab50..aad875948b6 100644
--- a/src/pl/plpgsql/src/po/meson.build
+++ b/src/pl/plpgsql/src/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('plpgsql-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('plpgsql-' + pg_version_major.to_string())]
diff --git a/src/pl/plpython/po/meson.build b/src/pl/plpython/po/meson.build
index e5457069b47..ddaa1913b84 100644
--- a/src/pl/plpython/po/meson.build
+++ b/src/pl/plpython/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('plpython-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('plpython-' + pg_version_major.to_string())]
diff --git a/src/pl/tcl/po/meson.build b/src/pl/tcl/po/meson.build
index 3e7d3287f84..9e5c8e95f15 100644
--- a/src/pl/tcl/po/meson.build
+++ b/src/pl/tcl/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('pltcl-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('pltcl-' + pg_version_major.to_string())]
diff --git a/src/interfaces/ecpg/ecpglib/po/meson.build b/src/interfaces/ecpg/ecpglib/po/meson.build
index 95e748d9fa5..39fcc93bfcc 100644
--- a/src/interfaces/ecpg/ecpglib/po/meson.build
+++ b/src/interfaces/ecpg/ecpglib/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('ecpglib' + '6' + '-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('ecpglib' + '6' + '-' + pg_version_major.to_string())]
diff --git a/src/interfaces/ecpg/preproc/po/meson.build b/src/interfaces/ecpg/preproc/po/meson.build
index 1b2ff116547..43f825b88bb 100644
--- a/src/interfaces/ecpg/preproc/po/meson.build
+++ b/src/interfaces/ecpg/preproc/po/meson.build
@@ -1,3 +1,3 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
-i18n.gettext('ecpg-' + pg_version_major.to_string())
+nls_targets += [i18n.gettext('ecpg-' + pg_version_major.to_string())]
--
2.38.0
v2-0005-docs-html-copy-images-to-output-as-part-of-xslt-b.patchtext/x-diff; charset=us-asciiDownload
From f7f88de6726a5663d90da5a454c9b3a1ba037fd1 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:45:14 -0700
Subject: [PATCH v2 5/8] docs: html: copy images to output as part of xslt
build
---
doc/src/sgml/Makefile | 2 --
doc/src/sgml/stylesheet-common.xsl | 22 ++++++++++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 6 ++++++
doc/src/sgml/stylesheet.xsl | 7 ++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index b96c7cbf223..1b098f983ec 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -144,7 +144,6 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(ALL_IMAGES) html/
cp $(srcdir)/stylesheet.css html/
touch $@
@@ -152,7 +151,6 @@ htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(ALL_IMAGES) htmlhelp/
cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index 761484c7fef..d2928f86eb7 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -101,4 +101,26 @@
<xsl:apply-templates select="." mode="xref"/>
</xsl:template>
+
+<!--
+ Support for copying images to the output directory, so the output is self
+ contained.
+-->
+<xsl:template name="write-image">
+ <xsl:variable name="input_filename">
+ <xsl:value-of select="imagedata/@fileref"/>
+ </xsl:variable>
+
+ <!-- references images directly, without images/ -->
+ <xsl:variable name="output_filename">
+ <xsl:value-of select="concat($chunk.base.dir, substring-after($input_filename, '/'))"/>
+ </xsl:variable>
+
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename" select="$output_filename"/>
+ <xsl:with-param name="content" select="document($input_filename)"/>
+ </xsl:call-template>
+</xsl:template>
+
+
</xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 6f4b706dac6..568ccf36d2a 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -39,6 +39,12 @@
</xsl:template>
+<xsl:template match="imageobject">
+ <xsl:call-template name="write-image"/>
+ <!-- copy images to the output directory, so the output is self contained -->
+ <xsl:apply-templates select="imagedata"/>
+</xsl:template>
+
<!-- strip directory name from image filerefs -->
<xsl:template match="imagedata/@fileref">
<xsl:value-of select="substring-after(., '/')"/>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index b6141303abd..f9163e7d946 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -29,7 +29,12 @@
</xsl:param>
-<!-- strip directory name from image filerefs -->
+<xsl:template match="imageobject">
+ <xsl:call-template name="write-image"/>
+ <!-- copy images to the output directory, so the output is self contained -->
+ <xsl:apply-templates select="imagedata"/>
+</xsl:template>
+
<xsl:template match="imagedata/@fileref">
<xsl:value-of select="substring-after(., '/')"/>
</xsl:template>
--
2.38.0
v2-0006-wip-docs-copy-or-inline-css.patchtext/x-diff; charset=us-asciiDownload
From 481cf9704196db7f6c05054943d184bfea303466 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 20:49:47 -0700
Subject: [PATCH v2 6/8] wip: docs: copy or inline css
---
doc/src/sgml/Makefile | 4 +---
doc/src/sgml/meson.build | 2 +-
doc/src/sgml/stylesheet-common.xsl | 20 ++++++++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 10 +++++++++-
doc/src/sgml/stylesheet-html-nochunk.xsl | 20 ++++++++++++++++++++
doc/src/sgml/stylesheet.xsl | 15 ++++++---------
6 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 1b098f983ec..3f971f6eb33 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -53,7 +53,7 @@ else
XSLTPROC = $(missing) xsltproc
endif
-override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
+override XSLTPROCFLAGS += --xincludestyle --stringparam pg.version '$(VERSION)'
GENERATED_SGML = version.sgml \
@@ -144,14 +144,12 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css html/
touch $@
htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
# single-page HTML
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index f24acebb0fe..bbe285b29bb 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -104,7 +104,7 @@ if xsltproc_bin.found()
xsltproc_flags = [
'--nonet',
'--stringparam', 'pg.version', pg_version,
- '--param', 'website.stylesheet', '1'
+ '--xincludestyle',
]
xsltproc = xmltools_wrapper + [
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index d2928f86eb7..25d05b9e5f4 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -41,6 +41,8 @@
<xsl:param name="variablelist.term.break.after">1</xsl:param>
<xsl:param name="variablelist.term.separator"></xsl:param>
<xsl:param name="xref.with.number.and.title" select="0"></xsl:param>
+<!-- currently htmlhelp and other html have no common stylesheet -->
+<xsl:param name="website.stylesheet" select="0"/>
<!-- Change display of some elements -->
@@ -122,5 +124,23 @@
</xsl:call-template>
</xsl:template>
+<xsl:template name="stylesheet-reference">
+ <xsl:choose>
+ <xsl:when test="$website.stylesheet = 0">stylesheet.css
+ <xsl:variable name="styleout" select="concat($base.dir, 'stylesheet.css')"/>
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename" select="$styleout"/>
+ <xsl:with-param name="omit-xml-declaration" select="'yes'"/>
+ <xsl:with-param name="content">
+ <!-- xinclude is only processed in toplevel stylesheet -->
+ <xsl:call-template name="stylesheet-contents"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ https://www.postgresql.org/media/css/docs-complete.css
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
</xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 568ccf36d2a..6f6c6c64626 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -1,5 +1,6 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl"/>
@@ -9,7 +10,6 @@
<xsl:param name="htmlhelp.use.hhk" select="'1'"/>
<xsl:param name="base.dir" select="'htmlhelp/'"></xsl:param>
-<xsl:param name="html.stylesheet" select="'stylesheet.css'"></xsl:param>
<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
<xsl:param name="manifest.in.base.dir" select="1"/>
<xsl:param name="make.valid.html" select="1"></xsl:param>
@@ -19,6 +19,14 @@
<xsl:param name="chunker.output.indent" select="'yes'"/>
<xsl:param name="chunk.quietly" select="1"></xsl:param>
+<xsl:param name="html.stylesheet">
+ <xsl:call-template name="stylesheet-reference"/>
+</xsl:param>
+
+<xsl:template name="stylesheet-contents">
+ <xi:include href="stylesheet.css" parse="text"/>
+</xsl:template>
+
<!-- Change display of some elements -->
diff --git a/doc/src/sgml/stylesheet-html-nochunk.xsl b/doc/src/sgml/stylesheet-html-nochunk.xsl
index 8167127b93a..560f6a0b0a7 100644
--- a/doc/src/sgml/stylesheet-html-nochunk.xsl
+++ b/doc/src/sgml/stylesheet-html-nochunk.xsl
@@ -1,5 +1,7 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns="http://www.w3.org/1999/xhtml"
version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
@@ -7,6 +9,24 @@
<xsl:include href="stylesheet-html-common.xsl" />
<xsl:include href="stylesheet-speedup-xhtml.xsl" />
+
+<xsl:param name="generate.css.header" select="1"/>
+<xsl:template name="generate.css.headers">
+ <xsl:choose>
+ <!-- inline css style sheet -->
+ <xsl:when test="$website.stylesheet = 0">
+ <style type="text/css">
+ <xi:include href="stylesheet.css" parse="text"/>
+ </style>
+ </xsl:when>
+ <!-- link to website -->
+ <xsl:otherwise>
+ <link rel="stylesheet" type="text/css" href="https://www.postgresql.org/media/css/docs-complete.css"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
<!-- embed SVG images into output file -->
<xsl:template match="imagedata[@format='SVG']">
<xsl:variable name="filename">
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index f9163e7d946..c551b9cd809 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -1,7 +1,8 @@
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'
- xmlns="http://www.w3.org/1999/xhtml">
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
<xsl:include href="stylesheet-common.xsl" />
@@ -17,17 +18,13 @@
<xsl:param name="chunk.quietly" select="1"></xsl:param>
<xsl:param name="admon.style"></xsl:param> <!-- handled by CSS stylesheet -->
-<xsl:param name="website.stylesheet" select="0"/>
-
<xsl:param name="html.stylesheet">
- <xsl:choose>
- <xsl:when test="$website.stylesheet = 0">stylesheet.css</xsl:when>
- <xsl:otherwise>
- https://www.postgresql.org/media/css/docs-complete.css
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="stylesheet-reference"/>
</xsl:param>
+<xsl:template name="stylesheet-contents">
+ <xi:include href="stylesheet.css" parse="text"/>
+</xsl:template>
<xsl:template match="imageobject">
<xsl:call-template name="write-image"/>
--
2.38.0
v2-0007-docs-speed-up-docs-build-by-special-casing-the-ge.patchtext/x-diff; charset=us-asciiDownload
From 8d4cc69ea39304decc78d687fd3b97a9b1907bf9 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 19 Mar 2023 11:11:37 -0700
Subject: [PATCH v2 7/8] docs: speed up docs build by special-casing the
gentext.template
---
doc/src/sgml/stylesheet-speedup-common.xsl | 79 ++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/doc/src/sgml/stylesheet-speedup-common.xsl b/doc/src/sgml/stylesheet-speedup-common.xsl
index e3fb582a1cc..5266ff587b9 100644
--- a/doc/src/sgml/stylesheet-speedup-common.xsl
+++ b/doc/src/sgml/stylesheet-speedup-common.xsl
@@ -96,5 +96,84 @@
<!-- Just hardcode the language for the whole document, to make it faster. -->
<xsl:template name="l10n.language">en</xsl:template>
+<xsl:param name='pg.l10n.xml' select="document('file:///usr/share/xml/docbook/stylesheet/docbook-xsl/common/en.xml')[1]"/>
+
+<xsl:template name="gentext.template.recurse">
+ <xsl:param name="context"/>
+ <xsl:param name="name"/>
+ <xsl:param name="origname"/>
+ <xsl:param name="verbose"/>
+
+
+ <xsl:choose>
+ <xsl:when test="contains($name, '/')">
+ <xsl:call-template name="gentext.template.recurse">
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="name" select="substring-after($name, '/')"/>
+ <xsl:with-param name="origname" select="$origname"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+
+ <!-- FIXME: should find a way to avoid the concat and [1] here -->
+ <xsl:variable name="template.node"
+ select="key('l10n-template', concat($context, '#', $name))[1]"/>
+
+ <xsl:choose>
+ <xsl:when test="$template.node/@text">
+ <xsl:value-of select="$template.node/@text"/>
+ </xsl:when>
+ <xsl:when test="$verbose = 0">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>No template for "</xsl:text>
+ <xsl:value-of select="$origname"/>
+ <xsl:text>" (or any of its leaves) exists in the context named "</xsl:text>
+ <xsl:value-of select="$context"/>
+ <xsl:text>" in the "</xsl:text>
+ <xsl:text>" en localization.</xsl:text>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="gentext.template">
+ <xsl:param name="context" select="'default'"/>
+ <xsl:param name="name" select="'default'"/>
+ <xsl:param name="origname" select="$name"/>
+ <xsl:param name="lang" select="'en'"/>
+ <xsl:param name="verbose" select="1"/>
+
+ <!-- FIXME: unnecessary recursion for leading -->
+ <xsl:for-each select="$pg.l10n.xml">
+ <xsl:variable name="context.node"
+ select="key('l10n-context', $context)[1]"/>
+
+ <xsl:if test="count($context.node) = 0
+ and $verbose != 0">
+ <xsl:message>
+ <xsl:text>No context named "</xsl:text>
+ <xsl:value-of select="$context"/>
+ <xsl:text>" exists in the "</xsl:text>
+ <xsl:value-of select="$lang"/>
+ <xsl:text>" localization.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+
+ <xsl:for-each select="$context.node">
+ <xsl:call-template name="gentext.template.recurse">
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="origname" select="$origname"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:for-each>
+</xsl:template>
</xsl:stylesheet>
--
2.38.0
v2-0008-VERY-WIP-parallel-doc-generation.patchtext/x-diff; charset=us-asciiDownload
From df0548082b821e90b783131f37053326e28cfd06 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 19 Mar 2023 19:29:41 -0700
Subject: [PATCH v2 8/8] VERY WIP: parallel doc generation
---
doc/src/sgml/meson.build | 17 +++++++++++
doc/src/sgml/postgres.sgml | 2 +-
doc/src/sgml/stylesheet.xsl | 51 ++++++++++++++++++++++++++++++-
doc/src/sgml/xmltools_dep_wrapper | 5 +++
4 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index bbe285b29bb..1adae3f7ee5 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -121,6 +121,23 @@ if xsltproc_bin.found()
)
alldocs += html
+ parts = ['bookinfo', 'preface', 'tutorial', 'sql', 'admin', 'client-interfaces', 'server-programming', 'reference', 'internals', 'appendixes', 'biblio', 'bookindex']
+ html_parts = []
+ foreach part : parts
+ html_parts += custom_target('html-@0@'.format(part),
+ input: ['stylesheet.xsl', postgres_full_xml],
+ output: 'html-stamp-@0@'.format(part),
+ depfile: 'html.d',
+ depends: doc_generated,
+ command: [
+ xmltools_wrapper, '--tool', xsltproc_bin, '--stamp', '@OUTPUT0@', '--',
+ '-o', '@OUTDIR@/', xsltproc_flags, '--stringparam', 'rootid', part, '@INPUT@',
+ ],
+ build_by_default: false,
+ )
+ endforeach
+ alias_target('html-parts', html_parts)
+
install_doc_html = custom_target('install-html',
output: 'install-html', input: html,
command: [
diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml
index 2e271862fc1..a169fd6f30a 100644
--- a/doc/src/sgml/postgres.sgml
+++ b/doc/src/sgml/postgres.sgml
@@ -23,7 +23,7 @@ break is not needed in a wider output rendering.
<book id="postgres">
<title>PostgreSQL &version; Documentation</title>
- <bookinfo>
+ <bookinfo id="bookinfo">
<corpauthor>The PostgreSQL Global Development Group</corpauthor>
<productname>PostgreSQL</productname>
<productnumber>&version;</productnumber>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index c551b9cd809..32bceba2d54 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -15,7 +15,7 @@
<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
<xsl:param name="generate.legalnotice.link" select="1"></xsl:param>
<xsl:param name="chunk.first.sections" select="1"/>
-<xsl:param name="chunk.quietly" select="1"></xsl:param>
+<xsl:param name="chunk.quietly" select="0"></xsl:param>
<xsl:param name="admon.style"></xsl:param> <!-- handled by CSS stylesheet -->
<xsl:param name="html.stylesheet">
@@ -36,6 +36,55 @@
<xsl:value-of select="substring-after(., '/')"/>
</xsl:template>
+<!-- Emit index.html and legalnotice.html -->
+<xsl:template name="pg.write.bookinfo">
+ <xsl:for-each select="/book">
+ <xsl:call-template name="process-chunk">
+ <xsl:with-param name="prev" select="/dontexist"/>
+ <xsl:with-param name="next" select="preface"/>
+ <xsl:with-param name="content">
+
+ <div>
+ <xsl:apply-templates select="." mode="common.html.attributes"/>
+ <xsl:call-template name="id.attribute">
+ <xsl:with-param name="conditional" select="0"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="book.titlepage"/>
+
+ <xsl:apply-templates select="dedication" mode="dedication"/>
+ <xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
+
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:call-template name="make.lots">
+ <xsl:with-param name="toc.params" select="$toc.params"/>
+ <xsl:with-param name="toc">
+ <xsl:call-template name="division.toc">
+ <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </div>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="/book/bookinfo" mode="process.root" priority="2">
+ <xsl:choose>
+ <xsl:when test="$rootid = 'bookinfo'">
+ <xsl:call-template name="pg.write.bookinfo"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
<!--
Customization of header
diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper
index dd96f784268..a5f5981dcee 100644
--- a/doc/src/sgml/xmltools_dep_wrapper
+++ b/doc/src/sgml/xmltools_dep_wrapper
@@ -14,6 +14,7 @@ parser = argparse.ArgumentParser(
parser.add_argument('--targetname', type=str, required=False, nargs='+')
parser.add_argument('--depfile', type=str, required=False)
parser.add_argument('--tool', type=str, required=True)
+parser.add_argument('--stamp', type=str, required=False, default=None)
parser.add_argument('flags', nargs='*')
args = parser.parse_args()
@@ -51,4 +52,8 @@ else:
command = [args.tool] + args.flags
res = subprocess.run(command)
+if args.stamp is not None:
+ with open(args.stamp, "w") as f:
+ pass
+
exit(res.returncode)
--
2.38.0
On 20.03.23 03:33, Andres Freund wrote:
I did end up getting stuck when hacking on this, and ended up adding css
support for nochunk and support for the website style for htmlhelp and
nochunk, as well as obsoleting the need for copying the css files... But
perhaps that's a bit too much.Updated set of patches attached. This one works in older meson versions too
and adds install-world and install-quiet targets.
Oh, this patch set grew quite quickly. ;-)
[PATCH v2 1/8] meson: rename html_help target to htmlhelp
This is obvious.
[PATCH v2 5/8] docs: html: copy images to output as part of xslt build
Making the XSLT stylesheets do the copying has some appeal. I think it
would only work for SVG (or other XML) files, which I guess is okay, but
maybe the templates should have a filter on format="SVG" or something.
Also, this copying actually modifies the files in some XML-equivalent
way. Also okay, I think, but worth noting.
Note sure why you removed this comment
-<!-- strip directory name from image filerefs -->
since the code still exists.
[PATCH v2 6/8] wip: docs: copy or inline css
This seems pretty complicated compared to just copying a file?
Hi,
On 2023-03-20 11:58:08 +0100, Peter Eisentraut wrote:
Oh, this patch set grew quite quickly. ;-)
Yep :)
[PATCH v2 5/8] docs: html: copy images to output as part of xslt build
Making the XSLT stylesheets do the copying has some appeal. I think it
would only work for SVG (or other XML) files, which I guess is okay, but
maybe the templates should have a filter on format="SVG" or something. Also,
this copying actually modifies the files in some XML-equivalent way. Also
okay, I think, but worth noting.
I think it can be made work for non-xml files with xinclude too. But the
restriction around only working in top-level stylesheets (vs everywhere for
documents) is quite annoying.
[PATCH v2 6/8] wip: docs: copy or inline css
This seems pretty complicated compared to just copying a file?
Mainly that it works correctly for the standalone file.
Greetings,
Andres Freund
Hi,
On 2023-03-19 19:33:38 -0700, Andres Freund wrote:
I think we can make the docs build in parallel and incrementally, by building
the different parts of the docs in parallel, using --stringparam rootid,
e.g. building each 'part' separately.A very very rough draft attached:
parallel with parts:
real 0m10.831s
user 0m58.295s
sys 0m1.402snormal:
real 0m32.215s
user 0m31.876s
sys 0m0.328s1/3 of the build time at 2x the cost is nothing to sneeze at.
I could not make myself stop trying to figure out where the big constant time
factor comes from. Every invocation costs about 2s, even if not much is
rendered. Turns out, that's solely spent building all the <xsl:key>s. The
first time *any* key() is invoked for a document, all the keys are computed in
a single pass over the document.
A single reasonable key doesn't take that much time, even for the size of our
docs. But there are several redundant keys being built. Some of them somewhat
expensive. E.g. each
<xsl:key name="genid" match="*" use="generate-id()"/>
takes about 300ms. There's one in chunk-common and one in
docbook-no-doctype.xsl.
I'm going to cry now.
Greetings,
Andres Freund
Hi,
On 2023-03-20 10:32:49 -0700, Andres Freund wrote:
On 2023-03-20 11:58:08 +0100, Peter Eisentraut wrote:
Oh, this patch set grew quite quickly. ;-)
Yep :)
Unless somebody sees a reason to wait, I am planning to commit:
meson: add install-{quiet, world} targets
meson: add install-{docs,doc-html,doc-man} targets
meson: make install_test_files more generic, rename to install_files
While I don't think we have necessarily the path forward around .css and .svg,
the above are independent of that.
For the .svg: I wonder if we should just inline the images in the chunked
html, just like we do in the single page one. It's not like we reuse one image
across a lot of pages, so there's no bandwidth saved from having the images
separate...
For the .css: docbook-xsl actually has support for writing the .css: [1]https://docbook.sourceforge.net/release/xsl/current/doc/html/custom.css.source.html - but
it requires the .css file be valid xml. I wonder if the cleanest approch would
be to have a build step to create .css.xml - then the non-chunked build's
generate.css.header would do the right thing.
I'll start a new thread for
docs: speed up docs build by special-casing the gentext.template
VERY WIP: parallel doc generation
after the feature freeze.
After looking into it a tiny bit more, it seems we should use neither pandoc
nor dbtoepub for epub generation.
All the dbtoepub does is to invoke the docbook-xsl support for epubs and zip
the result - except it doesn't use our stylesheets, so it looks randomly
different and doesn't use our speedups. At the very least we should use our
customizations, if we want epub support. Or we should just remove it.
Pandoc unfortunately doesn't do docbook well enough to be usable for now to
directly parse our docbook.
Regards,
Andres
[1]: https://docbook.sourceforge.net/release/xsl/current/doc/html/custom.css.source.html
Hi,
On 2023-03-22 11:59:17 -0700, Andres Freund wrote:
Unless somebody sees a reason to wait, I am planning to commit:
meson: add install-{quiet, world} targets
meson: add install-{docs,doc-html,doc-man} targets
meson: make install_test_files more generic, rename to install_files
I've done that now.
For the .css: docbook-xsl actually has support for writing the .css: [1] - but
it requires the .css file be valid xml. I wonder if the cleanest approch would
be to have a build step to create .css.xml - then the non-chunked build's
generate.css.header would do the right thing.
We don't even need to do that! The attached patch just creates a wrapper
css.xml that loads the .css via an entity reference.
I think this looks reasonably complicated, given that it gives us a working
stylesheet for the non-chunked output?
I don't know if my hack of putting the paramters in stylesheet-common.xsl is
reasonable. Perhaps we should just include stylesheet-html-common.xsl in
stylesheet-hh.xsl, then this uglyness wouldn't be required.
Greetings,
Andres Freund
Attachments:
v3-0001-docs-html-copy-images-to-output-as-part-of-xslt-b.patchtext/x-diff; charset=us-asciiDownload
From e7145805c25c0f1af983268882107f1557b67d44 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Mar 2023 16:45:14 -0700
Subject: [PATCH v3 1/4] docs: html: copy images to output as part of xslt
build
---
doc/src/sgml/Makefile | 2 --
doc/src/sgml/stylesheet-common.xsl | 22 ++++++++++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 6 ++++++
doc/src/sgml/stylesheet.xsl | 7 ++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index b96c7cbf223..1b098f983ec 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -144,7 +144,6 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(ALL_IMAGES) html/
cp $(srcdir)/stylesheet.css html/
touch $@
@@ -152,7 +151,6 @@ htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(ALL_IMAGES) htmlhelp/
cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index 761484c7fef..d2928f86eb7 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -101,4 +101,26 @@
<xsl:apply-templates select="." mode="xref"/>
</xsl:template>
+
+<!--
+ Support for copying images to the output directory, so the output is self
+ contained.
+-->
+<xsl:template name="write-image">
+ <xsl:variable name="input_filename">
+ <xsl:value-of select="imagedata/@fileref"/>
+ </xsl:variable>
+
+ <!-- references images directly, without images/ -->
+ <xsl:variable name="output_filename">
+ <xsl:value-of select="concat($chunk.base.dir, substring-after($input_filename, '/'))"/>
+ </xsl:variable>
+
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename" select="$output_filename"/>
+ <xsl:with-param name="content" select="document($input_filename)"/>
+ </xsl:call-template>
+</xsl:template>
+
+
</xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 6f4b706dac6..568ccf36d2a 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -39,6 +39,12 @@
</xsl:template>
+<xsl:template match="imageobject">
+ <xsl:call-template name="write-image"/>
+ <!-- copy images to the output directory, so the output is self contained -->
+ <xsl:apply-templates select="imagedata"/>
+</xsl:template>
+
<!-- strip directory name from image filerefs -->
<xsl:template match="imagedata/@fileref">
<xsl:value-of select="substring-after(., '/')"/>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index b6141303abd..f9163e7d946 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -29,7 +29,12 @@
</xsl:param>
-<!-- strip directory name from image filerefs -->
+<xsl:template match="imageobject">
+ <xsl:call-template name="write-image"/>
+ <!-- copy images to the output directory, so the output is self contained -->
+ <xsl:apply-templates select="imagedata"/>
+</xsl:template>
+
<xsl:template match="imagedata/@fileref">
<xsl:value-of select="substring-after(., '/')"/>
</xsl:template>
--
2.38.0
v3-0002-docs-load-stylesheet-via-custom.css.source.patchtext/x-diff; charset=us-asciiDownload
From fdd771319069322383e144eba68f07f2c305abc1 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 24 Mar 2023 00:13:53 -0700
Subject: [PATCH v3 2/4] docs: load stylesheet via custom.css.source
---
doc/src/sgml/Makefile | 4 +---
doc/src/sgml/meson.build | 12 ++++++------
doc/src/sgml/stylesheet-common.xsl | 14 ++++++++++++++
doc/src/sgml/stylesheet-hh.xsl | 1 -
doc/src/sgml/stylesheet-html-nochunk.xsl | 3 +++
doc/src/sgml/stylesheet.css.xml | 8 ++++++++
doc/src/sgml/stylesheet.xsl | 11 -----------
7 files changed, 32 insertions(+), 21 deletions(-)
create mode 100644 doc/src/sgml/stylesheet.css.xml
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 1b098f983ec..9be480613b4 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -39,7 +39,7 @@ ifndef FOP
FOP = $(missing) fop
endif
-XMLINCLUDE = --path .
+XMLINCLUDE = --path . --path $(srcdir)
ifdef XMLLINT
XMLLINT := $(XMLLINT) --nonet
@@ -144,14 +144,12 @@ html: html-stamp
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css html/
touch $@
htmlhelp: htmlhelp-stamp
htmlhelp-stamp: stylesheet-hh.xsl postgres-full.xml $(ALL_IMAGES)
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(wordlist 1,2,$^)
- cp $(srcdir)/stylesheet.css htmlhelp/
touch $@
# single-page HTML
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 157b8589e55..d9c46224dc9 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -104,7 +104,7 @@ if xsltproc_bin.found()
xsltproc_flags = [
'--nonet',
'--stringparam', 'pg.version', pg_version,
- '--param', 'website.stylesheet', '1'
+ '--path', '@CURRENT_SOURCE_DIR@', '--path', '@OUTDIR@',
]
xsltproc = xmltools_wrapper + [
@@ -140,7 +140,7 @@ if xsltproc_bin.found()
output: 'htmlhelp',
depfile: 'htmlhelp.d',
depends: doc_generated,
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += htmlhelp
@@ -152,7 +152,7 @@ if xsltproc_bin.found()
output: 'postgres.html',
depfile: 'postgres.html.d',
depends: doc_generated,
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += postgres_html
@@ -180,14 +180,14 @@ if xsltproc_bin.found()
output: 'INSTALL.xml',
depfile: 'INSTALL.xml.d',
depends: doc_generated + [postgres_full_xml],
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
)
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
depfile: 'INSTALL.html.d',
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += install_html
@@ -216,7 +216,7 @@ if xsltproc_bin.found()
output: ['man1', 'man3', 'man7'],
depfile: 'man.d',
depends: doc_generated,
- command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
alldocs += man
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index d2928f86eb7..c1a7d46bcc6 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -42,6 +42,20 @@
<xsl:param name="variablelist.term.separator"></xsl:param>
<xsl:param name="xref.with.number.and.title" select="0"></xsl:param>
+<!--
+ currently htmlhelp and "normal" html have no common stylesheet, so this is
+ implemented here
+-->
+<xsl:param name="website.stylesheet" select="0"/>
+
+<xsl:param name="custom.css.source">
+ <xsl:if test="$website.stylesheet = 0">stylesheet.css.xml</xsl:if>
+</xsl:param>
+
+<xsl:param name="html.stylesheet">
+ <xsl:if test="not($website.stylesheet = 0)">https://www.postgresql.org/media/css/docs-complete.css.xml</xsl:if>
+</xsl:param>
+
<!-- Change display of some elements -->
diff --git a/doc/src/sgml/stylesheet-hh.xsl b/doc/src/sgml/stylesheet-hh.xsl
index 568ccf36d2a..fb659d2ec38 100644
--- a/doc/src/sgml/stylesheet-hh.xsl
+++ b/doc/src/sgml/stylesheet-hh.xsl
@@ -9,7 +9,6 @@
<xsl:param name="htmlhelp.use.hhk" select="'1'"/>
<xsl:param name="base.dir" select="'htmlhelp/'"></xsl:param>
-<xsl:param name="html.stylesheet" select="'stylesheet.css'"></xsl:param>
<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
<xsl:param name="manifest.in.base.dir" select="1"/>
<xsl:param name="make.valid.html" select="1"></xsl:param>
diff --git a/doc/src/sgml/stylesheet-html-nochunk.xsl b/doc/src/sgml/stylesheet-html-nochunk.xsl
index 8167127b93a..fae8d5fbd96 100644
--- a/doc/src/sgml/stylesheet-html-nochunk.xsl
+++ b/doc/src/sgml/stylesheet-html-nochunk.xsl
@@ -7,6 +7,9 @@
<xsl:include href="stylesheet-html-common.xsl" />
<xsl:include href="stylesheet-speedup-xhtml.xsl" />
+<!-- embed stylesheet.css if using that -->
+<xsl:param name="generate.css.header" select="$website.stylesheet = 0"/>
+
<!-- embed SVG images into output file -->
<xsl:template match="imagedata[@format='SVG']">
<xsl:variable name="filename">
diff --git a/doc/src/sgml/stylesheet.css.xml b/doc/src/sgml/stylesheet.css.xml
new file mode 100644
index 00000000000..a21fcca576f
--- /dev/null
+++ b/doc/src/sgml/stylesheet.css.xml
@@ -0,0 +1,8 @@
+<!--
+ wrapper around stylesheet.css.xml to allow it to be loaded via docbook-xsl's
+ generate.css.header parameter.
+-->
+<!DOCTYPE style [
+<!ENTITY css SYSTEM "stylesheet.css">
+]>
+<style>&css;</style>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index f9163e7d946..65606ca3dbe 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -17,17 +17,6 @@
<xsl:param name="chunk.quietly" select="1"></xsl:param>
<xsl:param name="admon.style"></xsl:param> <!-- handled by CSS stylesheet -->
-<xsl:param name="website.stylesheet" select="0"/>
-
-<xsl:param name="html.stylesheet">
- <xsl:choose>
- <xsl:when test="$website.stylesheet = 0">stylesheet.css</xsl:when>
- <xsl:otherwise>
- https://www.postgresql.org/media/css/docs-complete.css
- </xsl:otherwise>
- </xsl:choose>
-</xsl:param>
-
<xsl:template match="imageobject">
<xsl:call-template name="write-image"/>
--
2.38.0
v3-0003-docs-speed-up-docs-build-by-special-casing-the-ge.patchtext/x-diff; charset=us-asciiDownload
From 4a220cc1bf79e19e9cb5e94d8a650123a0347bb4 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 19 Mar 2023 11:11:37 -0700
Subject: [PATCH v3 3/4] docs: speed up docs build by special-casing the
gentext.template
---
doc/src/sgml/stylesheet-speedup-common.xsl | 79 ++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/doc/src/sgml/stylesheet-speedup-common.xsl b/doc/src/sgml/stylesheet-speedup-common.xsl
index e3fb582a1cc..5266ff587b9 100644
--- a/doc/src/sgml/stylesheet-speedup-common.xsl
+++ b/doc/src/sgml/stylesheet-speedup-common.xsl
@@ -96,5 +96,84 @@
<!-- Just hardcode the language for the whole document, to make it faster. -->
<xsl:template name="l10n.language">en</xsl:template>
+<xsl:param name='pg.l10n.xml' select="document('file:///usr/share/xml/docbook/stylesheet/docbook-xsl/common/en.xml')[1]"/>
+
+<xsl:template name="gentext.template.recurse">
+ <xsl:param name="context"/>
+ <xsl:param name="name"/>
+ <xsl:param name="origname"/>
+ <xsl:param name="verbose"/>
+
+
+ <xsl:choose>
+ <xsl:when test="contains($name, '/')">
+ <xsl:call-template name="gentext.template.recurse">
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="name" select="substring-after($name, '/')"/>
+ <xsl:with-param name="origname" select="$origname"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+
+ <!-- FIXME: should find a way to avoid the concat and [1] here -->
+ <xsl:variable name="template.node"
+ select="key('l10n-template', concat($context, '#', $name))[1]"/>
+
+ <xsl:choose>
+ <xsl:when test="$template.node/@text">
+ <xsl:value-of select="$template.node/@text"/>
+ </xsl:when>
+ <xsl:when test="$verbose = 0">
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>
+ <xsl:text>No template for "</xsl:text>
+ <xsl:value-of select="$origname"/>
+ <xsl:text>" (or any of its leaves) exists in the context named "</xsl:text>
+ <xsl:value-of select="$context"/>
+ <xsl:text>" in the "</xsl:text>
+ <xsl:text>" en localization.</xsl:text>
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+
+<xsl:template name="gentext.template">
+ <xsl:param name="context" select="'default'"/>
+ <xsl:param name="name" select="'default'"/>
+ <xsl:param name="origname" select="$name"/>
+ <xsl:param name="lang" select="'en'"/>
+ <xsl:param name="verbose" select="1"/>
+
+ <!-- FIXME: unnecessary recursion for leading -->
+ <xsl:for-each select="$pg.l10n.xml">
+ <xsl:variable name="context.node"
+ select="key('l10n-context', $context)[1]"/>
+
+ <xsl:if test="count($context.node) = 0
+ and $verbose != 0">
+ <xsl:message>
+ <xsl:text>No context named "</xsl:text>
+ <xsl:value-of select="$context"/>
+ <xsl:text>" exists in the "</xsl:text>
+ <xsl:value-of select="$lang"/>
+ <xsl:text>" localization.</xsl:text>
+ </xsl:message>
+ </xsl:if>
+
+ <xsl:for-each select="$context.node">
+ <xsl:call-template name="gentext.template.recurse">
+ <xsl:with-param name="context" select="$context"/>
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="origname" select="$origname"/>
+ <xsl:with-param name="verbose" select="$verbose"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:for-each>
+</xsl:template>
</xsl:stylesheet>
--
2.38.0
v3-0004-VERY-WIP-parallel-doc-generation.patchtext/x-diff; charset=us-asciiDownload
From 37c880b04e13efa36b67832c647255ee80e726bd Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 19 Mar 2023 19:29:41 -0700
Subject: [PATCH v3 4/4] VERY WIP: parallel doc generation
---
doc/src/sgml/meson.build | 17 +++++++++++
doc/src/sgml/postgres.sgml | 2 +-
doc/src/sgml/stylesheet.xsl | 49 +++++++++++++++++++++++++++++++
doc/src/sgml/xmltools_dep_wrapper | 5 ++++
4 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index d9c46224dc9..c6195965a71 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -121,6 +121,23 @@ if xsltproc_bin.found()
)
alldocs += html
+ parts = ['bookinfo', 'preface', 'tutorial', 'sql', 'admin', 'client-interfaces', 'server-programming', 'reference', 'internals', 'appendixes', 'biblio', 'bookindex']
+ html_parts = []
+ foreach part : parts
+ html_parts += custom_target('html-@0@'.format(part),
+ input: ['stylesheet.xsl', postgres_full_xml],
+ output: 'html-stamp-@0@'.format(part),
+ depfile: 'html.d',
+ depends: doc_generated,
+ command: [
+ xmltools_wrapper, '--tool', xsltproc_bin, '--stamp', '@OUTPUT0@', '--',
+ '-o', '@OUTDIR@/', xsltproc_flags, '--stringparam', 'rootid', part, '@INPUT@',
+ ],
+ build_by_default: false,
+ )
+ endforeach
+ alias_target('html-parts', html_parts)
+
install_doc_html = custom_target('install-html',
output: 'install-html',
command: [
diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml
index 2e271862fc1..a169fd6f30a 100644
--- a/doc/src/sgml/postgres.sgml
+++ b/doc/src/sgml/postgres.sgml
@@ -23,7 +23,7 @@ break is not needed in a wider output rendering.
<book id="postgres">
<title>PostgreSQL &version; Documentation</title>
- <bookinfo>
+ <bookinfo id="bookinfo">
<corpauthor>The PostgreSQL Global Development Group</corpauthor>
<productname>PostgreSQL</productname>
<productnumber>&version;</productnumber>
diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl
index 65606ca3dbe..f9986d17f4a 100644
--- a/doc/src/sgml/stylesheet.xsl
+++ b/doc/src/sgml/stylesheet.xsl
@@ -28,6 +28,55 @@
<xsl:value-of select="substring-after(., '/')"/>
</xsl:template>
+<!-- Emit index.html and legalnotice.html -->
+<xsl:template name="pg.write.bookinfo">
+ <xsl:for-each select="/book">
+ <xsl:call-template name="process-chunk">
+ <xsl:with-param name="prev" select="/dontexist"/>
+ <xsl:with-param name="next" select="preface"/>
+ <xsl:with-param name="content">
+
+ <div>
+ <xsl:apply-templates select="." mode="common.html.attributes"/>
+ <xsl:call-template name="id.attribute">
+ <xsl:with-param name="conditional" select="0"/>
+ </xsl:call-template>
+
+ <xsl:call-template name="book.titlepage"/>
+
+ <xsl:apply-templates select="dedication" mode="dedication"/>
+ <xsl:apply-templates select="acknowledgements" mode="acknowledgements"/>
+
+ <xsl:variable name="toc.params">
+ <xsl:call-template name="find.path.params">
+ <xsl:with-param name="table" select="normalize-space($generate.toc)"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:call-template name="make.lots">
+ <xsl:with-param name="toc.params" select="$toc.params"/>
+ <xsl:with-param name="toc">
+ <xsl:call-template name="division.toc">
+ <xsl:with-param name="toc.title.p" select="contains($toc.params, 'title')"/>
+ </xsl:call-template>
+ </xsl:with-param>
+ </xsl:call-template>
+ </div>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="/book/bookinfo" mode="process.root" priority="2">
+ <xsl:choose>
+ <xsl:when test="$rootid = 'bookinfo'">
+ <xsl:call-template name="pg.write.bookinfo"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
<!--
Customization of header
diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper
index dd96f784268..a5f5981dcee 100644
--- a/doc/src/sgml/xmltools_dep_wrapper
+++ b/doc/src/sgml/xmltools_dep_wrapper
@@ -14,6 +14,7 @@ parser = argparse.ArgumentParser(
parser.add_argument('--targetname', type=str, required=False, nargs='+')
parser.add_argument('--depfile', type=str, required=False)
parser.add_argument('--tool', type=str, required=True)
+parser.add_argument('--stamp', type=str, required=False, default=None)
parser.add_argument('flags', nargs='*')
args = parser.parse_args()
@@ -51,4 +52,8 @@ else:
command = [args.tool] + args.flags
res = subprocess.run(command)
+if args.stamp is not None:
+ with open(args.stamp, "w") as f:
+ pass
+
exit(res.returncode)
--
2.38.0
On 24.03.23 08:26, Andres Freund wrote:
For the .css: docbook-xsl actually has support for writing the .css: [1] - but
it requires the .css file be valid xml. I wonder if the cleanest approch would
be to have a build step to create .css.xml - then the non-chunked build's
generate.css.header would do the right thing.We don't even need to do that! The attached patch just creates a wrapper
css.xml that loads the .css via an entity reference.
That looks like a better solution.
I don't know if my hack of putting the paramters in stylesheet-common.xsl is
reasonable. Perhaps we should just include stylesheet-html-common.xsl in
stylesheet-hh.xsl, then this uglyness wouldn't be required.
Maybe, but it's not clear whether all the customizations in there are
applicable to htmlhelp.
Another option here is to remove support for htmlhelp.
Hi,
On 2023-03-24 11:59:23 +0100, Peter Eisentraut wrote:
Another option here is to remove support for htmlhelp.
That might actually be the best path - it certainly doesn't look like anybody
has been actively using it. Or otherwise somebody would have complained about
there not being any instructions on how to actually compile a .chm file. And
perhaps complained that it takes next to forever to build.
I also have the impression that people don't use the .chm stuff much anymore,
but that might just be me not using windows.
Greetings,
Andres
On 24 Mar 2023, at 17:58, Andres Freund <andres@anarazel.de> wrote:
On 2023-03-24 11:59:23 +0100, Peter Eisentraut wrote:Another option here is to remove support for htmlhelp.
That might actually be the best path - it certainly doesn't look like anybody
has been actively using it.
I had no idea we had support for building a .chm until reading this, but I've
also never come across anyone asking for such a docset. FWIW, no objections to
it going.
--
Daniel Gustafsson
On 24.03.23 17:58, Andres Freund wrote:
On 2023-03-24 11:59:23 +0100, Peter Eisentraut wrote:
Another option here is to remove support for htmlhelp.
That might actually be the best path - it certainly doesn't look like anybody
has been actively using it. Or otherwise somebody would have complained about
there not being any instructions on how to actually compile a .chm file. And
perhaps complained that it takes next to forever to build.I also have the impression that people don't use the .chm stuff much anymore,
but that might just be me not using windows.
I think in ancient times, pgadmin used it for its internal help.
But I have heard less about htmlhelp over the years than about the info
format.
On Tue, 28 Mar 2023 at 10:46, Peter Eisentraut <
peter.eisentraut@enterprisedb.com> wrote:
On 24.03.23 17:58, Andres Freund wrote:
On 2023-03-24 11:59:23 +0100, Peter Eisentraut wrote:
Another option here is to remove support for htmlhelp.
That might actually be the best path - it certainly doesn't look like
anybody
has been actively using it. Or otherwise somebody would have complained
about
there not being any instructions on how to actually compile a .chm file.
And
perhaps complained that it takes next to forever to build.
I also have the impression that people don't use the .chm stuff much
anymore,
but that might just be me not using windows.
I think in ancient times, pgadmin used it for its internal help.
Yes, very ancient :-). We use Sphinx now.
But I have heard less about htmlhelp over the years than about the info
format.
--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake
On 15.03.23 08:14, Peter Eisentraut wrote:
I have identified several open issues with the documentation build under
Meson (approximately in priority order):
Some work has been done on this. Here is my current assessment.
1. Image files are not handled at all, so they don't show up in the
final product.
This is fixed.
2. Defaults to website stylesheet, no way to configure. This should be
adjusted to match the make build.
This is fixed.
3. The various build targets and their combinations are mismatching and
incomplete.
This has been improved, and I see there is documentation.
I think it's still an issue that "make docs" builds html and man but
"ninja docs" only builds html. For some reason the wiki page actually
claims that ninja docs builds both, but this does not happen for me.
4. There doesn't appear to be a way to install the documentation.
This has been addressed.
5. There doesn't appear to be an equivalent of "make world" and "make
install-world" that includes documentation builds.
This has been addressed with the additional meson auto options. But it
seems that these options only control building, not installing, so there
is no "install-world" aspect yet.
Hi,
On 2023-04-05 12:24:04 +0200, Peter Eisentraut wrote:
On 15.03.23 08:14, Peter Eisentraut wrote:
3. The various build targets and their combinations are mismatching and
incomplete.This has been improved, and I see there is documentation.
I think it's still an issue that "make docs" builds html and man but "ninja
docs" only builds html. For some reason the wiki page actually claims that
ninja docs builds both, but this does not happen for me.
It used to, but Tom insisted that it should not. I'm afraid that it's not
quite possible to emulate make here. 'make docs' at the toplevel builds both
HTML and manpages. But 'make -C doc/src/sgml', only builds HTML.
5. There doesn't appear to be an equivalent of "make world" and "make
install-world" that includes documentation builds.This has been addressed with the additional meson auto options. But it
seems that these options only control building, not installing, so there is
no "install-world" aspect yet.
I'm not following - install-world install docs if the docs feature is
available, and not if not?
Greetings,
Andres Freund
On 05.04.23 16:45, Andres Freund wrote:
I think it's still an issue that "make docs" builds html and man but "ninja
docs" only builds html. For some reason the wiki page actually claims that
ninja docs builds both, but this does not happen for me.It used to, but Tom insisted that it should not. I'm afraid that it's not
quite possible to emulate make here. 'make docs' at the toplevel builds both
HTML and manpages. But 'make -C doc/src/sgml', only builds HTML.
Ok, not a topic for this thread then.
5. There doesn't appear to be an equivalent of "make world" and "make
install-world" that includes documentation builds.This has been addressed with the additional meson auto options. But it
seems that these options only control building, not installing, so there is
no "install-world" aspect yet.I'm not following - install-world install docs if the docs feature is
available, and not if not?
I had expected that if meson setup enables the 'docs' feature, then
meson compile will build the documentation, which happens, and meson
install will install it, which does not happen.
On 2023-04-06 Th 05:11, Peter Eisentraut wrote:
On 05.04.23 16:45, Andres Freund wrote:
I think it's still an issue that "make docs" builds html and man but
"ninja
docs" only builds html. For some reason the wiki page actually
claims that
ninja docs builds both, but this does not happen for me.It used to, but Tom insisted that it should not. I'm afraid that it's
not
quite possible to emulate make here. 'make docs' at the toplevel
builds both
HTML and manpages. But 'make -C doc/src/sgml', only builds HTML.Ok, not a topic for this thread then.
5. There doesn't appear to be an equivalent of "make world" and "make
install-world" that includes documentation builds.This has been addressed with the additional meson auto options. But it
seems that these options only control building, not installing, so
there is
no "install-world" aspect yet.I'm not following - install-world install docs if the docs feature is
available, and not if not?I had expected that if meson setup enables the 'docs' feature, then
meson compile will build the documentation, which happens, and meson
install will install it, which does not happen.
"meson compile" doesn't seem to build the docs by default ( see
<https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=crake&dt=2023-04-06%2018%3A17%3A04&stg=build>),
and I'd rather it didn't, building the docs is a separate and optional
step for the buildfarm.
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
On 07.04.23 16:39, Andrew Dunstan wrote:
5. There doesn't appear to be an equivalent of "make world" and "make
install-world" that includes documentation builds.This has been addressed with the additional meson auto options. But it
seems that these options only control building, not installing, so
there is
no "install-world" aspect yet.I'm not following - install-world install docs if the docs feature is
available, and not if not?I had expected that if meson setup enables the 'docs' feature, then
meson compile will build the documentation, which happens, and meson
install will install it, which does not happen."meson compile" doesn't seem to build the docs by default ( see
<https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=crake&dt=2023-04-06%2018%3A17%3A04&stg=build>), and I'd rather it didn't, building the docs is a separate and optional step for the buildfarm.
You can control this with the "docs" option for meson, as of recently.
Re: Peter Eisentraut
"meson compile" doesn't seem to build the docs by default ( see <https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=crake&dt=2023-04-06%2018%3A17%3A04&stg=build>),
and I'd rather it didn't, building the docs is a separate and optional
step for the buildfarm.You can control this with the "docs" option for meson, as of recently.
I've been looking into switching the Debian PG 17 build to meson, but
I'm running into several problems.
* The docs are still not built by default, and -Ddocs=enabled doesn't
change that
* None of the "build docs" targets are documented in install-meson.html
* "ninja -C build alldocs" works, but it's impossible to see what
flavors it's actually building. Everything is autodetected, and
perhaps I would like to no build the .txt/something variants,
but I have no idea what switch that is, or what package I have to
uninstall so it's not autodetected (only html and pdf are
documented.)
Are there any other targets for the individual formats? (I could
probably use one for the manpages only, without the html.)
Non-doc issues:
* LLVM is off by default (ok), when I enable it with -Dllvm=auto, it
gets detected, but no .bc files are built, nor installed
* selinux is not autodetected. It needs -Dselinux=auto, but that's not
documented in install-meson.html
* There is no split between libdir and pkglibdir. We had used that in
the past for libpq -> /usr/lib/x86_64-linux-gnu and PG stuff ->
/usr/lib/postgresql/17/lib.
Christoph
Hi,
On 2023-11-03 15:26:05 +0100, Christoph Berg wrote:
Re: Peter Eisentraut
"meson compile" doesn't seem to build the docs by default ( see <https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=crake&dt=2023-04-06%2018%3A17%3A04&stg=build>),
and I'd rather it didn't, building the docs is a separate and optional
step for the buildfarm.You can control this with the "docs" option for meson, as of recently.
I've been looking into switching the Debian PG 17 build to meson, but
I'm running into several problems.* The docs are still not built by default, and -Ddocs=enabled doesn't
change that
Maybe I am missing something - they aren't built by default in autoconf
either?
* None of the "build docs" targets are documented in install-meson.html
Hm, odd, I thought they were, but you are right. There were some docs patches
that we never really could find agreement upon :/
* "ninja -C build alldocs" works, but it's impossible to see what
flavors it's actually building. Everything is autodetected, and
perhaps I would like to no build the .txt/something variants,
but I have no idea what switch that is, or what package I have to
uninstall so it's not autodetected (only html and pdf are
documented.)
I think a package build should probably turn off auto-detection (
meson setup --auto-features=disabled) and enable specific features that are
desired - in which case you get errors if they are not available. Which
presumably is the behaviour you'd like?
Are there any other targets for the individual formats? (I could
probably use one for the manpages only, without the html.)
Yes, there are.
ninja doc/src/sgml/{postgres-A4.pdf,html,postgres.html,man1}
Perhaps more interesting for your purposes, there are the
install-doc-{html,man} targets.
I remember discussing adding doc-{html,man} targets alongside
install-doc-{html,man}, not sure why we ended up not doing that. I'd be in
favor of adding them.
I've also been wondering about a 'help' target that documents important
targets in a interactively usable way.
Non-doc issues:
* LLVM is off by default (ok), when I enable it with -Dllvm=auto, it
gets detected, but no .bc files are built, nor installed
Support for that has not yet been merged.
* selinux is not autodetected. It needs -Dselinux=auto, but that's not
documented in install-meson.html
Uh, huh. There's no documentation for --with-selinux in the installation.sgml
either, just in sepgsql.sgml. So when the relevant docs got translated to
meson, -Dselinux= wasn't documented either.
* There is no split between libdir and pkglibdir. We had used that in
the past for libpq -> /usr/lib/x86_64-linux-gnu and PG stuff ->
/usr/lib/postgresql/17/lib.
I don't think the autoconf build currently exposes separately configuring
pkglibdir either, I think that's a debian patch? I'm entirely open to adding
an explicit configuration option for this though.
Thanks for looking at this, it's quite helpful!
Greetings,
Andres Freund
Re: Andres Freund
You can control this with the "docs" option for meson, as of recently.
I've been looking into switching the Debian PG 17 build to meson, but
I'm running into several problems.* The docs are still not built by default, and -Ddocs=enabled doesn't
change thatMaybe I am missing something - they aren't built by default in autoconf
either?
True, but the documentation (and this thread) reads like it should. Or
at least it should, when I explicitly say -Ddocs=enabled.
What would also help is when the tail of the meson output had a list
of features that are enabled. There's the list of "External libraries"
which is quite helpful at figuring out what's still missing, but
perhaps this could be extended:
Features
LLVM : YES (/usr/bin/llvm-config-16)
DOCS : YES (html pdf texinfo)
Atm it's hidden in the long initial blurb of "Checking for.." and the
"NO" in there don't really stand out as much, since some of them are
normal.
* "ninja -C build alldocs" works, but it's impossible to see what
flavors it's actually building. Everything is autodetected, and
perhaps I would like to no build the .txt/something variants,
but I have no idea what switch that is, or what package I have to
uninstall so it's not autodetected (only html and pdf are
documented.)I think a package build should probably turn off auto-detection (
meson setup --auto-features=disabled) and enable specific features that are
desired - in which case you get errors if they are not available. Which
presumably is the behaviour you'd like?
I'm still trying to figure out the best spot in that space of options.
Currently I'm still in the phase of getting it to work at all; the end
result might well use that option.
Are there any other targets for the individual formats? (I could
probably use one for the manpages only, without the html.)Yes, there are.
ninja doc/src/sgml/{postgres-A4.pdf,html,postgres.html,man1}
Oh, that was not obvious to me that this "make $some_file" style
command would work. (But it still leaves the problem of knowing which
targets there are.)
Perhaps more interesting for your purposes, there are the
install-doc-{html,man} targets.
Hmm, I thought I had tried these, but apparently managed to miss them.
Thanks.
install-doc-man seems to install "man1" only, though?
(It seems to compile man5/man7, but not install them.)
I remember discussing adding doc-{html,man} targets alongside
install-doc-{html,man}, not sure why we ended up not doing that. I'd be in
favor of adding them.I've also been wondering about a 'help' target that documents important
targets in a interactively usable way.
That is definitely missing, yes. I found out about "alldocs" only
after reading the meson files, and that took more than it should have.
Non-doc issues:
* LLVM is off by default (ok), when I enable it with -Dllvm=auto, it
gets detected, but no .bc files are built, nor installedSupport for that has not yet been merged.
Oh, that's a showstopper. I thought meson would already be ready for
production use. There is indeed an "experimental" note in
install-requirements.html, but not in install-meson.html
* selinux is not autodetected. It needs -Dselinux=auto, but that's not
documented in install-meson.htmlUh, huh. There's no documentation for --with-selinux in the installation.sgml
either, just in sepgsql.sgml. So when the relevant docs got translated to
meson, -Dselinux= wasn't documented either.
Ok. It does show up in "External libraries" and was enabled in the
Debian packages before.
Why isn't it "auto" like the others?
* There is no split between libdir and pkglibdir. We had used that in
the past for libpq -> /usr/lib/x86_64-linux-gnu and PG stuff ->
/usr/lib/postgresql/17/lib.I don't think the autoconf build currently exposes separately configuring
pkglibdir either, I think that's a debian patch? I'm entirely open to adding
an explicit configuration option for this though.
That would definitely be helpful.
Thanks for looking at this, it's quite helpful!
Thanks for the feedback!
Christoph
Hi,
On 2023-11-03 19:19:17 +0100, Christoph Berg wrote:
Re: Andres Freund
You can control this with the "docs" option for meson, as of recently.
I've been looking into switching the Debian PG 17 build to meson, but
I'm running into several problems.* The docs are still not built by default, and -Ddocs=enabled doesn't
change thatMaybe I am missing something - they aren't built by default in autoconf
either?True, but the documentation (and this thread) reads like it should. Or
at least it should, when I explicitly say -Ddocs=enabled.
My understanding of the intent of the options is to make meson error out if
the required dependencies are not available, not that it controls when the
build targets are built.
The reason for that is simply that the docs take too long to build.
What would also help is when the tail of the meson output had a list
of features that are enabled. There's the list of "External libraries"
which is quite helpful at figuring out what's still missing, but
perhaps this could be extended:Features
LLVM : YES (/usr/bin/llvm-config-16)
DOCS : YES (html pdf texinfo)Atm it's hidden in the long initial blurb of "Checking for.." and the
"NO" in there don't really stand out as much, since some of them are
normal.
The summary does include both. LLVM is 'llvm', man/html docs is 'docs' and pdf
docs as 'docs_pdf'.
Are there any other targets for the individual formats? (I could
probably use one for the manpages only, without the html.)Yes, there are.
ninja doc/src/sgml/{postgres-A4.pdf,html,postgres.html,man1}Oh, that was not obvious to me that this "make $some_file" style
command would work. (But it still leaves the problem of knowing which
targets there are.)
Yes, you can trigger building any file that way.
The following is *not* an argument the docs targets shouldn't be documented
(working on a patch), just something that might be helpful until then /
separately. You can see which targets are built with
ninja -t targets all|grep doc/src/
Perhaps more interesting for your purposes, there are the
install-doc-{html,man} targets.Hmm, I thought I had tried these, but apparently managed to miss them.
Thanks.install-doc-man seems to install "man1" only, though?
(It seems to compile man5/man7, but not install them.)
Ugh, that's obviously a bug. I'll fix it.
Non-doc issues:
* LLVM is off by default (ok), when I enable it with -Dllvm=auto, it
gets detected, but no .bc files are built, nor installedSupport for that has not yet been merged.
Oh, that's a showstopper. I thought meson would already be ready for
production use. There is indeed an "experimental" note in
install-requirements.html, but not in install-meson.html
I'm working on merging it. Having it for core PG isn't a huge difficulty, the
extension story is what's been holding me back...
* selinux is not autodetected. It needs -Dselinux=auto, but that's not
documented in install-meson.htmlUh, huh. There's no documentation for --with-selinux in the installation.sgml
either, just in sepgsql.sgml. So when the relevant docs got translated to
meson, -Dselinux= wasn't documented either.Ok. It does show up in "External libraries" and was enabled in the
Debian packages before.Why isn't it "auto" like the others?
I don't really remember why I did that, but it's platform specific, maybe
that's why I did it that way?
* There is no split between libdir and pkglibdir. We had used that in
the past for libpq -> /usr/lib/x86_64-linux-gnu and PG stuff ->
/usr/lib/postgresql/17/lib.I don't think the autoconf build currently exposes separately configuring
pkglibdir either, I think that's a debian patch? I'm entirely open to adding
an explicit configuration option for this though.That would definitely be helpful.
I have a patch locally, will send it together with a few others in a bit.
Greetings,
Andres Freund
Re: Andres Freund
The reason for that is simply that the docs take too long to build.
That why I'd prefer to be able to separate arch:all and arch:any
builds, yes.
The summary does include both. LLVM is 'llvm', man/html docs is 'docs' and pdf
docs as 'docs_pdf'.
Sorry, I should have looked closer. :(
The following is *not* an argument the docs targets shouldn't be documented
(working on a patch), just something that might be helpful until then /
separately. You can see which targets are built withninja -t targets all|grep doc/src/
Thanks.
Oh, that's a showstopper. I thought meson would already be ready for
production use. There is indeed an "experimental" note in
install-requirements.html, but not in install-meson.htmlI'm working on merging it. Having it for core PG isn't a huge difficulty, the
extension story is what's been holding me back...
In-core extensions or external ones?
Why isn't it "auto" like the others?
I don't really remember why I did that, but it's platform specific, maybe
that's why I did it that way?
Isn't that kind the point of autodetecting things? Aren't bonjour and
bsd_auth autodetected as well?
I don't think the autoconf build currently exposes separately configuring
pkglibdir either, I think that's a debian patch? I'm entirely open to adding
an explicit configuration option for this though.That would definitely be helpful.
I have a patch locally, will send it together with a few others in a bit.
Thanks!
Christoph
Hi,
On 2023-11-03 20:19:18 +0100, Christoph Berg wrote:
Re: Andres Freund
The reason for that is simply that the docs take too long to build.
That why I'd prefer to be able to separate arch:all and arch:any
builds, yes.
What's stopping you from doing that? I think the only arch:any content we
have is the docs, and those you can build separately? Doc builds do trigger
generation of a handful of files besides the docs, but not more.
Oh, that's a showstopper. I thought meson would already be ready for
production use. There is indeed an "experimental" note in
install-requirements.html, but not in install-meson.htmlI'm working on merging it. Having it for core PG isn't a huge difficulty, the
extension story is what's been holding me back...In-core extensions or external ones?
Both, although the difficulty of doing it is somewhat separate for each.
Why isn't it "auto" like the others?
I don't really remember why I did that, but it's platform specific, maybe
that's why I did it that way?Isn't that kind the point of autodetecting things? Aren't bonjour and
bsd_auth autodetected as well?
I'd be happy to change it, unless somebody objects?
I don't think the autoconf build currently exposes separately configuring
pkglibdir either, I think that's a debian patch? I'm entirely open to adding
an explicit configuration option for this though.That would definitely be helpful.
I have a patch locally, will send it together with a few others in a bit.
Thanks!
Attached.
0001 - the bugfix for install-man only installing man1, I'll push that soon
0002 - Document --with-selinux/-Dselinux options centrally
0003 - Add doc-{html,man} targets
I'm not quite sure it's worth it, but it's basically free, so ...
0004 - Documentation for important build targets
I'm not entirely happy with the formatting, but it looks like that's
mostly a CSS issue. I started a thread on fixing that on -www.
0005 - Add -Dpkglibdir option
I guess we might want to do the same for configure if we decide to do
this?
Greetings,
Andres Freund
Attachments:
v1-0001-meson-docs-Install-all-manpages-not-just-ones-in-.patchtext/x-diff; charset=us-asciiDownload
From 146f4e5a76e68c551aee55cb46bb2197166da63d Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 11:46:52 -0700
Subject: [PATCH v1 1/5] meson: docs: Install all manpages, not just ones in
man1
In f13eb16485f I made a mistake leading to only man1 being installed. I will
report a bug suggesting that meson warn about mistakes of this sort.
Reported-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/ZUU5pRQO6ZUeBsi6@msg.df7cb.de
Backpatch: 16-, where the meson build was introduced
---
doc/src/sgml/meson.build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 16c1aa980c9..90e2c062fa8 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -225,9 +225,10 @@ if docs_dep.found()
install_doc_man = custom_target('install-man',
output: 'install-man',
+ input: man,
command: [
python, install_files, '--prefix', dir_prefix,
- '--install-dirs', dir_man, man],
+ '--install-dirs', dir_man, '@INPUT@'],
build_always_stale: true, build_by_default: false,
)
alias_target('install-doc-man', install_doc_man)
--
2.38.0
v1-0002-docs-Document-with-selinux-Dselinux-options-centr.patchtext/x-diff; charset=us-asciiDownload
From 16109154c197d77b3e5d16144cfd383c74459025 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 10:21:13 -0700
Subject: [PATCH v1 2/5] docs: Document --with-selinux/-Dselinux options
centrally
Previously --with-selinux was documented for autoconf in the sepgsql
documentation and not at all for meson. There are further improvements related
to this that could be made, but this seems like a clear improvement.
Author:
Reviewed-by:
Reported-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
doc/src/sgml/installation.sgml | 21 +++++++++++++++++++++
doc/src/sgml/sepgsql.sgml | 11 ++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 9b25e9fdb1b..e1c03e21414 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -1209,6 +1209,16 @@ build-postgresql:
</listitem>
</varlistentry>
+ <varlistentry id="configure-option-with-sepgsql">
+ <term><option>--with-selinux</option></term>
+ <listitem>
+ <para>
+ Build with selinux support, enabling the <xref linkend="sepgsql"/>
+ extension.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</sect3>
@@ -2640,6 +2650,17 @@ ninja install
</para>
</listitem>
</varlistentry>
+
+ <varlistentry id="configure-with-sepgsql-meson">
+ <term><option>-Dselinux={ disabled | auto | enabled }</option></term>
+ <listitem>
+ <para>
+ Build with selinux support, enabling the <xref linkend="sepgsql"/>
+ extension.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</sect3>
diff --git a/doc/src/sgml/sepgsql.sgml b/doc/src/sgml/sepgsql.sgml
index b368e587cbf..1b848f1977c 100644
--- a/doc/src/sgml/sepgsql.sgml
+++ b/doc/src/sgml/sepgsql.sgml
@@ -87,9 +87,14 @@ Policy from config file: targeted
</para>
<para>
- To build this module, include the option <literal>--with-selinux</literal> in
- your PostgreSQL <literal>configure</literal> command. Be sure that the
- <filename>libselinux-devel</filename> RPM is installed at build time.
+ To build this module specify <xref
+ linkend="configure-option-with-sepgsql"/> (when using <link
+ linkend="install-make">make and autoconf</link> ) or <xref
+ linkend="configure-with-sepgsql-meson"/> (when using <link
+ linkend="install-meson">meson</link>).
+
+ Be sure that the <filename>libselinux-devel</filename> RPM is installed at
+ build time.
</para>
<para>
--
2.38.0
v1-0003-meson-docs-Add-doc-html-man-targets.patchtext/x-diff; charset=us-asciiDownload
From 5a857146354bc8b42259a32ed0432b406de22a25 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 11:59:25 -0700
Subject: [PATCH v1 3/5] meson: docs: Add doc-{html,man} targets
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
---
doc/src/sgml/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 90e2c062fa8..003b57498bb 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -142,6 +142,7 @@ if docs_dep.found()
'--install-dir-contents', dir_doc_html, html],
build_always_stale: true, build_by_default: false,
)
+ alias_target('doc-html', install_doc_html)
alias_target('install-doc-html', install_doc_html)
# build and install multi-page html docs as part of docs target
@@ -231,6 +232,8 @@ if docs_dep.found()
'--install-dirs', dir_man, '@INPUT@'],
build_always_stale: true, build_by_default: false,
)
+
+ alias_target('doc-man', install_doc_html)
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
--
2.38.0
v1-0004-docs-meson-Add-documentation-for-important-build-.patchtext/x-diff; charset=us-asciiDownload
From 68a46f88defd013f7213a56a7325665ce5dd9036 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 14:06:25 -0700
Subject: [PATCH v1 4/5] docs: meson: Add documentation for important build
targets
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
doc/src/sgml/installation.sgml | 224 +++++++++++++++++++++++++++++++++
1 file changed, 224 insertions(+)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index e1c03e21414..6050c38be25 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -3211,6 +3211,230 @@ ninja install
</variablelist>
</sect3>
</sect2>
+
+ <sect2 id="meson-targets">
+ <title><literal>meson</literal> Build Targets</title>
+
+ <para>
+ Individual build targets can be built using <command>ninja</command> <replaceable>target</replaceable>.
+
+ When no target is specified, everything except documentation is
+ built. Individual build products can be built using the path/filename as
+ <replaceable>target</replaceable>.
+ </para>
+
+ <sect3 id="meson-targets-install">
+ <title>Install Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-install">
+ <term><option>install</option></term>
+ <listitem>
+ <para>
+ Install postgres, excluding documentation
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-quiet">
+ <term><option>install-quiet</option></term>
+ <listitem>
+ <para>
+ Like <xref linkend="meson-target-install"/>, but installed
+ files are not displayed
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-world">
+ <term><option>install-install-world</option></term>
+ <listitem>
+ <para>
+ Install postgres, including multi-page HTML and man page
+ documentation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-docs">
+ <term><option>install-docs</option></term>
+ <listitem>
+ <para>
+ Install documentation in multi-page HTML and man page formats. See
+ also <xref linkend="meson-target-install-doc-html"/>, <xref
+ linkend="meson-target-install-doc-man"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-doc-html">
+ <term><option>install-doc-html</option></term>
+ <listitem>
+ <para>
+ Install documentation in multi-page HTML format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-doc-man">
+ <term><option>install-doc-html</option></term>
+ <listitem>
+ <para>
+ Install documentation in man page format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-uninstall">
+ <term><option>uninstall</option></term>
+ <listitem>
+ <para>
+ Remove installed files.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect3>
+
+ <sect3 id="meson-targets-docs">
+ <title>Documentation Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-docs">
+ <term><option>docs</option></term>
+ <term><option>doc-html</option></term>
+ <listitem>
+ <para>
+ Build documentation in multi-page HTML format. Note that
+ <option>docs</option> does <emphasis>not</emphasis> include building
+ man page documentation, as man page generation seldom fails when
+ building HTML documentation succeeds.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-doc-man">
+ <term><option>doc-man</option></term>
+ <listitem>
+ <para>
+ Build documentation in man page format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-html-single-page">
+ <term><option>doc/src/sgml/postgres.html</option></term>
+ <listitem>
+ <para>
+ Build documentation in single-page HTML format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-pdf">
+ <term><option>doc/src/sgml/postgres-A4.pdf</option></term>
+ <term><option>doc/src/sgml/postgres-US.pdf</option></term>
+ <listitem>
+ <para>
+ Build documentation in PDF format, using A4 and U.S. letter format
+ respectively.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-alldocs">
+ <term><option>alldocs</option></term>
+ <listitem>
+ <para>
+ Build documentation in all supported formats. Primarily useful when
+ testing larger documentation changes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect3>
+
+ <sect3 id="meson-targets-code">
+ <title>Code Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-backend">
+ <term><option>backend</option></term>
+ <listitem>
+ <para>
+ Build backend and related modules.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-bin">
+ <term><option>bin</option></term>
+ <listitem>
+ <para>
+ Build frontend binaries
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-contrib">
+ <term><option>contrib</option></term>
+ <listitem>
+ <para>
+ Build contrib modules
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-pl">
+ <term><option>pl</option></term>
+ <listitem>
+ <para>
+ Build procedual languages
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect3>
+
+ <sect3 id="meson-targets-other">
+ <title>Other Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-clean">
+ <term><option>clean</option></term>
+ <listitem>
+ <para>
+ Remove all build products
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-test">
+ <term><option>test</option></term>
+ <listitem>
+ <para>
+ Remove all enabled tests. Support for some classes of tests can be
+ enabled / disabled with <xref linkend="configure-tap-tests-meson"/>
+ and <xref linkend="configure-pg-test-extra-meson"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect3>
+
+ </sect2>
+
</sect1>
<sect1 id="install-post">
--
2.38.0
v1-0005-meson-Add-Dpkglibdir-option.patchtext/x-diff; charset=us-asciiDownload
From 13dbd38c4aea7d4c4f0e2ad9dd72bb021ad1cb2b Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 10:06:00 -0700
Subject: [PATCH v1 5/5] meson: Add -Dpkglibdir option
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
meson.build | 9 ++++++---
meson_options.txt | 3 +++
doc/src/sgml/installation.sgml | 18 +++++++++++++++---
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 2d516c8f372..dbbdb46808f 100644
--- a/meson.build
+++ b/meson.build
@@ -492,9 +492,12 @@ endif
dir_lib = get_option('libdir')
-dir_lib_pkg = dir_lib
-if not (dir_prefix_contains_pg or dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
- dir_lib_pkg = dir_lib_pkg / pkg
+dir_lib_pkg = get_option('pkglibdir')
+if dir_lib_pkg == ''
+ dir_lib_pkg = dir_lib
+ if not (dir_prefix_contains_pg or dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
+ dir_lib_pkg = dir_lib_pkg / pkg
+ endif
endif
dir_pgxs = dir_lib_pkg / 'pgxs'
diff --git a/meson_options.txt b/meson_options.txt
index d2f95cfec36..2da3830d006 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -70,6 +70,9 @@ option('darwin_sysroot', type: 'string', value: '',
option('rpath', type: 'boolean', value: true,
description: 'Embed shared library search path in executables')
+option('pkglibdir', type: 'string', value: '',
+ description: 'Directory to install / load dynamically loadable modules from')
+
# External dependencies
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 6050c38be25..ef4489a6fc5 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2265,9 +2265,21 @@ ninja install
<term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term>
<listitem>
<para>
- Sets the location to install libraries and dynamically loadable
- modules. The default is
- <filename><replaceable>PREFIX</replaceable>/lib</filename>.
+ Sets the location to install libraries. The default is
+ <filename><replaceable>PREFIX</replaceable>/lib</filename>. This
+ option, unless <xref linkend='configure-pkglibdir-meson'/> is
+ specified, also controls where dynamically loadable modules get
+ installed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-pkglibdir-meson">
+ <term><option>-Dpkglibdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the location to dynamically loadable modules. The default is set
+ by <xref linkend='configure-libdir-meson'/>.
</para>
</listitem>
</varlistentry>
--
2.38.0
Re: Andres Freund
The reason for that is simply that the docs take too long to build.
That why I'd prefer to be able to separate arch:all and arch:any
builds, yes.What's stopping you from doing that? I think the only arch:any content we
have is the docs, and those you can build separately? Doc builds do trigger
generation of a handful of files besides the docs, but not more.
Historically, .deb files have been required to contain the manpages
for all executables even when there's a separate -doc package. This
means we'd need a separate (hopefully fast) manpage build even when
the arch:any binaries are built. We might get around that by
introducing a new postgresql-manpages-XX arch:all package, but that
might be too much micropackaging.
The install-doc-man target will likely fix it, will play with it a bit
more, thanks.
I'm working on merging it. Having it for core PG isn't a huge difficulty, the
extension story is what's been holding me back...In-core extensions or external ones?
Both, although the difficulty of doing it is somewhat separate for each.
I'd think most external extensions could stay with pgxs.mk for the
time being.
+ <varlistentry id="configure-with-sepgsql-meson"> + <term><option>-Dselinux={ disabled | auto | enabled }</option></term> + <listitem> + <para> + Build with selinux support, enabling the <xref linkend="sepgsql"/> + extension.
This option defaults to ... auto?
index 90e2c062fa8..003b57498bb 100644 --- a/doc/src/sgml/meson.build +++ b/doc/src/sgml/meson.build @@ -142,6 +142,7 @@ if docs_dep.found() '--install-dir-contents', dir_doc_html, html], build_always_stale: true, build_by_default: false, ) + alias_target('doc-html', install_doc_html) alias_target('install-doc-html', install_doc_html)
Shouldn't this just build the html docs, without installing?
+ alias_target('doc-man', install_doc_html)
alias_target('install-doc-man', install_doc_man)
... same
+ <varlistentry id="meson-target-install-world"> + <term><option>install-install-world</option></term>
install-world
+ <varlistentry id="meson-target-install-doc-man"> + <term><option>install-doc-html</option></term> + <listitem> + <para> + Install documentation in man page format.
install-doc-man
+ <sect3 id="meson-targets-docs"> + <title>Documentation Targets</title>
+ <varlistentry id="meson-target-docs"> + <term><option>docs</option></term> + <term><option>doc-html</option></term> + <listitem> + <para> + Build documentation in multi-page HTML format. Note that + <option>docs</option> does <emphasis>not</emphasis> include building + man page documentation, as man page generation seldom fails when + building HTML documentation succeeds.
Why is that a reason for not building the manpages?
+ <sect3 id="meson-targets-code">
+ <title>Code Targets</title>
I would have expected the sections to be in the order
build-docs-install. Having install first seems weird to me.
+ <sect3 id="meson-targets-other"> + <title>Other Targets</title> + + <variablelist> + + <varlistentry id="meson-target-clean"> + <term><option>clean</option></term> + <listitem> + <para> + Remove all build products + </para> + </listitem> + </varlistentry> + + <varlistentry id="meson-target-test"> + <term><option>test</option></term> + <listitem> + <para> + Remove all enabled tests. Support for some classes of tests can be + enabled / disabled with <xref linkend="configure-tap-tests-meson"/> + and <xref linkend="configure-pg-test-extra-meson"/>.
This should explicitly say if contrib tests are included (or there
needs to be a separate test-world target.)
Subject: [PATCH v1 5/5] meson: Add -Dpkglibdir option
Will give that a try, thanks!
Christoph
On 03.11.23 22:16, Andres Freund wrote:
[selinux option]
Why isn't it "auto" like the others?
I don't really remember why I did that, but it's platform specific, maybe
that's why I did it that way?Isn't that kind the point of autodetecting things? Aren't bonjour and
bsd_auth autodetected as well?I'd be happy to change it, unless somebody objects?
Makes sense to me to change it to auto.
On 03.11.23 19:19, Christoph Berg wrote:
You can control this with the "docs" option for meson, as of recently.
I've been looking into switching the Debian PG 17 build to meson, but
I'm running into several problems.* The docs are still not built by default, and -Ddocs=enabled doesn't
change thatMaybe I am missing something - they aren't built by default in autoconf
either?True, but the documentation (and this thread) reads like it should. Or
at least it should, when I explicitly say -Ddocs=enabled.What would also help is when the tail of the meson output had a list
of features that are enabled. There's the list of "External libraries"
which is quite helpful at figuring out what's still missing, but
perhaps this could be extended:Features
LLVM : YES (/usr/bin/llvm-config-16)
DOCS : YES (html pdf texinfo)Atm it's hidden in the long initial blurb of "Checking for.." and the
"NO" in there don't really stand out as much, since some of them are
normal.
I don't feel like we have fully worked out how the docs options should
fit together.
With the make build system, there is a canonical sequence of
make world
make check-world
make install-world
that encompasses everything.
Now with meson to handle the documentation one needs to remember a
variety of additional targets. (There is a risk that once this gets
more widespread, more people will submit broken documentation.)
I would like to have some set of options that enables it so that the
standard documentation targets become part of "meson compile" and "meson
install".
Hi,
On November 7, 2023 7:55:37 AM PST, Peter Eisentraut <peter@eisentraut.org> wrote:
On 03.11.23 19:19, Christoph Berg wrote:
You can control this with the "docs" option for meson, as of recently.
I've been looking into switching the Debian PG 17 build to meson, but
I'm running into several problems.* The docs are still not built by default, and -Ddocs=enabled doesn't
change thatMaybe I am missing something - they aren't built by default in autoconf
either?True, but the documentation (and this thread) reads like it should. Or
at least it should, when I explicitly say -Ddocs=enabled.What would also help is when the tail of the meson output had a list
of features that are enabled. There's the list of "External libraries"
which is quite helpful at figuring out what's still missing, but
perhaps this could be extended:Features
LLVM : YES (/usr/bin/llvm-config-16)
DOCS : YES (html pdf texinfo)Atm it's hidden in the long initial blurb of "Checking for.." and the
"NO" in there don't really stand out as much, since some of them are
normal.I don't feel like we have fully worked out how the docs options should fit together.
With the make build system, there is a canonical sequence of
make world
make check-world
make install-worldthat encompasses everything.
Now with meson to handle the documentation one needs to remember a variety of additional targets. (There is a risk that once this gets more widespread, more people will submit broken documentation.)
install-world with meson also installs docs.
I would like to have some set of options that enables it so that the standard documentation targets become part of "meson compile" and "meson install".
-0.5 - it's just too painfully slow. For all scripted uses you can just as well use install-world...
Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Andres Freund <andres@anarazel.de> writes:
On November 7, 2023 7:55:37 AM PST, Peter Eisentraut <peter@eisentraut.org> wrote:
I would like to have some set of options that enables it so that the standard documentation targets become part of "meson compile" and "meson install".
-0.5 - it's just too painfully slow. For all scripted uses you can just as well use install-world...
I think we should set up the meson stuff so that "install" and
"install-world" cover exactly what they did with "make". Otherwise
there will be too much confusion.
regards, tom lane
On 2023-Nov-07, Andres Freund wrote:
I would like to have some set of options that enables it so that the
standard documentation targets become part of "meson compile" and
"meson install".-0.5 - it's just too painfully slow. For all scripted uses you can just as well use install-world...
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson. Looking at doc/src/sgml/meson.build, we don't
seem to do that anywhere. Doing the no-output lint run is very fast
(375ms real time in my machine, whereas "make html" takes 27s).
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"¿Cómo puedes confiar en algo que pagas y que no ves,
y no confiar en algo que te dan y te lo muestran?" (Germán Poo)
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson.
+1, but let's do that for the "make" build too. I see that
doc/src/sgml/Makefile has a "check" target, but AFAICS it's not
wired up to the top-level check-world.
regards, tom lane
Hi,
On 2023-11-06 10:45:27 +0100, Christoph Berg wrote:
Re: Andres Freund
The reason for that is simply that the docs take too long to build.
That why I'd prefer to be able to separate arch:all and arch:any
builds, yes.What's stopping you from doing that? I think the only arch:any content we
have is the docs, and those you can build separately? Doc builds do trigger
generation of a handful of files besides the docs, but not more.Historically, .deb files have been required to contain the manpages
for all executables even when there's a separate -doc package. This
means we'd need a separate (hopefully fast) manpage build even when
the arch:any binaries are built.
Manpages are a bit faster to build than html, but not a whole lot. Both are a
lot faster than PDF.
We might get around that by introducing a new postgresql-manpages-XX
arch:all package, but that might be too much micropackaging.
I've not done packaging in, uh, a fair while, but isn't the common solution to
that a -common package? There might be a few more files we could put itno one.
+ <varlistentry id="configure-with-sepgsql-meson"> + <term><option>-Dselinux={ disabled | auto | enabled }</option></term> + <listitem> + <para> + Build with selinux support, enabling the <xref linkend="sepgsql"/> + extension.This option defaults to ... auto?
Not quite sure what you mean? Today it defaults to disabled, a patch changing
that should also change the docs?
index 90e2c062fa8..003b57498bb 100644 --- a/doc/src/sgml/meson.build +++ b/doc/src/sgml/meson.build @@ -142,6 +142,7 @@ if docs_dep.found() '--install-dir-contents', dir_doc_html, html], build_always_stale: true, build_by_default: false, ) + alias_target('doc-html', install_doc_html) alias_target('install-doc-html', install_doc_html)Shouldn't this just build the html docs, without installing?
+ alias_target('doc-man', install_doc_html)
alias_target('install-doc-man', install_doc_man)... same
+ <varlistentry id="meson-target-install-world"> + <term><option>install-install-world</option></term>install-world
+ <varlistentry id="meson-target-install-doc-man"> + <term><option>install-doc-html</option></term> + <listitem> + <para> + Install documentation in man page format.install-doc-man
Oops.
+ <sect3 id="meson-targets-docs"> + <title>Documentation Targets</title>+ <varlistentry id="meson-target-docs"> + <term><option>docs</option></term> + <term><option>doc-html</option></term> + <listitem> + <para> + Build documentation in multi-page HTML format. Note that + <option>docs</option> does <emphasis>not</emphasis> include building + man page documentation, as man page generation seldom fails when + building HTML documentation succeeds.Why is that a reason for not building the manpages?
I didn't have it that way, and Tom argued strongly for maintaining that
behaviour from the make build. Personally I wouldn't.
+ <sect3 id="meson-targets-code">
+ <title>Code Targets</title>I would have expected the sections to be in the order
build-docs-install. Having install first seems weird to me.
Makes sense to me. I just had the install first because I wrote it first
because of our conversation...
+ <sect3 id="meson-targets-other"> + <title>Other Targets</title> + + <variablelist> + + <varlistentry id="meson-target-clean"> + <term><option>clean</option></term> + <listitem> + <para> + Remove all build products + </para> + </listitem> + </varlistentry> + + <varlistentry id="meson-target-test"> + <term><option>test</option></term> + <listitem> + <para> + Remove all enabled tests. Support for some classes of tests can be + enabled / disabled with <xref linkend="configure-tap-tests-meson"/> + and <xref linkend="configure-pg-test-extra-meson"/>.This should explicitly say if contrib tests are included (or there
needs to be a separate test-world target.)
They are included, will state that. And also s/Remove/Run/
Subject: [PATCH v1 5/5] meson: Add -Dpkglibdir option
Will give that a try, thanks!
Thanks for the review!
Greetings,
Andres Freund
Re: Andres Freund
We might get around that by introducing a new postgresql-manpages-XX
arch:all package, but that might be too much micropackaging.I've not done packaging in, uh, a fair while, but isn't the common solution to
that a -common package? There might be a few more files we could put itno one.
True. /usr/share/postgresql/17/ is 4.2MB here, with 1.5MB manpages,
1.1MB /extensions/ and some other bits. Will consider, thanks.
+ <varlistentry id="configure-with-sepgsql-meson"> + <term><option>-Dselinux={ disabled | auto | enabled }</option></term> + <listitem> + <para> + Build with selinux support, enabling the <xref linkend="sepgsql"/> + extension.This option defaults to ... auto?
Not quite sure what you mean? Today it defaults to disabled, a patch changing
that should also change the docs?
What I failed to say is that the other options document what the
default it, this one doesn't yet.
Christoph
On 07.11.23 17:08, Andres Freund wrote:
make world
make check-world
make install-worldthat encompasses everything.
Now with meson to handle the documentation one needs to remember a variety of additional targets. (There is a risk that once this gets more widespread, more people will submit broken documentation.)
install-world with meson also installs docs.
Ok, I didn't know about ninja install-world. That works for me. Maybe
a "world" target would also be good.
I played around with this a bit and noticed some files missing or in the
wrong place. See two attached patches (plus e9f075f9a1 already committed).
Attachments:
0001-meson-Fix-doc-installation-path-computation.patchtext/plain; charset=UTF-8; name=0001-meson-Fix-doc-installation-path-computation.patchDownload
From 543e669f78b65c5ec8a07dcad34c60c6f32439e7 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 8 Nov 2023 12:00:02 +0100
Subject: [PATCH 1/2] meson: Fix doc installation path computation
This applies the logic from 8f6858064b also to the doc installation
directory.
---
meson.build | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 88a9d9051f..6c0faa9490 100644
--- a/meson.build
+++ b/meson.build
@@ -511,7 +511,10 @@ endif
dir_man = get_option('mandir')
# FIXME: These used to be separately configurable - worth adding?
-dir_doc = get_option('datadir') / 'doc' / 'postgresql'
+dir_doc = get_option('datadir') / 'doc'
+if not (dir_prefix_contains_pg or dir_doc.contains('pgsql') or dir_doc.contains('postgres'))
+ dir_doc = dir_doc / pkg
+endif
dir_doc_html = dir_doc / 'html'
dir_locale = get_option('localedir')
--
2.42.0
0002-meson-Install-missing-example-files.patchtext/plain; charset=UTF-8; name=0002-meson-Install-missing-example-files.patchDownload
From e7067f3de85bee6bf3621d5fe902078ba1bcabe6 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 8 Nov 2023 12:00:40 +0100
Subject: [PATCH 2/2] meson: Install missing example files
Install the example files from contrib/spi/, to make makefiles.
---
contrib/meson.build | 5 +++++
contrib/spi/meson.build | 17 +++++++++++++++++
meson.build | 1 +
3 files changed, 23 insertions(+)
diff --git a/contrib/meson.build b/contrib/meson.build
index 84d4e18561..c0b267c632 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -7,6 +7,11 @@ contrib_data_args = {
'install_dir': contrib_data_dir,
}
+contrib_doc_dir = dir_doc_extension
+contrib_doc_args = {
+ 'install_dir': contrib_doc_dir,
+}
+
subdir('adminpack')
subdir('amcheck')
subdir('auth_delay')
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
index a80e2c8ce4..b551eda4a7 100644
--- a/contrib/spi/meson.build
+++ b/contrib/spi/meson.build
@@ -20,6 +20,10 @@ install_data('autoinc.control', 'autoinc--1.0.sql',
kwargs: contrib_data_args,
)
+install_data('autoinc.example',
+ kwargs: contrib_doc_args,
+)
+
insert_username_sources = files(
'insert_username.c',
@@ -43,6 +47,10 @@ install_data(
kwargs: contrib_data_args,
)
+install_data('insert_username.example',
+ kwargs: contrib_doc_args,
+)
+
moddatetime_sources = files(
'moddatetime.c',
@@ -66,6 +74,11 @@ install_data(
kwargs: contrib_data_args,
)
+install_data('moddatetime.example',
+ kwargs: contrib_doc_args,
+)
+
+
# this is needed for the regression tests;
# comment out if you want a quieter refint package for other uses
refint_cflags = ['-DREFINT_VERBOSE']
@@ -90,3 +103,7 @@ contrib_targets += refint
install_data('refint.control', 'refint--1.0.sql',
kwargs: contrib_data_args,
)
+
+install_data('refint.example',
+ kwargs: contrib_doc_args,
+)
diff --git a/meson.build b/meson.build
index 6c0faa9490..47c8fcdc53 100644
--- a/meson.build
+++ b/meson.build
@@ -526,6 +526,7 @@ dir_include_internal = dir_include_pkg / 'internal'
dir_include_server = dir_include_pkg / 'server'
dir_include_extension = dir_include_server / 'extension'
dir_data_extension = dir_data / 'extension'
+dir_doc_extension = dir_doc / 'extension'
--
2.42.0
On 07.11.23 17:40, Alvaro Herrera wrote:
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson. Looking at doc/src/sgml/meson.build, we don't
seem to do that anywhere. Doing the no-output lint run is very fast
(375ms real time in my machine, whereas "make html" takes 27s).
This would be a start, but it wouldn't cover everything. Lately, we
require id attributes on certain elements, which is checked on the XSLT
level.
Re: Peter Eisentraut
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson. Looking at doc/src/sgml/meson.build, we don't
seem to do that anywhere. Doing the no-output lint run is very fast
(375ms real time in my machine, whereas "make html" takes 27s).This would be a start, but it wouldn't cover everything. Lately, we require
id attributes on certain elements, which is checked on the XSLT level.
I'd think there should be a catchy "make check-world"-equivalent that
does run all reasonable check that we can tell people to run by
default. Then if that takes too long, we could still offer
alternatives that exclude some areas. If it's the other way round,
some areas will never be checked widely.
Christoph
On 08.11.23 13:55, Christoph Berg wrote:
Re: Peter Eisentraut
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson. Looking at doc/src/sgml/meson.build, we don't
seem to do that anywhere. Doing the no-output lint run is very fast
(375ms real time in my machine, whereas "make html" takes 27s).This would be a start, but it wouldn't cover everything. Lately, we require
id attributes on certain elements, which is checked on the XSLT level.I'd think there should be a catchy "make check-world"-equivalent that
does run all reasonable check that we can tell people to run by
default. Then if that takes too long, we could still offer
alternatives that exclude some areas. If it's the other way round,
some areas will never be checked widely.
I think we could build doc/src/sgml/postgres-full.xml by default. That
takes less than 0.5 seconds here and it's an intermediate target for
html and man.
On 2023-Nov-08, Peter Eisentraut wrote:
I think we could build doc/src/sgml/postgres-full.xml by default. That
takes less than 0.5 seconds here and it's an intermediate target for html
and man.
If that detects problems like the id attributes you mentioned, apart
from the other checks in the `xmllint --noout`, then that WFM.
At least with the makefile the command to produce postgres-full.xml
includes --valid, so I think we're covered.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Having your biases confirmed independently is how scientific progress is
made, and hence made our great society what it is today" (Mary Gardiner)
Looks good to me. Thanks for finding this.
--
Tristan Partin
Neon (https://neon.tech)
Hi,
On 2023-11-08 12:04:30 +0100, Peter Eisentraut wrote:
Ok, I didn't know about ninja install-world. That works for me. Maybe a
"world" target would also be good.
Yea, I thought so as well. I'll send out a patch shortly. Kinda wondering if
its worth backpatching to 16. Uniformity seems useful and it's low risk.
I played around with this a bit and noticed some files missing or in the
wrong place. See two attached patches (plus e9f075f9a1 already committed).
Make sense.
Greetings,
Andres Freund
Hi,
I really like the idea of an 'help' target that prints the targets. It seemed
annoying to document such targets in both the sgml docs and the input for a
the help target. Particularly due to the redundancies between id attributes,
the target name etc.
First I generated the list of targets from within meson.build, only to later
realize that that would not work when building the docs via make. So I instead
added doc/src/sgml/meson-targets.txt which is lightly postprocessed for the
'help' target, and slightly more processed when building the docs.
That does have some downsides, e.g. it'd be more complicated to only print
targets if a relevant option is enabled. But I think it's acceptable that way.
Example output:
$ ninja help
[0/1 1 0%] Running external command help (wrapped by meson to set env)
Code Targets:
all Build everything other than documentation
backend Build backend and related modules
bin Build frontend binaries
contrib Build contrib modules
pl Build procedual languages
Documentation Targets:
docs Build documentation in multi-page HTML format
doc-html Build documentation in multi-page HTML format
doc-man Build documentation in man page format
doc/src/sgml/postgres-A4.pdf Build documentation in PDF format, with A4 pages
doc/src/sgml/postgres-US.pdf Build documentation in PDF format, with US letter pages
doc/src/sgml/postgres.html Build documentation in single-page HTML format
alldocs Build documentation in all supported formats
Installation Targets:
install Install postgres, excluding documentation
install-doc-html Install documentation in multi-page HTML format
install-doc-man Install documentation in man page format
install-docs Install documentation in multi-page HTML and man page formats
install-quiet Like "install", but installed files are not displayed
install-world Install postgres, including multi-page HTML and man page documentation
uninstall Remove installed files
Other Targets:
clean Remove all build products
test Run all enabled tests (including contrib)
world Build everything, including documentation
help List important targets
Because of the common source, some of the descriptions in the state of this
patch are a bit shorter than in the preceding commit. But I don't think that
hurts much.
Greetings,
Andres Freund
Attachments:
v2-0001-meson-Change-default-of-selinux-feature-option-to.patchtext/x-diff; charset=us-asciiDownload
From 9b0b5cd952880ecebbd157c05698125755bc53ed Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 8 Nov 2023 09:29:38 -0800
Subject: [PATCH v2 1/7] meson: Change default of 'selinux' feature option to
auto
There is really no reason for selinux to behave differently than other
options.
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20231103211601.bgqx3cfq6pz2lmjw@awork3.anarazel.de
Backpatch:
---
meson_options.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson_options.txt b/meson_options.txt
index d2f95cfec36..be1b327f544 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -136,7 +136,7 @@ option('tcl_version', type: 'string', value: 'tcl',
option('readline', type: 'feature', value: 'auto',
description: 'Use GNU Readline or BSD Libedit for editing')
-option('selinux', type: 'feature', value: 'disabled',
+option('selinux', type: 'feature', value: 'auto',
description: 'SELinux support')
option('ssl', type: 'combo', choices: ['auto', 'none', 'openssl'],
--
2.38.0
v2-0002-docs-Document-with-selinux-Dselinux-options-centr.patchtext/x-diff; charset=us-asciiDownload
From a2aa43811296c92a8d4611c996d4aebcf1b88f31 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 10:21:13 -0700
Subject: [PATCH v2 2/7] docs: Document --with-selinux/-Dselinux options
centrally
Previously --with-selinux was documented for autoconf in the sepgsql
documentation and not at all for meson. There are further improvements related
to this that could be made, but this seems like a clear improvement.
Author:
Reviewed-by:
Reported-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
doc/src/sgml/installation.sgml | 21 +++++++++++++++++++++
doc/src/sgml/sepgsql.sgml | 11 ++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index a3dc6eb855f..1bfb27fd38d 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -1198,6 +1198,16 @@ build-postgresql:
</listitem>
</varlistentry>
+ <varlistentry id="configure-option-with-sepgsql">
+ <term><option>--with-selinux</option></term>
+ <listitem>
+ <para>
+ Build with selinux support, enabling the <xref linkend="sepgsql"/>
+ extension.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</sect3>
@@ -2629,6 +2639,17 @@ ninja install
</para>
</listitem>
</varlistentry>
+
+ <varlistentry id="configure-with-sepgsql-meson">
+ <term><option>-Dselinux={ auto | enabled | disabled }</option></term>
+ <listitem>
+ <para>
+ Build with selinux support, enabling the <xref linkend="sepgsql"/>
+ extension. Defaults to auto.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</sect3>
diff --git a/doc/src/sgml/sepgsql.sgml b/doc/src/sgml/sepgsql.sgml
index b368e587cbf..1b848f1977c 100644
--- a/doc/src/sgml/sepgsql.sgml
+++ b/doc/src/sgml/sepgsql.sgml
@@ -87,9 +87,14 @@ Policy from config file: targeted
</para>
<para>
- To build this module, include the option <literal>--with-selinux</literal> in
- your PostgreSQL <literal>configure</literal> command. Be sure that the
- <filename>libselinux-devel</filename> RPM is installed at build time.
+ To build this module specify <xref
+ linkend="configure-option-with-sepgsql"/> (when using <link
+ linkend="install-make">make and autoconf</link> ) or <xref
+ linkend="configure-with-sepgsql-meson"/> (when using <link
+ linkend="install-meson">meson</link>).
+
+ Be sure that the <filename>libselinux-devel</filename> RPM is installed at
+ build time.
</para>
<para>
--
2.38.0
v2-0003-meson-docs-Add-doc-html-man-targets.patchtext/x-diff; charset=us-asciiDownload
From a8dc88cf6247a07b02dbef61e9ae7ef30af50131 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 11:59:25 -0700
Subject: [PATCH v2 3/7] meson: docs: Add doc-{html,man} targets
Reviewed-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
---
doc/src/sgml/meson.build | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 90e2c062fa8..fac7e701610 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -142,6 +142,7 @@ if docs_dep.found()
'--install-dir-contents', dir_doc_html, html],
build_always_stale: true, build_by_default: false,
)
+ alias_target('doc-html', html)
alias_target('install-doc-html', install_doc_html)
# build and install multi-page html docs as part of docs target
@@ -231,6 +232,8 @@ if docs_dep.found()
'--install-dirs', dir_man, '@INPUT@'],
build_always_stale: true, build_by_default: false,
)
+
+ alias_target('doc-man', man)
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
--
2.38.0
v2-0004-meson-Add-world-target.patchtext/x-diff; charset=us-asciiDownload
From 65a248330069d2891ae48912fa2c947217f0c366 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 8 Nov 2023 12:39:05 -0800
Subject: [PATCH v2 4/7] meson: Add 'world' target
Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
---
meson.build | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meson.build b/meson.build
index 88a9d9051fe..5b03e90c3db 100644
--- a/meson.build
+++ b/meson.build
@@ -3326,6 +3326,8 @@ alias_target('bin', bin_targets + [libpq_st])
alias_target('pl', pl_targets)
alias_target('contrib', contrib_targets)
alias_target('testprep', testprep_targets)
+
+alias_target('world', all_built, docs)
alias_target('install-world', install_quiet, installdocs)
--
2.38.0
v2-0005-docs-meson-Add-documentation-for-important-build-.patchtext/x-diff; charset=us-asciiDownload
From e8bea2e38093371fad3af9ba65436696d4d01cca Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 14:06:25 -0700
Subject: [PATCH v2 5/7] docs: meson: Add documentation for important build
targets
Author:
Reviewed-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
doc/src/sgml/installation.sgml | 244 +++++++++++++++++++++++++++++++++
1 file changed, 244 insertions(+)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 1bfb27fd38d..9dde19224a7 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -3200,6 +3200,250 @@ ninja install
</variablelist>
</sect3>
</sect2>
+
+ <sect2 id="meson-targets">
+ <title><literal>meson</literal> Build Targets</title>
+
+ <para>
+ Individual build targets can be built using <command>ninja</command> <replaceable>target</replaceable>.
+
+ When no target is specified, everything except documentation is
+ built. Individual build products can be built using the path/filename as
+ <replaceable>target</replaceable>.
+ </para>
+
+ <sect3 id="meson-targets-code">
+ <title>Code Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-all">
+ <term><option>all</option></term>
+ <listitem>
+ <para>
+ Build everything other than documentation
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-backend">
+ <term><option>backend</option></term>
+ <listitem>
+ <para>
+ Build backend and related modules.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-bin">
+ <term><option>bin</option></term>
+ <listitem>
+ <para>
+ Build frontend binaries.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-contrib">
+ <term><option>contrib</option></term>
+ <listitem>
+ <para>
+ Build contrib modules.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-pl">
+ <term><option>pl</option></term>
+ <listitem>
+ <para>
+ Build procedual languages.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect3>
+
+ <sect3 id="meson-targets-install">
+ <title>Install Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-install">
+ <term><option>install</option></term>
+ <listitem>
+ <para>
+ Install postgres, excluding documentation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-quiet">
+ <term><option>install-quiet</option></term>
+ <listitem>
+ <para>
+ Like <xref linkend="meson-target-install"/>, but installed
+ files are not displayed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-world">
+ <term><option>install-world</option></term>
+ <listitem>
+ <para>
+ Install postgres, including multi-page HTML and man page
+ documentation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-docs">
+ <term><option>install-docs</option></term>
+ <listitem>
+ <para>
+ Install documentation in multi-page HTML and man page formats. See
+ also <xref linkend="meson-target-install-doc-html"/>, <xref
+ linkend="meson-target-install-doc-man"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-doc-html">
+ <term><option>install-doc-html</option></term>
+ <listitem>
+ <para>
+ Install documentation in multi-page HTML format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-install-doc-man">
+ <term><option>install-doc-man</option></term>
+ <listitem>
+ <para>
+ Install documentation in man page format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-uninstall">
+ <term><option>uninstall</option></term>
+ <listitem>
+ <para>
+ Remove installed files.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect3>
+
+ <sect3 id="meson-targets-docs">
+ <title>Documentation Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-docs">
+ <term><option>docs</option></term>
+ <term><option>doc-html</option></term>
+ <listitem>
+ <para>
+ Build documentation in multi-page HTML format. Note that
+ <option>docs</option> does <emphasis>not</emphasis> include building
+ man page documentation, as man page generation seldom fails when
+ building HTML documentation succeeds.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-doc-man">
+ <term><option>doc-man</option></term>
+ <listitem>
+ <para>
+ Build documentation in man page format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-html-single-page">
+ <term><option>doc/src/sgml/postgres.html</option></term>
+ <listitem>
+ <para>
+ Build documentation in single-page HTML format.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-pdf">
+ <term><option>doc/src/sgml/postgres-A4.pdf</option></term>
+ <term><option>doc/src/sgml/postgres-US.pdf</option></term>
+ <listitem>
+ <para>
+ Build documentation in PDF format, using A4 and U.S. letter format
+ respectively.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-alldocs">
+ <term><option>alldocs</option></term>
+ <listitem>
+ <para>
+ Build documentation in all supported formats. Primarily useful when
+ testing larger documentation changes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect3>
+
+ <sect3 id="meson-targets-other">
+ <title>Other Targets</title>
+
+ <variablelist>
+
+ <varlistentry id="meson-target-clean">
+ <term><option>clean</option></term>
+ <listitem>
+ <para>
+ Remove all build products
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="meson-target-test">
+ <term><option>test</option></term>
+ <listitem>
+ <para>
+ Run all enabled tests (including contrib). Support for some classes
+ of tests can be enabled / disabled with <xref
+ linkend="configure-tap-tests-meson"/> and <xref
+ linkend="configure-pg-test-extra-meson"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry id="meson-target-world">
+ <term><option>world</option></term>
+ <listitem>
+ <para>
+ Build everything, including documentation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </sect3>
+
+ </sect2>
+
</sect1>
<sect1 id="install-post">
--
2.38.0
v2-0006-meson-Add-help-target-build-docs-from-a-common-so.patchtext/x-diff; charset=us-asciiDownload
From 619fb4f7b2289bbf2bda9156d866b89451cac70e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 8 Nov 2023 15:03:00 -0800
Subject: [PATCH v2 6/7] meson: Add 'help' target, build docs from a common
source file
Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
---
meson.build | 7 +
doc/src/sgml/Makefile | 3 +
doc/src/sgml/filelist.sgml | 1 +
doc/src/sgml/generate-meson-targets.pl | 63 +++++++
doc/src/sgml/installation.sgml | 231 +------------------------
doc/src/sgml/meson-targets.txt | 38 ++++
doc/src/sgml/meson.build | 9 +
7 files changed, 122 insertions(+), 230 deletions(-)
create mode 100644 doc/src/sgml/generate-meson-targets.pl
create mode 100644 doc/src/sgml/meson-targets.txt
diff --git a/meson.build b/meson.build
index 5b03e90c3db..0f086757e17 100644
--- a/meson.build
+++ b/meson.build
@@ -3330,6 +3330,13 @@ alias_target('testprep', testprep_targets)
alias_target('world', all_built, docs)
alias_target('install-world', install_quiet, installdocs)
+run_target('help',
+ command: [
+ perl, '-ne', 'next if /^#/; print',
+ files('doc/src/sgml/meson-targets.txt'),
+ ]
+)
+
###############################################################
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 49d35dd0d6e..28858f42228 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -110,6 +110,9 @@ keywords-table.sgml: $(top_srcdir)/src/include/parser/kwlist.h $(wildcard $(srcd
wait_event_types.sgml: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
$(PERL) $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --docs $<
+meson-targets.sgml: meson-targets.txt $(srcdir)/generate-meson-targets.pl
+ $(PERL) $(srcdir)/generate-meson-targets.pl $^ > $@
+
##
## Generation of some text files.
##
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 4c63a7e7689..ed89e75b614 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -38,6 +38,7 @@
<!ENTITY high-availability SYSTEM "high-availability.sgml">
<!ENTITY installbin SYSTEM "install-binaries.sgml">
<!ENTITY installation SYSTEM "installation.sgml">
+<!ENTITY meson-targets SYSTEM "meson-targets.sgml">
<!ENTITY installw SYSTEM "install-windows.sgml">
<!ENTITY maintenance SYSTEM "maintenance.sgml">
<!ENTITY manage-ag SYSTEM "manage-ag.sgml">
diff --git a/doc/src/sgml/generate-meson-targets.pl b/doc/src/sgml/generate-meson-targets.pl
new file mode 100644
index 00000000000..65314aee282
--- /dev/null
+++ b/doc/src/sgml/generate-meson-targets.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+#
+# Generate the meson-targets.sgml file from meson-targets.txt
+# Copyright (c) 2000-2023, PostgreSQL Global Development Group
+
+use strict;
+use warnings;
+
+my $meson_targets_file = $ARGV[0];
+open my $meson_targets, '<', $meson_targets_file or die;
+
+print
+ "<!-- autogenerated from doc/src/sgml/meson-targets.txt, do not edit -->\n";
+
+# Find the start of each group of targets
+while (<$meson_targets>)
+{
+ next if /^#/;
+
+ if (/^(.*) Targets:$/)
+ {
+ my $targets = $1;
+ my $targets_id = lc $targets;
+
+ print qq(
+<sect3 id="meson-targets-$targets_id">
+ <title>$targets Targets</title>
+
+ <variablelist>
+);
+
+ # Each target in the group
+ while (<$meson_targets>)
+ {
+ next if /^#/;
+ last if !/^\s+([^ ]+)\s+(.+)/;
+
+ my $target = $1;
+ my $desc = $2;
+ my $target_id = $1;
+
+ $target_id =~ s/\//-/g;
+
+ print qq(
+ <varlistentry id="meson-target-${target_id}">
+ <term><option>${target}</option></term>
+ <listitem>
+ <para>
+ ${desc}
+ </para>
+ </listitem>
+ </varlistentry>
+);
+ }
+
+ print qq(
+ </variablelist>
+</sect3>
+);
+ }
+}
+
+close $meson_targets;
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 9dde19224a7..d7fefa0918c 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -3212,236 +3212,7 @@ ninja install
<replaceable>target</replaceable>.
</para>
- <sect3 id="meson-targets-code">
- <title>Code Targets</title>
-
- <variablelist>
-
- <varlistentry id="meson-target-all">
- <term><option>all</option></term>
- <listitem>
- <para>
- Build everything other than documentation
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-backend">
- <term><option>backend</option></term>
- <listitem>
- <para>
- Build backend and related modules.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-bin">
- <term><option>bin</option></term>
- <listitem>
- <para>
- Build frontend binaries.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-contrib">
- <term><option>contrib</option></term>
- <listitem>
- <para>
- Build contrib modules.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-pl">
- <term><option>pl</option></term>
- <listitem>
- <para>
- Build procedual languages.
- </para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- </sect3>
-
- <sect3 id="meson-targets-install">
- <title>Install Targets</title>
-
- <variablelist>
-
- <varlistentry id="meson-target-install">
- <term><option>install</option></term>
- <listitem>
- <para>
- Install postgres, excluding documentation.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-install-quiet">
- <term><option>install-quiet</option></term>
- <listitem>
- <para>
- Like <xref linkend="meson-target-install"/>, but installed
- files are not displayed.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-install-world">
- <term><option>install-world</option></term>
- <listitem>
- <para>
- Install postgres, including multi-page HTML and man page
- documentation.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-install-docs">
- <term><option>install-docs</option></term>
- <listitem>
- <para>
- Install documentation in multi-page HTML and man page formats. See
- also <xref linkend="meson-target-install-doc-html"/>, <xref
- linkend="meson-target-install-doc-man"/>.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-install-doc-html">
- <term><option>install-doc-html</option></term>
- <listitem>
- <para>
- Install documentation in multi-page HTML format.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-install-doc-man">
- <term><option>install-doc-man</option></term>
- <listitem>
- <para>
- Install documentation in man page format.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-uninstall">
- <term><option>uninstall</option></term>
- <listitem>
- <para>
- Remove installed files.
- </para>
- </listitem>
- </varlistentry>
-
- </variablelist>
- </sect3>
-
- <sect3 id="meson-targets-docs">
- <title>Documentation Targets</title>
-
- <variablelist>
-
- <varlistentry id="meson-target-docs">
- <term><option>docs</option></term>
- <term><option>doc-html</option></term>
- <listitem>
- <para>
- Build documentation in multi-page HTML format. Note that
- <option>docs</option> does <emphasis>not</emphasis> include building
- man page documentation, as man page generation seldom fails when
- building HTML documentation succeeds.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-doc-man">
- <term><option>doc-man</option></term>
- <listitem>
- <para>
- Build documentation in man page format.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-html-single-page">
- <term><option>doc/src/sgml/postgres.html</option></term>
- <listitem>
- <para>
- Build documentation in single-page HTML format.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-pdf">
- <term><option>doc/src/sgml/postgres-A4.pdf</option></term>
- <term><option>doc/src/sgml/postgres-US.pdf</option></term>
- <listitem>
- <para>
- Build documentation in PDF format, using A4 and U.S. letter format
- respectively.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-alldocs">
- <term><option>alldocs</option></term>
- <listitem>
- <para>
- Build documentation in all supported formats. Primarily useful when
- testing larger documentation changes.
- </para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- </sect3>
-
- <sect3 id="meson-targets-other">
- <title>Other Targets</title>
-
- <variablelist>
-
- <varlistentry id="meson-target-clean">
- <term><option>clean</option></term>
- <listitem>
- <para>
- Remove all build products
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="meson-target-test">
- <term><option>test</option></term>
- <listitem>
- <para>
- Run all enabled tests (including contrib). Support for some classes
- of tests can be enabled / disabled with <xref
- linkend="configure-tap-tests-meson"/> and <xref
- linkend="configure-pg-test-extra-meson"/>.
- </para>
- </listitem>
- </varlistentry>
-
-
- <varlistentry id="meson-target-world">
- <term><option>world</option></term>
- <listitem>
- <para>
- Build everything, including documentation.
- </para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- </sect3>
-
+ &meson-targets;
</sect2>
</sect1>
diff --git a/doc/src/sgml/meson-targets.txt b/doc/src/sgml/meson-targets.txt
new file mode 100644
index 00000000000..690e4ebc814
--- /dev/null
+++ b/doc/src/sgml/meson-targets.txt
@@ -0,0 +1,38 @@
+# Copyright (c) 2023, PostgreSQL Global Development Group
+#
+# Description of important meson targets, used for the 'help' target and
+# installation.sgml (via generate-meson-targets.pl). Right now the parsers are
+# extremely simple. Both parsers ignore comments. The help target prints
+# everything else. For xml everything without a leading newline is a group,
+# remaining lines are target separated by whitespace from their description
+#
+Code Targets:
+ all Build everything other than documentation
+ backend Build backend and related modules
+ bin Build frontend binaries
+ contrib Build contrib modules
+ pl Build procedual languages
+
+Documentation Targets:
+ docs Build documentation in multi-page HTML format
+ doc-html Build documentation in multi-page HTML format
+ doc-man Build documentation in man page format
+ doc/src/sgml/postgres-A4.pdf Build documentation in PDF format, with A4 pages
+ doc/src/sgml/postgres-US.pdf Build documentation in PDF format, with US letter pages
+ doc/src/sgml/postgres.html Build documentation in single-page HTML format
+ alldocs Build documentation in all supported formats
+
+Installation Targets:
+ install Install postgres, excluding documentation
+ install-doc-html Install documentation in multi-page HTML format
+ install-doc-man Install documentation in man page format
+ install-docs Install documentation in multi-page HTML and man page formats
+ install-quiet Like "install", but installed files are not displayed
+ install-world Install postgres, including multi-page HTML and man page documentation
+ uninstall Remove installed files
+
+Other Targets:
+ clean Remove all build products
+ test Run all enabled tests (including contrib)
+ world Build everything, including documentation
+ help List important targets
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index fac7e701610..2dca38ccf7b 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -71,6 +71,15 @@ doc_generated += custom_target('keywords-table.sgml',
capture: true,
)
+doc_generated += custom_target('meson-targets.sgml',
+ input: files('meson-targets.txt'),
+ output: 'meson-targets.sgml',
+ command: [perl, files('generate-meson-targets.pl'), '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
# For everything else we need at least xmllint
if not xmllint_bin.found()
subdir_done()
--
2.38.0
v2-0007-meson-Add-Dpkglibdir-option.patchtext/x-diff; charset=us-asciiDownload
From d3dc1f361e73f7e2ee4732cc82eb5279596b548d Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 10:06:00 -0700
Subject: [PATCH v2 7/7] meson: Add -Dpkglibdir option
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
meson.build | 9 ++++++---
meson_options.txt | 3 +++
doc/src/sgml/installation.sgml | 18 +++++++++++++++---
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index 0f086757e17..9f38433285b 100644
--- a/meson.build
+++ b/meson.build
@@ -492,9 +492,12 @@ endif
dir_lib = get_option('libdir')
-dir_lib_pkg = dir_lib
-if not (dir_prefix_contains_pg or dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
- dir_lib_pkg = dir_lib_pkg / pkg
+dir_lib_pkg = get_option('pkglibdir')
+if dir_lib_pkg == ''
+ dir_lib_pkg = dir_lib
+ if not (dir_prefix_contains_pg or dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
+ dir_lib_pkg = dir_lib_pkg / pkg
+ endif
endif
dir_pgxs = dir_lib_pkg / 'pgxs'
diff --git a/meson_options.txt b/meson_options.txt
index be1b327f544..82441b4d524 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -70,6 +70,9 @@ option('darwin_sysroot', type: 'string', value: '',
option('rpath', type: 'boolean', value: true,
description: 'Embed shared library search path in executables')
+option('pkglibdir', type: 'string', value: '',
+ description: 'Directory to install / load dynamically loadable modules from')
+
# External dependencies
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index d7fefa0918c..8345bb68e92 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2254,9 +2254,21 @@ ninja install
<term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term>
<listitem>
<para>
- Sets the location to install libraries and dynamically loadable
- modules. The default is
- <filename><replaceable>PREFIX</replaceable>/lib</filename>.
+ Sets the location to install libraries. The default is
+ <filename><replaceable>PREFIX</replaceable>/lib</filename>. This
+ option, unless <xref linkend='configure-pkglibdir-meson'/> is
+ specified, also controls where dynamically loadable modules get
+ installed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-pkglibdir-meson">
+ <term><option>-Dpkglibdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the location to dynamically loadable modules. The default is set
+ by <xref linkend='configure-libdir-meson'/>.
</para>
</listitem>
</varlistentry>
--
2.38.0
Hi,
On 2023-11-08 13:55:02 +0100, Christoph Berg wrote:
Re: Peter Eisentraut
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson. Looking at doc/src/sgml/meson.build, we don't
seem to do that anywhere. Doing the no-output lint run is very fast
(375ms real time in my machine, whereas "make html" takes 27s).This would be a start, but it wouldn't cover everything. Lately, we require
id attributes on certain elements, which is checked on the XSLT level.I'd think there should be a catchy "make check-world"-equivalent that
does run all reasonable check that we can tell people to run by
default. Then if that takes too long, we could still offer
alternatives that exclude some areas. If it's the other way round,
some areas will never be checked widely.
The 'test' target (generated by meson, otherwise I'd have named it check),
runs all enabled tests. You obviously can run a subset if you so desire.
Greetings,
Andres Freund
Hi,
On 2023-11-08 16:19:51 +0100, Peter Eisentraut wrote:
On 08.11.23 13:55, Christoph Berg wrote:
Re: Peter Eisentraut
If the problem is broken doc patches, then maybe a solution is to
include the `xmllint --noout --valid` target in whatever the check-world
equivalent is for meson. Looking at doc/src/sgml/meson.build, we don't
seem to do that anywhere. Doing the no-output lint run is very fast
(375ms real time in my machine, whereas "make html" takes 27s).This would be a start, but it wouldn't cover everything. Lately, we require
id attributes on certain elements, which is checked on the XSLT level.I'd think there should be a catchy "make check-world"-equivalent that
does run all reasonable check that we can tell people to run by
default. Then if that takes too long, we could still offer
alternatives that exclude some areas. If it's the other way round,
some areas will never be checked widely.I think we could build doc/src/sgml/postgres-full.xml by default. That
takes less than 0.5 seconds here and it's an intermediate target for html
and man.
That does require the docbook dtd to be installed, afaict. I think we would
need a configure test for that to be present if we want to build it by
default, otherwise we'll cause errors on plenty systems that don't get them
today. The docbook dts aren't a huge dependency, but still. Some OSs might
not have a particularly install source for them, e.g. windows.
I don't think that'd detect the missing ids?
Greetings,
Andres Freund
On 09.11.23 01:59, Andres Freund wrote:
I think we could build doc/src/sgml/postgres-full.xml by default. That
takes less than 0.5 seconds here and it's an intermediate target for html
and man.That does require the docbook dtd to be installed, afaict. I think we would
need a configure test for that to be present if we want to build it by
default, otherwise we'll cause errors on plenty systems that don't get them
today. The docbook dts aren't a huge dependency, but still. Some OSs might
not have a particularly install source for them, e.g. windows.
I was thinking we would do it only if the required tools are found.
Basically like
postgres_full_xml = custom_target('postgres-full.xml',
input: 'postgres.sgml',
output: 'postgres-full.xml',
depfile: 'postgres-full.xml.d',
command: [xmllint, '--nonet', '--noent', '--valid',
'--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
depends: doc_generated,
- build_by_default: false,
+ build_by_default: xmllint_bin.found(),
)
Besides giving you a quick validity check of the XML, this also builds
the doc_generated, which draw from non-doc source files, so this would
also serve to check that those are sound and didn't mess up the docs.
I don't think that'd detect the missing ids?
Right, it wouldn't do that.
On 09.11.23 00:21, Andres Freund wrote:
Example output:
This is very nice!
$ ninja help
[0/1 1 0%] Running external command help (wrapped by meson to set env)
Code Targets:
all Build everything other than documentation
backend Build backend and related modules
bin Build frontend binaries
contrib Build contrib modules
pl Build procedual languages
ok
Documentation Targets:
docs Build documentation in multi-page HTML format
doc-html Build documentation in multi-page HTML format
doc-man Build documentation in man page format
doc/src/sgml/postgres-A4.pdf Build documentation in PDF format, with A4 pages
doc/src/sgml/postgres-US.pdf Build documentation in PDF format, with US letter pages
doc/src/sgml/postgres.html Build documentation in single-page HTML format
alldocs Build documentation in all supported formatsInstallation Targets:
install Install postgres, excluding documentation
This should probably read "Install everything other than documentation",
to mirror "all" above. (Otherwise one might think it installs just the
backend.)
install-doc-html Install documentation in multi-page HTML format
install-doc-man Install documentation in man page format
install-docs Install documentation in multi-page HTML and man page formats
There is a mismatch between "docs" and "install-docs". (As was
previously discussed, I'm in the camp that "docs" should be html + man.)
install-quiet Like "install", but installed files are not displayed
install-world Install postgres, including multi-page HTML and man page documentation
Suggest "Install everything, including documentation" (matches "world").
uninstall Remove installed files
Other Targets:
clean Remove all build products
test Run all enabled tests (including contrib)
world Build everything, including documentation
Shouldn't that be under "Code Targets"?
Show quoted text
help List important targets
Hi,
On 2023-11-09 15:32:39 +0100, Peter Eisentraut wrote:
On 09.11.23 01:59, Andres Freund wrote:
I think we could build doc/src/sgml/postgres-full.xml by default. That
takes less than 0.5 seconds here and it's an intermediate target for html
and man.That does require the docbook dtd to be installed, afaict. I think we would
need a configure test for that to be present if we want to build it by
default, otherwise we'll cause errors on plenty systems that don't get them
today. The docbook dts aren't a huge dependency, but still. Some OSs might
not have a particularly install source for them, e.g. windows.I was thinking we would do it only if the required tools are found.
Basically likepostgres_full_xml = custom_target('postgres-full.xml', input: 'postgres.sgml', output: 'postgres-full.xml', depfile: 'postgres-full.xml.d', command: [xmllint, '--nonet', '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'], depends: doc_generated, - build_by_default: false, + build_by_default: xmllint_bin.found(), )
We don't get to that point if xmllint isn't found...
Besides giving you a quick validity check of the XML, this also builds the
doc_generated, which draw from non-doc source files, so this would also
serve to check that those are sound and didn't mess up the docs.
Unfortunately presence of xmllint doesn't guarantee presence of the relevant
DTDs. Without docbook-xml installed, you'll get something like
../../../../../home/andres/src/postgresql/doc/src/sgml/postgres.sgml:21: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
]>
^
and a bunch of other subsequent errors.
I think if we want to do this, we'd need a configure time check for being able
to validate a document with
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"...
That's certainly doable. If we go there, we imo also should check if the
relevant xslt stylesheets are installed.
Greetings,
Andres Freund
On 09.11.23 18:52, Andres Freund wrote:
Besides giving you a quick validity check of the XML, this also builds the
doc_generated, which draw from non-doc source files, so this would also
serve to check that those are sound and didn't mess up the docs.Unfortunately presence of xmllint doesn't guarantee presence of the relevant
DTDs. Without docbook-xml installed, you'll get something like../../../../../home/andres/src/postgresql/doc/src/sgml/postgres.sgml:21: warning: failed to load external entity"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
]>
^and a bunch of other subsequent errors.
I think if we want to do this, we'd need a configure time check for being able
to validate a document with
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN""http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"...
We used to have exactly such a check in configure, but it was removed in
4823c4f6ac. I suppose we could look into reviving that.
Some comments on your patches:
v2-0001-meson-Change-default-of-selinux-feature-option-to.patch
Ok
v2-0002-docs-Document-with-selinux-Dselinux-options-centr.patch
Ok, but "selinux" should be "SELinux" when referring to the product.
v2-0003-meson-docs-Add-doc-html-man-targets.patch
We have make targets "html" and "man", so I suggest we make the meson
targets the same.
v2-0004-meson-Add-world-target.patch
AFAICT, this world target doesn't include the man target. (Again, this
would all work better if we added "man" to "docs".)
v2-0005-docs-meson-Add-documentation-for-important-build-.patch
It's nice to document this, but it's weird that we only document the
meson targets, not the make targets.
v2-0006-meson-Add-help-target-build-docs-from-a-common-so.patch
Here also, making this consistent and uniform with make would be useful.
v2-0007-meson-Add-Dpkglibdir-option.patch
Normally, the pkgFOOdir variables are just FOOdir plus package name. I
don't feel comfortable allowing those to be separately set. We don't
allow that with configure; this just arose from a Debian patch.
The description "location to dynamically loadable modules" is too
narrow. Consider for example, another proposed patch, where we are
doing some preprocessing on postgres.bki at build time. Since that
makes postgres.bki platform dependent, it should really be moved from
share (datadir in configure parlance) to pkglibdir. So then we have
things in there that are not loadable modules. I don't know how that
affects Debian packaging, but this patch might not be the right one.
I suggest we leave this patch for a separate discussion.
Hi,
On 2023-11-14 21:16:13 +0100, Peter Eisentraut wrote:
Some comments on your patches:
v2-0001-meson-Change-default-of-selinux-feature-option-to.patch
Ok
v2-0002-docs-Document-with-selinux-Dselinux-options-centr.patch
Ok, but "selinux" should be "SELinux" when referring to the product.
Will apply with that fix.
v2-0003-meson-docs-Add-doc-html-man-targets.patch
We have make targets "html" and "man", so I suggest we make the meson
targets the same.
Hm, ok.
v2-0004-meson-Add-world-target.patch
AFAICT, this world target doesn't include the man target. (Again, this
would all work better if we added "man" to "docs".)
I agree with that sentiment - I only moved to the current arrangement after
Tom argued forcefully against building both.
The situation in the make world is weird:
"make docs" in the toplevel builds both, because it's defined as
docs:
$(MAKE) -C doc all
Buf if you "make -C doc/src/sgml" (or are in doc/src/sgml), we only build
html, as the default target is explicitly just html:
# Make "html" the default target, since that is what most people tend
# to want to use.
html:
There's no real way of making the recursive-make and non-recursive ninja
coherent. There's no equivalent to default target in a sudirectory with ninja
(or non-recursive make).
v2-0005-docs-meson-Add-documentation-for-important-build-.patch
It's nice to document this, but it's weird that we only document the meson
targets, not the make targets.
I think it'd have been good if we had documented the important targets with
make. But I don't think documenting them as a prerequisite to documenting the
meson targets makes much sense.
v2-0006-meson-Add-help-target-build-docs-from-a-common-so.patch
Here also, making this consistent and uniform with make would be useful.
What precisely are you referring to here? Also adding a help target? Or just
consistency between what the "docs" target does?
v2-0007-meson-Add-Dpkglibdir-option.patch
Normally, the pkgFOOdir variables are just FOOdir plus package name. I
don't feel comfortable allowing those to be separately set. We don't allow
that with configure; this just arose from a Debian patch.
Right - but Debian's desire seems quite sensible. The need to have multiple
postgres versions installed in parallel is quite widespread.
The description "location to dynamically loadable modules" is too narrow.
Consider for example, another proposed patch, where we are doing some
preprocessing on postgres.bki at build time. Since that makes postgres.bki
platform dependent, it should really be moved from share (datadir in
configure parlance) to pkglibdir.
I think I cannot be faulted for documenting the current use of the directory
:).
Separately, I'm not really convinced that moving some build time values into
postgres.bki is useful, but that's a matter for a different thread.
So then we have things in there that are not loadable modules. I don't know
how that affects Debian packaging, but this patch might not be the right
one.
I'm not really seeing why that'd affect pkglibdir being adjustable, besides
needing to tweak the description of pkglibdir?
I suggest we leave this patch for a separate discussion.
Fair enough.
Thanks for the review,
Andres Freund
Hi,
On 2023-11-14 11:58:53 +0100, Peter Eisentraut wrote:
On 09.11.23 18:52, Andres Freund wrote:
I think if we want to do this, we'd need a configure time check for being able
to validate a document with
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN""http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"...We used to have exactly such a check in configure, but it was removed in
4823c4f6ac. I suppose we could look into reviving that.
Yea, that change was obsoleted by xmllint/xsltproc not being able to fetch the
dtd over network anymore... And the performance issue 4823c4f6ac notes also
doesn't apply anymore, as we use -nonet since 969509c3f2e.
Greetings,
Andres Freund
Hi,
On 2023-11-14 16:22:31 -0800, Andres Freund wrote:
v2-0004-meson-Add-world-target.patch
AFAICT, this world target doesn't include the man target. (Again, this
would all work better if we added "man" to "docs".)I agree with that sentiment - I only moved to the current arrangement after
Tom argued forcefully against building both.
Another message in this thread made me realize that I actually hadn't
implemented it at all - it was Tom in 969509c3f2e
In HEAD, also document how to build docs using Meson, and adjust
"ninja docs" to just build the HTML docs, for consistency with the
default behavior of doc/src/sgml/Makefile.
I think that change was just ill-advised, given that the top-level make target
actually *does* build both html and man:
The situation in the make world is weird:
"make docs" in the toplevel builds both, because it's defined asdocs:
$(MAKE) -C doc all
Notwithstanding this:
Buf if you "make -C doc/src/sgml" (or are in doc/src/sgml), we only build
html, as the default target is explicitly just html:
As the obvious thing for people that really just want to build html with ninja
would be to just use the doc-html (to-be-renamed to "html") target.
Greetings,
Andres Freund
Hi,
On 2023-11-14 16:30:24 -0800, Andres Freund wrote:
On 2023-11-14 16:22:31 -0800, Andres Freund wrote:
v2-0004-meson-Add-world-target.patch
AFAICT, this world target doesn't include the man target. (Again, this
would all work better if we added "man" to "docs".)I agree with that sentiment - I only moved to the current arrangement after
Tom argued forcefully against building both.Another message in this thread made me realize that I actually hadn't
implemented it at all - it was Tom in 969509c3f2eIn HEAD, also document how to build docs using Meson, and adjust
"ninja docs" to just build the HTML docs, for consistency with the
default behavior of doc/src/sgml/Makefile.I think that change was just ill-advised, given that the top-level make target
actually *does* build both html and man:The situation in the make world is weird:
"make docs" in the toplevel builds both, because it's defined asdocs:
$(MAKE) -C doc allNotwithstanding this:
Buf if you "make -C doc/src/sgml" (or are in doc/src/sgml), we only build
html, as the default target is explicitly just html:As the obvious thing for people that really just want to build html with ninja
would be to just use the doc-html (to-be-renamed to "html") target.
I pushed the first two commits (the selinux stuff) and worked a bit more on
the subsequent ones.
- As requested, I've renamed the 'doc-html' and 'doc-man' targets to just 'html'
and 'man'. Which then seems to also necessitates renaming the existing
install-doc-{html,man}. I'm not so sure about this change, likely because I
use autocomplete to remember the spelling of ninja (or make) targets, which
is easier with [install-]doc-{html,man} than with [install-]{html,man}.
- I added a commit to change what 'docs' builds, undoing that part of
969509c3f2e. I also moved the 'all' target in doc/src/sgml/Makefile up to
the 'html' target to make things less confusing there, as discussed in the
thread referenced in the commit message.
Because of the 'html' target, Tom can still just build html easily.
- I renamed 'meson-targets.txt' to 'targets-meson.txt' and renamed other files
to match. One reason is that meson tries to prevent conflict between its
internal targets by prefixing them with 'meson-', and the old names
conflicted with that rule. If we ever wanted to add something similar for
make, the new naming also seems better.
- I added documentation for some developer targets (reformat-dat-files,
expand-dat-files, update-unicode)
I didn't move 'world' in the docs, as it doesn't quite seem right in the "code
targets" section?
I attached the pkglibdir thing again, even though I don't plan to push it or
really review it further. Thought it might still be interesting for Christoph.
Greetings,
Andres Freund
Attachments:
v3-0001-meson-docs-Add-html-man-targets-rename-install-do.patchtext/x-diff; charset=us-asciiDownload
From 52a94efbcac0520716c792a33f0216e22584c72a Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 15 Nov 2023 18:53:03 -0800
Subject: [PATCH v3 1/5] meson: docs: Add {html,man} targets, rename
install-doc-*
We have toplevel html, man targets in the autoconf build as well. It'd be odd
to have an 'html' target but have the install target be 'install-doc-html',
thus rename the install targets to match.
Reviewed-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
---
doc/src/sgml/meson.build | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index 90e2c062fa8..e5a38e060c7 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -142,7 +142,8 @@ if docs_dep.found()
'--install-dir-contents', dir_doc_html, html],
build_always_stale: true, build_by_default: false,
)
- alias_target('install-doc-html', install_doc_html)
+ alias_target('html', html)
+ alias_target('install-html', install_doc_html)
# build and install multi-page html docs as part of docs target
docs += html
@@ -231,7 +232,8 @@ if docs_dep.found()
'--install-dirs', dir_man, '@INPUT@'],
build_always_stale: true, build_by_default: false,
)
- alias_target('install-doc-man', install_doc_man)
+ alias_target('man', man)
+ alias_target('install-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
--
2.38.0
v3-0002-docs-Change-what-docs-meson-target-builds.patchtext/x-diff; charset=us-asciiDownload
From 69b85a8224aaa52aa5896fbfa6952ae18c184219 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 17 Nov 2023 10:29:19 -0800
Subject: [PATCH v3 2/5] docs: Change what 'docs' meson target builds
This undoes the change in what the 'docs' target builds 969509c3f2e. Tom was
concerned with having a target to just build the html docs, which a prior
commit now provided explicitly.
A subsequent commit will overhaul the documentation for the documentation
targets.
While at it, move all target in doc/src/sgml/Makefile up to just after the
default "html" target, and add a comment explaining "all" is *not* the default
target.
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20230209203855.njrepiupc3rmehfw@awork3.anarazel.de
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
doc/src/sgml/Makefile | 4 ++--
doc/src/sgml/docguide.sgml | 2 +-
doc/src/sgml/meson.build | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 49d35dd0d6e..53100828a64 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -15,6 +15,8 @@
# Make "html" the default target, since that is what most people tend
# to want to use.
html:
+# Note that all is *not* the default target in this directory
+all: html man
# We don't need the tree-wide headers or install support here.
NO_GENERATED_HEADERS=yes
@@ -25,8 +27,6 @@ top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
-all: html man
-
ifndef DBTOEPUB
DBTOEPUB = $(missing) dbtoepub
diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml
index fd72b3975ad..b319621fdb8 100644
--- a/doc/src/sgml/docguide.sgml
+++ b/doc/src/sgml/docguide.sgml
@@ -442,7 +442,7 @@ LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=WARN
<para>
To build just the <acronym>HTML</acronym> version of the documentation:
<screen>
-<prompt>build$ </prompt><userinput>ninja docs</userinput>
+<prompt>build$ </prompt><userinput>ninja html</userinput>
</screen>
To build all forms of the documentation:
<screen>
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index e5a38e060c7..dfdb1d0daa7 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -235,9 +235,9 @@ if docs_dep.found()
alias_target('man', man)
alias_target('install-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
+ # built and installed as part of the the docs target
installdocs += install_doc_man
+ docs += man
endif
--
2.38.0
v3-0003-meson-Add-world-target.patchtext/x-diff; charset=us-asciiDownload
From 40f0eae1be25aec792638cfe48145c79de8bb8de Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 17 Nov 2023 10:29:32 -0800
Subject: [PATCH v3 3/5] meson: Add 'world' target
We have this for make as well.
Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
---
meson.build | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meson.build b/meson.build
index 286d7e42698..588788aad4d 100644
--- a/meson.build
+++ b/meson.build
@@ -3331,6 +3331,8 @@ alias_target('bin', bin_targets + [libpq_st])
alias_target('pl', pl_targets)
alias_target('contrib', contrib_targets)
alias_target('testprep', testprep_targets)
+
+alias_target('world', all_built, docs)
alias_target('install-world', install_quiet, installdocs)
--
2.38.0
v3-0004-meson-Document-build-targets-add-help-target.patchtext/x-diff; charset=us-asciiDownload
From 70c2253d1967ab4ffca9d0b241b111515e072118 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 14:06:25 -0700
Subject: [PATCH v3 4/5] meson: Document build targets, add 'help' target
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20231108232121.ww542mt6lfo6f26f@awork3.anarazel.de
Backpatch:
---
meson.build | 7 +++
doc/src/sgml/Makefile | 5 +-
doc/src/sgml/docguide.sgml | 13 +++---
doc/src/sgml/filelist.sgml | 1 +
doc/src/sgml/generate-targets-meson.pl | 63 ++++++++++++++++++++++++++
doc/src/sgml/installation.sgml | 15 ++++++
doc/src/sgml/meson.build | 9 ++++
doc/src/sgml/targets-meson.txt | 43 ++++++++++++++++++
8 files changed, 148 insertions(+), 8 deletions(-)
create mode 100644 doc/src/sgml/generate-targets-meson.pl
create mode 100644 doc/src/sgml/targets-meson.txt
diff --git a/meson.build b/meson.build
index 588788aad4d..ee58ee7a065 100644
--- a/meson.build
+++ b/meson.build
@@ -3335,6 +3335,13 @@ alias_target('testprep', testprep_targets)
alias_target('world', all_built, docs)
alias_target('install-world', install_quiet, installdocs)
+run_target('help',
+ command: [
+ perl, '-ne', 'next if /^#/; print',
+ files('doc/src/sgml/targets-meson.txt'),
+ ]
+)
+
###############################################################
diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile
index 53100828a64..2ef818900fd 100644
--- a/doc/src/sgml/Makefile
+++ b/doc/src/sgml/Makefile
@@ -55,7 +55,7 @@ override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
GENERATED_SGML = version.sgml \
features-supported.sgml features-unsupported.sgml errcodes-table.sgml \
- keywords-table.sgml wait_event_types.sgml
+ keywords-table.sgml targets-meson.sgml wait_event_types.sgml
ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
@@ -110,6 +110,9 @@ keywords-table.sgml: $(top_srcdir)/src/include/parser/kwlist.h $(wildcard $(srcd
wait_event_types.sgml: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
$(PERL) $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --docs $<
+targets-meson.sgml: targets-meson.txt $(srcdir)/generate-targets-meson.pl
+ $(PERL) $(srcdir)/generate-targets-meson.pl $^ > $@
+
##
## Generation of some text files.
##
diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml
index b319621fdb8..c129215dd3c 100644
--- a/doc/src/sgml/docguide.sgml
+++ b/doc/src/sgml/docguide.sgml
@@ -434,9 +434,9 @@ LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=WARN
<title>Building the Documentation with Meson</title>
<para>
- Two options are provided for building the documentation using Meson.
- Change to the <filename>build</filename> directory before running
- one of these commands, or add <option>-C build</option> to the command.
+ To build the documentation using Meson, change to the
+ <filename>build</filename> directory before running one of these commands,
+ or add <option>-C build</option> to the command.
</para>
<para>
@@ -444,10 +444,9 @@ LOGLEVEL=-Dorg.apache.commons.logging.simplelog.defaultlog=WARN
<screen>
<prompt>build$ </prompt><userinput>ninja html</userinput>
</screen>
- To build all forms of the documentation:
-<screen>
-<prompt>build$ </prompt><userinput>ninja alldocs</userinput>
-</screen>
+ For a list of other documentation targets see
+ <xref linkend="targets-meson-documentation"/>.
+
The output appears in the
subdirectory <filename>build/doc/src/sgml</filename>.
</para>
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 4c63a7e7689..bd42b3ef16b 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -38,6 +38,7 @@
<!ENTITY high-availability SYSTEM "high-availability.sgml">
<!ENTITY installbin SYSTEM "install-binaries.sgml">
<!ENTITY installation SYSTEM "installation.sgml">
+<!ENTITY targets-meson SYSTEM "targets-meson.sgml">
<!ENTITY installw SYSTEM "install-windows.sgml">
<!ENTITY maintenance SYSTEM "maintenance.sgml">
<!ENTITY manage-ag SYSTEM "manage-ag.sgml">
diff --git a/doc/src/sgml/generate-targets-meson.pl b/doc/src/sgml/generate-targets-meson.pl
new file mode 100644
index 00000000000..56a94d6ead9
--- /dev/null
+++ b/doc/src/sgml/generate-targets-meson.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+#
+# Generate the targets-meson.sgml file from targets-meson.txt
+# Copyright (c) 2000-2023, PostgreSQL Global Development Group
+
+use strict;
+use warnings;
+
+my $targets_meson_file = $ARGV[0];
+open my $targets_meson, '<', $targets_meson_file or die;
+
+print
+ "<!-- autogenerated from doc/src/sgml/targets-meson.txt, do not edit -->\n";
+
+# Find the start of each group of targets
+while (<$targets_meson>)
+{
+ next if /^#/;
+
+ if (/^(.*) Targets:$/)
+ {
+ my $targets = $1;
+ my $targets_id = lc $targets;
+
+ print qq(
+<sect3 id="targets-meson-$targets_id">
+ <title>$targets Targets</title>
+
+ <variablelist>
+);
+
+ # Each target in the group
+ while (<$targets_meson>)
+ {
+ next if /^#/;
+ last if !/^\s+([^ ]+)\s+(.+)/;
+
+ my $target = $1;
+ my $desc = $2;
+ my $target_id = $1;
+
+ $target_id =~ s/\//-/g;
+
+ print qq(
+ <varlistentry id="meson-target-${target_id}">
+ <term><option>${target}</option></term>
+ <listitem>
+ <para>
+ ${desc}
+ </para>
+ </listitem>
+ </varlistentry>
+);
+ }
+
+ print qq(
+ </variablelist>
+</sect3>
+);
+ }
+}
+
+close $targets_meson;
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 8e926a3a8cb..b23b35cd8e7 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -3200,6 +3200,21 @@ ninja install
</variablelist>
</sect3>
</sect2>
+
+ <sect2 id="targets-meson">
+ <title><literal>meson</literal> Build Targets</title>
+
+ <para>
+ Individual build targets can be built using <command>ninja</command> <replaceable>target</replaceable>.
+
+ When no target is specified, everything except documentation is
+ built. Individual build products can be built using the path/filename as
+ <replaceable>target</replaceable>.
+ </para>
+
+ &targets-meson;
+ </sect2>
+
</sect1>
<sect1 id="install-post">
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index dfdb1d0daa7..e1a85dc607b 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -71,6 +71,15 @@ doc_generated += custom_target('keywords-table.sgml',
capture: true,
)
+doc_generated += custom_target('targets-meson.sgml',
+ input: files('targets-meson.txt'),
+ output: 'targets-meson.sgml',
+ command: [perl, files('generate-targets-meson.pl'), '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
# For everything else we need at least xmllint
if not xmllint_bin.found()
subdir_done()
diff --git a/doc/src/sgml/targets-meson.txt b/doc/src/sgml/targets-meson.txt
new file mode 100644
index 00000000000..2495790429e
--- /dev/null
+++ b/doc/src/sgml/targets-meson.txt
@@ -0,0 +1,43 @@
+# Copyright (c) 2023, PostgreSQL Global Development Group
+#
+# Description of important meson targets, used for the 'help' target and
+# installation.sgml (via generate-targets-meson.pl). Right now the parsers are
+# extremely simple. Both parsers ignore comments. The help target prints
+# everything else. For xml everything without a leading newline is a group,
+# remaining lines are target separated by whitespace from their description
+#
+Code Targets:
+ all Build everything other than documentation
+ backend Build backend and related modules
+ bin Build frontend binaries
+ contrib Build contrib modules
+ pl Build procedual languages
+
+Developer Targets:
+ reformat-dat-files Rewrite catalog data files into standard format
+ expand-dat-files Expand all data files to include defaults
+ update-unicode Update unicode data to new version
+
+Documentation Targets:
+ html Build documentation in multi-page HTML format
+ man Build documentation in man page format
+ docs Build documentation in multi-page HTML and man page format
+ doc/src/sgml/postgres-A4.pdf Build documentation in PDF format, with A4 pages
+ doc/src/sgml/postgres-US.pdf Build documentation in PDF format, with US letter pages
+ doc/src/sgml/postgres.html Build documentation in single-page HTML format
+ alldocs Build documentation in all supported formats
+
+Installation Targets:
+ install Install postgres, excluding documentation
+ install-docs Install documentation in multi-page HTML and man page formats
+ install-html Install documentation in multi-page HTML format
+ install-man Install documentation in man page format
+ install-quiet Like "install", but installed files are not displayed
+ install-world Install postgres, including multi-page HTML and man page documentation
+ uninstall Remove installed files
+
+Other Targets:
+ clean Remove all build products
+ test Run all enabled tests (including contrib)
+ world Build everything, including documentation
+ help List important targets
--
2.38.0
v3-0005-meson-Add-Dpkglibdir-option.patchtext/x-diff; charset=us-asciiDownload
From 96d6424087cf2d35b81df032050e2c1fc07ee74a Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 3 Nov 2023 10:06:00 -0700
Subject: [PATCH v3 5/5] meson: Add -Dpkglibdir option
Author:
Reviewed-by:
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3vmil@awork3.anarazel.de
Backpatch:
---
meson.build | 9 ++++++---
meson_options.txt | 3 +++
doc/src/sgml/installation.sgml | 18 +++++++++++++++---
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/meson.build b/meson.build
index ee58ee7a065..ed4c664e6eb 100644
--- a/meson.build
+++ b/meson.build
@@ -492,9 +492,12 @@ endif
dir_lib = get_option('libdir')
-dir_lib_pkg = dir_lib
-if not (dir_prefix_contains_pg or dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
- dir_lib_pkg = dir_lib_pkg / pkg
+dir_lib_pkg = get_option('pkglibdir')
+if dir_lib_pkg == ''
+ dir_lib_pkg = dir_lib
+ if not (dir_prefix_contains_pg or dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
+ dir_lib_pkg = dir_lib_pkg / pkg
+ endif
endif
dir_pgxs = dir_lib_pkg / 'pgxs'
diff --git a/meson_options.txt b/meson_options.txt
index be1b327f544..82441b4d524 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -70,6 +70,9 @@ option('darwin_sysroot', type: 'string', value: '',
option('rpath', type: 'boolean', value: true,
description: 'Embed shared library search path in executables')
+option('pkglibdir', type: 'string', value: '',
+ description: 'Directory to install / load dynamically loadable modules from')
+
# External dependencies
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index b23b35cd8e7..3b6e49dbdbb 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2254,9 +2254,21 @@ ninja install
<term><option>--libdir=<replaceable>DIRECTORY</replaceable></option></term>
<listitem>
<para>
- Sets the location to install libraries and dynamically loadable
- modules. The default is
- <filename><replaceable>PREFIX</replaceable>/lib</filename>.
+ Sets the location to install libraries. The default is
+ <filename><replaceable>PREFIX</replaceable>/lib</filename>. This
+ option, unless <xref linkend='configure-pkglibdir-meson'/> is
+ specified, also controls where dynamically loadable modules get
+ installed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-pkglibdir-meson">
+ <term><option>-Dpkglibdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the location to dynamically loadable modules. The default is set
+ by <xref linkend='configure-libdir-meson'/>.
</para>
</listitem>
</varlistentry>
--
2.38.0
On 17.11.23 19:53, Andres Freund wrote:
I pushed the first two commits (the selinux stuff) and worked a bit more on
the subsequent ones.
Patches 0001 through 0004 look good to me.
Some possible small tweaks in 0004:
+ perl, '-ne', 'next if /^#/; print',
If you're going for super-brief mode, you could also use "perl -p" and
drop the "print".
Put at least two spaces between the "columns" in targets-meson.txt:
+ doc/src/sgml/postgres-A4.pdf Build documentation in PDF format, with
^^
Hi,
On 2023-11-20 08:27:48 +0100, Peter Eisentraut wrote:
On 17.11.23 19:53, Andres Freund wrote:
I pushed the first two commits (the selinux stuff) and worked a bit more on
the subsequent ones.Patches 0001 through 0004 look good to me.
Cool, I pushed them now.
Some possible small tweaks in 0004:
+ perl, '-ne', 'next if /^#/; print',
If you're going for super-brief mode, you could also use "perl -p" and drop
the "print".
I thought this didn't add much, so I didn't go there.
Put at least two spaces between the "columns" in targets-meson.txt:
+ doc/src/sgml/postgres-A4.pdf Build documentation in PDF format, with
^^
I did adopt this.
One remaining question is whether we should adjust install-doc-{html,man} to
be install-{html,man}, to match the docs targets.
Greetings,
Andres Freund
On 21.11.23 02:56, Andres Freund wrote:
One remaining question is whether we should adjust install-doc-{html,man} to
be install-{html,man}, to match the docs targets.
Ah didn't notice that one; yes please.
On 21.11.23 14:23, Peter Eisentraut wrote:
On 21.11.23 02:56, Andres Freund wrote:
One remaining question is whether we should adjust
install-doc-{html,man} to
be install-{html,man}, to match the docs targets.Ah didn't notice that one; yes please.
I think this was done?