More patches:
0001-meson-Assorted-compiler-test-tweaks.patch
I was going through a diff of pg_config.h between old and new build and
found a few omissions and small differences.
Some of the
blah ? 1 : false
is of course annoying and can be removed eventually, but it's useful
when analyzing the diff, and since it's already done in other places it
seems reasonable to apply it consistently.
Of course there is some more work left for some of the more complicated
tests; this isn't meant to be complete.
0002-meson-Add-pg_walinspect.patch
This was added more recently and was not ported yet. Nothing too
interesting here.
0003-meson-Install-all-server-headers.patch
With this, all the server headers installed by a makefile-based build
are installed. I tried to strike a balance between using
install_subdir() with exclude list versus listing things explicitly.
Different variations might be possible, but this looked pretty sensible
to me.
With these patches, the list of files installed with make versus meson
match up, except for known open items (postmaster symlink, some library
naming differences, pkgconfig, pgxs, test modules installed, documentation).From c3f4f4f8002e473284587d21f89cb66364365a26 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 4 May 2022 09:54:36 +0200
Subject: [PATCH 1/3] meson: Assorted compiler test tweaks
---
meson.build | 46 +++++++++++++++++++++++++++++++++++++---------
1 file changed, 37 insertions(+), 9 deletions(-)
diff --git a/meson.build b/meson.build
index 80af8e13da..27bc9dcd48 100644
--- a/meson.build
+++ b/meson.build
@@ -222,7 +222,7 @@ meson_bin = find_program(meson_binpath, native: true)
# Option Handling
###############################################################
-cdata.set('USE_ASSERT_CHECKING', get_option('cassert'))
+cdata.set('USE_ASSERT_CHECKING', get_option('cassert') ? 1 : false)
cdata.set('BLCKSZ', 8192, description: '''
Size of a disk block --- this also limits the size of a tuple. You
@@ -241,7 +241,7 @@ cdata.set('BLCKSZ', 8192, description: '''
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', '5432')
+cdata.set_quoted('DEF_PGPORT_STR', get_option('pgport'))
cdata.set_quoted('PG_KRB_SRVNAM', 'postgres')
@@ -870,8 +870,6 @@ if get_option('ssl') == 'openssl'
ssl_int = [ssl]
endif
- cdata.set_quoted('WITH_SSL', get_option('ssl'))
-
check_funcs = [
['CRYPTO_new_ex_data', {'required': true}],
['SSL_new', {'required': true}],
@@ -1381,7 +1379,7 @@ int main(void)
cdata.set(check['name'],
cc.links(test,
name: check['desc'],
- args: g_c_args + ['-DINT64=@0@'.format(cdata.get('PG_INT64_TYPE'))])
+ args: g_c_args + ['-DINT64=@0@'.format(cdata.get('PG_INT64_TYPE'))]) ?
1 : false
)
endforeach
@@ -1609,7 +1607,8 @@ endif
if cc.has_member('struct sockaddr_storage', 'ss_family',
args: g_c_args, include_directories: g_c_inc,
- prefix: '''#include <sys/types.h>
+ prefix: '''
+#include <sys/types.h>
#include <sys/socket.h>''')
cdata.set('HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY', 1)
endif
@@ -1622,6 +1621,30 @@ if cc.has_member('struct sockaddr_storage',
'__ss_family',
cdata.set('HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY', 1)
endif
+if cc.has_member('struct sockaddr_storage', 'ss_len',
+ args: g_c_args, include_directories: g_c_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/socket.h>''')
+ cdata.set('HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN', 1)
+endif
+
+if cc.has_member('struct sockaddr_storage', '__ss_len',
+ args: g_c_args, include_directories: g_c_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/socket.h>''')
+ cdata.set('HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN', 1)
+endif
+
+if cc.has_member('struct sockaddr', 'sa_len',
+ args: g_c_args, include_directories: g_c_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/socket.h>''')
+ cdata.set('HAVE_STRUCT_SOCKADDR_SA_LEN', 1)
+endif
+
if cc.has_type('struct sockaddr_un',
args: g_c_args, include_directories: g_c_inc,
prefix: '''
@@ -1701,10 +1724,10 @@ endif
# needs xlocale.h; standard is locale.h, but glibc also has an
# xlocale.h file that we should not use.
if cc.has_type('locale_t', prefix: '#include <locale.h>')
- cdata.set('HAVE_LOCALE_T', true)
+ cdata.set('HAVE_LOCALE_T', 1)
elif cc.has_type('locale_t', prefix: '#include <xlocale.h>')
- cdata.set('HAVE_LOCALE_T', true)
- cdata.set('LOCALE_T_IN_XLOCALE', true)
+ cdata.set('HAVE_LOCALE_T', 1)
+ cdata.set('LOCALE_T_IN_XLOCALE', 1)
endif
# MSVC doesn't cope well with defining restrict to __restrict, the
@@ -1781,6 +1804,7 @@ func_checks = [
['getrusage'],
['gettimeofday'], # XXX: This seems to be in the autoconf case
['inet_aton'],
+ ['inet_pton'],
['kqueue'],
['link'],
['mbstowcs_l'],
@@ -1852,6 +1876,10 @@ foreach c : func_checks
endforeach
+if cc.has_function('syslog', args: g_c_args) and cc.check_header('syslog.h',
args: g_c_args)
+ cdata.set('HAVE_SYSLOG', 1)
+endif
+
--
2.35.1
From 258c06186b7a4b9beabde33eb3677dbc89117418 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 4 May 2022 12:21:03 +0200
Subject: [PATCH 2/3] meson: Add pg_walinspect
---
contrib/meson.build | 1 +
contrib/pg_walinspect/meson.build | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
create mode 100644 contrib/pg_walinspect/meson.build
diff --git a/contrib/meson.build b/contrib/meson.build
index 09c0f8ab03..84752d4bd0 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -48,6 +48,7 @@ subdir('pgstattuple')
subdir('pg_surgery')
subdir('pg_trgm')
subdir('pg_visibility')
+subdir('pg_walinspect')
subdir('postgres_fdw')
subdir('seg')
subdir('sepgsql')
diff --git a/contrib/pg_walinspect/meson.build
b/contrib/pg_walinspect/meson.build
new file mode 100644
index 0000000000..7977d4b1bb
--- /dev/null
+++ b/contrib/pg_walinspect/meson.build
@@ -0,0 +1,24 @@
+pg_walinspect = shared_module('pg_walinspect',
+ files('pg_walinspect.c'),
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'],
+ },
+)
+
+install_data(
+ 'pg_walinspect.control',
+ 'pg_walinspect--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_walinspect',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_walinspect',
+ ],
+ 'regress_args': ['--temp-config', files('walinspect.conf')],
+ },
+}
--
2.35.1
From ecb38fbf49cec66ec4eb77cb4fba0fac0df1241f Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pe...@eisentraut.org>
Date: Wed, 4 May 2022 12:22:02 +0200
Subject: [PATCH 3/3] meson: Install all server headers
---
contrib/cube/meson.build | 5 +++
contrib/hstore/meson.build | 5 +++
contrib/isn/meson.build | 5 +++
contrib/ltree/meson.build | 5 +++
contrib/seg/meson.build | 5 +++
meson.build | 1 +
src/include/meson.build | 64 +++++++++++++++++++++++++++++++++--
src/include/utils/meson.build | 12 +++++--
src/pl/plperl/meson.build | 7 ++++
src/pl/plpython/meson.build | 17 ++++++++++
10 files changed, 121 insertions(+), 5 deletions(-)
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
index cb6ebf481b..e15a56f257 100644
--- a/contrib/cube/meson.build
+++ b/contrib/cube/meson.build
@@ -31,6 +31,11 @@ install_data(
kwargs: contrib_data_args,
)
+install_headers(
+ 'cubedata.h',
+ install_dir: dir_include_extension / 'cube',
+)
+
tests += {
'name': 'cube',
'sd': meson.current_source_dir(),
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 3026fe95e8..3aed37ce8e 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -27,6 +27,11 @@ install_data(
kwargs: contrib_data_args,
)
+install_headers(
+ 'hstore.h',
+ install_dir: dir_include_extension / 'hstore',
+)
+
tests += {
'name': 'hstore',
'sd': meson.current_source_dir(),
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
index 8178c1450d..508e2dfa08 100644
--- a/contrib/isn/meson.build
+++ b/contrib/isn/meson.build
@@ -15,6 +15,11 @@ install_data(
kwargs: contrib_data_args,
)
+install_headers(
+ 'isn.h',
+ install_dir: dir_include_extension / 'isn',
+)
+
tests += {
'name': 'isn',
'sd': meson.current_source_dir(),
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
index e2ab05ddba..222c64bb35 100644
--- a/contrib/ltree/meson.build
+++ b/contrib/ltree/meson.build
@@ -26,6 +26,11 @@ install_data(
kwargs: contrib_data_args,
)
+install_headers(
+ 'ltree.h',
+ install_dir: dir_include_extension / 'ltree',
+)
+
tests += {
'name': 'ltree',
'sd': meson.current_source_dir(),
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
index 21561f6651..10e9b8562b 100644
--- a/contrib/seg/meson.build
+++ b/contrib/seg/meson.build
@@ -30,6 +30,11 @@ install_data(
kwargs: contrib_data_args,
)
+install_headers(
+ 'segdata.h',
+ install_dir: dir_include_extension / 'seg',
+)
+
tests += {
'name': 'seg',
'sd': meson.current_source_dir(),
diff --git a/meson.build b/meson.build
index 27bc9dcd48..70951efeb4 100644
--- a/meson.build
+++ b/meson.build
@@ -297,6 +297,7 @@ dir_locale = get_option('localedir')
dir_bitcode = dir_lib / 'bitcode'
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'
diff --git a/src/include/meson.build b/src/include/meson.build
index 2f27d6f33e..e5ce901e9a 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -68,10 +68,23 @@ install_headers(
install_headers(
'c.h',
- 'port.h',
- 'postgres_fe.h',
+ 'fmgr.h',
+ 'funcapi.h',
+ 'getaddrinfo.h',
+ 'getopt_long.h',
+ 'miscadmin.h',
'pg_config_manual.h',
+ 'pg_getopt.h',
+ 'pg_trace.h',
+ 'pgstat.h',
+ 'pgtar.h',
+ 'pgtime.h',
+ 'port.h',
+ 'postgres.h',
'postgres_ext.h',
+ 'postgres_fe.h',
+ 'rusagestub.h',
+ 'windowapi.h',
pg_config_ext,
pg_config_os,
pg_config,
@@ -83,3 +96,50 @@ subdir('storage')
subdir('catalog')
subdir('parser')
subdir('pch')
+
+foreach d : [
+ 'access', 'bootstrap', 'commands', 'common', 'datatype',
+ 'executor', 'fe_utils', 'foreign', 'jit',
+ 'lib', 'libpq', 'mb', 'nodes', 'optimizer', 'parser', 'partitioning',
'postmaster',
+ 'regex', 'replication', 'rewrite',
+ 'statistics', 'storage', 'tcop', 'snowball', 'tsearch',
+ 'utils', 'port', 'portability',
+]
+ install_subdir(d, install_dir: dir_include_server,
+ exclude_files: ['.gitignore', 'meson.build'])
+endforeach
+
+install_subdir('catalog', install_dir: dir_include_server,
+ exclude_files: [
+ '.gitignore',
+ 'Makefile',
+ 'duplicate_oids',
+ 'meson.build',
+ 'pg_aggregate.dat',
+ 'pg_am.dat',
+ 'pg_amop.dat',
+ 'pg_amproc.dat',
+ 'pg_authid.dat',
+ 'pg_cast.dat',
+ 'pg_class.dat',
+ 'pg_collation.dat',
+ 'pg_conversion.dat',
+ 'pg_database.dat',
+ 'pg_language.dat',
+ 'pg_namespace.dat',
+ 'pg_opclass.dat',
+ 'pg_operator.dat',
+ 'pg_opfamily.dat',
+ 'pg_proc.dat',
+ 'pg_range.dat',
+ 'pg_tablespace.dat',
+ 'pg_ts_config.dat',
+ 'pg_ts_config_map.dat',
+ 'pg_ts_dict.dat',
+ 'pg_ts_parser.dat',
+ 'pg_ts_template.dat',
+ 'pg_type.dat',
+ 'reformat_dat_file.pl',
+ 'renumber_oids.pl',
+ 'unused_oids',
+ ])
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
index b9c959b474..6e1437f300 100644
--- a/src/include/utils/meson.build
+++ b/src/include/utils/meson.build
@@ -1,7 +1,9 @@
errcodes = custom_target('errcodes',
input : files('../../backend/utils/errcodes.txt'),
output : ['errcodes.h'],
- command : [perl, files('../../backend/utils/generate-errcodes.pl'),
'@INPUT@', '@OUTPUT@']
+ command : [perl, files('../../backend/utils/generate-errcodes.pl'),
'@INPUT@', '@OUTPUT@'],
+ install: true,
+ install_dir: dir_include_server/'utils',
)
generated_headers += errcodes
@@ -9,13 +11,17 @@ 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@']
+ command : [sed, '-f', files('../../backend/utils/Gen_dummy_probes.sed'),
'@INPUT@'],
+ install: true,
+ install_dir: dir_include_server/'utils',
)
fmgrtab_target = custom_target('fmgrtab',
input: '../catalog/pg_proc.dat',
output : ['fmgroids.h', 'fmgrprotos.h', 'fmgrtab.c'],
- command: [perl, '-I', '@SOURCE_ROOT@/src/backend/catalog/',
files('../../backend/utils/Gen_fmgrtab.pl'),
'--include-path=@SOURCE_ROOT@/src/include', '--output=@OUTDIR@', '@INPUT@']
+ command: [perl, '-I', '@SOURCE_ROOT@/src/backend/catalog/',
files('../../backend/utils/Gen_fmgrtab.pl'),
'--include-path=@SOURCE_ROOT@/src/include', '--output=@OUTDIR@', '@INPUT@'],
+ install: true,
+ install_dir: [dir_include_server/'utils', dir_include_server/'utils', false],
)
generated_backend_headers += fmgrtab_target[0]
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 9f0ad97936..4b14c556c2 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -60,6 +60,13 @@ install_data(
install_dir: dir_data_extension,
)
+install_headers(
+ 'plperl.h',
+ 'plperl_helpers.h',
+ 'ppport.h',
+ install_dir: dir_include_server,
+)
+
tests += {
'name': 'plperl',
'sd': meson.current_source_dir(),
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index dd5f8838e2..449654914d 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -44,6 +44,23 @@ install_data(
install_dir: dir_data_extension,
)
+install_headers(
+ 'plpy_cursorobject.h',
+ 'plpy_elog.h',
+ 'plpy_exec.h',
+ 'plpy_main.h',
+ 'plpy_planobject.h',
+ 'plpy_plpymodule.h',
+ 'plpy_procedure.h',
+ 'plpy_resultobject.h',
+ 'plpy_spi.h',
+ 'plpy_subxactobject.h',
+ 'plpy_typeio.h',
+ 'plpy_util.h',
+ 'plpython.h',
+ install_dir: dir_include_server,
+)
+
plpython_regress = [
'plpython_schema',
'plpython_populate',
--
2.35.1