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.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...
>
> 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
>From 146f4e5a76e68c551aee55cb46bb2197166da63d Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@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 <m...@debian.org>
Discussion: https://postgr.es/m/zuu5prqo6zueb...@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

>From 16109154c197d77b3e5d16144cfd383c74459025 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@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 <m...@debian.org>
Discussion: https://postgr.es/m/20231103163848.26egkh5qdgw3v...@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

>From 5a857146354bc8b42259a32ed0432b406de22a25 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@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.26egkh5qdgw3v...@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

>From 68a46f88defd013f7213a56a7325665ce5dd9036 Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@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.26egkh5qdgw3v...@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

>From 13dbd38c4aea7d4c4f0e2ad9dd72bb021ad1cb2b Mon Sep 17 00:00:00 2001
From: Andres Freund <and...@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.26egkh5qdgw3v...@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

Reply via email to