On Mon Jun 12, 2023 at 12:20 PM CDT, Andres Freund wrote:
> Hi,
>
> On 2023-06-12 11:54:42 -0500, Tristan Partin wrote:
> > On Fri Jun 9, 2023 at 1:36 PM CDT, Andres Freund wrote:
> > > The biggest change to make them more usable would be to properly 
> > > reconfigure
> > > when the contents of machine file change. IIRC configure is rerun, but the
> > > changes aren't taken into account.
> > 
> > I could not reproduce this. Perhaps you were testing with an older Meson
> > where that was the case
> > 
> > # meson.build
> > project('mytest')
> > 
> > myprog = find_program('myprog')
> > message(myprog.full_path())
> > 
> > test('dummy', find_program('echo'), args: [myprog.full_path()])
> > 
> > # file.ini
> > [binaries]
> > myprog = '/usr/bin/python3'
> > 
> > # CLI
> > meson setup build
> > meson test -C build
> > sed -i 's/python3/python2/' file.ini
> > meson test -C build
>
> It's possible that it doesn't happen in all contexts. I just reproduced the
> problem I had, changing
>
> [binaries]
> llvm-config = '/usr/bin/llvm-config-13'
>
> to
>
> [binaries]
> llvm-config = '/usr/bin/llvm-config-14'
>
> does not change which version is used in an existing build tree, but does
> change what's used in a new build tree.
>
> Same with e.g. changing the C compiler version in a machine file. That also
> only takes effect in a new tree.
>
>
> This is with meson HEAD, updated earlier today.

Mind opening a Meson issue if one doesn't exist already?

> > > In the end, I also just don't see a meaningful benefit in forcing the use 
> > > of
> > > machine files.
> > 
> > I think it is best to use patterns tools want you to use.
>
> Sometimes. I'd perhaps have a different view if we weren't migrating from
> autoconf, where overwriting binaries was trivially possible...

I'll see what I can advocate for, regardless. The following things seem
relevant. Might be useful to track in your meta issue on your fork.

https://github.com/mesonbuild/meson/issues/7755
https://github.com/mesonbuild/meson/pull/11561
https://github.com/mesonbuild/meson/issues/6180
https://github.com/mesonbuild/meson/issues/11294

Attached you will find a v3 with the offending commits removed. I did
leave the overrides in since you didn't mention it in your last email.

-- 
Tristan Partin
Neon (https://neon.tech)
From 3467aa4c4f9a239d349d84f26f4662fd37ec605f Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 07:55:03 -0500
Subject: [PATCH v3 01/15] Remove triple-quoted strings

Triple-quoted strings are for multiline strings in Meson. None of the
descriptions that got changed were multiline and the entire file uses
single-line descriptions.
---
 meson_options.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 5b44a8829d..1ea9729dc2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,19 +10,19 @@ option('blocksize', type : 'combo',
 option('wal_blocksize', type : 'combo',
   choices: ['1', '2', '4', '8', '16', '32', '64'],
   value: '8',
-  description : '''WAL block size, in kilobytes''')
+  description : 'WAL block size, in kilobytes')
 
 option('segsize', type : 'integer', value : 1,
-  description : '''Segment size, in gigabytes''')
+  description : 'Segment size, in gigabytes')
 
 option('segsize_blocks', type : 'integer', value: 0,
-  description : '''Segment size, in blocks''')
+  description : 'Segment size, in blocks')
 
 
 # Miscellaneous options
 
 option('krb_srvnam', type : 'string', value : 'postgres',
-  description : '''Default Kerberos service principal for GSSAPI''')
+  description : 'Default Kerberos service principal for GSSAPI')
 
 option('system_tzdata', type: 'string', value: '',
   description: 'use system time zone data in specified directory')
@@ -32,7 +32,7 @@ option('system_tzdata', type: 'string', value: '',
 
 option('pgport', type : 'integer', value : 5432,
   min: 1, max: 65535,
-  description : '''Default port number for server and clients''')
+  description : 'Default port number for server and clients')
 
 
 # Developer options
-- 
Tristan Partin
Neon (https://neon.tech)

From 8e911a487443b0fa40c5e7033746d97ee9a741f1 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 08:03:31 -0500
Subject: [PATCH v3 02/15] Use consistent casing in Meson option descriptions

Meson itself uses capital letters for option descriptions, so follow
that.
---
 meson_options.txt | 90 +++++++++++++++++++++++------------------------
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index 1ea9729dc2..fa823fd088 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -5,7 +5,7 @@
 option('blocksize', type : 'combo',
   choices : ['1', '2', '4', '8', '16', '32'],
   value : '8',
-  description: 'set relation block size in kB')
+  description: 'Set relation block size in kB')
 
 option('wal_blocksize', type : 'combo',
   choices: ['1', '2', '4', '8', '16', '32', '64'],
@@ -25,7 +25,7 @@ option('krb_srvnam', type : 'string', value : 'postgres',
   description : 'Default Kerberos service principal for GSSAPI')
 
 option('system_tzdata', type: 'string', value: '',
-  description: 'use system time zone data in specified directory')
+  description: 'Use system time zone data in specified directory')
 
 
 # Defaults
@@ -38,7 +38,7 @@ option('pgport', type : 'integer', value : 5432,
 # Developer options
 
 option('cassert', type : 'boolean', value: false,
-  description: 'enable assertion checks (for debugging)')
+  description: 'Enable assertion checks (for debugging)')
 
 option('tap_tests', type : 'feature', value : 'auto',
   description : 'Whether to enable tap tests')
@@ -47,43 +47,43 @@ option('PG_TEST_EXTRA', type : 'string', value: '',
   description: 'Enable selected extra tests')
 
 option('atomics', type : 'boolean', value: true,
-  description: 'whether to use atomic operations')
+  description: 'Whether to use atomic operations')
 
 option('spinlocks', type : 'boolean', value: true,
-  description: 'whether to use spinlocks')
+  description: 'Whether to use spinlocks')
 
 
 # Compilation options
 
 option('extra_include_dirs', type : 'array', value: [],
-  description: 'non-default directories to be searched for headers')
+  description: 'Non-default directories to be searched for headers')
 
 option('extra_lib_dirs', type : 'array', value: [],
-  description: 'non-default directories to be searched for libs')
+  description: 'Non-default directories to be searched for libs')
 
 option('extra_version', type : 'string', value: '',
-  description: 'append STRING to the PostgreSQL version number')
+  description: 'Append STRING to the PostgreSQL version number')
 
 option('darwin_sysroot', type : 'string', value: '',
-  description: 'select a non-default sysroot path')
+  description: 'Select a non-default sysroot path')
 
 option('rpath', type : 'boolean', value: true,
-  description: 'whether to embed shared library search path in executables')
+  description: 'Whether to embed shared library search path in executables')
 
 
 # External dependencies
 
 option('bonjour', type : 'feature', value: 'auto',
-  description: 'build with Bonjour support')
+  description: 'Build with Bonjour support')
 
 option('bsd_auth', type : 'feature', value: 'auto',
-  description: 'build with BSD Authentication support')
+  description: 'Build with BSD Authentication support')
 
 option('docs', type : 'feature', value: 'auto',
-  description: 'documentation in HTML and man page format')
+  description: 'Documentation in HTML and man page format')
 
 option('docs_pdf', type : 'feature', value: 'auto',
-  description: 'documentation in PDF format')
+  description: 'Documentation in PDF format')
 
 option('docs_html_style', type : 'combo', choices: ['simple', 'website'],
   description: 'CSS stylesheet for HTML documentation')
@@ -110,102 +110,102 @@ option('libxslt', type : 'feature', value: 'auto',
   description: 'XSLT support in contrib/xml2')
 
 option('llvm', type : 'feature', value: 'disabled',
-  description: 'whether to use llvm')
+  description: 'Whether to use llvm')
 
 option('lz4', type : 'feature', value: 'auto',
   description: 'LZ4 support')
 
 option('nls', type: 'feature', value: 'auto',
-  description: 'native language support')
+  description: 'Native language support')
 
 option('pam', type : 'feature', value: 'auto',
-  description: 'build with PAM support')
+  description: 'Build with PAM support')
 
 option('plperl', type : 'feature', value: 'auto',
-  description: 'build Perl modules (PL/Perl)')
+  description: 'Build Perl modules (PL/Perl)')
 
 option('plpython', type : 'feature', value: 'auto',
-  description: 'build Python modules (PL/Python)')
+  description: 'Build Python modules (PL/Python)')
 
 option('pltcl', type : 'feature', value: 'auto',
-  description: 'build with TCL support')
+  description: 'Build with TCL support')
 
 option('tcl_version', type : 'string', value : 'tcl',
-  description: 'specify TCL version')
+  description: 'Specify TCL version')
 
 option('readline', type : 'feature', value : 'auto',
-  description: 'use GNU Readline or BSD Libedit for editing')
+  description: 'Use GNU Readline or BSD Libedit for editing')
 
 option('selinux', type : 'feature', value : 'disabled',
-  description: 'build with SELinux support')
+  description: 'Build with SELinux support')
 
 option('ssl', type : 'combo', choices : ['auto', 'none', 'openssl'],
   value : 'auto',
-  description: 'use LIB for SSL/TLS support (openssl)')
+  description: 'Use LIB for SSL/TLS support (openssl)')
 
 option('systemd', type : 'feature', value: 'auto',
-  description: 'build with systemd support')
+  description: 'Build with systemd support')
 
 option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'],
   value : 'none',
-  description: 'build contrib/uuid-ossp using LIB')
+  description: 'Build contrib/uuid-ossp using LIB')
 
 option('zlib', type : 'feature', value: 'auto',
-  description: 'whether to use zlib')
+  description: 'Whether to use zlib')
 
 option('zstd', type : 'feature', value: 'auto',
-  description: 'whether to use zstd')
+  description: 'Whether to use zstd')
 
 
 # Programs
 
 option('BISON', type : 'array', value: ['bison', 'win_bison'],
-  description: 'path to bison binary')
+  description: 'Path to bison binary')
 
 option('DTRACE', type : 'string', value: 'dtrace',
-  description: 'path to dtrace binary')
+  description: 'Path to dtrace binary')
 
 option('FLEX', type : 'array', value: ['flex', 'win_flex'],
-  description: 'path to flex binary')
+  description: 'Path to flex binary')
 
 option('FOP', type : 'string', value: 'fop',
-  description: 'path to fop binary')
+  description: 'Path to fop binary')
 
 option('GZIP', type : 'string', value: 'gzip',
-  description: 'path to gzip binary')
+  description: 'Path to gzip binary')
 
 option('LZ4', type : 'string', value: 'lz4',
-  description: 'path to lz4 binary')
+  description: 'Path to lz4 binary')
 
 option('OPENSSL', type : 'string', value: 'openssl',
-  description: 'path to openssl binary')
+  description: 'Path to openssl binary')
 
 option('PERL', type : 'string', value: 'perl',
-  description: 'path to perl binary')
+  description: 'Path to perl binary')
 
 option('PROVE', type : 'string', value: 'prove',
-  description: 'path to prove binary')
+  description: 'Path to prove binary')
 
 option('PYTHON', type : 'array', value: ['python3', 'python'],
-  description: 'path to python binary')
+  description: 'Path to python binary')
 
 option('SED', type : 'string', value: 'gsed',
-  description: 'path to sed binary')
+  description: 'Path to sed binary')
 
 option('STRIP', type : 'string', value: 'strip',
-  description: 'path to strip binary, used for PGXS emulation')
+  description: 'Path to strip binary, used for PGXS emulation')
 
 option('TAR', type : 'string', value: 'tar',
-  description: 'path to tar binary')
+  description: 'Path to tar binary')
 
 option('XMLLINT', type : 'string', value: 'xmllint',
-  description: 'path to xmllint binary')
+  description: 'Path to xmllint binary')
 
 option('XSLTPROC', type : 'string', value: 'xsltproc',
-  description: 'path to xsltproc binary')
+  description: 'Path to xsltproc binary')
 
 option('ZSTD', type : 'string', value: 'zstd',
-  description: 'path to zstd binary')
+  description: 'Path to zstd binary')
 
 option('ZIC', type : 'string', value: 'zic',
-  description: 'path to zic binary, when cross-compiling')
+  description: 'Path to zic binary, when cross-compiling')
-- 
Tristan Partin
Neon (https://neon.tech)

From 193faf593b47cbb820ad2a7492d32ba50a054607 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 08:11:14 -0500
Subject: [PATCH v3 03/15] Use consistent Meson option description formats

---
 meson_options.txt | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index fa823fd088..bdc6735332 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -5,7 +5,7 @@
 option('blocksize', type : 'combo',
   choices : ['1', '2', '4', '8', '16', '32'],
   value : '8',
-  description: 'Set relation block size in kB')
+  description: 'Relation block size, in kilobytes')
 
 option('wal_blocksize', type : 'combo',
   choices: ['1', '2', '4', '8', '16', '32', '64'],
@@ -41,16 +41,16 @@ option('cassert', type : 'boolean', value: false,
   description: 'Enable assertion checks (for debugging)')
 
 option('tap_tests', type : 'feature', value : 'auto',
-  description : 'Whether to enable tap tests')
+  description : 'Enable tap tests')
 
 option('PG_TEST_EXTRA', type : 'string', value: '',
   description: 'Enable selected extra tests')
 
 option('atomics', type : 'boolean', value: true,
-  description: 'Whether to use atomic operations')
+  description: 'Use atomic operations')
 
 option('spinlocks', type : 'boolean', value: true,
-  description: 'Whether to use spinlocks')
+  description: 'Use spinlocks')
 
 
 # Compilation options
@@ -68,16 +68,16 @@ option('darwin_sysroot', type : 'string', value: '',
   description: 'Select a non-default sysroot path')
 
 option('rpath', type : 'boolean', value: true,
-  description: 'Whether to embed shared library search path in executables')
+  description: 'Embed shared library search path in executables')
 
 
 # External dependencies
 
 option('bonjour', type : 'feature', value: 'auto',
-  description: 'Build with Bonjour support')
+  description: 'Bonjour support')
 
 option('bsd_auth', type : 'feature', value: 'auto',
-  description: 'Build with BSD Authentication support')
+  description: 'BSD Authentication support')
 
 option('docs', type : 'feature', value: 'auto',
   description: 'Documentation in HTML and man page format')
@@ -110,7 +110,7 @@ option('libxslt', type : 'feature', value: 'auto',
   description: 'XSLT support in contrib/xml2')
 
 option('llvm', type : 'feature', value: 'disabled',
-  description: 'Whether to use llvm')
+  description: 'LLVM support')
 
 option('lz4', type : 'feature', value: 'auto',
   description: 'LZ4 support')
@@ -119,7 +119,7 @@ option('nls', type: 'feature', value: 'auto',
   description: 'Native language support')
 
 option('pam', type : 'feature', value: 'auto',
-  description: 'Build with PAM support')
+  description: 'PAM support')
 
 option('plperl', type : 'feature', value: 'auto',
   description: 'Build Perl modules (PL/Perl)')
@@ -128,33 +128,33 @@ option('plpython', type : 'feature', value: 'auto',
   description: 'Build Python modules (PL/Python)')
 
 option('pltcl', type : 'feature', value: 'auto',
-  description: 'Build with TCL support')
+  description: 'Build with TCL support (PL/TCL)')
 
 option('tcl_version', type : 'string', value : 'tcl',
-  description: 'Specify TCL version')
+  description: 'TCL version')
 
 option('readline', type : 'feature', value : 'auto',
   description: 'Use GNU Readline or BSD Libedit for editing')
 
 option('selinux', type : 'feature', value : 'disabled',
-  description: 'Build with SELinux support')
+  description: 'SELinux support')
 
 option('ssl', type : 'combo', choices : ['auto', 'none', 'openssl'],
   value : 'auto',
   description: 'Use LIB for SSL/TLS support (openssl)')
 
 option('systemd', type : 'feature', value: 'auto',
-  description: 'Build with systemd support')
+  description: 'systemd support')
 
 option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'],
   value : 'none',
-  description: 'Build contrib/uuid-ossp using LIB')
+  description: 'Use LIB for contrib/uuid-ossp support')
 
 option('zlib', type : 'feature', value: 'auto',
-  description: 'Whether to use zlib')
+  description: 'Enable zlib')
 
 option('zstd', type : 'feature', value: 'auto',
-  description: 'Whether to use zstd')
+  description: 'Enable zstd')
 
 
 # Programs
-- 
Tristan Partin
Neon (https://neon.tech)

From 702588e79b858d0e70fe2202840b00d23eb6814d Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 08:28:48 -0500
Subject: [PATCH v3 04/15] Attach colon to keyword argument

This matches the style found in the rest of the Meson build description.
---
 meson_options.txt | 138 +++++++++++++++++++++++-----------------------
 1 file changed, 69 insertions(+), 69 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index bdc6735332..e9ac70766a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,27 +2,27 @@
 
 # Data layout influencing options
 
-option('blocksize', type : 'combo',
-  choices : ['1', '2', '4', '8', '16', '32'],
-  value : '8',
+option('blocksize', type: 'combo',
+  choices: ['1', '2', '4', '8', '16', '32'],
+  value: '8',
   description: 'Relation block size, in kilobytes')
 
-option('wal_blocksize', type : 'combo',
+option('wal_blocksize', type: 'combo',
   choices: ['1', '2', '4', '8', '16', '32', '64'],
   value: '8',
-  description : 'WAL block size, in kilobytes')
+  description: 'WAL block size, in kilobytes')
 
-option('segsize', type : 'integer', value : 1,
-  description : 'Segment size, in gigabytes')
+option('segsize', type: 'integer', value: 1,
+  description: 'Segment size, in gigabytes')
 
-option('segsize_blocks', type : 'integer', value: 0,
-  description : 'Segment size, in blocks')
+option('segsize_blocks', type: 'integer', value: 0,
+  description: 'Segment size, in blocks')
 
 
 # Miscellaneous options
 
-option('krb_srvnam', type : 'string', value : 'postgres',
-  description : 'Default Kerberos service principal for GSSAPI')
+option('krb_srvnam', type: 'string', value: 'postgres',
+  description: 'Default Kerberos service principal for GSSAPI')
 
 option('system_tzdata', type: 'string', value: '',
   description: 'Use system time zone data in specified directory')
@@ -30,182 +30,182 @@ option('system_tzdata', type: 'string', value: '',
 
 # Defaults
 
-option('pgport', type : 'integer', value : 5432,
+option('pgport', type: 'integer', value: 5432,
   min: 1, max: 65535,
-  description : 'Default port number for server and clients')
+  description: 'Default port number for server and clients')
 
 
 # Developer options
 
-option('cassert', type : 'boolean', value: false,
+option('cassert', type: 'boolean', value: false,
   description: 'Enable assertion checks (for debugging)')
 
-option('tap_tests', type : 'feature', value : 'auto',
-  description : 'Enable tap tests')
+option('tap_tests', type: 'feature', value: 'auto',
+  description: 'Enable tap tests')
 
-option('PG_TEST_EXTRA', type : 'string', value: '',
+option('PG_TEST_EXTRA', type: 'string', value: '',
   description: 'Enable selected extra tests')
 
-option('atomics', type : 'boolean', value: true,
+option('atomics', type: 'boolean', value: true,
   description: 'Use atomic operations')
 
-option('spinlocks', type : 'boolean', value: true,
+option('spinlocks', type: 'boolean', value: true,
   description: 'Use spinlocks')
 
 
 # Compilation options
 
-option('extra_include_dirs', type : 'array', value: [],
+option('extra_include_dirs', type: 'array', value: [],
   description: 'Non-default directories to be searched for headers')
 
-option('extra_lib_dirs', type : 'array', value: [],
+option('extra_lib_dirs', type: 'array', value: [],
   description: 'Non-default directories to be searched for libs')
 
-option('extra_version', type : 'string', value: '',
+option('extra_version', type: 'string', value: '',
   description: 'Append STRING to the PostgreSQL version number')
 
-option('darwin_sysroot', type : 'string', value: '',
+option('darwin_sysroot', type: 'string', value: '',
   description: 'Select a non-default sysroot path')
 
-option('rpath', type : 'boolean', value: true,
+option('rpath', type: 'boolean', value: true,
   description: 'Embed shared library search path in executables')
 
 
 # External dependencies
 
-option('bonjour', type : 'feature', value: 'auto',
+option('bonjour', type: 'feature', value: 'auto',
   description: 'Bonjour support')
 
-option('bsd_auth', type : 'feature', value: 'auto',
+option('bsd_auth', type: 'feature', value: 'auto',
   description: 'BSD Authentication support')
 
-option('docs', type : 'feature', value: 'auto',
+option('docs', type: 'feature', value: 'auto',
   description: 'Documentation in HTML and man page format')
 
-option('docs_pdf', type : 'feature', value: 'auto',
+option('docs_pdf', type: 'feature', value: 'auto',
   description: 'Documentation in PDF format')
 
-option('docs_html_style', type : 'combo', choices: ['simple', 'website'],
+option('docs_html_style', type: 'combo', choices: ['simple', 'website'],
   description: 'CSS stylesheet for HTML documentation')
 
-option('dtrace', type : 'feature', value: 'disabled',
+option('dtrace', type: 'feature', value: 'disabled',
   description: 'DTrace support')
 
-option('gssapi', type : 'feature', value: 'auto',
+option('gssapi', type: 'feature', value: 'auto',
   description: 'GSSAPI support')
 
-option('icu', type : 'feature', value: 'auto',
+option('icu', type: 'feature', value: 'auto',
   description: 'ICU support')
 
-option('ldap', type : 'feature', value: 'auto',
+option('ldap', type: 'feature', value: 'auto',
   description: 'LDAP support')
 
-option('libedit_preferred', type : 'boolean', value: false,
+option('libedit_preferred', type: 'boolean', value: false,
   description: 'Prefer BSD Libedit over GNU Readline')
 
-option('libxml', type : 'feature', value: 'auto',
+option('libxml', type: 'feature', value: 'auto',
   description: 'XML support')
 
-option('libxslt', type : 'feature', value: 'auto',
+option('libxslt', type: 'feature', value: 'auto',
   description: 'XSLT support in contrib/xml2')
 
-option('llvm', type : 'feature', value: 'disabled',
+option('llvm', type: 'feature', value: 'disabled',
   description: 'LLVM support')
 
-option('lz4', type : 'feature', value: 'auto',
+option('lz4', type: 'feature', value: 'auto',
   description: 'LZ4 support')
 
 option('nls', type: 'feature', value: 'auto',
   description: 'Native language support')
 
-option('pam', type : 'feature', value: 'auto',
+option('pam', type: 'feature', value: 'auto',
   description: 'PAM support')
 
-option('plperl', type : 'feature', value: 'auto',
+option('plperl', type: 'feature', value: 'auto',
   description: 'Build Perl modules (PL/Perl)')
 
-option('plpython', type : 'feature', value: 'auto',
+option('plpython', type: 'feature', value: 'auto',
   description: 'Build Python modules (PL/Python)')
 
-option('pltcl', type : 'feature', value: 'auto',
+option('pltcl', type: 'feature', value: 'auto',
   description: 'Build with TCL support (PL/TCL)')
 
-option('tcl_version', type : 'string', value : 'tcl',
+option('tcl_version', type: 'string', value: 'tcl',
   description: 'TCL version')
 
-option('readline', type : 'feature', value : 'auto',
+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: 'disabled',
   description: 'SELinux support')
 
-option('ssl', type : 'combo', choices : ['auto', 'none', 'openssl'],
-  value : 'auto',
+option('ssl', type: 'combo', choices: ['auto', 'none', 'openssl'],
+  value: 'auto',
   description: 'Use LIB for SSL/TLS support (openssl)')
 
-option('systemd', type : 'feature', value: 'auto',
+option('systemd', type: 'feature', value: 'auto',
   description: 'systemd support')
 
-option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'],
-  value : 'none',
+option('uuid', type: 'combo', choices: ['none', 'bsd', 'e2fs', 'ossp'],
+  value: 'none',
   description: 'Use LIB for contrib/uuid-ossp support')
 
-option('zlib', type : 'feature', value: 'auto',
+option('zlib', type: 'feature', value: 'auto',
   description: 'Enable zlib')
 
-option('zstd', type : 'feature', value: 'auto',
+option('zstd', type: 'feature', value: 'auto',
   description: 'Enable zstd')
 
 
 # Programs
 
-option('BISON', type : 'array', value: ['bison', 'win_bison'],
+option('BISON', type: 'array', value: ['bison', 'win_bison'],
   description: 'Path to bison binary')
 
-option('DTRACE', type : 'string', value: 'dtrace',
+option('DTRACE', type: 'string', value: 'dtrace',
   description: 'Path to dtrace binary')
 
-option('FLEX', type : 'array', value: ['flex', 'win_flex'],
+option('FLEX', type: 'array', value: ['flex', 'win_flex'],
   description: 'Path to flex binary')
 
-option('FOP', type : 'string', value: 'fop',
+option('FOP', type: 'string', value: 'fop',
   description: 'Path to fop binary')
 
-option('GZIP', type : 'string', value: 'gzip',
+option('GZIP', type: 'string', value: 'gzip',
   description: 'Path to gzip binary')
 
-option('LZ4', type : 'string', value: 'lz4',
+option('LZ4', type: 'string', value: 'lz4',
   description: 'Path to lz4 binary')
 
-option('OPENSSL', type : 'string', value: 'openssl',
+option('OPENSSL', type: 'string', value: 'openssl',
   description: 'Path to openssl binary')
 
-option('PERL', type : 'string', value: 'perl',
+option('PERL', type: 'string', value: 'perl',
   description: 'Path to perl binary')
 
-option('PROVE', type : 'string', value: 'prove',
+option('PROVE', type: 'string', value: 'prove',
   description: 'Path to prove binary')
 
-option('PYTHON', type : 'array', value: ['python3', 'python'],
+option('PYTHON', type: 'array', value: ['python3', 'python'],
   description: 'Path to python binary')
 
-option('SED', type : 'string', value: 'gsed',
+option('SED', type: 'string', value: 'gsed',
   description: 'Path to sed binary')
 
-option('STRIP', type : 'string', value: 'strip',
+option('STRIP', type: 'string', value: 'strip',
   description: 'Path to strip binary, used for PGXS emulation')
 
-option('TAR', type : 'string', value: 'tar',
+option('TAR', type: 'string', value: 'tar',
   description: 'Path to tar binary')
 
-option('XMLLINT', type : 'string', value: 'xmllint',
+option('XMLLINT', type: 'string', value: 'xmllint',
   description: 'Path to xmllint binary')
 
-option('XSLTPROC', type : 'string', value: 'xsltproc',
+option('XSLTPROC', type: 'string', value: 'xsltproc',
   description: 'Path to xsltproc binary')
 
-option('ZSTD', type : 'string', value: 'zstd',
+option('ZSTD', type: 'string', value: 'zstd',
   description: 'Path to zstd binary')
 
-option('ZIC', type : 'string', value: 'zic',
+option('ZIC', type: 'string', value: 'zic',
   description: 'Path to zic binary, when cross-compiling')
-- 
Tristan Partin
Neon (https://neon.tech)

From 475f2544fcf86c8b34f0ed18a19c1dadec88f2c9 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 08:33:12 -0500
Subject: [PATCH v3 05/15] Use the not_found_dep constant

Previously in the build description, a not_found_dep was defined. Make
use of it.
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 16b2e86646..f608eaed30 100644
--- a/meson.build
+++ b/meson.build
@@ -558,7 +558,7 @@ endif
 ###############################################################
 
 bonjouropt = get_option('bonjour')
-bonjour = dependency('', required : false)
+bonjour = not_found_dep
 if cc.check_header('dns_sd.h', required: bonjouropt,
     args: test_c_args, include_directories: postgres_inc) and \
    cc.has_function('DNSServiceRegister',
-- 
Tristan Partin
Neon (https://neon.tech)

From 7392390eea304f3d4961a8f24ee51ed388ca8c1e Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 09:19:46 -0500
Subject: [PATCH v3 06/15] Remove old comment

That portion of code is not run in the Windows case already given the
structure of the surrounding if statement.
---
 meson.build | 2 --
 1 file changed, 2 deletions(-)

diff --git a/meson.build b/meson.build
index f608eaed30..42797694f0 100644
--- a/meson.build
+++ b/meson.build
@@ -722,8 +722,6 @@ choke me
     endif
   endif
 
-  # XXX: this shouldn't be tested in the windows case, but should be tested in
-  # the dependency() success case
   if ldap.found() and cc.has_function('ldap_initialize',
       dependencies: ldap, args: test_c_args)
     cdata.set('HAVE_LDAP_INITIALIZE', 1)
-- 
Tristan Partin
Neon (https://neon.tech)

From f8c2da5d2f1f13021cd44838ca9f8d9c83ef673b Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 09:27:06 -0500
Subject: [PATCH v3 07/15] Tie adding C++ support to the llvm Meson option

In the event the llvm option is defined to be 'auto', it is possible
that the host machine might not have a C++ compiler. If that is the
case, then we shouldn't continue reaching for the llvm dependency.
---
 meson.build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 42797694f0..f18032a66c 100644
--- a/meson.build
+++ b/meson.build
@@ -742,8 +742,8 @@ endif
 ###############################################################
 
 llvmopt = get_option('llvm')
-if not llvmopt.disabled()
-  add_languages('cpp', required: true, native: false)
+llvm = not_found_dep
+if add_languages('cpp', required: llvmopt, native: false)
   llvm = dependency('llvm', version: '>=3.9', method: 'config-tool', required: llvmopt)
 
   if llvm.found()
@@ -757,8 +757,6 @@ if not llvmopt.disabled()
     ccache = find_program('ccache', native: true, required: false)
     clang = find_program(llvm_binpath / 'clang', required: true)
   endif
-else
-  llvm = not_found_dep
 endif
 
 
-- 
Tristan Partin
Neon (https://neon.tech)

From a0fad88aa088768383ef23a43676b439673fe0b9 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Tue, 16 May 2023 10:27:34 -0500
Subject: [PATCH v3 08/15] Mention the correct way to disable readline support

Using false to disable a feature option is incorrect.
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index f18032a66c..061a74b83e 100644
--- a/meson.build
+++ b/meson.build
@@ -1129,7 +1129,7 @@ if not get_option('readline').disabled()
       error('''readline header not found
 If you have @0@ already installed, see meson-log/meson-log.txt for details on the
 failure. It is possible the compiler isn't looking in the proper directory.
-Use -Dreadline=false to disable readline support.'''.format(readline_dep))
+Use -Dreadline=disabled to disable readline support.'''.format(readline_dep))
     endif
 
     check_funcs = [
-- 
Tristan Partin
Neon (https://neon.tech)

From a87561d27dcfd4a5581a51bd2b1d8d229a1b3f4a Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 09:30:54 -0500
Subject: [PATCH v3 09/15] Remove return code check

run_command(check: true) will already handle this.
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 061a74b83e..a81aaeb8aa 100644
--- a/meson.build
+++ b/meson.build
@@ -385,7 +385,7 @@ install_files = files('src/tools/install_files')
 # https://github.com/mesonbuild/meson/issues/8511
 meson_binpath_r = run_command(python, 'src/tools/find_meson', check: true)
 
-if meson_binpath_r.returncode() != 0 or meson_binpath_r.stdout() == ''
+if meson_binpath_r.stdout() == ''
   error('huh, could not run find_meson.\nerrcode: @0@\nstdout: @1@\nstderr: @2@'.format(
     meson_binpath_r.returncode(),
     meson_binpath_r.stdout(),
-- 
Tristan Partin
Neon (https://neon.tech)

From 0d859e0d6c8a76dc18fd51b63f7d4d9bcf06c008 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 09:33:18 -0500
Subject: [PATCH v3 10/15] Fix some grammar usage in Meson comments

---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index a81aaeb8aa..0ab31b3424 100644
--- a/meson.build
+++ b/meson.build
@@ -150,7 +150,7 @@ cdata.set_quoted('PG_MAJORVERSION', pg_version_major.to_string())
 cdata.set('PG_MAJORVERSION_NUM', pg_version_major)
 cdata.set('PG_MINORVERSION_NUM', pg_version_minor)
 cdata.set('PG_VERSION_NUM', pg_version_num)
-# PG_VERSION_STR is built later, it depends compiler test results
+# PG_VERSION_STR is built later, it depends on compiler test results
 cdata.set_quoted('CONFIGURE_ARGS', '')
 
 
@@ -1672,7 +1672,7 @@ if cc.has_function_attribute('visibility:default') and \
   cdata.set('HAVE_VISIBILITY_ATTRIBUTE', 1)
 
   # Only newer versions of meson know not to apply gnu_symbol_visibility =
-  # inlineshidden to C code as well... Any either way, we want to put these
+  # inlineshidden to C code as well... And either way, we want to put these
   # flags into exported files (pgxs, .pc files).
   cflags_mod += '-fvisibility=hidden'
   cxxflags_mod += ['-fvisibility=hidden', '-fvisibility-inlines-hidden']
-- 
Tristan Partin
Neon (https://neon.tech)

From ae741c434aef202917acd159422a8f7123b64575 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 09:38:09 -0500
Subject: [PATCH v3 11/15] Pass feature option through to required kwarg

Meson understands this already. No need to convert it to a boolean.
---
 meson.build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 0ab31b3424..188dd81243 100644
--- a/meson.build
+++ b/meson.build
@@ -767,8 +767,8 @@ endif
 
 icuopt = get_option('icu')
 if not icuopt.disabled()
-  icu = dependency('icu-uc', required: icuopt.enabled())
-  icu_i18n = dependency('icu-i18n', required: icuopt.enabled())
+  icu = dependency('icu-uc', required: icuopt)
+  icu_i18n = dependency('icu-i18n', required: icuopt)
 
   if icu.found()
     cdata.set('USE_ICU', 1)
@@ -1077,7 +1077,7 @@ if not get_option('readline').disabled()
     readline = dependency(readline_dep, required: false)
     if not readline.found()
       readline = cc.find_library(readline_dep,
-        required: get_option('readline').enabled(),
+        required: get_option('readline'),
         dirs: test_lib_d)
     endif
     if readline.found()
@@ -2537,7 +2537,7 @@ if not nlsopt.disabled()
   # otherwise there'd be lots of
   # "Gettext not found, all translation (po) targets will be ignored."
   # warnings if not found.
-  msgfmt = find_program('msgfmt', required: nlsopt.enabled(), native: true)
+  msgfmt = find_program('msgfmt', required: nlsopt, native: true)
 
   # meson 0.59 has this wrapped in dependency('int')
   if (msgfmt.found() and
-- 
Tristan Partin
Neon (https://neon.tech)

From 5221313935b078feac8e929acad39f95ac1c3e7d Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 09:40:02 -0500
Subject: [PATCH v3 12/15] Make finding pkg-config(python3) more robust

It is a possibility that the installation can't be found. Checking for
Python.h is redundant with what Meson does internally.

https://github.com/mesonbuild/meson/blob/master/mesonbuild/dependencies/python.py#L218
---
 meson.build | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index 188dd81243..7f6cad1908 100644
--- a/meson.build
+++ b/meson.build
@@ -1050,15 +1050,17 @@ endif
 ###############################################################
 
 pyopt = get_option('plpython')
+python3_dep = not_found_dep
 if not pyopt.disabled()
   pm = import('python')
-  python3_inst = pm.find_installation(required: pyopt.enabled())
-  python3_dep = python3_inst.dependency(embed: true, required: pyopt.enabled())
-  if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt.enabled())
-    python3_dep = not_found_dep
+  python3_inst = pm.find_installation(required: pyopt)
+  if python3_inst.found()
+    python3_dep = python3_inst.dependency(embed: true, required: pyopt)
+    # Remove this check after we depend on Meson >= 1.1.0
+    if not cc.check_header('Python.h', dependencies: python3_dep, required: pyopt)
+      python3_dep = not_found_dep
+    endif
   endif
-else
-  python3_dep = not_found_dep
 endif
 
 
-- 
Tristan Partin
Neon (https://neon.tech)

From ddbef71047fe7e9e5cb5585923901f4ac5fd6ae3 Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 09:43:51 -0500
Subject: [PATCH v3 13/15] Make some Meson style more consistent with
 surrounding code

---
 meson.build             | 17 ++++++++---------
 src/include/meson.build |  2 +-
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index 7f6cad1908..79b6aa47ec 100644
--- a/meson.build
+++ b/meson.build
@@ -1146,7 +1146,7 @@ Use -Dreadline=disabled to disable readline support.'''.format(readline_dep))
     foreach func : check_funcs
       found = cc.has_function(func, dependencies: [readline],
         args: test_c_args, include_directories: postgres_inc)
-      cdata.set('HAVE_'+func.to_upper(), found ? 1 : false)
+      cdata.set('HAVE_' + func.to_upper(), found ? 1 : false)
     endforeach
 
     check_vars = [
@@ -1156,7 +1156,7 @@ Use -Dreadline=disabled to disable readline support.'''.format(readline_dep))
     ]
 
     foreach var : check_vars
-      cdata.set('HAVE_'+var.to_upper(),
+      cdata.set('HAVE_' + var.to_upper(),
         cc.has_header_symbol(readline_h, var,
           args: test_c_args, include_directories: postgres_inc,
           prefix: '#include <stdio.h>',
@@ -1311,7 +1311,7 @@ if sslopt in ['auto', 'openssl']
       cdata.set('USE_OPENSSL', 1,
                 description: 'Define to 1 to build with OpenSSL support. (-Dssl=openssl)')
       cdata.set('OPENSSL_API_COMPAT', '0x10001000L',
-                description: '''Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.''')
+                description: 'Define to the OpenSSL API version in use. This avoids deprecation warnings from newer OpenSSL versions.')
       ssl_library = 'openssl'
     else
       ssl = not_found_dep
@@ -1599,8 +1599,7 @@ if cc.links('''
 
   if not buggy_int128
     cdata.set('PG_INT128_TYPE', '__int128')
-    cdata.set('ALIGNOF_PG_INT128_TYPE', cc.
-      alignment('__int128', args: test_c_args))
+    cdata.set('ALIGNOF_PG_INT128_TYPE', cc.alignment('__int128', args: test_c_args))
   endif
 endif
 
@@ -1642,8 +1641,8 @@ endif
 # We use <stdbool.h> if we have it and it declares type bool as having
 # size 1.  Otherwise, c.h will fall back to declaring bool as unsigned char.
 if cc.has_type('_Bool', args: test_c_args) \
-  and cc.has_type('bool', prefix: '#include <stdbool.h>', args: test_c_args) \
-  and cc.sizeof('bool', prefix: '#include <stdbool.h>', args: test_c_args) == 1
+    and cc.has_type('bool', prefix: '#include <stdbool.h>', args: test_c_args) \
+    and cc.sizeof('bool', prefix: '#include <stdbool.h>', args: test_c_args) == 1
   cdata.set('HAVE__BOOL', 1)
   cdata.set('PG_USE_STDBOOL', 1)
 endif
@@ -1670,7 +1669,7 @@ endforeach
 
 
 if cc.has_function_attribute('visibility:default') and \
-  cc.has_function_attribute('visibility:hidden')
+    cc.has_function_attribute('visibility:hidden')
   cdata.set('HAVE_VISIBILITY_ATTRIBUTE', 1)
 
   # Only newer versions of meson know not to apply gnu_symbol_visibility =
@@ -3032,7 +3031,7 @@ meson_install_args = meson_args + ['install'] + {
     'muon': []
 }[meson_impl]
 
-# setup tests should  be run first,
+# setup tests should be run first,
 # so define priority for these
 setup_tests_priority = 100
 test('tmp_install',
diff --git a/src/include/meson.build b/src/include/meson.build
index 33c0a5562c..d7e1ecd4c9 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -89,7 +89,7 @@ install_headers(
   'c.h',
   'port.h',
   'postgres_fe.h',
-  install_dir: dir_include_internal
+  install_dir: dir_include_internal,
 )
 
 install_headers(
-- 
Tristan Partin
Neon (https://neon.tech)

From 585a2741d08daf7165ed75551867ffa32c93594d Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 09:48:18 -0500
Subject: [PATCH v3 14/15] Use a better error message in an impossible case

Meson validates 'choice' options for us, so technically this case is
impossible. A better error message helps people reading the code
understand what is going on in that branch.
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 79b6aa47ec..127d266095 100644
--- a/meson.build
+++ b/meson.build
@@ -1346,7 +1346,7 @@ if uuidopt != 'none'
     uuidfunc = 'uuid_export'
     uuidheader = 'uuid.h'
   else
-    error('huh')
+    error('unknown uuid build option value: @0@'.format(uuidopt))
   endif
 
   if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid)
-- 
Tristan Partin
Neon (https://neon.tech)

From c3a2e8f46760f86cf9d2bafe4f3777e103701e0f Mon Sep 17 00:00:00 2001
From: Tristan Partin <tris...@neon.tech>
Date: Wed, 17 May 2023 10:36:52 -0500
Subject: [PATCH v3 15/15] Add Meson overrides

Meson has the ability to do transparent overrides when projects are used
as subprojects. For instance, say I am building a Postgres extension. I
can define Postgres to be a subproject of my extension given the
following wrap file:

[wrap-git]
url = https://git.postgresql.org/git/postgresql.git
revision = master
depth = 1

[provide]
dependency_names = libpq

Then in my extension (root project), I can have the following line
snippet:

libpq = dependency('libpq')

This will tell Meson to transparently compile libpq prior to it
compiling my extension (because I depend on libpq) if libpq isn't found
on the host system.

I have also added overrides for the various public-facing exectuables.
Though I don't expect them to get much usage, might as well go ahead and
override them. They can be used by adding the following line to the
aforementioned wrap file:

program_names = initdb, postgres, ...

Then in my extension (root project), I can find them with the following
line:

initdb = find_program('initdb')

Again, initdb will be compiled transparently as my extension gets built
if and only if initdb isn't found on the host system.
---
 src/backend/meson.build                 | 2 ++
 src/bin/initdb/meson.build              | 2 ++
 src/bin/pg_amcheck/meson.build          | 2 ++
 src/bin/pg_archivecleanup/meson.build   | 2 ++
 src/bin/pg_basebackup/meson.build       | 6 ++++++
 src/bin/pg_checksums/meson.build        | 2 ++
 src/bin/pg_config/meson.build           | 2 ++
 src/bin/pg_controldata/meson.build      | 2 ++
 src/bin/pg_ctl/meson.build              | 2 ++
 src/bin/pg_dump/meson.build             | 6 ++++++
 src/bin/pg_resetwal/meson.build         | 2 ++
 src/bin/pg_rewind/meson.build           | 2 ++
 src/bin/pg_test_fsync/meson.build       | 2 ++
 src/bin/pg_test_timing/meson.build      | 2 ++
 src/bin/pg_upgrade/meson.build          | 2 ++
 src/bin/pg_verifybackup/meson.build     | 2 ++
 src/bin/pg_waldump/meson.build          | 2 ++
 src/bin/pgbench/meson.build             | 2 ++
 src/bin/psql/meson.build                | 2 ++
 src/bin/scripts/meson.build             | 6 ++++--
 src/interfaces/ecpg/preproc/meson.build | 2 ++
 src/interfaces/libpq/meson.build        | 2 ++
 22 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/src/backend/meson.build b/src/backend/meson.build
index ccfc382fcf..ac2f66d920 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -147,6 +147,8 @@ postgres = executable('postgres',
 
 backend_targets += postgres
 
+meson.override_find_program('postgres', postgres)
+
 pg_mod_c_args = cflags_mod
 pg_mod_cpp_args = cxxflags_mod
 pg_mod_link_args = ldflags_sl + ldflags_mod
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
index 49743630aa..12b4918e8b 100644
--- a/src/bin/initdb/meson.build
+++ b/src/bin/initdb/meson.build
@@ -23,6 +23,8 @@ initdb = executable('initdb',
 )
 bin_targets += initdb
 
+meson.override_find_program('initdb', initdb)
+
 tests += {
   'name': 'initdb',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
index 2ade5aba03..8694abbf07 100644
--- a/src/bin/pg_amcheck/meson.build
+++ b/src/bin/pg_amcheck/meson.build
@@ -17,6 +17,8 @@ pg_amcheck = executable('pg_amcheck',
 )
 bin_targets += pg_amcheck
 
+meson.override_find_program('pg_amcheck', pg_amcheck)
+
 tests += {
   'name': 'pg_amcheck',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
index 28349db58b..6eecb42b05 100644
--- a/src/bin/pg_archivecleanup/meson.build
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -17,6 +17,8 @@ pg_archivecleanup = executable('pg_archivecleanup',
 )
 bin_targets += pg_archivecleanup
 
+meson.override_find_program('pg_archivecleanup', pg_archivecleanup)
+
 tests += {
   'name': 'pg_archivecleanup',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
index c684622bfb..589c664163 100644
--- a/src/bin/pg_basebackup/meson.build
+++ b/src/bin/pg_basebackup/meson.build
@@ -37,6 +37,8 @@ pg_basebackup = executable('pg_basebackup',
 )
 bin_targets += pg_basebackup
 
+meson.override_find_program('pg_basebackup', pg_basebackup)
+
 
 pg_receivewal_sources = files(
   'pg_receivewal.c',
@@ -56,6 +58,8 @@ pg_receivewal = executable('pg_receivewal',
 )
 bin_targets += pg_receivewal
 
+meson.override_find_program('pg_receivewal', pg_receivewal)
+
 
 pg_recvlogical_sources = files(
   'pg_recvlogical.c',
@@ -75,6 +79,8 @@ pg_recvlogical = executable('pg_recvlogical',
 )
 bin_targets += pg_recvlogical
 
+meson.override_find_program('pg_recvlogical', pg_recvlogical)
+
 tests += {
   'name': 'pg_basebackup',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
index 5528526094..d54e76ae6c 100644
--- a/src/bin/pg_checksums/meson.build
+++ b/src/bin/pg_checksums/meson.build
@@ -18,6 +18,8 @@ pg_checksums = executable('pg_checksums',
 )
 bin_targets += pg_checksums
 
+meson.override_find_program('pg_checksums', pg_checksums)
+
 tests += {
   'name': 'pg_checksums',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
index 7fd7e94e2d..bea966f63e 100644
--- a/src/bin/pg_config/meson.build
+++ b/src/bin/pg_config/meson.build
@@ -17,6 +17,8 @@ pg_config = executable('pg_config',
 )
 bin_targets += pg_config
 
+meson.override_find_program('pg_config', pg_config)
+
 tests += {
   'name': 'pg_config',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
index 03c9d0ae3e..4521828b1f 100644
--- a/src/bin/pg_controldata/meson.build
+++ b/src/bin/pg_controldata/meson.build
@@ -17,6 +17,8 @@ pg_controldata = executable('pg_controldata',
 )
 bin_targets += pg_controldata
 
+meson.override_find_program('pg_controldata', pg_controldata)
+
 tests += {
   'name': 'pg_controldata',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
index 608a52f9fb..b62519c15f 100644
--- a/src/bin/pg_ctl/meson.build
+++ b/src/bin/pg_ctl/meson.build
@@ -17,6 +17,8 @@ pg_ctl = executable('pg_ctl',
 )
 bin_targets += pg_ctl
 
+meson.override_find_program('pg_ctl', pg_ctl)
+
 tests += {
   'name': 'pg_ctl',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 9d59a106f3..ae89758ef6 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -45,6 +45,8 @@ pg_dump = executable('pg_dump',
 )
 bin_targets += pg_dump
 
+meson.override_find_program('pg_dump', pg_dump)
+
 
 pg_dumpall_sources = files(
   'pg_dumpall.c',
@@ -64,6 +66,8 @@ pg_dumpall = executable('pg_dumpall',
 )
 bin_targets += pg_dumpall
 
+meson.override_find_program('pg_dumpall', pg_dumpall)
+
 
 pg_restore_sources = files(
   'pg_restore.c',
@@ -83,6 +87,8 @@ pg_restore = executable('pg_restore',
 )
 bin_targets += pg_restore
 
+meson.override_find_program('pg_restore', pg_restore)
+
 tests += {
   'name': 'pg_dump',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
index 3f08a819bb..e7d4ab3fa5 100644
--- a/src/bin/pg_resetwal/meson.build
+++ b/src/bin/pg_resetwal/meson.build
@@ -17,6 +17,8 @@ pg_resetwal = executable('pg_resetwal',
 )
 bin_targets += pg_resetwal
 
+meson.override_find_program('pg_resetwal', pg_resetwal)
+
 tests += {
   'name': 'pg_resetwal',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
index fd22818be4..23d698d8fd 100644
--- a/src/bin/pg_rewind/meson.build
+++ b/src/bin/pg_rewind/meson.build
@@ -27,6 +27,8 @@ pg_rewind = executable('pg_rewind',
 )
 bin_targets += pg_rewind
 
+meson.override_find_program('pg_rewind', pg_rewind)
+
 
 tests += {
   'name': 'pg_rewind',
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
index aaf65c310e..3a03156508 100644
--- a/src/bin/pg_test_fsync/meson.build
+++ b/src/bin/pg_test_fsync/meson.build
@@ -17,6 +17,8 @@ pg_test_fsync = executable('pg_test_fsync',
 )
 bin_targets += pg_test_fsync
 
+meson.override_find_program('pg_test_fsync', pg_test_fsync)
+
 tests += {
   'name': 'pg_test_fsync',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
index 02f4a5c641..8a5aa29135 100644
--- a/src/bin/pg_test_timing/meson.build
+++ b/src/bin/pg_test_timing/meson.build
@@ -17,6 +17,8 @@ pg_test_timing = executable('pg_test_timing',
 )
 bin_targets += pg_test_timing
 
+meson.override_find_program('pg_test_timing', pg_test_timing)
+
 tests += {
   'name': 'pg_test_timing',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index 12a97f84e2..3046b3f471 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -32,6 +32,8 @@ pg_upgrade = executable('pg_upgrade',
 )
 bin_targets += pg_upgrade
 
+meson.override_find_program('pg_upgrade', pg_upgrade)
+
 
 tests += {
   'name': 'pg_upgrade',
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
index 9369da1bc6..5b670fd3e5 100644
--- a/src/bin/pg_verifybackup/meson.build
+++ b/src/bin/pg_verifybackup/meson.build
@@ -18,6 +18,8 @@ pg_verifybackup = executable('pg_verifybackup',
 )
 bin_targets += pg_verifybackup
 
+meson.override_find_program('pg_verifybackup', pg_verifybackup)
+
 tests += {
   'name': 'pg_verifybackup',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index ae674d17c3..c03f212842 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -24,6 +24,8 @@ pg_waldump = executable('pg_waldump',
 )
 bin_targets += pg_waldump
 
+meson.override_find_program('pg_waldump', pg_waldump)
+
 tests += {
   'name': 'pg_waldump',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index e3c7619cf4..b8b46ef721 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -35,6 +35,8 @@ pgbench = executable('pgbench',
 )
 bin_targets += pgbench
 
+meson.override_find_program('pgbench', pgbench)
+
 tests += {
   'name': 'pgbench',
   'sd': meson.current_source_dir(),
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index a0a4ac7afb..cf20b3a7a4 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -53,6 +53,8 @@ psql = executable('psql',
 )
 bin_targets += psql
 
+meson.override_find_program('psql', psql)
+
 install_data('psqlrc.sample',
   install_dir: dir_data,
 )
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
index 5b4f8a6f85..fa16814710 100644
--- a/src/bin/scripts/meson.build
+++ b/src/bin/scripts/meson.build
@@ -26,13 +26,15 @@ foreach binary : binaries
       '--FILEDESC', '@0@ - PostgreSQL utility'.format(binary),])
   endif
 
-  binary = executable(binary,
+  exe = executable(binary,
     binary_sources,
     link_with: [scripts_common],
     dependencies: [frontend_code, libpq],
     kwargs: default_bin_args,
   )
-  bin_targets += binary
+  bin_targets += exe
+
+  meson.override_find_program(binary, exe)
 endforeach
 
 tests += {
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 08d772d261..f7c9f79c81 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -110,4 +110,6 @@ ecpg_exe = executable('ecpg',
 )
 ecpg_targets += ecpg_exe
 
+meson.override_find_program('ecpg', ecpg_exe)
+
 subdir('po', if_found: libintl)
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 80e6a15adf..6d18970e81 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -84,6 +84,8 @@ libpq = declare_dependency(
   include_directories: [include_directories('.')]
 )
 
+meson.override_dependency('libpq', libpq)
+
 pkgconfig.generate(
   name: 'libpq',
   description: 'PostgreSQL libpq library',
-- 
Tristan Partin
Neon (https://neon.tech)

Reply via email to