More patches:
I fixed the Perl detection issue in my macOS environment that I had
reported a while ago.
Then I added in support for all configure options that had not been
ported over yet. Some of these are rather trivial.
After that, these configure options don't have an equivalent yet:
--disable-rpath
--enable-profiling
--disable-thread-safety
--with-libedit-preferred
The first three overlap with meson built-in functionality, so we would
need to check whether the desired functionality is available somehow.
The last one we probably want to keep somehow; it would need a bit of
fiddly work.From fd05ad3f1582884aef2db162c2c7ba4897299078 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 11:08:07 +0200
Subject: [PATCH 1/9] meson: Fix Perl include dir detection
Only use -iwithsysroot if required. This aligns with the logic in
configure.ac.
---
meson.build | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/meson.build b/meson.build
index 5f8165df9c..7958e8eb19 100644
--- a/meson.build
+++ b/meson.build
@@ -591,8 +591,6 @@ else
perl_inc_dir = '@0@/CORE'.format(archlibexp)
- perl_ccflags = []
-
if useshrplib != 'true'
perl_may_work = false
perl_msg = 'need a shared perl'
@@ -606,9 +604,13 @@ else
# et al seeing them. So we can't use include_directories(), as that checks
# file existence.
if perl_may_work
- perl_ccflags += ['-I@0@'.format(perl_inc_dir)]
- if host_machine.system() == 'darwin'
- perl_ccflags += ['-iwithsysroot', perl_inc_dir]
+ # On most platforms, archlibexp is also where the Perl include files live
...
+ perl_ccflags = ['-I@0@'.format(perl_inc_dir)]
+ # ... but on newer macOS versions, we must use -iwithsysroot to look
+ # under sysroot
+ if not fs.is_file('@0@/perl.h'.format(perl_inc_dir)) and \
+ fs.is_file('@0@@1@/perl.h'.format(sysroot, perl_inc_dir))
+ perl_ccflags = ['-iwithsysroot', perl_inc_dir]
endif
endif
--
2.35.1
From 1429482c5d3e83a89915cc332be3b0d932c939cb Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 07:31:30 +0200
Subject: [PATCH 2/9] meson: Add pam option
---
meson.build | 26 +++++++++++++++++++++++++-
meson_options.txt | 3 +++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 7958e8eb19..a07e25c732 100644
--- a/meson.build
+++ b/meson.build
@@ -525,6 +525,29 @@ endif
+###############################################################
+# Library: pam
+###############################################################
+
+pamopt = get_option('pam')
+if not pamopt.disabled()
+ pam = cc.find_library('pam', dirs: g_c_lib, required: pamopt)
+ if pam.found()
+ if cc.has_header('security/pam_appl.h', args: g_c_args,
include_directories: g_c_inc)
+ cdata.set('HAVE_SECURITY_PAM_APPL_H', 1)
+ elif cc.has_header('pam/pam_appl.h', args: g_c_args, include_directories:
g_c_inc)
+ cdata.set('HAVE_PAM_PAM_APPL_H', 1)
+ else
+ error('pam header not found')
+ endif
+ endif
+else
+ pam = dependency('', required: false)
+endif
+cdata.set('USE_PAM', pam.found() ? 1 : false)
+
+
+
###############################################################
# Library: Tcl (for pltcl)
# tclConfig.sh
@@ -2143,7 +2166,7 @@ backend_code = declare_dependency(
include_directories: [postgres_inc],
link_with: [],
sources: generated_headers + generated_backend_headers,
- dependencies: [os_deps, libintl, ssl, lz4, zlib, icu, icu_i18n, ldap,
gssapi, libxml, zstd, systemd],
+ dependencies: [os_deps, libintl, ssl, lz4, zlib, icu, icu_i18n, ldap, pam,
gssapi, libxml, zstd, systemd],
)
# Note there's intentionally no dependency on pgport/common here - we want the
@@ -2485,6 +2508,7 @@ if meson.version().version_compare('>=0.57')
'llvm': llvm,
'lz4': lz4,
'nls' : libintl,
+ 'pam' : pam,
'perl': perl_dep,
'python3': python3_dep,
'readline': readline,
diff --git a/meson_options.txt b/meson_options.txt
index e3e36678d1..f57410fa50 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -74,6 +74,9 @@ option('lz4', type : 'feature', value: 'auto',
option('nls', type: 'feature', value: 'auto',
description: 'national language support')
+option('pam', type : 'feature', value: 'auto',
+ description: 'PAM support')
+
option('plperl', type : 'feature', value: 'auto',
description: 'build Perl modules (PL/Perl)')
--
2.35.1
From 049b34b6a8dd949f0eb7987cad65f6682a6ec786 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 09:06:13 +0200
Subject: [PATCH 3/9] meson: prereq: Refactor dtrace postprocessing make rules
Move the dtrace postprocessing sed commands into a separate file so
that it can be shared by meson. Also split the rule into two for
proper dependency declaration.
---
src/backend/utils/Makefile | 21 +++++++--------------
src/backend/utils/postprocess_dtrace.sed | 15 +++++++++++++++
2 files changed, 22 insertions(+), 14 deletions(-)
create mode 100644 src/backend/utils/postprocess_dtrace.sed
diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile
index b1820cd959..7bc58693f9 100644
--- a/src/backend/utils/Makefile
+++ b/src/backend/utils/Makefile
@@ -54,22 +54,15 @@ fmgr-stamp: Gen_fmgrtab.pl $(catalogdir)/Catalog.pm
$(top_srcdir)/src/include/ca
errcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes.pl
$(PERL) $(srcdir)/generate-errcodes.pl $< $@
-ifneq ($(enable_dtrace), yes)
-probes.h: Gen_dummy_probes.sed
-endif
-
-# We editorialize on dtrace's output to the extent of changing the macro
-# names (from POSTGRESQL_foo to TRACE_POSTGRESQL_foo) and changing any
-# "char *" arguments to "const char *".
-probes.h: probes.d
ifeq ($(enable_dtrace), yes)
- $(DTRACE) -C -h -s $< -o $@.tmp
- sed -e 's/POSTGRESQL_/TRACE_POSTGRESQL_/g' \
- -e 's/( *char \*/(const char */g' \
- -e 's/, *char \*/, const char */g' $@.tmp >$@
- rm $@.tmp
+probes.h: postprocess_dtrace.sed probes.h.tmp
+ sed -f $^ >$@
+
+probes.h.tmp: probes.d
+ $(DTRACE) -C -h -s $< -o $@
else
- sed -f $(srcdir)/Gen_dummy_probes.sed $< >$@
+probes.h: Gen_dummy_probes.sed probes.d
+ sed -f $^ >$@
endif
# These generated headers must be symlinked into builddir/src/include/,
diff --git a/src/backend/utils/postprocess_dtrace.sed
b/src/backend/utils/postprocess_dtrace.sed
new file mode 100644
index 0000000000..a68c30c75e
--- /dev/null
+++ b/src/backend/utils/postprocess_dtrace.sed
@@ -0,0 +1,15 @@
+#-------------------------------------------------------------------------
+# sed script to postprocess dtrace output
+#
+# Copyright (c) 2008-2022, PostgreSQL Global Development Group
+#
+# src/backend/utils/postprocess_dtrace.sed
+#-------------------------------------------------------------------------
+
+# We editorialize on dtrace's output to the extent of changing the macro
+# names (from POSTGRESQL_foo to TRACE_POSTGRESQL_foo) and changing any
+# "char *" arguments to "const char *".
+
+s/POSTGRESQL_/TRACE_POSTGRESQL_/g
+s/( *char \*/(const char */g
+s/, *char \*/, const char */g
--
2.35.1
From bf583cd5fdb7fecef8055dfa31ef2334cdd66fa6 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 09:06:39 +0200
Subject: [PATCH 4/9] meson: Add dtrace option
This currently only works on macOS. The dtrace -G calls needed on
other platforms are not implemented yet. Therefore, the option is not
auto by default.
---
meson.build | 1 +
meson_options.txt | 6 ++++++
src/include/utils/meson.build | 34 ++++++++++++++++++++++++++--------
3 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/meson.build b/meson.build
index a07e25c732..7cb2083936 100644
--- a/meson.build
+++ b/meson.build
@@ -162,6 +162,7 @@ program_lz4 = find_program(get_option('LZ4'), native: true,
required: false)
touch = find_program('touch', native: true)
sh = find_program('sh', native: true) # FIXME, should get rid of this
program_zstd = find_program(get_option('ZSTD'), native: true, required: false)
+dtrace = find_program(get_option('DTRACE'), required: get_option('dtrace'))
# Internal programs
testwrap = find_program('src/tools/testwrap', native: true)
diff --git a/meson_options.txt b/meson_options.txt
index f57410fa50..56440f81d0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -50,6 +50,9 @@ option('extra_lib_dirs', type : 'array', value: [],
# External dependencies
+option('dtrace', type : 'feature', value: 'disabled',
+ description: 'DTrace support')
+
option('gssapi', type : 'feature', value: 'auto',
description: 'GSSAPI support')
@@ -116,6 +119,9 @@ option('zstd', type : 'feature', value: 'auto',
option('BISON', type : 'string', value: 'bison',
description: 'path to bison binary')
+option('DTRACE', type : 'string', value: 'dtrace',
+ description: 'path to dtrace binary')
+
option('FLEX', type : 'string', value: 'flex',
description: 'path to flex binary')
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
index 6e1437f300..152a235b5c 100644
--- a/src/include/utils/meson.build
+++ b/src/include/utils/meson.build
@@ -7,14 +7,32 @@ errcodes = custom_target('errcodes',
)
generated_headers += errcodes
-generated_backend_headers += custom_target('probes.d',
- input: files('../../backend/utils/probes.d'),
- output : 'probes.h',
- capture: true,
- command : [sed, '-f', files('../../backend/utils/Gen_dummy_probes.sed'),
'@INPUT@'],
- install: true,
- install_dir: dir_include_server/'utils',
-)
+if dtrace.found()
+ probes_tmp = custom_target('probes.h.tmp',
+ input: files('../../backend/utils/probes.d'),
+ output : 'probes.h.tmp',
+ command : [dtrace, '-C', '-h', '-s', '@INPUT@', '-o', '@OUTPUT@'],
+ )
+ probes = custom_target('probes.h',
+ input: probes_tmp[0],
+ output : 'probes.h',
+ capture: true,
+ command : [sed, '-f', files('../../backend/utils/postprocess_dtrace.sed'),
'@INPUT@'],
+ install: true,
+ install_dir: dir_include_server/'utils',
+ )
+else
+ probes = custom_target('probes.h',
+ input: files('../../backend/utils/probes.d'),
+ output : 'probes.h',
+ capture: true,
+ command : [sed, '-f', files('../../backend/utils/Gen_dummy_probes.sed'),
'@INPUT@'],
+ install: true,
+ install_dir: dir_include_server/'utils',
+ )
+endif
+
+generated_backend_headers += probes
fmgrtab_target = custom_target('fmgrtab',
input: '../catalog/pg_proc.dat',
--
2.35.1
From c2599ec7f66c75c9c898fcf902dd3fc0209e42cb Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 09:29:23 +0200
Subject: [PATCH 5/9] meson: Add bonjour option
---
meson.build | 13 +++++++++++++
meson_options.txt | 3 +++
2 files changed, 16 insertions(+)
diff --git a/meson.build b/meson.build
index 7cb2083936..e724fcc345 100644
--- a/meson.build
+++ b/meson.build
@@ -305,6 +305,19 @@ dir_data_extension = dir_data / 'extension'
+###############################################################
+# Library: bonjour
+###############################################################
+
+bonjouropt = get_option('bonjour')
+if not bonjouropt.disabled()
+ if cc.has_header('dns_sd.h', args: g_c_args, include_directories: g_c_inc,
required: bonjouropt.enabled())
+ cdata.set('USE_BONJOUR', 1)
+ endif
+endif
+
+
+
###############################################################
# Library: GSSAPI
###############################################################
diff --git a/meson_options.txt b/meson_options.txt
index 56440f81d0..cbef629ca0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -50,6 +50,9 @@ option('extra_lib_dirs', type : 'array', value: [],
# External dependencies
+option('bonjour', type : 'feature', value: 'auto',
+ description: 'Bonjour support')
+
option('dtrace', type : 'feature', value: 'disabled',
description: 'DTrace support')
--
2.35.1
From 2845c3f08a7e8eba5a41f2e474ffbeb5d5eadea2 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 09:37:28 +0200
Subject: [PATCH 6/9] meson: Add bsd-auth option
---
meson.build | 13 +++++++++++++
meson_options.txt | 3 +++
2 files changed, 16 insertions(+)
diff --git a/meson.build b/meson.build
index e724fcc345..7c9c6e7f23 100644
--- a/meson.build
+++ b/meson.build
@@ -318,6 +318,19 @@ endif
+###############################################################
+# Library: bsd-auth
+###############################################################
+
+bsdauthopt = get_option('bsd-auth')
+if not bsdauthopt.disabled()
+ if cc.has_header('bsd_auth.h', args: g_c_args, include_directories: g_c_inc,
required: bsdauthopt.enabled())
+ cdata.set('USE_BSD_AUTH', 1)
+ endif
+endif
+
+
+
###############################################################
# Library: GSSAPI
###############################################################
diff --git a/meson_options.txt b/meson_options.txt
index cbef629ca0..892ef117ee 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -53,6 +53,9 @@ option('extra_lib_dirs', type : 'array', value: [],
option('bonjour', type : 'feature', value: 'auto',
description: 'Bonjour support')
+option('bsd-auth', type : 'feature', value: 'auto',
+ description: 'BSD Authentication support')
+
option('dtrace', type : 'feature', value: 'disabled',
description: 'DTrace support')
--
2.35.1
From fad02f1fb71ec8c64e47e5031726ffbee4a1dd84 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 09:53:01 +0200
Subject: [PATCH 7/9] meson: Add system-tzdata option
---
meson.build | 3 +++
meson_options.txt | 3 +++
2 files changed, 6 insertions(+)
diff --git a/meson.build b/meson.build
index 7c9c6e7f23..b33a51a35d 100644
--- a/meson.build
+++ b/meson.build
@@ -246,6 +246,9 @@ cdata.set('RELSEG_SIZE', get_option('segsize') * 131072)
cdata.set('DEF_PGPORT', get_option('pgport'))
cdata.set_quoted('DEF_PGPORT_STR', get_option('pgport'))
cdata.set_quoted('PG_KRB_SRVNAM', 'postgres')
+if get_option('system-tzdata') != ''
+ cdata.set_quoted('SYSTEMTZDIR', get_option('system-tzdata'))
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 892ef117ee..250d758ded 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -20,6 +20,9 @@ option('pgport', type : 'string', value : '5432',
description : '''Default port number for server and clients.
The default is 5432. The port can always be changed later on, but if you
specify it here then both server and clients will have the same default
compiled in, which can be very convenient. Usually the only good reason to
select a non-default value is if you intend to run multiple PostgreSQL servers
on the same machine.''')
+option('system-tzdata', type: 'string', value: '',
+ description: 'use system time zone data in specified directory')
+
# Developer options
--
2.35.1
From 7c5c35a5ceff42dcd64e7a78f63ce2cdfc46d856 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 09:57:18 +0200
Subject: [PATCH 8/9] meson: Add krb-srvnam option
---
meson.build | 2 +-
meson_options.txt | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index b33a51a35d..8a372282ff 100644
--- a/meson.build
+++ b/meson.build
@@ -245,7 +245,7 @@ cdata.set('XLOG_BLCKSZ', get_option('wal-blocksize') * 1024)
cdata.set('RELSEG_SIZE', get_option('segsize') * 131072)
cdata.set('DEF_PGPORT', get_option('pgport'))
cdata.set_quoted('DEF_PGPORT_STR', get_option('pgport'))
-cdata.set_quoted('PG_KRB_SRVNAM', 'postgres')
+cdata.set_quoted('PG_KRB_SRVNAM', get_option('krb-srvnam'))
if get_option('system-tzdata') != ''
cdata.set_quoted('SYSTEMTZDIR', get_option('system-tzdata'))
endif
diff --git a/meson_options.txt b/meson_options.txt
index 250d758ded..d4a7500306 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,9 @@ Large tables are divided into multiple operating-system
files, each of size equa
# Defaults
+option('krb-srvnam', type: 'string', value: 'postgres',
+ description: 'default service principal name in Kerberos (GSSAPI)')
+
option('pgport', type : 'string', value : '5432',
description : '''Default port number for server and clients.
The default is 5432. The port can always be changed later on, but if you
specify it here then both server and clients will have the same default
compiled in, which can be very convenient. Usually the only good reason to
select a non-default value is if you intend to run multiple PostgreSQL servers
on the same machine.''')
--
2.35.1
From 55e92f039526d9c6d01f0be1a4ad34e64d7e01b9 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 11 May 2022 10:04:50 +0200
Subject: [PATCH 9/9] meson: Add extra-version option
---
meson.build | 1 +
meson_options.txt | 3 +++
2 files changed, 4 insertions(+)
diff --git a/meson.build b/meson.build
index 8a372282ff..a2680f5a1a 100644
--- a/meson.build
+++ b/meson.build
@@ -79,6 +79,7 @@ cdata.set_quoted('PACKAGE_NAME', 'PostgreSQL')
cdata.set_quoted('PACKAGE_BUGREPORT', 'pgsql-b...@lists.postgresql.org')
cdata.set_quoted('PACKAGE_URL', pg_url)
+pg_version += get_option('extra-version')
cdata.set_quoted('PG_VERSION', pg_version)
cdata.set_quoted('PG_VERSION_STR', 'PostgreSQL @0@ on @1@, compiled by
@2@-@3@'.format(
pg_version, target_machine.cpu_family(), cc.get_id(), cc.version()))
diff --git a/meson_options.txt b/meson_options.txt
index d4a7500306..3cc211b39d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,9 @@ Large tables are divided into multiple operating-system
files, each of size equa
# Defaults
+option('extra-version', type: 'string', value: '',
+ description: 'Append string to version.')
+
option('krb-srvnam', type: 'string', value: 'postgres',
description: 'default service principal name in Kerberos (GSSAPI)')
--
2.35.1