pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [RFC] building postgres with meson - v13
81+ messages / 13 participants
[nested] [flat]
* Re: [RFC] building postgres with meson - v13
@ 2022-09-15 02:26 Andres Freund <andres@anarazel.de>
0 siblings, 3 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-15 02:26 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@gmail.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; +Cc: pgsql-hackers
Hi,
Attached is v13 of the meson patchset. The biggest changes are:
- fix for the occasional ecpg.c crashes - which turned out to be crashes of
python, which in turn likely are due to a bug in the windows CRT
- split out and improved the patch to add resource files on windows. This
doesn't yet add them to all binaries, but I think the infrastructure looks
better now, and there's no duplicated win32ver.rc anymore.
- several rebasing adjustments, most notably the parser stuff and the
introduction of postgresql-full.xml
- improved structure of docs, based on Peter's review (Samay)
- generation of proper dependencies for xmllint/xsltproc, by parsing xsltproc
--load-trace. Previously the meson build didn't rebuild docs properly (meson
doesn't have "glob-style" dependencies). (Bilal)
- numerous small improvements and fixes
- added a patch to drop DLLTOOL/DLLWRAP from configure.ac / Makefile.global.in
- we've removed the use of them in 2014. This way the pgxs emulation doesn't
need to care.
- noticed that libpgport.a had and needed a dependency on errcodes.h - that
seemed wrong. The dependency is due to src/port/*p{read,write}v?.c including
postgres.h - which seems wrong. So I added a patch changing them to include
c.h.
One thing I just realized is that the existing autoconf/make and
src/tools/msvc buildsystems don't generate static libraries for e.g. libpq. So
far the meson build generates both static and shared libraries on windows
too.
Meson solves the naming conflict that presumably lead to us not generating
static libraries on windows by naming the link library for dlls's differently
than static libraries.
I'm inclined to build the static lib on windows as long as we do it on other
platforms.
Greetings,
Andres Freund
Attachments:
[text/x-diff] v13-0001-Remove-DLLTOOL-DLLWRAP-from-configure-Makefile.g.patch (7.1K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/2-v13-0001-Remove-DLLTOOL-DLLWRAP-from-configure-Makefile.g.patch)
download | inline diff:
From b7d7fe009731b5cfd6b6f97c6774dd4f7841e345 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 30 Aug 2022 15:33:43 -0700
Subject: [PATCH v13 01/20] Remove DLLTOOL, DLLWRAP from configure /
Makefile.global.in
We got rid of the need for them in 4f5f485d10c and 846e91e0223.
---
configure | 186 -----------------------------------------
configure.ac | 2 -
src/Makefile.global.in | 2 -
3 files changed, 190 deletions(-)
diff --git a/configure b/configure
index f325bd85b88..aee8a0d3579 100755
--- a/configure
+++ b/configure
@@ -688,8 +688,6 @@ INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
WINDRES
-DLLWRAP
-DLLTOOL
AR
STRIP_SHARED_LIB
STRIP_STATIC_LIB
@@ -9769,190 +9767,6 @@ else
fi
if test "$PORTNAME" = "win32"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
- ac_ct_DLLTOOL=$DLLTOOL
- # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DLLTOOL"; then
- ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DLLTOOL="dlltool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_DLLTOOL" = x; then
- DLLTOOL="dlltool"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- DLLTOOL=$ac_ct_DLLTOOL
- fi
-else
- DLLTOOL="$ac_cv_prog_DLLTOOL"
-fi
-
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}dllwrap", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dllwrap; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLWRAP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$DLLWRAP"; then
- ac_cv_prog_DLLWRAP="$DLLWRAP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DLLWRAP="${ac_tool_prefix}dllwrap"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLWRAP=$ac_cv_prog_DLLWRAP
-if test -n "$DLLWRAP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLWRAP" >&5
-$as_echo "$DLLWRAP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLWRAP"; then
- ac_ct_DLLWRAP=$DLLWRAP
- # Extract the first word of "dllwrap", so it can be a program name with args.
-set dummy dllwrap; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLWRAP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DLLWRAP"; then
- ac_cv_prog_ac_ct_DLLWRAP="$ac_ct_DLLWRAP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DLLWRAP="dllwrap"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLWRAP=$ac_cv_prog_ac_ct_DLLWRAP
-if test -n "$ac_ct_DLLWRAP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLWRAP" >&5
-$as_echo "$ac_ct_DLLWRAP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_DLLWRAP" = x; then
- DLLWRAP="dllwrap"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- DLLWRAP=$ac_ct_DLLWRAP
- fi
-else
- DLLWRAP="$ac_cv_prog_DLLWRAP"
-fi
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
set dummy ${ac_tool_prefix}windres; ac_word=$2
diff --git a/configure.ac b/configure.ac
index 7792ae5bad3..33634ccad9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1128,8 +1128,6 @@ AC_PROG_RANLIB
PGAC_CHECK_STRIP
AC_CHECK_TOOL(AR, ar, ar)
if test "$PORTNAME" = "win32"; then
- AC_CHECK_TOOL(DLLTOOL, dlltool, dlltool)
- AC_CHECK_TOOL(DLLWRAP, dllwrap, dllwrap)
AC_CHECK_TOOL(WINDRES, windres, windres)
fi
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 5664c645f82..0963c6d6395 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -284,8 +284,6 @@ ZIC = @ZIC@
# Linking
AR = @AR@
-DLLTOOL = @DLLTOOL@
-DLLWRAP = @DLLWRAP@
LIBS = @LIBS@
LDAP_LIBS_FE = @LDAP_LIBS_FE@
LDAP_LIBS_BE = @LDAP_LIBS_BE@
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0002-Don-t-hardcode-tmp_check-as-test-directory-for-t.patch (6.9K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/3-v13-0002-Don-t-hardcode-tmp_check-as-test-directory-for-t.patch)
download | inline diff:
From 979f2688954477c235cdca5e669b8a95c5597318 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Thu, 11 Aug 2022 08:57:58 -0700
Subject: [PATCH v13 02/20] Don't hardcode tmp_check/ as test directory for tap
tests
This is motivated by the meson patchset, which wants to put the log / data for
tests in a different place than the autoconf build. Right now log files for
tap tests have to be inside $TESTDIR/tmp_check, whereas log files for
pg_regress/isolationtester are outside of tmp_check. This change doesn't fix
the latter, but is a prerequisite.
The only test that needs adjustment is 010_tab_completion.pl, as it hardcoded
the tmp_check/ directory. Instead create a dedicated directory for the test
files. It's also a bit cleaner independently, because it doesn't intermingle
the test files with more important things like the log/ directory.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1131990.1660661896@sss.pgh.pa.us
---
src/bin/psql/t/010_tab_completion.pl | 33 +++++++++++++-------------
src/test/perl/PostgreSQL/Test/Utils.pm | 2 +-
src/Makefile.global.in | 6 ++---
src/tools/msvc/vcregress.pl | 2 +-
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index 2eea515e871..cb36e8e4811 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -68,7 +68,7 @@ delete $ENV{LS_COLORS};
# In a VPATH build, we'll be started in the source directory, but we want
# to run in the build directory so that we can use relative paths to
-# access the tmp_check subdirectory; otherwise the output from filename
+# access the tab_comp_dir subdirectory; otherwise the output from filename
# completion tests is too variable.
if ($ENV{TESTDIR})
{
@@ -76,17 +76,18 @@ if ($ENV{TESTDIR})
}
# Create some junk files for filename completion testing.
+mkdir "tab_comp_dir";
my $FH;
-open $FH, ">", "tmp_check/somefile"
- or die("could not create file \"tmp_check/somefile\": $!");
+open $FH, ">", "tab_comp_dir/somefile"
+ or die("could not create file \"tab_comp_dir/somefile\": $!");
print $FH "some stuff\n";
close $FH;
-open $FH, ">", "tmp_check/afile123"
- or die("could not create file \"tmp_check/afile123\": $!");
+open $FH, ">", "tab_comp_dir/afile123"
+ or die("could not create file \"tab_comp_dir/afile123\": $!");
print $FH "more stuff\n";
close $FH;
-open $FH, ">", "tmp_check/afile456"
- or die("could not create file \"tmp_check/afile456\": $!");
+open $FH, ">", "tab_comp_dir/afile456"
+ or die("could not create file \"tab_comp_dir/afile456\": $!");
print $FH "other stuff\n";
close $FH;
@@ -272,16 +273,16 @@ clear_query();
# check filename completion
check_completion(
- "\\lo_import tmp_check/some\t",
- qr|tmp_check/somefile |,
+ "\\lo_import tab_comp_dir/some\t",
+ qr|tab_comp_dir/somefile |,
"filename completion with one possibility");
clear_query();
# note: readline might print a bell before the completion
check_completion(
- "\\lo_import tmp_check/af\t",
- qr|tmp_check/af\a?ile|,
+ "\\lo_import tab_comp_dir/af\t",
+ qr|tab_comp_dir/af\a?ile|,
"filename completion with multiple possibilities");
# broken versions of libedit require clear_line not clear_query here
@@ -291,15 +292,15 @@ clear_line();
# note: broken versions of libedit want to backslash the closing quote;
# not much we can do about that
check_completion(
- "COPY foo FROM tmp_check/some\t",
- qr|'tmp_check/somefile\\?' |,
+ "COPY foo FROM tab_comp_dir/some\t",
+ qr|'tab_comp_dir/somefile\\?' |,
"quoted filename completion with one possibility");
clear_line();
check_completion(
- "COPY foo FROM tmp_check/af\t",
- qr|'tmp_check/afile|,
+ "COPY foo FROM tab_comp_dir/af\t",
+ qr|'tab_comp_dir/afile|,
"quoted filename completion with multiple possibilities");
# some versions of readline/libedit require two tabs here, some only need one
@@ -307,7 +308,7 @@ check_completion(
# the quotes might appear, too
check_completion(
"\t\t",
- qr|afile123'? +'?(tmp_check/)?afile456|,
+ qr|afile123'? +'?(tab_comp_dir/)?afile456|,
"offer multiple file choices");
clear_line();
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 1ca2cc59170..88a472f2442 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -192,7 +192,7 @@ INIT
# Determine output directories, and create them. The base path is the
# TESTDIR environment variable, which is normally set by the invoking
# Makefile.
- $tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}/tmp_check" : "tmp_check";
+ $tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}" : "tmp_check";
$log_path = "$tmp_check/log";
mkdir $tmp_check;
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 0963c6d6395..606a2a6f172 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -451,7 +451,7 @@ echo "+++ tap install-check in $(subdir) +++" && \
rm -rf '$(CURDIR)'/tmp_check && \
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
cd $(srcdir) && \
- TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
+ TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
@@ -462,7 +462,7 @@ echo "+++ tap install-check in $(subdir) +++" && \
rm -rf '$(CURDIR)'/tmp_check && \
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
cd $(srcdir) && \
- TESTDIR='$(CURDIR)' PATH="$(bindir):$(CURDIR):$$PATH" \
+ TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \
PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
@@ -474,7 +474,7 @@ echo "+++ tap check in $(subdir) +++" && \
rm -rf '$(CURDIR)'/tmp_check && \
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
cd $(srcdir) && \
- TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
+ TESTDIR='$(CURDIR)/tmp_check' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
endef
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index c3729f6be5e..da152da8e5f 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -291,7 +291,7 @@ sub tap_check
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
- $ENV{TESTDIR} = "$dir";
+ $ENV{TESTDIR} = "$dir/tmp_check";
my $module = basename $dir;
# add the module build dir as the second element in the PATH
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0003-Split-TESTDIR-into-TESTLOGDIR-and-TESTDATADIR.patch (5.0K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/4-v13-0003-Split-TESTDIR-into-TESTLOGDIR-and-TESTDATADIR.patch)
download | inline diff:
From 9fc657fbb7e2970d4fdee668fc878ad8f47d60bb Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 15 Aug 2022 19:49:44 -0700
Subject: [PATCH v13 03/20] Split TESTDIR into TESTLOGDIR and TESTDATADIR
The motivation for this is twofold. For one the meson patchset would like to
have more control over the logfiles. For another, the log file location for
tap tests (tmp_check/log) is not symmetric to the log location for
pg_regress/isolation tests (log/).
This commit does not change the default location for log files for tap tests,
as that'd break the buildfarm log collection, it just provides the
infrastructure for doing so.
---
src/bin/psql/t/010_tab_completion.pl | 4 ++--
src/test/perl/PostgreSQL/Test/Utils.pm | 10 +++++-----
src/Makefile.global.in | 13 ++++++++++---
src/tools/msvc/vcregress.pl | 4 +++-
4 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl
index cb36e8e4811..4aa6dd5fe13 100644
--- a/src/bin/psql/t/010_tab_completion.pl
+++ b/src/bin/psql/t/010_tab_completion.pl
@@ -70,9 +70,9 @@ delete $ENV{LS_COLORS};
# to run in the build directory so that we can use relative paths to
# access the tab_comp_dir subdirectory; otherwise the output from filename
# completion tests is too variable.
-if ($ENV{TESTDIR})
+if ($ENV{TESTDATADIR})
{
- chdir $ENV{TESTDIR} or die "could not chdir to \"$ENV{TESTDIR}\": $!";
+ chdir $ENV{TESTDATADIR} or die "could not chdir to \"$ENV{TESTDATADIR}\": $!";
}
# Create some junk files for filename completion testing.
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index 88a472f2442..99d33451064 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -189,11 +189,11 @@ INIT
# test may still fail, but it's more likely to report useful facts.
$SIG{PIPE} = 'IGNORE';
- # Determine output directories, and create them. The base path is the
- # TESTDIR environment variable, which is normally set by the invoking
- # Makefile.
- $tmp_check = $ENV{TESTDIR} ? "$ENV{TESTDIR}" : "tmp_check";
- $log_path = "$tmp_check/log";
+ # Determine output directories, and create them. The base paths are the
+ # TESTDATADIR / TESTLOGDIR environment variables, which are normally set
+ # by the invoking Makefile.
+ $tmp_check = $ENV{TESTDATADIR} ? "$ENV{TESTDATADIR}" : "tmp_check";
+ $log_path = $ENV{TESTLOGDIR} ? "$ENV{TESTLOGDIR}" : "log";
mkdir $tmp_check;
mkdir $log_path;
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 606a2a6f172..f6adf566403 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -451,7 +451,9 @@ echo "+++ tap install-check in $(subdir) +++" && \
rm -rf '$(CURDIR)'/tmp_check && \
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
cd $(srcdir) && \
- TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
+ TESTLOGDIR='$(CURDIR)/tmp_check/log' \
+ TESTDATADIR='$(CURDIR)/tmp_check' \
+ PATH="$(bindir):$(CURDIR):$$PATH" \
PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' \
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
@@ -462,7 +464,9 @@ echo "+++ tap install-check in $(subdir) +++" && \
rm -rf '$(CURDIR)'/tmp_check && \
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
cd $(srcdir) && \
- TESTDIR='$(CURDIR)/tmp_check' PATH="$(bindir):$(CURDIR):$$PATH" \
+ TESTLOGDIR='$(CURDIR)/tmp_check/log' \
+ TESTDATADIR='$(CURDIR)/tmp_check' \
+ PATH="$(bindir):$(CURDIR):$$PATH" \
PGPORT='6$(DEF_PGPORT)' top_builddir='$(top_builddir)' \
PG_REGRESS='$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
@@ -474,7 +478,10 @@ echo "+++ tap check in $(subdir) +++" && \
rm -rf '$(CURDIR)'/tmp_check && \
$(MKDIR_P) '$(CURDIR)'/tmp_check && \
cd $(srcdir) && \
- TESTDIR='$(CURDIR)/tmp_check' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' \
+ TESTLOGDIR='$(CURDIR)/tmp_check/log' \
+ TESTDATADIR='$(CURDIR)/tmp_check' \
+ $(with_temp_install) \
+ PGPORT='6$(DEF_PGPORT)' \
PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' \
$(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
endef
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index da152da8e5f..5182721eb79 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -291,7 +291,9 @@ sub tap_check
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
- $ENV{TESTDIR} = "$dir/tmp_check";
+ $ENV{TESTDATADIR} = "$dir/tmp_check";
+ $ENV{TESTLOGDIR} = "$dir/tmp_check/log";
+
my $module = basename $dir;
# add the module build dir as the second element in the PATH
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0004-meson-prereq-Extend-gendef.pl-in-preparation-for.patch (4.9K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/5-v13-0004-meson-prereq-Extend-gendef.pl-in-preparation-for.patch)
download | inline diff:
From 6de8f1de0ffa48f5543b899a4ab939b3c5b02d07 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 9 Aug 2022 00:29:57 -0700
Subject: [PATCH v13 04/20] meson: prereq: Extend gendef.pl in preparation for
meson
The main issue with using gendef.pl as is for meson is that with meson the
filenames are a bit longer, exceeding the max commandline length when calling
dumpbin with all objects. It's easier to pass a library in anyway.
The .def file location, input and temporary file location need to be tunable
as well.
This also fixes a bug in gendef.pl: The logic when to regenerate was broken
and never avoid regenerating.
Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/20220809071055.rgikv3qn74ypnnbb@awork3.anarazel.de
Discussion: https://postgr.es/m/7dae5979-c6c0-cec5-7a36-76a85aa8053d@enterprisedb.com
---
src/tools/msvc/MSBuildProject.pm | 4 +-
src/tools/msvc/gendef.pl | 67 ++++++++++++++++++++++----------
2 files changed, 49 insertions(+), 22 deletions(-)
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index 594729ceb7d..58590fdac29 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -312,6 +312,8 @@ sub WriteItemDefinitionGroup
my $targetmachine =
$self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
+ my $arch =
+ $self->{platform} eq 'Win32' ? 'x86' : 'x86_64';
my $includes = join ';', @{ $self->{includes} }, "";
@@ -380,7 +382,7 @@ EOF
print $f <<EOF;
<PreLinkEvent>
<Message>Generate DEF file</Message>
- <Command>perl src\\tools\\msvc\\gendef.pl $cfgname\\$self->{name} $self->{platform}</Command>
+ <Command>perl src\\tools\\msvc\\gendef.pl --arch $arch --deffile $cfgname\\$self->{name}\\$self->{name}.def $cfgname\\$self->{name}</Command>
</PreLinkEvent>
EOF
}
diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl
index b4af3dea81b..d6bed1ce151 100644
--- a/src/tools/msvc/gendef.pl
+++ b/src/tools/msvc/gendef.pl
@@ -3,7 +3,8 @@
use strict;
use warnings;
-use List::Util qw(max);
+use List::Util qw(min);
+use Getopt::Long;
my @def;
@@ -112,7 +113,7 @@ sub extract_syms
sub writedef
{
- my ($deffile, $platform, $def) = @_;
+ my ($deffile, $arch, $def) = @_;
open(my $fh, '>', $deffile) || die "Could not write to $deffile\n";
print $fh "EXPORTS\n";
foreach my $f (sort keys %{$def})
@@ -121,7 +122,7 @@ sub writedef
# Strip the leading underscore for win32, but not x64
$f =~ s/^_//
- unless ($platform eq "x64");
+ unless ($arch eq "x86_64");
# Emit just the name if it's a function symbol, or emit the name
# decorated with the DATA option for variables.
@@ -141,40 +142,64 @@ sub writedef
sub usage
{
- die( "Usage: gendef.pl <modulepath> <platform>\n"
- . " modulepath: path to dir with obj files, no trailing slash"
- . " platform: Win32 | x64");
+ die("Usage: gendef.pl --arch <arch> --deffile <deffile> --tempdir <tempdir> files-or-directories\n"
+ . " arch: x86 | x86_64\n"
+ . " deffile: path of the generated file\n"
+ . " tempdir: directory for temporary files\n"
+ . " files or directories: object files or directory containing object files\n"
+ );
}
-usage()
- unless scalar(@ARGV) == 2
- && ( ($ARGV[0] =~ /\\([^\\]+$)/)
- && ($ARGV[1] eq 'Win32' || $ARGV[1] eq 'x64'));
-my $defname = uc $1;
-my $deffile = "$ARGV[0]/$defname.def";
-my $platform = $ARGV[1];
+my $arch;
+my $deffile;
+my $tempdir = '.';
+
+GetOptions(
+ 'arch:s' => \$arch,
+ 'deffile:s' => \$deffile,
+ 'tempdir:s' => \$tempdir,) or usage();
+
+usage("arch: $arch")
+ unless ($arch eq 'x86' || $arch eq 'x86_64');
+
+my @files;
+
+foreach my $in (@ARGV)
+{
+ if (-d $in)
+ {
+ push @files, glob "$in/*.obj";
+ }
+ else
+ {
+ push @files, $in;
+ }
+}
# if the def file exists and is newer than all input object files, skip
# its creation
if (-f $deffile
- && (-M $deffile > max(map { -M } <$ARGV[0]/*.obj>)))
+ && (-M $deffile < min(map { -M } @files)))
{
- print "Not re-generating $defname.DEF, file already exists.\n";
+ print "Not re-generating $deffile, file already exists.\n";
exit(0);
}
-print "Generating $defname.DEF from directory $ARGV[0], platform $platform\n";
+print "Generating $deffile in tempdir $tempdir\n";
my %def = ();
-my $symfile = "$ARGV[0]/all.sym";
-my $tmpfile = "$ARGV[0]/tmp.sym";
-system("dumpbin /symbols /out:$tmpfile $ARGV[0]/*.obj >NUL")
- && die "Could not call dumpbin";
+my $symfile = "$tempdir/all.sym";
+my $tmpfile = "$tempdir/tmp.sym";
+mkdir($tempdir) unless -d $tempdir;
+
+my $cmd = "dumpbin /nologo /symbols /out:$tmpfile " . join(' ', @files);
+
+system($cmd) && die "Could not call dumpbin";
rename($tmpfile, $symfile);
extract_syms($symfile, \%def);
print "\n";
-writedef($deffile, $platform, \%def);
+writedef($deffile, $arch, \%def);
print "Generated " . scalar(keys(%def)) . " symbols\n";
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0005-meson-prereq-Add-src-tools-gen_export.pl.patch (2.4K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/6-v13-0005-meson-prereq-Add-src-tools-gen_export.pl.patch)
download | inline diff:
From 7054861f0fef88b76a10a1cad4db08abafde8721 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 19 Jan 2022 23:36:50 -0800
Subject: [PATCH v13 05/20] meson: prereq: Add src/tools/gen_export.pl
Currently the logic is all in src/Makefile.shlib. This adds a sketch of a
generation script that can be used from meson.
Author: Andres Freund <andres@anarazel.de>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/7dae5979-c6c0-cec5-7a36-76a85aa8053d@enterprisedb.com
---
src/tools/gen_export.pl | 81 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 src/tools/gen_export.pl
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
new file mode 100644
index 00000000000..68b3ab86614
--- /dev/null
+++ b/src/tools/gen_export.pl
@@ -0,0 +1,81 @@
+use strict;
+use warnings;
+use Getopt::Long;
+
+my $format;
+my $libname;
+my $input;
+my $output;
+
+GetOptions(
+ 'format:s' => \$format,
+ 'libname:s' => \$libname,
+ 'input:s' => \$input,
+ 'output:s' => \$output) or die "wrong arguments";
+
+if (not ($format eq 'aix' or $format eq 'darwin' or $format eq 'gnu' or $format eq 'win'))
+{
+ die "$0: $format is not yet handled (only aix, darwin, gnu, win are)\n";
+}
+
+open(my $input_handle, '<', $input)
+ or die "$0: could not open input file '$input': $!\n";
+
+open(my $output_handle, '>', $output)
+ or die "$0: could not open output file '$output': $!\n";
+
+
+if ($format eq 'gnu')
+{
+ print $output_handle "{
+ global:
+";
+}
+elsif ($format eq 'win')
+{
+ # XXX: Looks like specifying LIBRARY $libname is optional, which makes it
+ # easier to build a generic command for generating export files...
+ if ($libname)
+ {
+ print $output_handle "LIBRARY $libname\n";
+ }
+ print $output_handle "EXPORTS\n";
+}
+
+while (<$input_handle>)
+{
+ if (/^#/)
+ {
+ # don't do anything with a comment
+ }
+ elsif (/^(\S+)\s+(\S+)/)
+ {
+ if ($format eq 'aix')
+ {
+ print $output_handle "$1\n";
+ }
+ elsif ($format eq 'darwin')
+ {
+ print $output_handle "_$1\n";
+ }
+ elsif ($format eq 'gnu')
+ {
+ print $output_handle " $1;\n";
+ }
+ elsif ($format eq 'win')
+ {
+ print $output_handle "$1 @ $2\n";
+ }
+ }
+ else
+ {
+ die "$0: unexpected line $_\n";
+ }
+}
+
+if ($format eq 'gnu')
+{
+ print $output_handle " local: *;
+};
+";
+}
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0006-meson-prereq-Refactor-PG_TEST_EXTRA-logic-in-aut.patch (4.0K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/7-v13-0006-meson-prereq-Refactor-PG_TEST_EXTRA-logic-in-aut.patch)
download | inline diff:
From 1aa586f2921cf58c3d74b1c7344663876cf2f693 Mon Sep 17 00:00:00 2001
From: nbyavuz <byavuz81@gmail.com>
Date: Fri, 25 Mar 2022 10:55:08 +0300
Subject: [PATCH v13 06/20] meson: prereq: Refactor PG_TEST_EXTRA logic in
autoconf build
---
src/test/Makefile | 15 +++++----------
src/test/kerberos/t/001_auth.pl | 4 ++++
src/test/ldap/t/001_auth.pl | 4 ++++
src/test/ssl/t/001_ssltests.pl | 4 ++++
src/test/ssl/t/002_scram.pl | 4 ++++
src/test/ssl/t/003_sslinfo.pl | 4 ++++
6 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/src/test/Makefile b/src/test/Makefile
index 69ef074d75e..dbd3192874d 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -17,25 +17,20 @@ SUBDIRS = perl regress isolation modules authentication recovery subscription
ifeq ($(with_icu),yes)
SUBDIRS += icu
endif
-
-# Test suites that are not safe by default but can be run if selected
-# by the user via the whitespace-separated list in variable
-# PG_TEST_EXTRA:
ifeq ($(with_gssapi),yes)
-ifneq (,$(filter kerberos,$(PG_TEST_EXTRA)))
SUBDIRS += kerberos
endif
-endif
ifeq ($(with_ldap),yes)
-ifneq (,$(filter ldap,$(PG_TEST_EXTRA)))
SUBDIRS += ldap
endif
-endif
ifeq ($(with_ssl),openssl)
-ifneq (,$(filter ssl,$(PG_TEST_EXTRA)))
SUBDIRS += ssl
endif
-endif
+
+# Test suites that are not safe by default but can be run if selected
+# by the user via the whitespace-separated list in variable PG_TEST_EXTRA.
+# Export PG_TEST_EXTRA to check it in individual tap tests.
+export PG_TEST_EXTRA
# We don't build or execute these by default, but we do want "make
# clean" etc to recurse into them. (We must filter out those that we
diff --git a/src/test/kerberos/t/001_auth.pl b/src/test/kerberos/t/001_auth.pl
index 62e05426393..e403d24c0c2 100644
--- a/src/test/kerberos/t/001_auth.pl
+++ b/src/test/kerberos/t/001_auth.pl
@@ -25,6 +25,10 @@ if ($ENV{with_gssapi} ne 'yes')
{
plan skip_all => 'GSSAPI/Kerberos not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /kerberos/)
+{
+ plan skip_all => 'Potentially unsafe test GSSAPI/Kerberos not enabled in PG_TEST_EXTRA';
+}
my ($krb5_bin_dir, $krb5_sbin_dir);
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 86dff8bd1f3..a5afddc5272 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -16,6 +16,10 @@ if ($ENV{with_ldap} ne 'yes')
{
plan skip_all => 'LDAP not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /ldap/)
+{
+ plan skip_all => 'Potentially unsafe test LDAP not enabled in PG_TEST_EXTRA';
+}
elsif ($^O eq 'darwin' && -d '/usr/local/opt/openldap')
{
# typical paths for Homebrew
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index efab2ac194c..c77bc9ef500 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -17,6 +17,10 @@ if ($ENV{with_ssl} ne 'openssl')
{
plan skip_all => 'OpenSSL not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /ssl/)
+{
+ plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
+}
my $ssl_server = SSL::Server->new();
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 588f47a39b9..15d45c88e50 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -20,6 +20,10 @@ if ($ENV{with_ssl} ne 'openssl')
{
plan skip_all => 'OpenSSL not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /ssl/)
+{
+ plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
+}
my $ssl_server = SSL::Server->new();
diff --git a/src/test/ssl/t/003_sslinfo.pl b/src/test/ssl/t/003_sslinfo.pl
index 87fb18a31e0..acd0ba8e828 100644
--- a/src/test/ssl/t/003_sslinfo.pl
+++ b/src/test/ssl/t/003_sslinfo.pl
@@ -18,6 +18,10 @@ if ($ENV{with_ssl} ne 'openssl')
{
plan skip_all => 'OpenSSL not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /ssl/)
+{
+ plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
+}
#### Some configuration
my $ssl_server = SSL::Server->new();
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0007-meson-prereq-port-Include-c.h-instead-of-postgre.patch (1.5K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/8-v13-0007-meson-prereq-port-Include-c.h-instead-of-postgre.patch)
download | inline diff:
From 5a9731dcc2e6fb8afaf856e674e587a0edb731ad Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 6 Sep 2022 12:13:49 -0700
Subject: [PATCH v13 07/20] meson: prereq: port: Include c.h instead of
postgres.h in *p{read,write}*.c
This is part of the meson series as otherwise these files need an unnecessary
dependency on errcodes.h.
---
src/port/preadv.c | 2 +-
src/port/pwritev.c | 2 +-
src/port/win32pread.c | 2 +-
src/port/win32pwrite.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/port/preadv.c b/src/port/preadv.c
index 48b64d4593d..188e10f0652 100644
--- a/src/port/preadv.c
+++ b/src/port/preadv.c
@@ -12,7 +12,7 @@
*/
-#include "postgres.h"
+#include "c.h"
#include <unistd.h>
diff --git a/src/port/pwritev.c b/src/port/pwritev.c
index 8b303fcbcdc..de9b7e4e3d3 100644
--- a/src/port/pwritev.c
+++ b/src/port/pwritev.c
@@ -12,7 +12,7 @@
*/
-#include "postgres.h"
+#include "c.h"
#include <unistd.h>
diff --git a/src/port/win32pread.c b/src/port/win32pread.c
index 7058c3460b5..ebcdd337569 100644
--- a/src/port/win32pread.c
+++ b/src/port/win32pread.c
@@ -12,7 +12,7 @@
*/
-#include "postgres.h"
+#include "c.h"
#include <windows.h>
diff --git a/src/port/win32pwrite.c b/src/port/win32pwrite.c
index 455cec4a747..7f2e62e8a78 100644
--- a/src/port/win32pwrite.c
+++ b/src/port/win32pwrite.c
@@ -12,7 +12,7 @@
*/
-#include "postgres.h"
+#include "c.h"
#include <windows.h>
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0008-meson-Add-meson-based-buildsystem.patch (349.6K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/9-v13-0008-meson-Add-meson-based-buildsystem.patch)
download | inline diff:
From 1939bdcfbfeaaf053b6a8e8a7e9f5c257b38fdfb Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 12 Sep 2022 17:05:05 -0700
Subject: [PATCH v13 08/20] meson: Add meson based buildsystem
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Peter Eisentraut <peter@eisentraut.org>
Author: Thomas Munro <thomas.munro@gmail.com>
Author: John Naylor <john.naylor@enterprisedb.com>
Author: Stone Tickle <lattis@mochiro.moe>
---
src/include/catalog/meson.build | 142 +
src/include/meson.build | 173 +
src/include/nodes/meson.build | 58 +
src/include/pg_config_ext.h.meson | 7 +
src/include/storage/meson.build | 19 +
src/include/utils/meson.build | 57 +
src/common/meson.build | 174 +
src/common/unicode/meson.build | 106 +
src/port/meson.build | 184 +
config/meson.build | 4 +
src/backend/access/brin/meson.build | 12 +
src/backend/access/common/meson.build | 18 +
src/backend/access/gin/meson.build | 17 +
src/backend/access/gist/meson.build | 13 +
src/backend/access/hash/meson.build | 12 +
src/backend/access/heap/meson.build | 11 +
src/backend/access/index/meson.build | 6 +
src/backend/access/meson.build | 13 +
src/backend/access/nbtree/meson.build | 13 +
src/backend/access/rmgrdesc/meson.build | 26 +
src/backend/access/spgist/meson.build | 13 +
src/backend/access/table/meson.build | 6 +
src/backend/access/tablesample/meson.build | 5 +
src/backend/access/transam/meson.build | 31 +
src/backend/backup/meson.build | 13 +
src/backend/bootstrap/meson.build | 28 +
src/backend/catalog/meson.build | 44 +
src/backend/commands/meson.build | 51 +
src/backend/executor/meson.build | 67 +
src/backend/foreign/meson.build | 3 +
src/backend/jit/llvm/meson.build | 73 +
src/backend/jit/meson.build | 3 +
src/backend/lib/meson.build | 12 +
src/backend/libpq/meson.build | 32 +
src/backend/main/meson.build | 2 +
src/backend/meson.build | 190 ++
src/backend/nodes/meson.build | 29 +
src/backend/optimizer/geqo/meson.build | 17 +
src/backend/optimizer/meson.build | 5 +
src/backend/optimizer/path/meson.build | 11 +
src/backend/optimizer/plan/meson.build | 10 +
src/backend/optimizer/prep/meson.build | 7 +
src/backend/optimizer/util/meson.build | 16 +
src/backend/parser/meson.build | 48 +
src/backend/partitioning/meson.build | 5 +
src/backend/po/meson.build | 1 +
src/backend/port/meson.build | 31 +
src/backend/port/win32/meson.build | 6 +
src/backend/postmaster/meson.build | 15 +
src/backend/regex/meson.build | 8 +
.../replication/libpqwalreceiver/meson.build | 13 +
src/backend/replication/logical/meson.build | 14 +
src/backend/replication/meson.build | 51 +
src/backend/replication/pgoutput/meson.build | 11 +
src/backend/rewrite/meson.build | 9 +
src/backend/snowball/meson.build | 88 +
src/backend/statistics/meson.build | 6 +
src/backend/storage/buffer/meson.build | 7 +
src/backend/storage/file/meson.build | 8 +
src/backend/storage/freespace/meson.build | 5 +
src/backend/storage/ipc/meson.build | 20 +
src/backend/storage/large_object/meson.build | 3 +
src/backend/storage/lmgr/meson.build | 13 +
src/backend/storage/meson.build | 9 +
src/backend/storage/page/meson.build | 5 +
src/backend/storage/smgr/meson.build | 4 +
src/backend/storage/sync/meson.build | 4 +
src/backend/tcop/meson.build | 8 +
src/backend/tsearch/meson.build | 21 +
src/backend/utils/activity/meson.build | 18 +
src/backend/utils/adt/meson.build | 131 +
src/backend/utils/cache/meson.build | 16 +
src/backend/utils/error/meson.build | 6 +
src/backend/utils/fmgr/meson.build | 8 +
src/backend/utils/hash/meson.build | 4 +
src/backend/utils/init/meson.build | 4 +
.../utils/mb/conversion_procs/meson.build | 36 +
src/backend/utils/mb/meson.build | 9 +
src/backend/utils/meson.build | 17 +
src/backend/utils/misc/meson.build | 35 +
src/backend/utils/mmgr/meson.build | 10 +
src/backend/utils/resowner/meson.build | 3 +
src/backend/utils/sort/meson.build | 9 +
src/backend/utils/time/meson.build | 4 +
src/fe_utils/meson.build | 29 +
src/bin/initdb/meson.build | 30 +
src/bin/initdb/po/meson.build | 1 +
src/bin/meson.build | 20 +
src/bin/pg_amcheck/meson.build | 27 +
src/bin/pg_amcheck/po/meson.build | 1 +
src/bin/pg_archivecleanup/meson.build | 19 +
src/bin/pg_archivecleanup/po/meson.build | 1 +
src/bin/pg_basebackup/meson.build | 61 +
src/bin/pg_basebackup/po/meson.build | 1 +
src/bin/pg_checksums/meson.build | 21 +
src/bin/pg_checksums/po/meson.build | 1 +
src/bin/pg_config/meson.build | 19 +
src/bin/pg_config/po/meson.build | 1 +
src/bin/pg_controldata/meson.build | 19 +
src/bin/pg_controldata/po/meson.build | 1 +
src/bin/pg_ctl/meson.build | 22 +
src/bin/pg_ctl/po/meson.build | 1 +
src/bin/pg_dump/meson.build | 75 +
src/bin/pg_dump/po/meson.build | 1 +
src/bin/pg_resetwal/meson.build | 20 +
src/bin/pg_resetwal/po/meson.build | 1 +
src/bin/pg_rewind/meson.build | 42 +
src/bin/pg_rewind/po/meson.build | 1 +
src/bin/pg_test_fsync/meson.build | 21 +
src/bin/pg_test_fsync/po/meson.build | 1 +
src/bin/pg_test_timing/meson.build | 19 +
src/bin/pg_test_timing/po/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 40 +
src/bin/pg_upgrade/po/meson.build | 1 +
src/bin/pg_verifybackup/meson.build | 33 +
src/bin/pg_verifybackup/po/meson.build | 1 +
src/bin/pg_waldump/meson.build | 30 +
src/bin/pg_waldump/po/meson.build | 1 +
src/bin/pgbench/meson.build | 38 +
src/bin/pgevent/meson.build | 26 +
src/bin/psql/meson.build | 67 +
src/bin/psql/po/meson.build | 1 +
src/bin/scripts/meson.build | 51 +
src/bin/scripts/po/meson.build | 1 +
src/interfaces/libpq/meson.build | 108 +
src/interfaces/libpq/po/meson.build | 1 +
src/interfaces/libpq/test/meson.build | 15 +
src/pl/meson.build | 5 +
src/pl/plperl/meson.build | 90 +
src/pl/plperl/po/meson.build | 1 +
src/pl/plpgsql/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 84 +
src/pl/plpgsql/src/po/meson.build | 1 +
src/pl/plpython/meson.build | 99 +
src/pl/plpython/po/meson.build | 1 +
src/pl/tcl/meson.build | 55 +
src/pl/tcl/po/meson.build | 1 +
contrib/adminpack/meson.build | 23 +
contrib/amcheck/meson.build | 37 +
contrib/auth_delay/meson.build | 5 +
contrib/auto_explain/meson.build | 16 +
contrib/basebackup_to_shell/meson.build | 22 +
contrib/basic_archive/meson.build | 23 +
contrib/bloom/meson.build | 36 +
contrib/bool_plperl/meson.build | 42 +
contrib/btree_gin/meson.build | 54 +
contrib/btree_gist/meson.build | 84 +
contrib/citext/meson.build | 34 +
contrib/cube/meson.build | 53 +
contrib/dblink/meson.build | 31 +
contrib/dict_int/meson.build | 22 +
contrib/dict_xsyn/meson.build | 29 +
contrib/earthdistance/meson.build | 23 +
contrib/file_fdw/meson.build | 22 +
contrib/fuzzystrmatch/meson.build | 26 +
contrib/hstore/meson.build | 44 +
contrib/hstore_plperl/meson.build | 43 +
contrib/hstore_plpython/meson.build | 37 +
contrib/intagg/meson.build | 6 +
contrib/intarray/meson.build | 37 +
contrib/isn/meson.build | 33 +
contrib/jsonb_plperl/meson.build | 43 +
contrib/jsonb_plpython/meson.build | 36 +
contrib/lo/meson.build | 27 +
contrib/ltree/meson.build | 44 +
contrib/ltree_plpython/meson.build | 37 +
contrib/meson.build | 66 +
contrib/oid2name/meson.build | 17 +
contrib/old_snapshot/meson.build | 15 +
contrib/pageinspect/meson.build | 50 +
contrib/passwordcheck/meson.build | 30 +
contrib/pg_buffercache/meson.build | 27 +
contrib/pg_freespacemap/meson.build | 29 +
contrib/pg_prewarm/meson.build | 27 +
contrib/pg_stat_statements/meson.build | 35 +
contrib/pg_surgery/meson.build | 25 +
contrib/pg_trgm/meson.build | 35 +
contrib/pg_visibility/meson.build | 26 +
contrib/pg_walinspect/meson.build | 27 +
contrib/pgcrypto/meson.build | 100 +
contrib/pgrowlocks/meson.build | 27 +
contrib/pgstattuple/meson.build | 31 +
contrib/postgres_fdw/meson.build | 34 +
contrib/seg/meson.build | 51 +
contrib/sepgsql/meson.build | 34 +
contrib/spi/meson.build | 50 +
contrib/sslinfo/meson.build | 21 +
contrib/tablefunc/meson.build | 24 +
contrib/tcn/meson.build | 25 +
contrib/test_decoding/meson.build | 63 +
contrib/tsm_system_rows/meson.build | 24 +
contrib/tsm_system_time/meson.build | 24 +
contrib/unaccent/meson.build | 32 +
contrib/uuid-ossp/meson.build | 31 +
contrib/vacuumlo/meson.build | 17 +
contrib/xml2/meson.build | 32 +
src/interfaces/ecpg/compatlib/meson.build | 22 +
src/interfaces/ecpg/ecpglib/meson.build | 37 +
src/interfaces/ecpg/ecpglib/po/meson.build | 1 +
src/interfaces/ecpg/include/meson.build | 51 +
src/interfaces/ecpg/meson.build | 9 +
src/interfaces/ecpg/pgtypeslib/meson.build | 30 +
src/interfaces/ecpg/preproc/meson.build | 103 +
src/interfaces/ecpg/preproc/po/meson.build | 1 +
.../ecpg/test/compat_informix/meson.build | 31 +
.../ecpg/test/compat_oracle/meson.build | 20 +
src/interfaces/ecpg/test/connect/meson.build | 20 +
src/interfaces/ecpg/test/meson.build | 79 +
.../ecpg/test/pgtypeslib/meson.build | 21 +
src/interfaces/ecpg/test/preproc/meson.build | 37 +
src/interfaces/ecpg/test/sql/meson.build | 46 +
src/interfaces/ecpg/test/thread/meson.build | 21 +
src/interfaces/meson.build | 2 +
doc/src/sgml/meson.build | 252 ++
doc/src/sgml/version.sgml.in | 2 +
src/test/authentication/meson.build | 11 +
src/test/icu/meson.build | 11 +
src/test/isolation/meson.build | 58 +
src/test/kerberos/meson.build | 15 +
src/test/ldap/meson.build | 11 +
src/test/meson.build | 25 +
src/test/modules/brin/meson.build | 16 +
src/test/modules/commit_ts/meson.build | 18 +
src/test/modules/delay_execution/meson.build | 18 +
src/test/modules/dummy_index_am/meson.build | 23 +
src/test/modules/dummy_seclabel/meson.build | 23 +
src/test/modules/libpq_pipeline/meson.build | 21 +
src/test/modules/meson.build | 27 +
src/test/modules/plsample/meson.build | 23 +
src/test/modules/snapshot_too_old/meson.build | 14 +
src/test/modules/spgist_name_ops/meson.build | 23 +
.../ssl_passphrase_callback/meson.build | 48 +
src/test/modules/test_bloomfilter/meson.build | 23 +
src/test/modules/test_ddl_deparse/meson.build | 43 +
src/test/modules/test_extensions/meson.build | 45 +
.../modules/test_ginpostinglist/meson.build | 23 +
src/test/modules/test_integerset/meson.build | 23 +
src/test/modules/test_lfind/meson.build | 23 +
src/test/modules/test_misc/meson.build | 12 +
src/test/modules/test_oat_hooks/meson.build | 18 +
src/test/modules/test_parser/meson.build | 23 +
src/test/modules/test_pg_dump/meson.build | 22 +
src/test/modules/test_predtest/meson.build | 23 +
src/test/modules/test_rbtree/meson.build | 23 +
src/test/modules/test_regex/meson.build | 24 +
src/test/modules/test_rls_hooks/meson.build | 17 +
src/test/modules/test_shm_mq/meson.build | 27 +
src/test/modules/unsafe_tests/meson.build | 11 +
src/test/modules/worker_spi/meson.build | 26 +
src/test/perl/meson.build | 12 +
src/test/recovery/meson.build | 43 +
src/test/regress/meson.build | 62 +
src/test/ssl/meson.build | 13 +
src/test/subscription/meson.build | 42 +
configure | 6 +
configure.ac | 6 +
meson.build | 3027 +++++++++++++++++
meson_options.txt | 185 +
src/meson.build | 12 +
src/timezone/meson.build | 56 +
src/timezone/tznames/meson.build | 21 +
src/tools/find_meson | 30 +
src/tools/pgflex | 85 +
src/tools/testwrap | 47 +
264 files changed, 10886 insertions(+)
create mode 100644 src/include/catalog/meson.build
create mode 100644 src/include/meson.build
create mode 100644 src/include/nodes/meson.build
create mode 100644 src/include/pg_config_ext.h.meson
create mode 100644 src/include/storage/meson.build
create mode 100644 src/include/utils/meson.build
create mode 100644 src/common/meson.build
create mode 100644 src/common/unicode/meson.build
create mode 100644 src/port/meson.build
create mode 100644 config/meson.build
create mode 100644 src/backend/access/brin/meson.build
create mode 100644 src/backend/access/common/meson.build
create mode 100644 src/backend/access/gin/meson.build
create mode 100644 src/backend/access/gist/meson.build
create mode 100644 src/backend/access/hash/meson.build
create mode 100644 src/backend/access/heap/meson.build
create mode 100644 src/backend/access/index/meson.build
create mode 100644 src/backend/access/meson.build
create mode 100644 src/backend/access/nbtree/meson.build
create mode 100644 src/backend/access/rmgrdesc/meson.build
create mode 100644 src/backend/access/spgist/meson.build
create mode 100644 src/backend/access/table/meson.build
create mode 100644 src/backend/access/tablesample/meson.build
create mode 100644 src/backend/access/transam/meson.build
create mode 100644 src/backend/backup/meson.build
create mode 100644 src/backend/bootstrap/meson.build
create mode 100644 src/backend/catalog/meson.build
create mode 100644 src/backend/commands/meson.build
create mode 100644 src/backend/executor/meson.build
create mode 100644 src/backend/foreign/meson.build
create mode 100644 src/backend/jit/llvm/meson.build
create mode 100644 src/backend/jit/meson.build
create mode 100644 src/backend/lib/meson.build
create mode 100644 src/backend/libpq/meson.build
create mode 100644 src/backend/main/meson.build
create mode 100644 src/backend/meson.build
create mode 100644 src/backend/nodes/meson.build
create mode 100644 src/backend/optimizer/geqo/meson.build
create mode 100644 src/backend/optimizer/meson.build
create mode 100644 src/backend/optimizer/path/meson.build
create mode 100644 src/backend/optimizer/plan/meson.build
create mode 100644 src/backend/optimizer/prep/meson.build
create mode 100644 src/backend/optimizer/util/meson.build
create mode 100644 src/backend/parser/meson.build
create mode 100644 src/backend/partitioning/meson.build
create mode 100644 src/backend/po/meson.build
create mode 100644 src/backend/port/meson.build
create mode 100644 src/backend/port/win32/meson.build
create mode 100644 src/backend/postmaster/meson.build
create mode 100644 src/backend/regex/meson.build
create mode 100644 src/backend/replication/libpqwalreceiver/meson.build
create mode 100644 src/backend/replication/logical/meson.build
create mode 100644 src/backend/replication/meson.build
create mode 100644 src/backend/replication/pgoutput/meson.build
create mode 100644 src/backend/rewrite/meson.build
create mode 100644 src/backend/snowball/meson.build
create mode 100644 src/backend/statistics/meson.build
create mode 100644 src/backend/storage/buffer/meson.build
create mode 100644 src/backend/storage/file/meson.build
create mode 100644 src/backend/storage/freespace/meson.build
create mode 100644 src/backend/storage/ipc/meson.build
create mode 100644 src/backend/storage/large_object/meson.build
create mode 100644 src/backend/storage/lmgr/meson.build
create mode 100644 src/backend/storage/meson.build
create mode 100644 src/backend/storage/page/meson.build
create mode 100644 src/backend/storage/smgr/meson.build
create mode 100644 src/backend/storage/sync/meson.build
create mode 100644 src/backend/tcop/meson.build
create mode 100644 src/backend/tsearch/meson.build
create mode 100644 src/backend/utils/activity/meson.build
create mode 100644 src/backend/utils/adt/meson.build
create mode 100644 src/backend/utils/cache/meson.build
create mode 100644 src/backend/utils/error/meson.build
create mode 100644 src/backend/utils/fmgr/meson.build
create mode 100644 src/backend/utils/hash/meson.build
create mode 100644 src/backend/utils/init/meson.build
create mode 100644 src/backend/utils/mb/conversion_procs/meson.build
create mode 100644 src/backend/utils/mb/meson.build
create mode 100644 src/backend/utils/meson.build
create mode 100644 src/backend/utils/misc/meson.build
create mode 100644 src/backend/utils/mmgr/meson.build
create mode 100644 src/backend/utils/resowner/meson.build
create mode 100644 src/backend/utils/sort/meson.build
create mode 100644 src/backend/utils/time/meson.build
create mode 100644 src/fe_utils/meson.build
create mode 100644 src/bin/initdb/meson.build
create mode 100644 src/bin/initdb/po/meson.build
create mode 100644 src/bin/meson.build
create mode 100644 src/bin/pg_amcheck/meson.build
create mode 100644 src/bin/pg_amcheck/po/meson.build
create mode 100644 src/bin/pg_archivecleanup/meson.build
create mode 100644 src/bin/pg_archivecleanup/po/meson.build
create mode 100644 src/bin/pg_basebackup/meson.build
create mode 100644 src/bin/pg_basebackup/po/meson.build
create mode 100644 src/bin/pg_checksums/meson.build
create mode 100644 src/bin/pg_checksums/po/meson.build
create mode 100644 src/bin/pg_config/meson.build
create mode 100644 src/bin/pg_config/po/meson.build
create mode 100644 src/bin/pg_controldata/meson.build
create mode 100644 src/bin/pg_controldata/po/meson.build
create mode 100644 src/bin/pg_ctl/meson.build
create mode 100644 src/bin/pg_ctl/po/meson.build
create mode 100644 src/bin/pg_dump/meson.build
create mode 100644 src/bin/pg_dump/po/meson.build
create mode 100644 src/bin/pg_resetwal/meson.build
create mode 100644 src/bin/pg_resetwal/po/meson.build
create mode 100644 src/bin/pg_rewind/meson.build
create mode 100644 src/bin/pg_rewind/po/meson.build
create mode 100644 src/bin/pg_test_fsync/meson.build
create mode 100644 src/bin/pg_test_fsync/po/meson.build
create mode 100644 src/bin/pg_test_timing/meson.build
create mode 100644 src/bin/pg_test_timing/po/meson.build
create mode 100644 src/bin/pg_upgrade/meson.build
create mode 100644 src/bin/pg_upgrade/po/meson.build
create mode 100644 src/bin/pg_verifybackup/meson.build
create mode 100644 src/bin/pg_verifybackup/po/meson.build
create mode 100644 src/bin/pg_waldump/meson.build
create mode 100644 src/bin/pg_waldump/po/meson.build
create mode 100644 src/bin/pgbench/meson.build
create mode 100644 src/bin/pgevent/meson.build
create mode 100644 src/bin/psql/meson.build
create mode 100644 src/bin/psql/po/meson.build
create mode 100644 src/bin/scripts/meson.build
create mode 100644 src/bin/scripts/po/meson.build
create mode 100644 src/interfaces/libpq/meson.build
create mode 100644 src/interfaces/libpq/po/meson.build
create mode 100644 src/interfaces/libpq/test/meson.build
create mode 100644 src/pl/meson.build
create mode 100644 src/pl/plperl/meson.build
create mode 100644 src/pl/plperl/po/meson.build
create mode 100644 src/pl/plpgsql/meson.build
create mode 100644 src/pl/plpgsql/src/meson.build
create mode 100644 src/pl/plpgsql/src/po/meson.build
create mode 100644 src/pl/plpython/meson.build
create mode 100644 src/pl/plpython/po/meson.build
create mode 100644 src/pl/tcl/meson.build
create mode 100644 src/pl/tcl/po/meson.build
create mode 100644 contrib/adminpack/meson.build
create mode 100644 contrib/amcheck/meson.build
create mode 100644 contrib/auth_delay/meson.build
create mode 100644 contrib/auto_explain/meson.build
create mode 100644 contrib/basebackup_to_shell/meson.build
create mode 100644 contrib/basic_archive/meson.build
create mode 100644 contrib/bloom/meson.build
create mode 100644 contrib/bool_plperl/meson.build
create mode 100644 contrib/btree_gin/meson.build
create mode 100644 contrib/btree_gist/meson.build
create mode 100644 contrib/citext/meson.build
create mode 100644 contrib/cube/meson.build
create mode 100644 contrib/dblink/meson.build
create mode 100644 contrib/dict_int/meson.build
create mode 100644 contrib/dict_xsyn/meson.build
create mode 100644 contrib/earthdistance/meson.build
create mode 100644 contrib/file_fdw/meson.build
create mode 100644 contrib/fuzzystrmatch/meson.build
create mode 100644 contrib/hstore/meson.build
create mode 100644 contrib/hstore_plperl/meson.build
create mode 100644 contrib/hstore_plpython/meson.build
create mode 100644 contrib/intagg/meson.build
create mode 100644 contrib/intarray/meson.build
create mode 100644 contrib/isn/meson.build
create mode 100644 contrib/jsonb_plperl/meson.build
create mode 100644 contrib/jsonb_plpython/meson.build
create mode 100644 contrib/lo/meson.build
create mode 100644 contrib/ltree/meson.build
create mode 100644 contrib/ltree_plpython/meson.build
create mode 100644 contrib/meson.build
create mode 100644 contrib/oid2name/meson.build
create mode 100644 contrib/old_snapshot/meson.build
create mode 100644 contrib/pageinspect/meson.build
create mode 100644 contrib/passwordcheck/meson.build
create mode 100644 contrib/pg_buffercache/meson.build
create mode 100644 contrib/pg_freespacemap/meson.build
create mode 100644 contrib/pg_prewarm/meson.build
create mode 100644 contrib/pg_stat_statements/meson.build
create mode 100644 contrib/pg_surgery/meson.build
create mode 100644 contrib/pg_trgm/meson.build
create mode 100644 contrib/pg_visibility/meson.build
create mode 100644 contrib/pg_walinspect/meson.build
create mode 100644 contrib/pgcrypto/meson.build
create mode 100644 contrib/pgrowlocks/meson.build
create mode 100644 contrib/pgstattuple/meson.build
create mode 100644 contrib/postgres_fdw/meson.build
create mode 100644 contrib/seg/meson.build
create mode 100644 contrib/sepgsql/meson.build
create mode 100644 contrib/spi/meson.build
create mode 100644 contrib/sslinfo/meson.build
create mode 100644 contrib/tablefunc/meson.build
create mode 100644 contrib/tcn/meson.build
create mode 100644 contrib/test_decoding/meson.build
create mode 100644 contrib/tsm_system_rows/meson.build
create mode 100644 contrib/tsm_system_time/meson.build
create mode 100644 contrib/unaccent/meson.build
create mode 100644 contrib/uuid-ossp/meson.build
create mode 100644 contrib/vacuumlo/meson.build
create mode 100644 contrib/xml2/meson.build
create mode 100644 src/interfaces/ecpg/compatlib/meson.build
create mode 100644 src/interfaces/ecpg/ecpglib/meson.build
create mode 100644 src/interfaces/ecpg/ecpglib/po/meson.build
create mode 100644 src/interfaces/ecpg/include/meson.build
create mode 100644 src/interfaces/ecpg/meson.build
create mode 100644 src/interfaces/ecpg/pgtypeslib/meson.build
create mode 100644 src/interfaces/ecpg/preproc/meson.build
create mode 100644 src/interfaces/ecpg/preproc/po/meson.build
create mode 100644 src/interfaces/ecpg/test/compat_informix/meson.build
create mode 100644 src/interfaces/ecpg/test/compat_oracle/meson.build
create mode 100644 src/interfaces/ecpg/test/connect/meson.build
create mode 100644 src/interfaces/ecpg/test/meson.build
create mode 100644 src/interfaces/ecpg/test/pgtypeslib/meson.build
create mode 100644 src/interfaces/ecpg/test/preproc/meson.build
create mode 100644 src/interfaces/ecpg/test/sql/meson.build
create mode 100644 src/interfaces/ecpg/test/thread/meson.build
create mode 100644 src/interfaces/meson.build
create mode 100644 doc/src/sgml/meson.build
create mode 100644 doc/src/sgml/version.sgml.in
create mode 100644 src/test/authentication/meson.build
create mode 100644 src/test/icu/meson.build
create mode 100644 src/test/isolation/meson.build
create mode 100644 src/test/kerberos/meson.build
create mode 100644 src/test/ldap/meson.build
create mode 100644 src/test/meson.build
create mode 100644 src/test/modules/brin/meson.build
create mode 100644 src/test/modules/commit_ts/meson.build
create mode 100644 src/test/modules/delay_execution/meson.build
create mode 100644 src/test/modules/dummy_index_am/meson.build
create mode 100644 src/test/modules/dummy_seclabel/meson.build
create mode 100644 src/test/modules/libpq_pipeline/meson.build
create mode 100644 src/test/modules/meson.build
create mode 100644 src/test/modules/plsample/meson.build
create mode 100644 src/test/modules/snapshot_too_old/meson.build
create mode 100644 src/test/modules/spgist_name_ops/meson.build
create mode 100644 src/test/modules/ssl_passphrase_callback/meson.build
create mode 100644 src/test/modules/test_bloomfilter/meson.build
create mode 100644 src/test/modules/test_ddl_deparse/meson.build
create mode 100644 src/test/modules/test_extensions/meson.build
create mode 100644 src/test/modules/test_ginpostinglist/meson.build
create mode 100644 src/test/modules/test_integerset/meson.build
create mode 100644 src/test/modules/test_lfind/meson.build
create mode 100644 src/test/modules/test_misc/meson.build
create mode 100644 src/test/modules/test_oat_hooks/meson.build
create mode 100644 src/test/modules/test_parser/meson.build
create mode 100644 src/test/modules/test_pg_dump/meson.build
create mode 100644 src/test/modules/test_predtest/meson.build
create mode 100644 src/test/modules/test_rbtree/meson.build
create mode 100644 src/test/modules/test_regex/meson.build
create mode 100644 src/test/modules/test_rls_hooks/meson.build
create mode 100644 src/test/modules/test_shm_mq/meson.build
create mode 100644 src/test/modules/unsafe_tests/meson.build
create mode 100644 src/test/modules/worker_spi/meson.build
create mode 100644 src/test/perl/meson.build
create mode 100644 src/test/recovery/meson.build
create mode 100644 src/test/regress/meson.build
create mode 100644 src/test/ssl/meson.build
create mode 100644 src/test/subscription/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 src/meson.build
create mode 100644 src/timezone/meson.build
create mode 100644 src/timezone/tznames/meson.build
create mode 100755 src/tools/find_meson
create mode 100755 src/tools/pgflex
create mode 100755 src/tools/testwrap
diff --git a/src/include/catalog/meson.build b/src/include/catalog/meson.build
new file mode 100644
index 00000000000..45ffa99692e
--- /dev/null
+++ b/src/include/catalog/meson.build
@@ -0,0 +1,142 @@
+catalog_headers = [
+ 'pg_proc.h',
+ 'pg_type.h',
+ 'pg_attribute.h',
+ 'pg_class.h',
+ 'pg_attrdef.h',
+ 'pg_constraint.h',
+ 'pg_inherits.h',
+ 'pg_index.h',
+ 'pg_operator.h',
+ 'pg_opfamily.h',
+ 'pg_opclass.h',
+ 'pg_am.h',
+ 'pg_amop.h',
+ 'pg_amproc.h',
+ 'pg_language.h',
+ 'pg_largeobject_metadata.h',
+ 'pg_largeobject.h',
+ 'pg_aggregate.h',
+ 'pg_statistic.h',
+ 'pg_statistic_ext.h',
+ 'pg_statistic_ext_data.h',
+ 'pg_rewrite.h',
+ 'pg_trigger.h',
+ 'pg_event_trigger.h',
+ 'pg_description.h',
+ 'pg_cast.h',
+ 'pg_enum.h',
+ 'pg_namespace.h',
+ 'pg_conversion.h',
+ 'pg_depend.h',
+ 'pg_database.h',
+ 'pg_db_role_setting.h',
+ 'pg_tablespace.h',
+ 'pg_authid.h',
+ 'pg_auth_members.h',
+ 'pg_shdepend.h',
+ 'pg_shdescription.h',
+ 'pg_ts_config.h',
+ 'pg_ts_config_map.h',
+ 'pg_ts_dict.h',
+ 'pg_ts_parser.h',
+ 'pg_ts_template.h',
+ 'pg_extension.h',
+ 'pg_foreign_data_wrapper.h',
+ 'pg_foreign_server.h',
+ 'pg_user_mapping.h',
+ 'pg_foreign_table.h',
+ 'pg_policy.h',
+ 'pg_replication_origin.h',
+ 'pg_default_acl.h',
+ 'pg_init_privs.h',
+ 'pg_seclabel.h',
+ 'pg_shseclabel.h',
+ 'pg_collation.h',
+ 'pg_parameter_acl.h',
+ 'pg_partitioned_table.h',
+ 'pg_range.h',
+ 'pg_transform.h',
+ 'pg_sequence.h',
+ 'pg_publication.h',
+ 'pg_publication_namespace.h',
+ 'pg_publication_rel.h',
+ 'pg_subscription.h',
+ 'pg_subscription_rel.h',
+]
+
+bki_data = [
+ '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',
+]
+bki_data_f = files(bki_data)
+
+
+input = []
+output_files = ['postgres.bki', 'system_constraints.sql', 'schemapg.h', 'system_fk_info.h']
+output_install = [dir_data, dir_data, dir_include_server / 'catalog', dir_include_server / 'catalog']
+
+foreach h : catalog_headers
+ fname = h.split('.h')[0] + '_d.h'
+ input += files(h)
+ output_files += fname
+ output_install += dir_include_server / 'catalog'
+endforeach
+
+generated_catalog_headers = custom_target('generated_catalog_headers',
+ output: output_files,
+ install_dir: output_install,
+ input: input,
+ depend_files: bki_data_f,
+ build_by_default: true,
+ install: true,
+ command: [
+ perl,
+ files('../../backend/catalog/genbki.pl'),
+ '--include-path=@SOURCE_ROOT@/src/include',
+ '--set-version=' + pg_version_major.to_string(),
+ '--output=@OUTDIR@', '@INPUT@'
+ ],
+)
+
+generated_headers += generated_catalog_headers.to_list()
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/catalog': output_files + ['bki-stamp']}
+generated_sources_ac += {'src/include/catalog': ['header-stamp']}
+
+# 'reformat-dat-files' is a convenience target for rewriting the
+# catalog data files in our standard format. This includes collapsing
+# out any entries that are redundant with a BKI_DEFAULT annotation.
+run_target('reformat-dat-files',
+ command: [perl, files('reformat_dat_file.pl'), '--output', '@CURRENT_SOURCE_DIR@', bki_data_f],
+)
+
+# 'expand-dat-files' is a convenience target for expanding out all
+# default values in the catalog data files. This should be run before
+# altering or removing any BKI_DEFAULT annotation.
+run_target('expand-dat-files',
+ command: [perl, files('reformat_dat_file.pl'), '--output', '@CURRENT_SOURCE_DIR@', bki_data_f, '--full-tuples'],
+)
diff --git a/src/include/meson.build b/src/include/meson.build
new file mode 100644
index 00000000000..e5390df0584
--- /dev/null
+++ b/src/include/meson.build
@@ -0,0 +1,173 @@
+pg_config_ext = configure_file(
+ input: 'pg_config_ext.h.meson',
+ output: 'pg_config_ext.h',
+ configuration: cdata,
+ install: true,
+ install_dir: dir_include,
+)
+configure_files += pg_config_ext
+
+pg_config_os = configure_file(
+ output: 'pg_config_os.h',
+ input: files('port/@0@.h'.format(portname)),
+ install: true,
+ install_dir: dir_include,
+ copy: true,
+)
+configure_files += pg_config_os
+
+pg_config = configure_file(
+ output: 'pg_config.h',
+ install: true,
+ install_dir: dir_include,
+ configuration: cdata,
+)
+configure_files += pg_config
+
+
+config_paths_data = configuration_data()
+config_paths_data.set_quoted('PGBINDIR', dir_prefix / dir_bin)
+config_paths_data.set_quoted('PGSHAREDIR', dir_prefix / dir_data)
+config_paths_data.set_quoted('SYSCONFDIR', dir_prefix / dir_sysconf)
+config_paths_data.set_quoted('INCLUDEDIR', dir_prefix / dir_include)
+config_paths_data.set_quoted('PKGINCLUDEDIR', dir_prefix / dir_include_pkg)
+config_paths_data.set_quoted('INCLUDEDIRSERVER', dir_prefix / dir_include_server)
+config_paths_data.set_quoted('LIBDIR', dir_prefix / dir_lib)
+config_paths_data.set_quoted('PKGLIBDIR', dir_prefix / dir_lib_pkg)
+config_paths_data.set_quoted('LOCALEDIR', dir_prefix / dir_locale)
+config_paths_data.set_quoted('DOCDIR', dir_prefix / dir_doc)
+config_paths_data.set_quoted('HTMLDIR', dir_prefix / dir_doc_html)
+config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
+
+
+var_cc = ' '.join(cc.cmd_array())
+var_cpp = ' '.join(cc.cmd_array() + ['-E'])
+var_cflags = ' '.join(cflags + cflags_warn)
+var_cxxflags = ' '.join(cxxflags + cxxflags_warn)
+var_cppflags = ' '.join(cppflags)
+var_cflags_sl = '-fPIC' #FIXME
+var_ldflags = ' '.join(ldflags)
+var_ldflags_sl = ''.join(ldflags_sl)
+var_ldflags_ex = '' # FIXME
+# FIXME - some extensions might directly use symbols from one of libs. If
+# that symbol isn't used by postgres, and statically linked, it'll cause an
+# undefined symbol at runtime. And obviously it'll cause problems for
+# executables, although those are probably less common.
+var_libs = ''
+
+
+pg_config_paths = configure_file(
+ output: 'pg_config_paths.h',
+ configuration: config_paths_data,
+ install: false,
+)
+configure_files += pg_config_paths
+
+install_headers(
+ 'pg_config_manual.h',
+ 'postgres_ext.h',
+)
+
+install_headers(
+ 'libpq/libpq-fs.h',
+ install_dir: dir_include / 'libpq',
+)
+
+install_headers(
+ 'c.h',
+ 'port.h',
+ 'postgres_fe.h',
+ install_dir: dir_include_internal
+)
+
+install_headers(
+ 'libpq/pqcomm.h',
+ install_dir: dir_include_internal / 'libpq',
+)
+
+install_headers(
+ 'c.h',
+ 'fmgr.h',
+ 'funcapi.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',
+ 'windowapi.h',
+ pg_config_ext,
+ pg_config_os,
+ pg_config,
+ install_dir: dir_include_server,
+)
+
+subdir('catalog')
+subdir('nodes')
+subdir('storage')
+subdir('utils')
+
+header_subdirs = [
+ 'access',
+ 'catalog',
+ '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',
+]
+
+# XXX: installing headers this way has the danger of installing editor files
+# etc, unfortunately install_subdir() doesn't allow including / excluding by
+# pattern currently.
+foreach d : header_subdirs
+ if d == 'catalog'
+ continue
+ endif
+ 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',
+ 'reformat_dat_file.pl',
+ 'renumber_oids.pl',
+ 'unused_oids',
+ ] + bki_data,
+)
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/include': ['stamp-h', 'stamp-ext-h']}
diff --git a/src/include/nodes/meson.build b/src/include/nodes/meson.build
new file mode 100644
index 00000000000..b7df232081f
--- /dev/null
+++ b/src/include/nodes/meson.build
@@ -0,0 +1,58 @@
+node_support_input_i = [
+ 'nodes/nodes.h',
+ 'nodes/primnodes.h',
+ 'nodes/parsenodes.h',
+ 'nodes/pathnodes.h',
+ 'nodes/plannodes.h',
+ 'nodes/execnodes.h',
+ 'access/amapi.h',
+ 'access/sdir.h',
+ 'access/tableam.h',
+ 'access/tsmapi.h',
+ 'commands/event_trigger.h',
+ 'commands/trigger.h',
+ 'executor/tuptable.h',
+ 'foreign/fdwapi.h',
+ 'nodes/extensible.h',
+ 'nodes/lockoptions.h',
+ 'nodes/replnodes.h',
+ 'nodes/supportnodes.h',
+ 'nodes/value.h',
+ 'utils/rel.h',
+]
+
+node_support_input = []
+foreach i : node_support_input_i
+ node_support_input += meson.source_root() / 'src' / 'include' / i
+endforeach
+
+node_support_output = [
+ 'nodetags.h',
+ 'outfuncs.funcs.c', 'outfuncs.switch.c',
+ 'readfuncs.funcs.c', 'readfuncs.switch.c',
+ 'copyfuncs.funcs.c', 'copyfuncs.switch.c',
+ 'equalfuncs.funcs.c', 'equalfuncs.switch.c',
+]
+node_support_install = [
+ dir_include_server / 'nodes',
+ false, false,
+ false, false,
+ false, false,
+ false, false,
+]
+
+generated_nodes = custom_target('nodetags.h',
+ input: node_support_input,
+ output: node_support_output,
+ command: [
+ perl, files('../../backend/nodes/gen_node_support.pl'),
+ '-o', '@OUTDIR@',
+ '@INPUT@'],
+ install: true,
+ install_dir: node_support_install,
+)
+generated_headers += generated_nodes[0]
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/nodes': node_support_output + ['node-support-stamp']}
+generated_sources_ac += {'src/include/nodes': ['header-stamp']}
diff --git a/src/include/pg_config_ext.h.meson b/src/include/pg_config_ext.h.meson
new file mode 100644
index 00000000000..57cdfca0cfd
--- /dev/null
+++ b/src/include/pg_config_ext.h.meson
@@ -0,0 +1,7 @@
+/*
+ * src/include/pg_config_ext.h.in. This is generated manually, not by
+ * autoheader, since we want to limit which symbols get defined here.
+ */
+
+/* Define to the name of a signed 64-bit integer type. */
+#mesondefine PG_INT64_TYPE
diff --git a/src/include/storage/meson.build b/src/include/storage/meson.build
new file mode 100644
index 00000000000..eae9f98920e
--- /dev/null
+++ b/src/include/storage/meson.build
@@ -0,0 +1,19 @@
+lwlocknames = custom_target('lwlocknames',
+ input: files('../../backend/storage/lmgr/lwlocknames.txt'),
+ output: ['lwlocknames.h', 'lwlocknames.c'],
+ command: [
+ perl, files('../../backend/storage/lmgr/generate-lwlocknames.pl'),
+ '-o', '@OUTDIR@',
+ '@INPUT@'
+ ],
+ build_by_default: true,
+ install: true,
+ install_dir: [dir_include_server / 'storage', false],
+)
+
+lwlocknames_h = lwlocknames[0]
+
+generated_backend_headers += lwlocknames_h
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/storage/lmgr': ['lwlocknames.c', 'lwlocknames.h']}
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
new file mode 100644
index 00000000000..bded105f7ea
--- /dev/null
+++ b/src/include/utils/meson.build
@@ -0,0 +1,57 @@
+errcodes = custom_target('errcodes',
+ input: files('../../backend/utils/errcodes.txt'),
+ output: ['errcodes.h'],
+ command: [
+ perl, files('../../backend/utils/generate-errcodes.pl'),
+ '--outfile', '@OUTPUT@',
+ '@INPUT@',
+ ],
+ install: true,
+ install_dir: dir_include_server / 'utils',
+)
+generated_headers += errcodes
+
+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,
+ 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_output = ['fmgroids.h', 'fmgrprotos.h', 'fmgrtab.c']
+fmgrtab_target = custom_target('fmgrtab',
+ input: '../catalog/pg_proc.dat',
+ output : fmgrtab_output,
+ 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]
+generated_backend_headers += fmgrtab_target[1]
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {
+ 'src/backend/utils': fmgrtab_output + ['errcodes.h', 'probes.h', 'fmgr-stamp'],
+ 'src/include/utils': ['header-stamp'],
+}
diff --git a/src/common/meson.build b/src/common/meson.build
new file mode 100644
index 00000000000..23842e1ffef
--- /dev/null
+++ b/src/common/meson.build
@@ -0,0 +1,174 @@
+common_sources = files(
+ 'archive.c',
+ 'base64.c',
+ 'checksum_helper.c',
+ 'compression.c',
+ 'controldata_utils.c',
+ 'encnames.c',
+ 'exec.c',
+ 'file_perm.c',
+ 'file_utils.c',
+ 'hashfn.c',
+ 'ip.c',
+ 'jsonapi.c',
+ 'keywords.c',
+ 'kwlookup.c',
+ 'link-canary.c',
+ 'md5_common.c',
+ 'pg_get_line.c',
+ 'pg_lzcompress.c',
+ 'pg_prng.c',
+ 'pgfnames.c',
+ 'psprintf.c',
+ 'relpath.c',
+ 'rmtree.c',
+ 'saslprep.c',
+ 'scram-common.c',
+ 'string.c',
+ 'stringinfo.c',
+ 'unicode_norm.c',
+ 'username.c',
+ 'wait_error.c',
+ 'wchar.c',
+)
+
+if ssl.found()
+ common_sources += files(
+ 'cryptohash_openssl.c',
+ 'hmac_openssl.c',
+ 'protocol_openssl.c',
+ )
+else
+ common_sources += files(
+ 'cryptohash.c',
+ 'hmac.c',
+ 'md5.c',
+ 'sha1.c',
+ 'sha2.c',
+ )
+endif
+
+common_kwlist = custom_target('kwlist',
+ input: files('../include/parser/kwlist.h'),
+ output: 'kwlist_d.h',
+ command: [perl, '-I', '@SOURCE_ROOT@/src/tools', files('../tools/gen_keywordlist.pl'),
+ '--extern', '--output', '@OUTDIR@', '@INPUT@'])
+generated_sources += common_kwlist
+common_sources += common_kwlist
+
+# The code imported from Ryu gets a pass on declaration-after-statement,
+# in order to keep it more closely aligned with its upstream.
+ryu_sources = files(
+ 'd2s.c',
+ 'f2s.c',
+)
+ryu_cflags = []
+
+if using_declaration_after_statement_warning
+ ryu_cflags += ['-Wno-declaration-after-statement']
+endif
+
+config_info_sources = files('config_info.c',)
+config_info_cflags = [
+ '-DVAL_CC="@0@"'.format(var_cc),
+ '-DVAL_CPPFLAGS="@0@"'.format(var_cppflags),
+ '-DVAL_CFLAGS="@0@"'.format(var_cflags),
+ '-DVAL_CFLAGS_SL="@0@"'.format(var_cflags_sl),
+ '-DVAL_LDFLAGS="@0@"'.format(var_ldflags),
+ '-DVAL_LDFLAGS_EX="@0@"'.format(var_ldflags_ex),
+ '-DVAL_LDFLAGS_SL="@0@"'.format(var_ldflags_sl),
+ '-DVAL_LIBS="@0@"'.format(var_libs),
+]
+
+# Some files need to be built with different cflags. The different sets are
+# defined here.
+common_cflags = {
+ 'ryu': ryu_cflags,
+ 'config_info': config_info_cflags,
+}
+common_sources_cflags = {
+ 'ryu': ryu_sources,
+ 'config_info': config_info_sources
+}
+
+
+# A few files are currently only built for frontend, not server
+# (Mkvcbuild.pm has a copy of this list, too). logging.c is excluded
+# from OBJS_FRONTEND_SHLIB (shared library) as a matter of policy,
+# because it is not appropriate for general purpose libraries such
+# as libpq to report errors directly.
+
+common_sources_frontend_shlib = common_sources
+common_sources_frontend_shlib += files(
+ 'fe_memutils.c',
+ 'restricted_token.c',
+ 'sprompt.c',
+)
+
+common_sources_frontend_static = common_sources_frontend_shlib
+common_sources_frontend_static += files(
+ 'logging.c',
+)
+
+# Build pgport once for backend, once for use in frontend binaries, and once
+# for use in shared libraries
+#
+# XXX: in most environments we could probably link_whole pgcommon_shlib
+# against pgcommon_static, instead of compiling twice.
+#
+# For the server build of pgcommon, depend on lwlocknames_h, because at least
+# cryptohash_openssl.c, hmac_openssl.c depend on it. That's arguably a
+# layering violation, but ...
+pgcommon = {}
+pgcommon_variants = {
+ '_srv': internal_lib_args + {
+ 'sources': common_sources + [lwlocknames_h],
+ 'dependencies': [backend_common_code],
+ },
+ '': default_lib_args + {
+ 'sources': common_sources_frontend_static,
+ 'dependencies': [frontend_common_code],
+ },
+ '_shlib': default_lib_args + {
+ 'pic': true,
+ 'sources': common_sources_frontend_shlib,
+ 'dependencies': [frontend_common_code],
+ },
+}
+
+foreach name, opts : pgcommon_variants
+
+ # Build internal static libraries for sets of files that need to be built
+ # with different cflags
+ cflag_libs = []
+ foreach cflagname, sources : common_sources_cflags
+ if sources.length() == 0
+ continue
+ endif
+ c_args = opts.get('c_args', []) + common_cflags[cflagname]
+ cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ include_directories: include_directories('.'),
+ kwargs: opts + {
+ 'sources': sources,
+ 'c_args': c_args,
+ 'build_by_default': false,
+ 'install': false,
+ },
+ )
+ endforeach
+
+ lib = static_library('libpgcommon@0@'.format(name),
+ link_with: cflag_libs,
+ include_directories: include_directories('.'),
+ kwargs: opts + {
+ 'dependencies': opts['dependencies'] + [ssl],
+ }
+ )
+ pgcommon += {name: lib}
+endforeach
+
+common_srv = pgcommon['_srv']
+common_shlib = pgcommon['_shlib']
+common_static = pgcommon['']
+
+subdir('unicode')
diff --git a/src/common/unicode/meson.build b/src/common/unicode/meson.build
new file mode 100644
index 00000000000..43f0edd83e0
--- /dev/null
+++ b/src/common/unicode/meson.build
@@ -0,0 +1,106 @@
+UNICODE_VERSION = '14.0.0'
+
+unicode_data = {}
+unicode_baseurl = 'https://www.unicode.org/Public/@0@/ucd/@1@'
+
+if not wget.found()
+ subdir_done()
+endif
+
+# These files are part of the Unicode Character Database. Download them on
+# demand.
+foreach f : ['UnicodeData.txt', 'EastAsianWidth.txt', 'DerivedNormalizationProps.txt', 'CompositionExclusions.txt', 'NormalizationTest.txt']
+ url = unicode_baseurl.format(UNICODE_VERSION, f)
+ target = custom_target(f,
+ output: f,
+ command: [wget, wget_flags, url],
+ build_by_default: false,
+ )
+ unicode_data += {f: target}
+endforeach
+
+
+update_unicode_targets = []
+
+update_unicode_targets += \
+ custom_target('unicode_norm_table.h',
+ input: [unicode_data['UnicodeData.txt'], unicode_data['CompositionExclusions.txt']],
+ output: ['unicode_norm_table.h', 'unicode_norm_hashfunc.h'],
+ command: [
+ perl, files('generate-unicode_norm_table.pl'),
+ '--outdir', '@OUTDIR@', '@INPUT@'],
+ build_by_default: false,
+ )
+
+update_unicode_targets += \
+ custom_target('unicode_nonspacing_table.h',
+ input: [unicode_data['UnicodeData.txt']],
+ output: ['unicode_nonspacing_table.h'],
+ command: [perl, files('generate-unicode_nonspacing_table.pl'), '@INPUT@'],
+ build_by_default: false,
+ capture: true,
+ )
+
+update_unicode_targets += \
+ custom_target('unicode_east_asian_fw_table.h',
+ input: [unicode_data['EastAsianWidth.txt']],
+ output: ['unicode_east_asian_fw_table.h'],
+ command: [perl, files('generate-unicode_east_asian_fw_table.pl'), '@INPUT@'],
+ build_by_default: false,
+ capture: true,
+ )
+
+update_unicode_targets += \
+ custom_target('unicode_normprops_table.h',
+ input: [unicode_data['DerivedNormalizationProps.txt']],
+ output: ['unicode_normprops_table.h'],
+ command: [perl, files('generate-unicode_normprops_table.pl'), '@INPUT@'],
+ build_by_default: false,
+ capture: true,
+ )
+
+norm_test_table = custom_target('norm_test_table.h',
+ input: [unicode_data['NormalizationTest.txt']],
+ output: ['norm_test_table.h'],
+ command: [perl, files('generate-norm_test_table.pl'), '@INPUT@', '@OUTPUT@'],
+ build_by_default: false,
+ )
+
+inc = include_directories('.')
+
+norm_test = executable('norm_test',
+ ['norm_test.c', norm_test_table],
+ dependencies: [frontend_port_code],
+ include_directories: inc,
+ link_with: [common_static, pgport_static],
+ build_by_default: false,
+ kwargs: default_bin_args + {
+ 'install': false,
+ }
+)
+
+update_unicode_dep = []
+
+if not meson.is_cross_build()
+ update_unicode_dep += custom_target('norm_test.run',
+ output: 'norm_test.run',
+ input: update_unicode_targets,
+ command: [norm_test],
+ build_by_default: false,
+ build_always_stale: true,
+ )
+endif
+
+
+# Use a custom target, as run targets serialize the output, making this harder
+# to debug, and don't deal well with targets with multiple outputs.
+update_unicode = custom_target('update-unicode',
+ depends: update_unicode_dep,
+ output: ['dont-exist'],
+ input: update_unicode_targets,
+ command: ['cp', '@INPUT@', '@SOURCE_ROOT@/src/include/common/'],
+ build_by_default: false,
+ build_always_stale: true,
+)
+
+alias_target('update-unicode', update_unicode)
diff --git a/src/port/meson.build b/src/port/meson.build
new file mode 100644
index 00000000000..ced2e014db8
--- /dev/null
+++ b/src/port/meson.build
@@ -0,0 +1,184 @@
+pgport_sources = [
+ 'bsearch_arg.c',
+ 'chklocale.c',
+ 'inet_net_ntop.c',
+ 'noblock.c',
+ 'path.c',
+ 'pg_bitutils.c',
+ 'pg_strong_random.c',
+ 'pgcheckdir.c',
+ 'pgmkdirp.c',
+ 'pgsleep.c',
+ 'pgstrcasecmp.c',
+ 'pgstrsignal.c',
+ 'pqsignal.c',
+ 'qsort.c',
+ 'qsort_arg.c',
+ 'quotes.c',
+ 'snprintf.c',
+ 'strerror.c',
+ 'tar.c',
+ 'thread.c',
+]
+
+if host_system == 'windows'
+ pgport_sources += files(
+ 'dirmod.c',
+ 'kill.c',
+ 'open.c',
+ 'system.c',
+ 'win32dlopen.c',
+ 'win32env.c',
+ 'win32error.c',
+ 'win32fdatasync.c',
+ 'win32getrusage.c',
+ 'win32link.c',
+ 'win32ntdll.c',
+ 'win32pread.c',
+ 'win32pwrite.c',
+ 'win32security.c',
+ 'win32setlocale.c',
+ 'win32stat.c',
+ )
+endif
+
+if cc.get_id() == 'msvc'
+ pgport_sources += files(
+ 'dirent.c',
+ 'win32gettimeofday.c',
+ )
+endif
+
+# Replacement functionality to be built if corresponding configure symbol
+# is false
+replace_funcs_neg = [
+ ['explicit_bzero'],
+ ['getopt'],
+ ['getopt_long'],
+ ['getpeereid'],
+ ['inet_aton'],
+ ['mkdtemp'],
+ ['preadv', 'HAVE_DECL_PREADV'],
+ ['pwritev', 'HAVE_DECL_PWRITEV'],
+ ['strlcat'],
+ ['strlcpy'],
+ ['strnlen'],
+]
+
+if host_system != 'windows'
+ replace_funcs_neg += [['pthread_barrier_wait']]
+endif
+
+# Replacement functionality to be built if corresponding configure symbol
+# is true
+replace_funcs_pos = [
+ # x86/x64
+ ['pg_crc32c_sse42', 'USE_SSE42_CRC32C'],
+ ['pg_crc32c_sse42', 'USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 'crc'],
+ ['pg_crc32c_sse42_choose', 'USE_SSE42_CRC32C_WITH_RUNTIME_CHECK'],
+ ['pg_crc32c_sb8', 'USE_SSE42_CRC32C_WITH_RUNTIME_CHECK'],
+
+ # arm / aarch64
+ ['pg_crc32c_armv8', 'USE_ARMV8_CRC32C'],
+ ['pg_crc32c_armv8', 'USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK', 'crc'],
+ ['pg_crc32c_armv8_choose', 'USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK'],
+ ['pg_crc32c_sb8', 'USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK'],
+
+ # generic fallback
+ ['pg_crc32c_sb8', 'USE_SLICING_BY_8_CRC32C'],
+]
+
+pgport_cflags = {'crc': cflags_crc}
+pgport_sources_cflags = {'crc': []}
+
+foreach f : replace_funcs_neg
+ func = f.get(0)
+ varname = f.get(1, 'HAVE_@0@'.format(func.to_upper()))
+ filename = '@0@.c'.format(func)
+
+ val = '@0@'.format(cdata.get(varname, 'false'))
+ if val == 'false' or val == '0'
+ pgport_sources += files(filename)
+ endif
+endforeach
+
+foreach f : replace_funcs_pos
+ func = f.get(0)
+ varname = f.get(1, 'HAVE_@0@'.format(func.to_upper()))
+ filename = '@0@.c'.format(func)
+
+ val = '@0@'.format(cdata.get(varname, 'false'))
+ if val == 'true' or val == '1'
+ src = files(filename)
+ if f.length() > 2
+ pgport_sources_cflags += {f[2]: pgport_sources_cflags[f[2]] + src}
+ else
+ pgport_sources += src
+ endif
+ endif
+endforeach
+
+
+if (host_system == 'windows' or host_system == 'cygwin') and \
+ (cc.get_id() != 'msvc' or cc.version().version_compare('<14.0'))
+
+ # Cygwin and (apparently, based on test results) Mingw both
+ # have a broken strtof(), so substitute its implementation.
+ # That's not a perfect fix, since it doesn't avoid double-rounding,
+ # but we have no better options.
+ pgport_sources += files('strtof.c')
+ message('On @0@ with compiler @1@ @2@ we will use our strtof wrapper.'.format(
+ host_system, cc.get_id(), cc.version()))
+endif
+
+
+
+# Build pgport once for backend, once for use in frontend binaries, and once
+# for use in shared libraries
+pgport = {}
+pgport_variants = {
+ '_srv': internal_lib_args + {
+ 'dependencies': [backend_port_code],
+ },
+ '': default_lib_args + {
+ 'dependencies': [frontend_port_code],
+ },
+ '_shlib': default_lib_args + {
+ 'pic': true,
+ 'dependencies': [frontend_port_code],
+ },
+}
+
+foreach name, opts : pgport_variants
+
+ # Build internal static libraries for sets of files that need to be built
+ # with different cflags
+ cflag_libs = []
+ foreach cflagname, sources : pgport_sources_cflags
+ if sources.length() == 0
+ continue
+ endif
+ c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
+ cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
+ sources,
+ kwargs: opts + {
+ 'c_args': c_args,
+ 'build_by_default': false,
+ 'install': false,
+ },
+ )
+ endforeach
+
+ lib = static_library('libpgport@0@'.format(name),
+ pgport_sources,
+ link_with: cflag_libs,
+ kwargs: opts + {
+ 'dependencies': opts['dependencies'] + [ssl],
+ }
+ )
+ pgport += {name: lib}
+endforeach
+
+pgport_srv = pgport['_srv']
+pgport_static = pgport['']
+pgport_shlib = pgport['_shlib']
diff --git a/config/meson.build b/config/meson.build
new file mode 100644
index 00000000000..ab19c380bd2
--- /dev/null
+++ b/config/meson.build
@@ -0,0 +1,4 @@
+install_data(
+ 'install-sh', 'missing',
+ install_dir: dir_pgxs / 'config'
+)
diff --git a/src/backend/access/brin/meson.build b/src/backend/access/brin/meson.build
new file mode 100644
index 00000000000..a54c7532927
--- /dev/null
+++ b/src/backend/access/brin/meson.build
@@ -0,0 +1,12 @@
+backend_sources += files(
+ 'brin.c',
+ 'brin_bloom.c',
+ 'brin_inclusion.c',
+ 'brin_minmax.c',
+ 'brin_minmax_multi.c',
+ 'brin_pageops.c',
+ 'brin_revmap.c',
+ 'brin_tuple.c',
+ 'brin_validate.c',
+ 'brin_xlog.c',
+)
diff --git a/src/backend/access/common/meson.build b/src/backend/access/common/meson.build
new file mode 100644
index 00000000000..857beaa32d3
--- /dev/null
+++ b/src/backend/access/common/meson.build
@@ -0,0 +1,18 @@
+backend_sources += files(
+ 'attmap.c',
+ 'bufmask.c',
+ 'detoast.c',
+ 'heaptuple.c',
+ 'indextuple.c',
+ 'printsimple.c',
+ 'printtup.c',
+ 'relation.c',
+ 'reloptions.c',
+ 'scankey.c',
+ 'session.c',
+ 'syncscan.c',
+ 'toast_compression.c',
+ 'toast_internals.c',
+ 'tupconvert.c',
+ 'tupdesc.c',
+)
diff --git a/src/backend/access/gin/meson.build b/src/backend/access/gin/meson.build
new file mode 100644
index 00000000000..56d6f343d54
--- /dev/null
+++ b/src/backend/access/gin/meson.build
@@ -0,0 +1,17 @@
+backend_sources += files(
+ 'ginarrayproc.c',
+ 'ginbtree.c',
+ 'ginbulk.c',
+ 'gindatapage.c',
+ 'ginentrypage.c',
+ 'ginfast.c',
+ 'ginget.c',
+ 'gininsert.c',
+ 'ginlogic.c',
+ 'ginpostinglist.c',
+ 'ginscan.c',
+ 'ginutil.c',
+ 'ginvacuum.c',
+ 'ginvalidate.c',
+ 'ginxlog.c',
+)
diff --git a/src/backend/access/gist/meson.build b/src/backend/access/gist/meson.build
new file mode 100644
index 00000000000..1a996b5e25d
--- /dev/null
+++ b/src/backend/access/gist/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'gist.c',
+ 'gistbuild.c',
+ 'gistbuildbuffers.c',
+ 'gistget.c',
+ 'gistproc.c',
+ 'gistscan.c',
+ 'gistsplit.c',
+ 'gistutil.c',
+ 'gistvacuum.c',
+ 'gistvalidate.c',
+ 'gistxlog.c',
+)
diff --git a/src/backend/access/hash/meson.build b/src/backend/access/hash/meson.build
new file mode 100644
index 00000000000..22f2c691c34
--- /dev/null
+++ b/src/backend/access/hash/meson.build
@@ -0,0 +1,12 @@
+backend_sources += files(
+ 'hash.c',
+ 'hash_xlog.c',
+ 'hashfunc.c',
+ 'hashinsert.c',
+ 'hashovfl.c',
+ 'hashpage.c',
+ 'hashsearch.c',
+ 'hashsort.c',
+ 'hashutil.c',
+ 'hashvalidate.c',
+)
diff --git a/src/backend/access/heap/meson.build b/src/backend/access/heap/meson.build
new file mode 100644
index 00000000000..f1dca73743c
--- /dev/null
+++ b/src/backend/access/heap/meson.build
@@ -0,0 +1,11 @@
+backend_sources += files(
+ 'heapam.c',
+ 'heapam_handler.c',
+ 'heapam_visibility.c',
+ 'heaptoast.c',
+ 'hio.c',
+ 'pruneheap.c',
+ 'rewriteheap.c',
+ 'vacuumlazy.c',
+ 'visibilitymap.c',
+)
diff --git a/src/backend/access/index/meson.build b/src/backend/access/index/meson.build
new file mode 100644
index 00000000000..18af5533e65
--- /dev/null
+++ b/src/backend/access/index/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'amapi.c',
+ 'amvalidate.c',
+ 'genam.c',
+ 'indexam.c',
+)
diff --git a/src/backend/access/meson.build b/src/backend/access/meson.build
new file mode 100644
index 00000000000..9874291fc0a
--- /dev/null
+++ b/src/backend/access/meson.build
@@ -0,0 +1,13 @@
+subdir('brin')
+subdir('common')
+subdir('gin')
+subdir('gist')
+subdir('hash')
+subdir('heap')
+subdir('index')
+subdir('nbtree')
+subdir('rmgrdesc')
+subdir('spgist')
+subdir('table')
+subdir('tablesample')
+subdir('transam')
diff --git a/src/backend/access/nbtree/meson.build b/src/backend/access/nbtree/meson.build
new file mode 100644
index 00000000000..07dc29e8190
--- /dev/null
+++ b/src/backend/access/nbtree/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'nbtcompare.c',
+ 'nbtdedup.c',
+ 'nbtinsert.c',
+ 'nbtpage.c',
+ 'nbtree.c',
+ 'nbtsearch.c',
+ 'nbtsort.c',
+ 'nbtsplitloc.c',
+ 'nbtutils.c',
+ 'nbtvalidate.c',
+ 'nbtxlog.c',
+)
diff --git a/src/backend/access/rmgrdesc/meson.build b/src/backend/access/rmgrdesc/meson.build
new file mode 100644
index 00000000000..f3a6e0a571b
--- /dev/null
+++ b/src/backend/access/rmgrdesc/meson.build
@@ -0,0 +1,26 @@
+# used by frontend programs like pg_waldump
+rmgr_desc_sources = files(
+ 'brindesc.c',
+ 'clogdesc.c',
+ 'committsdesc.c',
+ 'dbasedesc.c',
+ 'genericdesc.c',
+ 'gindesc.c',
+ 'gistdesc.c',
+ 'hashdesc.c',
+ 'heapdesc.c',
+ 'logicalmsgdesc.c',
+ 'mxactdesc.c',
+ 'nbtdesc.c',
+ 'relmapdesc.c',
+ 'replorigindesc.c',
+ 'seqdesc.c',
+ 'smgrdesc.c',
+ 'spgdesc.c',
+ 'standbydesc.c',
+ 'tblspcdesc.c',
+ 'xactdesc.c',
+ 'xlogdesc.c',
+)
+
+backend_sources += rmgr_desc_sources
diff --git a/src/backend/access/spgist/meson.build b/src/backend/access/spgist/meson.build
new file mode 100644
index 00000000000..f18d0d2e53f
--- /dev/null
+++ b/src/backend/access/spgist/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'spgdoinsert.c',
+ 'spginsert.c',
+ 'spgkdtreeproc.c',
+ 'spgproc.c',
+ 'spgquadtreeproc.c',
+ 'spgscan.c',
+ 'spgtextproc.c',
+ 'spgutils.c',
+ 'spgvacuum.c',
+ 'spgvalidate.c',
+ 'spgxlog.c',
+)
diff --git a/src/backend/access/table/meson.build b/src/backend/access/table/meson.build
new file mode 100644
index 00000000000..66c706d640e
--- /dev/null
+++ b/src/backend/access/table/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'table.c',
+ 'tableam.c',
+ 'tableamapi.c',
+ 'toast_helper.c',
+)
diff --git a/src/backend/access/tablesample/meson.build b/src/backend/access/tablesample/meson.build
new file mode 100644
index 00000000000..63ee8203226
--- /dev/null
+++ b/src/backend/access/tablesample/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'bernoulli.c',
+ 'system.c',
+ 'tablesample.c',
+)
diff --git a/src/backend/access/transam/meson.build b/src/backend/access/transam/meson.build
new file mode 100644
index 00000000000..c32169bd2c6
--- /dev/null
+++ b/src/backend/access/transam/meson.build
@@ -0,0 +1,31 @@
+backend_sources += files(
+ 'clog.c',
+ 'commit_ts.c',
+ 'generic_xlog.c',
+ 'multixact.c',
+ 'parallel.c',
+ 'rmgr.c',
+ 'slru.c',
+ 'subtrans.c',
+ 'timeline.c',
+ 'transam.c',
+ 'twophase.c',
+ 'twophase_rmgr.c',
+ 'varsup.c',
+ 'xact.c',
+ 'xlog.c',
+ 'xlogarchive.c',
+ 'xlogfuncs.c',
+ 'xloginsert.c',
+ 'xlogprefetcher.c',
+ 'xlogrecovery.c',
+ 'xlogstats.c',
+ 'xlogutils.c',
+)
+
+# used by frontend programs to build a frontend xlogreader
+xlogreader_sources = files(
+ 'xlogreader.c',
+)
+
+backend_sources += xlogreader_sources
diff --git a/src/backend/backup/meson.build b/src/backend/backup/meson.build
new file mode 100644
index 00000000000..a09305cadfa
--- /dev/null
+++ b/src/backend/backup/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'backup_manifest.c',
+ 'basebackup.c',
+ 'basebackup_copy.c',
+ 'basebackup_gzip.c',
+ 'basebackup_lz4.c',
+ 'basebackup_progress.c',
+ 'basebackup_server.c',
+ 'basebackup_sink.c',
+ 'basebackup_target.c',
+ 'basebackup_throttle.c',
+ 'basebackup_zstd.c',
+)
diff --git a/src/backend/bootstrap/meson.build b/src/backend/bootstrap/meson.build
new file mode 100644
index 00000000000..55c33dd21c3
--- /dev/null
+++ b/src/backend/bootstrap/meson.build
@@ -0,0 +1,28 @@
+backend_sources += files(
+ 'bootstrap.c')
+
+# see ../parser/meson.build
+boot_parser_sources = []
+
+bootscanner = custom_target('bootscanner',
+ input: 'bootscanner.l',
+ output: 'bootscanner.c',
+ command: flex_cmd,
+)
+generated_sources += bootscanner
+boot_parser_sources += bootscanner
+
+bootparse = custom_target('bootparse',
+ input: 'bootparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += bootparse.to_list()
+boot_parser_sources += bootparse
+
+boot_parser = static_library('boot_parser',
+ boot_parser_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += boot_parser
diff --git a/src/backend/catalog/meson.build b/src/backend/catalog/meson.build
new file mode 100644
index 00000000000..08747914516
--- /dev/null
+++ b/src/backend/catalog/meson.build
@@ -0,0 +1,44 @@
+backend_sources += files(
+ 'aclchk.c',
+ 'catalog.c',
+ 'dependency.c',
+ 'heap.c',
+ 'index.c',
+ 'indexing.c',
+ 'namespace.c',
+ 'objectaccess.c',
+ 'objectaddress.c',
+ 'partition.c',
+ 'pg_aggregate.c',
+ 'pg_attrdef.c',
+ 'pg_cast.c',
+ 'pg_class.c',
+ 'pg_collation.c',
+ 'pg_constraint.c',
+ 'pg_conversion.c',
+ 'pg_db_role_setting.c',
+ 'pg_depend.c',
+ 'pg_enum.c',
+ 'pg_inherits.c',
+ 'pg_largeobject.c',
+ 'pg_namespace.c',
+ 'pg_operator.c',
+ 'pg_parameter_acl.c',
+ 'pg_proc.c',
+ 'pg_publication.c',
+ 'pg_range.c',
+ 'pg_shdepend.c',
+ 'pg_subscription.c',
+ 'pg_type.c',
+ 'storage.c',
+ 'toasting.c',
+)
+
+
+install_data(
+ 'information_schema.sql',
+ 'sql_features.txt',
+ 'system_functions.sql',
+ 'system_views.sql',
+ install_dir: dir_data,
+)
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
new file mode 100644
index 00000000000..9b350d025ff
--- /dev/null
+++ b/src/backend/commands/meson.build
@@ -0,0 +1,51 @@
+backend_sources += files(
+ 'aggregatecmds.c',
+ 'alter.c',
+ 'amcmds.c',
+ 'analyze.c',
+ 'async.c',
+ 'cluster.c',
+ 'collationcmds.c',
+ 'comment.c',
+ 'constraint.c',
+ 'conversioncmds.c',
+ 'copy.c',
+ 'copyfrom.c',
+ 'copyfromparse.c',
+ 'copyto.c',
+ 'createas.c',
+ 'dbcommands.c',
+ 'define.c',
+ 'discard.c',
+ 'dropcmds.c',
+ 'event_trigger.c',
+ 'explain.c',
+ 'extension.c',
+ 'foreigncmds.c',
+ 'functioncmds.c',
+ 'indexcmds.c',
+ 'lockcmds.c',
+ 'matview.c',
+ 'opclasscmds.c',
+ 'operatorcmds.c',
+ 'policy.c',
+ 'portalcmds.c',
+ 'prepare.c',
+ 'proclang.c',
+ 'publicationcmds.c',
+ 'schemacmds.c',
+ 'seclabel.c',
+ 'sequence.c',
+ 'statscmds.c',
+ 'subscriptioncmds.c',
+ 'tablecmds.c',
+ 'tablespace.c',
+ 'trigger.c',
+ 'tsearchcmds.c',
+ 'typecmds.c',
+ 'user.c',
+ 'vacuum.c',
+ 'vacuumparallel.c',
+ 'variable.c',
+ 'view.c',
+)
diff --git a/src/backend/executor/meson.build b/src/backend/executor/meson.build
new file mode 100644
index 00000000000..518674cfa28
--- /dev/null
+++ b/src/backend/executor/meson.build
@@ -0,0 +1,67 @@
+backend_sources += files(
+ 'execAmi.c',
+ 'execAsync.c',
+ 'execCurrent.c',
+ 'execExpr.c',
+ 'execExprInterp.c',
+ 'execGrouping.c',
+ 'execIndexing.c',
+ 'execJunk.c',
+ 'execMain.c',
+ 'execParallel.c',
+ 'execPartition.c',
+ 'execProcnode.c',
+ 'execReplication.c',
+ 'execSRF.c',
+ 'execScan.c',
+ 'execTuples.c',
+ 'execUtils.c',
+ 'functions.c',
+ 'instrument.c',
+ 'nodeAgg.c',
+ 'nodeAppend.c',
+ 'nodeBitmapAnd.c',
+ 'nodeBitmapHeapscan.c',
+ 'nodeBitmapIndexscan.c',
+ 'nodeBitmapOr.c',
+ 'nodeCtescan.c',
+ 'nodeCustom.c',
+ 'nodeForeignscan.c',
+ 'nodeFunctionscan.c',
+ 'nodeGather.c',
+ 'nodeGatherMerge.c',
+ 'nodeGroup.c',
+ 'nodeHash.c',
+ 'nodeHashjoin.c',
+ 'nodeIncrementalSort.c',
+ 'nodeIndexonlyscan.c',
+ 'nodeIndexscan.c',
+ 'nodeLimit.c',
+ 'nodeLockRows.c',
+ 'nodeMaterial.c',
+ 'nodeMemoize.c',
+ 'nodeMergeAppend.c',
+ 'nodeMergejoin.c',
+ 'nodeModifyTable.c',
+ 'nodeNamedtuplestorescan.c',
+ 'nodeNestloop.c',
+ 'nodeProjectSet.c',
+ 'nodeRecursiveunion.c',
+ 'nodeResult.c',
+ 'nodeSamplescan.c',
+ 'nodeSeqscan.c',
+ 'nodeSetOp.c',
+ 'nodeSort.c',
+ 'nodeSubplan.c',
+ 'nodeSubqueryscan.c',
+ 'nodeTableFuncscan.c',
+ 'nodeTidrangescan.c',
+ 'nodeTidscan.c',
+ 'nodeUnique.c',
+ 'nodeValuesscan.c',
+ 'nodeWindowAgg.c',
+ 'nodeWorktablescan.c',
+ 'spi.c',
+ 'tqueue.c',
+ 'tstoreReceiver.c',
+)
diff --git a/src/backend/foreign/meson.build b/src/backend/foreign/meson.build
new file mode 100644
index 00000000000..57463db92c1
--- /dev/null
+++ b/src/backend/foreign/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'foreign.c'
+)
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
new file mode 100644
index 00000000000..de2e624ab58
--- /dev/null
+++ b/src/backend/jit/llvm/meson.build
@@ -0,0 +1,73 @@
+if not llvm.found()
+ subdir_done()
+endif
+
+# Build LLVM JIT backend module
+
+llvmjit_sources = []
+
+# Infrastructure
+llvmjit_sources += files(
+ 'llvmjit.c',
+ 'llvmjit_error.cpp',
+ 'llvmjit_inline.cpp',
+ 'llvmjit_wrap.cpp',
+)
+
+# Code generation
+llvmjit_sources += files(
+ 'llvmjit_deform.c',
+ 'llvmjit_expr.c',
+)
+
+llvmjit = shared_module('llvmjit',
+ llvmjit_sources,
+ kwargs: pg_mod_args + {
+ 'dependencies': pg_mod_args['dependencies'] + [llvm],
+ }
+)
+
+backend_targets += llvmjit
+
+
+# Define a few bits and pieces used here and elsewhere to generate bitcode
+
+llvm_irgen_args = [
+ '-c', '-o', '@OUTPUT@', '@INPUT@',
+ '-flto=thin', '-emit-llvm',
+ '-MD', '-MQ', '@OUTPUT@', '-MF', '@DEPFILE@',
+ '-O2',
+ '-Wno-ignored-attributes',
+ '-Wno-empty-body',
+]
+
+if ccache.found()
+ llvm_irgen_command = ccache
+ llvm_irgen_args = [clang.path()] + llvm_irgen_args
+else
+ llvm_irgen_command = clang
+endif
+
+
+# XXX: Need to determine proper version of the function cflags for clang
+bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
+bitcode_cflags += cppflags
+
+# XXX: Worth improving on the logic to find directories here
+bitcode_cflags += '-I@BUILD_ROOT@/src/include'
+bitcode_cflags += '-I@BUILD_ROOT@/src/backend/utils/misc'
+bitcode_cflags += '-I@SOURCE_ROOT@/src/include'
+
+
+# Note this is intentionally not installed to bitcodedir, as it's not for
+# inlining
+llvmjit_types = custom_target('llvmjit_types.bc',
+ command: [llvm_irgen_command] + llvm_irgen_args + bitcode_cflags,
+ input: 'llvmjit_types.c',
+ output: 'llvmjit_types.bc',
+ depends: [postgres],
+ install: true,
+ install_dir: dir_lib_pkg,
+ depfile: '@BASENAME@.c.bc.d',
+)
+backend_targets += llvmjit_types
diff --git a/src/backend/jit/meson.build b/src/backend/jit/meson.build
new file mode 100644
index 00000000000..63cd33a4bed
--- /dev/null
+++ b/src/backend/jit/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'jit.c'
+)
diff --git a/src/backend/lib/meson.build b/src/backend/lib/meson.build
new file mode 100644
index 00000000000..48da1bddce7
--- /dev/null
+++ b/src/backend/lib/meson.build
@@ -0,0 +1,12 @@
+backend_sources += files(
+ 'binaryheap.c',
+ 'bipartite_match.c',
+ 'bloomfilter.c',
+ 'dshash.c',
+ 'hyperloglog.c',
+ 'ilist.c',
+ 'integerset.c',
+ 'knapsack.c',
+ 'pairingheap.c',
+ 'rbtree.c',
+)
diff --git a/src/backend/libpq/meson.build b/src/backend/libpq/meson.build
new file mode 100644
index 00000000000..6061269ef13
--- /dev/null
+++ b/src/backend/libpq/meson.build
@@ -0,0 +1,32 @@
+backend_sources += files(
+ 'auth-sasl.c',
+ 'auth-scram.c',
+ 'auth.c',
+ 'be-fsstubs.c',
+ 'be-secure-common.c',
+ 'be-secure.c',
+ 'crypt.c',
+ 'hba.c',
+ 'ifaddr.c',
+ 'pqcomm.c',
+ 'pqformat.c',
+ 'pqmq.c',
+ 'pqsignal.c',
+)
+
+if ssl.found()
+ backend_sources += files('be-secure-openssl.c')
+endif
+
+if gssapi.found()
+ backend_sources += files(
+ 'be-secure-gssapi.c',
+ 'be-gssapi-common.c'
+ )
+endif
+
+install_data(
+ 'pg_hba.conf.sample',
+ 'pg_ident.conf.sample',
+ install_dir: dir_data,
+)
diff --git a/src/backend/main/meson.build b/src/backend/main/meson.build
new file mode 100644
index 00000000000..241e125f089
--- /dev/null
+++ b/src/backend/main/meson.build
@@ -0,0 +1,2 @@
+main_file = files('main.c')
+backend_sources += main_file
diff --git a/src/backend/meson.build b/src/backend/meson.build
new file mode 100644
index 00000000000..fefa40ddb64
--- /dev/null
+++ b/src/backend/meson.build
@@ -0,0 +1,190 @@
+backend_build_deps = [backend_code]
+backend_sources = []
+backend_link_with = [pgport_srv, common_srv]
+
+generated_backend_sources = []
+
+subdir('access')
+subdir('backup')
+subdir('bootstrap')
+subdir('catalog')
+subdir('commands')
+subdir('executor')
+subdir('foreign')
+subdir('jit')
+subdir('lib')
+subdir('libpq')
+subdir('main')
+subdir('nodes')
+subdir('optimizer')
+subdir('parser')
+subdir('partitioning')
+subdir('port')
+subdir('postmaster')
+subdir('regex')
+subdir('replication')
+subdir('rewrite')
+subdir('statistics')
+subdir('storage')
+subdir('tcop')
+subdir('tsearch')
+subdir('utils')
+
+subdir('po', if_found: libintl)
+
+
+backend_link_args = []
+backend_link_depends = []
+
+
+# On windows when compiling with msvc we need to make postgres export all its
+# symbols so that extension libraries can use them. For that we need to scan
+# the constituting objects and generate a file specifying all the functions as
+# exported (variables need an "import" declaration in the header, hence
+# PGDLLEXPORT, but functions work without that, due to import libraries
+# basically being trampolines).
+#
+# For dtrace probes we need to invoke dtrace on all input files, before
+# linking the final executable (see more below).
+#
+#
+# On meson there's currently no easy way to do this that I found. So we build
+# a static library with all the input objects, run our script to generate
+# exports, and build the final executable using that static library
+#
+# We could do that only if either dtrace or msvc is in use, but it seems
+# easier to just always do so.
+#
+# Can't name the static library 'postgres', because msbuild ends up with a
+# conflict for the .pdb file otherwise.
+
+postgres_lib = static_library('postgres_lib',
+ backend_sources + timezone_sources + generated_backend_sources,
+ link_whole: backend_link_with,
+ dependencies: backend_build_deps,
+ kwargs: internal_lib_args,
+)
+
+if cc.get_id() == 'msvc'
+ postgres_def = custom_target('postgres.def',
+ command: [perl, files('../tools/msvc/gendef.pl'),
+ '--arch', host_cpu,
+ '--tempdir', '@PRIVATE_DIR@',
+ '--deffile', '@OUTPUT@',
+ '@INPUT@'],
+ input: [postgres_lib, common_srv, pgport_srv],
+ output: 'postgres.def',
+ depends: [postgres_lib, common_srv, pgport_srv],
+ install: false,
+ build_by_default: false,
+ )
+
+ backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
+ backend_link_depends += postgres_def
+
+elif host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+backend_input = []
+backend_objs = [postgres_lib.extract_all_objects(recursive: false)]
+
+# As of 1/2010:
+# The probes.o file is necessary for dtrace support on Solaris, and on recent
+# versions of systemtap. (Older systemtap releases just produce an empty
+# file, but that's okay.) However, macOS's dtrace doesn't use it and doesn't
+# even recognize the -G option. So, build probes.o except on macOS.
+# This might need adjustment as other platforms add dtrace support.
+#
+# On at least linux we don't actually need to pass in all the objects, but
+# at least on FreeBSD and Solaris we have to.
+#
+# XXX: The reason we don't use the objects for generated sources is that
+# hits a meson bug. Luckily we don't don't have probes in generated
+# sources...
+if dtrace.found() and host_system != 'darwin'
+ backend_input += custom_target(
+ 'probes.o',
+ input: ['utils/probes.d', postgres_lib.extract_objects(backend_sources, timezone_sources)],
+ output: 'probes.o',
+ command: [dtrace, '-C', '-G', '-o', '@OUTPUT@', '-s', '@INPUT@'],
+ install: false,
+ )
+endif
+
+postgres = executable('postgres',
+ backend_input,
+ objects: backend_objs,
+ link_args: backend_link_args,
+ link_with: backend_link_with,
+ link_depends: backend_link_depends,
+ export_dynamic: true,
+ implib: true,
+ dependencies: backend_build_deps,
+ kwargs: default_bin_args,
+)
+
+backend_targets += postgres
+
+pg_mod_c_args = cflags_mod
+pg_mod_cpp_args = cxxflags_mod
+pg_mod_link_args = ldflags_sl + ldflags_mod
+pg_mod_link_depend = []
+
+# A few platforms like MacOS and Windows link shared modules against postgres,
+# or a [import] library derived from it. Set up the link flags for that.
+if mod_link_args_fmt.length() > 0
+ # To avoid unnecessary build-time dependencies on other operating systems,
+ # only the dependency when it when necessary.
+ pg_mod_link_depend += postgres
+
+ name = mod_link_with_name.format('postgres')
+ link_with_uninst = meson.current_build_dir() / name
+ link_with_inst = '${@0@}/@1@'.format(mod_link_with_dir, name)
+
+ foreach el : mod_link_args_fmt
+ pg_mod_link_args += el.format(link_with_uninst)
+ endforeach
+endif
+
+
+# Note there's intentionally no dependency on pgport/common here - we want the
+# symbols from the main binary for extension modules, rather than the
+# extension linking separately to pgport/common.
+backend_mod_code = declare_dependency(
+ compile_args: pg_mod_c_args,
+ include_directories: postgres_inc,
+ link_args: pg_mod_link_args,
+ sources: generated_headers + generated_backend_headers,
+ dependencies: backend_mod_deps,
+)
+
+pg_mod_args = default_mod_args + {
+ 'dependencies': [backend_mod_code],
+ 'cpp_args': pg_mod_cpp_args,
+ 'link_depends': pg_mod_link_depend,
+}
+
+
+
+# Shared modules that, on some system, link against the server binary. Only
+# enter these after we defined the server build.
+
+subdir('jit/llvm')
+subdir('replication/libpqwalreceiver')
+subdir('replication/pgoutput')
+subdir('snowball')
+subdir('utils/mb/conversion_procs')
diff --git a/src/backend/nodes/meson.build b/src/backend/nodes/meson.build
new file mode 100644
index 00000000000..8e0d4039f24
--- /dev/null
+++ b/src/backend/nodes/meson.build
@@ -0,0 +1,29 @@
+backend_sources += files(
+ 'bitmapset.c',
+ 'extensible.c',
+ 'list.c',
+ 'makefuncs.c',
+ 'nodeFuncs.c',
+ 'nodes.c',
+ 'params.c',
+ 'print.c',
+ 'read.c',
+ 'tidbitmap.c',
+ 'value.c',
+)
+
+# these include .c files generated in ../../include/nodes, seems nicer to not
+# add that as an include path for the whole backend
+nodefunc_sources = files(
+ 'copyfuncs.c',
+ 'equalfuncs.c',
+ 'outfuncs.c',
+ 'readfuncs.c',
+)
+nodefuncs = static_library('nodefuncs',
+ nodefunc_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('../../include/nodes'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += nodefuncs
diff --git a/src/backend/optimizer/geqo/meson.build b/src/backend/optimizer/geqo/meson.build
new file mode 100644
index 00000000000..c04f1dc2dfd
--- /dev/null
+++ b/src/backend/optimizer/geqo/meson.build
@@ -0,0 +1,17 @@
+backend_sources += files(
+ 'geqo_copy.c',
+ 'geqo_cx.c',
+ 'geqo_erx.c',
+ 'geqo_eval.c',
+ 'geqo_main.c',
+ 'geqo_misc.c',
+ 'geqo_mutation.c',
+ 'geqo_ox1.c',
+ 'geqo_ox2.c',
+ 'geqo_pmx.c',
+ 'geqo_pool.c',
+ 'geqo_px.c',
+ 'geqo_random.c',
+ 'geqo_recombination.c',
+ 'geqo_selection.c',
+)
diff --git a/src/backend/optimizer/meson.build b/src/backend/optimizer/meson.build
new file mode 100644
index 00000000000..1ab1d9934ae
--- /dev/null
+++ b/src/backend/optimizer/meson.build
@@ -0,0 +1,5 @@
+subdir('geqo')
+subdir('path')
+subdir('plan')
+subdir('prep')
+subdir('util')
diff --git a/src/backend/optimizer/path/meson.build b/src/backend/optimizer/path/meson.build
new file mode 100644
index 00000000000..310042e7aee
--- /dev/null
+++ b/src/backend/optimizer/path/meson.build
@@ -0,0 +1,11 @@
+backend_sources += files(
+ 'allpaths.c',
+ 'clausesel.c',
+ 'costsize.c',
+ 'equivclass.c',
+ 'indxpath.c',
+ 'joinpath.c',
+ 'joinrels.c',
+ 'pathkeys.c',
+ 'tidpath.c',
+)
diff --git a/src/backend/optimizer/plan/meson.build b/src/backend/optimizer/plan/meson.build
new file mode 100644
index 00000000000..22ec65a3845
--- /dev/null
+++ b/src/backend/optimizer/plan/meson.build
@@ -0,0 +1,10 @@
+backend_sources += files(
+ 'analyzejoins.c',
+ 'createplan.c',
+ 'initsplan.c',
+ 'planagg.c',
+ 'planmain.c',
+ 'planner.c',
+ 'setrefs.c',
+ 'subselect.c',
+)
diff --git a/src/backend/optimizer/prep/meson.build b/src/backend/optimizer/prep/meson.build
new file mode 100644
index 00000000000..4549a5b0e79
--- /dev/null
+++ b/src/backend/optimizer/prep/meson.build
@@ -0,0 +1,7 @@
+backend_sources += files(
+ 'prepagg.c',
+ 'prepjointree.c',
+ 'prepqual.c',
+ 'preptlist.c',
+ 'prepunion.c',
+)
diff --git a/src/backend/optimizer/util/meson.build b/src/backend/optimizer/util/meson.build
new file mode 100644
index 00000000000..e7ceaf566b5
--- /dev/null
+++ b/src/backend/optimizer/util/meson.build
@@ -0,0 +1,16 @@
+backend_sources += files(
+ 'appendinfo.c',
+ 'clauses.c',
+ 'inherit.c',
+ 'joininfo.c',
+ 'orclauses.c',
+ 'paramassign.c',
+ 'pathnode.c',
+ 'placeholder.c',
+ 'plancat.c',
+ 'predtest.c',
+ 'relnode.c',
+ 'restrictinfo.c',
+ 'tlist.c',
+ 'var.c',
+)
diff --git a/src/backend/parser/meson.build b/src/backend/parser/meson.build
new file mode 100644
index 00000000000..15d5a349eeb
--- /dev/null
+++ b/src/backend/parser/meson.build
@@ -0,0 +1,48 @@
+backend_sources += files(
+ 'analyze.c',
+ 'parse_agg.c',
+ 'parse_clause.c',
+ 'parse_coerce.c',
+ 'parse_collate.c',
+ 'parse_cte.c',
+ 'parse_enr.c',
+ 'parse_expr.c',
+ 'parse_func.c',
+ 'parse_merge.c',
+ 'parse_node.c',
+ 'parse_oper.c',
+ 'parse_param.c',
+ 'parse_relation.c',
+ 'parse_target.c',
+ 'parse_type.c',
+ 'parse_utilcmd.c',
+ 'scansup.c',
+)
+
+# Build a small utility static lib for the parser. The generation of the
+# parser is slow, and building this separately avoids other parts of the
+# backend having to wait till gram.h is generated.
+parser_sources = files('parser.c')
+
+backend_scanner = custom_target('scan',
+ input: 'scan.l',
+ output: 'scan.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-CF', '-p', '-p'],
+)
+generated_sources += backend_scanner
+parser_sources += backend_scanner
+
+backend_parser = custom_target('gram',
+ input: 'gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += backend_parser.to_list()
+parser_sources += backend_parser
+
+parser = static_library('parser',
+ parser_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += parser
diff --git a/src/backend/partitioning/meson.build b/src/backend/partitioning/meson.build
new file mode 100644
index 00000000000..e5e3806a0cc
--- /dev/null
+++ b/src/backend/partitioning/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'partbounds.c',
+ 'partdesc.c',
+ 'partprune.c',
+)
diff --git a/src/backend/po/meson.build b/src/backend/po/meson.build
new file mode 100644
index 00000000000..4ace0554680
--- /dev/null
+++ b/src/backend/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('postgres-' + pg_version_major.to_string())
diff --git a/src/backend/port/meson.build b/src/backend/port/meson.build
new file mode 100644
index 00000000000..a22c25dd952
--- /dev/null
+++ b/src/backend/port/meson.build
@@ -0,0 +1,31 @@
+backend_sources += files(
+ 'atomics.c',
+)
+
+
+if cdata.has('USE_UNNAMED_POSIX_SEMAPHORES') or cdata.has('USE_NAMED_POSIX_SEMAPHORES')
+ backend_sources += files('posix_sema.c')
+endif
+
+if cdata.has('USE_SYSV_SEMAPHORES')
+ backend_sources += files('sysv_sema.c')
+endif
+
+if cdata.has('USE_WIN32_SEMAPHORES')
+ backend_sources += files('win32_sema.c')
+endif
+
+if cdata.has('USE_SYSV_SHARED_MEMORY')
+ backend_sources += files('sysv_shmem.c')
+endif
+
+if cdata.has('USE_WIN32_SHARED_MEMORY')
+ backend_sources += files('win32_shmem.c')
+endif
+
+if host_system == 'windows'
+ subdir('win32')
+endif
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/port': ['pg_sema.c', 'pg_shmem.c', 'tas.s']}
diff --git a/src/backend/port/win32/meson.build b/src/backend/port/win32/meson.build
new file mode 100644
index 00000000000..68fe4cc3cd0
--- /dev/null
+++ b/src/backend/port/win32/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'crashdump.c',
+ 'signal.c',
+ 'socket.c',
+ 'timer.c',
+)
diff --git a/src/backend/postmaster/meson.build b/src/backend/postmaster/meson.build
new file mode 100644
index 00000000000..293a44ca295
--- /dev/null
+++ b/src/backend/postmaster/meson.build
@@ -0,0 +1,15 @@
+backend_sources += files(
+ 'autovacuum.c',
+ 'auxprocess.c',
+ 'bgworker.c',
+ 'bgwriter.c',
+ 'checkpointer.c',
+ 'fork_process.c',
+ 'interrupt.c',
+ 'pgarch.c',
+ 'postmaster.c',
+ 'shell_archive.c',
+ 'startup.c',
+ 'syslogger.c',
+ 'walwriter.c',
+)
diff --git a/src/backend/regex/meson.build b/src/backend/regex/meson.build
new file mode 100644
index 00000000000..c84e57fdba5
--- /dev/null
+++ b/src/backend/regex/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'regcomp.c',
+ 'regerror.c',
+ 'regexec.c',
+ 'regexport.c',
+ 'regfree.c',
+ 'regprefix.c',
+)
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
new file mode 100644
index 00000000000..3fc786c80a0
--- /dev/null
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -0,0 +1,13 @@
+libpqwalreceiver_sources = files(
+ 'libpqwalreceiver.c',
+)
+
+libpqwalreceiver = shared_module('pqwalreceiver',
+ libpqwalreceiver_sources,
+ kwargs: pg_mod_args + {
+ 'name_prefix': 'lib',
+ 'dependencies': pg_mod_args['dependencies'] + [libpq],
+ }
+)
+
+backend_targets += libpqwalreceiver
diff --git a/src/backend/replication/logical/meson.build b/src/backend/replication/logical/meson.build
new file mode 100644
index 00000000000..773583a12ba
--- /dev/null
+++ b/src/backend/replication/logical/meson.build
@@ -0,0 +1,14 @@
+backend_sources += files(
+ 'decode.c',
+ 'launcher.c',
+ 'logical.c',
+ 'logicalfuncs.c',
+ 'message.c',
+ 'origin.c',
+ 'proto.c',
+ 'relation.c',
+ 'reorderbuffer.c',
+ 'snapbuild.c',
+ 'tablesync.c',
+ 'worker.c',
+)
diff --git a/src/backend/replication/meson.build b/src/backend/replication/meson.build
new file mode 100644
index 00000000000..27b9bf13182
--- /dev/null
+++ b/src/backend/replication/meson.build
@@ -0,0 +1,51 @@
+backend_sources += files(
+ 'slot.c',
+ 'slotfuncs.c',
+ 'syncrep.c',
+ 'walreceiver.c',
+ 'walreceiverfuncs.c',
+ 'walsender.c',
+)
+
+# see ../parser/meson.build
+repl_parser_sources = []
+
+repl_scanner = custom_target('repl_scanner',
+ input: 'repl_scanner.l',
+ output: 'repl_scanner.c',
+ command: flex_cmd,
+)
+generated_sources += repl_scanner
+repl_parser_sources += repl_scanner
+
+repl_gram = custom_target('repl_gram',
+ input: 'repl_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += repl_gram.to_list()
+repl_parser_sources += repl_gram
+
+syncrep_scanner = custom_target('syncrep_scanner',
+ input: 'syncrep_scanner.l',
+ output: 'syncrep_scanner.c',
+ command: flex_cmd,
+)
+generated_sources += syncrep_scanner
+repl_parser_sources += syncrep_scanner
+
+syncrep_gram = custom_target('syncrep_gram',
+ input: 'syncrep_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += syncrep_gram.to_list()
+repl_parser_sources += syncrep_gram
+
+repl_parser = static_library('repl_parser',
+ repl_parser_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += repl_parser
+
+subdir('logical')
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
new file mode 100644
index 00000000000..8ff0a0c6133
--- /dev/null
+++ b/src/backend/replication/pgoutput/meson.build
@@ -0,0 +1,11 @@
+pgoutput_sources = files(
+ 'pgoutput.c',
+)
+
+pgoutput = shared_module('pgoutput',
+ pgoutput_sources,
+ kwargs: pg_mod_args + {
+ }
+)
+
+backend_targets += pgoutput
diff --git a/src/backend/rewrite/meson.build b/src/backend/rewrite/meson.build
new file mode 100644
index 00000000000..21fa0e230b0
--- /dev/null
+++ b/src/backend/rewrite/meson.build
@@ -0,0 +1,9 @@
+backend_sources += files(
+ 'rewriteDefine.c',
+ 'rewriteHandler.c',
+ 'rewriteManip.c',
+ 'rewriteRemove.c',
+ 'rewriteSearchCycle.c',
+ 'rewriteSupport.c',
+ 'rowsecurity.c',
+)
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
new file mode 100644
index 00000000000..8c6f685cb32
--- /dev/null
+++ b/src/backend/snowball/meson.build
@@ -0,0 +1,88 @@
+dict_snowball_sources = files(
+ 'libstemmer/api.c',
+ 'libstemmer/utilities.c',
+ 'dict_snowball.c',
+)
+
+dict_snowball_sources += files(
+ 'libstemmer/stem_ISO_8859_1_basque.c',
+ 'libstemmer/stem_ISO_8859_1_catalan.c',
+ 'libstemmer/stem_ISO_8859_1_danish.c',
+ 'libstemmer/stem_ISO_8859_1_dutch.c',
+ 'libstemmer/stem_ISO_8859_1_english.c',
+ 'libstemmer/stem_ISO_8859_1_finnish.c',
+ 'libstemmer/stem_ISO_8859_1_french.c',
+ 'libstemmer/stem_ISO_8859_1_german.c',
+ 'libstemmer/stem_ISO_8859_1_indonesian.c',
+ 'libstemmer/stem_ISO_8859_1_irish.c',
+ 'libstemmer/stem_ISO_8859_1_italian.c',
+ 'libstemmer/stem_ISO_8859_1_norwegian.c',
+ 'libstemmer/stem_ISO_8859_1_porter.c',
+ 'libstemmer/stem_ISO_8859_1_portuguese.c',
+ 'libstemmer/stem_ISO_8859_1_spanish.c',
+ 'libstemmer/stem_ISO_8859_1_swedish.c',
+ 'libstemmer/stem_ISO_8859_2_hungarian.c',
+ 'libstemmer/stem_ISO_8859_2_romanian.c',
+ 'libstemmer/stem_KOI8_R_russian.c',
+ 'libstemmer/stem_UTF_8_arabic.c',
+ 'libstemmer/stem_UTF_8_armenian.c',
+ 'libstemmer/stem_UTF_8_basque.c',
+ 'libstemmer/stem_UTF_8_catalan.c',
+ 'libstemmer/stem_UTF_8_danish.c',
+ 'libstemmer/stem_UTF_8_dutch.c',
+ 'libstemmer/stem_UTF_8_english.c',
+ 'libstemmer/stem_UTF_8_finnish.c',
+ 'libstemmer/stem_UTF_8_french.c',
+ 'libstemmer/stem_UTF_8_german.c',
+ 'libstemmer/stem_UTF_8_greek.c',
+ 'libstemmer/stem_UTF_8_hindi.c',
+ 'libstemmer/stem_UTF_8_hungarian.c',
+ 'libstemmer/stem_UTF_8_indonesian.c',
+ 'libstemmer/stem_UTF_8_irish.c',
+ 'libstemmer/stem_UTF_8_italian.c',
+ 'libstemmer/stem_UTF_8_lithuanian.c',
+ 'libstemmer/stem_UTF_8_nepali.c',
+ 'libstemmer/stem_UTF_8_norwegian.c',
+ 'libstemmer/stem_UTF_8_porter.c',
+ 'libstemmer/stem_UTF_8_portuguese.c',
+ 'libstemmer/stem_UTF_8_romanian.c',
+ 'libstemmer/stem_UTF_8_russian.c',
+ 'libstemmer/stem_UTF_8_serbian.c',
+ 'libstemmer/stem_UTF_8_spanish.c',
+ 'libstemmer/stem_UTF_8_swedish.c',
+ 'libstemmer/stem_UTF_8_tamil.c',
+ 'libstemmer/stem_UTF_8_turkish.c',
+ 'libstemmer/stem_UTF_8_yiddish.c',
+)
+
+# see comment in src/include/snowball/header.h
+stemmer_inc = include_directories('../../include/snowball')
+
+dict_snowball = shared_module('dict_snowball',
+ dict_snowball_sources,
+ kwargs: pg_mod_args + {
+ 'include_directories': [stemmer_inc],
+ }
+)
+
+snowball_create = custom_target('snowball_create',
+ output: ['snowball_create.sql'],
+ depfile: 'snowball_create.dep',
+ command: [
+ perl, files('snowball_create.pl'),
+ '--depfile',
+ '--input', '@CURRENT_SOURCE_DIR@',
+ '--outdir', '@OUTDIR@',
+ ],
+ install: true,
+ install_dir: dir_data,
+)
+generated_sources += snowball_create
+
+install_subdir('stopwords',
+ install_dir: dir_data / 'tsearch_data',
+ strip_directory: true,
+)
+
+backend_targets += dict_snowball
+backend_targets += snowball_create
diff --git a/src/backend/statistics/meson.build b/src/backend/statistics/meson.build
new file mode 100644
index 00000000000..8530c55f73c
--- /dev/null
+++ b/src/backend/statistics/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'dependencies.c',
+ 'extended_stats.c',
+ 'mcv.c',
+ 'mvdistinct.c',
+)
diff --git a/src/backend/storage/buffer/meson.build b/src/backend/storage/buffer/meson.build
new file mode 100644
index 00000000000..56a59b52484
--- /dev/null
+++ b/src/backend/storage/buffer/meson.build
@@ -0,0 +1,7 @@
+backend_sources += files(
+ 'buf_init.c',
+ 'buf_table.c',
+ 'bufmgr.c',
+ 'freelist.c',
+ 'localbuf.c',
+)
diff --git a/src/backend/storage/file/meson.build b/src/backend/storage/file/meson.build
new file mode 100644
index 00000000000..e1d5047d4aa
--- /dev/null
+++ b/src/backend/storage/file/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'buffile.c',
+ 'copydir.c',
+ 'fd.c',
+ 'fileset.c',
+ 'reinit.c',
+ 'sharedfileset.c',
+)
diff --git a/src/backend/storage/freespace/meson.build b/src/backend/storage/freespace/meson.build
new file mode 100644
index 00000000000..e4200ea6527
--- /dev/null
+++ b/src/backend/storage/freespace/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'freespace.c',
+ 'fsmpage.c',
+ 'indexfsm.c',
+)
diff --git a/src/backend/storage/ipc/meson.build b/src/backend/storage/ipc/meson.build
new file mode 100644
index 00000000000..516bc1d0193
--- /dev/null
+++ b/src/backend/storage/ipc/meson.build
@@ -0,0 +1,20 @@
+backend_sources += files(
+ 'barrier.c',
+ 'dsm.c',
+ 'dsm_impl.c',
+ 'ipc.c',
+ 'ipci.c',
+ 'latch.c',
+ 'pmsignal.c',
+ 'procarray.c',
+ 'procsignal.c',
+ 'shm_mq.c',
+ 'shm_toc.c',
+ 'shmem.c',
+ 'shmqueue.c',
+ 'signalfuncs.c',
+ 'sinval.c',
+ 'sinvaladt.c',
+ 'standby.c',
+
+)
diff --git a/src/backend/storage/large_object/meson.build b/src/backend/storage/large_object/meson.build
new file mode 100644
index 00000000000..8a181ab9b34
--- /dev/null
+++ b/src/backend/storage/large_object/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'inv_api.c',
+)
diff --git a/src/backend/storage/lmgr/meson.build b/src/backend/storage/lmgr/meson.build
new file mode 100644
index 00000000000..68237c8a2e8
--- /dev/null
+++ b/src/backend/storage/lmgr/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'condition_variable.c',
+ 'deadlock.c',
+ 'lmgr.c',
+ 'lock.c',
+ 'lwlock.c',
+ 'predicate.c',
+ 'proc.c',
+ 's_lock.c',
+ 'spin.c',
+)
+
+generated_backend_sources += lwlocknames[1]
diff --git a/src/backend/storage/meson.build b/src/backend/storage/meson.build
new file mode 100644
index 00000000000..daad628d74c
--- /dev/null
+++ b/src/backend/storage/meson.build
@@ -0,0 +1,9 @@
+subdir('buffer')
+subdir('file')
+subdir('freespace')
+subdir('ipc')
+subdir('large_object')
+subdir('lmgr')
+subdir('page')
+subdir('smgr')
+subdir('sync')
diff --git a/src/backend/storage/page/meson.build b/src/backend/storage/page/meson.build
new file mode 100644
index 00000000000..2ecd16c952c
--- /dev/null
+++ b/src/backend/storage/page/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'bufpage.c',
+ 'checksum.c',
+ 'itemptr.c',
+)
diff --git a/src/backend/storage/smgr/meson.build b/src/backend/storage/smgr/meson.build
new file mode 100644
index 00000000000..fdeb1223b32
--- /dev/null
+++ b/src/backend/storage/smgr/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'md.c',
+ 'smgr.c',
+)
diff --git a/src/backend/storage/sync/meson.build b/src/backend/storage/sync/meson.build
new file mode 100644
index 00000000000..05148b91a8e
--- /dev/null
+++ b/src/backend/storage/sync/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'sync.c',
+
+)
diff --git a/src/backend/tcop/meson.build b/src/backend/tcop/meson.build
new file mode 100644
index 00000000000..fb54aae8122
--- /dev/null
+++ b/src/backend/tcop/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'cmdtag.c',
+ 'dest.c',
+ 'fastpath.c',
+ 'postgres.c',
+ 'pquery.c',
+ 'utility.c',
+)
diff --git a/src/backend/tsearch/meson.build b/src/backend/tsearch/meson.build
new file mode 100644
index 00000000000..4144e9befc5
--- /dev/null
+++ b/src/backend/tsearch/meson.build
@@ -0,0 +1,21 @@
+backend_sources += files(
+ 'dict.c',
+ 'dict_ispell.c',
+ 'dict_simple.c',
+ 'dict_synonym.c',
+ 'dict_thesaurus.c',
+ 'regis.c',
+ 'spell.c',
+ 'to_tsany.c',
+ 'ts_locale.c',
+ 'ts_parse.c',
+ 'ts_selfuncs.c',
+ 'ts_typanalyze.c',
+ 'ts_utils.c',
+ 'wparser.c',
+ 'wparser_def.c',
+)
+
+install_subdir('dicts',
+ install_dir: dir_data / 'tsearch_data',
+ strip_directory: true)
diff --git a/src/backend/utils/activity/meson.build b/src/backend/utils/activity/meson.build
new file mode 100644
index 00000000000..5b3b558a67d
--- /dev/null
+++ b/src/backend/utils/activity/meson.build
@@ -0,0 +1,18 @@
+backend_sources += files(
+ 'backend_progress.c',
+ 'backend_status.c',
+ 'pgstat.c',
+ 'pgstat_archiver.c',
+ 'pgstat_bgwriter.c',
+ 'pgstat_checkpointer.c',
+ 'pgstat_database.c',
+ 'pgstat_function.c',
+ 'pgstat_relation.c',
+ 'pgstat_replslot.c',
+ 'pgstat_shmem.c',
+ 'pgstat_slru.c',
+ 'pgstat_subscription.c',
+ 'pgstat_wal.c',
+ 'pgstat_xact.c',
+ 'wait_event.c',
+)
diff --git a/src/backend/utils/adt/meson.build b/src/backend/utils/adt/meson.build
new file mode 100644
index 00000000000..ed9ceadfef0
--- /dev/null
+++ b/src/backend/utils/adt/meson.build
@@ -0,0 +1,131 @@
+backend_sources += files(
+ 'acl.c',
+ 'amutils.c',
+ 'array_expanded.c',
+ 'array_selfuncs.c',
+ 'array_typanalyze.c',
+ 'array_userfuncs.c',
+ 'arrayfuncs.c',
+ 'arraysubs.c',
+ 'arrayutils.c',
+ 'ascii.c',
+ 'bool.c',
+ 'cash.c',
+ 'char.c',
+ 'cryptohashfuncs.c',
+ 'date.c',
+ 'datetime.c',
+ 'datum.c',
+ 'dbsize.c',
+ 'domains.c',
+ 'encode.c',
+ 'enum.c',
+ 'expandeddatum.c',
+ 'expandedrecord.c',
+ 'float.c',
+ 'format_type.c',
+ 'formatting.c',
+ 'genfile.c',
+ 'geo_ops.c',
+ 'geo_selfuncs.c',
+ 'geo_spgist.c',
+ 'hbafuncs.c',
+ 'inet_cidr_ntop.c',
+ 'inet_net_pton.c',
+ 'int.c',
+ 'int8.c',
+ 'json.c',
+ 'jsonb.c',
+ 'jsonb_gin.c',
+ 'jsonb_op.c',
+ 'jsonb_util.c',
+ 'jsonbsubs.c',
+ 'jsonfuncs.c',
+ 'jsonpath.c',
+ 'jsonpath_exec.c',
+ 'like.c',
+ 'like_support.c',
+ 'lockfuncs.c',
+ 'mac.c',
+ 'mac8.c',
+ 'mcxtfuncs.c',
+ 'misc.c',
+ 'multirangetypes.c',
+ 'multirangetypes_selfuncs.c',
+ 'name.c',
+ 'network.c',
+ 'network_gist.c',
+ 'network_selfuncs.c',
+ 'network_spgist.c',
+ 'numeric.c',
+ 'numutils.c',
+ 'oid.c',
+ 'oracle_compat.c',
+ 'orderedsetaggs.c',
+ 'partitionfuncs.c',
+ 'pg_locale.c',
+ 'pg_lsn.c',
+ 'pg_upgrade_support.c',
+ 'pgstatfuncs.c',
+ 'pseudotypes.c',
+ 'quote.c',
+ 'rangetypes.c',
+ 'rangetypes_gist.c',
+ 'rangetypes_selfuncs.c',
+ 'rangetypes_spgist.c',
+ 'rangetypes_typanalyze.c',
+ 'regexp.c',
+ 'regproc.c',
+ 'ri_triggers.c',
+ 'rowtypes.c',
+ 'ruleutils.c',
+ 'selfuncs.c',
+ 'tid.c',
+ 'timestamp.c',
+ 'trigfuncs.c',
+ 'tsginidx.c',
+ 'tsgistidx.c',
+ 'tsquery.c',
+ 'tsquery_cleanup.c',
+ 'tsquery_gist.c',
+ 'tsquery_op.c',
+ 'tsquery_rewrite.c',
+ 'tsquery_util.c',
+ 'tsrank.c',
+ 'tsvector.c',
+ 'tsvector_op.c',
+ 'tsvector_parser.c',
+ 'uuid.c',
+ 'varbit.c',
+ 'varchar.c',
+ 'varlena.c',
+ 'version.c',
+ 'windowfuncs.c',
+ 'xid.c',
+ 'xid8funcs.c',
+ 'xml.c',
+)
+
+
+jsonpath_scan = custom_target('jsonpath_scan',
+ input: 'jsonpath_scan.l',
+ output: 'jsonpath_scan.c',
+ command: [flex_cmd, '--no-backup', '--', '-CF', '-p', '-p'],
+)
+generated_sources += jsonpath_scan
+
+jsonpath_gram = custom_target('jsonpath_parse',
+ input: 'jsonpath_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += jsonpath_gram.to_list()
+
+# so we don't need to add . as an include dir for the whole backend
+backend_link_with += static_library('jsonpath',
+ jsonpath_scan, jsonpath_gram,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+
+#generated_backend_sources += jsonpath_gram.to_list()
diff --git a/src/backend/utils/cache/meson.build b/src/backend/utils/cache/meson.build
new file mode 100644
index 00000000000..4fe6db6bda6
--- /dev/null
+++ b/src/backend/utils/cache/meson.build
@@ -0,0 +1,16 @@
+backend_sources += files(
+ 'attoptcache.c',
+ 'catcache.c',
+ 'evtcache.c',
+ 'inval.c',
+ 'lsyscache.c',
+ 'partcache.c',
+ 'plancache.c',
+ 'relcache.c',
+ 'relfilenumbermap.c',
+ 'relmapper.c',
+ 'spccache.c',
+ 'syscache.c',
+ 'ts_cache.c',
+ 'typcache.c',
+)
diff --git a/src/backend/utils/error/meson.build b/src/backend/utils/error/meson.build
new file mode 100644
index 00000000000..325446c8f93
--- /dev/null
+++ b/src/backend/utils/error/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'assert.c',
+ 'csvlog.c',
+ 'elog.c',
+ 'jsonlog.c',
+)
diff --git a/src/backend/utils/fmgr/meson.build b/src/backend/utils/fmgr/meson.build
new file mode 100644
index 00000000000..e545b424fd2
--- /dev/null
+++ b/src/backend/utils/fmgr/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'dfmgr.c',
+ 'fmgr.c',
+ 'funcapi.c',
+)
+
+# fmgrtab.c
+generated_backend_sources += fmgrtab_target[2]
diff --git a/src/backend/utils/hash/meson.build b/src/backend/utils/hash/meson.build
new file mode 100644
index 00000000000..242e2f0ecdf
--- /dev/null
+++ b/src/backend/utils/hash/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'dynahash.c',
+ 'pg_crc.c'
+)
diff --git a/src/backend/utils/init/meson.build b/src/backend/utils/init/meson.build
new file mode 100644
index 00000000000..ec9d72c3df1
--- /dev/null
+++ b/src/backend/utils/init/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'globals.c',
+ 'miscinit.c',
+ 'postinit.c')
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
new file mode 100644
index 00000000000..1bc971d1945
--- /dev/null
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -0,0 +1,36 @@
+encodings = {
+ 'cyrillic_and_mic': ['cyrillic_and_mic/cyrillic_and_mic.c'],
+ 'euc2004_sjis2004': ['euc2004_sjis2004/euc2004_sjis2004.c'],
+ 'euc_cn_and_mic': ['euc_cn_and_mic/euc_cn_and_mic.c'],
+ 'euc_jp_and_sjis': ['euc_jp_and_sjis/euc_jp_and_sjis.c'],
+ 'euc_kr_and_mic': ['euc_kr_and_mic/euc_kr_and_mic.c'],
+ 'euc_tw_and_big5': [
+ 'euc_tw_and_big5/euc_tw_and_big5.c',
+ 'euc_tw_and_big5/big5.c',
+ ],
+ 'latin2_and_win1250': ['latin2_and_win1250/latin2_and_win1250.c'],
+ 'latin_and_mic': ['latin_and_mic/latin_and_mic.c'],
+ 'utf8_and_big5': ['utf8_and_big5/utf8_and_big5.c'],
+ 'utf8_and_cyrillic': ['utf8_and_cyrillic/utf8_and_cyrillic.c'],
+ 'utf8_and_euc2004': ['utf8_and_euc2004/utf8_and_euc2004.c'],
+ 'utf8_and_euc_cn': ['utf8_and_euc_cn/utf8_and_euc_cn.c'],
+ 'utf8_and_euc_jp': ['utf8_and_euc_jp/utf8_and_euc_jp.c'],
+ 'utf8_and_euc_kr': ['utf8_and_euc_kr/utf8_and_euc_kr.c'],
+ 'utf8_and_euc_tw': ['utf8_and_euc_tw/utf8_and_euc_tw.c'],
+ 'utf8_and_gb18030': ['utf8_and_gb18030/utf8_and_gb18030.c'],
+ 'utf8_and_gbk': ['utf8_and_gbk/utf8_and_gbk.c'],
+ 'utf8_and_iso8859': ['utf8_and_iso8859/utf8_and_iso8859.c'],
+ 'utf8_and_iso8859_1': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'],
+ 'utf8_and_johab': ['utf8_and_johab/utf8_and_johab.c'],
+ 'utf8_and_sjis': ['utf8_and_sjis/utf8_and_sjis.c'],
+ 'utf8_and_sjis2004': ['utf8_and_sjis2004/utf8_and_sjis2004.c'],
+ 'utf8_and_uhc': ['utf8_and_uhc/utf8_and_uhc.c'],
+ 'utf8_and_win': ['utf8_and_win/utf8_and_win.c'],
+}
+
+foreach encoding, sources : encodings
+ backend_targets += shared_module(encoding,
+ sources,
+ kwargs: pg_mod_args,
+ )
+endforeach
diff --git a/src/backend/utils/mb/meson.build b/src/backend/utils/mb/meson.build
new file mode 100644
index 00000000000..39e45638db0
--- /dev/null
+++ b/src/backend/utils/mb/meson.build
@@ -0,0 +1,9 @@
+backend_sources += files(
+ 'conv.c',
+ 'mbutils.c',
+ 'stringinfo_mb.c',
+ 'wstrcmp.c',
+ 'wstrncmp.c',
+)
+
+# Note we only enter conversion_procs once the backend build is defined
diff --git a/src/backend/utils/meson.build b/src/backend/utils/meson.build
new file mode 100644
index 00000000000..3a916320bb3
--- /dev/null
+++ b/src/backend/utils/meson.build
@@ -0,0 +1,17 @@
+install_data('errcodes.txt',
+ install_dir: dir_data,
+)
+
+subdir('activity')
+subdir('adt')
+subdir('cache')
+subdir('error')
+subdir('fmgr')
+subdir('hash')
+subdir('init')
+subdir('mb')
+subdir('misc')
+subdir('mmgr')
+subdir('resowner')
+subdir('sort')
+subdir('time')
diff --git a/src/backend/utils/misc/meson.build b/src/backend/utils/misc/meson.build
new file mode 100644
index 00000000000..db4de225e18
--- /dev/null
+++ b/src/backend/utils/misc/meson.build
@@ -0,0 +1,35 @@
+backend_sources += files(
+ 'guc.c',
+ 'guc_funcs.c',
+ 'guc_tables.c',
+ 'help_config.c',
+ 'pg_config.c',
+ 'pg_controldata.c',
+ 'pg_rusage.c',
+ 'ps_status.c',
+ 'queryenvironment.c',
+ 'queryjumble.c',
+ 'rls.c',
+ 'sampling.c',
+ 'superuser.c',
+ 'timeout.c',
+ 'tzparser.c',
+)
+
+guc_scan = custom_target('guc_scan',
+ input: 'guc-file.l',
+ output: 'guc-file.c',
+ command: flex_cmd)
+generated_sources += guc_scan
+
+# so we don't need to add . as an include dir for the whole backend
+backend_link_with += static_library('guc-file',
+ guc_scan,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+
+install_data('postgresql.conf.sample',
+ install_dir: dir_data,
+)
diff --git a/src/backend/utils/mmgr/meson.build b/src/backend/utils/mmgr/meson.build
new file mode 100644
index 00000000000..641bb181ba1
--- /dev/null
+++ b/src/backend/utils/mmgr/meson.build
@@ -0,0 +1,10 @@
+backend_sources += files(
+ 'aset.c',
+ 'dsa.c',
+ 'freepage.c',
+ 'generation.c',
+ 'mcxt.c',
+ 'memdebug.c',
+ 'portalmem.c',
+ 'slab.c',
+)
diff --git a/src/backend/utils/resowner/meson.build b/src/backend/utils/resowner/meson.build
new file mode 100644
index 00000000000..d30891ca027
--- /dev/null
+++ b/src/backend/utils/resowner/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'resowner.c'
+)
diff --git a/src/backend/utils/sort/meson.build b/src/backend/utils/sort/meson.build
new file mode 100644
index 00000000000..1862ceae8c1
--- /dev/null
+++ b/src/backend/utils/sort/meson.build
@@ -0,0 +1,9 @@
+backend_sources += files(
+ 'logtape.c',
+ 'qsort_interruptible.c',
+ 'sharedtuplestore.c',
+ 'sortsupport.c',
+ 'tuplesort.c',
+ 'tuplesortvariants.c',
+ 'tuplestore.c',
+)
diff --git a/src/backend/utils/time/meson.build b/src/backend/utils/time/meson.build
new file mode 100644
index 00000000000..6fff8792bb0
--- /dev/null
+++ b/src/backend/utils/time/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'combocid.c',
+ 'snapmgr.c',
+)
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
new file mode 100644
index 00000000000..b6bf8e1ca21
--- /dev/null
+++ b/src/fe_utils/meson.build
@@ -0,0 +1,29 @@
+fe_utils_sources = files(
+ 'archive.c',
+ 'cancel.c',
+ 'conditional.c',
+ 'connect_utils.c',
+ 'mbprint.c',
+ 'option_utils.c',
+ 'parallel_slot.c',
+ 'print.c',
+ 'query_utils.c',
+ 'recovery_gen.c',
+ 'simple_list.c',
+ 'string_utils.c',
+)
+
+psqlscan = custom_target('psqlscan',
+ input: 'psqlscan.l',
+ output: 'psqlscan.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'],
+)
+generated_sources += psqlscan
+fe_utils_sources += psqlscan
+
+fe_utils = static_library('libpgfeutils',
+ fe_utils_sources + generated_headers,
+ include_directories: [postgres_inc, libpq_inc],
+ dependencies: frontend_common_code,
+ kwargs: default_lib_args,
+)
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
new file mode 100644
index 00000000000..9f213274d2f
--- /dev/null
+++ b/src/bin/initdb/meson.build
@@ -0,0 +1,30 @@
+initdb_sources = files(
+ 'findtimezone.c',
+ 'initdb.c'
+)
+
+initdb_sources += timezone_localtime_source
+
+#fixme: reimplement libpq_pgport logic
+
+initdb = executable('initdb',
+ initdb_sources,
+ include_directories: [timezone_inc],
+ dependencies: [frontend_code, libpq, icu, icu_i18n],
+ kwargs: default_bin_args,
+)
+bin_targets += initdb
+
+tests += {
+ 'name': 'initdb',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_initdb.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/initdb/po/meson.build b/src/bin/initdb/po/meson.build
new file mode 100644
index 00000000000..8b8a9fd2ce1
--- /dev/null
+++ b/src/bin/initdb/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('initdb-' + pg_version_major.to_string())
diff --git a/src/bin/meson.build b/src/bin/meson.build
new file mode 100644
index 00000000000..5fd5a9d2f98
--- /dev/null
+++ b/src/bin/meson.build
@@ -0,0 +1,20 @@
+subdir('initdb')
+subdir('pg_amcheck')
+subdir('pg_archivecleanup')
+subdir('pg_basebackup')
+subdir('pg_checksums')
+subdir('pg_config')
+subdir('pg_controldata')
+subdir('pg_ctl')
+subdir('pg_dump')
+subdir('pg_resetwal')
+subdir('pg_rewind')
+subdir('pg_test_fsync')
+subdir('pg_test_timing')
+subdir('pg_upgrade')
+subdir('pg_verifybackup')
+subdir('pg_waldump')
+subdir('pgbench')
+subdir('pgevent')
+subdir('psql')
+subdir('scripts')
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
new file mode 100644
index 00000000000..8e197eba5f3
--- /dev/null
+++ b/src/bin/pg_amcheck/meson.build
@@ -0,0 +1,27 @@
+pg_amcheck_sources = files(
+ 'pg_amcheck.c'
+)
+
+pg_amcheck = executable('pg_amcheck',
+ pg_amcheck_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_amcheck
+
+tests += {
+ 'name': 'pg_amcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_nonesuch.pl',
+ 't/003_check.pl',
+ 't/004_verify_heapam.pl',
+ 't/005_opclass_damage.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_amcheck/po/meson.build b/src/bin/pg_amcheck/po/meson.build
new file mode 100644
index 00000000000..b255f552c94
--- /dev/null
+++ b/src/bin/pg_amcheck/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_amcheck-' + pg_version_major.to_string())
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
new file mode 100644
index 00000000000..87a0d980c4f
--- /dev/null
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -0,0 +1,19 @@
+pg_archivecleanup = executable('pg_archivecleanup',
+ ['pg_archivecleanup.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_archivecleanup
+
+tests += {
+ 'name': 'pg_archivecleanup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_pg_archivecleanup.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_archivecleanup/po/meson.build b/src/bin/pg_archivecleanup/po/meson.build
new file mode 100644
index 00000000000..37935fcabc4
--- /dev/null
+++ b/src/bin/pg_archivecleanup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
new file mode 100644
index 00000000000..d26fed9cd8a
--- /dev/null
+++ b/src/bin/pg_basebackup/meson.build
@@ -0,0 +1,61 @@
+common_sources = files(
+ 'bbstreamer_file.c',
+ 'bbstreamer_gzip.c',
+ 'bbstreamer_inject.c',
+ 'bbstreamer_lz4.c',
+ 'bbstreamer_tar.c',
+ 'bbstreamer_zstd.c',
+ 'receivelog.c',
+ 'streamutil.c',
+ 'walmethods.c',
+)
+
+pg_basebackup_deps = [frontend_code, libpq, lz4, zlib, zstd]
+pg_basebackup_common = static_library('libpg_basebackup_common',
+ common_sources,
+ dependencies: pg_basebackup_deps,
+ kwargs: internal_lib_args,
+)
+
+pg_basebackup = executable('pg_basebackup',
+ 'pg_basebackup.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_basebackup
+
+pg_receivewal = executable('pg_receivewal',
+ 'pg_receivewal.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_receivewal
+
+pg_recvlogical = executable('pg_recvlogical',
+ 'pg_recvlogical.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_recvlogical
+
+tests += {
+ 'name': 'pg_basebackup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'GZIP_PROGRAM': gzip.path(),
+ 'TAR': tar.path(),
+ 'LZ4': program_lz4.found() ? program_lz4.path() : '',
+ 'ZSTD': program_zstd.found() ? program_zstd.path() : ''},
+ 'tests': [
+ 't/010_pg_basebackup.pl',
+ 't/020_pg_receivewal.pl',
+ 't/030_pg_recvlogical.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_basebackup/po/meson.build b/src/bin/pg_basebackup/po/meson.build
new file mode 100644
index 00000000000..cab021153fe
--- /dev/null
+++ b/src/bin/pg_basebackup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_basebackup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
new file mode 100644
index 00000000000..ee1f367bac3
--- /dev/null
+++ b/src/bin/pg_checksums/meson.build
@@ -0,0 +1,21 @@
+pg_checksums = executable('pg_checksums',
+ ['pg_checksums.c'],
+ include_directories: [timezone_inc],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_checksums
+
+tests += {
+ 'name': 'pg_checksums',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_actions.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_checksums/po/meson.build b/src/bin/pg_checksums/po/meson.build
new file mode 100644
index 00000000000..2c47c2338f6
--- /dev/null
+++ b/src/bin/pg_checksums/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_checksums-' + pg_version_major.to_string())
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
new file mode 100644
index 00000000000..0ecbf2f9d28
--- /dev/null
+++ b/src/bin/pg_config/meson.build
@@ -0,0 +1,19 @@
+pg_config = executable('pg_config',
+ ['pg_config.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_config
+
+tests += {
+ 'name': 'pg_config',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pg_config.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_config/po/meson.build b/src/bin/pg_config/po/meson.build
new file mode 100644
index 00000000000..b6fb6db9213
--- /dev/null
+++ b/src/bin/pg_config/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_config-' + pg_version_major.to_string())
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
new file mode 100644
index 00000000000..557e672beb7
--- /dev/null
+++ b/src/bin/pg_controldata/meson.build
@@ -0,0 +1,19 @@
+pg_controldata = executable('pg_controldata',
+ ['pg_controldata.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_controldata
+
+tests += {
+ 'name': 'pg_controldata',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pg_controldata.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_controldata/po/meson.build b/src/bin/pg_controldata/po/meson.build
new file mode 100644
index 00000000000..31b486d002c
--- /dev/null
+++ b/src/bin/pg_controldata/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_controldata-' + pg_version_major.to_string())
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
new file mode 100644
index 00000000000..6812e73e329
--- /dev/null
+++ b/src/bin/pg_ctl/meson.build
@@ -0,0 +1,22 @@
+pg_ctl = executable('pg_ctl',
+ ['pg_ctl.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_ctl
+
+tests += {
+ 'name': 'pg_ctl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_start_stop.pl',
+ 't/002_status.pl',
+ 't/003_promote.pl',
+ 't/004_logrotate.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_ctl/po/meson.build b/src/bin/pg_ctl/po/meson.build
new file mode 100644
index 00000000000..947b5108423
--- /dev/null
+++ b/src/bin/pg_ctl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_ctl-' + pg_version_major.to_string())
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
new file mode 100644
index 00000000000..785ec094dbd
--- /dev/null
+++ b/src/bin/pg_dump/meson.build
@@ -0,0 +1,75 @@
+pg_dump_common_sources = files(
+ 'compress_io.c',
+ 'dumputils.c',
+ 'parallel.c',
+ 'pg_backup_archiver.c',
+ 'pg_backup_custom.c',
+ 'pg_backup_db.c',
+ 'pg_backup_directory.c',
+ 'pg_backup_null.c',
+ 'pg_backup_tar.c',
+ 'pg_backup_utils.c',
+)
+
+pg_dump_common = static_library('libpgdump_common',
+ pg_dump_common_sources,
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: internal_lib_args,
+)
+
+
+pg_dump_sources = files(
+ 'common.c',
+ 'pg_dump.c',
+ 'pg_dump_sort.c',
+)
+
+pg_dump = executable('pg_dump',
+ pg_dump_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_dump
+
+
+pg_dumpall_sources = files(
+ 'pg_dumpall.c',
+)
+
+pg_dumpall = executable('pg_dumpall',
+ pg_dumpall_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_dumpall
+
+
+pg_restore_sources = files(
+ 'pg_restore.c',
+)
+
+pg_restore = executable('pg_restore',
+ pg_restore_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_restore
+
+tests += {
+ 'name': 'pg_dump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_pg_dump.pl',
+ 't/003_pg_dump_with_server.pl',
+ 't/010_dump_connstr.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_dump/po/meson.build b/src/bin/pg_dump/po/meson.build
new file mode 100644
index 00000000000..82e5e537ff4
--- /dev/null
+++ b/src/bin/pg_dump/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_dump-' + pg_version_major.to_string())
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
new file mode 100644
index 00000000000..7c5de134ac0
--- /dev/null
+++ b/src/bin/pg_resetwal/meson.build
@@ -0,0 +1,20 @@
+pg_resetwal = executable('pg_resetwal',
+ files('pg_resetwal.c'),
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_resetwal
+
+tests += {
+ 'name': 'pg_resetwal',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_corrupted.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_resetwal/po/meson.build b/src/bin/pg_resetwal/po/meson.build
new file mode 100644
index 00000000000..d130d3b775f
--- /dev/null
+++ b/src/bin/pg_resetwal/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_resetwal-' + pg_version_major.to_string())
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
new file mode 100644
index 00000000000..d8ec9e482d5
--- /dev/null
+++ b/src/bin/pg_rewind/meson.build
@@ -0,0 +1,42 @@
+pg_rewind_sources = files(
+ 'datapagemap.c',
+ 'file_ops.c',
+ 'filemap.c',
+ 'libpq_source.c',
+ 'local_source.c',
+ 'parsexlog.c',
+ 'pg_rewind.c',
+ 'timeline.c',
+)
+
+pg_rewind_sources += xlogreader_sources
+
+pg_rewind = executable('pg_rewind',
+ pg_rewind_sources,
+ dependencies: [frontend_code, libpq, lz4, zstd],
+ c_args: ['-DFRONTEND'], # needed for xlogreader et al
+ kwargs: default_bin_args,
+)
+bin_targets += pg_rewind
+
+
+tests += {
+ 'name': 'pg_rewind',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_databases.pl',
+ 't/003_extrafiles.pl',
+ 't/004_pg_xlog_symlink.pl',
+ 't/005_same_timeline.pl',
+ 't/006_options.pl',
+ 't/007_standby_source.pl',
+ 't/008_min_recovery_point.pl',
+ 't/009_growing_files.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_rewind/po/meson.build b/src/bin/pg_rewind/po/meson.build
new file mode 100644
index 00000000000..a105600b348
--- /dev/null
+++ b/src/bin/pg_rewind/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_rewind-' + pg_version_major.to_string())
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
new file mode 100644
index 00000000000..2c01831e11f
--- /dev/null
+++ b/src/bin/pg_test_fsync/meson.build
@@ -0,0 +1,21 @@
+test_fsync_sources = files('pg_test_fsync.c')
+
+pg_test_fsync = executable('pg_test_fsync',
+ test_fsync_sources,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_test_fsync
+
+tests += {
+ 'name': 'pg_test_fsync',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_test_fsync/po/meson.build b/src/bin/pg_test_fsync/po/meson.build
new file mode 100644
index 00000000000..2ee1125282d
--- /dev/null
+++ b/src/bin/pg_test_fsync/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
new file mode 100644
index 00000000000..0a3068f1657
--- /dev/null
+++ b/src/bin/pg_test_timing/meson.build
@@ -0,0 +1,19 @@
+pg_test_timing = executable('pg_test_timing',
+ ['pg_test_timing.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_test_timing
+
+tests += {
+ 'name': 'pg_test_timing',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_test_timing/po/meson.build b/src/bin/pg_test_timing/po/meson.build
new file mode 100644
index 00000000000..cda8615165b
--- /dev/null
+++ b/src/bin/pg_test_timing/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_test_timing-' + pg_version_major.to_string())
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
new file mode 100644
index 00000000000..02f030e0ccf
--- /dev/null
+++ b/src/bin/pg_upgrade/meson.build
@@ -0,0 +1,40 @@
+pg_upgrade_sources = files(
+ 'check.c',
+ 'controldata.c',
+ 'dump.c',
+ 'exec.c',
+ 'file.c',
+ 'function.c',
+ 'info.c',
+ 'option.c',
+ 'parallel.c',
+ 'pg_upgrade.c',
+ 'relfilenumber.c',
+ 'server.c',
+ 'tablespace.c',
+ 'util.c',
+ 'version.c',
+)
+
+pg_upgrade = executable('pg_upgrade',
+ pg_upgrade_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_upgrade
+
+
+tests += {
+ 'name': 'pg_upgrade',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_pg_upgrade.pl',
+ ],
+ 'test_kwargs': {'priority': 40}, # pg_upgrade tests are slow
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_upgrade/po/meson.build b/src/bin/pg_upgrade/po/meson.build
new file mode 100644
index 00000000000..39301cbede8
--- /dev/null
+++ b/src/bin/pg_upgrade/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_upgrade-' + pg_version_major.to_string())
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
new file mode 100644
index 00000000000..4c3b2bb5f97
--- /dev/null
+++ b/src/bin/pg_verifybackup/meson.build
@@ -0,0 +1,33 @@
+pg_verifybackup_sources = files(
+ 'parse_manifest.c',
+ 'pg_verifybackup.c'
+)
+
+pg_verifybackup = executable('pg_verifybackup',
+ pg_verifybackup_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_verifybackup
+
+tests += {
+ 'name': 'pg_verifybackup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_algorithm.pl',
+ 't/003_corruption.pl',
+ 't/004_options.pl',
+ 't/005_bad_manifest.pl',
+ 't/006_encoding.pl',
+ 't/007_wal.pl',
+ 't/008_untar.pl',
+ 't/009_extract.pl',
+ 't/010_client_untar.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_verifybackup/po/meson.build b/src/bin/pg_verifybackup/po/meson.build
new file mode 100644
index 00000000000..b583f1958ba
--- /dev/null
+++ b/src/bin/pg_verifybackup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
new file mode 100644
index 00000000000..95872652ffd
--- /dev/null
+++ b/src/bin/pg_waldump/meson.build
@@ -0,0 +1,30 @@
+pg_waldump_sources = files(
+ 'compat.c',
+ 'pg_waldump.c',
+ 'rmgrdesc.c',
+)
+
+pg_waldump_sources += rmgr_desc_sources
+pg_waldump_sources += xlogreader_sources
+pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+
+pg_waldump = executable('pg_waldump',
+ pg_waldump_sources,
+ dependencies: [frontend_code, lz4, zstd],
+ c_args: ['-DFRONTEND'], # needed for xlogreader et al
+ kwargs: default_bin_args,
+)
+bin_targets += pg_waldump
+
+tests += {
+ 'name': 'pg_waldump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_waldump/po/meson.build b/src/bin/pg_waldump/po/meson.build
new file mode 100644
index 00000000000..f335aa4b360
--- /dev/null
+++ b/src/bin/pg_waldump/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_waldump-' + pg_version_major.to_string())
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
new file mode 100644
index 00000000000..6564e54029c
--- /dev/null
+++ b/src/bin/pgbench/meson.build
@@ -0,0 +1,38 @@
+pgbench_sources = files(
+ 'pgbench.c',
+)
+
+exprscan = custom_target('exprscan',
+ input: 'exprscan.l',
+ output: 'exprscan.c',
+ command: flex_cmd,
+)
+generated_sources += exprscan
+pgbench_sources += exprscan
+
+exprparse = custom_target('exprparse',
+ input: 'exprparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += exprparse.to_list()
+pgbench_sources += exprparse
+
+pgbench = executable('pgbench',
+ pgbench_sources,
+ dependencies: [frontend_code, libpq, thread_dep],
+ include_directories: include_directories('.'),
+ kwargs: default_bin_args,
+)
+bin_targets += pgbench
+
+tests += {
+ 'name': 'pgbench',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pgbench_with_server.pl',
+ 't/002_pgbench_no_server.pl',
+ ],
+ },
+}
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
new file mode 100644
index 00000000000..5852bca4d87
--- /dev/null
+++ b/src/bin/pgevent/meson.build
@@ -0,0 +1,26 @@
+if host_system != 'windows'
+ subdir_done()
+endif
+
+pgevent_sources = files(
+ 'pgevent.c',
+)
+
+pgevent_sources += windows.compile_resources('pgmsgevent.rc')
+
+# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
+pgevent_link_args = []
+if cc.get_id() == 'msvc'
+ pgevent_link_args += '/ignore:4104'
+endif
+
+pgevent = shared_library('pgevent',
+ pgevent_sources,
+ dependencies: [frontend_code],
+ link_args: pgevent_link_args,
+ vs_module_defs: 'pgevent.def',
+ kwargs: default_lib_args + {
+ 'name_prefix': '',
+ },
+)
+bin_targets += pgevent
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
new file mode 100644
index 00000000000..ea850c8fdf5
--- /dev/null
+++ b/src/bin/psql/meson.build
@@ -0,0 +1,67 @@
+psql_sources = files(
+ 'command.c',
+ 'common.c',
+ 'copy.c',
+ 'crosstabview.c',
+ 'describe.c',
+ 'help.c',
+ 'input.c',
+ 'large_obj.c',
+ 'mainloop.c',
+ 'prompt.c',
+ 'startup.c',
+ 'stringutils.c',
+ 'tab-complete.c',
+ 'variables.c',
+)
+
+psqlscanslash = custom_target('psqlscanslash',
+ input: 'psqlscanslash.l',
+ output: 'psqlscanslash.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'])
+generated_sources += psqlscanslash
+psql_sources += psqlscanslash
+bin_targets += psqlscanslash
+
+sql_help = custom_target('psql_help',
+ output: ['sql_help.c', 'sql_help.h'],
+ depfile: 'sql_help.dep',
+ command: [
+ perl, files('create_help.pl'),
+ '--docdir', '@SOURCE_ROOT@/doc/src/sgml/ref',
+ '--depfile', '@DEPFILE@',
+ '--outdir', '@OUTDIR@',
+ '--basename', 'sql_help',
+ ],
+)
+generated_sources += sql_help.to_list()
+psql_sources += sql_help
+bin_targets += sql_help
+
+psql = executable('psql',
+ psql_sources,
+ include_directories: include_directories('.'),
+ dependencies: [frontend_code, libpq, readline],
+ kwargs: default_bin_args,
+)
+bin_targets += psql
+
+install_data('psqlrc.sample',
+ install_dir: dir_data,
+)
+
+tests += {
+ 'name': 'psql',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_readline': readline.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_basic.pl',
+ 't/010_tab_completion.pl',
+ 't/020_cancel.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/psql/po/meson.build b/src/bin/psql/po/meson.build
new file mode 100644
index 00000000000..45fe425298d
--- /dev/null
+++ b/src/bin/psql/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('psql-' + pg_version_major.to_string())
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
new file mode 100644
index 00000000000..eaf250c7f73
--- /dev/null
+++ b/src/bin/scripts/meson.build
@@ -0,0 +1,51 @@
+scripts_common = static_library('libscripts_common',
+ files('common.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: internal_lib_args,
+)
+
+binaries = [
+ 'createdb',
+ 'dropdb',
+ 'createuser',
+ 'dropuser',
+ 'clusterdb',
+ 'vacuumdb',
+ 'reindexdb',
+ 'pg_isready',
+]
+
+foreach binary : binaries
+ binary = executable(binary,
+ files(binary + '.c'),
+ link_with: [scripts_common],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+ )
+ bin_targets += binary
+endforeach
+
+tests += {
+ 'name': 'scripts',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_clusterdb.pl',
+ 't/011_clusterdb_all.pl',
+ 't/020_createdb.pl',
+ 't/040_createuser.pl',
+ 't/050_dropdb.pl',
+ 't/070_dropuser.pl',
+ 't/080_pg_isready.pl',
+ 't/090_reindexdb.pl',
+ 't/091_reindexdb_all.pl',
+ 't/100_vacuumdb.pl',
+ 't/101_vacuumdb_all.pl',
+ 't/102_vacuumdb_stages.pl',
+ 't/200_connstr.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/scripts/po/meson.build b/src/bin/scripts/po/meson.build
new file mode 100644
index 00000000000..3c531459c2d
--- /dev/null
+++ b/src/bin/scripts/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pgscripts-' + pg_version_major.to_string())
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
new file mode 100644
index 00000000000..bc047e00d62
--- /dev/null
+++ b/src/interfaces/libpq/meson.build
@@ -0,0 +1,108 @@
+# test/ is entered via top-level meson.build, that way it can use the default
+# args for executables (which depend on libpq).
+
+libpq_sources = files(
+ 'fe-auth-scram.c',
+ 'fe-auth.c',
+ 'fe-connect.c',
+ 'fe-exec.c',
+ 'fe-lobj.c',
+ 'fe-misc.c',
+ 'fe-print.c',
+ 'fe-protocol3.c',
+ 'fe-secure.c',
+ 'fe-trace.c',
+ 'legacy-pqsignal.c',
+ 'libpq-events.c',
+ 'pqexpbuffer.c',
+)
+
+if host_system == 'windows'
+ libpq_sources += files('pthread-win32.c', 'win32.c')
+endif
+
+if ssl.found()
+ libpq_sources += files('fe-secure-common.c')
+ libpq_sources += files('fe-secure-openssl.c')
+endif
+
+if gssapi.found()
+ libpq_sources += files(
+ 'fe-gssapi-common.c',
+ 'fe-secure-gssapi.c',
+ )
+endif
+
+export_file = custom_target('libpq.exports',
+ kwargs: gen_export_kwargs,
+)
+
+# port needs to be in include path due to pthread-win32.h
+libpq_inc = include_directories('.', '../../port')
+
+libpq_st = static_library('libpq',
+ libpq_sources,
+ pic: true,
+ include_directories: [libpq_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=5'],
+ dependencies: libpq_deps,
+ kwargs: default_lib_args,
+)
+
+# not using both_libraries here, causes problems with precompiled headers and
+# resource files with msbuild
+libpq_so = shared_library('libpq',
+ dependencies: libpq_deps,
+ include_directories: [libpq_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=5'],
+ link_whole: libpq_st,
+ version: '5.' + pg_version_major.to_string(),
+ soversion: host_system != 'windows' ? '5' : '',
+ darwin_versions: ['5', '5.' + pg_version_major.to_string()],
+ link_depends: export_file,
+ link_args: export_fmt.format(export_file.full_path()),
+ kwargs: default_lib_args,
+)
+
+libpq = declare_dependency(
+ link_with: [libpq_so],
+ include_directories: [include_directories('.')]
+)
+
+pkgconfig.generate(
+ libpq_so,
+ name: 'libpq',
+ description: 'PostgreSQL libpq library',
+ url: pg_url,
+)
+
+install_headers(
+ 'libpq-fe.h',
+ 'libpq-events.h',
+)
+
+install_headers(
+ 'libpq-int.h',
+ 'pqexpbuffer.h',
+ 'fe-auth-sasl.h',
+ install_dir: dir_include_internal,
+)
+install_data('pg_service.conf.sample',
+ install_dir: dir_data,
+)
+
+
+tests += {
+ 'name': 'libpq',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_uri.pl',
+ 't/002_api.pl',
+ ],
+ 'env': {'with_ssl': get_option('ssl')},
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/interfaces/libpq/po/meson.build b/src/interfaces/libpq/po/meson.build
new file mode 100644
index 00000000000..eed91110fd6
--- /dev/null
+++ b/src/interfaces/libpq/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('libpq' + '5' + '-' + pg_version_major.to_string())
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
new file mode 100644
index 00000000000..16f94c1ed8b
--- /dev/null
+++ b/src/interfaces/libpq/test/meson.build
@@ -0,0 +1,15 @@
+executable('libpq_uri_regress',
+ files('libpq_uri_regress.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install': false,
+ }
+)
+
+executable('libpq_testclient',
+ files('libpq_testclient.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install': false,
+ }
+)
diff --git a/src/pl/meson.build b/src/pl/meson.build
new file mode 100644
index 00000000000..d9a57465441
--- /dev/null
+++ b/src/pl/meson.build
@@ -0,0 +1,5 @@
+subdir('plpgsql')
+
+subdir('plperl')
+subdir('plpython')
+subdir('tcl')
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
new file mode 100644
index 00000000000..73b733dd50b
--- /dev/null
+++ b/src/pl/plperl/meson.build
@@ -0,0 +1,90 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+plperl_sources = files(
+ 'plperl.c',
+)
+
+subppdir = run_command(perl, '-e', 'use List::Util qw(first); print first { -r "$_/ExtUtils/xsubpp" } @INC',
+ check: true).stdout()
+xsubpp = '@0@/ExtUtils/xsubpp'.format(subppdir)
+typemap = '@0@/ExtUtils/typemap'.format(privlibexp)
+
+plperl_sources += custom_target('perlchunks.h',
+ input: files('plc_perlboot.pl', 'plc_trusted.pl'),
+ output: 'perlchunks.h',
+ capture: true,
+ command: [perl, files('text2macro.pl'), '--strip=^(\#.*|\s*)$', '@INPUT@']
+)
+
+plperl_sources += custom_target('plperl_opmask.h',
+ input: files('plperl_opmask.pl'),
+ output: 'plperl_opmask.h',
+ command: [perl, '@INPUT@', '@OUTPUT@']
+)
+
+foreach n : ['SPI', 'Util']
+ xs = files(n + '.xs')
+ xs_c_name = n + '.c'
+ xs_c = custom_target(xs_c_name,
+ input: xs,
+ output: xs_c_name,
+ command: [perl, xsubpp, '-typemap', typemap, '-output', '@OUTPUT@', '@INPUT@']
+ )
+ plperl_sources += xs_c
+endforeach
+
+plperl_inc = include_directories('.')
+plperl = shared_module('plperl',
+ plperl_sources,
+ include_directories: [plperl_inc, postgres_inc],
+ kwargs: pg_mod_args + {
+ 'dependencies': [perl_dep, pg_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+pl_targets += plperl
+
+install_data(
+ 'plperl.control',
+ 'plperl--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+install_data(
+ 'plperlu.control',
+ 'plperlu--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+install_headers(
+ 'plperl.h',
+ 'ppport.h',
+ install_dir: dir_include_server,
+)
+
+tests += {
+ 'name': 'plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'plperl_setup',
+ 'plperl',
+ 'plperl_lc',
+ 'plperl_trigger',
+ 'plperl_shared',
+ 'plperl_elog',
+ 'plperl_util',
+ 'plperl_init',
+ 'plperlu',
+ 'plperl_array',
+ 'plperl_call',
+ 'plperl_transaction',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/plperl/po/meson.build b/src/pl/plperl/po/meson.build
new file mode 100644
index 00000000000..fe0a715bdf0
--- /dev/null
+++ b/src/pl/plperl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('plperl-' + pg_version_major.to_string())
diff --git a/src/pl/plpgsql/meson.build b/src/pl/plpgsql/meson.build
new file mode 100644
index 00000000000..9537275d67c
--- /dev/null
+++ b/src/pl/plpgsql/meson.build
@@ -0,0 +1 @@
+subdir('src')
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
new file mode 100644
index 00000000000..dd499fdd151
--- /dev/null
+++ b/src/pl/plpgsql/src/meson.build
@@ -0,0 +1,84 @@
+plpgsql_sources = files(
+ 'pl_comp.c',
+ 'pl_exec.c',
+ 'pl_funcs.c',
+ 'pl_handler.c',
+ 'pl_scanner.c',
+)
+
+pl_gram = custom_target('gram',
+ input: 'pl_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += pl_gram.to_list()
+plpgsql_sources += pl_gram
+
+gen_plerrcodes = files('generate-plerrcodes.pl')
+pl_errcodes = custom_target('plerrcodes',
+ input: ['../../../../src/backend/utils/errcodes.txt'],
+ output: ['plerrcodes.h'],
+ command: [perl, gen_plerrcodes, '@INPUT0@'],
+ capture: true,
+)
+generated_sources += pl_errcodes
+plpgsql_sources += pl_errcodes
+
+gen_keywordlist = files('../../../../src/tools/gen_keywordlist.pl')
+pl_reserved = custom_target('pl_reserved_kwlist',
+ input: ['pl_reserved_kwlist.h'],
+ output: ['pl_reserved_kwlist_d.h'],
+ command: [perl, '-I', '@SOURCE_ROOT@/src/tools', gen_keywordlist, '--output', '@OUTDIR@', '--varname', 'ReservedPLKeywords', '@INPUT@']
+)
+generated_sources += pl_reserved
+plpgsql_sources += pl_reserved
+
+pl_unreserved = custom_target('pl_unreserved_kwlist',
+ input: ['pl_unreserved_kwlist.h'],
+ output: ['pl_unreserved_kwlist_d.h'],
+ command: [perl, '-I', '@SOURCE_ROOT@/src/tools', gen_keywordlist, '--output', '@OUTDIR@', '--varname', 'UnreservedPLKeywords', '@INPUT@']
+)
+generated_sources += pl_unreserved
+plpgsql_sources += pl_unreserved
+
+plpgsql = shared_module('plpgsql',
+ plpgsql_sources,
+ include_directories: include_directories('.'),
+ kwargs: pg_mod_args,
+)
+pl_targets += plpgsql
+
+install_data(
+ 'plpgsql.control',
+ 'plpgsql--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+install_headers(
+ 'plpgsql.h',
+ install_dir: dir_include_server
+)
+
+
+tests += {
+ 'name': 'plpgsql',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'plpgsql_array',
+ 'plpgsql_call',
+ 'plpgsql_control',
+ 'plpgsql_copy',
+ 'plpgsql_domain',
+ 'plpgsql_record',
+ 'plpgsql_cache',
+ 'plpgsql_simple',
+ 'plpgsql_transaction',
+ 'plpgsql_trap',
+ 'plpgsql_trigger',
+ 'plpgsql_varprops',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/plpgsql/src/po/meson.build b/src/pl/plpgsql/src/po/meson.build
new file mode 100644
index 00000000000..29e0b74488f
--- /dev/null
+++ b/src/pl/plpgsql/src/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('plpgsql-' + pg_version_major.to_string())
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
new file mode 100644
index 00000000000..366b3b171ac
--- /dev/null
+++ b/src/pl/plpython/meson.build
@@ -0,0 +1,99 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+plpython_sources = files(
+ 'plpy_cursorobject.c',
+ 'plpy_elog.c',
+ 'plpy_exec.c',
+ 'plpy_main.c',
+ 'plpy_planobject.c',
+ 'plpy_plpymodule.c',
+ 'plpy_procedure.c',
+ 'plpy_resultobject.c',
+ 'plpy_spi.c',
+ 'plpy_subxactobject.c',
+ 'plpy_typeio.c',
+ 'plpy_util.c',
+)
+
+plpython_sources += custom_target('spiexceptions.h',
+ input: files('../../backend/utils/errcodes.txt'),
+ output: 'spiexceptions.h',
+ command: [perl, files('generate-spiexceptions.pl'), '@INPUT@'],
+ capture: true,
+)
+
+
+# FIXME: need to duplicate import library ugliness?
+plpython_inc = include_directories('.')
+
+plpython = shared_module('plpython3',
+ plpython_sources,
+ include_directories: [plpython_inc, postgres_inc],
+ kwargs: pg_mod_args + {
+ 'dependencies': [python3_dep, pg_mod_args['dependencies']],
+ },
+)
+pl_targets += plpython
+
+# FIXME: Only install the relevant versions
+install_data(
+ 'plpython3u.control',
+ 'plpython3u--1.0.sql',
+ 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',
+ 'plpython_test',
+ 'plpython_do',
+ 'plpython_global',
+ 'plpython_import',
+ 'plpython_spi',
+ 'plpython_newline',
+ 'plpython_void',
+ 'plpython_call',
+ 'plpython_params',
+ 'plpython_setof',
+ 'plpython_record',
+ 'plpython_trigger',
+ 'plpython_types',
+ 'plpython_error',
+ 'plpython_ereport',
+ 'plpython_unicode',
+ 'plpython_quote',
+ 'plpython_composite',
+ 'plpython_subtransaction',
+ 'plpython_transaction',
+ 'plpython_drop',
+]
+
+tests += {
+ 'name': 'plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': plpython_regress,
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/plpython/po/meson.build b/src/pl/plpython/po/meson.build
new file mode 100644
index 00000000000..542e27fbe1f
--- /dev/null
+++ b/src/pl/plpython/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('plpython-' + pg_version_major.to_string())
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
new file mode 100644
index 00000000000..9b6addd7fd5
--- /dev/null
+++ b/src/pl/tcl/meson.build
@@ -0,0 +1,55 @@
+if not tcl_dep.found()
+ subdir_done()
+endif
+
+pltcl_sources = files(
+ 'pltcl.c',
+)
+
+gen_pltclerrcodes = files('generate-pltclerrcodes.pl')
+pltcl_sources += custom_target('pltclerrcodes.h',
+ input: files('../../backend/utils/errcodes.txt'),
+ output: 'pltclerrcodes.h',
+ capture: true,
+ command: [perl, gen_pltclerrcodes, '@INPUT@']
+)
+
+pltcl = shared_module('pltcl',
+ pltcl_sources,
+ include_directories: [include_directories('.'), postgres_inc],
+ kwargs: pg_mod_args + {
+ 'dependencies': [tcl_dep, pg_mod_args['dependencies']],
+ },
+)
+pl_targets += pltcl
+
+install_data(
+ 'pltcl.control',
+ 'pltcl--1.0.sql',
+ 'pltclu.control',
+ 'pltclu--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+pltcl_regress = [
+ 'pltcl_setup',
+ 'pltcl_queries',
+ 'pltcl_trigger',
+ 'pltcl_call',
+ 'pltcl_start_proc',
+ 'pltcl_subxact',
+ 'pltcl_unicode',
+ 'pltcl_transaction',
+]
+
+tests += {
+ 'name': 'pltcl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': pltcl_regress,
+ 'regress_args': ['--load-extension=pltcl'],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/tcl/po/meson.build b/src/pl/tcl/po/meson.build
new file mode 100644
index 00000000000..cc23ef1eb3b
--- /dev/null
+++ b/src/pl/tcl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pltcl-' + pg_version_major.to_string())
diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build
new file mode 100644
index 00000000000..fc2368d02cf
--- /dev/null
+++ b/contrib/adminpack/meson.build
@@ -0,0 +1,23 @@
+adminpack = shared_module('adminpack',
+ ['adminpack.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += adminpack
+
+install_data(
+ 'adminpack.control',
+ 'adminpack--1.0.sql',
+ 'adminpack--1.0--1.1.sql',
+ 'adminpack--1.1--2.0.sql',
+ 'adminpack--2.0--2.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'adminpack',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': ['adminpack'],
+ },
+}
diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build
new file mode 100644
index 00000000000..1db3d20349e
--- /dev/null
+++ b/contrib/amcheck/meson.build
@@ -0,0 +1,37 @@
+amcheck = shared_module('amcheck', [
+ 'verify_heapam.c',
+ 'verify_nbtree.c',
+ ],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += amcheck
+
+install_data(
+ 'amcheck.control',
+ 'amcheck--1.0.sql',
+ 'amcheck--1.0--1.1.sql',
+ 'amcheck--1.1--1.2.sql',
+ 'amcheck--1.2--1.3.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'amcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'check',
+ 'check_btree',
+ 'check_heap',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_verify_heapam.pl',
+ 't/002_cic.pl',
+ 't/003_cic_2pc.pl',
+ ],
+ },
+}
+
diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build
new file mode 100644
index 00000000000..d2e01968f54
--- /dev/null
+++ b/contrib/auth_delay/meson.build
@@ -0,0 +1,5 @@
+autoinc = shared_module('auth_delay',
+ ['auth_delay.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += autoinc
diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build
new file mode 100644
index 00000000000..249a8376faa
--- /dev/null
+++ b/contrib/auto_explain/meson.build
@@ -0,0 +1,16 @@
+auto_explain = shared_module('auto_explain',
+ files('auto_explain.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += auto_explain
+
+tests += {
+ 'name': 'auto_explain',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_auto_explain.pl',
+ ],
+ },
+}
diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build
new file mode 100644
index 00000000000..9f0517f1701
--- /dev/null
+++ b/contrib/basebackup_to_shell/meson.build
@@ -0,0 +1,22 @@
+basebackup_to_shell_sources = files(
+ 'basebackup_to_shell.c',
+)
+
+basebackup_to_shell = shared_module('basebackup_to_shell',
+ basebackup_to_shell_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += basebackup_to_shell
+
+tests += {
+ 'name': 'basebackup_to_shell',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ 'env': {'GZIP_PROGRAM': gzip.path(),
+ 'TAR': tar.path()},
+ },
+}
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
new file mode 100644
index 00000000000..b67cbef60bd
--- /dev/null
+++ b/contrib/basic_archive/meson.build
@@ -0,0 +1,23 @@
+basic_archive_sources = files(
+ 'basic_archive.c',
+)
+
+basic_archive = shared_module('basic_archive',
+ basic_archive_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += basic_archive
+
+tests += {
+ 'name': 'basic_archive',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'basic_archive',
+ ],
+ 'regress_args': [
+ '--temp-config', files('basic_archive.conf'),
+ ],
+ },
+}
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
new file mode 100644
index 00000000000..1fe7632bdbe
--- /dev/null
+++ b/contrib/bloom/meson.build
@@ -0,0 +1,36 @@
+bloom_sources = files(
+ 'blcost.c',
+ 'blinsert.c',
+ 'blscan.c',
+ 'blutils.c',
+ 'blvacuum.c',
+ 'blvalidate.c',
+)
+
+bloom = shared_module('bloom',
+ bloom_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += bloom
+
+install_data(
+ 'bloom.control',
+ 'bloom--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'bloom',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'bloom',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_wal.pl',
+ ],
+ },
+}
diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build
new file mode 100644
index 00000000000..c20b667d75f
--- /dev/null
+++ b/contrib/bool_plperl/meson.build
@@ -0,0 +1,42 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+bool_plperl_sources = files(
+ 'bool_plperl.c',
+)
+
+bool_plperl = shared_module('bool_plperl',
+ bool_plperl_sources,
+ include_directories: [plperl_inc, include_directories('.')],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [perl_dep, contrib_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+contrib_targets += bool_plperl
+
+install_data(
+ 'bool_plperl.control',
+ 'bool_plperl--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'bool_plperlu.control',
+ 'bool_plperlu--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'bool_plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'bool_plperl',
+ 'bool_plperlu',
+ ],
+ },
+}
diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build
new file mode 100644
index 00000000000..15d6d31a6ee
--- /dev/null
+++ b/contrib/btree_gin/meson.build
@@ -0,0 +1,54 @@
+btree_gin = shared_module('btree_gin',
+ files('btree_gin.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += btree_gin
+
+install_data(
+ 'btree_gin.control',
+ 'btree_gin--1.0.sql',
+ 'btree_gin--1.0--1.1.sql',
+ 'btree_gin--1.1--1.2.sql',
+ 'btree_gin--1.2--1.3.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'btree_gin',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'install_btree_gin',
+ 'int2',
+ 'int4',
+ 'int8',
+ 'float4',
+ 'float8',
+ 'money',
+ 'oid',
+ 'timestamp',
+ 'timestamptz',
+ 'time',
+ 'timetz',
+ 'date',
+ 'interval',
+ 'macaddr',
+ 'macaddr8',
+ 'inet',
+ 'cidr',
+ 'text',
+ 'varchar',
+ 'char',
+ 'bytea',
+ 'bit',
+ 'varbit',
+ 'numeric',
+ 'enum',
+ 'uuid',
+ 'name',
+ 'bool',
+ 'bpchar',
+ ],
+ },
+}
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
new file mode 100644
index 00000000000..c0a8d238540
--- /dev/null
+++ b/contrib/btree_gist/meson.build
@@ -0,0 +1,84 @@
+btree_gist_sources = files(
+ 'btree_bit.c',
+ 'btree_bool.c',
+ 'btree_bytea.c',
+ 'btree_cash.c',
+ 'btree_date.c',
+ 'btree_enum.c',
+ 'btree_float4.c',
+ 'btree_float8.c',
+ 'btree_gist.c',
+ 'btree_inet.c',
+ 'btree_int2.c',
+ 'btree_int4.c',
+ 'btree_int8.c',
+ 'btree_interval.c',
+ 'btree_macaddr.c',
+ 'btree_macaddr8.c',
+ 'btree_numeric.c',
+ 'btree_oid.c',
+ 'btree_text.c',
+ 'btree_time.c',
+ 'btree_ts.c',
+ 'btree_utils_num.c',
+ 'btree_utils_var.c',
+ 'btree_uuid.c',
+)
+
+btree_gist = shared_module('btree_gist',
+ btree_gist_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += btree_gist
+
+install_data(
+ 'btree_gist.control',
+ 'btree_gist--1.0--1.1.sql',
+ 'btree_gist--1.1--1.2.sql',
+ 'btree_gist--1.2.sql',
+ 'btree_gist--1.2--1.3.sql',
+ 'btree_gist--1.3--1.4.sql',
+ 'btree_gist--1.4--1.5.sql',
+ 'btree_gist--1.5--1.6.sql',
+ 'btree_gist--1.6--1.7.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'btree_gist',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'init',
+ 'int2',
+ 'int4',
+ 'int8',
+ 'float4',
+ 'float8',
+ 'cash',
+ 'oid',
+ 'timestamp',
+ 'timestamptz',
+ 'time',
+ 'timetz',
+ 'date',
+ 'interval',
+ 'macaddr',
+ 'macaddr8',
+ 'inet',
+ 'cidr',
+ 'text',
+ 'varchar',
+ 'char',
+ 'bytea',
+ 'bit',
+ 'varbit',
+ 'numeric',
+ 'uuid',
+ 'not_equal',
+ 'enum',
+ 'bool',
+ ],
+ },
+}
diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build
new file mode 100644
index 00000000000..ca60eded80b
--- /dev/null
+++ b/contrib/citext/meson.build
@@ -0,0 +1,34 @@
+citext_sources = files(
+ 'citext.c',
+)
+
+citext = shared_module('citext',
+ citext_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += citext
+
+install_data(
+ 'citext.control',
+ 'citext--1.0--1.1.sql',
+ 'citext--1.1--1.2.sql',
+ 'citext--1.2--1.3.sql',
+ 'citext--1.3--1.4.sql',
+ 'citext--1.4.sql',
+ 'citext--1.4--1.5.sql',
+ 'citext--1.5--1.6.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'citext',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'create_index_acl',
+ 'citext',
+ 'citext_utf8',
+ ],
+ },
+}
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
new file mode 100644
index 00000000000..72342b0c82c
--- /dev/null
+++ b/contrib/cube/meson.build
@@ -0,0 +1,53 @@
+cube_sources = files(
+ 'cube.c',
+)
+
+cube_scan = custom_target('cubescan',
+ input: 'cubescan.l',
+ output: 'cubescan.c',
+ command: flex_cmd,
+)
+generated_sources += cube_scan
+cube_sources += cube_scan
+
+cube_parse = custom_target('cubeparse',
+ input: 'cubeparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += cube_parse.to_list()
+cube_sources += cube_parse
+
+cube = shared_module('cube',
+ cube_sources,
+ include_directories: include_directories('.'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += cube
+
+install_data(
+ 'cube.control',
+ 'cube--1.0--1.1.sql',
+ 'cube--1.1--1.2.sql',
+ 'cube--1.2.sql',
+ 'cube--1.2--1.3.sql',
+ 'cube--1.3--1.4.sql',
+ 'cube--1.4--1.5.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'cubedata.h',
+ install_dir: dir_include_extension / 'cube',
+)
+
+tests += {
+ 'name': 'cube',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'cube',
+ 'cube_sci',
+ ],
+ },
+}
diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
new file mode 100644
index 00000000000..d35f7b5d49e
--- /dev/null
+++ b/contrib/dblink/meson.build
@@ -0,0 +1,31 @@
+dblink_sources = files(
+ 'dblink.c',
+)
+
+dblink = shared_module('dblink',
+ dblink_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'] + [libpq],
+ },
+)
+contrib_targets += dblink
+
+install_data(
+ 'dblink.control',
+ 'dblink--1.0--1.1.sql',
+ 'dblink--1.1--1.2.sql',
+ 'dblink--1.2.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dblink',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dblink',
+ ],
+ 'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
+ },
+}
diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build
new file mode 100644
index 00000000000..f00e8085619
--- /dev/null
+++ b/contrib/dict_int/meson.build
@@ -0,0 +1,22 @@
+dict_int = shared_module('dict_int',
+ files('dict_int.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += dict_int
+
+install_data(
+ 'dict_int.control',
+ 'dict_int--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dict_int',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dict_int',
+ ],
+ },
+}
diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build
new file mode 100644
index 00000000000..be53f55bb79
--- /dev/null
+++ b/contrib/dict_xsyn/meson.build
@@ -0,0 +1,29 @@
+dict_xsyn = shared_module('dict_xsyn',
+ files('dict_xsyn.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += dict_xsyn
+
+install_data(
+ 'dict_xsyn.control',
+ 'dict_xsyn--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'xsyn_sample.rules',
+ kwargs: contrib_data_args + {
+ 'install_dir': dir_data / 'tsearch_data'
+ }
+)
+
+tests += {
+ 'name': 'dict_xsyn',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dict_xsyn',
+ ],
+ },
+}
diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build
new file mode 100644
index 00000000000..807f5cb7de3
--- /dev/null
+++ b/contrib/earthdistance/meson.build
@@ -0,0 +1,23 @@
+earthdistance = shared_module('earthdistance',
+ files('earthdistance.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += earthdistance
+
+install_data(
+ 'earthdistance.control',
+ 'earthdistance--1.0--1.1.sql',
+ 'earthdistance--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'earthdistance',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'earthdistance',
+ ],
+ },
+}
diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build
new file mode 100644
index 00000000000..f13efb6e38e
--- /dev/null
+++ b/contrib/file_fdw/meson.build
@@ -0,0 +1,22 @@
+file_fdw = shared_module('file_fdw',
+ files('file_fdw.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += file_fdw
+
+install_data(
+ 'file_fdw.control',
+ 'file_fdw--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'file_fdw',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'file_fdw',
+ ],
+ },
+}
diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build
new file mode 100644
index 00000000000..ec278a6211e
--- /dev/null
+++ b/contrib/fuzzystrmatch/meson.build
@@ -0,0 +1,26 @@
+fuzzystrmatch = shared_module('fuzzystrmatch',
+ files(
+ 'fuzzystrmatch.c',
+ 'dmetaphone.c'
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += fuzzystrmatch
+
+install_data(
+ 'fuzzystrmatch.control',
+ 'fuzzystrmatch--1.0--1.1.sql',
+ 'fuzzystrmatch--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'fuzzystrmatch',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'fuzzystrmatch',
+ ],
+ },
+}
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
new file mode 100644
index 00000000000..07c59f40a97
--- /dev/null
+++ b/contrib/hstore/meson.build
@@ -0,0 +1,44 @@
+# .. so that includes of hstore/hstore.h work
+hstore_inc = include_directories('.', '../')
+
+hstore = shared_module('hstore',
+ files(
+ 'hstore_compat.c',
+ 'hstore_gin.c',
+ 'hstore_gist.c',
+ 'hstore_io.c',
+ 'hstore_op.c',
+ 'hstore_subs.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += hstore
+
+install_data(
+ 'hstore.control',
+ 'hstore--1.1--1.2.sql',
+ 'hstore--1.2--1.3.sql',
+ 'hstore--1.3--1.4.sql',
+ 'hstore--1.4.sql',
+ 'hstore--1.4--1.5.sql',
+ 'hstore--1.5--1.6.sql',
+ 'hstore--1.6--1.7.sql',
+ 'hstore--1.7--1.8.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'hstore.h',
+ install_dir: dir_include_extension / 'hstore',
+)
+
+tests += {
+ 'name': 'hstore',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'hstore',
+ ],
+ },
+}
diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build
new file mode 100644
index 00000000000..bbafa0221bd
--- /dev/null
+++ b/contrib/hstore_plperl/meson.build
@@ -0,0 +1,43 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+hstore_plperl_sources = files(
+ 'hstore_plperl.c',
+)
+
+hstore_plperl = shared_module('hstore_plperl',
+ hstore_plperl_sources,
+ include_directories: [plperl_inc, hstore_inc],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [perl_dep, contrib_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+contrib_targets += hstore_plperl
+
+install_data(
+ 'hstore_plperl.control',
+ 'hstore_plperl--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'hstore_plperlu.control',
+ 'hstore_plperlu--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'hstore_plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'hstore_plperl',
+ 'hstore_plperlu',
+ 'create_transform',
+ ],
+ },
+}
diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build
new file mode 100644
index 00000000000..214b48519a9
--- /dev/null
+++ b/contrib/hstore_plpython/meson.build
@@ -0,0 +1,37 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+hstore_plpython_sources = files(
+ 'hstore_plpython.c',
+)
+
+hstore_plpython = shared_module('hstore_plpython3',
+ hstore_plpython_sources,
+ include_directories: [plpython_inc, hstore_inc, ],
+ c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [python3_dep, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += hstore_plpython
+
+install_data(
+ 'hstore_plpython3u--1.0.sql',
+ 'hstore_plpython3u.control',
+ kwargs: contrib_data_args,
+)
+
+hstore_plpython_regress = [
+ 'hstore_plpython'
+]
+
+tests += {
+ 'name': 'hstore_plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': hstore_plpython_regress,
+ 'regress_args': ['--load-extension=hstore'],
+ },
+}
diff --git a/contrib/intagg/meson.build b/contrib/intagg/meson.build
new file mode 100644
index 00000000000..a0f39366f47
--- /dev/null
+++ b/contrib/intagg/meson.build
@@ -0,0 +1,6 @@
+install_data(
+ 'intagg.control',
+ 'intagg--1.0--1.1.sql',
+ 'intagg--1.1.sql',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build
new file mode 100644
index 00000000000..1655bcbb3fd
--- /dev/null
+++ b/contrib/intarray/meson.build
@@ -0,0 +1,37 @@
+intarray_sources = files(
+ '_int_bool.c',
+ '_int_gin.c',
+ '_int_gist.c',
+ '_int_op.c',
+ '_int_selfuncs.c',
+ '_int_tool.c',
+ '_intbig_gist.c',
+)
+
+intarray = shared_module('_int',
+ intarray_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += intarray
+
+install_data(
+ 'intarray.control',
+ 'intarray--1.0--1.1.sql',
+ 'intarray--1.1--1.2.sql',
+ 'intarray--1.2.sql',
+ 'intarray--1.2--1.3.sql',
+ 'intarray--1.3--1.4.sql',
+ 'intarray--1.4--1.5.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'intarray',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ '_int',
+ ],
+ },
+}
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
new file mode 100644
index 00000000000..cc30bbeb55c
--- /dev/null
+++ b/contrib/isn/meson.build
@@ -0,0 +1,33 @@
+isn_sources = files(
+ 'isn.c',
+)
+
+isn = shared_module('isn',
+ isn_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += isn
+
+install_data(
+ 'isn.control',
+ 'isn--1.0--1.1.sql',
+ 'isn--1.1--1.2.sql',
+ 'isn--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'isn.h',
+ install_dir: dir_include_extension / 'isn',
+)
+
+tests += {
+ 'name': 'isn',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'isn',
+ ],
+ },
+}
diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build
new file mode 100644
index 00000000000..5c915d8ed94
--- /dev/null
+++ b/contrib/jsonb_plperl/meson.build
@@ -0,0 +1,43 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+jsonb_plperl_sources = files(
+ 'jsonb_plperl.c',
+)
+
+jsonb_plperl = shared_module('jsonb_plperl',
+ jsonb_plperl_sources,
+ include_directories: [plperl_inc],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [perl_dep, contrib_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+contrib_targets += jsonb_plperl
+
+install_data(
+ 'jsonb_plperl.control',
+ 'jsonb_plperl--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'jsonb_plperlu.control',
+ 'jsonb_plperlu--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+
+tests += {
+ 'name': 'jsonb_plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'jsonb_plperl',
+ 'jsonb_plperlu',
+ ],
+ },
+}
diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build
new file mode 100644
index 00000000000..de8e1105c6a
--- /dev/null
+++ b/contrib/jsonb_plpython/meson.build
@@ -0,0 +1,36 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+jsonb_plpython_sources = files(
+ 'jsonb_plpython.c',
+)
+
+jsonb_plpython = shared_module('jsonb_plpython3',
+ jsonb_plpython_sources,
+ include_directories: [plpython_inc],
+ c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [python3_dep, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += jsonb_plpython
+
+install_data(
+ 'jsonb_plpython3u.control',
+ 'jsonb_plpython3u--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+jsonb_plpython_regress = [
+ 'jsonb_plpython'
+]
+
+tests += {
+ 'name': 'jsonb_plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': jsonb_plpython_regress,
+ },
+}
diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build
new file mode 100644
index 00000000000..9082d5713c7
--- /dev/null
+++ b/contrib/lo/meson.build
@@ -0,0 +1,27 @@
+lo_sources = files(
+ 'lo.c',
+)
+
+lo = shared_module('lo',
+ lo_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += lo
+
+install_data(
+ 'lo.control',
+ 'lo--1.0--1.1.sql',
+ 'lo--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'lo',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'lo',
+ ],
+ },
+}
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
new file mode 100644
index 00000000000..9463fc2c5e5
--- /dev/null
+++ b/contrib/ltree/meson.build
@@ -0,0 +1,44 @@
+ltree_sources = files(
+ '_ltree_gist.c',
+ '_ltree_op.c',
+ 'crc32.c',
+ 'lquery_op.c',
+ 'ltree_gist.c',
+ 'ltree_io.c',
+ 'ltree_op.c',
+ 'ltxtquery_io.c',
+ 'ltxtquery_op.c',
+)
+
+# .. so that includes of ltree/ltree.h work
+ltree_inc = include_directories('.', '../')
+
+ltree = shared_module('ltree',
+ ltree_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += ltree
+
+install_data(
+ 'ltree.control',
+ 'ltree--1.0--1.1.sql',
+ 'ltree--1.1--1.2.sql',
+ 'ltree--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'ltree.h',
+ install_dir: dir_include_extension / 'ltree',
+)
+
+tests += {
+ 'name': 'ltree',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'ltree',
+ ],
+ },
+}
diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build
new file mode 100644
index 00000000000..429d75006aa
--- /dev/null
+++ b/contrib/ltree_plpython/meson.build
@@ -0,0 +1,37 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+ltree_plpython_sources = files(
+ 'ltree_plpython.c',
+)
+
+ltree_plpython = shared_module('ltree_plpython3',
+ ltree_plpython_sources,
+ include_directories: [plpython_inc, ltree_inc],
+ c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [python3_dep, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += ltree_plpython
+
+install_data(
+ 'ltree_plpython3u--1.0.sql',
+ 'ltree_plpython3u.control',
+ kwargs: contrib_data_args,
+)
+
+ltree_plpython_regress = [
+ 'ltree_plpython'
+]
+
+tests += {
+ 'name': 'ltree_plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': ltree_plpython_regress,
+ 'regress_args': ['--load-extension=ltree'],
+ },
+}
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 00000000000..84752d4bd0f
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1,66 @@
+contrib_mod_args = pg_mod_args
+
+contrib_data_dir = dir_data_extension
+contrib_data_args = {
+ 'install_dir': contrib_data_dir,
+}
+
+subdir('adminpack')
+subdir('amcheck')
+subdir('auth_delay')
+subdir('auto_explain')
+subdir('basic_archive')
+subdir('bloom')
+subdir('basebackup_to_shell')
+subdir('bool_plperl')
+subdir('btree_gin')
+subdir('btree_gist')
+subdir('citext')
+subdir('cube')
+subdir('dblink')
+subdir('dict_int')
+subdir('dict_xsyn')
+subdir('earthdistance')
+subdir('file_fdw')
+subdir('fuzzystrmatch')
+subdir('hstore')
+subdir('hstore_plperl')
+subdir('hstore_plpython')
+subdir('intagg')
+subdir('intarray')
+subdir('isn')
+subdir('jsonb_plperl')
+subdir('jsonb_plpython')
+subdir('lo')
+subdir('ltree')
+subdir('ltree_plpython')
+subdir('oid2name')
+subdir('old_snapshot')
+subdir('pageinspect')
+subdir('passwordcheck')
+subdir('pg_buffercache')
+subdir('pgcrypto')
+subdir('pg_freespacemap')
+subdir('pg_prewarm')
+subdir('pgrowlocks')
+subdir('pg_stat_statements')
+subdir('pgstattuple')
+subdir('pg_surgery')
+subdir('pg_trgm')
+subdir('pg_visibility')
+subdir('pg_walinspect')
+subdir('postgres_fdw')
+subdir('seg')
+subdir('sepgsql')
+subdir('spi')
+subdir('sslinfo')
+# start-scripts doesn't contain build products
+subdir('tablefunc')
+subdir('tcn')
+subdir('test_decoding')
+subdir('tsm_system_rows')
+subdir('tsm_system_time')
+subdir('unaccent')
+subdir('uuid-ossp')
+subdir('vacuumlo')
+subdir('xml2')
diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build
new file mode 100644
index 00000000000..1dad5d8f6e7
--- /dev/null
+++ b/contrib/oid2name/meson.build
@@ -0,0 +1,17 @@
+oid2name = executable('oid2name',
+ ['oid2name.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+contrib_targets += oid2name
+
+tests += {
+ 'name': 'oid2name',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build
new file mode 100644
index 00000000000..8e7ee09a43a
--- /dev/null
+++ b/contrib/old_snapshot/meson.build
@@ -0,0 +1,15 @@
+old_snapshot_sources = files(
+ 'time_mapping.c',
+)
+
+old_snapshot = shared_module('old_snapshot',
+ old_snapshot_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += old_snapshot
+
+install_data(
+ 'old_snapshot.control',
+ 'old_snapshot--1.0.sql',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
new file mode 100644
index 00000000000..4af8153e4fd
--- /dev/null
+++ b/contrib/pageinspect/meson.build
@@ -0,0 +1,50 @@
+pageinspect_sources = files(
+ 'brinfuncs.c',
+ 'btreefuncs.c',
+ 'fsmfuncs.c',
+ 'ginfuncs.c',
+ 'gistfuncs.c',
+ 'hashfuncs.c',
+ 'heapfuncs.c',
+ 'rawpage.c',
+)
+
+pageinspect = shared_module('pageinspect',
+ pageinspect_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pageinspect
+
+install_data(
+ 'pageinspect--1.0--1.1.sql',
+ 'pageinspect--1.1--1.2.sql',
+ 'pageinspect--1.2--1.3.sql',
+ 'pageinspect--1.3--1.4.sql',
+ 'pageinspect--1.4--1.5.sql',
+ 'pageinspect--1.5--1.6.sql',
+ 'pageinspect--1.5.sql',
+ 'pageinspect--1.6--1.7.sql',
+ 'pageinspect--1.7--1.8.sql',
+ 'pageinspect--1.8--1.9.sql',
+ 'pageinspect--1.9--1.10.sql',
+ 'pageinspect.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pageinspect',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'page',
+ 'btree',
+ 'brin',
+ 'gin',
+ 'gist',
+ 'hash',
+ 'checksum',
+ 'oldextversions',
+ ],
+ },
+}
diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build
new file mode 100644
index 00000000000..7da47d02f1d
--- /dev/null
+++ b/contrib/passwordcheck/meson.build
@@ -0,0 +1,30 @@
+passwordcheck_sources = files(
+ 'passwordcheck.c',
+)
+
+passwordcheck_c_args = []
+passwordcheck_deps = []
+
+# uncomment the following two lines to enable cracklib support
+# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
+# passwordcheck_deps += [cc.find_library('crack')]
+
+passwordcheck = shared_module('passwordcheck',
+ passwordcheck_sources,
+ c_args: passwordcheck_c_args,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args.get('dependencies') + passwordcheck_deps,
+ }
+)
+contrib_targets += passwordcheck
+
+tests += {
+ 'name': 'passwordcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'passwordcheck',
+ ],
+ },
+}
diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build
new file mode 100644
index 00000000000..2c69eae3ea2
--- /dev/null
+++ b/contrib/pg_buffercache/meson.build
@@ -0,0 +1,27 @@
+pg_buffercache = shared_module('pg_buffercache',
+ files(
+ 'pg_buffercache_pages.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_buffercache
+
+install_data(
+ 'pg_buffercache--1.0--1.1.sql',
+ 'pg_buffercache--1.1--1.2.sql',
+ 'pg_buffercache--1.2--1.3.sql',
+ 'pg_buffercache--1.2.sql',
+ 'pg_buffercache.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_buffercache',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_buffercache',
+ ],
+ },
+}
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
new file mode 100644
index 00000000000..f795014d7ca
--- /dev/null
+++ b/contrib/pg_freespacemap/meson.build
@@ -0,0 +1,29 @@
+pg_freespacemap = shared_module('pg_freespacemap',
+ files(
+ 'pg_freespacemap.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_freespacemap
+
+install_data(
+ 'pg_freespacemap--1.0--1.1.sql',
+ 'pg_freespacemap--1.1--1.2.sql',
+ 'pg_freespacemap--1.1.sql',
+ 'pg_freespacemap.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_freespacemap',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_freespacemap',
+ ],
+ 'regress_args': [
+ '--temp-config', files('pg_freespacemap.conf')
+ ],
+ },
+}
diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build
new file mode 100644
index 00000000000..bdca9af4f27
--- /dev/null
+++ b/contrib/pg_prewarm/meson.build
@@ -0,0 +1,27 @@
+pg_prewarm = shared_module('pg_prewarm',
+ files(
+ 'autoprewarm.c',
+ 'pg_prewarm.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_prewarm
+
+install_data(
+ 'pg_prewarm--1.0--1.1.sql',
+ 'pg_prewarm--1.1--1.2.sql',
+ 'pg_prewarm--1.1.sql',
+ 'pg_prewarm.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_prewarm',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
new file mode 100644
index 00000000000..ac117d2fc1d
--- /dev/null
+++ b/contrib/pg_stat_statements/meson.build
@@ -0,0 +1,35 @@
+pg_stat_statements = shared_module('pg_stat_statements',
+ files('pg_stat_statements.c'),
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'],
+ },
+)
+contrib_targets += pg_stat_statements
+
+install_data(
+ 'pg_stat_statements.control',
+ 'pg_stat_statements--1.4.sql',
+ 'pg_stat_statements--1.9--1.10.sql',
+ 'pg_stat_statements--1.8--1.9.sql',
+ 'pg_stat_statements--1.7--1.8.sql',
+ 'pg_stat_statements--1.6--1.7.sql',
+ 'pg_stat_statements--1.5--1.6.sql',
+ 'pg_stat_statements--1.4--1.5.sql',
+ 'pg_stat_statements--1.3--1.4.sql',
+ 'pg_stat_statements--1.2--1.3.sql',
+ 'pg_stat_statements--1.1--1.2.sql',
+ 'pg_stat_statements--1.0--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_stat_statements',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_stat_statements',
+ ],
+ 'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
+ },
+}
diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build
new file mode 100644
index 00000000000..ac71caa5276
--- /dev/null
+++ b/contrib/pg_surgery/meson.build
@@ -0,0 +1,25 @@
+pg_surgery = shared_module('pg_surgery',
+ files(
+ 'heap_surgery.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_surgery
+
+install_data(
+ 'pg_surgery--1.0.sql',
+ 'pg_surgery.control',
+ kwargs: contrib_data_args,
+)
+
+
+tests += {
+ 'name': 'pg_surgery',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'heap_surgery',
+ ],
+ },
+}
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
new file mode 100644
index 00000000000..a90628d23c6
--- /dev/null
+++ b/contrib/pg_trgm/meson.build
@@ -0,0 +1,35 @@
+pg_trgm = shared_module('pg_trgm',
+ files(
+ 'trgm_gin.c',
+ 'trgm_gist.c',
+ 'trgm_op.c',
+ 'trgm_regexp.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_trgm
+
+install_data(
+ 'pg_trgm--1.0--1.1.sql',
+ 'pg_trgm--1.1--1.2.sql',
+ 'pg_trgm--1.2--1.3.sql',
+ 'pg_trgm--1.3--1.4.sql',
+ 'pg_trgm--1.3.sql',
+ 'pg_trgm--1.4--1.5.sql',
+ 'pg_trgm--1.5--1.6.sql',
+ 'pg_trgm.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_trgm',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_trgm',
+ 'pg_word_trgm',
+ 'pg_strict_word_trgm',
+ ],
+ },
+}
diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build
new file mode 100644
index 00000000000..933dc99ac4d
--- /dev/null
+++ b/contrib/pg_visibility/meson.build
@@ -0,0 +1,26 @@
+pg_visibility = shared_module('pg_visibility',
+ files(
+ 'pg_visibility.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_visibility
+
+install_data(
+ 'pg_visibility--1.0--1.1.sql',
+ 'pg_visibility--1.1--1.2.sql',
+ 'pg_visibility--1.1.sql',
+ 'pg_visibility.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_visibility',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_visibility',
+ ],
+ },
+}
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
new file mode 100644
index 00000000000..d6b27877dd0
--- /dev/null
+++ b/contrib/pg_walinspect/meson.build
@@ -0,0 +1,27 @@
+pg_walinspect_sources = files('pg_walinspect.c')
+
+pg_walinspect = shared_module('pg_walinspect',
+ pg_walinspect_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'],
+ },
+)
+contrib_targets += pg_walinspect
+
+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')],
+ },
+}
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
new file mode 100644
index 00000000000..fe0851bf8e8
--- /dev/null
+++ b/contrib/pgcrypto/meson.build
@@ -0,0 +1,100 @@
+if not ssl.found()
+ subdir_done()
+endif
+
+pgcrypto_sources = files(
+ 'crypt-blowfish.c',
+ 'crypt-des.c',
+ 'crypt-gensalt.c',
+ 'crypt-md5.c',
+ 'mbuf.c',
+ 'pgcrypto.c',
+ 'pgp-armor.c',
+ 'pgp-cfb.c',
+ 'pgp-compress.c',
+ 'pgp-decrypt.c',
+ 'pgp-encrypt.c',
+ 'pgp-info.c',
+ 'pgp-mpi.c',
+ 'pgp-pgsql.c',
+ 'pgp-pubdec.c',
+ 'pgp-pubenc.c',
+ 'pgp-pubkey.c',
+ 'pgp-s2k.c',
+ 'pgp.c',
+ 'px-crypt.c',
+ 'px-hmac.c',
+ 'px.c',
+)
+
+pgcrypto_regress = [
+ 'init',
+ 'md5',
+ 'sha1',
+ 'hmac-md5',
+ 'hmac-sha1',
+ 'blowfish',
+ 'rijndael',
+ 'sha2',
+ 'des',
+ '3des',
+ 'cast5',
+ 'crypt-des',
+ 'crypt-md5',
+ 'crypt-blowfish',
+ 'crypt-xdes',
+ 'pgp-armor',
+ 'pgp-decrypt',
+ 'pgp-encrypt',
+ 'pgp-pubkey-decrypt',
+ 'pgp-pubkey-encrypt',
+ 'pgp-info',
+]
+
+pgcrypto_openssl_sources = files(
+ 'openssl.c',
+ 'pgp-mpi-openssl.c',
+)
+
+pgcrypto_deps = []
+pgcrypto_link_with = []
+
+pgcrypto_deps += ssl
+pgcrypto_sources += pgcrypto_openssl_sources
+
+if zlib.found()
+ pgcrypto_deps += zlib
+ pgcrypto_regress += 'pgp-compression'
+else
+ pgcrypto_regress += 'pgp-zlib-DISABLED'
+endif
+
+pgcrypto = shared_module('pgcrypto',
+ pgcrypto_sources,
+ link_with: pgcrypto_link_with,
+ kwargs: contrib_mod_args + {
+ 'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
+ },
+)
+contrib_targets += pgcrypto
+
+install_data(
+ 'pgcrypto--1.0--1.1.sql',
+ 'pgcrypto--1.1--1.2.sql',
+ 'pgcrypto--1.2--1.3.sql',
+ 'pgcrypto--1.3.sql',
+ 'pgcrypto.control',
+ kwargs: contrib_data_args,
+)
+
+
+tests += {
+ 'name': 'pgcrypto',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ pgcrypto_regress,
+ ],
+ },
+}
diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build
new file mode 100644
index 00000000000..1b41691a2a3
--- /dev/null
+++ b/contrib/pgrowlocks/meson.build
@@ -0,0 +1,27 @@
+pgrowlocks = shared_module('pgrowlocks',
+ files(
+ 'pgrowlocks.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pgrowlocks
+
+install_data(
+ 'pgrowlocks--1.0--1.1.sql',
+ 'pgrowlocks--1.1--1.2.sql',
+ 'pgrowlocks--1.2.sql',
+ 'pgrowlocks.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pgrowlocks',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'pgrowlocks',
+ ],
+ 'regress_args': ['--load-extension=pgrowlocks'],
+ },
+}
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
new file mode 100644
index 00000000000..8e828692d5c
--- /dev/null
+++ b/contrib/pgstattuple/meson.build
@@ -0,0 +1,31 @@
+pgstattuple = shared_module('pgstattuple',
+ files(
+ 'pgstatapprox.c',
+ 'pgstatindex.c',
+ 'pgstattuple.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pgstattuple
+
+install_data(
+ 'pgstattuple--1.0--1.1.sql',
+ 'pgstattuple--1.1--1.2.sql',
+ 'pgstattuple--1.2--1.3.sql',
+ 'pgstattuple--1.3--1.4.sql',
+ 'pgstattuple--1.4--1.5.sql',
+ 'pgstattuple--1.4.sql',
+ 'pgstattuple.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pgstattuple',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pgstattuple',
+ ],
+ },
+}
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
new file mode 100644
index 00000000000..378885ec93b
--- /dev/null
+++ b/contrib/postgres_fdw/meson.build
@@ -0,0 +1,34 @@
+postgres_fdw_sources = files(
+ 'connection.c',
+ 'deparse.c',
+ 'option.c',
+ 'postgres_fdw.c',
+ 'shippable.c',
+)
+
+postgres_fdw = shared_module('postgres_fdw',
+ postgres_fdw_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'] + [libpq],
+ },
+)
+contrib_targets += postgres_fdw
+
+install_data(
+ 'postgres_fdw.control',
+ 'postgres_fdw--1.0.sql',
+ 'postgres_fdw--1.0--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'postgres_fdw',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'postgres_fdw',
+ ],
+ 'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
+ },
+}
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
new file mode 100644
index 00000000000..e476eab2a77
--- /dev/null
+++ b/contrib/seg/meson.build
@@ -0,0 +1,51 @@
+seg_sources = files(
+ 'seg.c',
+)
+
+seg_scan = custom_target('segscan',
+ input: 'segscan.l',
+ output: 'segscan.c',
+ command: flex_cmd,
+)
+generated_sources += seg_scan
+seg_sources += seg_scan
+
+seg_parse = custom_target('segparse',
+ input: 'segparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += seg_parse.to_list()
+seg_sources += seg_parse
+
+seg = shared_module('seg',
+ seg_sources,
+ include_directories: include_directories('.'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += seg
+
+install_data(
+ 'seg.control',
+ 'seg--1.0--1.1.sql',
+ 'seg--1.1--1.2.sql',
+ 'seg--1.1.sql',
+ 'seg--1.2--1.3.sql',
+ 'seg--1.3--1.4.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'segdata.h',
+ install_dir: dir_include_extension / 'seg',
+)
+
+tests += {
+ 'name': 'seg',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'seg',
+ ],
+ },
+}
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
new file mode 100644
index 00000000000..60a95e17c2f
--- /dev/null
+++ b/contrib/sepgsql/meson.build
@@ -0,0 +1,34 @@
+if not selinux.found()
+ subdir_done()
+endif
+
+sepgsql_sources = files(
+ 'database.c',
+ 'dml.c',
+ 'hooks.c',
+ 'label.c',
+ 'proc.c',
+ 'relation.c',
+ 'schema.c',
+ 'selinux.c',
+ 'uavc.c',
+)
+
+sepgsql = shared_module('sepgsql',
+ sepgsql_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': [selinux, contrib_mod_args['dependencies']],
+ }
+)
+contrib_targets += sepgsql
+
+custom_target('sepgsql.sql',
+ input: 'sepgsql.sql.in',
+ output: 'sepgsql.sql',
+ command: [sed, '-e', 's,MODULE_PATHNAME,$libdir/sepgsql,g', '@INPUT@'],
+ capture: true,
+ install: true,
+ install_dir: contrib_data_args['install_dir'],
+)
+
+# TODO: implement sepgsql tests
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
new file mode 100644
index 00000000000..98008980ec2
--- /dev/null
+++ b/contrib/spi/meson.build
@@ -0,0 +1,50 @@
+autoinc = shared_module('autoinc',
+ ['autoinc.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += autoinc
+
+install_data('autoinc.control', 'autoinc--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+
+insert_username = shared_module('insert_username',
+ ['insert_username.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += insert_username
+
+install_data(
+ 'insert_username.control',
+ 'insert_username--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+
+moddatetime = shared_module('moddatetime',
+ ['moddatetime.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += moddatetime
+
+install_data(
+ 'moddatetime.control',
+ 'moddatetime--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+# this is needed for the regression tests;
+# comment out if you want a quieter refint package for other uses
+refint_cflags = ['-DREFINT_VERBOSE']
+
+refint = shared_module('refint',
+ ['refint.c'],
+ c_args: refint_cflags,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += refint
+
+install_data('refint.control', 'refint--1.0.sql',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
new file mode 100644
index 00000000000..53f752a08ac
--- /dev/null
+++ b/contrib/sslinfo/meson.build
@@ -0,0 +1,21 @@
+if not ssl.found()
+ subdir_done()
+endif
+
+sslinfo = shared_module('sslinfo',
+ files(
+ 'sslinfo.c',
+ ),
+ kwargs: contrib_mod_args + {
+ 'dependencies': [ssl, contrib_mod_args['dependencies']],
+ }
+)
+contrib_targets += sslinfo
+
+install_data(
+ 'sslinfo--1.0--1.1.sql',
+ 'sslinfo--1.1--1.2.sql',
+ 'sslinfo--1.2.sql',
+ 'sslinfo.control',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build
new file mode 100644
index 00000000000..f4230096c0c
--- /dev/null
+++ b/contrib/tablefunc/meson.build
@@ -0,0 +1,24 @@
+tablefunc = shared_module('tablefunc',
+ files(
+ 'tablefunc.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tablefunc
+
+install_data(
+ 'tablefunc--1.0.sql',
+ 'tablefunc.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tablefunc',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'tablefunc',
+ ],
+ },
+}
diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build
new file mode 100644
index 00000000000..c3a025247d4
--- /dev/null
+++ b/contrib/tcn/meson.build
@@ -0,0 +1,25 @@
+tcn = shared_module('tcn',
+ files(
+ 'tcn.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tcn
+
+install_data(
+ 'tcn--1.0.sql',
+ 'tcn.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tcn',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'tcn',
+ ],
+ 'regress_args': ['--load-extension=tcn'],
+ },
+}
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
new file mode 100644
index 00000000000..dd7cb0101ad
--- /dev/null
+++ b/contrib/test_decoding/meson.build
@@ -0,0 +1,63 @@
+test_decoding_sources = files(
+ 'test_decoding.c',
+)
+
+test_decoding = shared_module('test_decoding',
+ test_decoding_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += test_decoding
+
+tests += {
+ 'name': 'test_decoding',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'ddl',
+ 'xact',
+ 'rewrite',
+ 'toast',
+ 'permissions',
+ 'decoding_in_xact',
+ 'decoding_into_rel',
+ 'binary',
+ 'prepared',
+ 'replorigin',
+ 'time',
+ 'messages',
+ 'spill',
+ 'slot',
+ 'truncate',
+ 'stream',
+ 'stats',
+ 'twophase',
+ 'twophase_stream',
+ ],
+ 'regress_args': [
+ '--temp-config', files('logical.conf'),
+ ],
+ },
+ 'isolation': {
+ 'specs': [
+ 'mxact',
+ 'delayed_startup',
+ 'ondisk_startup',
+ 'concurrent_ddl_dml',
+ 'oldest_xmin',
+ 'snapshot_transfer',
+ 'subxact_without_top',
+ 'concurrent_stream',
+ 'twophase_snapshot',
+ 'slot_creation_error',
+ ],
+ 'regress_args': [
+ '--temp-config', files('logical.conf'),
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_repl_stats.pl',
+ ],
+ },
+}
diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build
new file mode 100644
index 00000000000..b9cd42115a8
--- /dev/null
+++ b/contrib/tsm_system_rows/meson.build
@@ -0,0 +1,24 @@
+tsm_system_rows = shared_module('tsm_system_rows',
+ files(
+ 'tsm_system_rows.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tsm_system_rows
+
+install_data(
+ 'tsm_system_rows--1.0.sql',
+ 'tsm_system_rows.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tsm_system_rows',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'tsm_system_rows',
+ ],
+ },
+}
diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build
new file mode 100644
index 00000000000..18015912ffb
--- /dev/null
+++ b/contrib/tsm_system_time/meson.build
@@ -0,0 +1,24 @@
+tsm_system_time = shared_module('tsm_system_time',
+ files(
+ 'tsm_system_time.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tsm_system_time
+
+install_data(
+ 'tsm_system_time--1.0.sql',
+ 'tsm_system_time.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tsm_system_time',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'tsm_system_time',
+ ],
+ },
+}
diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build
new file mode 100644
index 00000000000..872b76e3223
--- /dev/null
+++ b/contrib/unaccent/meson.build
@@ -0,0 +1,32 @@
+unaccent = shared_module('unaccent',
+ files(
+ 'unaccent.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += unaccent
+
+install_data(
+ 'unaccent--1.0--1.1.sql',
+ 'unaccent--1.1.sql',
+ 'unaccent.control',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'unaccent.rules',
+ install_dir: dir_data / 'tsearch_data'
+)
+
+# XXX: Implement downlo
+tests += {
+ 'name': 'unaccent',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'unaccent',
+ ],
+ 'regress_args': ['--encoding=UTF8'],
+ },
+}
diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build
new file mode 100644
index 00000000000..da6d1d75c12
--- /dev/null
+++ b/contrib/uuid-ossp/meson.build
@@ -0,0 +1,31 @@
+if not uuid.found()
+ subdir_done()
+endif
+
+uuid_ossp = shared_module('uuid-ossp',
+ files(
+ 'uuid-ossp.c',
+ ),
+ kwargs: contrib_mod_args + {
+ 'dependencies': [uuid, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += uuid_ossp
+
+install_data(
+ 'uuid-ossp--1.0--1.1.sql',
+ 'uuid-ossp--1.1.sql',
+ 'uuid-ossp.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'uuid-ossp',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'uuid_ossp',
+ ],
+ },
+}
diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build
new file mode 100644
index 00000000000..7a632b87d1b
--- /dev/null
+++ b/contrib/vacuumlo/meson.build
@@ -0,0 +1,17 @@
+vacuumlo = executable('vacuumlo',
+ ['vacuumlo.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+contrib_targets += vacuumlo
+
+tests += {
+ 'name': 'vacuumlo',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
new file mode 100644
index 00000000000..9c0b56f01f6
--- /dev/null
+++ b/contrib/xml2/meson.build
@@ -0,0 +1,32 @@
+if not libxml.found()
+ subdir_done()
+endif
+
+xml2 = shared_module('pgxml',
+ files(
+ 'xpath.c',
+ 'xslt_proc.c',
+ ),
+ kwargs: contrib_mod_args + {
+ 'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += xml2
+
+install_data(
+ 'xml2--1.0--1.1.sql',
+ 'xml2--1.1.sql',
+ 'xml2.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'xml2',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'xml2',
+ ],
+ },
+}
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
new file mode 100644
index 00000000000..5887cb92b52
--- /dev/null
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -0,0 +1,22 @@
+export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+
+ecpg_compat = both_libraries('libecpg_compat',
+ 'informix.c',
+ include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
+ c_args: ['-DSO_MAJOR_VERSION=3'],
+ dependencies: [frontend_code, thread_dep],
+ link_with: [ecpglib, ecpg_pgtypes],
+ soversion: host_system != 'windows' ? '3' : '',
+ darwin_versions: ['3', '3.' + pg_version_major.to_string()],
+ version: '3.' + pg_version_major.to_string(),
+ link_args: export_fmt.format(export_file.full_path()),
+ link_depends: export_file,
+ kwargs: default_lib_args,
+)
+ecpg_targets += [ecpg_compat.get_shared_lib(), ecpg_compat.get_static_lib()]
+
+pkgconfig.generate(
+ ecpg_compat.get_shared_lib(),
+ description: 'PostgreSQL libecpg_compat library',
+ url: pg_url,
+)
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
new file mode 100644
index 00000000000..2da029ec8ea
--- /dev/null
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -0,0 +1,37 @@
+ecpglib_sources = files(
+ 'connect.c',
+ 'data.c',
+ 'descriptor.c',
+ 'error.c',
+ 'execute.c',
+ 'memory.c',
+ 'misc.c',
+ 'prepare.c',
+ 'sqlda.c',
+ 'typename.c',
+)
+
+export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+
+ecpglib = both_libraries('libecpg',
+ ecpglib_sources,
+ include_directories: ['.', ecpg_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=6'],
+ dependencies: [frontend_code, libpq, thread_dep],
+ link_with: [ecpg_pgtypes],
+ soversion: host_system != 'windows' ? '6' : '',
+ darwin_versions: ['6', '6.' + pg_version_major.to_string()],
+ version: '6.' + pg_version_major.to_string(),
+ link_args: export_fmt.format(export_file.full_path()),
+ link_depends: export_file,
+ kwargs: default_lib_args,
+)
+ecpg_targets += [ecpglib.get_shared_lib(), ecpglib.get_static_lib()]
+
+pkgconfig.generate(
+ ecpglib.get_shared_lib(),
+ description: 'PostgreSQL libecpg library',
+ url: pg_url,
+)
+
+subdir('po', if_found: libintl)
diff --git a/src/interfaces/ecpg/ecpglib/po/meson.build b/src/interfaces/ecpg/ecpglib/po/meson.build
new file mode 100644
index 00000000000..246e399ebd3
--- /dev/null
+++ b/src/interfaces/ecpg/ecpglib/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('ecpglib' + '6' + '-' + pg_version_major.to_string())
diff --git a/src/interfaces/ecpg/include/meson.build b/src/interfaces/ecpg/include/meson.build
new file mode 100644
index 00000000000..c95d0455b9a
--- /dev/null
+++ b/src/interfaces/ecpg/include/meson.build
@@ -0,0 +1,51 @@
+ecpg_inc = include_directories('.')
+
+ecpg_conf_keys = [
+ 'ENABLE_THREAD_SAFETY',
+ 'HAVE_INT64',
+ 'HAVE_LONG_INT_64',
+ 'HAVE_LONG_LONG_INT_64',
+ 'PG_USE_STDBOOL',
+]
+
+ecpg_conf_data = configuration_data()
+
+foreach key : ecpg_conf_keys
+ if cdata.has(key)
+ ecpg_conf_data.set(key, cdata.get(key))
+ endif
+endforeach
+
+ecpg_config_h = configure_file(
+ output: 'ecpg_config.h',
+ configuration: ecpg_conf_data,
+ install_dir: dir_include,
+)
+configure_files += ecpg_config_h
+
+generated_sources_ac += {'src/interfaces/ecpg/include': ['stamp-h']}
+
+install_headers(
+ 'ecpg_informix.h',
+ 'ecpgerrno.h',
+ 'ecpglib.h',
+ 'ecpgtype.h',
+ 'pgtypes.h',
+ 'pgtypes_date.h',
+ 'pgtypes_error.h',
+ 'pgtypes_interval.h',
+ 'pgtypes_numeric.h',
+ 'pgtypes_timestamp.h',
+ 'sql3types.h',
+ 'sqlca.h',
+ 'sqlda.h',
+ 'sqlda-compat.h',
+ 'sqlda-native.h',
+)
+
+install_headers(
+ 'datetime.h',
+ 'decimal.h',
+ 'sqltypes.h',
+ install_dir: dir_include_pkg / 'informix' / 'esql',
+)
diff --git a/src/interfaces/ecpg/meson.build b/src/interfaces/ecpg/meson.build
new file mode 100644
index 00000000000..f079b42269f
--- /dev/null
+++ b/src/interfaces/ecpg/meson.build
@@ -0,0 +1,9 @@
+ecpg_targets = []
+
+subdir('include')
+subdir('pgtypeslib')
+subdir('ecpglib')
+subdir('compatlib')
+subdir('preproc')
+
+alias_target('ecpg', ecpg_targets)
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
new file mode 100644
index 00000000000..96489d9f1d7
--- /dev/null
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -0,0 +1,30 @@
+ecpg_pgtypes_sources = files(
+ 'common.c',
+ 'datetime.c',
+ 'dt_common.c',
+ 'interval.c',
+ 'numeric.c',
+ 'timestamp.c',
+)
+
+export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+
+ecpg_pgtypes = both_libraries('libpgtypes',
+ ecpg_pgtypes_sources,
+ include_directories: ['.', ecpg_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=3'],
+ dependencies: [frontend_code],
+ version: '3.' + pg_version_major.to_string(),
+ soversion: host_system != 'windows' ? '3' : '',
+ darwin_versions: ['3', '3.' + pg_version_major.to_string()],
+ link_args: export_fmt.format(export_file.full_path()),
+ link_depends: export_file,
+ kwargs: default_lib_args,
+)
+ecpg_targets += [ecpg_pgtypes.get_shared_lib(), ecpg_pgtypes.get_static_lib()]
+
+pkgconfig.generate(
+ ecpg_pgtypes.get_shared_lib(),
+ description: 'PostgreSQL libpgtypes library',
+ url: pg_url,
+)
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
new file mode 100644
index 00000000000..08956bbdbb6
--- /dev/null
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -0,0 +1,103 @@
+ecpg_sources = files(
+ '../ecpglib/typename.c',
+ 'c_keywords.c',
+ 'descriptor.c',
+ 'ecpg.c',
+ 'ecpg_keywords.c',
+ 'keywords.c',
+ 'output.c',
+ 'parser.c',
+ 'type.c',
+ 'variable.c',
+)
+
+pgc = custom_target('pgc.c',
+ input: 'pgc.l',
+ output: 'pgc.c',
+ command: flex_cmd,
+)
+generated_sources += pgc
+ecpg_sources += pgc
+
+ecpg_files = [
+ 'ecpg.addons',
+ 'ecpg.header',
+ 'ecpg.tokens',
+ 'ecpg.trailer',
+ 'ecpg.type',
+]
+
+preproc_y = custom_target('preproc.y',
+ input: [
+ '../../../backend/parser/gram.y',
+ ecpg_files,
+ ],
+ output: ['preproc.y'],
+ command: [
+ perl, files('parse.pl'),
+ '--srcdir', '@CURRENT_SOURCE_DIR@',
+ '--parser', '@INPUT0@',
+ '--output', '@OUTPUT0@',
+ ],
+)
+generated_sources += preproc_y
+
+check_rules = custom_target('preproc.y.check_rules',
+ input: [
+ '../../../backend/parser/gram.y',
+ ecpg_files,
+ ],
+ output: 'preproc.y.check_rules',
+ command: [
+ perl, files('check_rules.pl'),
+ '--srcdir', '@CURRENT_SOURCE_DIR@',
+ '--parser', '@INPUT0@',
+ '--stamp', '@OUTPUT0@',
+ ],
+)
+
+preproc = custom_target('preproc.c',
+ input: preproc_y,
+ kwargs: bison_kw,
+)
+generated_sources += preproc.to_list()
+ecpg_sources += preproc
+
+c_kwlist = custom_target('c_kwlist_d.h',
+ input: ['c_kwlist.h'],
+ output: ['c_kwlist_d.h'],
+ command: [
+ perl,
+ '-I', '@SOURCE_ROOT@/src/tools',
+ '@SOURCE_ROOT@/src/tools/gen_keywordlist.pl',
+ '--output', '@OUTDIR@',
+ '--varname', 'ScanCKeywords',
+ '--no-case-fold', '@INPUT0@',
+ ],
+)
+generated_sources += c_kwlist
+ecpg_sources += c_kwlist
+
+ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
+ input: ['ecpg_kwlist.h'],
+ output: ['ecpg_kwlist_d.h'],
+ command: [
+ perl, '-I',
+ '@SOURCE_ROOT@/src/tools',
+ '@SOURCE_ROOT@/src/tools/gen_keywordlist.pl',
+ '--output', '@OUTDIR@',
+ '--varname', 'ScanECPGKeywords', '@INPUT0@',
+ ]
+)
+generated_sources += ecpg_kwlist
+ecpg_sources += ecpg_kwlist
+
+ecpg_exe = executable('ecpg',
+ ecpg_sources,
+ include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+ecpg_targets += ecpg_exe
+
+subdir('po', if_found: libintl)
diff --git a/src/interfaces/ecpg/preproc/po/meson.build b/src/interfaces/ecpg/preproc/po/meson.build
new file mode 100644
index 00000000000..d73b05afd5e
--- /dev/null
+++ b/src/interfaces/ecpg/preproc/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('ecpg-' + pg_version_major.to_string())
diff --git a/src/interfaces/ecpg/test/compat_informix/meson.build b/src/interfaces/ecpg/test/compat_informix/meson.build
new file mode 100644
index 00000000000..6bb0d980761
--- /dev/null
+++ b/src/interfaces/ecpg/test/compat_informix/meson.build
@@ -0,0 +1,31 @@
+pgc_files = [
+ 'charfuncs',
+ 'dec_test',
+ 'describe',
+ 'rfmtdate',
+ 'rfmtlong',
+ 'rnull',
+ 'sqlda',
+ 'test_informix',
+ 'test_informix2',
+]
+
+pgc_extra_flags = {
+ 'rnull': ['-r', 'no_indicator',],
+}
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ ['-C', 'INFORMIX',] +
+ pgc_extra_flags.get(pgc_file, []) +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/compat_oracle/meson.build b/src/interfaces/ecpg/test/compat_oracle/meson.build
new file mode 100644
index 00000000000..2e8794ba386
--- /dev/null
+++ b/src/interfaces/ecpg/test/compat_oracle/meson.build
@@ -0,0 +1,20 @@
+pgc_files = [
+ 'char_array',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ output: '@BASENAME@.c',
+ command: ecpg_preproc_test_command_start +
+ ['-C', 'ORACLE',] +
+ ecpg_preproc_test_command_end,
+ install: false,
+ build_by_default: false,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/connect/meson.build b/src/interfaces/ecpg/test/connect/meson.build
new file mode 100644
index 00000000000..0b1c3593146
--- /dev/null
+++ b/src/interfaces/ecpg/test/connect/meson.build
@@ -0,0 +1,20 @@
+pgc_files = [
+ 'test1',
+ 'test2',
+ 'test3',
+ 'test4',
+ 'test5',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start + ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
new file mode 100644
index 00000000000..bd2489f2bb1
--- /dev/null
+++ b/src/interfaces/ecpg/test/meson.build
@@ -0,0 +1,79 @@
+pg_regress_ecpg_sources = pg_regress_c + files(
+ 'pg_regress_ecpg.c',
+)
+
+pg_regress_ecpg = executable('pg_regress_ecpg',
+ pg_regress_ecpg_sources,
+ c_args: pg_regress_cflags,
+ include_directories: [pg_regress_inc, include_directories('.')],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args + {
+ 'install': false
+ },
+)
+testprep_targets += pg_regress_ecpg
+
+# create .c files and executables from .pgc files
+ecpg_test_exec_kw = {
+ 'dependencies': [frontend_code, libpq],
+ 'include_directories': [ecpg_inc],
+ 'link_with': [ecpglib, ecpg_compat, ecpg_pgtypes],
+ 'build_by_default': false,
+ 'install': false,
+}
+
+ecpg_preproc_kw = {
+ 'output': '@BASENAME@.c',
+ 'install': false,
+ 'build_by_default': false,
+}
+
+ecpg_preproc_test_command_start = [
+ ecpg_exe,
+ '--regression',
+ '-I@CURRENT_SOURCE_DIR@',
+ '-I@SOURCE_ROOT@' + '/src/interfaces/ecpg/include/',
+]
+ecpg_preproc_test_command_end = [
+ '-o', '@OUTPUT@', '@INPUT@'
+]
+
+ecpg_test_dependencies = []
+
+subdir('compat_informix')
+subdir('compat_oracle')
+subdir('connect')
+subdir('pgtypeslib')
+subdir('preproc')
+subdir('sql')
+subdir('thread')
+
+testprep_targets += ecpg_test_dependencies
+
+ecpg_test_files = files(
+ 'ecpg_schedule',
+)
+
+ecpg_regress_args = [
+ '--dbname=ecpg1_regression,ecpg2_regression',
+ '--create-role=regress_ecpg_user1,regress_ecpg_user2',
+ '--encoding=SQL_ASCII',
+]
+
+tests += {
+ 'name': 'ecpg',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'ecpg': {
+ 'expecteddir': meson.current_source_dir(),
+ 'inputdir': meson.current_build_dir(),
+ 'schedule': ecpg_test_files,
+ 'sql': [
+ 'sql/twophase',
+ ],
+ 'test_kwargs': {
+ 'depends': meson.is_cross_build() ? [] : ecpg_test_dependencies,
+ },
+ 'regress_args': ecpg_regress_args,
+ },
+}
diff --git a/src/interfaces/ecpg/test/pgtypeslib/meson.build b/src/interfaces/ecpg/test/pgtypeslib/meson.build
new file mode 100644
index 00000000000..2957f12abfc
--- /dev/null
+++ b/src/interfaces/ecpg/test/pgtypeslib/meson.build
@@ -0,0 +1,21 @@
+pgc_files = [
+ 'dt_test',
+ 'dt_test2',
+ 'num_test',
+ 'num_test2',
+ 'nan_test',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/preproc/meson.build b/src/interfaces/ecpg/test/preproc/meson.build
new file mode 100644
index 00000000000..0608df2f2a2
--- /dev/null
+++ b/src/interfaces/ecpg/test/preproc/meson.build
@@ -0,0 +1,37 @@
+pgc_files = [
+ 'array_of_struct',
+ 'autoprep',
+ 'comment',
+ 'cursor',
+ 'define',
+ 'init',
+ 'outofscope',
+ 'pointer_to_struct',
+ 'strings',
+ 'type',
+ 'variable',
+ 'whenever',
+ 'whenever_do_continue',
+]
+
+pgc_extra_flags = {
+ 'array_of_struct': ['-c'],
+ 'pointer_to_struct': ['-c'],
+ 'autoprep': ['-r', 'prepare'],
+ 'strings': ['-i'],
+}
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ pgc_extra_flags.get(pgc_file, []) +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/sql/meson.build b/src/interfaces/ecpg/test/sql/meson.build
new file mode 100644
index 00000000000..bec7d4ed8f6
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/meson.build
@@ -0,0 +1,46 @@
+pgc_files = [
+ 'array',
+ 'binary',
+ 'bytea',
+ 'code100',
+ 'copystdout',
+ 'createtableas',
+ 'declare',
+ 'define',
+ 'desc',
+ 'describe',
+ 'dynalloc',
+ 'dynalloc2',
+ 'dyntest',
+ 'execute',
+ 'fetch',
+ 'func',
+ 'indicators',
+ 'insupd',
+ 'oldexec',
+ 'parser',
+ 'prepareas',
+ 'quote',
+ 'show',
+ 'sqlda',
+ 'twophase',
+]
+
+pgc_extra_flags = {
+ 'oldexec': ['-r', 'questionmarks'],
+}
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ pgc_extra_flags.get(pgc_file, []) +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/thread/meson.build b/src/interfaces/ecpg/test/thread/meson.build
new file mode 100644
index 00000000000..2f1629e266b
--- /dev/null
+++ b/src/interfaces/ecpg/test/thread/meson.build
@@ -0,0 +1,21 @@
+pgc_files = [
+ 'thread_implicit',
+ 'thread',
+ 'prep',
+ 'descriptor',
+ 'alloc',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw + {'dependencies': [frontend_code, libpq, thread_dep,]},
+ )
+endforeach
diff --git a/src/interfaces/meson.build b/src/interfaces/meson.build
new file mode 100644
index 00000000000..73fffbee394
--- /dev/null
+++ b/src/interfaces/meson.build
@@ -0,0 +1,2 @@
+# NB: libpq is entered directly from the toplevel meson file
+subdir('ecpg')
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
new file mode 100644
index 00000000000..32b90f4f8c6
--- /dev/null
+++ b/doc/src/sgml/meson.build
@@ -0,0 +1,252 @@
+docs = []
+alldocs = []
+doc_generated = []
+
+xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
+
+
+version_sgml = configure_file(
+ input: 'version.sgml.in',
+ output: 'version.sgml',
+ configuration: cdata,
+)
+configure_files += version_sgml
+
+doc_generated += custom_target('features-supported.sgml',
+ input: files(
+ '../../../src/backend/catalog/sql_feature_packages.txt',
+ '../../../src/backend/catalog/sql_features.txt',
+ ),
+ output: 'features-supported.sgml',
+ command: [perl, files('mk_feature_tables.pl'), 'YES', '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+doc_generated += custom_target('features-unsupported.sgml',
+ input: files(
+ '../../../src/backend/catalog/sql_feature_packages.txt',
+ '../../../src/backend/catalog/sql_features.txt',
+ ),
+ output: 'features-unsupported.sgml',
+ command: [perl, files('mk_feature_tables.pl'), 'NO', '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+doc_generated += custom_target('errcodes-table.sgml',
+ input: files(
+ '../../../src/backend/utils/errcodes.txt'),
+ output: 'errcodes-table.sgml',
+ command: [perl, files('generate-errcodes-table.pl'), '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+# FIXME: this actually has further inputs, adding depfile support to
+# generate-keywords-table.pl is probably the best way to address that
+# robustly.
+doc_generated += custom_target('keywords-table.sgml',
+ input: files(
+ '../../../src/include/parser/kwlist.h'),
+ output: 'keywords-table.sgml',
+ command: [perl, files('generate-keywords-table.pl'), '@CURRENT_SOURCE_DIR@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+# For everything else we need at least xmllint
+if not xmllint.found()
+ subdir_done()
+endif
+
+pandoc = find_program('pandoc', native: true, required: false)
+xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
+fop = find_program('fop', native: true, required: false)
+
+# Compute validity just once
+# Run validation only once, common to all subsequent targets. While
+# we're at it, also resolve all entities (that is, copy all included
+# files into one big file). This helps tools that don't understand
+# vpath builds (such as dbtoepub).
+postgres_full_xml = custom_target('postgres-full.xml',
+ input: 'postgres.sgml',
+ output: 'postgres-full.xml',
+ command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
+ depends: doc_generated,
+ build_by_default: true,
+)
+
+#
+# Full documentation as html, text
+#
+if xsltproc.found()
+ xsltproc_flags = [
+ '--stringparam', 'pg.version', pg_version,
+ '--param', 'website.stylesheet', '1'
+ ]
+
+
+ # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
+ # depfile
+ html = custom_target('html',
+ input: ['stylesheet.xsl', postgres_full_xml],
+ output: 'html',
+ depends: doc_generated,
+ command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += html
+
+ # build multi-page html docs as part of docs target
+ docs += html
+
+ html_help = custom_target('html_help',
+ input: ['stylesheet-hh.xsl', postgres_full_xml],
+ output: 'htmlhelp',
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += html_help
+
+
+ # single-page HTML
+ postgres_html = custom_target('postgres.html',
+ input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
+ output: 'postgres.html',
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_html
+
+ # single-page text
+ if pandoc.found()
+ postgres_txt = custom_target('postgres.txt',
+ input: [postgres_html],
+ output: 'postgres.txt',
+ depends: doc_generated,
+ command: [pandoc, '-t', 'plain', '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_txt
+ endif
+endif
+
+
+#
+# INSTALL in html, text
+#
+if xsltproc.found()
+ install_xml = custom_target('INSTALL.xml',
+ input: ['standalone-profile.xsl', 'standalone-install.xml'],
+ output: 'INSTALL.xml',
+ depends: doc_generated + [postgres_full_xml],
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
+ build_by_default: false,
+ )
+ install_html = custom_target('INSTALL.html',
+ input: ['stylesheet-text.xsl', install_xml],
+ output: 'INSTALL.html',
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += install_html
+
+ if pandoc.found()
+ # XXX: Makefile does an iconv translit here, but unclear why?
+ install = custom_target('INSTALL',
+ input: [install_html],
+ output: 'INSTALL',
+ command: [pandoc, '-t', 'plain', '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += install
+ endif
+
+endif
+
+
+#
+# Man pages
+#
+if xsltproc.found()
+ # FIXME: implement / consider sqlmansectnum logic
+ man = custom_target('man',
+ input: ['stylesheet-man.xsl', postgres_full_xml],
+ output: ['man1', 'man3', 'man7'],
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+
+ # build by default as part of docs target
+ docs += man
+endif
+
+
+#
+# Full documentation as PDF
+#
+if fop.found() and xsltproc.found()
+ xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
+
+ foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
+ postgres_x_fo_f = 'postgres-@0@.fo'.format(format)
+ postgres_x_pdf_f = 'postgres-@0@.pdf'.format(format)
+
+ postgres_x_fo = custom_target(postgres_x_fo_f,
+ input: ['stylesheet-fo.xsl', postgres_full_xml],
+ output: [postgres_x_fo_f],
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
+ '--stringparam', 'paper.type', detail,
+ '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: false,
+ )
+
+ postgres_x_pdf = custom_target(postgres_x_pdf_f,
+ input: [postgres_x_fo],
+ output: [postgres_x_pdf_f],
+ command: [fop, '-fo', '@INPUT@', '-pdf', '@OUTPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_x_pdf
+ endforeach
+endif
+
+
+#
+# epub
+#
+
+# This was previously implemented using dbtoepub - but that doesn't seem to
+# support running in build != source directory (i.e. VPATH builds already
+# weren't supported).
+if pandoc.found() and xsltproc.found()
+ postgres_epub = custom_target('postgres.epub',
+ input: postgres_full_xml,
+ output: 'postgres.epub',
+ command: [pandoc, '-f', 'docbook', '-t', 'epub', '-o', '@OUTPUT@', '--resource-path=@CURRENT_SOURCE_DIR@',
+ '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_epub
+endif
+
+if docs.length() == 0
+ run_target('docs', command: [missing, 'xsltproc'])
+else
+ alias_target('docs', docs)
+endif
+
+if alldocs.length() == 0
+ run_target('alldocs', command: [missing, 'xsltproc'])
+else
+ alias_target('alldocs', alldocs)
+endif
diff --git a/doc/src/sgml/version.sgml.in b/doc/src/sgml/version.sgml.in
new file mode 100644
index 00000000000..fa5ff343f40
--- /dev/null
+++ b/doc/src/sgml/version.sgml.in
@@ -0,0 +1,2 @@
+<!ENTITY version @PG_VERSION@>
+<!ENTITY majorversion @PG_MAJORVERSION@>
diff --git a/src/test/authentication/meson.build b/src/test/authentication/meson.build
new file mode 100644
index 00000000000..2374028cbda
--- /dev/null
+++ b/src/test/authentication/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'authentication',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_password.pl',
+ 't/002_saslprep.pl',
+ ],
+ },
+}
diff --git a/src/test/icu/meson.build b/src/test/icu/meson.build
new file mode 100644
index 00000000000..5a4f53f37ff
--- /dev/null
+++ b/src/test/icu/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'icu',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_database.pl',
+ ],
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ },
+}
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
new file mode 100644
index 00000000000..c7656fd4609
--- /dev/null
+++ b/src/test/isolation/meson.build
@@ -0,0 +1,58 @@
+# pg_regress_c helpfully provided by regress/meson.build
+
+isolation_sources = pg_regress_c + files(
+ 'isolation_main.c',
+)
+
+isolationtester_sources = files(
+ 'isolationtester.c',
+)
+
+spec_scanner = custom_target('specscanner',
+ input: 'specscanner.l',
+ output: 'specscanner.c',
+ command: flex_cmd,
+)
+isolationtester_sources += spec_scanner
+generated_sources += spec_scanner
+
+spec_parser = custom_target('specparse',
+ input: 'specparse.y',
+ kwargs: bison_kw,
+)
+isolationtester_sources += spec_parser
+generated_sources += spec_parser.to_list()
+
+pg_isolation_regress = executable('pg_isolation_regress',
+ isolation_sources,
+ c_args: pg_regress_cflags,
+ include_directories: pg_regress_inc,
+ dependencies: frontend_code,
+ kwargs: default_bin_args + {
+ 'install_dir': dir_pgxs / 'src/test/isolation',
+ },
+)
+bin_targets += pg_isolation_regress
+
+isolationtester = executable('isolationtester',
+ isolationtester_sources,
+ include_directories: include_directories('.'),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install_dir': dir_pgxs / 'src/test/isolation',
+ },
+)
+bin_targets += isolationtester
+
+tests += {
+ 'name': 'main',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'schedule': files('isolation_schedule'),
+ 'test_kwargs': {
+ 'priority': 40,
+ 'timeout': 1000,
+ },
+ },
+}
diff --git a/src/test/kerberos/meson.build b/src/test/kerberos/meson.build
new file mode 100644
index 00000000000..7e2b6733fcc
--- /dev/null
+++ b/src/test/kerberos/meson.build
@@ -0,0 +1,15 @@
+tests += {
+ 'name': 'kerberos',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'test_kwargs': {'priority': 40}, # kerberos tests are slow, start early
+ 'tests': [
+ 't/001_auth.pl',
+ ],
+ 'env': {
+ 'with_gssapi': gssapi.found() ? 'yes' : 'no',
+ 'with_krb_srvnam': 'postgres',
+ },
+ },
+}
diff --git a/src/test/ldap/meson.build b/src/test/ldap/meson.build
new file mode 100644
index 00000000000..2211bd5e3ec
--- /dev/null
+++ b/src/test/ldap/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'ldap',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_auth.pl',
+ ],
+ 'env': {'with_ldap': ldap.found() ? 'yes' : 'no'},
+ },
+}
diff --git a/src/test/meson.build b/src/test/meson.build
new file mode 100644
index 00000000000..241d9d48aa5
--- /dev/null
+++ b/src/test/meson.build
@@ -0,0 +1,25 @@
+subdir('regress')
+subdir('isolation')
+
+subdir('authentication')
+subdir('recovery')
+subdir('subscription')
+subdir('modules')
+
+if ssl.found()
+ subdir('ssl')
+endif
+
+if ldap.found()
+ subdir('ldap')
+endif
+
+if gssapi.found()
+ subdir('kerberos')
+endif
+
+if icu.found()
+ subdir('icu')
+endif
+
+subdir('perl')
diff --git a/src/test/modules/brin/meson.build b/src/test/modules/brin/meson.build
new file mode 100644
index 00000000000..58254d093a4
--- /dev/null
+++ b/src/test/modules/brin/meson.build
@@ -0,0 +1,16 @@
+tests += {
+ 'name': 'brin',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'summarization-and-inprogress-insertion',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/01_workitems.pl',
+ 't/02_wal_consistency.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/commit_ts/meson.build b/src/test/modules/commit_ts/meson.build
new file mode 100644
index 00000000000..60cb12164d2
--- /dev/null
+++ b/src/test/modules/commit_ts/meson.build
@@ -0,0 +1,18 @@
+tests += {
+ 'name': 'commit_ts',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'commit_timestamp',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_base.pl',
+ 't/002_standby.pl',
+ 't/003_standby_2.pl',
+ 't/004_restart.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build
new file mode 100644
index 00000000000..cf4bdaba637
--- /dev/null
+++ b/src/test/modules/delay_execution/meson.build
@@ -0,0 +1,18 @@
+# FIXME: prevent install during main install, but not during test :/
+delay_execution = shared_module('delay_execution',
+ ['delay_execution.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += delay_execution
+
+tests += {
+ 'name': 'delay_execution',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'partition-addition',
+ 'partition-removal-1',
+ ],
+ },
+}
diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build
new file mode 100644
index 00000000000..56ff5f48001
--- /dev/null
+++ b/src/test/modules/dummy_index_am/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+dummy_index_am = shared_module('dummy_index_am',
+ ['dummy_index_am.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += dummy_index_am
+
+install_data(
+ 'dummy_index_am.control',
+ 'dummy_index_am--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dummy_index_am',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'reloptions',
+ ],
+ },
+}
diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build
new file mode 100644
index 00000000000..21b7cf8f353
--- /dev/null
+++ b/src/test/modules/dummy_seclabel/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+dummy_seclabel = shared_module('dummy_seclabel',
+ ['dummy_seclabel.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += dummy_seclabel
+
+install_data(
+ 'dummy_seclabel.control',
+ 'dummy_seclabel--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dummy_seclabel',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dummy_seclabel',
+ ],
+ },
+}
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
new file mode 100644
index 00000000000..8384b6e3b2a
--- /dev/null
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -0,0 +1,21 @@
+libpq_pipeline = executable('libpq_pipeline',
+ files(
+ 'libpq_pipeline.c',
+ ),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install': false,
+ },
+)
+testprep_targets += libpq_pipeline
+
+tests += {
+ 'name': 'libpq_pipeline',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_libpq_pipeline.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/meson.build b/src/test/modules/meson.build
new file mode 100644
index 00000000000..a80e6e2ce29
--- /dev/null
+++ b/src/test/modules/meson.build
@@ -0,0 +1,27 @@
+subdir('brin')
+subdir('commit_ts')
+subdir('delay_execution')
+subdir('dummy_index_am')
+subdir('dummy_seclabel')
+subdir('libpq_pipeline')
+subdir('plsample')
+subdir('snapshot_too_old')
+subdir('spgist_name_ops')
+subdir('ssl_passphrase_callback')
+subdir('test_bloomfilter')
+subdir('test_ddl_deparse')
+subdir('test_extensions')
+subdir('test_ginpostinglist')
+subdir('test_integerset')
+subdir('test_lfind')
+subdir('test_misc')
+subdir('test_oat_hooks')
+subdir('test_parser')
+subdir('test_pg_dump')
+subdir('test_predtest')
+subdir('test_rbtree')
+subdir('test_regex')
+subdir('test_rls_hooks')
+subdir('test_shm_mq')
+subdir('unsafe_tests')
+subdir('worker_spi')
diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build
new file mode 100644
index 00000000000..45de3f1990d
--- /dev/null
+++ b/src/test/modules/plsample/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+plsample = shared_module('plsample',
+ ['plsample.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += plsample
+
+install_data(
+ 'plsample.control',
+ 'plsample--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'plsample',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'plsample',
+ ],
+ },
+}
diff --git a/src/test/modules/snapshot_too_old/meson.build b/src/test/modules/snapshot_too_old/meson.build
new file mode 100644
index 00000000000..efd3f1f113b
--- /dev/null
+++ b/src/test/modules/snapshot_too_old/meson.build
@@ -0,0 +1,14 @@
+tests += {
+ 'name': 'snapshot_too_old',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'test_kwargs': {'priority': 40}, # sto tests are slow, start early
+ 'specs': [
+ 'sto_using_cursor',
+ 'sto_using_select',
+ 'sto_using_hash_index',
+ ],
+ 'regress_args': ['--temp-config', files('sto.conf')],
+ },
+}
diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build
new file mode 100644
index 00000000000..857fc7e140e
--- /dev/null
+++ b/src/test/modules/spgist_name_ops/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+spgist_name_ops = shared_module('spgist_name_ops',
+ ['spgist_name_ops.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += spgist_name_ops
+
+install_data(
+ 'spgist_name_ops.control',
+ 'spgist_name_ops--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'spgist_name_ops',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'spgist_name_ops',
+ ],
+ },
+}
diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build
new file mode 100644
index 00000000000..62d2c276513
--- /dev/null
+++ b/src/test/modules/ssl_passphrase_callback/meson.build
@@ -0,0 +1,48 @@
+if not ssl.found()
+ subdir_done()
+endif
+
+# FIXME: prevent install during main install, but not during test :/
+ssl_passphrase_callback = shared_module('ssl_passphrase_func',
+ ['ssl_passphrase_func.c'],
+ kwargs: pg_mod_args + {
+ 'dependencies': [ssl, pg_mod_args['dependencies']],
+ },
+)
+testprep_targets += ssl_passphrase_callback
+
+# Targets to generate or remove the ssl certificate and key. Need to be copied
+# to the source afterwards. Normally not needed.
+
+openssl = find_program('openssl', native: true, required: false)
+
+if openssl.found()
+ cert = custom_target('server.crt',
+ output: ['server.crt', 'server.ckey'],
+ command: [openssl, 'req', '-new', '-x509', '-days', '10000', '-nodes', '-out', '@OUTPUT0@',
+ '-keyout', '@OUTPUT1@', '-subj', '/CN=localhost'],
+ build_by_default: false,
+ install: false,
+ )
+
+ # needs to agree with what's in the test script
+ pass = 'FooBaR1'
+
+ enccert = custom_target('server.key',
+ input: [cert[1]],
+ output: ['server.key'],
+ command: [openssl, 'rsa', '-aes256', '-in', '@INPUT0@', '-out', '@OUTPUT0@', '-passout', 'pass:@0@'.format(pass)]
+ )
+endif
+
+tests += {
+ 'name': 'ssl_passphrase_callback',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_testfunc.pl',
+ ],
+ 'env': {'with_ssl': 'openssl'},
+ },
+}
diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build
new file mode 100644
index 00000000000..945eb5a70c4
--- /dev/null
+++ b/src/test/modules/test_bloomfilter/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_bloomfilter = shared_module('test_bloomfilter',
+ ['test_bloomfilter.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_bloomfilter
+
+install_data(
+ 'test_bloomfilter.control',
+ 'test_bloomfilter--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_bloomfilter',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_bloomfilter',
+ ],
+ },
+}
diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build
new file mode 100644
index 00000000000..81ad5adc526
--- /dev/null
+++ b/src/test/modules/test_ddl_deparse/meson.build
@@ -0,0 +1,43 @@
+# FIXME: prevent install during main install, but not during test :/
+test_ddl_deparse = shared_module('test_ddl_deparse',
+ ['test_ddl_deparse.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_ddl_deparse
+
+install_data(
+ 'test_ddl_deparse.control',
+ 'test_ddl_deparse--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_ddl_deparse',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_ddl_deparse',
+ 'create_extension',
+ 'create_schema',
+ 'create_type',
+ 'create_conversion',
+ 'create_domain',
+ 'create_sequence_1',
+ 'create_table',
+ 'create_transform',
+ 'alter_table',
+ 'create_view',
+ 'create_trigger',
+ 'create_rule',
+ 'comment_on',
+ 'alter_function',
+ 'alter_sequence',
+ 'alter_ts_config',
+ 'alter_type_enum',
+ 'opfamily',
+ 'defprivs',
+ 'matviews',
+ ],
+ },
+}
diff --git a/src/test/modules/test_extensions/meson.build b/src/test/modules/test_extensions/meson.build
new file mode 100644
index 00000000000..e95a9f2e7eb
--- /dev/null
+++ b/src/test/modules/test_extensions/meson.build
@@ -0,0 +1,45 @@
+# FIXME: prevent install during main install, but not during test :/
+install_data(
+ 'test_ext1--1.0.sql',
+ 'test_ext1.control',
+ 'test_ext2--1.0.sql',
+ 'test_ext2.control',
+ 'test_ext3--1.0.sql',
+ 'test_ext3.control',
+ 'test_ext4--1.0.sql',
+ 'test_ext4.control',
+ 'test_ext5--1.0.sql',
+ 'test_ext5.control',
+ 'test_ext6--1.0.sql',
+ 'test_ext6.control',
+ 'test_ext7--1.0--2.0.sql',
+ 'test_ext7--1.0.sql',
+ 'test_ext7.control',
+ 'test_ext8--1.0.sql',
+ 'test_ext8.control',
+ 'test_ext_cine--1.0.sql',
+ 'test_ext_cine--1.0--1.1.sql',
+ 'test_ext_cine.control',
+ 'test_ext_cor--1.0.sql',
+ 'test_ext_cor.control',
+ 'test_ext_cyclic1--1.0.sql',
+ 'test_ext_cyclic1.control',
+ 'test_ext_cyclic2--1.0.sql',
+ 'test_ext_cyclic2.control',
+ 'test_ext_evttrig--1.0--2.0.sql',
+ 'test_ext_evttrig--1.0.sql',
+ 'test_ext_evttrig.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_extensions',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_extensions',
+ 'test_extdepend',
+ ],
+ },
+}
diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build
new file mode 100644
index 00000000000..abf0a3b0430
--- /dev/null
+++ b/src/test/modules/test_ginpostinglist/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_ginpostinglist = shared_module('test_ginpostinglist',
+ ['test_ginpostinglist.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_ginpostinglist
+
+install_data(
+ 'test_ginpostinglist.control',
+ 'test_ginpostinglist--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_ginpostinglist',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_ginpostinglist',
+ ],
+ },
+}
diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build
new file mode 100644
index 00000000000..c32c469c69a
--- /dev/null
+++ b/src/test/modules/test_integerset/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_integerset = shared_module('test_integerset',
+ ['test_integerset.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_integerset
+
+install_data(
+ 'test_integerset.control',
+ 'test_integerset--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_integerset',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_integerset',
+ ],
+ },
+}
diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build
new file mode 100644
index 00000000000..a388de1156a
--- /dev/null
+++ b/src/test/modules/test_lfind/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_lfind = shared_module('test_lfind',
+ ['test_lfind.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_lfind
+
+install_data(
+ 'test_lfind.control',
+ 'test_lfind--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_lfind',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_lfind',
+ ],
+ },
+}
diff --git a/src/test/modules/test_misc/meson.build b/src/test/modules/test_misc/meson.build
new file mode 100644
index 00000000000..cfc830ff399
--- /dev/null
+++ b/src/test/modules/test_misc/meson.build
@@ -0,0 +1,12 @@
+tests += {
+ 'name': 'test_misc',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_constraint_validation.pl',
+ 't/002_tablespace.pl',
+ 't/003_check_guc.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
new file mode 100644
index 00000000000..5faf0459777
--- /dev/null
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -0,0 +1,18 @@
+# FIXME: prevent install during main install, but not during test :/
+test_oat_hooks = shared_module('test_oat_hooks',
+ ['test_oat_hooks.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_oat_hooks
+
+tests += {
+ 'name': 'test_oat_hooks',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_oat_hooks',
+ ],
+ 'regress_args': ['--no-locale', '--encoding=UTF8'],
+ },
+}
diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build
new file mode 100644
index 00000000000..b59960f615e
--- /dev/null
+++ b/src/test/modules/test_parser/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_parser = shared_module('test_parser',
+ ['test_parser.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_parser
+
+install_data(
+ 'test_parser.control',
+ 'test_parser--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_parser',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_parser',
+ ],
+ },
+}
diff --git a/src/test/modules/test_pg_dump/meson.build b/src/test/modules/test_pg_dump/meson.build
new file mode 100644
index 00000000000..41021829f3a
--- /dev/null
+++ b/src/test/modules/test_pg_dump/meson.build
@@ -0,0 +1,22 @@
+# FIXME: prevent install during main install, but not during test :/
+install_data(
+ 'test_pg_dump.control',
+ 'test_pg_dump--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_pg_dump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_pg_dump',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_base.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build
new file mode 100644
index 00000000000..1cfa84b3609
--- /dev/null
+++ b/src/test/modules/test_predtest/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_predtest = shared_module('test_predtest',
+ ['test_predtest.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_predtest
+
+install_data(
+ 'test_predtest.control',
+ 'test_predtest--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_predtest',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_predtest',
+ ],
+ },
+}
diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build
new file mode 100644
index 00000000000..34cbc3e1624
--- /dev/null
+++ b/src/test/modules/test_rbtree/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_rbtree = shared_module('test_rbtree',
+ ['test_rbtree.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_rbtree
+
+install_data(
+ 'test_rbtree.control',
+ 'test_rbtree--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_rbtree',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_rbtree',
+ ],
+ },
+}
diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build
new file mode 100644
index 00000000000..867a64e57c3
--- /dev/null
+++ b/src/test/modules/test_regex/meson.build
@@ -0,0 +1,24 @@
+# FIXME: prevent install during main install, but not during test :/
+test_regex = shared_module('test_regex',
+ ['test_regex.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_regex
+
+install_data(
+ 'test_regex.control',
+ 'test_regex--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_regex',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_regex',
+ 'test_regex_utf8',
+ ],
+ },
+}
diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build
new file mode 100644
index 00000000000..80d8adda332
--- /dev/null
+++ b/src/test/modules/test_rls_hooks/meson.build
@@ -0,0 +1,17 @@
+# FIXME: prevent install during main install, but not during test :/
+test_rls_hooks = shared_module('test_rls_hooks',
+ ['test_rls_hooks.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_rls_hooks
+
+tests += {
+ 'name': 'test_rls_hooks',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_rls_hooks',
+ ],
+ },
+}
diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build
new file mode 100644
index 00000000000..b663543d616
--- /dev/null
+++ b/src/test/modules/test_shm_mq/meson.build
@@ -0,0 +1,27 @@
+# FIXME: prevent install during main install, but not during test :/
+test_shm_mq = shared_module('test_shm_mq',
+ files(
+ 'setup.c',
+ 'test.c',
+ 'worker.c',
+ ),
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_shm_mq
+
+install_data(
+ 'test_shm_mq.control',
+ 'test_shm_mq--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_shm_mq',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_shm_mq',
+ ],
+ },
+}
diff --git a/src/test/modules/unsafe_tests/meson.build b/src/test/modules/unsafe_tests/meson.build
new file mode 100644
index 00000000000..d69b0e7ce44
--- /dev/null
+++ b/src/test/modules/unsafe_tests/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'unsafe_tests',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'rolenames',
+ 'alter_system_table',
+ ],
+ },
+}
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
new file mode 100644
index 00000000000..32acad883b2
--- /dev/null
+++ b/src/test/modules/worker_spi/meson.build
@@ -0,0 +1,26 @@
+# FIXME: prevent install during main install, but not during test :/
+test_worker_spi = shared_module('worker_spi',
+ files(
+ 'worker_spi.c',
+ ),
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_worker_spi
+
+install_data(
+ 'worker_spi.control',
+ 'worker_spi--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'worker_spi',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'worker_spi',
+ ],
+ 'regress_args': ['--temp-config', files('dynamic.conf'), '--dbname=contrib_regression'],
+ },
+}
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
new file mode 100644
index 00000000000..901bae7a564
--- /dev/null
+++ b/src/test/perl/meson.build
@@ -0,0 +1,12 @@
+# could use install_data's preserve_path option in >=0.64.0
+
+install_data(
+ 'PostgreSQL/Version.pm',
+ install_dir: dir_pgxs / 'src/test/perl/PostgreSQL')
+
+install_data(
+ 'PostgreSQL/Test/Utils.pm',
+ 'PostgreSQL/Test/SimpleTee.pm',
+ 'PostgreSQL/Test/RecursiveCopy.pm',
+ 'PostgreSQL/Test/Cluster.pm',
+ install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
diff --git a/src/test/recovery/meson.build b/src/test/recovery/meson.build
new file mode 100644
index 00000000000..b0e398363f7
--- /dev/null
+++ b/src/test/recovery/meson.build
@@ -0,0 +1,43 @@
+tests += {
+ 'name': 'recovery',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'test_kwargs': {'priority': 40}, # recovery tests are slow, start early
+ 'tests': [
+ 't/001_stream_rep.pl',
+ 't/002_archiving.pl',
+ 't/003_recovery_targets.pl',
+ 't/004_timeline_switch.pl',
+ 't/005_replay_delay.pl',
+ 't/006_logical_decoding.pl',
+ 't/007_sync_rep.pl',
+ 't/008_fsm_truncation.pl',
+ 't/009_twophase.pl',
+ 't/010_logical_decoding_timelines.pl',
+ 't/011_crash_recovery.pl',
+ 't/012_subtransactions.pl',
+ 't/013_crash_restart.pl',
+ 't/014_unlogged_reinit.pl',
+ 't/015_promotion_pages.pl',
+ 't/016_min_consistency.pl',
+ 't/017_shm.pl',
+ 't/018_wal_optimize.pl',
+ 't/019_replslot_limit.pl',
+ 't/020_archive_status.pl',
+ 't/021_row_visibility.pl',
+ 't/022_crash_temp_files.pl',
+ 't/023_pitr_prepared_xact.pl',
+ 't/024_archive_recovery.pl',
+ 't/025_stuck_on_old_timeline.pl',
+ 't/026_overwrite_contrecord.pl',
+ 't/027_stream_regress.pl',
+ 't/028_pitr_timelines.pl',
+ 't/029_stats_restart.pl',
+ 't/030_stats_cleanup_replica.pl',
+ 't/031_recovery_conflict.pl',
+ 't/032_relfilenode_reuse.pl',
+ 't/033_replay_tsp_drops.pl',
+ ],
+ },
+}
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
new file mode 100644
index 00000000000..fd8ee995b79
--- /dev/null
+++ b/src/test/regress/meson.build
@@ -0,0 +1,62 @@
+# also used by isolationtester and ecpg tests
+pg_regress_c = files('pg_regress.c')
+pg_regress_inc = include_directories('.')
+
+regress_sources = pg_regress_c + files(
+ 'pg_regress_main.c'
+)
+
+pg_regress_cflags = ['-DHOST_TUPLE="frak"', '-DSHELLPROG="/bin/sh"']
+
+pg_regress = executable('pg_regress',
+ regress_sources,
+ c_args: pg_regress_cflags,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args + {
+ 'install_dir': dir_pgxs / 'src/test/regress',
+ },
+)
+bin_targets += pg_regress
+
+regress_module = shared_module('regress',
+ ['regress.c'],
+ kwargs: pg_mod_args + {
+ 'install': false,
+ },
+)
+testprep_targets += regress_module
+
+# Get some extra C modules from contrib/spi but mark them as not to be
+# installed.
+# FIXME: avoid the duplication.
+
+autoinc_regress = shared_module('autoinc',
+ ['../../../contrib/spi/autoinc.c'],
+ kwargs: pg_mod_args + {
+ 'install': false,
+ },
+)
+testprep_targets += autoinc_regress
+
+refint_regress = shared_module('refint',
+ ['../../../contrib/spi/refint.c'],
+ c_args: refint_cflags,
+ kwargs: pg_mod_args + {
+ 'install': false,
+ },
+)
+testprep_targets += refint_regress
+
+
+tests += {
+ 'name': 'main',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'schedule': files('parallel_schedule'),
+ 'test_kwargs': {
+ 'priority': 50,
+ 'timeout': 1000,
+ },
+ },
+}
diff --git a/src/test/ssl/meson.build b/src/test/ssl/meson.build
new file mode 100644
index 00000000000..e2f021d884a
--- /dev/null
+++ b/src/test/ssl/meson.build
@@ -0,0 +1,13 @@
+tests += {
+ 'name': 'ssl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_ssl': get_option('ssl')},
+ 'tests': [
+ 't/001_ssltests.pl',
+ 't/002_scram.pl',
+ 't/003_sslinfo.pl',
+ ],
+ },
+}
diff --git a/src/test/subscription/meson.build b/src/test/subscription/meson.build
new file mode 100644
index 00000000000..85d1dd92951
--- /dev/null
+++ b/src/test/subscription/meson.build
@@ -0,0 +1,42 @@
+tests += {
+ 'name': 'subscription',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_rep_changes.pl',
+ 't/002_types.pl',
+ 't/003_constraints.pl',
+ 't/004_sync.pl',
+ 't/005_encoding.pl',
+ 't/006_rewrite.pl',
+ 't/007_ddl.pl',
+ 't/008_diff_schema.pl',
+ 't/009_matviews.pl',
+ 't/010_truncate.pl',
+ 't/011_generated.pl',
+ 't/012_collation.pl',
+ 't/013_partition.pl',
+ 't/014_binary.pl',
+ 't/015_stream.pl',
+ 't/016_stream_subxact.pl',
+ 't/017_stream_ddl.pl',
+ 't/018_stream_subxact_abort.pl',
+ 't/019_stream_subxact_ddl_abort.pl',
+ 't/020_messages.pl',
+ 't/021_twophase.pl',
+ 't/022_twophase_cascade.pl',
+ 't/023_twophase_stream.pl',
+ 't/024_add_drop_pub.pl',
+ 't/025_rep_changes_for_schema.pl',
+ 't/026_stats.pl',
+ 't/027_nosuperuser.pl',
+ 't/028_row_filter.pl',
+ 't/029_on_error.pl',
+ 't/030_origin.pl',
+ 't/031_column_list.pl',
+ 't/100_bugs.pl',
+ ],
+ },
+}
diff --git a/configure b/configure
index aee8a0d3579..d509c264a0b 100755
--- a/configure
+++ b/configure
@@ -20651,3 +20651,9 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Ensure that any meson build directories would reconfigure and see that
+# there's a conflicting in-tree build and can error out.
+if test "$vpath_build"="no"; then
+ touch meson.build
+fi
diff --git a/configure.ac b/configure.ac
index 33634ccad9d..b2a93b259f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2467,3 +2467,9 @@ AC_CONFIG_HEADERS([src/interfaces/ecpg/include/ecpg_config.h],
[echo >src/interfaces/ecpg/include/stamp-h])
AC_OUTPUT
+
+# Ensure that any meson build directories would reconfigure and see that
+# there's a conflicting in-tree build and can error out.
+if test "$vpath_build"="no"; then
+ touch meson.build
+fi
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..d5411831e82
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,3027 @@
+# Entry point for building PostgreSQL with meson
+#
+# Good starting points for writing meson.build files are:
+# - https://mesonbuild.com/Syntax.html
+# - https://mesonbuild.com/Reference-manual.html
+
+project('postgresql',
+ ['c'],
+ version: '16devel',
+ license: 'PostgreSQL',
+
+ # We want < 0.56 for python 3.5 compatibility on old platforms. EPEL for
+ # RHEL 7 has 0.55. < 0.54 would require replacing some uses of the fs
+ # module, < 0.53 all uses of fs. So far there's no need to go to >=0.56.
+ meson_version: '>=0.54',
+ default_options: [
+ 'warning_level=1', #-Wall equivalent
+ 'buildtype=release',
+ ]
+)
+
+
+
+###############################################################
+# Basic prep
+###############################################################
+
+fs = import('fs')
+pkgconfig = import('pkgconfig')
+
+host_system = host_machine.system()
+host_cpu = host_machine.cpu_family()
+
+cc = meson.get_compiler('c')
+
+not_found_dep = dependency('', required: false)
+thread_dep = dependency('threads')
+
+
+
+###############################################################
+# Safety first
+###############################################################
+
+# It's very easy to get into confusing states when the source directory
+# contains an in-place build. E.g. the wrong pg_config.h will be used. So just
+# refuse to build in that case.
+#
+# There's a more elaborate check later, that checks for conflicts around all
+# generated files. But we can only do that much further down the line, so this
+# quick check seems worth it. Adhering to this advice should clean up the
+# conflict, but won't protect against somebody doing make distclean or just
+# removing pg_config.h
+errmsg_nonclean_base = '''
+****
+Non-clean source code directory detected.
+
+To build with meson the source tree may not have an in-place, ./configure
+style, build configured. You can have both meson and ./configure style builds
+for the same source tree by building out-of-source / VPATH with
+configure. Alternatively use a separate check out for meson based builds.
+
+@0@
+****'''
+if fs.exists(meson.current_source_dir() / 'src' / 'include' / 'pg_config.h')
+ errmsg_cleanup = 'To clean up, run make maintainer-clean in the source tree.'
+ error(errmsg_nonclean_base.format(errmsg_cleanup))
+endif
+
+
+
+###############################################################
+# Variables to be determined
+###############################################################
+
+postgres_inc_d = ['src/include']
+postgres_inc_d += get_option('extra_include_dirs')
+
+postgres_lib_d = get_option('extra_lib_dirs')
+
+cppflags = []
+
+cflags = []
+cxxflags = []
+cflags_warn = []
+cxxflags_warn = []
+cflags_mod = []
+cxxflags_mod = []
+
+ldflags = []
+ldflags_be = []
+ldflags_sl = []
+ldflags_mod = []
+
+test_c_args = []
+
+os_deps = []
+backend_both_deps = []
+backend_deps = []
+libpq_deps = []
+
+pg_sysroot = ''
+
+# source of data for pg_config.h etc
+cdata = configuration_data()
+
+
+
+###############################################################
+# Version and other metadata
+###############################################################
+
+pg_version = meson.project_version()
+
+if pg_version.endswith('devel')
+ pg_version_arr = [pg_version.split('devel')[0], '0']
+elif pg_version.contains('beta')
+ pg_version_arr = [pg_version.split('beta')[0], '0']
+elif pg_version.contains('rc')
+ pg_version_arr = [pg_version.split('rc')[0], '0']
+else
+ pg_version_arr = pg_version.split('.')
+endif
+
+pg_version_major = pg_version_arr[0].to_int()
+pg_version_minor = pg_version_arr[1].to_int()
+pg_version_num = (pg_version_major * 10000) + pg_version_minor
+
+pg_url = 'https://www.postgresql.org/'
+
+cdata.set_quoted('PACKAGE_NAME', 'PostgreSQL')
+cdata.set_quoted('PACKAGE_BUGREPORT', 'pgsql-bugs@lists.postgresql.org')
+cdata.set_quoted('PACKAGE_URL', pg_url)
+cdata.set_quoted('PACKAGE_VERSION', pg_version)
+cdata.set_quoted('PACKAGE_STRING', 'PostgreSQL @0@'.format(pg_version))
+cdata.set_quoted('PACKAGE_TARNAME', 'postgresql')
+
+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, build_machine.cpu_family(), cc.get_id(), cc.version()))
+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)
+cdata.set_quoted('CONFIGURE_ARGS', '')
+
+
+
+###############################################################
+# Basic platform specific configuration
+###############################################################
+
+# meson's system names don't quite map to our "traditional" names. In some
+# places we need the "traditional" name, e.g., for mapping
+# src/include/port/$os.h to src/include/pg_config_os.h. Define portname for
+# that purpose.
+portname = host_system
+
+exesuffix = '' # overridden below where necessary
+dlsuffix = '.so' # overridden below where necessary
+library_path_var = 'LD_LIBRARY_PATH'
+
+# Format of file to control exports from libraries, and how to pass them to
+# the compiler. For export_fmt @0@ is the path to the file export file.
+export_file_format = 'gnu'
+export_file_suffix = 'list'
+export_fmt = '-Wl,--version-script=@0@'
+
+# Flags to add when linking a postgres extension, @0@ is path to
+# the relevant object on the platform.
+mod_link_args_fmt = []
+
+memset_loop_limit = 1024
+
+# Choice of shared memory and semaphore implementation
+shmem_kind = 'sysv'
+sema_kind = 'sysv'
+
+# We implement support for some operating systems by pretending they're
+# another. Map here, before determining system properties below
+if host_system == 'dragonfly'
+ # apparently the most similar
+ host_system = 'netbsd'
+endif
+
+if host_system == 'aix'
+ ld_library_path_var = 'LIBPATH'
+
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@0@.imp'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # Native memset() is faster, tested on:
+ # - AIX 5.1 and 5.2, XLC 6.0 (IBM's cc)
+ # - AIX 5.3 ML3, gcc 4.0.1
+ memset_loop_limit = 0
+
+elif host_system == 'cygwin'
+ cppflags += '-D_GNU_SOURCE'
+
+elif host_system == 'darwin'
+ dlsuffix = '.dylib'
+ ld_library_path_var = 'DYLD_LIBRARY_PATH'
+
+ export_file_format = 'darwin'
+ export_fmt = '-exported_symbols_list=@0@'
+
+ mod_link_args_fmt = ['-bundle_loader', '@0@']
+ mod_link_with_dir = 'bindir'
+ mod_link_with_name = '@0@'
+
+ sysroot_args = [files('src/tools/darwin_sysroot'), get_option('darwin_sysroot')]
+ pg_sysroot = run_command(sysroot_args, check:true).stdout().strip()
+ message('darwin sysroot: @0@'.format(pg_sysroot))
+ cflags += ['-isysroot', pg_sysroot]
+ ldflags += ['-isysroot', pg_sysroot]
+
+elif host_system == 'freebsd'
+ sema_kind = 'unnamed_posix'
+
+elif host_system == 'linux'
+ sema_kind = 'unnamed_posix'
+ cppflags += '-D_GNU_SOURCE'
+
+elif host_system == 'netbsd'
+ # We must resolve all dynamic linking in the core server at program start.
+ # Otherwise the postmaster can self-deadlock due to signals interrupting
+ # resolution of calls, since NetBSD's linker takes a lock while doing that
+ # and some postmaster signal handlers do things that will also acquire that
+ # lock. As long as we need "-z now", might as well specify "-z relro" too.
+ # While there's not a hard reason to adopt these settings for our other
+ # executables, there's also little reason not to, so just add them to
+ # LDFLAGS.
+ ldflags += ['-Wl,-z,now', '-Wl,-z,relro']
+
+elif host_system == 'openbsd'
+ # you're ok
+
+elif host_system == 'sunos'
+ portname = 'solaris'
+ export_fmt = '-Wl,-M@0@'
+ cppflags += '-D_POSIX_PTHREAD_SEMANTICS'
+
+elif host_system == 'windows'
+ portname = 'win32'
+ exesuffix = '.exe'
+ dlsuffix = '.dll'
+ ld_library_path_var = ''
+
+ export_file_format = 'win'
+ export_file_suffix = 'def'
+ if cc.get_id() == 'msvc'
+ export_fmt = '/DEF:@0@'
+ mod_link_with_name = '@0@.exe.lib'
+ else
+ export_fmt = '@0@'
+ mod_link_with_name = 'lib@0@.exe.a'
+ endif
+ mod_link_args_fmt = ['@0@']
+ mod_link_with_dir = 'libdir'
+
+ shmem_kind = 'win32'
+ sema_kind = 'win32'
+
+ cdata.set('WIN32_STACK_RLIMIT', 4194304)
+ if cc.get_id() == 'msvc'
+ ldflags += '/INCREMENTAL:NO'
+ ldflags += '/STACK:@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))
+ # ldflags += '/nxcompat' # generated by msbuild, should have it for ninja?
+ else
+ ldflags += '-Wl,--stack,@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))
+ endif
+
+ os_deps += cc.find_library('ws2_32', required: true)
+ secur32_dep = cc.find_library('secur32', required: true)
+ backend_deps += secur32_dep
+ libpq_deps += secur32_dep
+
+ postgres_inc_d += 'src/include/port/win32'
+ if cc.get_id() == 'msvc'
+ postgres_inc_d += 'src/include/port/win32_msvc'
+ endif
+
+ windows = import('windows')
+
+else
+ # XXX: Should we add an option to override the host_system as an escape
+ # hatch?
+ error('unknown host system: @0@'.format(host_system))
+endif
+
+
+
+###############################################################
+# Program paths
+###############################################################
+
+# External programs
+perl = find_program(get_option('PERL'), required: true, native: true)
+python = find_program(get_option('PYTHON'), required: true, native: true)
+flex = find_program(get_option('FLEX'), native: true, version: '>= 2.5.31')
+bison = find_program(get_option('BISON'), native: true, version: '>= 1.875')
+sed = find_program(get_option('SED'), 'sed', native: true)
+prove = find_program(get_option('PROVE'), native: true)
+tar = find_program(get_option('TAR'), native: true)
+gzip = find_program(get_option('GZIP'), native: true)
+program_lz4 = find_program(get_option('LZ4'), native: true, required: false)
+touch = find_program('touch', native: true)
+program_zstd = find_program(get_option('ZSTD'), native: true, required: false)
+dtrace = find_program(get_option('DTRACE'), native: true, required: get_option('dtrace'))
+missing = find_program('config/missing', native: true)
+
+# used by PGXS
+install_sh = find_program('config/install-sh', native: true)
+
+bison_flags = []
+if bison.found()
+ bison_version_c = run_command(bison, '--version', check: true)
+ # bison version string helpfully is something like
+ # >>bison (GNU bison) 3.8.1<<
+ bison_version = bison_version_c.stdout().split(' ')[3].split('\n')[0]
+ if bison_version.version_compare('>=3.0')
+ bison_flags += ['-Wno-deprecated']
+ endif
+endif
+bison_cmd = [bison, bison_flags, '-o', '@OUTPUT0@', '-d', '@INPUT@']
+bison_kw = {
+ 'output': ['@BASENAME@.c', '@BASENAME@.h'],
+ 'command': bison_cmd,
+}
+
+flex_flags = []
+flex_wrapper = files('src/tools/pgflex')
+flex_cmd = [python, flex_wrapper,
+ '--builddir', '@BUILD_ROOT@',
+ '--srcdir', '@SOURCE_ROOT@',
+ '--privatedir', '@PRIVATE_DIR@',
+ '--flex', flex, '--perl', perl,
+ '-i', '@INPUT@', '-o', '@OUTPUT0@',
+]
+
+wget = find_program('wget', required: false, native: true)
+wget_flags = ['-O', '@OUTPUT0@', '--no-use-server-timestamps']
+
+
+
+###############################################################
+# Path to meson (for tests etc)
+###############################################################
+
+# NB: this should really be part of meson, see
+# 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() == ''
+ error('huh, could not run find_meson.\nerrcode: @0@\nstdout: @1@\nstderr: @2@'.format(
+ meson_binpath_r.returncode(),
+ meson_binpath_r.stdout(),
+ meson_binpath_r.stderr()))
+endif
+
+meson_binpath_s = meson_binpath_r.stdout().split('\n')
+meson_binpath_len = meson_binpath_s.length()
+
+if meson_binpath_len < 1
+ error('unexpected introspect line @0@'.format(meson_binpath_r.stdout()))
+endif
+
+i = 0
+meson_impl = ''
+meson_binpath = ''
+meson_args = []
+foreach e : meson_binpath_s
+ if i == 0
+ meson_impl = e
+ elif i == 1
+ meson_binpath = e
+ else
+ meson_args += e
+ endif
+ i += 1
+endforeach
+
+if meson_impl not in ['muon', 'meson']
+ error('unknown meson implementation "@0@"'.format(meson_impl))
+endif
+
+meson_bin = find_program(meson_binpath, native: true)
+
+
+
+###############################################################
+# Option Handling
+###############################################################
+
+cdata.set('USE_ASSERT_CHECKING', get_option('cassert') ? 1 : false)
+
+cdata.set('BLCKSZ', get_option('blocksize').to_int() * 1024, description:
+'''Size of a disk block --- this also limits the size of a tuple. You can set
+ it bigger if you need bigger tuples (although TOAST should reduce the need
+ to have large tuples, since fields can be spread across multiple tuples).
+ BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is
+ currently 2^15 (32768). This is determined by the 15-bit widths of the
+ lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h).
+ Changing BLCKSZ requires an initdb.''')
+
+cdata.set('XLOG_BLCKSZ', get_option('wal_blocksize').to_int() * 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').to_string())
+cdata.set_quoted('PG_KRB_SRVNAM', get_option('krb_srvnam'))
+if get_option('system_tzdata') != ''
+ cdata.set_quoted('SYSTEMTZDIR', get_option('system_tzdata'))
+endif
+
+
+
+###############################################################
+# Directories
+###############################################################
+
+# These are set by the equivalent --xxxdir configure options. We
+# append "postgresql" to some of them, if the string does not already
+# contain "pgsql" or "postgres", in order to avoid directory clutter.
+
+pkg = 'postgresql'
+
+dir_prefix = get_option('prefix')
+
+dir_bin = get_option('bindir')
+
+dir_data = get_option('datadir')
+if not (dir_data.contains('pgsql') or dir_data.contains('postgres'))
+ dir_data = dir_data / pkg
+endif
+
+dir_sysconf = get_option('sysconfdir')
+if not (dir_sysconf.contains('pgsql') or dir_sysconf.contains('postgres'))
+ dir_sysconf = dir_sysconf / pkg
+endif
+
+dir_lib = get_option('libdir')
+
+dir_lib_pkg = dir_lib
+if not (dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
+ dir_lib_pkg = dir_lib_pkg / pkg
+endif
+
+dir_pgxs = dir_lib_pkg / 'pgxs'
+
+dir_include = get_option('includedir')
+
+dir_include_pkg = dir_include
+dir_include_pkg_rel = ''
+if not (dir_include_pkg.contains('pgsql') or dir_include_pkg.contains('postgres'))
+ dir_include_pkg = dir_include_pkg / pkg
+ dir_include_pkg_rel = pkg
+endif
+
+dir_man = get_option('mandir')
+
+# FIXME: These used to be separately configurable - worth adding?
+dir_doc = get_option('datadir') / 'doc' / 'postgresql'
+dir_doc_html = dir_doc
+
+dir_locale = get_option('localedir')
+
+
+# Derived values
+dir_bitcode = dir_lib_pkg / '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'
+
+
+
+###############################################################
+# Search paths, preparation for compiler tests
+#
+# NB: Arguments added later are not automatically used for subsequent
+# configuration-time checks (so they are more isolated). If they should be
+# used, they need to be added to test_c_args as well.
+###############################################################
+
+postgres_inc = [include_directories(postgres_inc_d)]
+test_lib_d = postgres_lib_d
+test_c_args = cppflags + cflags
+
+
+
+###############################################################
+# Library: bsd-auth
+###############################################################
+
+bsd_authopt = get_option('bsd_auth')
+bsd_auth = not_found_dep
+if cc.check_header('bsd_auth.h', required: bsd_authopt,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('USE_BSD_AUTH', 1)
+ bsd_auth = declare_dependency()
+endif
+
+
+
+###############################################################
+# Library: bonjour
+#
+# For now don't search for DNSServiceRegister in a library - only Apple's
+# Bonjour implementation, which is always linked, works.
+###############################################################
+
+bonjouropt = get_option('bonjour')
+bonjour = dependency('', required : false)
+if cc.check_header('dns_sd.h', required: bonjouropt,
+ args: test_c_args, include_directories: postgres_inc) and \
+ cc.has_function('DNSServiceRegister',
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('USE_BONJOUR', 1)
+ bonjour = declare_dependency()
+endif
+
+
+
+###############################################################
+# Library: GSSAPI
+###############################################################
+
+gssapiopt = get_option('gssapi')
+krb_srvtab = ''
+have_gssapi = false
+if not gssapiopt.disabled()
+ gssapi = dependency('krb5-gssapi', required: gssapiopt)
+ have_gssapi = gssapi.found()
+
+ if not have_gssapi
+ elif cc.check_header('gssapi/gssapi.h', dependencies: gssapi, required: false,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_GSSAPI_GSSAPI_H', 1)
+ elif cc.check_header('gssapi.h', args: test_c_args, dependencies: gssapi, required: gssapiopt)
+ cdata.set('HAVE_GSSAPI_H', 1)
+ else
+ have_gssapi = false
+ endif
+
+ if not have_gssapi
+ elif cc.has_function('gss_init_sec_context', dependencies: gssapi,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('ENABLE_GSS', 1)
+
+ krb_srvtab = 'FILE:/@0@/krb5.keytab)'.format(get_option('sysconfdir'))
+ cdata.set_quoted('PG_KRB_SRVTAB', krb_srvtab)
+ elif gssapiopt.enabled()
+ error('''could not find function 'gss_init_sec_context' required for GSSAPI''')
+ else
+ have_gssapi = false
+ endif
+endif
+if not have_gssapi
+ gssapi = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: ldap
+###############################################################
+
+ldapopt = get_option('ldap')
+if host_system == 'windows'
+ ldap = cc.find_library('wldap32', required: ldapopt)
+ ldap_r = ldap
+else
+ # macos framework dependency is buggy for ldap (one can argue whether it's
+ # Apple's or meson's fault), leading to an endless recursion with ldap.h
+ # including itself. See https://github.com/mesonbuild/meson/issues/10002
+ # Luckily we only need pkg-config support, so the workaround isn't
+ # complicated.
+ ldap = dependency('ldap', method: 'pkg-config', required: false)
+ ldap_r = ldap
+
+ # Before 2.5 openldap didn't have a pkg-config file, and it might not be
+ # installed
+ if not ldap.found()
+ ldap = cc.find_library('ldap', required: ldapopt, dirs: test_lib_d,
+ has_headers: 'ldap.h', header_include_directories: postgres_inc)
+
+ # The separate ldap_r library only exists in OpenLDAP < 2.5, and if we
+ # have 2.5 or later, we shouldn't even probe for ldap_r (we might find a
+ # library from a separate OpenLDAP installation). The most reliable
+ # way to check that is to check for a function introduced in 2.5.
+ if not ldap.found()
+ # don't have ldap, we shouldn't check for ldap_r
+ elif cc.has_function('ldap_verify_credentials',
+ dependencies: ldap, args: test_c_args)
+ ldap_r = ldap # ldap >= 2.5, no need for ldap_r
+ else
+
+ # Use ldap_r for FE if available, else assume ldap is thread-safe.
+ ldap_r = cc.find_library('ldap_r', required: false, dirs: test_lib_d,
+ has_headers: 'ldap.h', header_include_directories: postgres_inc)
+ if not ldap_r.found()
+ ldap_r = ldap
+ else
+ # On some platforms ldap_r fails to link without PTHREAD_LIBS.
+ ldap_r = declare_dependency(dependencies: [ldap_r, thread_dep])
+ endif
+
+ # PostgreSQL sometimes loads libldap_r and plain libldap into the same
+ # process. Check for OpenLDAP versions known not to tolerate doing so;
+ # assume non-OpenLDAP implementations are safe. The dblink test suite
+ # exercises the hazardous interaction directly.
+ compat_test_code = '''
+#include <ldap.h>
+#if !defined(LDAP_VENDOR_VERSION) || \
+ (defined(LDAP_API_FEATURE_X_OPENLDAP) && \
+ LDAP_VENDOR_VERSION >= 20424 && LDAP_VENDOR_VERSION <= 20431)
+choke me
+#endif
+'''
+ if not cc.compiles(compat_test_code,
+ name: 'LDAP implementation compatible',
+ dependencies: ldap, args: test_c_args)
+ warning('''
+*** With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, each backend
+*** process that loads libpq (via WAL receiver, dblink, or postgres_fdw) and
+*** also uses LDAP will crash on exit.''')
+ endif
+ 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)
+ endif
+endif
+
+if ldap.found()
+ assert(ldap_r.found())
+ cdata.set('USE_LDAP', 1)
+else
+ assert(not ldap_r.found())
+endif
+
+
+
+###############################################################
+# Library: LLVM
+###############################################################
+
+llvmopt = get_option('llvm')
+if not llvmopt.disabled()
+ add_languages('cpp', required: true, native: false)
+ llvm = dependency('llvm', version: '>=3.9', method: 'config-tool', required: llvmopt)
+
+ if llvm.found()
+
+ cdata.set('USE_LLVM', 1)
+
+ cpp = meson.get_compiler('cpp')
+
+ llvm_binpath = llvm.get_variable(configtool: 'bindir')
+
+ ccache = find_program('ccache', native: true, required: false)
+ clang = find_program(llvm_binpath / 'clang', required: true)
+ endif
+else
+ llvm = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: icu
+###############################################################
+
+icuopt = get_option('icu')
+if not icuopt.disabled()
+ icu = dependency('icu-uc', required: icuopt.enabled())
+ icu_i18n = dependency('icu-i18n', required: icuopt.enabled())
+
+ if icu.found()
+ cdata.set('USE_ICU', 1)
+ endif
+
+else
+ icu = not_found_dep
+ icu_i18n = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: libxml
+###############################################################
+
+libxmlopt = get_option('libxml')
+if not libxmlopt.disabled()
+ libxml = dependency('libxml-2.0', required: libxmlopt, version: '>= 2.6.23')
+
+ if libxml.found()
+ cdata.set('USE_LIBXML', 1)
+ endif
+else
+ libxml = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: libxslt
+###############################################################
+
+libxsltopt = get_option('libxslt')
+if not libxsltopt.disabled()
+ libxslt = dependency('libxslt', required: libxsltopt)
+
+ if libxslt.found()
+ cdata.set('USE_LIBXSLT', 1)
+ endif
+else
+ libxslt = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: lz4
+###############################################################
+
+lz4opt = get_option('lz4')
+if not lz4opt.disabled()
+ lz4 = dependency('liblz4', required: lz4opt)
+
+ if lz4.found()
+ cdata.set('USE_LZ4', 1)
+ cdata.set('HAVE_LIBLZ4', 1)
+ endif
+
+else
+ lz4 = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: Tcl (for pltcl)
+#
+# NB: tclConfig.sh is used in autoconf build for getting
+# TCL_SHARED_BUILD, TCL_INCLUDE_SPEC, TCL_LIBS and TCL_LIB_SPEC
+# variables. For now we have not seen a need to copy
+# that behaviour to the meson build.
+###############################################################
+
+tclopt = get_option('pltcl')
+tcl_version = get_option('tcl_version')
+tcl_dep = not_found_dep
+if not tclopt.disabled()
+
+ # via pkg-config
+ tcl_dep = dependency(tcl_version, required: false)
+
+ if not tcl_dep.found()
+ tcl_dep = cc.find_library(tcl_version,
+ required: tclopt,
+ dirs: test_lib_d)
+ endif
+
+ if not cc.has_header('tcl.h', dependencies: tcl_dep, required: tclopt)
+ tcl_dep = not_found_dep
+ endif
+endif
+
+
+
+###############################################################
+# Library: pam
+###############################################################
+
+pamopt = get_option('pam')
+if not pamopt.disabled()
+ pam = dependency('pam', required: false)
+
+ if not pam.found()
+ pam = cc.find_library('pam', required: pamopt, dirs: test_lib_d)
+ endif
+
+ if pam.found()
+ pam_header_found = false
+
+ # header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.
+ if cc.check_header('security/pam_appl.h', dependencies: pam, required: false,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_SECURITY_PAM_APPL_H', 1)
+ pam_header_found = true
+ elif cc.check_header('pam/pam_appl.h', dependencies: pam, required: pamopt,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_PAM_PAM_APPL_H', 1)
+ pam_header_found = true
+ endif
+
+ if pam_header_found
+ cdata.set('USE_PAM', 1)
+ else
+ pam = not_found_dep
+ endif
+ endif
+else
+ pam = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: Perl (for plperl)
+###############################################################
+
+perlopt = get_option('plperl')
+perl_dep = not_found_dep
+if not perlopt.disabled()
+ perl_may_work = true
+
+ # First verify that perl has the necessary dependencies installed
+ perl_mods = run_command(
+ [perl,
+ '-MConfig', '-MOpcode', '-MExtUtils::Embed', '-MExtUtils::ParseXS',
+ '-e', ''],
+ check: false)
+ if perl_mods.returncode() != 0
+ perl_may_work = false
+ perl_msg = 'perl installation does not have the required modules'
+ endif
+
+ # Then inquire perl about its configuration
+ if perl_may_work
+ perl_conf_cmd = [perl, '-MConfig', '-e', 'print $Config{$ARGV[0]}']
+ perlversion = run_command(perl_conf_cmd, 'api_versionstring', check: true).stdout()
+ archlibexp = run_command(perl_conf_cmd, 'archlibexp', check: true).stdout()
+ privlibexp = run_command(perl_conf_cmd, 'privlibexp', check: true).stdout()
+ useshrplib = run_command(perl_conf_cmd, 'useshrplib', check: true).stdout()
+
+ perl_inc_dir = '@0@/CORE'.format(archlibexp)
+
+ if useshrplib != 'true'
+ perl_may_work = false
+ perl_msg = 'need a shared perl'
+ endif
+ endif
+
+ if perl_may_work
+ # 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(pg_sysroot, perl_inc_dir))
+ perl_ccflags = ['-iwithsysroot', perl_inc_dir]
+ endif
+
+ # check compiler finds header
+ if not cc.has_header('perl.h', required: false,
+ args: test_c_args + perl_ccflags, include_directories: postgres_inc)
+ perl_may_work = false
+ perl_msg = 'missing perl.h'
+ endif
+ endif
+
+ if perl_may_work
+ perl_ccflags_r = run_command(perl_conf_cmd, 'ccflags', check: true).stdout()
+
+ # See comments for PGAC_CHECK_PERL_EMBED_CCFLAGS in perl.m4
+ foreach flag : perl_ccflags_r.split(' ')
+ if flag.startswith('-D') and \
+ (not flag.startswith('-D_') or flag == '_USE_32BIT_TIME_T')
+ perl_ccflags += flag
+ endif
+ endforeach
+
+ if host_system == 'windows'
+ perl_ccflags += ['-DPLPERL_HAVE_UID_GID']
+ endif
+
+ message('CCFLAGS recommended by perl: @0@'.format(perl_ccflags_r))
+ message('CCFLAGS for embedding perl: @0@'.format(' '.join(perl_ccflags)))
+
+ # We are after Embed's ldopts, but without the subset mentioned in
+ # Config's ccdlflags and ldflags. (Those are the choices of those who
+ # built the Perl installation, which are not necessarily appropriate
+ # for building PostgreSQL.)
+ ldopts = run_command(perl, '-MExtUtils::Embed', '-e', 'ldopts', check: true).stdout().strip()
+ undesired = run_command(perl_conf_cmd, 'ccdlflags', check: true).stdout().split()
+ undesired += run_command(perl_conf_cmd, 'ldflags', check: true).stdout().split()
+
+ perl_ldopts = []
+ foreach ldopt : ldopts.split(' ')
+ if ldopt == '' or ldopt in undesired
+ continue
+ endif
+
+ perl_ldopts += ldopt.strip('"')
+ endforeach
+
+ message('LDFLAGS recommended by perl: "@0@"'.format(ldopts))
+ message('LDFLAGS for embedding perl: "@0@"'.format(' '.join(perl_ldopts)))
+
+ perl_dep_int = declare_dependency(
+ compile_args: perl_ccflags,
+ link_args: perl_ldopts,
+ version: perlversion,
+ )
+
+ # While we're at it, check that we can link to libperl.
+ # On most platforms, if perl.h is there then libperl.so will be too, but
+ # at this writing Debian packages them separately. This doesn't work on
+ # old meson versions, but that's ok, it's just nicer to test here.
+ perl_link_test = '''
+/* see plperl.h */
+#ifdef _MSC_VER
+#define __inline__ inline
+#endif
+#include <EXTERN.h>
+#include <perl.h>
+int main(void)
+{
+perl_alloc();
+}'''
+ if meson.version().version_compare('>=0.57') and not \
+ cc.links(perl_link_test, name: 'libperl',
+ args: test_c_args + perl_ccflags + perl_ldopts,
+ include_directories: postgres_inc)
+ perl_may_work = false
+ perl_msg = 'missing libperl'
+ endif
+
+ endif # perl_may_work
+
+ if perl_may_work
+ perl_dep = perl_dep_int
+ else
+ if perlopt.enabled()
+ error('dependency plperl failed: @0@'.format(perl_msg))
+ else
+ message('disabling optional dependency plperl: @0@'.format(perl_msg))
+ endif
+ endif
+endif
+
+
+
+###############################################################
+# Library: Python (for plpython)
+###############################################################
+
+pyopt = get_option('plpython')
+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
+ endif
+else
+ python3_dep = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: Readline
+###############################################################
+
+if not get_option('readline').disabled()
+ libedit_preferred = get_option('libedit_preferred')
+ # Set the order of readline dependencies
+ check_readline_deps = libedit_preferred ? \
+ ['libedit', 'readline'] : ['readline', 'libedit']
+
+ foreach readline_dep : check_readline_deps
+ readline = dependency(readline_dep, required: false)
+ if not readline.found()
+ readline = cc.find_library(readline_dep,
+ required: get_option('readline').enabled(),
+ dirs: test_lib_d)
+ endif
+ if readline.found()
+ break
+ endif
+ endforeach
+
+ if readline.found()
+ cdata.set('HAVE_LIBREADLINE', 1)
+
+ editline_prefix = {
+ 'header_prefix': 'editline/',
+ 'flag_prefix': 'EDITLINE_',
+ }
+ readline_prefix = {
+ 'header_prefix': 'readline/',
+ 'flag_prefix': 'READLINE_',
+ }
+ default_prefix = {
+ 'header_prefix': '',
+ 'flag_prefix': '',
+ }
+
+ # Set the order of prefixes
+ prefixes = libedit_preferred ? \
+ [editline_prefix, default_prefix, readline_prefix] : \
+ [readline_prefix, default_prefix, editline_prefix]
+
+ at_least_one_header_found = false
+ foreach header : ['history', 'readline']
+ is_found = false
+ foreach prefix : prefixes
+ header_file = '@0@@1@.h'.format(prefix['header_prefix'], header)
+ # Check history.h and readline.h
+ if not is_found and cc.has_header(header_file,
+ args: test_c_args, include_directories: postgres_inc,
+ dependencies: [readline], required: false)
+ if header == 'readline'
+ readline_h = header_file
+ endif
+ cdata.set('HAVE_@0@@1@_H'.format(prefix['flag_prefix'], header).to_upper(), 1)
+ is_found = true
+ at_least_one_header_found = true
+ endif
+ endforeach
+ endforeach
+
+ if not at_least_one_header_found
+ error('''readline header not found
+If you have @0@ already installed, see 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))
+ endif
+
+ check_funcs = [
+ 'append_history',
+ 'history_truncate_file',
+ 'rl_completion_matches',
+ 'rl_filename_completion_function',
+ 'rl_reset_screen_size',
+ 'rl_variable_bind',
+ ]
+
+ 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)
+ endforeach
+
+ check_vars = [
+ 'rl_completion_suppress_quote',
+ 'rl_filename_quote_characters',
+ 'rl_filename_quoting_function',
+ ]
+
+ foreach var : check_vars
+ 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>',
+ dependencies: [readline]) ? 1 : false)
+ endforeach
+
+ # If found via cc.find_library() ensure headers are found when using the
+ # dependency. On meson < 0.57 one cannot do compiler checks using the
+ # dependency returned by declare_dependency(), so we can't do this above.
+ if readline.type_name() == 'library'
+ readline = declare_dependency(dependencies: readline,
+ include_directories: postgres_inc)
+ endif
+ endif
+
+ # XXX: Figure out whether to implement mingw warning equivalent
+else
+ readline = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: selinux
+###############################################################
+
+selinux = not_found_dep
+selinuxopt = get_option('selinux')
+if meson.version().version_compare('>=0.59')
+ selinuxopt = selinuxopt.disable_auto_if(host_system != 'linux')
+endif
+selinux = dependency('libselinux', required: selinuxopt, version: '>= 2.1.10')
+cdata.set('HAVE_LIBSELINUX',
+ selinux.found() ? 1 : false)
+
+
+
+###############################################################
+# Library: systemd
+###############################################################
+
+systemd = not_found_dep
+systemdopt = get_option('systemd')
+if meson.version().version_compare('>=0.59')
+ systemdopt = systemdopt.disable_auto_if(host_system != 'linux')
+endif
+systemd = dependency('libsystemd', required: systemdopt)
+cdata.set('USE_SYSTEMD', systemd.found() ? 1 : false)
+
+
+
+###############################################################
+# Library: SSL
+###############################################################
+
+if get_option('ssl') == 'openssl'
+
+ # Try to find openssl via pkg-config et al, if that doesn't work
+ # (e.g. because it's provided as part of the OS, like on FreeBSD), look for
+ # the library names that we know about.
+
+ # via pkg-config et al
+ ssl = dependency('openssl', required: false)
+
+ # via library + headers
+ if not ssl.found()
+ ssl_lib = cc.find_library('ssl',
+ dirs: test_lib_d,
+ header_include_directories: postgres_inc,
+ has_headers: ['openssl/ssl.h', 'openssl/err.h'])
+ crypto_lib = cc.find_library('crypto',
+ dirs: test_lib_d,
+ header_include_directories: postgres_inc)
+ ssl_int = [ssl_lib, crypto_lib]
+
+ ssl = declare_dependency(dependencies: ssl_int,
+ include_directories: postgres_inc)
+ else
+ cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: true)
+ cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: true)
+
+ ssl_int = [ssl]
+ endif
+
+ check_funcs = [
+ ['CRYPTO_new_ex_data', {'required': true}],
+ ['SSL_new', {'required': true}],
+
+ # Function introduced in OpenSSL 1.0.2.
+ ['X509_get_signature_nid'],
+
+ # Functions introduced in OpenSSL 1.1.0. We used to check for
+ # OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
+ # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it
+ # doesn't have these OpenSSL 1.1.0 functions. So check for individual
+ # functions.
+ ['OPENSSL_init_ssl'],
+ ['BIO_get_data'],
+ ['BIO_meth_new'],
+ ['ASN1_STRING_get0_data'],
+ ['HMAC_CTX_new'],
+ ['HMAC_CTX_free'],
+
+ # OpenSSL versions before 1.1.0 required setting callback functions, for
+ # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
+ # function was removed.
+ ['CRYPTO_lock'],
+ ]
+
+ foreach c : check_funcs
+ func = c.get(0)
+ val = cc.has_function(func, args: test_c_args, dependencies: ssl_int)
+ required = c.get(1, {}).get('required', false)
+ if required and not val
+ error('openssl function @0@ is required'.format(func))
+ elif not required
+ cdata.set('HAVE_' + func.to_upper(), val ? 1 : false)
+ endif
+ endforeach
+
+ 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.''')
+else
+ ssl = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: uuid
+###############################################################
+
+uuidopt = get_option('uuid')
+if uuidopt != 'none'
+ uuidname = uuidopt.to_upper()
+ if uuidopt == 'e2fs'
+ uuid = dependency('uuid', required: true)
+ uuidfunc = 'uuid_generate'
+ uuidheader = 'uuid/uuid.h'
+ elif uuidopt == 'bsd'
+ # libc should have uuid function
+ uuid = declare_dependency()
+ uuidfunc = 'uuid_to_string'
+ uuidheader = 'uuid.h'
+ elif uuidopt == 'ossp'
+ uuid = dependency('ossp-uuid', required: true)
+ uuidfunc = 'uuid_export'
+ uuidheader = 'ossp/uuid.h'
+ else
+ error('huh')
+ endif
+
+ if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid)
+ error('uuid library @0@ missing required function @1@'.format(uuidopt, uuidfunc))
+ endif
+ cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1)
+
+ cdata.set('HAVE_UUID_@0@'.format(uuidname), 1,
+ description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname))
+else
+ uuid = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: zlib
+###############################################################
+
+zlibopt = get_option('zlib')
+zlib = not_found_dep
+if not zlibopt.disabled()
+ zlib_t = dependency('zlib', required: zlibopt)
+
+ if zlib_t.type_name() == 'internal'
+ # if fallback was used, we don't need to test if headers are present (they
+ # aren't built yet, so we can't test)
+ zlib = zlib_t
+ elif not zlib_t.found()
+ warning('did not find zlib')
+ elif not cc.has_header('zlib.h',
+ args: test_c_args, include_directories: postgres_inc,
+ dependencies: [zlib_t], required: zlibopt.enabled())
+ warning('zlib header not found')
+ elif not cc.has_type('z_streamp',
+ dependencies: [zlib_t], prefix: '#include <zlib.h>',
+ args: test_c_args, include_directories: postgres_inc)
+ if zlibopt.enabled()
+ error('zlib version is too old')
+ else
+ warning('zlib version is too old')
+ endif
+ else
+ zlib = zlib_t
+ endif
+
+ if zlib.found()
+ cdata.set('HAVE_LIBZ', 1)
+ endif
+endif
+
+
+
+###############################################################
+# Library: tap test dependencies
+###############################################################
+
+# Check whether tap tests are enabled or not
+tap_tests_enabled = false
+tapopt = get_option('tap_tests')
+if not tapopt.disabled()
+ # Checking for perl modules for tap tests
+ perl_ipc_run_check = run_command(perl, 'config/check_modules.pl', check: false)
+ if perl_ipc_run_check.returncode() != 0
+ message(perl_ipc_run_check.stderr().strip())
+ if tapopt.enabled()
+ error('Additional Perl modules are required to run TAP tests.')
+ else
+ warning('Additional Perl modules are required to run TAP tests.')
+ endif
+ else
+ tap_tests_enabled = true
+ endif
+endif
+
+
+
+###############################################################
+# Library: zstd
+###############################################################
+
+zstdopt = get_option('zstd')
+if not zstdopt.disabled()
+ zstd = dependency('libzstd', required: zstdopt, version: '>=1.4.0')
+
+ if zstd.found()
+ cdata.set('USE_ZSTD', 1)
+ cdata.set('HAVE_LIBZSTD', 1)
+ endif
+
+else
+ zstd = not_found_dep
+endif
+
+
+
+###############################################################
+# Compiler tests
+###############################################################
+
+# Do we need -std=c99 to compile C99 code? We don't want to add -std=c99
+# unnecessarily, because we optionally rely on newer features.
+c99_test = '''
+#include <stdbool.h>
+#include <complex.h>
+#include <tgmath.h>
+#include <inttypes.h>
+
+struct named_init_test {
+ int a;
+ int b;
+};
+
+extern void structfunc(struct named_init_test);
+
+int main(int argc, char **argv)
+{
+ struct named_init_test nit = {
+ .a = 3,
+ .b = 5,
+ };
+
+ for (int loop_var = 0; loop_var < 3; loop_var++)
+ {
+ nit.a += nit.b;
+ }
+
+ structfunc((struct named_init_test){1, 0});
+
+ return nit.a != 0;
+}
+'''
+
+if not cc.compiles(c99_test, name: 'c99', args: test_c_args)
+ if cc.compiles(c99_test, name: 'c99 with -std=c99',
+ args: test_c_args + ['-std=c99'])
+ test_c_args += '-std=c99'
+ cflags += '-std=c99'
+ else
+ error('C compiler does not support C99')
+ endif
+endif
+
+sizeof_long = cc.sizeof('long', args: test_c_args)
+cdata.set('SIZEOF_LONG', sizeof_long)
+if sizeof_long == 8
+ cdata.set('HAVE_LONG_INT_64', 1)
+ cdata.set('PG_INT64_TYPE', 'long int')
+ cdata.set_quoted('INT64_MODIFIER', 'l')
+elif sizeof_long == 4 and cc.sizeof('long long', args: test_c_args) == 8
+ cdata.set('HAVE_LONG_LONG_INT_64', 1)
+ cdata.set('PG_INT64_TYPE', 'long long int')
+ cdata.set_quoted('INT64_MODIFIER', 'll')
+else
+ error('do not know how to get a 64bit int')
+endif
+
+if host_machine.endian() == 'big'
+ cdata.set('WORDS_BIGENDIAN', 1)
+endif
+
+alignof_types = ['short', 'int', 'long', 'double']
+maxalign = 0
+foreach t : alignof_types
+ align = cc.alignment(t, args: test_c_args)
+ if maxalign < align
+ maxalign = align
+ endif
+ cdata.set('ALIGNOF_@0@'.format(t.to_upper()), align)
+endforeach
+cdata.set('MAXIMUM_ALIGNOF', maxalign)
+
+cdata.set('SIZEOF_VOID_P', cc.sizeof('void *', args: test_c_args))
+cdata.set('SIZEOF_SIZE_T', cc.sizeof('size_t', args: test_c_args))
+
+
+# Check if __int128 is a working 128 bit integer type, and if so
+# define PG_INT128_TYPE to that typename.
+#
+# This currently only detects a GCC/clang extension, but support for other
+# environments may be added in the future.
+#
+# For the moment we only test for support for 128bit math; support for
+# 128bit literals and snprintf is not required.
+if cc.links('''
+ /*
+ * We don't actually run this test, just link it to verify that any support
+ * functions needed for __int128 are present.
+ *
+ * These are globals to discourage the compiler from folding all the
+ * arithmetic tests down to compile-time constants. We do not have
+ * convenient support for 128bit literals at this point...
+ */
+ __int128 a = 48828125;
+ __int128 b = 97656250;
+
+ int main(void)
+ {
+ __int128 c,d;
+ a = (a << 12) + 1; /* 200000000001 */
+ b = (b << 12) + 5; /* 400000000005 */
+ /* try the most relevant arithmetic ops */
+ c = a * b;
+ d = (c + b) / b;
+ /* must use the results, else compiler may optimize arithmetic away */
+ return d != a+1;
+ }''',
+ name: '__int128',
+ args: test_c_args)
+
+ buggy_int128 = false
+
+ # Use of non-default alignment with __int128 tickles bugs in some compilers.
+ # If not cross-compiling, we can test for bugs and disable use of __int128
+ # with buggy compilers. If cross-compiling, hope for the best.
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83925
+ if not meson.is_cross_build()
+ r = cc.run('''
+ /* This must match the corresponding code in c.h: */
+ #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+ #define pg_attribute_aligned(a) __attribute__((aligned(a)))
+ #endif
+ typedef __int128 int128a
+ #if defined(pg_attribute_aligned)
+ pg_attribute_aligned(8)
+ #endif
+ ;
+
+ int128a holder;
+ void pass_by_val(void *buffer, int128a par) { holder = par; }
+
+ int main(void)
+ {
+ long int i64 = 97656225L << 12;
+ int128a q;
+ pass_by_val(main, (int128a) i64);
+ q = (int128a) i64;
+ return q != holder;
+ }''',
+ name: '__int128 alignment bug',
+ args: test_c_args)
+ assert(r.compiled())
+ if r.returncode() != 0
+ buggy_int128 = true
+ message('__int128 support present but buggy and thus disabled')
+ endif
+ endif
+
+ if not buggy_int128
+ cdata.set('PG_INT128_TYPE', '__int128')
+ cdata.set('ALIGNOF_PG_INT128_TYPE', cc.
+ alignment('__int128', args: test_c_args))
+ endif
+endif
+
+
+# Check if the C compiler knows computed gotos (gcc extension, also
+# available in at least clang). If so, define HAVE_COMPUTED_GOTO.
+#
+# Checking whether computed gotos are supported syntax-wise ought to
+# be enough, as the syntax is otherwise illegal.
+if cc.compiles('''
+ static inline int foo(void)
+ {
+ void *labeladdrs[] = {&&my_label};
+ goto *labeladdrs[0];
+ my_label:
+ return 1;
+ }''',
+ args: test_c_args)
+ cdata.set('HAVE_COMPUTED_GOTO', 1)
+endif
+
+
+# Check if the C compiler understands _Static_assert(),
+# and define HAVE__STATIC_ASSERT if so.
+#
+# We actually check the syntax ({ _Static_assert(...) }), because we need
+# gcc-style compound expressions to be able to wrap the thing into macros.
+if cc.compiles('''
+ int main(int arg, char **argv)
+ {
+ ({ _Static_assert(1, "foo"); });
+ }
+ ''',
+ args: test_c_args)
+ cdata.set('HAVE__STATIC_ASSERT', 1)
+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
+ cdata.set('HAVE__BOOL', 1)
+ cdata.set('PG_USE_STDBOOL', 1)
+endif
+
+
+# Need to check a call with %m because netbsd supports gnu_printf but emits a
+# warning for each use of %m.
+printf_attributes = ['gnu_printf', '__syslog__', 'printf']
+testsrc = '''
+extern void emit_log(int ignore, const char *fmt,...) __attribute__((format(@0@, 2,3)));
+static void call_log(void)
+{
+ emit_log(0, "error: %s: %m", "foo");
+}
+'''
+attrib_error_args = cc.get_supported_arguments('-Werror=format', '-Werror=ignored-attributes')
+foreach a : printf_attributes
+ if cc.compiles(testsrc.format(a),
+ args: test_c_args + attrib_error_args, name: 'format ' + a)
+ cdata.set('PG_PRINTF_ATTRIBUTE', a)
+ break
+ endif
+endforeach
+
+
+if cc.has_function_attribute('visibility:default') and \
+ cc.has_function_attribute('visibility:hidden')
+ 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
+ # flags into exported files (pgxs, .pc files).
+ cflags_mod += '-fvisibility=hidden'
+ cxxflags_mod += ['-fvisibility=hidden', '-fvisibility-inlines-hidden']
+ ldflags_mod += '-fvisibility=hidden'
+endif
+
+
+# Check if various builtins exist. Some builtins are tested separately,
+# because we want to test something more complicated than the generic case.
+builtins = [
+ 'bswap16',
+ 'bswap32',
+ 'bswap64',
+ 'clz',
+ 'ctz',
+ 'constant_p',
+ 'frame_address',
+ 'popcount',
+ 'unreachable',
+]
+
+foreach builtin : builtins
+ fname = '__builtin_@0@'.format(builtin)
+ if cc.has_function(fname, args: test_c_args)
+ cdata.set('HAVE@0@'.format(fname.to_upper()), 1)
+ endif
+endforeach
+
+
+# Check if the C compiler understands __builtin_types_compatible_p,
+# and define HAVE__BUILTIN_TYPES_COMPATIBLE_P if so.
+#
+# We check usage with __typeof__, though it's unlikely any compiler would
+# have the former and not the latter.
+if cc.compiles('''
+ static int x;
+ static int y[__builtin_types_compatible_p(__typeof__(x), int)];
+ ''',
+ name: '__builtin_types_compatible_p',
+ args: test_c_args)
+ cdata.set('HAVE__BUILTIN_TYPES_COMPATIBLE_P', 1)
+endif
+
+
+# Check if the C compiler understands __builtin_$op_overflow(),
+# and define HAVE__BUILTIN_OP_OVERFLOW if so.
+#
+# Check for the most complicated case, 64 bit multiplication, as a
+# proxy for all of the operations. To detect the case where the compiler
+# knows the function but library support is missing, we must link not just
+# compile, and store the results in global variables so the compiler doesn't
+# optimize away the call.
+if cc.links('''
+ INT64 a = 1;
+ INT64 b = 1;
+ INT64 result;
+
+ int main(void)
+ {
+ return __builtin_mul_overflow(a, b, &result);
+ }''',
+ name: '__builtin_mul_overflow',
+ args: test_c_args + ['-DINT64=@0@'.format(cdata.get('PG_INT64_TYPE'))],
+ )
+ cdata.set('HAVE__BUILTIN_OP_OVERFLOW', 1)
+endif
+
+
+# XXX: The configure.ac check for __cpuid() is broken, we don't copy that
+# here. To prevent problems due to two detection methods working, stop
+# checking after one.
+if cc.links('''
+ #include <cpuid.h>
+ int main(int arg, char **argv)
+ {
+ unsigned int exx[4] = {0, 0, 0, 0};
+ __get_cpuid(1, &exx[0], &exx[1], &exx[2], &exx[3]);
+ }
+ ''', name: '__get_cpuid',
+ args: test_c_args)
+ cdata.set('HAVE__GET_CPUID', 1)
+elif cc.links('''
+ #include <intrin.h>
+ int main(int arg, char **argv)
+ {
+ unsigned int exx[4] = {0, 0, 0, 0};
+ __cpuid(exx, 1);
+ }
+ ''', name: '__cpuid',
+ args: test_c_args)
+ cdata.set('HAVE__CPUID', 1)
+endif
+
+
+# Defend against clang being used on x86-32 without SSE2 enabled. As current
+# versions of clang do not understand -fexcess-precision=standard, the use of
+# x87 floating point operations leads to problems like isinf possibly returning
+# false for a value that is infinite when converted from the 80bit register to
+# the 8byte memory representation.
+#
+# Only perform the test if the compiler doesn't understand
+# -fexcess-precision=standard, that way a potentially fixed compiler will work
+# automatically.
+if '-fexcess-precision=standard' not in cflags
+ if not cc.compiles('''
+#if defined(__clang__) && defined(__i386__) && !defined(__SSE2_MATH__)
+choke me
+#endif''',
+ name: '', args: test_c_args)
+ error('Compiling PostgreSQL with clang, on 32bit x86, requires SSE2 support. Use -msse2 or use gcc.')
+ endif
+endif
+
+
+
+###############################################################
+# Compiler flags
+###############################################################
+
+common_functional_flags = [
+ # Disable strict-aliasing rules; needed for gcc 3.3+
+ '-fno-strict-aliasing',
+ # Disable optimizations that assume no overflow; needed for gcc 4.3+
+ '-fwrapv',
+ '-fexcess-precision=standard',
+]
+
+cflags += cc.get_supported_arguments(common_functional_flags)
+if llvm.found()
+ cxxflags += cpp.get_supported_arguments(common_functional_flags)
+endif
+
+vectorize_cflags = cc.get_supported_arguments(['-ftree-vectorize'])
+unroll_loops_cflags = cc.get_supported_arguments(['-funroll-loops'])
+
+common_warning_flags = [
+ '-Wmissing-prototypes',
+ '-Wpointer-arith',
+ # Really don't want VLAs to be used in our dialect of C
+ '-Werror=vla',
+ # On macOS, complain about usage of symbols newer than the deployment target
+ '-Werror=unguarded-availability-new',
+ '-Wendif-labels',
+ '-Wmissing-format-attribute',
+ '-Wimplicit-fallthrough=3',
+ '-Wcast-function-type',
+ # This was included in -Wall/-Wformat in older GCC versions
+ '-Wformat-security',
+]
+
+cflags_warn += cc.get_supported_arguments(common_warning_flags)
+if llvm.found()
+ cxxflags_warn += cpp.get_supported_arguments(common_warning_flags)
+endif
+
+# A few places with imported code get a pass on -Wdeclaration-after-statement, remember
+# the result for them
+if cc.has_argument('-Wdeclaration-after-statement')
+ cflags_warn += '-Wdeclaration-after-statement'
+ using_declaration_after_statement_warning = true
+else
+ using_declaration_after_statement_warning = false
+endif
+
+
+# The following tests want to suppress various unhelpful warnings by adding
+# -Wno-foo switches. But gcc won't complain about unrecognized -Wno-foo
+# switches, so we have to test for the positive form and if that works,
+# add the negative form.
+
+negative_warning_flags = [
+ # Suppress clang's unhelpful unused-command-line-argument warnings.
+ 'unused-command-line-argument',
+
+ # Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
+ # of warnings when building plperl because of usages in the Perl headers.
+ 'compound-token-split-by-macro',
+
+ # Similarly disable useless truncation warnings from gcc 8+
+ 'format-truncation',
+ 'stringop-truncation',
+
+ # To make warning_level=2 / -Wextra work, we'd need at least the following
+ # 'clobbered',
+ # 'missing-field-initializers',
+ # 'sign-compare',
+ # 'unused-parameter',
+]
+
+foreach w : negative_warning_flags
+ if cc.has_argument('-W' + w)
+ cflags_warn += '-Wno-' + w
+ endif
+ if llvm.found() and cpp.has_argument('-W' + w)
+ cxxflags_warn += '-Wno-' + w
+ endif
+endforeach
+
+
+# From Project.pm
+if cc.get_id() == 'msvc'
+ cflags_warn += [
+ '/wd4018', # signed/unsigned mismatch
+ '/wd4244', # conversion from 'type1' to 'type2', possible loss of data
+ '/wd4273', # inconsistent DLL linkage
+ '/wd4101', # unreferenced local variable
+ '/wd4102', # unreferenced label
+ '/wd4090', # different 'modifier' qualifiers
+ '/wd4267', # conversion from 'size_t' to 'type', possible loss of data
+ ]
+
+ cppflags += [
+ '/DWIN32',
+ '/DWINDOWS',
+ '/D__WINDOWS__',
+ '/D__WIN32__',
+ '/D_CRT_SECURE_NO_DEPRECATE',
+ '/D_CRT_NONSTDC_NO_DEPRECATE',
+ ]
+
+ # We never need export libraries. As link.exe reports their creation, they
+ # are unnecessarily noisy. Similarly, we don't need import library for
+ # modules, we only import them dynamically, and they're also noisy.
+ ldflags += '/NOEXP'
+ ldflags_mod += '/NOIMPLIB'
+endif
+
+
+
+###############################################################
+# Atomics
+###############################################################
+
+if not get_option('spinlocks')
+ warning('Not using spinlocks will cause poor performance')
+else
+ cdata.set('HAVE_SPINLOCKS', 1)
+endif
+
+if not get_option('atomics')
+ warning('Not using atomics will cause poor performance')
+else
+ # XXX: perhaps we should require some atomics support in this case these
+ # days?
+ cdata.set('HAVE_ATOMICS', 1)
+
+ atomic_checks = [
+ {'name': 'HAVE_GCC__SYNC_CHAR_TAS',
+ 'desc': '__sync_lock_test_and_set(char)',
+ 'test': '''
+char lock = 0;
+__sync_lock_test_and_set(&lock, 1);
+__sync_lock_release(&lock);'''},
+
+ {'name': 'HAVE_GCC__SYNC_INT32_TAS',
+ 'desc': '__sync_lock_test_and_set(int32)',
+ 'test': '''
+int lock = 0;
+__sync_lock_test_and_set(&lock, 1);
+__sync_lock_release(&lock);'''},
+
+ {'name': 'HAVE_GCC__SYNC_INT32_CAS',
+ 'desc': '__sync_val_compare_and_swap(int32)',
+ 'test': '''
+int val = 0;
+__sync_val_compare_and_swap(&val, 0, 37);'''},
+
+ {'name': 'HAVE_GCC__SYNC_INT64_CAS',
+ 'desc': '__sync_val_compare_and_swap(int64)',
+ 'test': '''
+INT64 val = 0;
+__sync_val_compare_and_swap(&val, 0, 37);'''},
+
+ {'name': 'HAVE_GCC__ATOMIC_INT32_CAS',
+ 'desc': ' __atomic_compare_exchange_n(int32)',
+ 'test': '''
+int val = 0;
+int expect = 0;
+__atomic_compare_exchange_n(&val, &expect, 37, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);'''},
+
+ {'name': 'HAVE_GCC__ATOMIC_INT64_CAS',
+ 'desc': ' __atomic_compare_exchange_n(int64)',
+ 'test': '''
+INT64 val = 0;
+INT64 expect = 0;
+__atomic_compare_exchange_n(&val, &expect, 37, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);'''},
+ ]
+
+ foreach check : atomic_checks
+ test = '''
+int main(void)
+{
+@0@
+}'''.format(check['test'])
+
+ cdata.set(check['name'],
+ cc.links(test,
+ name: check['desc'],
+ args: test_c_args + ['-DINT64=@0@'.format(cdata.get('PG_INT64_TYPE'))]) ? 1 : false
+ )
+ endforeach
+
+endif
+
+
+
+###############################################################
+# Select CRC-32C implementation.
+#
+# If we are targeting a processor that has Intel SSE 4.2 instructions, we can
+# use the special CRC instructions for calculating CRC-32C. If we're not
+# targeting such a processor, but we can nevertheless produce code that uses
+# the SSE intrinsics, perhaps with some extra CFLAGS, compile both
+# implementations and select which one to use at runtime, depending on whether
+# SSE 4.2 is supported by the processor we're running on.
+#
+# Similarly, if we are targeting an ARM processor that has the CRC
+# instructions that are part of the ARMv8 CRC Extension, use them. And if
+# we're not targeting such a processor, but can nevertheless produce code that
+# uses the CRC instructions, compile both, and select at runtime.
+###############################################################
+
+have_optimized_crc = false
+cflags_crc = []
+if host_cpu == 'x86' or host_cpu == 'x86_64'
+
+ if cc.get_id() == 'msvc'
+ cdata.set('USE_SSE42_CRC32C', false)
+ cdata.set('USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 1)
+ have_optimized_crc = true
+ else
+
+ prog = '''
+#include <nmmintrin.h>
+
+int main(void)
+{
+ unsigned int crc = 0;
+ crc = _mm_crc32_u8(crc, 0);
+ crc = _mm_crc32_u32(crc, 0);
+ /* return computed value, to prevent the above being optimized away */
+ return crc == 0;
+}
+'''
+
+ if cc.links(prog, name: '_mm_crc32_u8 and _mm_crc32_u32 without -msse4.2',
+ args: test_c_args)
+ # Use Intel SSE 4.2 unconditionally.
+ cdata.set('USE_SSE42_CRC32C', 1)
+ have_optimized_crc = true
+ elif cc.links(prog, name: '_mm_crc32_u8 and _mm_crc32_u32 with -msse4.2',
+ args: test_c_args + ['-msse4.2'])
+ # Use Intel SSE 4.2, with runtime check. The CPUID instruction is needed for
+ # the runtime check.
+ cflags_crc += '-msse4.2'
+ cdata.set('USE_SSE42_CRC32C', false)
+ cdata.set('USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 1)
+ have_optimized_crc = true
+ endif
+
+ endif
+
+elif host_cpu == 'arm' or host_cpu == 'aarch64'
+
+ prog = '''
+#include <arm_acle.h>
+
+int main(void)
+{
+ unsigned int crc = 0;
+ crc = __crc32cb(crc, 0);
+ crc = __crc32ch(crc, 0);
+ crc = __crc32cw(crc, 0);
+ crc = __crc32cd(crc, 0);
+
+ /* return computed value, to prevent the above being optimized away */
+ return crc == 0;
+}
+'''
+
+ if cc.links(prog, name: '__crc32cb, __crc32ch, __crc32cw, and __crc32cd without -march=armv8-a+crc',
+ args: test_c_args)
+ # Use ARM CRC Extension unconditionally
+ cdata.set('USE_ARMV8_CRC32C', 1)
+ have_optimized_crc = true
+ elif cc.links(prog, name: '__crc32cb, __crc32ch, __crc32cw, and __crc32cd with -march=armv8-a+crc',
+ args: test_c_args + ['-march=armv8-a+crc'])
+ # Use ARM CRC Extension, with runtime check
+ cflags_crc += '-march=armv8-a+crc'
+ cdata.set('USE_ARMV8_CRC32C', false)
+ cdata.set('USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK', 1)
+ have_optimized_crc = true
+ endif
+endif
+
+if not have_optimized_crc
+ # fall back to slicing-by-8 algorithm, which doesn't require any special CPU
+ # support.
+ cdata.set('USE_SLICING_BY_8_CRC32C', 1)
+endif
+
+
+
+###############################################################
+# Other CPU specific stuff
+###############################################################
+
+if host_cpu == 'x86_64'
+
+ if cc.compiles('''
+ void main(void)
+ {
+ long long x = 1; long long r;
+ __asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));
+ }''',
+ name: '@0@: popcntq instruction'.format(host_cpu),
+ args: test_c_args)
+ cdata.set('HAVE_X86_64_POPCNTQ', 1)
+ endif
+
+elif host_cpu == 'ppc' or host_cpu == 'ppc64'
+ # Check if compiler accepts "i"(x) when __builtin_constant_p(x).
+ if cdata.has('HAVE__BUILTIN_CONSTANT_P')
+ if cc.compiles('''
+ static inline int
+ addi(int ra, int si)
+ {
+ int res = 0;
+ if (__builtin_constant_p(si))
+ __asm__ __volatile__(
+ " addi %0,%1,%2\n" : "=r"(res) : "b"(ra), "i"(si));
+ return res;
+ }
+ int test_adds(int x) { return addi(3, x) + addi(x, 5); }
+ ''',
+ args: test_c_args)
+ cdata.set('HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P', 1)
+ endif
+ endif
+endif
+
+
+
+###############################################################
+# Library / OS tests
+###############################################################
+
+# XXX: Might be worth conditioning some checks on the OS, to avoid doing
+# unnecessary checks over and over, particularly on windows.
+header_checks = [
+ 'atomic.h',
+ 'copyfile.h',
+ 'crtdefs.h',
+ 'execinfo.h',
+ 'getopt.h',
+ 'ifaddrs.h',
+ 'langinfo.h',
+ 'mbarrier.h',
+ 'stdbool.h',
+ 'strings.h',
+ 'sys/epoll.h',
+ 'sys/event.h',
+ 'sys/personality.h',
+ 'sys/prctl.h',
+ 'sys/procctl.h',
+ 'sys/signalfd.h',
+ 'sys/ucred.h',
+ 'termios.h',
+ 'ucred.h',
+]
+
+foreach header : header_checks
+ varname = 'HAVE_' + header.underscorify().to_upper()
+
+ # Emulate autoconf behaviour of not-found->undef, found->1
+ found = cc.has_header(header,
+ include_directories: postgres_inc, args: test_c_args)
+ cdata.set(varname, found ? 1 : false,
+ description: 'Define to 1 if you have the <@0@> header file.'.format(header))
+endforeach
+
+
+decl_checks = [
+ ['F_FULLFSYNC', 'fcntl.h'],
+ ['fdatasync', 'unistd.h'],
+ ['posix_fadvise', 'fcntl.h'],
+ ['strlcat', 'string.h'],
+ ['strlcpy', 'string.h'],
+ ['strnlen', 'string.h'],
+]
+
+# Need to check for function declarations for these functions, because
+# checking for library symbols wouldn't handle deployment target
+# restrictions on macOS
+decl_checks += [
+ ['preadv', 'sys/uio.h'],
+ ['pwritev', 'sys/uio.h'],
+]
+
+foreach c : decl_checks
+ func = c.get(0)
+ header = c.get(1)
+ args = c.get(2, {})
+ varname = 'HAVE_DECL_' + func.underscorify().to_upper()
+
+ found = cc.has_header_symbol(header, func,
+ args: test_c_args, include_directories: postgres_inc,
+ kwargs: args)
+ cdata.set10(varname, found, description:
+'''Define to 1 if you have the declaration of `@0@', and to 0 if you
+ don't.'''.format(func))
+endforeach
+
+
+if cc.has_type('struct cmsgcred',
+ args: test_c_args + ['@0@'.format(cdata.get('HAVE_SYS_UCRED_H')) == 'false' ? '' : '-DHAVE_SYS_UCRED_H'],
+ include_directories: postgres_inc,
+ prefix: '''
+#include <sys/socket.h>
+#include <sys/param.h>
+#ifdef HAVE_SYS_UCRED_H
+#include <sys/ucred.h>
+#endif''')
+ cdata.set('HAVE_STRUCT_CMSGCRED', 1)
+else
+ cdata.set('HAVE_STRUCT_CMSGCRED', false)
+endif
+
+if cc.has_type('struct option',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '@0@'.format(cdata.get('HAVE_GETOPT_H')) == '1' ? '#include <getopt.h>' : '')
+ cdata.set('HAVE_STRUCT_OPTION', 1)
+endif
+
+
+foreach c : ['opterr', 'optreset']
+ varname = 'HAVE_INT_' + c.underscorify().to_upper()
+
+ if cc.links('''
+#include <unistd.h>
+int main(void)
+{
+ extern int @0@;
+ @0@ = 1;
+}
+'''.format(c), name: c, args: test_c_args)
+ cdata.set(varname, 1)
+ else
+ cdata.set(varname, false)
+ endif
+endforeach
+
+if cc.has_type('socklen_t',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '''
+#include <sys/socket.h>''')
+ cdata.set('HAVE_SOCKLEN_T', 1)
+endif
+
+if cc.has_member('struct sockaddr', 'sa_len',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/socket.h>''')
+ cdata.set('HAVE_STRUCT_SOCKADDR_SA_LEN', 1)
+endif
+
+if cc.has_member('struct tm', 'tm_zone',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <time.h>
+''')
+ cdata.set('HAVE_STRUCT_TM_TM_ZONE', 1)
+endif
+
+if cc.compiles('''
+#include <time.h>
+extern int foo(void);
+int foo(void)
+{
+ return timezone / 60;
+}
+''',
+ name: 'global variable `timezone\' exists',
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_INT_TIMEZONE', 1)
+else
+ cdata.set('HAVE_INT_TIMEZONE', false)
+endif
+
+if cc.has_type('union semun',
+ args: test_c_args,
+ include_directories: postgres_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+''')
+ cdata.set('HAVE_UNION_SEMUN', 1)
+endif
+
+if cc.compiles('''
+#include <string.h>
+int main(void)
+{
+ char buf[100];
+ switch (strerror_r(1, buf, sizeof(buf)))
+ { case 0: break; default: break; }
+}''',
+ name: 'strerror_r',
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('STRERROR_R_INT', 1)
+else
+ cdata.set('STRERROR_R_INT', false)
+endif
+
+# Check for the locale_t type and find the right header file. macOS
+# 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', 1)
+elif cc.has_type('locale_t', prefix: '#include <xlocale.h>')
+ cdata.set('HAVE_LOCALE_T', 1)
+ cdata.set('LOCALE_T_IN_XLOCALE', 1)
+endif
+
+# Check if the C compiler understands typeof or a variant. Define
+# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
+foreach kw : ['typeof', '__typeof__', 'decltype']
+ if cc.compiles('''
+int main(void)
+{
+ int x = 0;
+ @0@(x) y;
+ y = x;
+ return y;
+}
+'''.format(kw),
+ name: 'typeof()',
+ args: test_c_args, include_directories: postgres_inc)
+
+ cdata.set('HAVE_TYPEOF', 1)
+ if kw != 'typeof'
+ cdata.set('typeof', kw)
+ endif
+
+ break
+ endif
+endforeach
+
+
+# Try to find a declaration for wcstombs_l(). It might be in stdlib.h
+# (following the POSIX requirement for wcstombs()), or in locale.h, or in
+# xlocale.h. If it's in the latter, define WCSTOMBS_L_IN_XLOCALE.
+wcstombs_l_test = '''
+#include <stdlib.h>
+#include <locale.h>
+@0@
+
+void main(void)
+{
+#ifndef wcstombs_l
+ (void) wcstombs_l;
+#endif
+}
+'''
+if (not cc.compiles(wcstombs_l_test.format(''),
+ name: 'wcstombs_l') and
+ cc.compiles(wcstombs_l_test.format('#include <xlocale.h>'),
+ name: 'wcstombs_l in xlocale.h'))
+ cdata.set('WCSTOMBS_L_IN_XLOCALE', 1)
+endif
+
+
+# MSVC doesn't cope well with defining restrict to __restrict, the spelling it
+# understands, because it conflicts with __declspec(restrict). Therefore we
+# define pg_restrict to the appropriate definition, which presumably won't
+# conflict.
+#
+# We assume C99 support, so we don't need to make this conditional.
+#
+# XXX: Historically we allowed platforms to disable restrict in template
+# files, but that was only added for AIX when building with XLC, which we
+# don't support yet.
+cdata.set('pg_restrict', '__restrict')
+
+
+if cc.links('''
+#include <machine/vmparam.h>
+#include <sys/exec.h>
+
+int main(void)
+{
+ PS_STRINGS->ps_nargvstr = 1;
+ PS_STRINGS->ps_argvstr = "foo";
+}
+''',
+ name: 'PS_STRINGS', args: test_c_args)
+ cdata.set('HAVE_PS_STRINGS', 1)
+else
+ cdata.set('HAVE_PS_STRINGS', false)
+endif
+
+
+# Most libraries are included only if they demonstrably provide a function we
+# need, but libm is an exception: always include it, because there are too
+# many compilers that play cute optimization games that will break probes for
+# standard functions such as pow().
+os_deps += cc.find_library('m', required: false)
+
+rt_dep = cc.find_library('rt', required: false)
+
+dl_dep = cc.find_library('dl', required: false)
+
+util_dep = cc.find_library('util', required: false)
+posix4_dep = cc.find_library('posix4', required: false)
+
+getopt_dep = cc.find_library('getopt', required: false)
+gnugetopt_dep = cc.find_library('gnugetopt', required: false)
+
+# Required on BSDs
+execinfo_dep = cc.find_library('execinfo', required: false)
+
+if host_system == 'cygwin'
+ cygipc_dep = cc.find_library('cygipc', required: false)
+else
+ cygipc_dep = not_found_dep
+endif
+
+if host_system == 'sunos'
+ socket_dep = cc.find_library('socket', required: false)
+else
+ socket_dep = not_found_dep
+endif
+
+# XXX: Might be worth conditioning some checks on the OS, to avoid doing
+# unnecessary checks over and over, particularly on windows.
+func_checks = [
+ ['_configthreadlocale', {'skip': host_system != 'windows'}],
+ ['backtrace_symbols', {'dependencies': [execinfo_dep]}],
+ ['clock_gettime', {'dependencies': [rt_dep, posix4_dep], 'define': false}],
+ ['copyfile'],
+ # gcc/clang's sanitizer helper library provides dlopen but not dlsym, thus
+ # when enabling asan the dlopen check doesn't notice that -ldl is actually
+ # required. Just checking for dlsym() ought to suffice.
+ ['dlsym', {'dependencies': [dl_dep], 'define': false}],
+ ['explicit_bzero'],
+ ['fdatasync', {'dependencies': [rt_dep, posix4_dep], 'define': false}], # Solaris
+ ['getifaddrs'],
+ ['getopt', {'dependencies': [getopt_dep, gnugetopt_dep]}],
+ ['getopt_long', {'dependencies': [getopt_dep, gnugetopt_dep]}],
+ ['getpeereid'],
+ ['getpeerucred'],
+ ['inet_aton'],
+ ['inet_pton'],
+ ['kqueue'],
+ ['mbstowcs_l'],
+ ['memset_s'],
+ ['mkdtemp'],
+ ['posix_fadvise'],
+ ['posix_fallocate'],
+ ['ppoll'],
+ ['pstat'],
+ ['pthread_barrier_wait', {'dependencies': [thread_dep]}],
+ ['pthread_is_threaded_np', {'dependencies': [thread_dep]}],
+ ['sem_init', {'dependencies': [rt_dep, thread_dep], 'skip': sema_kind != 'unnamed_posix', 'define': false}],
+ ['setproctitle', {'dependencies': [util_dep]}],
+ ['setproctitle_fast'],
+ ['shm_open', {'dependencies': [rt_dep], 'define': false}],
+ ['shm_unlink', {'dependencies': [rt_dep], 'define': false}],
+ ['shmget', {'dependencies': [cygipc_dep], 'define': false}],
+ ['socket', {'dependencies': [socket_dep], 'define': false}],
+ ['strchrnul'],
+ ['strerror_r', {'dependencies': [thread_dep]}],
+ ['strlcat'],
+ ['strlcpy'],
+ ['strnlen'],
+ ['strsignal'],
+ ['sync_file_range'],
+ ['syncfs'],
+ ['uselocale'],
+ ['wcstombs_l'],
+]
+
+func_check_results = {}
+foreach c : func_checks
+ func = c.get(0)
+ kwargs = c.get(1, {})
+ deps = kwargs.get('dependencies', [])
+
+ if kwargs.get('skip', false)
+ continue
+ endif
+
+ found = cc.has_function(func, args: test_c_args)
+
+ if not found
+ foreach dep : deps
+ if not dep.found()
+ continue
+ endif
+ found = cc.has_function(func, args: test_c_args,
+ dependencies: [dep])
+ if found
+ os_deps += dep
+ break
+ endif
+ endforeach
+ endif
+
+ func_check_results += {func: found}
+
+ if kwargs.get('define', true)
+ # Emulate autoconf behaviour of not-found->undef, found->1
+ cdata.set('HAVE_' + func.underscorify().to_upper(),
+ found ? 1 : false,
+ description: 'Define to 1 if you have the `@0@\' function.'.format(func))
+ endif
+endforeach
+
+
+if cc.has_function('syslog', args: test_c_args) and \
+ cc.check_header('syslog.h', args: test_c_args)
+ cdata.set('HAVE_SYSLOG', 1)
+endif
+
+
+# if prerequisites for unnamed posix semas aren't fulfilled, fall back to sysv
+# semaphores
+if sema_kind == 'unnamed_posix' and \
+ not func_check_results.get('sem_init', false)
+ sema_kind = 'sysv'
+endif
+
+cdata.set('USE_@0@_SHARED_MEMORY'.format(shmem_kind.to_upper()), 1)
+cdata.set('USE_@0@_SEMAPHORES'.format(sema_kind.to_upper()), 1)
+
+cdata.set('MEMSET_LOOP_LIMIT', memset_loop_limit)
+cdata.set_quoted('DLSUFFIX', dlsuffix)
+
+
+
+###############################################################
+# Threading
+###############################################################
+
+# XXX: About to rely on thread safety in the autoconf build, so not worth
+# implementing a fallback.
+cdata.set('ENABLE_THREAD_SAFETY', 1)
+
+
+
+###############################################################
+# NLS / Gettext
+###############################################################
+
+nlsopt = get_option('nls')
+libintl = not_found_dep
+
+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)
+
+ # meson 0.59 has this wrapped in dependency('int')
+ if (msgfmt.found() and
+ cc.check_header('libintl.h', required: nlsopt,
+ args: test_c_args, include_directories: postgres_inc))
+
+ # in libc
+ if cc.has_function('ngettext')
+ libintl = declare_dependency()
+ else
+ libintl = cc.find_library('intl',
+ has_headers: ['libintl.h'], required: nlsopt,
+ header_include_directories: postgres_inc,
+ dirs: test_lib_d)
+ endif
+ endif
+
+ if libintl.found()
+ i18n = import('i18n')
+ cdata.set('ENABLE_NLS', 1)
+ endif
+endif
+
+
+
+###############################################################
+# Build
+###############################################################
+
+# Set up compiler / linker arguments to be used everywhere, individual targets
+# can add further args directly, or indirectly via dependencies
+add_project_arguments(cflags, language: ['c'])
+add_project_arguments(cppflags, language: ['c'])
+add_project_arguments(cflags_warn, language: ['c'])
+add_project_arguments(cxxflags, language: ['cpp'])
+add_project_arguments(cppflags, language: ['cpp'])
+add_project_arguments(cxxflags_warn, language: ['cpp'])
+add_project_link_arguments(ldflags, language: ['c', 'cpp'])
+
+
+# Collect a number of lists of things while recursing through the source
+# tree. Later steps then can use those.
+
+# list of targets for various alias targets
+backend_targets = []
+bin_targets = []
+pl_targets = []
+contrib_targets = []
+testprep_targets = []
+
+
+# Define the tests to distribute them to the correct test styles later
+test_deps = []
+tests = []
+
+
+# Default options for targets
+
+# First identify rpaths
+bin_install_rpaths = []
+lib_install_rpaths = []
+mod_install_rpaths = []
+
+# Add extra_lib_dirs to rpath. Not needed on darwin, as the install_name of
+# libraries in extra_lib_dirs will be used anyway.
+if host_system != 'darwin'
+ bin_install_rpaths += postgres_lib_d
+ lib_install_rpaths += postgres_lib_d
+ mod_install_rpaths += postgres_lib_d
+endif
+
+
+# Define arguments for default targets
+
+default_target_args = {
+ 'implicit_include_directories': false,
+ 'install': true,
+}
+
+default_lib_args = default_target_args + {
+ 'name_prefix': '',
+ 'install_rpath': ':'.join(lib_install_rpaths),
+}
+
+internal_lib_args = default_lib_args + {
+ 'build_by_default': false,
+ 'install': false,
+}
+
+default_mod_args = default_lib_args + {
+ 'name_prefix': '',
+ 'install_dir': dir_lib_pkg,
+ 'install_rpath': ':'.join(mod_install_rpaths),
+}
+
+default_bin_args = default_target_args + {
+ 'install_dir': dir_bin,
+ 'install_rpath': ':'.join(bin_install_rpaths),
+}
+
+
+
+# Helper for exporting a limited number of symbols
+gen_export_kwargs = {
+ 'input': 'exports.txt',
+ 'output': '@BASENAME@.'+export_file_suffix,
+ 'command': [perl, files('src/tools/gen_export.pl'),
+ '--format', export_file_format,
+ '--input', '@INPUT0@', '--output', '@OUTPUT0@'],
+ 'build_by_default': false,
+ 'install': false,
+}
+
+
+
+# headers that the whole build tree depends on
+generated_headers = []
+# headers that the backend build depends on
+generated_backend_headers = []
+# configure_files() output, needs a way of converting to file names
+configure_files = []
+
+# generated files that might conflict with a partial in-tree autoconf build
+generated_sources = []
+# same, for paths that differ between autoconf / meson builds
+# elements are [dir, [files]]
+generated_sources_ac = {}
+
+
+# First visit src/include - all targets creating headers are defined
+# within. That makes it easy to add the necessary dependencies for the
+# subsequent build steps.
+
+subdir('src/include')
+
+subdir('config')
+
+# Then through src/port and src/common, as most other things depend on them
+
+frontend_port_code = declare_dependency(
+ compile_args: ['-DFRONTEND'],
+ include_directories: [postgres_inc],
+ dependencies: os_deps,
+)
+
+backend_port_code = declare_dependency(
+ compile_args: ['-DBUILDING_DLL'],
+ include_directories: [postgres_inc],
+ sources: [errcodes], # errcodes.h is needed due to use of ereport
+ dependencies: os_deps,
+)
+
+subdir('src/port')
+
+frontend_common_code = declare_dependency(
+ compile_args: ['-DFRONTEND'],
+ include_directories: [postgres_inc],
+ sources: generated_headers,
+ dependencies: [os_deps, zlib, zstd],
+)
+
+backend_common_code = declare_dependency(
+ compile_args: ['-DBUILDING_DLL'],
+ include_directories: [postgres_inc],
+ sources: generated_headers,
+ dependencies: [os_deps, zlib, zstd],
+)
+
+subdir('src/common')
+
+frontend_shlib_code = declare_dependency(
+ compile_args: ['-DFRONTEND'],
+ include_directories: [postgres_inc],
+ link_args: ldflags_sl,
+ link_with: [pgport_shlib, common_shlib],
+ sources: generated_headers,
+ dependencies: [os_deps, libintl],
+)
+
+libpq_deps += [
+ frontend_shlib_code,
+ thread_dep,
+
+ gssapi,
+ ldap_r,
+ libintl,
+ ssl,
+]
+
+subdir('src/interfaces/libpq')
+# fe_utils depends on libpq
+subdir('src/fe_utils')
+
+frontend_code = declare_dependency(
+ include_directories: [postgres_inc],
+ link_with: [fe_utils, common_static, pgport_static],
+ sources: generated_headers,
+ dependencies: [os_deps, libintl],
+)
+
+backend_both_deps += [
+ thread_dep,
+ bsd_auth,
+ gssapi,
+ icu,
+ icu_i18n,
+ ldap,
+ libintl,
+ libxml,
+ lz4,
+ pam,
+ ssl,
+ systemd,
+ zlib,
+ zstd,
+]
+
+backend_mod_deps = backend_both_deps + os_deps
+
+backend_code = declare_dependency(
+ compile_args: ['-DBUILDING_DLL'],
+ include_directories: [postgres_inc],
+ link_args: ldflags_be,
+ link_with: [],
+ sources: generated_headers + generated_backend_headers,
+ dependencies: os_deps + backend_both_deps + backend_deps,
+)
+
+# src/backend/meson.build defines backend_mod_code used for extension
+# libraries.
+
+
+# Then through the main sources. That way contrib can have dependencies on
+# main sources. Note that this explicitly doesn't enter src/test, right now a
+# few regression tests depend on contrib files.
+
+subdir('src')
+
+subdir('contrib')
+
+subdir('src/test')
+subdir('src/interfaces/libpq/test')
+subdir('src/interfaces/ecpg/test')
+
+subdir('doc/src/sgml')
+
+generated_sources_ac += {'': ['GNUmakefile']}
+
+
+# If there are any files in the source directory that we also generate in the
+# build directory, they might get preferred over the newly generated files,
+# e.g. because of a #include "file", which always will search in the current
+# directory first.
+message('checking for file conflicts between source and build directory')
+conflicting_files = []
+potentially_conflicting_files_t = []
+potentially_conflicting_files_t += generated_headers
+potentially_conflicting_files_t += generated_backend_headers
+potentially_conflicting_files_t += generated_backend_sources
+potentially_conflicting_files_t += generated_sources
+
+potentially_conflicting_files = []
+
+# convert all sources of potentially conflicting files into uniform shape
+foreach t : potentially_conflicting_files_t
+ potentially_conflicting_files += t.full_path()
+endforeach
+foreach t : configure_files
+ t = '@0@'.format(t)
+ potentially_conflicting_files += meson.current_build_dir() / t
+endforeach
+foreach sub, fnames : generated_sources_ac
+ sub = meson.build_root() / sub
+ foreach fname : fnames
+ potentially_conflicting_files += sub / fname
+ endforeach
+endforeach
+
+# find and report conflicting files
+foreach build_path : potentially_conflicting_files
+ build_path = host_system == 'windows' ? fs.as_posix(build_path) : build_path
+ # str.replace is in 0.56
+ src_path = meson.current_source_dir() / build_path.split(meson.current_build_dir() / '')[1]
+ if fs.exists(src_path) or fs.is_symlink(src_path)
+ conflicting_files += src_path
+ endif
+endforeach
+# XXX: Perhaps we should generate a file that would clean these up? The list
+# can be long.
+if conflicting_files.length() > 0
+ errmsg_cleanup = '''
+Conflicting files in source directory:
+ @0@
+
+The conflicting files need to be removed, either by removing the files listed
+above, or by running configure and then make maintainer-clean.
+'''
+ errmsg_cleanup = errmsg_cleanup.format(' '.join(conflicting_files))
+ error(errmsg_nonclean_base.format(errmsg_cleanup))
+endif
+
+
+
+###############################################################
+# Test prep
+###############################################################
+
+# The determination of where a DESTDIR install points to is ugly, it's somewhat hard
+# to combine two absolute paths portably...
+
+prefix = get_option('prefix')
+
+test_prefix = prefix
+
+if fs.is_absolute(get_option('prefix'))
+ if host_system == 'windows'
+ if prefix.split(':\\').length() == 1
+ # just a drive
+ test_prefix = ''
+ else
+ test_prefix = prefix.split(':\\')[1]
+ endif
+ else
+ assert(prefix.startswith('/'))
+ test_prefix = './@0@'.format(prefix)
+ endif
+endif
+
+# DESTDIR for the installation used to run tests in
+test_install_destdir = meson.build_root() / 'tmp_install/'
+# DESTDIR + prefix appropriately munged
+test_install_location = test_install_destdir / test_prefix
+
+
+meson_install_args = meson_args + ['install'] + {
+ 'meson': ['--quiet', '--only-changed', '--no-rebuild'],
+ 'muon': []
+}[meson_impl]
+
+test('tmp_install',
+ meson_bin, args: meson_install_args ,
+ env: {'DESTDIR':test_install_destdir},
+ priority: 100,
+ timeout: 300,
+ is_parallel: false,
+ suite: ['setup'])
+
+test_result_dir = meson.build_root() / 'testrun'
+
+
+# XXX: pg_regress doesn't assign unique ports on windows. To avoid the
+# inevitable conflicts from running tests in parallel, hackishly assign
+# different ports for different tests.
+
+testport = 40000
+
+test_env = environment()
+
+temp_install_bindir = test_install_location / get_option('bindir')
+test_env.set('PG_REGRESS', pg_regress.full_path())
+test_env.set('REGRESS_SHLIB', regress_module.full_path())
+
+# Test suites that are not safe by default but can be run if selected
+# by the user via the whitespace-separated list in variable PG_TEST_EXTRA.
+# Export PG_TEST_EXTRA so it can be checked in individual tap tests.
+test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA'))
+
+# Add the temporary installation to the library search path on platforms where
+# that works (everything but windows, basically). On windows everything
+# library-like gets installed into bindir, solving that issue.
+if library_path_var != ''
+ test_env.prepend(library_path_var, test_install_location / get_option('libdir'))
+endif
+
+
+
+###############################################################
+# Test Generation
+###############################################################
+
+testwrap = files('src/tools/testwrap')
+
+foreach test_dir : tests
+ testwrap_base = [
+ testwrap,
+ '--basedir', meson.build_root(),
+ '--srcdir', test_dir['sd'],
+ '--testgroup', test_dir['name'],
+ ]
+
+ foreach kind, v : test_dir
+ if kind in ['sd', 'bd', 'name']
+ continue
+ endif
+
+ t = test_dir[kind]
+
+ if kind in ['regress', 'isolation', 'ecpg']
+ if kind == 'regress'
+ runner = pg_regress
+ elif kind == 'isolation'
+ runner = pg_isolation_regress
+ elif kind == 'ecpg'
+ runner = pg_regress_ecpg
+ endif
+
+ test_output = test_result_dir / test_dir['name'] / kind
+
+ test_command = [
+ runner.full_path(),
+ '--inputdir', t.get('inputdir', test_dir['sd']),
+ '--expecteddir', t.get('expecteddir', test_dir['sd']),
+ '--outputdir', test_output,
+ '--temp-instance', test_output / 'tmp_check',
+ '--bindir', '',
+ '--dlpath', test_dir['bd'],
+ '--max-concurrent-tests=20',
+ '--port', testport.to_string(),
+ ] + t.get('regress_args', [])
+
+ if t.has_key('schedule')
+ test_command += ['--schedule', t['schedule'],]
+ endif
+
+ if kind == 'isolation'
+ test_command += t.get('specs', [])
+ else
+ test_command += t.get('sql', [])
+ endif
+
+ env = test_env
+ env.prepend('PATH', temp_install_bindir, test_dir['bd'])
+
+ test_kwargs = {
+ 'suite': [test_dir['name']],
+ 'priority': 10,
+ 'timeout': 1000,
+ 'depends': test_deps + t.get('deps', []),
+ 'env': env,
+ } + t.get('test_kwargs', {})
+
+ test(test_dir['name'] / kind,
+ python,
+ args: testwrap_base + [
+ '--testname', kind,
+ '--', test_command,
+ ],
+ kwargs: test_kwargs,
+ )
+
+ testport += 1
+ elif kind == 'tap'
+ if not tap_tests_enabled
+ continue
+ endif
+
+ test_command = [
+ perl.path(),
+ '-I', meson.source_root() / 'src/test/perl',
+ '-I', test_dir['sd'],
+ ]
+
+ # Add temporary install, the build directory for non-installed binaries and
+ # also test/ for non-installed test binaries built separately.
+ env = test_env
+ env.prepend('PATH', temp_install_bindir, test_dir['bd'], test_dir['bd'] / 'test')
+
+ foreach name, value : t.get('env', {})
+ env.set(name, value)
+ endforeach
+
+ test_kwargs = {
+ 'protocol': 'tap',
+ 'suite': [test_dir['name']],
+ 'timeout': 1000,
+ 'depends': test_deps + t.get('deps', []),
+ 'env': env,
+ } + t.get('test_kwargs', {})
+
+ foreach onetap : t['tests']
+ # Make tap test names prettier, remove t/ and .pl
+ onetap_p = onetap
+ if onetap_p.startswith('t/')
+ onetap_p = onetap.split('t/')[1]
+ endif
+ if onetap_p.endswith('.pl')
+ onetap_p = fs.stem(onetap_p)
+ endif
+
+ test(test_dir['name'] / onetap_p,
+ python,
+ kwargs: test_kwargs,
+ args: testwrap_base + [
+ '--testname', onetap_p,
+ '--', test_command,
+ test_dir['sd'] / onetap,
+ ],
+ )
+ endforeach
+ else
+ error('unknown kind @0@ of test in @1@'.format(kind, test_dir['sd']))
+ endif
+
+ endforeach # kinds of tests
+
+endforeach # directories with tests
+
+
+
+###############################################################
+# Pseudo targets
+###############################################################
+
+alias_target('backend', backend_targets)
+alias_target('bin', bin_targets + [libpq_st])
+alias_target('pl', pl_targets)
+alias_target('contrib', contrib_targets)
+alias_target('testprep', testprep_targets)
+
+
+
+###############################################################
+# The End, The End, My Friend
+###############################################################
+
+if meson.version().version_compare('>=0.57')
+
+ summary(
+ {
+ 'data block size': cdata.get('BLCKSZ'),
+ 'WAL block size': cdata.get('XLOG_BLCKSZ') / 1024,
+ 'segment size': cdata.get('RELSEG_SIZE') / 131072,
+ },
+ section: 'Data layout',
+ )
+
+ summary(
+ {
+ 'host system': '@0@ @1@'.format(host_system, host_cpu),
+ 'build system': '@0@ @1@'.format(build_machine.system(),
+ build_machine.cpu_family()),
+ },
+ section: 'System',
+ )
+
+ summary(
+ {
+ 'linker': '@0@'.format(cc.get_linker_id()),
+ 'C compiler': '@0@ @1@'.format(cc.get_id(), cc.version()),
+ },
+ section: 'Compiler',
+ )
+
+ summary(
+ {
+ 'CPP FLAGS': ' '.join(cppflags),
+ 'C FLAGS, functional': ' '.join(cflags),
+ 'C FLAGS, warnings': ' '.join(cflags_warn),
+ },
+ section: 'Compiler Flags',
+ )
+
+ if llvm.found()
+ summary(
+ {
+ 'C++ compiler': '@0@ @1@'.format(cpp.get_id(), cpp.version()),
+ },
+ section: 'Compiler',
+ )
+
+ summary(
+ {
+ 'C++ FLAGS, functional': ' '.join(cxxflags),
+ 'C++ FLAGS, warnings': ' '.join(cxxflags_warn),
+ },
+ section: 'Compiler Flags',
+ )
+ endif
+
+ summary(
+ {
+ 'bison': '@0@ @1@'.format(bison.full_path(), bison_version),
+ 'dtrace': dtrace,
+ },
+ section: 'Programs',
+ )
+
+ summary(
+ {
+ 'bonjour': bonjour,
+ 'bsd_auth': bsd_auth,
+ 'gss': gssapi,
+ 'icu': icu,
+ 'ldap': ldap,
+ 'libxml': libxml,
+ 'libxslt': libxslt,
+ 'llvm': llvm,
+ 'lz4': lz4,
+ 'nls': libintl,
+ 'pam': pam,
+ 'plperl': perl_dep,
+ 'plpython': python3_dep,
+ 'pltcl': tcl_dep,
+ 'readline': readline,
+ 'selinux': selinux,
+ 'ssl': ssl,
+ 'systemd': systemd,
+ 'uuid': uuid,
+ 'zlib': zlib,
+ 'zstd': zstd,
+ },
+ section: 'External libraries',
+ )
+
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..e847755caa4
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,185 @@
+# Data layout influencing options
+
+option('blocksize', type : 'combo',
+ choices : ['1', '2', '4', '8', '16', '32'],
+ value : '8',
+ description: 'set relation block size in kB')
+
+option('wal_blocksize', type : 'combo',
+ choices: ['1', '2', '4', '8', '16', '32', '64'],
+ value: '8',
+ description : '''WAL block size, in kilobytes''')
+
+option('segsize', type : 'integer', value : 1,
+ description : '''Segment size, in gigabytes''')
+
+
+# Miscellaneous options
+
+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')
+
+
+# Defaults
+
+option('pgport', type : 'integer', value : 5432,
+ min: 1, max: 65535,
+ description : '''Default port number for server and clients''')
+
+
+# Developer options
+
+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')
+
+option('PG_TEST_EXTRA', type : 'string', value: 'kerberos ldap ssl',
+ description: 'Enable selected extra tests')
+
+option('atomics', type : 'boolean', value: true,
+ description: 'whether to use atomic operations')
+
+option('spinlocks', type : 'boolean', value: true,
+ description: 'whether to use spinlocks')
+
+
+# Compilation options
+
+option('extra_include_dirs', type : 'array', value: [],
+ 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')
+
+option('extra_version', type : 'string', value: '',
+ description: 'append STRING to the PostgreSQL version number')
+
+option('darwin_sysroot', type : 'string', value: '',
+ description: 'select a non-default sysroot path')
+
+
+# External dependencies
+
+option('bonjour', type : 'feature', value: 'auto',
+ description: 'build with Bonjour support')
+
+option('bsd_auth', type : 'feature', value: 'auto',
+ description: 'build with BSD Authentication support')
+
+option('dtrace', type : 'feature', value: 'disabled',
+ description: 'DTrace support')
+
+option('gssapi', type : 'feature', value: 'auto',
+ description: 'GSSAPI support')
+
+option('icu', type : 'feature', value: 'auto',
+ description: 'ICU support')
+
+option('ldap', type : 'feature', value: 'auto',
+ description: 'LDAP support')
+
+option('libedit_preferred', type : 'boolean', value: false,
+ description: 'Prefer BSD Libedit over GNU Readline')
+
+option('libxml', type : 'feature', value: 'auto',
+ description: 'XML support')
+
+option('libxslt', type : 'feature', value: 'auto',
+ description: 'XSLT support in contrib/xml2')
+
+option('llvm', type : 'feature', value: 'disabled',
+ description: 'whether to use llvm')
+
+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',
+ description: 'build with PAM support')
+
+option('plperl', type : 'feature', value: 'auto',
+ description: 'build Perl modules (PL/Perl)')
+
+option('plpython', type : 'feature', value: 'auto',
+ description: 'build Python modules (PL/Python)')
+
+option('pltcl', type : 'feature', value: 'auto',
+ description: 'build with TCL support')
+
+option('tcl_version', type : 'string', value : 'tcl',
+ description: 'specify 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')
+
+option('ssl', type : 'combo', choices : ['none', 'openssl'],
+ value : 'none',
+ description: 'use LIB for SSL/TLS support (openssl)')
+
+option('systemd', type : 'feature', value: 'auto',
+ description: 'build with systemd support')
+
+option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'],
+ value : 'none',
+ description: 'build contrib/uuid-ossp using LIB')
+
+option('zlib', type : 'feature', value: 'auto',
+ description: 'whether to use zlib')
+
+option('zstd', type : 'feature', value: 'auto',
+ description: 'whether to use zstd')
+
+
+# Programs
+
+option('BISON', type : 'array', value: ['bison', 'win_bison'],
+ description: 'path to bison binary')
+
+option('DTRACE', type : 'string', value: 'dtrace',
+ description: 'path to dtrace binary')
+
+option('FLEX', type : 'array', value: ['flex', 'win_flex'],
+ description: 'path to flex binary')
+
+option('GZIP', type : 'string', value: 'gzip',
+ description: 'path to gzip binary')
+
+option('LZ4', type : 'string', value: 'lz4',
+ description: 'path to lz4 binary')
+
+option('PERL', type : 'string', value: 'perl',
+ description: 'path to perl binary')
+
+option('PROVE', type : 'string', value: 'prove',
+ description: 'path to prove binary')
+
+option('PYTHON', type : 'array', value: ['python3', 'python'],
+ description: 'path to python binary')
+
+option('SED', type : 'string', value: 'gsed',
+ description: 'path to sed binary')
+
+option('TAR', type : 'string', value: 'tar',
+ description: 'path to tar binary')
+
+option('XMLLINT', type : 'string', value: 'xmllint',
+ description: 'path to xmllint binary')
+
+option('XSLTPROC', type : 'string', value: 'xsltproc',
+ description: 'path to xsltproc binary')
+
+option('ZSTD', type : 'string', value: 'zstd',
+ description: 'path to zstd binary')
+
+option('ZIC', type : 'string', value: 'zic',
+ description: 'path to zic binary, when cross-compiling')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000000..a7fdd5a13ed
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,12 @@
+# libraries that other subsystems might depend uppon first, in their
+# respective dependency order
+
+subdir('timezone')
+
+subdir('backend')
+
+subdir('bin')
+
+subdir('pl')
+
+subdir('interfaces')
diff --git a/src/timezone/meson.build b/src/timezone/meson.build
new file mode 100644
index 00000000000..daf8b4aa44f
--- /dev/null
+++ b/src/timezone/meson.build
@@ -0,0 +1,56 @@
+# files to build into backend
+timezone_sources = files(
+ 'localtime.c',
+ 'pgtz.c',
+ 'strftime.c',
+)
+
+
+timezone_inc = include_directories('.')
+
+timezone_localtime_source = files('localtime.c')
+
+# files needed to build zic utility program
+zic_sources = files(
+ 'zic.c'
+)
+
+# we now distribute the timezone data as a single file
+tzdata = files(
+ 'data/tzdata.zi'
+)
+
+
+if get_option('system_tzdata') == ''
+ # FIXME: For cross builds, it would need a native built libpgport/pgcommon to
+ # build our zic. But for that we'd need to run a good chunk of the configure
+ # tests both natively and cross. Unclear if it's worth it.
+ if meson.is_cross_build()
+ zic = find_program(get_option('ZIC'), native: true, required: true)
+ else
+ zic = executable('zic', zic_sources,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args + {'install': false}
+ )
+ endif
+
+ tzdata = custom_target('tzdata',
+ input: tzdata,
+ output: ['timezone'],
+ command: [zic, '-d', '@OUTPUT@', '@INPUT@'],
+ install: true,
+ install_dir: dir_data,
+ )
+
+ bin_targets += tzdata
+
+ # FIXME: make sorts this - but the file isn't actually used, so ...
+ custom_target('abbrevs.txt',
+ input: tzdata,
+ output: ['abbrevs.txt'],
+ command: [zic, '-P', '-b', 'fat', 'junkdir', '@INPUT@'],
+ capture: true)
+
+endif
+
+subdir('tznames')
diff --git a/src/timezone/tznames/meson.build b/src/timezone/tznames/meson.build
new file mode 100644
index 00000000000..7e0a682bd9e
--- /dev/null
+++ b/src/timezone/tznames/meson.build
@@ -0,0 +1,21 @@
+tznames = files(
+ 'Africa.txt',
+ 'America.txt',
+ 'Antarctica.txt',
+ 'Asia.txt',
+ 'Atlantic.txt',
+ 'Australia.txt',
+ 'Etc.txt',
+ 'Europe.txt',
+ 'Indian.txt',
+ 'Pacific.txt',
+)
+
+tznames_sets = files(
+ 'Default',
+ 'Australia',
+ 'India')
+
+install_data(tznames, tznames_sets,
+ install_dir: dir_data / 'timezonesets',
+)
diff --git a/src/tools/find_meson b/src/tools/find_meson
new file mode 100755
index 00000000000..50e501a8011
--- /dev/null
+++ b/src/tools/find_meson
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+# Returns the path to the meson binary, for cases where we need to call it as
+# part of the build, e.g. to install into tmp_install/ for the tests.
+
+import os
+import shlex
+import sys
+
+to_print = []
+
+if 'MUON_PATH' in os.environ:
+ to_print += ['muon', os.environ['MUON_PATH']]
+else:
+ mesonintrospect = os.environ['MESONINTROSPECT']
+ components = shlex.split(mesonintrospect)
+
+ if len(components) < 2:
+ print('expected more than two components, got: %s' % components)
+ sys.exit(1)
+
+ if components[-1] != 'introspect':
+ print('expected introspection at the end')
+ sys.exit(1)
+
+ to_print += ['meson'] + components[:-1]
+
+print('\n'.join(to_print), end='')
+
+sys.exit(0)
diff --git a/src/tools/pgflex b/src/tools/pgflex
new file mode 100755
index 00000000000..baabe2df1c8
--- /dev/null
+++ b/src/tools/pgflex
@@ -0,0 +1,85 @@
+#!/usr/bin/env python3
+
+#
+# Wrapper around flex that:
+# - ensures lex.backup is created in a private directory
+# - can error out if lex.backup is created (--no-backup)
+# - can fix warnings (--fix-warnings)
+# - works around concurrency issues with win_flex.exe:
+# https://github.com/lexxmark/winflexbison/issues/86
+
+import argparse
+import os
+import subprocess
+import sys
+from os.path import abspath
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--flex', type=abspath, required=True)
+parser.add_argument('--perl', type=abspath, required=True)
+parser.add_argument('--builddir', type=abspath, required=True)
+parser.add_argument('--srcdir', type=abspath, required=True)
+parser.add_argument('--privatedir', type=abspath, required=True,
+ help='private directory for target')
+
+parser.add_argument('-o', dest='output_file', type=abspath, required=True,
+ help='output file')
+parser.add_argument('-i', dest='input_file', type=abspath, help='input file')
+
+
+parser.add_argument('--fix-warnings', action='store_true',
+ help='whether to fix warnings in generated file')
+parser.add_argument('--no-backup', action='store_true',
+ help='whether no_backup is enabled or not')
+
+parser.add_argument('flex_flags', nargs='*', help='flags passed on to flex')
+
+args = parser.parse_args()
+
+# Since 'lex.backup' is always named that and ninja uses the top level build
+# directory as current directory for all commands, change directory to
+# temporary directory to avoid conflicts between concurrent flex
+# invocations. Only unreleased versions of flex have an argument to change
+# lex.filename to be named differently.
+if not os.path.isdir(args.privatedir):
+ os.mkdir(args.privatedir)
+os.chdir(args.privatedir)
+
+# win_flex.exe generates names in a racy way, sometimes leading to random
+# "error deleting file" failures and sometimes to intermingled file
+# contents. Set FLEX_TMP_DIR to the target private directory to avoid
+# that. That environment variable isn't consulted on other platforms, so we
+# don't even need to make this conditional.
+env = {'FLEX_TMP_DIR': args.privatedir}
+
+# build flex invocation
+command = [args.flex, '-o', args.output_file]
+if args.no_backup:
+ command += ['-b']
+command += args.flex_flags
+command += [args.input_file]
+
+# create .c file from .l file
+sp = subprocess.run(command, env=env)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# check lex.backup
+if args.no_backup:
+ with open('lex.backup') as lex:
+ if len(lex.readlines()) != 1:
+ sys.exit('Scanner requires backup; see lex.backup.')
+ os.remove('lex.backup')
+
+# fix warnings
+if args.fix_warnings:
+ fix_warning_script = os.path.join(args.srcdir,
+ 'src/tools/fix-old-flex-code.pl')
+
+ command = [args.perl, fix_warning_script, args.output_file]
+ sp = subprocess.run(command)
+ if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+sys.exit(0)
diff --git a/src/tools/testwrap b/src/tools/testwrap
new file mode 100755
index 00000000000..7a64fe76a2d
--- /dev/null
+++ b/src/tools/testwrap
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+
+import argparse
+import shutil
+import subprocess
+import os
+import sys
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--srcdir', help='source directory of test', type=str)
+parser.add_argument('--basedir', help='base directory of test', type=str)
+parser.add_argument('--testgroup', help='test group', type=str)
+parser.add_argument('--testname', help='test name', type=str)
+parser.add_argument('test_command', nargs='*')
+
+args = parser.parse_args()
+
+testdir = '{}/testrun/{}/{}'.format(
+ args.basedir, args.testgroup, args.testname)
+
+print('# executing test in {} group {} test {}'.format(
+ testdir, args.testgroup, args.testname))
+sys.stdout.flush()
+
+if os.path.exists(testdir) and os.path.isdir(testdir):
+ shutil.rmtree(testdir)
+os.makedirs(testdir)
+
+os.chdir(args.srcdir)
+
+# mark test as having started
+open(os.path.join(testdir, 'test.start'), 'x')
+
+env_dict = {**os.environ,
+ 'TESTDATADIR': os.path.join(testdir, 'data'),
+ 'TESTLOGDIR': os.path.join(testdir, 'log')}
+
+sp = subprocess.run(args.test_command, env=env_dict)
+
+if sp.returncode == 0:
+ print('# test succeeded')
+ open(os.path.join(testdir, 'test.success'), 'x')
+else:
+ print('# test failed')
+ open(os.path.join(testdir, 'test.fail'), 'x')
+sys.exit(sp.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0009-ci-windows-set-error-mode-to-not-include-SEM_NOG.patch (1.6K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/10-v13-0009-ci-windows-set-error-mode-to-not-include-SEM_NOG.patch)
download | inline diff:
From 4ea8b4291afc676e71713970186da5e112918a0e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 9 Sep 2022 14:52:00 -0700
Subject: [PATCH v13 09/20] ci: windows: set error mode to not include
SEM_NOGPFAULTERRORBOX
This allows crashdumps to work and fixes an odd python crash.
Discussion: https://postgr.es/m/20220909235836.lz3igxtkcjb5w7zb%40awork3.anarazel.de
---
.cirrus.yml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/.cirrus.yml b/.cirrus.yml
index 81eb8a9996d..7034352c487 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -386,6 +386,15 @@ task:
# currently have a tool for that...
CIRRUS_ESCAPING_PROCESSES: 1
+ # Cirrus defaults to SetErrorMode(SEM_NOGPFAULTERRORBOX | ...). That
+ # prevents crash reporting from working unless binaries do SetErrorMode()
+ # themselves. Furthermore, it appears that either python or, more likely,
+ # the C runtime has a bug where SEM_NOGPFAULTERRORBOX can very
+ # occasionally *trigger* a crash on process exit - which is hard to debug,
+ # given that it explicitly prevents crash dumps from working...
+ # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
+ CIRRUS_WINDOWS_ERROR_MODE: 0x8001
+
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
windows_container:
@@ -398,6 +407,7 @@ task:
systeminfo
powershell -Command get-psdrive -psprovider filesystem
set
+ python -c "import msvcrt; print(hex(msvcrt.GetErrorMode()))"
setup_additional_packages_script: |
REM choco install -y --no-progress ...
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0010-meson-ci-Build-both-with-meson-and-as-before.patch (31.1K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/11-v13-0010-meson-ci-Build-both-with-meson-and-as-before.patch)
download | inline diff:
From f0f906d56347ab56735a4159b7a55f1b4fbd7a60 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 20 Apr 2022 12:08:09 -0700
Subject: [PATCH v13 10/20] meson: ci: Build both with meson and as before
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Justin Pryzby <pryzby@telsasoft.com>
---
.cirrus.yml | 843 +++++++++++++++++-
src/tools/ci/docker/linux_centos7 | 57 ++
src/tools/ci/docker/linux_centos8 | 54 ++
src/tools/ci/docker/linux_fedora_rawhide | 49 +
src/tools/ci/docker/linux_opensuse_tumbleweed | 56 ++
5 files changed, 1013 insertions(+), 46 deletions(-)
create mode 100644 src/tools/ci/docker/linux_centos7
create mode 100644 src/tools/ci/docker/linux_centos8
create mode 100644 src/tools/ci/docker/linux_fedora_rawhide
create mode 100644 src/tools/ci/docker/linux_opensuse_tumbleweed
diff --git a/.cirrus.yml b/.cirrus.yml
index 7034352c487..5a7a93baf4c 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -22,13 +22,14 @@ env:
CHECK: check-world PROVE_FLAGS=$PROVE_FLAGS
CHECKFLAGS: -Otarget
PROVE_FLAGS: --timer
+ MTEST_ARGS: --print-errorlogs --no-rebuild -C build
PGCTLTIMEOUT: 120 # avoids spurious failures during parallel tests
TEMP_CONFIG: ${CIRRUS_WORKING_DIR}/src/tools/ci/pg_ci_base.conf
PG_TEST_EXTRA: kerberos ldap ssl
# What files to preserve in case tests fail
-on_failure: &on_failure
+on_failure_ac: &on_failure_ac
log_artifacts:
paths:
- "**/*.log"
@@ -36,9 +37,41 @@ on_failure: &on_failure
- "**/regress_log_*"
type: text/plain
-task:
- name: FreeBSD - 13
+on_failure_meson: &on_failure_meson
+ testrun_artifacts:
+ paths:
+ - "build/testrun/**/*.log"
+ - "build/testrun/**/*.diffs"
+ - "build/testrun/**/regress_log_*"
+ type: text/plain
+ # In theory it'd be nice to upload the junit files meson generates, so that
+ # cirrus will nicely annotate the commit. Unfortunately the files don't
+ # contain identifyable file + line numbers right now, so the annotations
+ # don't end up useful. We could probably improve on that with a some custom
+ # conversion script, but ...
+ meson_log_artifacts:
+ path: "build/meson-logs/*.txt"
+ type: text/plain
+
+
+# configure feature flags, shared between the task running the BSD tests
+# these feature flags don't include --with-gssapi and --with-uuid=bsd
+# since these are not working on openBSD and netBSD
+BSD_CONFIGURE_FEATURES: &BSD_CONFIGURE_FEATURES >-
+ --with-icu
+ --with-ldap
+ --with-libxml
+ --with-libxslt
+ --with-lz4
+ --with-pam
+ --with-perl
+ --with-python
+ --with-ssl=openssl
+ --with-tcl --with-tclconfig=${TCL_CONFIG_PATH}
+
+
+freebsd_template: &freebsd_template
env:
# FreeBSD on GCP is slow when running with larger number of CPUS /
# jobs. Using one more job than cpus seems to work best.
@@ -48,6 +81,12 @@ task:
CCACHE_DIR: /tmp/ccache_dir
+ TCL_CONFIG_PATH: /usr/local/lib/tcl8.6/
+
+ CFLAGS: "-Og -ggdb"
+
+ BSD_CONFIGURE_FEATURES: *BSD_CONFIGURE_FEATURES
+
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
compute_engine_instance:
@@ -80,6 +119,13 @@ task:
setup_additional_packages_script: |
#pkg install -y ...
+
+task:
+ <<: *freebsd_template
+
+ name: FreeBSD - 13 - Autoconf
+ trigger_type: manual
+
# NB: Intentionally build without --with-llvm. The freebsd image size is
# already large enough to make VM startup slow, and even without llvm
# freebsd already takes longer than other platforms except for windows.
@@ -90,16 +136,7 @@ task:
--enable-nls \
\
--with-gssapi \
- --with-icu \
- --with-ldap \
- --with-libxml \
- --with-libxslt \
- --with-lz4 \
- --with-pam \
- --with-perl \
- --with-python \
- --with-ssl=openssl \
- --with-tcl --with-tclconfig=/usr/local/lib/tcl8.6/ \
+ ${BSD_CONFIGURE_FEATURES} \
--with-uuid=bsd \
--with-zstd \
\
@@ -107,8 +144,7 @@ task:
--with-libs=/usr/local/lib \
\
CC="ccache cc" \
- CXX="ccache c++" \
- CFLAGS="-Og -ggdb"
+ CXX="ccache c++"
EOF
build_script: su postgres -c "gmake -s -j${BUILD_JOBS} world-bin"
upload_caches: ccache
@@ -117,14 +153,274 @@ task:
# platforms without support for locking pipes. See also
# https://savannah.gnu.org/bugs/?60774
# script uses pseudo-ttys, which do support locking.
- test_world_script:
- - su postgres -c "time script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}"
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ time script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}
+ EOF
on_failure:
- <<: *on_failure
+ <<: *on_failure_ac
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ <<: *freebsd_template
+
+ name: FreeBSD - 13 - Meson
+
+ configure_script:
+ - su postgres -c 'meson setup --buildtype debug -Dcassert=true -Dssl=openssl -Duuid=bsd -Dtcl_version=tcl86 -Ddtrace=auto build'
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+ cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+
+
+netbsd_template: &netbsd_template
+ env:
+ CPUS: 2
+ BUILD_JOBS: 3
+ TEST_JOBS: 3
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+ TCL_CONFIG_PATH: /usr/pkg/lib
+
+ # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+ # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+
+ CFLAGS: "-Og -ggdb"
+
+ BSD_CONFIGURE_FEATURES: *BSD_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+
+ compute_engine_instance:
+ image_project: $IMAGE_PROJECT
+ image: family/pg-ci-netbsd-9-postgres
+ platform: netbsd
+ cpu: $CPUS
+ memory: 4G
+ disk: 25
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ export
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+
+task:
+ <<: *netbsd_template
+
+ name: NetBSD - 9 - Autoconf
+ trigger_type: manual
+
+ # --with-uuid=bsd is not set since 'bsd' uuid option
+ # is not working on netBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on netBSD
+ configure_script: |
+ su postgres <<-EOF
+ ./configure \
+ --enable-cassert --enable-debug --enable-tap-tests \
+ --enable-nls \
+ \
+ ${BSD_CONFIGURE_FEATURES} \
+ \
+ --with-includes=/usr/pkg/include --with-libs=/usr/pgk/lib \
+ CC="ccache cc" \
+ CXX="ccache c++" \
+ LDFLAGS="-Wl,-R/usr/pkg/lib" \
+ \
+ PYTHON=python3.9
+ EOF
+ build_script: su postgres -c "gmake -s -j${BUILD_JOBS} world-bin"
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ gmake -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_ac
+
+
+task:
+ <<: *netbsd_template
+
+ name: NetBSD - 9 - Meson
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on netBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on netBSD
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl \
+ -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
+openbsd_template: &openbsd_template
+ env:
+ CPUS: 2
+ BUILD_JOBS: 3
+ TEST_JOBS: 3
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+ TCL_CONFIG_PATH: /usr/local/lib/tcl/tcl8.6/
+
+ # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+ # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+
+ CFLAGS: "-Og -ggdb"
+
+ BSD_CONFIGURE_FEATURES: *BSD_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+
+ compute_engine_instance:
+ image_project: $IMAGE_PROJECT
+ image: family/pg-ci-openbsd-7-postgres
+ platform: openbsd
+ cpu: $CPUS
+ memory: 4G
+ disk: 25
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ export
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:postgres /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:postgres ${CCACHE_DIR}
+
+
+task:
+ <<: *openbsd_template
+
+ name: OpenBSD - 7 - Autoconf
+ trigger_type: manual
+
+ # --with-uuid option is set to 'e2fs' since 'bsd' uuid option
+ # is not working on openBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # (same error applies for openBSD)
+ configure_script: |
+ su postgres <<-EOF
+ ./configure \
+ --enable-cassert --enable-debug --enable-tap-tests \
+ --enable-nls \
+ \
+ ${BSD_CONFIGURE_FEATURES} \
+ --with-uuid=e2fs \
+ \
+ --with-includes=/usr/local/include --with-libs=/usr/local/lib \
+ CC="ccache cc" \
+ CXX="ccache c++" \
+ LDFLAGS="-Wl,-R/usr/local/lib"
+ EOF
+ build_script: su postgres -c "gmake -s -j${BUILD_JOBS} world-bin"
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ gmake -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_ac
+
+
+task:
+ <<: *openbsd_template
+
+ name: OpenBSD - 7 - Meson
+
+ # -Duuid option is set to 'e2fs' since 'bsd' uuid option
+ # is not working on openBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # (same error applies for openBSD)
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl -Duuid=e2fs \
+ -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
@@ -141,14 +437,28 @@ LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
--with-selinux
--with-ssl=openssl
--with-systemd
- --with-tcl --with-tclconfig=/usr/lib/tcl8.6/
- --with-uuid=ossp
+ --with-tcl --with-tclconfig=${TCL_DIR:/usr/lib/tcl8.6/}
+ --with-uuid=${UUID:ossp}
--with-zstd
-task:
- name: Linux - Debian Bullseye
+# configure preparation scripts, shared between tasks running the linux tests
+linux_preparation_scripts_template: &linux_preparation_scripts_template
+ sysinfo_script: |
+ id
+ uname -a
+ cat /proc/cmdline
+ ulimit -a -H && ulimit -a -S
+ export
+ create_user_script: |
+ useradd -m -U postgres
+ chown -R postgres:postgres .
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:postgres ${CCACHE_DIR}
+ su postgres -c "ulimit -l -H && ulimit -l -S"
+
+linux_debian_template: &linux_debian_template
env:
CPUS: 4
BUILD_JOBS: 4
@@ -157,6 +467,9 @@ task:
CCACHE_DIR: /tmp/ccache_dir
DEBUGINFOD_URLS: "https://debuginfod.debian.net"
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
@@ -171,19 +484,9 @@ task:
ccache_cache:
folder: ${CCACHE_DIR}
- sysinfo_script: |
- id
- uname -a
- cat /proc/cmdline
- ulimit -a -H && ulimit -a -S
- export
- create_user_script: |
- useradd -m postgres
- chown -R postgres:postgres .
- mkdir -p ${CCACHE_DIR}
- chown -R postgres:postgres ${CCACHE_DIR}
+ set_limits_script: |
echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
- su postgres -c "ulimit -l -H && ulimit -l -S"
+ <<: *linux_preparation_scripts_template
setup_core_files_script: |
mkdir -m 770 /tmp/cores
chown root:postgres /tmp/cores
@@ -192,6 +495,12 @@ task:
#apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y install ...
+
+task:
+ <<: *linux_debian_template
+
+ name: Linux - Debian Bullseye - Autoconf
+
configure_script: |
su postgres <<-EOF
./configure \
@@ -202,9 +511,7 @@ task:
\
CC="ccache gcc" \
CXX="ccache g++" \
- CLANG="ccache clang" \
- CFLAGS="-Og -ggdb" \
- CXXFLAGS="-Og -ggdb"
+ CLANG="ccache clang"
EOF
build_script: su postgres -c "make -s -j${BUILD_JOBS} world-bin"
upload_caches: ccache
@@ -216,13 +523,353 @@ task:
EOF
on_failure:
- <<: *on_failure
+ <<: *on_failure_ac
+ cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
+
+
+task: &linux_debian_bullseye_meson
+ <<: *linux_debian_template
+
+ name: Linux - Debian Bullseye - Meson
+
+ configure_script:
+ - su postgres -c 'meson setup --buildtype debug -Dcassert=true -Dssl=openssl -Duuid=e2fs -Ddtrace=enabled build'
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
task:
- name: macOS - Monterey
+ <<: *linux_debian_bullseye_meson
+ name: Linux - Debian Sid - Meson
+ trigger_type: manual
+
+ compute_engine_instance:
+ image: family/pg-ci-sid
+
+
+linux_opensuse_template: &linux_opensuse_template
+ env:
+ CPUS: 4
+ BUILD_JOBS: 4
+ TEST_JOBS: 8 # experimentally derived to be a decent choice
+
+ CCACHE_DIR: /tmp/ccache_dir
+ DEBUGINFOD_URLS: "https://debuginfod.opensuse.org/"
+
+ TCL_DIR: /usr/lib64/
+ UUID: e2fs
+
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
+ LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
+
+ container:
+ dockerfile: src/tools/ci/docker/linux_opensuse_tumbleweed
+ cpu: $CPUS
+ memory: 4G
+
+ ccache_cache:
+ folder: ${CCACHE_DIR}
+
+ <<: *linux_preparation_scripts_template
+
+
+task:
+ <<: *linux_opensuse_template
+
+ name: Linux - OpenSuse Tumbleweed - Autoconf
+ trigger_type: manual
+
+ configure_script: |
+ su postgres <<-EOF
+ export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" && \
+ ./configure \
+ --enable-cassert --enable-debug --enable-tap-tests \
+ --enable-nls \
+ \
+ ${LINUX_CONFIGURE_FEATURES}
+ \
+ CC="ccache gcc" \
+ CXX="ccache g++" \
+ CLANG="ccache clang"
+ EOF
+ build_script: su postgres -c 'make -s -j${BUILD_JOBS} world-bin'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_ac
+
+
+task:
+ <<: *linux_opensuse_template
+
+ name: Linux - OpenSuse Tumbleweed (LLVM) - Meson
+
+ configure_script:
+ - su postgres -c 'meson setup --buildtype debug -Dcassert=true -Dssl=openssl -Duuid=e2fs -Dllvm=enabled build'
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
+linux_rhel_template: &linux_rhel_template
+ env:
+ CPUS: 4
+ BUILD_JOBS: 4
+ TEST_JOBS: 8 # experimentally derived to be a decent choice
+
+ CCACHE_DIR: /tmp/ccache_dir
+ DEBUGINFOD_URLS: ${DEBUGINFO}
+
+ TCL_DIR: /usr/lib64/
+ UUID: e2fs
+
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
+ LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
+
+ container:
+ dockerfile: ${DOCKERFILE_PATH}
+ cpu: $CPUS
+ memory: 4G
+
+ ccache_cache:
+ folder: ${CCACHE_DIR}
+
+ <<: *linux_preparation_scripts_template
+
+
+task:
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_fedora_rawhide
+ DEBUGINFO: "https://debuginfod.fedoraproject.org/"
+
+ <<: *linux_rhel_template
+
+ name: Linux - Fedora Rawhide - Autoconf
+ trigger_type: manual
+
+ configure_script: |
+ su postgres <<-EOF
+ ./configure \
+ --enable-cassert --enable-debug --enable-tap-tests \
+ --enable-nls \
+ \
+ ${LINUX_CONFIGURE_FEATURES}
+ \
+ CC="ccache gcc" \
+ CXX="ccache g++" \
+ CLANG="ccache clang"
+ EOF
+ build_script: su postgres -c 'make -s -j${BUILD_JOBS} world-bin'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_ac
+
+
+task:
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_fedora_rawhide
+ DEBUGINFO: "https://debuginfod.fedoraproject.org/"
+
+ <<: *linux_rhel_template
+
+ name: Linux - Fedora Rawhide - Meson
+ trigger_type: manual
+
+ configure_script:
+ - su postgres -c 'meson setup --buildtype debug -Dcassert=true -Dssl=openssl -Duuid=e2fs build'
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
+task:
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos8
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ <<: *linux_rhel_template
+
+ name: Linux - Centos 8 - Autoconf
+ trigger_type: manual
+
+ configure_script: |
+ su postgres <<-EOF
+ ./configure \
+ --enable-cassert --enable-debug --enable-tap-tests \
+ --enable-nls \
+ \
+ ${LINUX_CONFIGURE_FEATURES}
+ \
+ CC="ccache gcc" \
+ CXX="ccache g++" \
+ CLANG="ccache clang"
+ EOF
+ build_script: su postgres -c 'make -s -j${BUILD_JOBS} world-bin'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_ac
+
+
+task:
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos8
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ <<: *linux_rhel_template
+
+ name: Linux - Centos 8 - Meson
+ trigger_type: manual
+
+ configure_script:
+ - su postgres -c 'meson setup --buildtype debug -Dcassert=true -Dssl=openssl -Duuid=e2fs build'
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
+task:
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ <<: *linux_rhel_template
+
+ name: Linux - Centos 7 - Autoconf
+ trigger_type: manual
+
+ configure_script: |
+ su postgres <<-EOF
+ PYTHON=python3 \
+ ./configure \
+ --enable-cassert --enable-debug --enable-tap-tests \
+ --enable-nls \
+ \
+ --with-gssapi \
+ --with-icu \
+ --with-ldap \
+ --with-libxml \
+ --with-libxslt \
+ --with-lz4 \
+ --with-pam \
+ --with-perl \
+ --with-python \
+ --with-selinux \
+ --with-ssl=openssl \
+ --with-systemd \
+ --with-tcl --with-tclconfig=/usr/lib64/ \
+ --with-uuid=e2fs \
+ \
+ CC="ccache gcc" \
+ CXX="ccache g++" \
+ CLANG="ccache clang"
+ EOF
+ build_script: su postgres -c 'make -s -j${BUILD_JOBS} world-bin'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ make -s ${CHECK} ${CHECKFLAGS} -j${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_ac
+
+
+task:
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ <<: *linux_rhel_template
+
+ name: Linux - Centos 7 - Meson
+ trigger_type: manual
+
+ configure_script:
+ - su postgres -c 'meson setup --buildtype debug -Dcassert=true -Dssl=openssl -Duuid=e2fs build'
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
+macos_template: &macos_template
env:
CPUS: 12 # always get that much for cirrusci macOS instances
BUILD_JOBS: $CPUS
@@ -233,6 +880,9 @@ task:
HOMEBREW_CACHE: ${HOME}/homebrew-cache
PERL5LIB: ${HOME}/perl5/lib/perl5
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
osx_instance:
@@ -269,6 +919,7 @@ task:
llvm \
lz4 \
make \
+ meson \
openldap \
openssl \
python \
@@ -280,6 +931,14 @@ task:
ccache_cache:
folder: $CCACHE_DIR
+
+
+task:
+ <<: *macos_template
+
+ name: macOS - Monterey - Autoconf
+ trigger_type: manual
+
configure_script: |
brewpath="/usr/local"
INCLUDES="${brewpath}/include:${INCLUDES}"
@@ -319,8 +978,6 @@ task:
CC="ccache cc" \
CXX="ccache c++" \
CLANG="ccache ${brewpath}/llvm/bin/ccache" \
- CFLAGS="-Og -ggdb" \
- CXXFLAGS="-Og -ggdb" \
\
LLVM_CONFIG=${brewpath}/llvm/bin/llvm-config \
PYTHON=python3
@@ -334,13 +991,48 @@ task:
script test.log gmake -s -j${TEST_JOBS} ${CHECK} ${CHECKFLAGS}
on_failure:
- <<: *on_failure
+ <<: *on_failure_ac
cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
task:
- name: Windows - Server 2019, VS 2019
+ <<: *macos_template
+ name: macOS - Monterey - Meson
+
+ configure_script: |
+ brewpath="/usr/local"
+ PKG_CONFIG_PATH="${brewpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
+
+ for pkg in icu4c krb5 openldap openssl ; do
+ pkgpath="${brewpath}/opt/${pkg}"
+ PKG_CONFIG_PATH="${pkgpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
+ done
+
+ export PKG_CONFIG_PATH
+
+ meson setup \
+ --buildtype debug \
+ -Dextra_include_dirs=${brewpath}/include \
+ -Dextra_lib_dirs=${brewpath}/lib \
+ -Dcassert=true \
+ -Dssl=openssl -Duuid=e2fs -Ddtrace=auto \
+ build
+
+ build_script: ninja -C build -j${BUILD_JOBS}
+ upload_caches: ccache
+
+ tests_world_script:
+ - ulimit -c unlimited
+ - ulimit -n 1024
+ - meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+
+ on_failure:
+ <<: *on_failure_meson
+ cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
+
+
+windows_template: &windows_template
env:
# Half the allowed per-user CPU cores
CPUS: 4
@@ -412,6 +1104,11 @@ task:
setup_additional_packages_script: |
REM choco install -y --no-progress ...
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Homegrown
+
configure_script:
# copy errors out when using forward slashes
- copy src\tools\ci\windows_build_config.pl src\tools\msvc\config.pl
@@ -461,10 +1158,63 @@ task:
%T_C% perl vcregress.pl ecpgcheck
on_failure:
- <<: *on_failure
+ <<: *on_failure_ac
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & ninja
+
+ meson_install_wraps_script:
+ - mkdir subprojects
+ - meson wrap install lz4
+ - meson wrap install zlib
+
+ configure_script:
+ - vcvarsall x64
+ - meson setup --buildtype debug --backend ninja -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
+
+ build_script:
+ - vcvarsall x64
+ - ninja -C build
+
+ check_world_script:
+ - vcvarsall x64
+ - meson test %MTEST_ARGS% --num-processes 10
+
+ on_failure:
+ <<: *on_failure_meson
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & msbuild
+
+ meson_install_wraps_script:
+ - mkdir subprojects
+ - meson wrap install lz4
+ - meson wrap install zlib
+
+ configure_script:
+ - vcvarsall x64
+ - meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
+
+ build_script:
+ - vcvarsall x64
+ - msbuild %MSBFLAGS% build\postgresql.sln
+
+ check_world_script:
+ - vcvarsall x64
+ - meson test %MTEST_ARGS% --num-processes 10
+
+ on_failure:
+ <<: *on_failure_meson
crashlog_artifacts:
path: "crashlog-*.txt"
- type: text/plain
task:
@@ -472,7 +1222,8 @@ task:
# To limit unnecessary work only run this once the normal linux test succeeds
depends_on:
- - Linux - Debian Bullseye
+ - Linux - Debian Bullseye - Meson
+ trigger_type: manual
env:
CPUS: 4
diff --git a/src/tools/ci/docker/linux_centos7 b/src/tools/ci/docker/linux_centos7
new file mode 100644
index 00000000000..3742890d961
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos7
@@ -0,0 +1,57 @@
+FROM centos:centos7
+# Enable powertools, EPEL and devtoolset repository
+RUN \
+ yum -y install dnf-plugins-core \
+ epel-release \
+ centos-release-scl-rh && \
+ \
+ yum -y update && \
+ yum -y install \
+ \
+ git \
+ perl \
+ perl-ExtUtils-Embed \
+ perl-IPC-Run \
+ perl-Test-Harness \
+ perl-Test-Simple \
+ \
+ bison \
+ ccache \
+ clang \
+ devtoolset-7-make \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ && \
+ pip3 install meson && \
+ pip3 install ninja && \
+ yum clean all
+
+# Make version is 3.82 but required is > 4, adding devtoolset-7-make to the PATH
+ENV PATH="/opt/rh/devtoolset-7/root/usr/bin/:${PATH}"
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_centos8 b/src/tools/ci/docker/linux_centos8
new file mode 100644
index 00000000000..58f95847ef1
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos8
@@ -0,0 +1,54 @@
+FROM quay.io/centos/centos:stream8
+# Enable powertools and EPEL repository
+RUN \
+ dnf -y install dnf-plugins-core && \
+ dnf config-manager --set-enabled powertools && \
+ dnf -y install epel-release && \
+ dnf -y update && \
+ dnf -y install \
+ \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ diffutils \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ glibc-langpack-en \
+ \
+ && \
+ pip3 install ninja && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_fedora_rawhide b/src/tools/ci/docker/linux_fedora_rawhide
new file mode 100644
index 00000000000..c95027cd6a7
--- /dev/null
+++ b/src/tools/ci/docker/linux_fedora_rawhide
@@ -0,0 +1,49 @@
+FROM fedora:rawhide
+RUN \
+ dnf -y update && \
+ dnf -y install \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gettext \
+ ninja-build \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ langpacks-en \
+ glibc-langpack-en \
+ \
+ && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_opensuse_tumbleweed b/src/tools/ci/docker/linux_opensuse_tumbleweed
new file mode 100644
index 00000000000..07364ee85ff
--- /dev/null
+++ b/src/tools/ci/docker/linux_opensuse_tumbleweed
@@ -0,0 +1,56 @@
+FROM opensuse/tumbleweed
+RUN \
+ zypper -n clean -a && \
+ zypper -n ref && \
+ zypper -n dup && \
+ zypper -n update && \
+ zypper -n install \
+ diffutils \
+ git \
+ icu \
+ make \
+ meson \
+ perl-IPC-Run \
+ shadow \
+ systemd-devel \
+ util-linux \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gcc-c++ \
+ gettext-runtime \
+ ninja \
+ \
+ krb5-devel \
+ libicu-devel \
+ libldapcpp-devel \
+ liblz4-devel \
+ libopenssl-devel \
+ libselinux-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ pam-devel \
+ python38-devel \
+ readline-devel \
+ tcl-devel \
+ \
+ openldap2 \
+ openldap2-client \
+ \
+ krb5-client \
+ krb5-plugin-kdb-ldap \
+ krb5-server \
+ lz4 \
+ zstd \
+ \
+ && \
+ zypper -n clean -a
+
+# Fixing ICU errors caused by locale being set to 'POSIX'
+ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0011-meson-prereq-De-special-case-pgevent-s-rc-file-h.patch (1.9K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/12-v13-0011-meson-prereq-De-special-case-pgevent-s-rc-file-h.patch)
download | inline diff:
From f149aba14ecd0bff9371df791a8c6538b54be574 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 13 Sep 2022 10:07:18 -0700
Subject: [PATCH v13 11/20] meson: prereq: De-special-case pgevent's rc file
handling
There's really no need to build win32ver.rc as part of building pgmsgevent.rc.
---
src/bin/pgevent/Makefile | 5 +++--
src/bin/pgevent/pgmsgevent.rc | 2 --
src/tools/msvc/Mkvcbuild.pm | 1 -
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/bin/pgevent/Makefile b/src/bin/pgevent/Makefile
index dea79d3f137..04d49711d8d 100644
--- a/src/bin/pgevent/Makefile
+++ b/src/bin/pgevent/Makefile
@@ -17,7 +17,8 @@ ifeq ($(PORTNAME), win32)
OBJS = \
pgevent.o \
- pgmsgevent.o
+ pgmsgevent.o \
+ $(WIN32RES)
NAME=pgevent
SHLIB_LINK =
@@ -29,7 +30,7 @@ install: all install-lib
include $(top_srcdir)/src/Makefile.shlib
-pgmsgevent.o: pgmsgevent.rc win32ver.rc
+pgmsgevent.o: pgmsgevent.rc
$(WINDRES) $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(top_srcdir)/src/include --include-dir=$(srcdir) --include-dir=.
clean distclean: clean-lib
diff --git a/src/bin/pgevent/pgmsgevent.rc b/src/bin/pgevent/pgmsgevent.rc
index e69862e882c..0885a897e6f 100644
--- a/src/bin/pgevent/pgmsgevent.rc
+++ b/src/bin/pgevent/pgmsgevent.rc
@@ -1,4 +1,2 @@
LANGUAGE 0x9,0x1
1 11 MSG00001.bin
-
-#include "win32ver.rc"
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 098bc3f1b09..ddb4f25eb12 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -425,7 +425,6 @@ sub mkvcbuild
$pgevent->AddFiles('src/bin/pgevent', 'pgevent.c', 'pgmsgevent.rc');
$pgevent->AddResourceFile('src/bin/pgevent', 'Eventlog message formatter',
'win32');
- $pgevent->RemoveFile('src/bin/pgevent/win32ver.rc');
$pgevent->UseDef('src/bin/pgevent/pgevent.def');
$pgevent->DisableLinkerWarnings('4104');
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0012-meson-prereq-win-remove-date-from-version-number.patch (1.1K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/13-v13-0012-meson-prereq-win-remove-date-from-version-number.patch)
download | inline diff:
From 506d219f1054bbac18034a1ca35788900010876a Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 14 Sep 2022 16:43:47 -0700
Subject: [PATCH v13 12/20] meson: prereq: win: remove date from version number
in win32ver.rc
This may have served a purpose at some point, but these days it just
contributes to a non-reproducible build.
Discussion: https://postgr.es/m/1cef5b48-32bd-5cbf-fb62-fb648860f5ef@enterprisedb.com
---
src/makefiles/Makefile.win32 | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
index 17d68196442..d268b3ebafd 100644
--- a/src/makefiles/Makefile.win32
+++ b/src/makefiles/Makefile.win32
@@ -69,7 +69,6 @@ win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
sed -e 's;FILEDESC;$(PGFILEDESC);' \
-e 's;VFT_APP;$(PGFTYPE);' \
-e 's;_ICO_;$(PGICOSTR);' \
- -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \
-e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
-e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
$< >$@
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0013-meson-WIP-Add-some-of-the-windows-resource-files.patch (11.0K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/14-v13-0013-meson-WIP-Add-some-of-the-windows-resource-files.patch)
download | inline diff:
From b61df29fc04648608c728d760ac00225fb84c890 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 14 Sep 2022 17:14:22 -0700
Subject: [PATCH v13 13/20] meson: WIP: Add some of the windows resource files
---
src/bin/initdb/meson.build | 6 ++
src/bin/pg_dump/meson.build | 18 ++++++
src/bin/pg_test_fsync/meson.build | 5 ++
src/bin/pgevent/meson.build | 4 ++
src/bin/psql/meson.build | 6 ++
src/interfaces/libpq/meson.build | 5 ++
contrib/pageinspect/meson.build | 5 ++
contrib/pg_walinspect/meson.build | 5 ++
meson.build | 61 +++++++++++++++++++
src/tools/rcgen | 99 +++++++++++++++++++++++++++++++
10 files changed, 214 insertions(+)
create mode 100755 src/tools/rcgen
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
index 9f213274d2f..6ced9a31b80 100644
--- a/src/bin/initdb/meson.build
+++ b/src/bin/initdb/meson.build
@@ -7,6 +7,12 @@ initdb_sources += timezone_localtime_source
#fixme: reimplement libpq_pgport logic
+if host_system == 'windows'
+ initdb_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'initdb',
+ '--FILEDESC', 'initdb - initialize a new database cluster',])
+endif
+
initdb = executable('initdb',
initdb_sources,
include_directories: [timezone_inc],
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 785ec094dbd..3527a25c288 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -24,6 +24,12 @@ pg_dump_sources = files(
'pg_dump_sort.c',
)
+if host_system == 'windows'
+ pg_dump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dump',
+ '--FILEDESC', 'pg_dump - backup one PostgreSQL database',])
+endif
+
pg_dump = executable('pg_dump',
pg_dump_sources,
link_with: [pg_dump_common],
@@ -37,6 +43,12 @@ pg_dumpall_sources = files(
'pg_dumpall.c',
)
+if host_system == 'windows'
+ pg_dumpall_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dumpall',
+ '--FILEDESC', 'pg_dumpall - backup PostgreSQL databases'])
+endif
+
pg_dumpall = executable('pg_dumpall',
pg_dumpall_sources,
link_with: [pg_dump_common],
@@ -50,6 +62,12 @@ pg_restore_sources = files(
'pg_restore.c',
)
+if host_system == 'windows'
+ pg_restore_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_restore',
+ '--FILEDESC', 'pg_restore - restore PostgreSQL databases'])
+endif
+
pg_restore = executable('pg_restore',
pg_restore_sources,
link_with: [pg_dump_common],
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
index 2c01831e11f..2bbc3cb915d 100644
--- a/src/bin/pg_test_fsync/meson.build
+++ b/src/bin/pg_test_fsync/meson.build
@@ -1,5 +1,10 @@
test_fsync_sources = files('pg_test_fsync.c')
+if host_system == 'windows'
+ test_fsync_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_fsync'])
+endif
+
pg_test_fsync = executable('pg_test_fsync',
test_fsync_sources,
dependencies: [frontend_code],
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
index 5852bca4d87..2e9aea4b0e1 100644
--- a/src/bin/pgevent/meson.build
+++ b/src/bin/pgevent/meson.build
@@ -6,6 +6,10 @@ pgevent_sources = files(
'pgevent.c',
)
+pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgevent',
+ '--FILEDESC', 'Eventlog message formatter',])
+
pgevent_sources += windows.compile_resources('pgmsgevent.rc')
# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index ea850c8fdf5..3474389d3b6 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -38,6 +38,12 @@ generated_sources += sql_help.to_list()
psql_sources += sql_help
bin_targets += sql_help
+if host_system == 'windows'
+ psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'psql',
+ '--FILEDESC', 'psql - the PostgreSQL interactive terminal',])
+endif
+
psql = executable('psql',
psql_sources,
include_directories: include_directories('.'),
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index bc047e00d62..2c9edeaa088 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -16,9 +16,13 @@ libpq_sources = files(
'libpq-events.c',
'pqexpbuffer.c',
)
+libpq_so_sources = [] # only for shared lib, in addition to above
if host_system == 'windows'
libpq_sources += files('pthread-win32.c', 'win32.c')
+ libpq_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq',
+ '--FILEDESC', 'PostgreSQL Access Library',])
endif
if ssl.found()
@@ -52,6 +56,7 @@ libpq_st = static_library('libpq',
# not using both_libraries here, causes problems with precompiled headers and
# resource files with msbuild
libpq_so = shared_library('libpq',
+ libpq_so_sources,
dependencies: libpq_deps,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
index 4af8153e4fd..050d60525c7 100644
--- a/contrib/pageinspect/meson.build
+++ b/contrib/pageinspect/meson.build
@@ -9,6 +9,11 @@ pageinspect_sources = files(
'rawpage.c',
)
+if host_system == 'windows'
+ initdb_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pageinspect',])
+endif
+
pageinspect = shared_module('pageinspect',
pageinspect_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index d6b27877dd0..aafd9a37f23 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -1,5 +1,10 @@
pg_walinspect_sources = files('pg_walinspect.c')
+if host_system == 'windows'
+ pg_walinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_walinspect'])
+endif
+
pg_walinspect = shared_module('pg_walinspect',
pg_walinspect_sources,
kwargs: contrib_mod_args + {
diff --git a/meson.build b/meson.build
index d5411831e82..11ce27c60ee 100644
--- a/meson.build
+++ b/meson.build
@@ -2525,6 +2525,67 @@ gen_export_kwargs = {
+###
+### windows resources related stuff
+###
+
+if host_system == 'windows'
+ pg_ico = meson.source_root() / 'src' / 'port' / 'win32.ico'
+ win32ver_rc = files('src/port/win32ver.rc')
+ rcgen = find_program('src/tools/rcgen', native: true)
+
+ rcgen_base_args = [
+ '--srcdir', '@SOURCE_DIR@',
+ '--builddir', meson.build_root(),
+ '--rcout', '@OUTPUT0@',
+ '--out', '@OUTPUT1@',
+ '--input', '@INPUT@',
+ '@EXTRA_ARGS@',
+ ]
+
+ if cc.get_argument_syntax() == 'msvc'
+ rcgen_base_args += [
+ '--rc', find_program('rc', required: true).path(),
+ ]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.res']
+ else
+ rcgen_base_args += [
+ '--windres', find_program('windres', required: true).path(),
+ ]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.obj']
+ endif
+
+ # msbuild backend doesn't support this atm
+ if meson.backend() == 'ninja'
+ rcgen_base_args += ['--depfile', '@DEPFILE@']
+ endif
+
+ rcgen_bin_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_APP',
+ '--FILEENDING', 'exe',
+ '--ICO', pg_ico
+ ]
+
+ rcgen_lib_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_DLL',
+ '--FILEENDING', 'dll',
+ ]
+
+ rc_bin_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_bin_args,
+ output: rcgen_outputs,
+ )
+
+ rc_lib_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_lib_args,
+ output: rcgen_outputs,
+ )
+endif
+
+
+
# headers that the whole build tree depends on
generated_headers = []
# headers that the backend build depends on
diff --git a/src/tools/rcgen b/src/tools/rcgen
new file mode 100755
index 00000000000..5b62bfe5410
--- /dev/null
+++ b/src/tools/rcgen
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+
+import argparse
+import os
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(description='generate PostgreSQL rc file')
+
+parser.add_argument('--srcdir', type=os.path.abspath,
+ required=True)
+parser.add_argument('--builddir', type=os.path.abspath,
+ required=True)
+
+binaries = parser.add_argument_group('binaries')
+binaries.add_argument('--windres', type=os.path.abspath)
+binaries.add_argument('--rc', type=os.path.abspath)
+
+inout = parser.add_argument_group('inout')
+inout.add_argument('--depfile', type=argparse.FileType('w'))
+inout.add_argument('--input', type=argparse.FileType('r'),
+ required=True)
+inout.add_argument('--rcout', type=argparse.FileType('w'),
+ required=True)
+inout.add_argument('--out', type=str,
+ required=True)
+
+replacements = parser.add_argument_group('replacements')
+replacements.add_argument('--FILEDESC', type=str)
+replacements.add_argument('--NAME', type=str, required=True)
+replacements.add_argument('--VFT_TYPE', type=str, required=True)
+replacements.add_argument('--FILEENDING', type=str, required=True)
+replacements.add_argument('--ICO', type=str)
+
+args = parser.parse_args()
+
+# determine replacement strings
+
+internal_name = '"{0}"'.format(args.NAME)
+original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING)
+
+# if no description is passed in, generate one based on the name
+if args.FILEDESC:
+ filedesc = args.FILEDESC
+elif args.NAME:
+ if args.VFT_TYPE == 'VFT_DLL':
+ filedesc = 'PostgreSQL {0} library'.format(args.NAME)
+ else:
+ filedesc = 'PostgreSQL {0} binary'.format(args.NAME)
+filedesc = '"{0}"'.format(filedesc)
+
+
+if args.ICO:
+ ico = 'IDI_ICON ICON "{0}"'.format(args.ICO)
+ if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO))
+else:
+ ico = ''
+
+
+data = args.input.read()
+
+data = data.replace('VFT_APP', args.VFT_TYPE)
+data = data.replace('_INTERNAL_NAME_', internal_name)
+data = data.replace('_ORIGINAL_NAME_', original_name)
+data = data.replace('FILEDESC', filedesc)
+data = data.replace("_ICO_", ico)
+
+args.rcout.write(data)
+args.rcout.close()
+
+if args.windres:
+ cmd = [
+ args.windres,
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '-o', args.out, '-i', args.rcout.name,
+ ]
+elif args.rc:
+ cmd = [
+ args.rc, '/nologo',
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '/fo', args.out, args.rcout.name,
+ ]
+else:
+ sys.exit('either --windres or --rc needs to be specified')
+
+sp = subprocess.run(cmd)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# It'd be nicer if we could generate correct dependencies here, but 'rc'
+# doesn't support doing so. It's unlikely we'll ever need more, so...
+if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(
+ args.rcout.name, args.input.name))
+ args.depfile.write("{0} : {1}/{2}\n".format(
+ args.out, args.builddir, 'src/include/pg_config.h'))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0014-meson-Add-support-for-relative-rpaths-fixing-tes.patch (7.3K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/15-v13-0014-meson-Add-support-for-relative-rpaths-fixing-tes.patch)
download | inline diff:
From fbee3715e97a09f2676e5b6bee4eb0637472010f Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 30 Aug 2022 16:15:05 -0700
Subject: [PATCH v13 14/20] meson: Add support for relative rpaths, fixing
tests on MacOS w/ SIP
---
meson.build | 47 ++++++++--
.../relativize_shared_library_references | 88 +++++++++++++++++++
src/tools/relpath.py | 6 ++
3 files changed, 136 insertions(+), 5 deletions(-)
create mode 100755 src/tools/relativize_shared_library_references
create mode 100755 src/tools/relpath.py
diff --git a/meson.build b/meson.build
index 11ce27c60ee..31c7dbe0ea0 100644
--- a/meson.build
+++ b/meson.build
@@ -159,6 +159,7 @@ portname = host_system
exesuffix = '' # overridden below where necessary
dlsuffix = '.so' # overridden below where necessary
+rpath_origin = '$ORIGIN'
library_path_var = 'LD_LIBRARY_PATH'
# Format of file to control exports from libraries, and how to pass them to
@@ -209,6 +210,7 @@ elif host_system == 'cygwin'
elif host_system == 'darwin'
dlsuffix = '.dylib'
ld_library_path_var = 'DYLD_LIBRARY_PATH'
+ rpath_origin = '@loader_path'
export_file_format = 'darwin'
export_fmt = '-exported_symbols_list=@0@'
@@ -241,8 +243,16 @@ elif host_system == 'netbsd'
# LDFLAGS.
ldflags += ['-Wl,-z,now', '-Wl,-z,relro']
+ # netbsd patched their meson in a broken way:
+ # https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=56959
+ # until there's a way out of that, disable rpath_origin
+ rpath_origin = ''
+
elif host_system == 'openbsd'
- # you're ok
+ # openbsd's $ORIGIN doesn't use an absolute path to the binary, but argv[0]
+ # (i.e. absolute when invoked with an absolute name, but e.g. not absolute
+ # when invoked via PATH search).
+ rpath_origin = ''
elif host_system == 'sunos'
portname = 'solaris'
@@ -254,6 +264,7 @@ elif host_system == 'windows'
exesuffix = '.exe'
dlsuffix = '.dll'
ld_library_path_var = ''
+ rpath_origin = ''
export_file_format = 'win'
export_file_suffix = 'def'
@@ -2481,6 +2492,25 @@ if host_system != 'darwin'
mod_install_rpaths += postgres_lib_d
endif
+# If the host can form relative rpaths, use that to make the installation
+# properly relocatable
+if rpath_origin != ''
+ # PG binaries might need to link to libpq, use relative path to reference
+ bin_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_bin, dir_lib, check: true).stdout().strip()
+ bin_install_rpaths += rpath_origin / bin_to_lib
+
+ # PG extensions might need to link to libpq, use relative path to reference
+ # (often just .)
+ mod_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_lib_pkg, dir_lib, check: true).stdout().strip()
+ mod_install_rpaths += rpath_origin / mod_to_lib
+
+ test_use_library_path_var = false
+else
+ test_use_library_path_var = true
+endif
+
# Define arguments for default targets
@@ -2773,6 +2803,14 @@ above, or by running configure and then make maintainer-clean.
endif
+# To make MacOS installation work without a prior make install, even with SIP
+# enabled, make rpaths relative after installation. This also makes the
+# installation relocatable.
+if host_system == 'darwin'
+ meson.add_install_script('src/tools/relativize_shared_library_references')
+endif
+
+
###############################################################
# Test prep
@@ -2838,10 +2876,9 @@ test_env.set('REGRESS_SHLIB', regress_module.full_path())
# Export PG_TEST_EXTRA so it can be checked in individual tap tests.
test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA'))
-# Add the temporary installation to the library search path on platforms where
-# that works (everything but windows, basically). On windows everything
-# library-like gets installed into bindir, solving that issue.
-if library_path_var != ''
+# On platforms without $ORIGIN support we need to add the temporary
+# installation to the library search path.
+if test_use_library_path_var and library_path_var != ''
test_env.prepend(library_path_var, test_install_location / get_option('libdir'))
endif
diff --git a/src/tools/relativize_shared_library_references b/src/tools/relativize_shared_library_references
new file mode 100755
index 00000000000..280bd48fd32
--- /dev/null
+++ b/src/tools/relativize_shared_library_references
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+# -*-python-*-
+
+# This script updates a macos postgres installation to reference all internal
+# shared libraries using rpaths, leaving absolute install_names in the
+# libraries themselves intact.
+
+import os
+import sys
+import json
+import subprocess
+import shutil
+
+
+def installed_path(destdir, path):
+ if destdir is not None:
+ return f'{destdir}{path}'
+ else:
+ return path
+
+
+def collect_information():
+ shared_libraries = []
+ executables = []
+ shared_modules = []
+
+ meson_info_p = os.path.join(build_root, 'meson-info')
+ targets = json.load(
+ open(os.path.join(meson_info_p, 'intro-targets.json')))
+ installed = json.load(
+ open(os.path.join(meson_info_p, 'intro-installed.json')))
+
+ for target in targets:
+ if not target['installed']:
+ continue
+
+ filenames = target['filename']
+
+ if target['type'] == 'shared library':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+
+ shared_libraries.append(installed[filename])
+
+ if target['type'] == 'executable':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ executables.append(installed[filename])
+
+ if target['type'] == 'shared module':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ shared_modules.append(installed[filename])
+
+ return shared_libraries, executables, shared_modules
+
+
+def patch_references(destdir, shared_libraries, executables, shared_modules):
+ install_name_tool = [shutil.which('install_name_tool')]
+
+ for lib in shared_libraries:
+ libname = os.path.basename(lib)
+ libpath = installed_path(destdir, lib)
+ newref = f'@rpath/{libname}'
+
+ for patch in shared_modules + executables:
+ patchpath = installed_path(destdir, patch)
+
+ # print(f'in {patchpath} replace reference to {libpath} with {newref}')
+ if not os.path.exists(patchpath):
+ print(f"path {patchpath} doesn't exist", file=sys.stderr)
+ sys.exit(1)
+
+ cmd = install_name_tool + ['-change', lib, newref, patchpath]
+ subprocess.check_call(cmd)
+
+
+if __name__ == '__main__':
+ build_root = os.environ['MESON_BUILD_ROOT']
+ destdir = os.environ.get('DESTDIR', None)
+
+ print(f'making references to shared libraries relative, destdir is {destdir}',
+ file=sys.stderr)
+
+ shared_libraries, executables, shared_modules = collect_information()
+ patch_references(destdir, shared_libraries, executables, shared_modules)
+
+ sys.exit(0)
diff --git a/src/tools/relpath.py b/src/tools/relpath.py
new file mode 100755
index 00000000000..87bcb496ab5
--- /dev/null
+++ b/src/tools/relpath.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+print(os.path.relpath(sys.argv[2], start=sys.argv[1]))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0015-meson-Add-docs-for-building-with-meson.patch (77.6K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/16-v13-0015-meson-Add-docs-for-building-with-meson.patch)
download | inline diff:
From 054375bef37c93c921a5579928e7b4e1dafd13ea Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:55:20 -0700
Subject: [PATCH v13 15/20] meson: Add docs for building with meson
Author: Samay Sharma <smilingsamay@gmail.com>
---
doc/src/sgml/installation.sgml | 1841 ++++++++++++++++++++++++++++++--
doc/src/sgml/monitoring.sgml | 2 +-
doc/src/sgml/runtime.sgml | 2 +-
doc/src/sgml/sourcerepo.sgml | 5 +-
4 files changed, 1743 insertions(+), 107 deletions(-)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 319c7e69660..b2c0aa72ac3 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -31,7 +31,144 @@ documentation. See standalone-profile.xsl for details.
C++</productname>, see <xref linkend="install-windows"/> instead.
</para>
- <sect1 id="install-short">
+ <sect1 id="supported-platforms">
+ <title>Supported Platforms</title>
+
+ <para>
+ A platform (that is, a CPU architecture and operating system combination)
+ is considered supported by the <productname>PostgreSQL</productname> development
+ community if the code contains provisions to work on that platform and
+ it has recently been verified to build and pass its regression tests
+ on that platform. Currently, most testing of platform compatibility
+ is done automatically by test machines in the
+ <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
+ If you are interested in using <productname>PostgreSQL</productname> on a platform
+ that is not represented in the build farm, but on which the code works
+ or can be made to work, you are strongly encouraged to set up a build
+ farm member machine so that continued compatibility can be assured.
+ </para>
+
+ <para>
+ In general, <productname>PostgreSQL</productname> can be expected to work on
+ these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
+ and PA-RISC, including
+ big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
+ It is often
+ possible to build on an unsupported CPU type by configuring with
+ <option>--disable-spinlocks</option>, but performance will be poor.
+ </para>
+
+ <para>
+ <productname>PostgreSQL</productname> can be expected to work on current
+ versions of these operating systems: Linux, Windows,
+ FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
+ Other Unix-like systems may also work but are not currently
+ being tested. In most cases, all CPU architectures supported by
+ a given operating system will work. Look in
+ <xref linkend="installation-platform-notes"/> below to see if
+ there is information
+ specific to your operating system, particularly if using an older system.
+ </para>
+
+ <para>
+ If you have installation problems on a platform that is known
+ to be supported according to recent build farm results, please report
+ it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
+ in porting <productname>PostgreSQL</productname> to a new platform,
+ <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
+ to discuss that.
+ </para>
+
+ <para>
+ Historical versions of <productname>PostgreSQL</productname> or POSTGRES
+ also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
+ M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
+ BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
+ Tru64 UNIX, and ULTRIX.
+ </para>
+ </sect1>
+
+ <sect1 id="get-source">
+ <title>Getting the Source</title>
+
+ <para>
+ You can download the source code in two ways - via git or the source code
+ tarballs.
+ </para>
+
+ <sect2 id="get-source-git">
+ <title>Getting the Source via <productname>Git</productname></title>
+ <para>
+ With <productname>Git</productname>, you can make a copy of the entire code repository
+ on your local machine, so you will have access to all history and branches
+ offline. This is the fastest and most flexible way to develop or test
+ patches.
+ </para>
+
+ <procedure>
+ <step>
+ <para>
+ To begin using the Git repository, make a clone of the official mirror:
+
+<programlisting>
+git clone https://git.postgresql.org/git/postgresql.git
+</programlisting>
+
+ This will copy the full repository to your local machine, so it may take
+ a while to complete, especially if you have a slow Internet connection.
+ The files will be placed in a new subdirectory <filename>postgresql</filename> of
+ your current directory.
+ </para>
+
+ </step>
+
+ <step>
+ <para>
+ Whenever you want to get the latest updates in the system, <command>cd</command>
+ into the repository, and run:
+
+<programlisting>
+git pull
+</programlisting>
+ </para>
+ </step>
+ </procedure>
+
+ <para>
+ <productname>Git</productname> can do a lot more things than just fetch the source.
+ Our wiki, <ulink
+ url="https://wiki.postgresql.org/wiki/Working_with_Git"></ulink>,
+ has some discussion on working with Git. For more information, consult the
+ <productname>Git</productname> man pages, or see the website at
+ <ulink url="https://git-scm.com"></ulink>.
+ </para>
+ </sect2>
+ <sect2 id="get-source-tarball">
+ <title>Getting the Source via Tarballs</title>
+
+ <para>
+ The <productname>PostgreSQL</productname> source code for released versions
+ can also be obtained from the download section of our website:
+ <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
+ Download the
+ <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
+ or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
+ file you're interested in, then unpack it:
+<screen>
+<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
+</screen>
+ This will create a directory
+ <filename>postgresql-<replaceable>version</replaceable></filename> under
+ the current directory with the <productname>PostgreSQL</productname> sources.
+ Change into that directory for the rest of the installation procedure.
+ </para>
+ </sect2>
+ </sect1>
+
+<sect1 id="install-make">
+ <title>Building and Installation with autoconf and make</title>
+
+ <sect2 id="install-short-make">
<title>Short Version</title>
<para>
@@ -50,12 +187,12 @@ su - postgres
/usr/local/pgsql/bin/psql test
</synopsis>
The long version is the rest of this
- <phrase>chapter</phrase>.
+ <phrase>section</phrase>.
</para>
- </sect1>
+ </sect2>
- <sect1 id="install-requirements">
+ <sect2 id="install-requirements-make">
<title>Requirements</title>
<para>
@@ -343,45 +480,9 @@ su - postgres
url="ftp://ftp.gnu.org/gnu/"></ulink>.
</para>
- <para>
- Also check that you have sufficient disk space. You will need about
- 350 MB for the source tree during compilation and about 60 MB for
- the installation directory. An empty database cluster takes about
- 40 MB; databases take about five times the amount of space that a
- flat text file with the same data would take. If you are going to
- run the regression tests you will temporarily need up to an extra
- 300 MB. Use the <command>df</command> command to check free disk
- space.
- </para>
- </sect1>
+ </sect2>
- <sect1 id="install-getsource">
- <title>Getting the Source</title>
-
- <para>
- The <productname>PostgreSQL</productname> source code for released versions
- can be obtained from the download section of our website:
- <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
- Download the
- <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
- or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
- file you're interested in, then unpack it:
-<screen>
-<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
-</screen>
- This will create a directory
- <filename>postgresql-<replaceable>version</replaceable></filename> under
- the current directory with the <productname>PostgreSQL</productname> sources.
- Change into that directory for the rest of the installation procedure.
- </para>
-
- <para>
- Alternatively, you can use the Git version control system; see
- <xref linkend="git"/> for more information.
- </para>
- </sect1>
-
- <sect1 id="install-procedure">
+ <sect2 id="install-procedure-make">
<title>Installation Procedure</title>
<procedure>
@@ -630,6 +731,7 @@ build-postgresql:
rebuilding. Without this, your changes in configuration choices
might not propagate everywhere they need to.
</para>
+ </sect2>
<sect2 id="configure-options">
<title><filename>configure</filename> Options</title>
@@ -844,7 +946,7 @@ build-postgresql:
various <productname>PostgreSQL</productname> features that are not
built by default. Most of these are non-default only because they
require additional software, as described in
- <xref linkend="install-requirements"/>.
+ <xref linkend="install-requirements-make"/>.
</para>
<variablelist>
@@ -1672,9 +1774,7 @@ build-postgresql:
</sect3>
- </sect2>
-
- <sect2 id="configure-envvars">
+ <sect3 id="configure-envvars">
<title><filename>configure</filename> Environment Variables</title>
<indexterm zone="configure-envvars">
@@ -1955,9 +2055,1600 @@ build-postgresql:
adjustments, while <envar>COPT</envar> might be kept set all the time.
</para>
</note>
+ </sect3>
</sect2>
</sect1>
+ <sect1 id="install-meson">
+ <title>Building and Installation with meson</title>
+
+ <sect2 id="install-short-meson">
+ <title>Short Version</title>
+
+ <para>
+<synopsis>
+
+# create working directory
+mkdir postgres
+cd postgres
+
+# fetch source code
+# git clone https://git.postgresql.org/git/postgresql.git src
+
+# current instructions for testing (to be removed when merging)
+git clone -b meson https://github.com/anarazel/postgres.git src
+
+# setup and enter build directory (done only first time)
+meson setup build src --prefix=$PWD/install
+cd build
+
+# Compile source
+ninja
+
+# Install to the prefix directory specified above
+ninja install
+
+# Run all tests (optional, takes time)
+meson test
+
+# Initialize a new database
+../install/bin/initdb -D ../data
+
+# Start database
+../install/bin/pg_ctl -D ../data/ -l logfile start
+
+# Connect to the database
+../install/bin/psql -d postgres
+
+</synopsis>
+ The long version is the rest of this
+ <phrase>section</phrase>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-requirements-meson">
+ <title>Requirements</title>
+
+ <para>
+ In general, a modern Unix-compatible platform or Windows should be able
+ to build <productname>PostgreSQL</productname> with meson and run it.
+ The platforms which have received specific testing at the time of release are:
+
+ <itemizedlist spacing="compact">
+ <listitem><simpara>Linux</simpara></listitem>
+ <listitem><simpara>Windows</simpara></listitem>
+ <listitem><simpara>OpenBSD</simpara></listitem>
+ <listitem><simpara>NetBSD</simpara></listitem>
+ <listitem><simpara>FreeBSD</simpara></listitem>
+ <listitem><simpara>macOS</simpara></listitem>
+ </itemizedlist>
+ </para>
+
+ <sect3 id="required-packages">
+ <title>Required packages</title>
+
+ <para>
+ The following software packages are required for building
+ <productname>PostgreSQL</productname>:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can download the source code in two ways - via git or by downloading
+ the source code tarballs. For the former, you will need an installed version of
+ <productname>Git</productname>, which you can get from
+ <ulink url="https://git-scm.com"></ulink>. Many systems already
+ have a recent version of <productname>Git</productname>
+ installed by default, or available in their package distribution system.
+ If you download the source code tarballs, you will need
+ <application>tar</application> in addition to
+ <application>gzip</application> or <application>bzip2</application>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>meson</primary>
+ </indexterm>
+ You need to install <application>
+ <ulink url="https://mesonbuild.com/">meson</ulink></application> version
+ 0.54 or later to be able to build <productname>PostgreSQL</productname>
+ with it. If your operating system provides a package manager, you can install
+ <application>meson</application> with that. If not, you
+ can download a <ulink url="https://github.com/mesonbuild/meson">meson release</ulink>
+ from github and run <literal>./meson.py</literal> from the git repository
+ itself. Lastly, Meson is also available in the python package index and can
+ be installed with <literal>pip</literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ You need an <acronym>ISO</acronym>/<acronym>ANSI</acronym> C compiler (at least
+ C99-compliant). Recent
+ versions of <productname>GCC</productname> are recommended, but
+ <productname>PostgreSQL</productname> is known to build using a wide variety
+ of compilers from different vendors.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>flex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>lex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>bison</primary>
+ </indexterm>
+ <indexterm>
+ <primary>yacc</primary>
+ </indexterm>
+
+ <application>Flex</application> and <application>Bison</application>
+ are needed to build <productname>PostgreSQL</productname> using
+ <application>meson</application>. Be sure to get
+ <application>Flex</application> 2.5.31 or later and
+ <application>Bison</application> 1.875 or later from your package manager.
+ Other <application>lex</application> and <application>yacc</application>
+ programs cannot be used.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>perl</primary>
+ </indexterm>
+ <application>Perl</application> 5.8.3 or later is needed to build PostgreSQL
+ using <application>meson</application> and to run some test suites.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="recommended-packages">
+ <title>Recommended packages</title>
+
+ <para>
+ The following packages are not required to build
+ <application>PostgreSQL</application> but are strongly recommended:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>readline</primary>
+ </indexterm>
+ <indexterm>
+ <primary>libedit</primary>
+ </indexterm>
+
+ The <acronym>GNU</acronym> <productname>Readline</productname> library
+ allows <application>psql</application> (the PostgreSQL command line
+ SQL interpreter) to remember each command you type, and allows you to
+ use arrow keys to recall and edit previous commands. This is very
+ helpful and is strongly recommended. As an alternative, you can often
+ use the BSD-licensed <filename>libedit</filename> library, originally
+ developed on <productname>NetBSD</productname>. The
+ <filename>libedit</filename> library is GNU
+ <productname>Readline</productname>-compatible and is used if
+ <filename>libreadline</filename> is not found, or if
+ <option>libedit_preferred</option> is enabled as an
+ option to <filename>meson configure</filename>. If you are using a
+ package-based Linux distribution, be aware that you need both the
+ <literal>readline</literal> and <literal>readline-devel</literal> packages, if
+ those are separate in your distribution.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+
+ The <productname>zlib</productname> compression library is
+ used to provide support for compressed archives in
+ <application>pg_dump</application> and
+ <application>pg_restore</application> and is recommended.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Various tests, particularly the client program tests under
+ <filename>src/bin</filename>, use the Perl TAP tools. Running
+ these tests is recommended for development. These TAP tests
+ require the Perl module <literal>IPC::Run</literal> which is
+ available from CPAN or an operating system package.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="optional-packages">
+ <title>Optional packages</title>
+
+ <para>
+ The following packages are optional. They are not required in the
+ default configuration, but they are needed when certain build
+ options are enabled, as explained below:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You need <productname>OpenSSL</productname>, if you want to support
+ encrypted client connections. <productname>OpenSSL</productname> is
+ also required for random number generation on platforms that do not
+ have <filename>/dev/urandom</filename> (except Windows). The minimum
+ required version is 1.0.1.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>LZ4</productname>, if you want to support
+ compression of data with that method; see
+ <xref linkend="guc-default-toast-compression"/> and
+ <xref linkend="guc-wal-compression"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>Zstandard</productname>, if you want to support
+ compression of data or backups with that method; see
+ <xref linkend="guc-wal-compression"/>.
+ The minimum required version is 1.4.0.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <application>Kerberos</application>, <productname>OpenLDAP</productname>,
+ and/or <application>PAM</application>, if you want to support authentication
+ using those services.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the server programming language
+ <application>PL/Perl</application> you need a full
+ <productname>Perl</productname> installation, including the
+ <filename>libperl</filename> library and the header files.
+ The minimum required version is <productname>Perl</productname> 5.8.3.
+ Since <application>PL/Perl</application> will be a shared
+ library, the <indexterm><primary>libperl</primary></indexterm>
+ <filename>libperl</filename> library must be a shared library
+ also on most platforms. This appears to be the default in
+ recent <productname>Perl</productname> versions, but it was not
+ in earlier versions, and in any case it is the choice of whomever
+ installed Perl at your site. <filename>configure</filename> will fail
+ if building <application>PL/Perl</application> is selected but it cannot
+ find a shared <filename>libperl</filename>. In that case, you will have
+ to rebuild and install <productname>Perl</productname> manually to be
+ able to build <application>PL/Perl</application>. During the
+ configuration process for <productname>Perl</productname>, request a
+ shared library.
+ </para>
+
+ <para>
+ If you intend to make more than incidental use of
+ <application>PL/Perl</application>, you should ensure that the
+ <productname>Perl</productname> installation was built with the
+ <literal>usemultiplicity</literal> option enabled (<literal>perl -V</literal>
+ will show whether this is the case).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Python</application> server programming
+ language, you need a <productname>Python</productname>
+ installation with the header files and
+ the <application>sysconfig</application> module. The minimum
+ required version is <productname>Python</productname> 3.2.
+ </para>
+
+ <para>
+ Since <application>PL/Python</application> will be a shared
+ library, the <indexterm><primary>libpython</primary></indexterm>
+ <filename>libpython</filename> library must be a shared library
+ also on most platforms. This is not the case in a default
+ <productname>Python</productname> installation built from source, but a
+ shared library is available in many operating system
+ distributions. <filename>configure</filename> will fail if
+ building <application>PL/Python</application> is selected but it cannot
+ find a shared <filename>libpython</filename>. That might mean that you
+ either have to install additional packages or rebuild (part of) your
+ <productname>Python</productname> installation to provide this shared
+ library. When building from source, run <productname>Python</productname>'s
+ configure with the <literal>--enable-shared</literal> flag.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Tcl</application>
+ procedural language, you of course need a <productname>Tcl</productname>
+ installation. The minimum required version is
+ <productname>Tcl</productname> 8.4.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To enable Native Language Support (<acronym>NLS</acronym>), that
+ is, the ability to display a program's messages in a language
+ other than English, you need an implementation of the
+ <application>Gettext</application> <acronym>API</acronym>. Some operating
+ systems have this built-in (e.g., <systemitem
+ class="osname">Linux</systemitem>, <systemitem class="osname">NetBSD</systemitem>,
+ <systemitem class="osname">Solaris</systemitem>), for other systems you
+ can download an add-on package from <ulink
+ url="https://www.gnu.org/software/gettext/"></ulink>.
+ If you are using the <application>Gettext</application> implementation in
+ the <acronym>GNU</acronym> C library then you will additionally
+ need the <productname>GNU Gettext</productname> package for some
+ utility programs. For any of the other implementations you will
+ not need it.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <productname>PostgreSQL</productname> documentation,
+ there is a separate set of requirements; see
+ <xref linkend="docguide-toolsets"/>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="configure-meson">
+ <title>Configuring the build</title>
+
+ <para>
+ The first step of the installation procedure is to configure the
+ source tree for your system and choose the options you would like. To
+ create and configure the build directory, you can start with the
+ <literal>meson setup</literal> command.
+ </para>
+
+<screen>
+<userinput>meson setup build</userinput>
+</screen>
+
+ <para>
+ The setup command takes a <literal>builddir</literal> and a <literal>srcdir</literal>
+ argument. If no <literal>srcdir</literal> is given Meson will deduce the
+ <literal>srcdir</literal> based on the current directory and the location
+ of <literal>meson.build</literal>. The <literal>builddir</literal> is mandatory.
+ </para>
+
+ <para>
+ Meson then loads the build configuration file and sets up the build directory.
+ Additionally, the invocation can pass options to Meson. The list of commonly
+ used options is in subsequent sections. A few examples of specifying different
+ build options are:
+
+<screen>
+#Setup build directory with a different installation prefix
+meson setup build --prefix=/home/user/pg-install
+
+#Setup build directory to generate a debug build
+meson setup build --buildtype=debug
+
+#Setup build directory with ssl (Use -D for project specific options)
+meson setup build -Dssl=openssl
+</screen>
+
+ Setting up the build directory is a one-time step. To reconfigure before a
+ new build, you can simply use the <literal>meson configure</literal> command
+ </para>
+
+<para>
+<screen>
+meson configure -Dcassert=true
+</screen>
+</para>
+
+<para>
+ <command>meson configure</command>'s commonly used command line options
+ are explained below. This list is not exhaustive (use
+ <literal>meson configure --help</literal> to get one that is).
+ The options not covered here are meant for advanced use-cases, and are
+ documented in the standard meson
+ <ulink url="https://mesonbuild.com/Commands.html#configure">documentation</ulink>.
+ These arguments can be used with <command>meson setup</command> as well.
+</para>
+
+ <sect3 id="configure-install-locations">
+ <title>Installation Locations</title>
+
+ <para>
+ These options control where <literal>ninja install (or meson install)</literal> will put
+ the files. The <option>--prefix</option> option is sufficient for
+ most cases. If you have special needs, you can customize the
+ installation subdirectories with the other options described in this
+ section. Beware however that changing the relative locations of the
+ different subdirectories may render the installation non-relocatable,
+ meaning you won't be able to move it after installation.
+ (The <literal>man</literal> and <literal>doc</literal> locations are
+ not affected by this restriction.)
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
+ <listitem>
+ <para>
+ Install all files under the directory <replaceable>PREFIX</replaceable>
+ instead of <filename>/usr/local/pgsql</filename>. The actual
+ files will be installed into various subdirectories; no files
+ will ever be installed directly into the
+ <replaceable>PREFIX</replaceable> directory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the directory for executable programs. The default
+ is <filename><replaceable>PREFIX</replaceable>/bin</filename>, which
+ normally means <filename>/usr/local/pgsql/bin</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for various configuration files,
+ <filename><replaceable>PREFIX</replaceable>/etc</filename> by default.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <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>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing C and C++ header files. The
+ default is <filename><replaceable>PREFIX</replaceable>/include</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for read-only data files used by the
+ installed programs. The default is
+ <filename><replaceable>PREFIX</replaceable>/share</filename>. Note that this has
+ nothing to do with where your database files will be placed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing locale data, in particular
+ message translation catalog files. The default is
+ <filename><replaceable>DATADIR</replaceable>/locale</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ The man pages that come with <productname>PostgreSQL</productname> will be installed under
+ this directory, in their respective
+ <filename>man<replaceable>x</replaceable></filename> subdirectories.
+ The default is <filename><replaceable>DATADIR</replaceable>/man</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <note>
+ <para>
+ Care has been taken to make it possible to install
+ <productname>PostgreSQL</productname> into shared installation locations
+ (such as <filename>/usr/local/include</filename>) without
+ interfering with the namespace of the rest of the system. First,
+ the string <quote><literal>/postgresql</literal></quote> is
+ automatically appended to <varname>datadir</varname>,
+ <varname>sysconfdir</varname>, and <varname>docdir</varname>,
+ unless the fully expanded directory name already contains the
+ string <quote><literal>postgres</literal></quote> or
+ <quote><literal>pgsql</literal></quote>. For example, if you choose
+ <filename>/usr/local</filename> as prefix, the documentation will
+ be installed in <filename>/usr/local/doc/postgresql</filename>,
+ but if the prefix is <filename>/opt/postgres</filename>, then it
+ will be in <filename>/opt/postgres/doc</filename>. The public C
+ header files of the client interfaces are installed into
+ <varname>includedir</varname> and are namespace-clean. The
+ internal header files and the server header files are installed
+ into private directories under <varname>includedir</varname>. See
+ the documentation of each interface for information about how to
+ access its header files. Finally, a private subdirectory will
+ also be created, if appropriate, under <varname>libdir</varname>
+ for dynamically loadable modules.
+ </para>
+ </note>
+ </sect3>
+
+ <sect3 id="configure-pg-features">
+ <title><productname>PostgreSQL</productname> Features</title>
+
+ <para>
+ The options described in this section enable building of
+ various <productname>PostgreSQL</productname> features that are not
+ built by default. Most of these are non-default only because they
+ require additional software, as described in
+ <xref linkend="install-requirements-meson"/>. To specify PostgreSQL
+ specific options, the name of the option should be prefixed by -D.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dnls=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Enables or disables Native Language Support (<acronym>NLS</acronym>),
+ that is, the ability to display a program's messages in a
+ language other than English. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To use this option, you will need an implementation of the
+ <application>Gettext</application> API.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplperl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Perl</application> server-side language. It
+ defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplpython=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Python</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpltcl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Tcl</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtcl_version=<replaceable>TCL_VERSION</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the TCL version to use when building PL/Tcl.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dicu=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for
+ the <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
+ library, enabling use of ICU collation
+ features<phrase condition="standalone-ignore"> (see
+ <xref linkend="collation"/>)</phrase>.
+ This requires the <productname>ICU4C</productname> package
+ to be installed. The minimum required version
+ of <productname>ICU4C</productname> is currently 4.2.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+
+ <para>
+ By default,
+ <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm>
+ will be used to find the required compilation options. This is
+ supported for <productname>ICU4C</productname> version 4.6 and later.
+ <!-- Add description for older ICU4C versions and when pkg-config isn't available-->
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-with-llvm-meson">
+ <term><option>-Dllvm=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for <productname>LLVM</productname> based
+ <acronym>JIT</acronym> compilation<phrase
+ condition="standalone-ignore"> (see <xref
+ linkend="jit"/>)</phrase>. This
+ requires the <productname>LLVM</productname> library to be installed.
+ The minimum required version of <productname>LLVM</productname> is
+ currently 3.9. It is set to disabled by default.
+ </para>
+ <para>
+ <command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm>
+ will be used to find the required compilation options.
+ <command>llvm-config</command>, and then
+ <command>llvm-config-$major-$minor</command> for all supported
+ versions, will be searched for in your <envar>PATH</envar>.
+ <!--Add substitute fo LLVM_CONFIG when llvm-config is not in PATH-->
+ </para>
+
+ <para>
+ <productname>LLVM</productname> support requires a compatible
+ <command>clang</command> compiler (specified, if necessary, using the
+ <envar>CLANG</envar> environment variable), and a working C++
+ compiler (specified, if necessary, using the <envar>CXX</envar>
+ environment variable).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlz4=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>LZ4</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzstd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>Zstandard</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option>
+ <indexterm>
+ <primary>OpenSSL</primary>
+ <seealso>SSL</seealso>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Build with support for <acronym>SSL</acronym> (encrypted)
+ connections. The only <replaceable>LIBRARY</replaceable>
+ supported is <option>openssl</option>. This requires the
+ <productname>OpenSSL</productname> package to be installed.
+ <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenSSL</productname> installation is sufficient
+ before proceeding. The default for this option is none.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dgssapi=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for GSSAPI authentication. On many systems, the
+ GSSAPI system (usually a part of the Kerberos installation) is not
+ installed in a location
+ that is searched by default (e.g., <filename>/usr/include</filename>,
+ <filename>/usr/lib</filename>), so you must use the options
+ <option>-Dextra_include_dirs</option> and <option>-Dextra_lib_dirs</option> in
+ addition to this option. <filename>meson configure</filename> will check
+ for the required header files and libraries to make sure that
+ your GSSAPI installation is sufficient before proceeding.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dldap=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>LDAP</acronym><indexterm><primary>LDAP</primary></indexterm>
+ support for authentication and connection parameter lookup (see
+ <phrase id="install-ldap-links-meson"><xref linkend="libpq-ldap"/> and
+ <xref linkend="auth-ldap"/></phrase> for more information). On Unix,
+ this requires the <productname>OpenLDAP</productname> package to be
+ installed. On Windows, the default <productname>WinLDAP</productname>
+ library is used. <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenLDAP</productname> installation is sufficient before
+ proceeding. It defaults to auto, meaning that it will be enabled automatically
+ if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpam=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>PAM</acronym><indexterm><primary>PAM</primary></indexterm>
+ (Pluggable Authentication Modules) support. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbsd_auth=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with BSD Authentication support. (The BSD Authentication framework is
+ currently only available on OpenBSD.) It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystemd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support
+ for <application>systemd</application><indexterm><primary>systemd</primary></indexterm>
+ service notifications. This improves integration if the server
+ is started under <application>systemd</application> but has no impact
+ otherwise<phrase condition="standalone-ignore">; see <xref linkend="server-start"/> for more
+ information</phrase>. <application>libsystemd</application> and the
+ associated header files need to be installed to use this option.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbonjour=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for Bonjour automatic service discovery.
+ This requires Bonjour support in your operating system.
+ Recommended on macOS. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <xref linkend="uuid-ossp"/> module
+ (which provides functions to generate UUIDs), using the specified
+ UUID library.<indexterm><primary>UUID</primary></indexterm>
+ <replaceable>LIBRARY</replaceable> must be one of:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <option>none</option> to not build the ussp module. This is the default.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>bsd</option> to use the UUID functions found in FreeBSD, NetBSD,
+ and some other BSD-derived systems
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>e2fs</option> to use the UUID library created by
+ the <literal>e2fsprogs</literal> project; this library is present in most
+ Linux systems and in macOS, and can be obtained for other
+ platforms as well
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>ossp</option> to use the <ulink
+ url="http://www.ossp.org/pkg/lib/uuid/">OSSP UUID library</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxml=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxml2, enabling SQL/XML support. Libxml2 version 2.6.23 or
+ later is required for this feature. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To detect the required compiler and linker options, PostgreSQL will
+ query <command>pkg-config</command>, if that is installed and knows
+ about libxml2. Otherwise the program <command>xml2-config</command>,
+ which is installed by libxml2, will be used if it is found. Use
+ of <command>pkg-config</command> is preferred, because it can deal
+ with multi-architecture installations better.
+ </para>
+
+ <para>
+ To use a libxml2 installation that is in an unusual location, you
+ can set <command>pkg-config</command>-related environment
+ variables (see its documentation).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxslt=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxslt, enabling the
+ <xref linkend="xml2"/>
+ module to perform XSL transformations of XML.
+ <option>-Dlibxml</option> must be specified as well.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dreadline=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Allows use of the <application>Readline</application> library
+ (and <application>libedit</application> as well). This option enables
+ command-line editing and history in
+ <application>psql</application> and is strongly recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibedit_preferred=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this to true favors the use of the BSD-licensed <application>libedit</application> library
+ rather than GPL-licensed <application>Readline</application>. This option
+ is significant only if you have both libraries installed; the
+ default is false that is to use <application>Readline</application>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzlib=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+ Enabls use of the <application>Zlib</application> library.
+ This enables
+ support for compressed archives in <application>pg_dump</application>
+ and <application>pg_restore</application> and is recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dspinlocks=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true by default and
+ setting it to false will allow the build to succeed even if <productname>PostgreSQL</productname>
+ has no CPU spinlock support for the platform. The lack of
+ spinlock support will result in very poor performance; therefore,
+ this option should only be changed if the build aborts and
+ informs you that the platform lacks spinlock support. If setting this
+ option to false is required to build <productname>PostgreSQL</productname> on
+ your platform, please report the problem to the
+ <productname>PostgreSQL</productname> developers.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Datomics=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true and setting it to false will
+ disable use of CPU atomic operations. The option does nothing on
+ platforms that lack such operations. On platforms that do have
+ them, disabling atomics will result in poor performance. Changing
+ this option is only useful for debugging or making performance comparisons.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-build-process">
+ <title>Build Process Details</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>--auto_features=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this option allows you to override value of all 'auto' features.
+ This can be useful when you want to disable or enable all the "optional"
+ features at once without having to set each of them manually. The default
+ value for this parameter is auto.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--backend=<replaceable>BACKEND</replaceable></option></term>
+ <listitem>
+ <para>
+ The default backend meson uses is ninja and that should suffice for most use cases.
+ However, if you'd like to fully integrate with visual studio, you can set the
+ BACKEND to <command>vs</command>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C compiler.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_link_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C linker.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_include_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories that will be added to the list the compiler
+ searches for header files. If you have optional packages
+ (such as GNU <application>Readline</application>) installed in a non-standard
+ location,
+ you have to use this option and probably also the corresponding
+ <option>-Dextra_lib_dirs</option> option.
+ </para>
+ <para>
+ Example: <literal>-Dextra_include_dirs=/opt/gnu/include:/usr/sup/include</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_lib_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories to search for libraries. You will probably have
+ to use this option (and the corresponding
+ <option>-Dextra_include_dirs</option> option) if you have packages
+ installed in non-standard locations.
+ </para>
+ <para>
+ Example: <literal>-Dextra_lib_dirs=/opt/gnu/lib:/usr/sup/lib</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystem_tzdata=<replaceable>DIRECTORY</replaceable></option>
+ <indexterm>
+ <primary>time zone data</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ <productname>PostgreSQL</productname> includes its own time zone database,
+ which it requires for date and time operations. This time zone
+ database is in fact compatible with the IANA time zone
+ database provided by many operating systems such as FreeBSD,
+ Linux, and Solaris, so it would be redundant to install it again.
+ When this option is used, the system-supplied time zone database
+ in <replaceable>DIRECTORY</replaceable> is used instead of the one
+ included in the PostgreSQL source distribution.
+ <replaceable>DIRECTORY</replaceable> must be specified as an
+ absolute path. <filename>/usr/share/zoneinfo</filename> is a
+ likely directory on some operating systems. Note that the
+ installation routine will not detect mismatching or erroneous time
+ zone data. If you use this option, you are advised to run the
+ regression tests to verify that the time zone data you have
+ pointed to works correctly with <productname>PostgreSQL</productname>.
+ </para>
+
+ <indexterm><primary>cross compilation</primary></indexterm>
+
+ <para>
+ This option is mainly aimed at binary package distributors
+ who know their target operating system well. The main
+ advantage of using this option is that the PostgreSQL package
+ won't need to be upgraded whenever any of the many local
+ daylight-saving time rules change. Another advantage is that
+ PostgreSQL can be cross-compiled more straightforwardly if the
+ time zone database files do not need to be built during the
+ installation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term>
+ <listitem>
+ <para>
+ Append <replaceable>STRING</replaceable> to the PostgreSQL version number. You
+ can use this, for example, to mark binaries built from unreleased Git
+ snapshots or containing custom patches with an extra version string,
+ such as a <command>git describe</command> identifier or a
+ distribution package release number.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
+ <listitem>
+ <para>
+ If you have the binaries for certain by programs required to build
+ Postgres (with or without optional flags) stored at non-standard
+ paths, you could specify them manually to meson configure. The complete
+ list of programs for whom this is supported can be found by running
+ <literal>meson configure</literal>. An example is included below.
+<programlisting>meson configure -DBISON=PATH_TO_BISON</programlisting>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-layout">
+ <title>Data layout</title>
+
+ <para>
+ These options affect how PostgreSQL lays out data on disk.
+ Note that changing these breaks on-disk database compatibility,
+ meaning you cannot use <command>pg_upgrade</command> to upgrade to
+ a build with a different value of these options.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>segment size</firstterm>, in gigabytes. Large tables are
+ divided into multiple operating-system files, each of size equal
+ to the segment size. This avoids problems with file size limits
+ that exist on many platforms. The default segment size, 1 gigabyte,
+ is safe on all supported platforms. If your operating system has
+ <quote>largefile</quote> support (which most do, nowadays), you can use
+ a larger segment size. This can be helpful to reduce the number of
+ file descriptors consumed when working with very large tables.
+ But be careful not to select a value larger than is supported
+ by your platform and the file systems you intend to use. Other
+ tools you might wish to use, such as <application>tar</application>, could
+ also set limits on the usable file size.
+ It is recommended, though not absolutely required, that this value
+ be a power of 2.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within tables. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 32 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>WAL block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within the WAL log. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 64 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-devel">
+ <title>Developer Options</title>
+
+ <para>
+ Most of the options in this section are only of interest for
+ developing or debugging <productname>PostgreSQL</productname>.
+ They are not recommended for production builds, except
+ for <option>--debug</option>, which can be useful to enable
+ detailed bug reports in the unlucky event that you encounter a bug.
+ On platforms supporting DTrace, <option>-Ddtrace</option>
+ may also be reasonable to use in production.
+ </para>
+
+ <para>
+ When building an installation that will be used to develop code inside
+ the server, it is recommended to use atleast the <option>--buildtype=debug</option>
+ and <option>-Dcassert</option> options.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to specify the buildtype to use; defaults
+ to release. If you'd like finer control on the debug symbols
+ and optimization levels than what this option provides, you can
+ refer to the --debug and --optimization flags.
+
+ The following build types are generally used:
+ <variablelist>
+ <varlistentry>
+ <term><literal>plain</literal></term>
+ <listitem>
+ <para>
+ No extra build flags are used, even for compiler warnings,
+ useful for distro packagers and other cases where you need to
+ specify all arguments by yourself.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debug</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated but the result is not optimized.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debugoptimized</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated and the code is optimized (on most compilers
+ this means <literal>-g -O2</literal>)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>release</literal></term>
+ <listitem>
+ <para>
+ This enables full optimization and no debug info is generated. This is
+ the default.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--debug</option></term>
+ <listitem>
+ <para>
+ Compiles all programs and libraries with debugging symbols.
+ This means that you can run the programs in a debugger
+ to analyze problems. This enlarges the size of the installed
+ executables considerably, and on non-GCC compilers it usually
+ also disables compiler optimization, causing slowdowns. However,
+ having the symbols available is extremely helpful for dealing
+ with any problems that might arise. Currently, this option is
+ recommended for production installations only if you use GCC.
+ But you should always have it on if you are doing development work
+ or running a beta version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term>
+ <listitem>
+ <para>
+ Specify the optimization level. LEVEL can be set to any of {0,g,1,2,3,s}.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--werror</option></term>
+ <listitem>
+ <para>
+ Setting this option asks the compiler to treat warnings as errors. This can
+ be useful for code development purposes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dcassert</option></term>
+ <listitem>
+ <para>
+ Enables <firstterm>assertion</firstterm> checks in the server, which test for
+ many <quote>cannot happen</quote> conditions. This is invaluable for
+ code development purposes, but the tests can slow down the
+ server significantly.
+ Also, having the tests turned on won't necessarily enhance the
+ stability of your server! The assertion checks are not categorized
+ for severity, and so what might be a relatively harmless bug will
+ still lead to server restarts if it triggers an assertion
+ failure. This option is not recommended for production use, but
+ you should have it on for development work or when running a beta
+ version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtap-tests</option></term>
+ <listitem>
+ <para>
+ Enable tests using the Perl TAP tools. This requires a Perl
+ installation and the Perl module <literal>IPC::Run</literal>.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-tap"/> for more information.</phrase>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-DPG_TEST_EXTRA=<replaceable>TEST_SUITES</replaceable></option></term>
+ <listitem>
+ <para>
+ Enable test suites which require special software to run. This option
+ accepts arguments via a whitespace-separated list. The following values
+ are currently supported:
+ <variablelist>
+ <varlistentry>
+ <term><literal>kerberos</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/kerberos</filename>. This
+ requires an MIT Kerberos installation and opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ldap</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ldap</filename>. This
+ requires an <productname>OpenLDAP</productname> installation and opens
+ TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ssl</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ssl</filename>. This opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>wal_consistency_checking</literal></term>
+ <listitem>
+ <para>
+ Uses <literal>wal_consistency_checking=all</literal> while running
+ certain tests under <filename>src/test/recovery</filename>. Not
+ enabled by default because it is resource intensive.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ Tests for features that are not supported by the current build
+ configuration are not run even if they are mentioned in
+ <varname>PG_TEST_EXTRA</varname>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--errorlogs</option></term>
+ <listitem>
+ <para>
+ This option can be used to print the logs from the failing tests
+ making debugging easier.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Db_coverage</option></term>
+ <listitem>
+ <para>
+ If using GCC, all programs and libraries are compiled with
+ code coverage testing instrumentation. When run, they
+ generate files in the build directory with code coverage
+ metrics.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-coverage"/>
+ for more information.</phrase> This option is for use only with GCC
+ and when doing development work.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Ddtrace=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>DTrace</primary>
+ </indexterm>
+ Enabling this compiles <productname>PostgreSQL</productname> with support for the
+ dynamic tracing tool DTrace.
+ <phrase condition="standalone-ignore">See <xref linkend="dynamic-trace"/>
+ for more information.</phrase>
+ </para>
+
+ <para>
+ To point to the <command>dtrace</command> program, the
+ environment variable <envar>DTRACE</envar> can be set. This
+ will often be necessary because <command>dtrace</command> is
+ typically installed under <filename>/usr/sbin</filename>,
+ which might not be in your <envar>PATH</envar>.
+ </para>
+
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-misc">
+ <title>Miscellaneous</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term>
+ <listitem>
+ <para>
+ Set <replaceable>NUMBER</replaceable> as the 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
+ <productname>PostgreSQL</productname> servers on the same machine.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term>
+ <listitem>
+ <para>
+ The default name of the Kerberos service principal used
+ by GSSAPI.
+ <literal>postgres</literal> is the default. There's usually no
+ reason to change this unless you are building for a Windows
+ environment, in which case it must be set to upper case
+ <literal>POSTGRES</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="build-meson">
+ <title>Building the source</title>
+ <para>
+ By default, <productname>Meson</productname> uses the
+ <ulink url="https://ninja-build.org/"> Ninja build system</ulink>.
+ To build <productname>PostgreSQL</productname> from source using meson, you can
+ simply use the <literal>ninja</literal> command in the build directory.
+<screen>
+ninja
+</screen>
+ Ninja will automatically detect the number of CPUs in your computer and
+ parallelize itself accordingly. You can override the amount of parallel
+ processes used with the command line argument <literal>-j</literal>.
+ </para>
+
+ <para>
+ It should be noted that after the initial configure step
+ <command>ninja</command> is the only command you ever need to type to
+ compile. No matter how you alter your source tree (short of moving it to
+ a completely new location), Meson will detect the changes and regenerate
+ itself accordingly. This is especially handy if you have multiple build
+ directories. Often one of them is used for development (the "debug" build)
+ and others only every now and then (such as a "static analysis" build).
+ Any configuration can be built just by cd'ing to the corresponding directory
+ and running Ninja.
+ </para>
+
+ <para>
+ If you'd like to build with a backend other that ninja, you can use configure
+ with the <option>--backend</option> option to select the one you want to use and then
+ build using <literal>meson compile</literal>. To learn more about these
+ backends and other arguments you can provide to ninja, you can refer to the
+ meson <ulink url="https://mesonbuild.com/Running-Meson.html#building-from-the-source">
+ documentation</ulink>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-files-meson">
+ <title>Installing the files</title>
+ <para>
+ Once Postgres is built, you can install it by simply running the
+ <literal>ninja install</literal> command.
+
+<screen>
+ninja install
+</screen>
+ </para>
+
+ <para>
+ This will install files into the directories that were specified
+ in <xref linkend="configure-meson"/>. Make sure that you have appropriate
+ permissions to write into that area. You might need to do this
+ step as root. Alternatively, you can create the target directories
+ in advance and arrange for appropriate permissions to be granted.
+ The standard installation provides all the header files needed for client
+ application development as well as for server-side program
+ development, such as custom functions or data types written in C.
+ </para>
+
+ <para>
+ <literal>ninja install</literal> should work for most cases
+ but if you'd like to use more options, you could also use
+ <literal>meson install</literal> instead. You can learn more about
+ <ulink url="https://mesonbuild.com/Commands.html#install">meson install</ulink>
+ and it's options in the meson documentation.
+ </para>
+
+ <para>
+ Depending on your platform and setup, you might have to perform a
+ few steps after installation. Those are outlined in
+ <xref linkend="install-post"/>.
+ </para>
+
+ <formalpara>
+ <title>Uninstallation:</title>
+ <para>
+ To undo the installation, you can use the <command>ninja
+ uninstall</command> command.
+ </para>
+ </formalpara>
+
+ <formalpara>
+ <title>Cleaning:</title>
+ <para>
+ After the installation you can free disk space by removing the built
+ files from the source tree with the <command>ninja clean</command>
+ command.
+ </para>
+ </formalpara>
+
+ </sect2>
+
+ <sect2 id="running-tests">
+ <title>Running tests</title>
+ <para>
+ If you want to test the newly built server, you can run the regression
+ tests. The regression tests are a collection of test suites to verify
+ that <productname>PostgreSQL</productname> runs on your machine in
+ the way the developers expected it to. To run them, simply type:
+<screen>
+<userinput>meson test</userinput>
+</screen>
+ You can repeat this at any later time by issuing the same command.
+ </para>
+
+ <para>Meson also allows you to list tests and run specific tests or suites.
+<screen>
+# List all tests
+<userinput>meson test --list</userinput>
+
+# Run a specific test
+<userinput>meson test recovery/001_stream_rep</userinput>
+
+# Run the main pg_regress and isolation tests
+<userinput>meson test --suite main</userinput>
+</screen>
+ </para>
+
+ <para>
+ To learn more about running the tests and how to interpret the results
+ you can refer to the documentation for interpreting test results.
+ <literal>meson test</literal> also provides a number of additional
+ options you can use which can be found in the
+ <ulink url="https://mesonbuild.com/Unit-tests.html#testing-tool">meson test documentation</ulink>.
+ </para>
+
+ </sect2>
+
+ </sect1>
+
<sect1 id="install-post">
<title>Post-Installation Setup</title>
@@ -2106,62 +3797,6 @@ export MANPATH
</sect2>
</sect1>
- <sect1 id="supported-platforms">
- <title>Supported Platforms</title>
-
- <para>
- A platform (that is, a CPU architecture and operating system combination)
- is considered supported by the <productname>PostgreSQL</productname> development
- community if the code contains provisions to work on that platform and
- it has recently been verified to build and pass its regression tests
- on that platform. Currently, most testing of platform compatibility
- is done automatically by test machines in the
- <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
- If you are interested in using <productname>PostgreSQL</productname> on a platform
- that is not represented in the build farm, but on which the code works
- or can be made to work, you are strongly encouraged to set up a build
- farm member machine so that continued compatibility can be assured.
- </para>
-
- <para>
- In general, <productname>PostgreSQL</productname> can be expected to work on
- these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
- and PA-RISC, including
- big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
- It is often
- possible to build on an unsupported CPU type by configuring with
- <option>--disable-spinlocks</option>, but performance will be poor.
- </para>
-
- <para>
- <productname>PostgreSQL</productname> can be expected to work on current
- versions of these operating systems: Linux, Windows,
- FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
- Other Unix-like systems may also work but are not currently
- being tested. In most cases, all CPU architectures supported by
- a given operating system will work. Look in
- <xref linkend="installation-platform-notes"/> below to see if
- there is information
- specific to your operating system, particularly if using an older system.
- </para>
-
- <para>
- If you have installation problems on a platform that is known
- to be supported according to recent build farm results, please report
- it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
- in porting <productname>PostgreSQL</productname> to a new platform,
- <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
- to discuss that.
- </para>
-
- <para>
- Historical versions of <productname>PostgreSQL</productname> or POSTGRES
- also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
- M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
- BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
- Tru64 UNIX, and ULTRIX.
- </para>
- </sect1>
<sect1 id="installation-platform-notes">
<title>Platform-Specific Notes</title>
@@ -2170,7 +3805,7 @@ export MANPATH
This section documents additional platform-specific issues
regarding the installation and setup of PostgreSQL. Be sure to
read the installation instructions, and in
- particular <xref linkend="install-requirements"/> as well. Also,
+ particular <xref linkend="install-requirements-make"/> as well. Also,
check <xref linkend="regress"/> regarding the
interpretation of regression test results.
</para>
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 1d9509a2f66..214e1b1d551 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -7072,7 +7072,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
explicitly tell the configure script to make the probes available
in <productname>PostgreSQL</productname>. To include DTrace support
specify <option>--enable-dtrace</option> to configure. See <xref
- linkend="install-procedure"/> for further information.
+ linkend="configure-options-devel"/> for further information.
</para>
</sect2>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index c802c0c5f50..3d860550d7f 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1855,7 +1855,7 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
<step>
<para>
Install the new version of <productname>PostgreSQL</productname> as
- outlined in <xref linkend="install-procedure"/>.
+ outlined in <xref linkend="installation"/>.
</para>
</step>
diff --git a/doc/src/sgml/sourcerepo.sgml b/doc/src/sgml/sourcerepo.sgml
index 0ed7f8a3fea..f16be29a61a 100644
--- a/doc/src/sgml/sourcerepo.sgml
+++ b/doc/src/sgml/sourcerepo.sgml
@@ -20,9 +20,10 @@
Note that building <productname>PostgreSQL</productname> from the source
repository requires reasonably up-to-date versions of <application>bison</application>,
<application>flex</application>, and <application>Perl</application>. These tools are not needed
- to build from a distribution tarball, because the files that these tools
+ to build from a distribution tarball if building via make, because the files that these tools
are used to build are included in the tarball. Other tool requirements
- are the same as shown in <xref linkend="install-requirements"/>.
+ are the same as shown in <xref linkend="install-requirements-make"/> and
+ <xref linkend="install-requirements-meson"/>.
</para>
<sect1 id="git">
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0016-meson-Add-PGXS-compatibility.patch (7.4K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/17-v13-0016-meson-Add-PGXS-compatibility.patch)
download | inline diff:
From f262548df27ea01cf2a849268fec70282365126e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 20:27:17 -0700
Subject: [PATCH v13 16/20] meson: Add PGXS compatibility
This works for some extensions on some operating systems, but could use plenty
of cleanups.
---
src/meson.build | 259 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 259 insertions(+)
diff --git a/src/meson.build b/src/meson.build
index a7fdd5a13ed..4c991a656d2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -10,3 +10,262 @@ subdir('bin')
subdir('pl')
subdir('interfaces')
+
+
+### Generate a Makefile.global that's complete enough for PGXS to work.
+#
+# This is somewhat ugly, but allows extensions to only use a single
+# buildsystem across all the supported postgres versions. Once all supported
+# PG versions support meson, we can remove all of this.
+#
+# XXX: Should we make this optional?
+
+pgxs_kv = {
+ 'PACKAGE_URL': pg_url,
+ 'PACKAGE_VERSION': pg_version,
+ 'PG_MAJORVERSION': pg_version_major,
+ 'PG_VERSION_NUM': pg_version_num,
+ 'configure_input': 'meson',
+
+ 'vpath_build': 'yes',
+ 'autodepend': 'no', # XXX: Should we just set this to true when possible?
+
+ 'host_cpu': host_cpu,
+ 'host': '@0@-@1@'.format(host_cpu, host_system),
+ 'host_os': host_system,
+ 'build_os': build_machine.system(),
+ 'PORTNAME': portname,
+ 'PG_SYSROOT': pg_sysroot,
+
+ 'abs_top_builddir': meson.build_root(),
+ 'abs_top_srcdir': meson.source_root(),
+
+ 'enable_thread_safety': 'yes',
+ 'enable_rpath': 'yes',
+ 'enable_nls': libintl.found() ? 'yes' : 'no',
+ 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
+ 'enable_debug': get_option('debug') ? 'yes' : 'no',
+ 'enable_coverage': get_option('b_coverage') ? 'yes' : 'no',
+ 'enable_dtrace': dtrace.found() ? 'yes' : 'no',
+
+ 'DLSUFFIX': dlsuffix,
+ 'EXEEXT': exesuffix,
+
+ 'SUN_STUDIO_CC': 'no', # not supported so far
+
+ 'default_port': get_option('pgport'),
+ 'with_system_tzdata': get_option('system_tzdata'),
+
+ 'with_krb_srvnam': get_option('krb_srvnam'),
+ 'krb_srvtab': krb_srvtab,
+
+ # FIXME: implement programs.m4 logic in PGAC_CHECK_STRIP
+ 'STRIP': 'strip',
+ 'STRIP_STATIC_LIB': 'strip -x',
+ 'STRIP_SHARED_LIB': 'strip --strip-unneeded',
+
+ # Just always use the install_sh fallback that autoconf uses. Unlikely to
+ # matter performance-wise for extensions. If it turns out to do, we can
+ # improve that later.
+ 'MKDIR_P': ' '.join([install_sh.path(), '-d']),
+
+ 'CC': var_cc,
+ 'CPP': var_cpp,
+ 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
+ 'with_gnu_ld': (cc.get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.lld'] ? 'yes' : 'no'),
+
+ 'CFLAGS': var_cflags,
+ 'CPPFLAGS': var_cppflags,
+ 'CXXFLAGS': var_cxxflags,
+ 'CFLAGS_SL': var_cflags_sl,
+ 'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
+ 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
+ 'CFLAGS_SSE42': ' '.join(cflags_crc),
+ 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
+ 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
+
+ # FIXME:
+ 'CFLAGS_ARMV8_CRC32C': '',
+ 'BITCODE_CFLAGS': '',
+ 'BITCODE_CXXFLAGS': '',
+
+ 'LDFLAGS': var_ldflags,
+ 'LDFLAGS_EX': var_ldflags_ex,
+ 'LDFLAGS_SL': var_ldflags_sl,
+
+ 'BISONFLAGS': ' '.join(bison_flags),
+ 'FLEXFLAGS': ' '.join(flex_flags),
+
+ 'LIBS': var_libs,
+}
+
+if llvm.found()
+ pgxs_kv += {
+ 'CLANG': clang.path(),
+ 'CXX': ' '.join(cpp.cmd_array()),
+ 'LLVM_BINPATH': llvm_binpath,
+ }
+else
+ pgxs_kv += {
+ 'CLANG': '',
+ 'CXX': '',
+ 'LLVM_BINPATH': '',
+ }
+endif
+
+pgxs_cdata = configuration_data(pgxs_kv)
+
+# FIXME: figure out which platforms we still need the linker "directly" -
+# can't be many?
+
+ld_program = find_program(cc.get_linker_id(), native: true, required: false)
+
+pgxs_bins = {
+ 'BISON': bison,
+ 'FLEX': flex,
+ 'GZIP': gzip,
+ 'LZ4': program_lz4,
+ 'PERL': perl,
+ 'PROVE': prove,
+ 'PYTHON': python,
+ 'TAR': tar,
+ 'ZSTD': program_zstd,
+ 'DTRACE': dtrace,
+ 'LD': ld_program,
+ 'install_bin': install_sh,
+}
+foreach b, p : pgxs_bins
+ pgxs_cdata.set(b, p.found() ? p.path() : '')
+endforeach
+
+pgxs_empty = [
+ 'PERMIT_DECLARATION_AFTER_STATEMENT',
+ 'ICU_CFLAGS', # needs to be added, included by public server headers
+
+ # probably need most of these?
+ 'RANLIB',
+ 'WINDRES',
+ 'LN_S',
+ 'AR',
+ 'AWK',
+
+ # hard to see why we'd need either?
+ 'ZIC',
+ 'TCLSH',
+
+ # docs don't seem to be supported by pgxs
+ 'XMLLINT',
+ 'XSLTPROC',
+ 'DBTOEPUB',
+ 'FOP',
+
+ # supporting coverage for pgxs-in-meson build doesn't seem worth it
+ 'GENHTML',
+ 'LCOV',
+ 'GCOV',
+ 'MSGFMT_FLAGS',
+
+ # translation doesn't appear to be supported by pgxs
+ 'MSGFMT',
+ 'XGETTEXT',
+ 'MSGMERGE',
+ 'WANTED_LANGUAGES',
+
+ # Not needed because we don't build the server / PLs with the generated makefile
+ 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
+ 'DTRACEFLAGS', # only server has dtrace probes
+
+ 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
+ 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
+
+ # possible that some of these are referenced explicitly in pgxs makefiles?
+ # For now not worth it.
+ 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
+
+ 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
+
+ 'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
+
+ 'UUID_LIBS',
+
+ 'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
+
+ 'ICU_LIBS',
+]
+
+foreach pe : pgxs_empty
+ pgxs_cdata.set(pe, '')
+endforeach
+
+pgxs_dirs = {
+ 'prefix': get_option('prefix'),
+
+ 'bindir': '${exec_prefix}' / get_option('bindir'),
+ 'datarootdir': '${prefix}' / get_option('datadir'),
+ 'datadir': '${datarootdir}',
+ 'docdir': '${prefix}' / dir_doc,
+ 'exec_prefix': '${prefix}',
+ 'htmldir': '${prefix}' / dir_doc_html, #?
+ 'includedir': '${prefix}' / get_option('includedir'),
+ 'libdir': '${exec_prefix}' / get_option('libdir'),
+ 'localedir': '${prefix}' / get_option('localedir'),
+ 'mandir': '${prefix}' / get_option('mandir'),
+ 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
+}
+
+foreach d, p : pgxs_dirs
+ pgxs_cdata.set(d, p)
+endforeach
+
+pgxs_deps = {
+ 'bonjour': bonjour,
+ 'bsd_auth': bsd_auth,
+ 'gssapi': gssapi,
+ 'icu': icu,
+ 'ldap': ldap,
+ 'libxml': libxml,
+ 'libxslt': libxslt,
+ 'llvm': llvm,
+ 'lz4': lz4,
+ 'nls': libintl,
+ 'pam': pam,
+ 'perl': perl_dep,
+ 'python': python3_dep,
+ 'readline': readline,
+ 'selinux': selinux,
+ 'systemd': systemd,
+ 'tcl': tcl_dep,
+ 'zlib': zlib,
+ 'zstd': zstd,
+}
+foreach d, v : pgxs_deps
+ pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')
+endforeach
+
+pgxs_cdata.set('with_ssl', get_option('ssl'))
+pgxs_cdata.set('with_uuid', uuidopt)
+
+makefile_global = configure_file(
+ input: 'Makefile.global.in',
+ output: 'Makefile.global',
+ configuration: pgxs_cdata,
+ install: true,
+ install_dir: dir_pgxs / 'src',
+)
+configure_files += makefile_global
+
+# FIXME: check if exists
+makefile_port = configure_file(
+ input: 'makefiles' / 'Makefile.@0@'.format(portname),
+ output: 'Makefile.port',
+ copy: true,
+ install_dir: dir_pgxs / 'src')
+configure_files += makefile_port
+
+install_data(
+ 'Makefile.shlib', 'nls-global.mk',
+ install_dir: dir_pgxs / 'src')
+
+install_data(
+ 'makefiles/pgxs.mk',
+ install_dir: dir_pgxs / 'src' / 'makefiles')
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0017-meson-Add-postgresql-extension.pc-for-building-e.patch (3.7K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/18-v13-0017-meson-Add-postgresql-extension.pc-for-building-e.patch)
download | inline diff:
From 5663a3db376bf36d0c313eb642cc459c1fb18853 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:52:03 -0700
Subject: [PATCH v13 17/20] meson: Add postgresql-extension.pc for building
extension libraries
This should work with several other buildsystems.
TODO: Docs and example
---
src/backend/meson.build | 96 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index fefa40ddb64..0598085a240 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -180,6 +180,102 @@ pg_mod_args = default_mod_args + {
+###############################################################
+# Define a .pc file that can be used to build server extensions
+###############################################################
+
+pg_ext_vars = []
+pg_ext_vars_inst = []
+pg_ext_vars_uninst = []
+
+pg_ext_cflags = pg_mod_c_args
+pg_ext_libs = [backend_mod_code, thread_dep, ldflags, ldflags_mod]
+pg_ext_subdirs = ['']
+
+# Compute directories to add include directories to the .pc files for.
+# This is a bit more complicated due to port/win32 etc.
+i = 0
+foreach incdir : postgres_inc_d
+ if incdir.startswith('src/include')
+ subincdir = dir_include_pkg_rel / 'server' / incdir.split('src/include/').get(1, '')
+ else
+ subincdir = ''
+ endif
+ pg_ext_subdirs += subincdir
+
+ # Add directories in source / build dir containing headers to cflags for the
+ # -uninstalled.pc
+ pg_ext_vars_uninst += [
+ 'build_inc@0@=-I${prefix}/@1@'.format(i, incdir),
+ 'src_inc@0@=-I${srcdir}/@1@'.format(i, incdir),
+ ]
+ pg_ext_cflags += [
+ '${build_inc@0@}'.format(i),
+ '${src_inc@0@}'.format(i)
+ ]
+
+ i += 1
+endforeach
+
+
+# Extension modules should likely also use -fwrapv etc. But it it's a bit odd
+# to expose it to a .pc file?
+pg_ext_cflags += cflags
+
+# Directories for extensions to install into
+# XXX: more needed
+pg_ext_vars += 'pkglibdir=${prefix}/@0@'.format(dir_lib_pkg)
+pg_ext_vars += 'dir_mod=${pkglibdir}'
+pg_ext_vars += 'dir_data=${prefix}/@0@'.format(dir_data_extension)
+# referenced on some platforms, via mod_link_with_dir
+pg_ext_vars += 'bindir=${prefix}/@0@'.format(dir_bin)
+
+# XXX: Define variables making it easy to define tests, too
+
+# Some platforms need linker flags to link with binary, they are the same
+# between building with meson and .pc file, except that we have have to
+# reference a variable to make it work for both normal and -uninstalled .pc
+# files.
+if mod_link_args_fmt.length() != 0
+ assert(link_with_inst != '')
+ assert(link_with_uninst != '')
+
+ pg_ext_vars_inst += 'mod_link_with=@0@'.format(link_with_inst)
+ pg_ext_vars_uninst += 'mod_link_with=@0@'.format(link_with_uninst)
+
+ foreach el : mod_link_args_fmt
+ pg_ext_libs += el.format('${mod_link_with}')
+ endforeach
+endif
+
+# main .pc to build extensions
+pkgconfig.generate(
+ name: 'postgresql-extension',
+ description: 'PostgreSQL Extension Support',
+ url: pg_url,
+
+ subdirs: pg_ext_subdirs,
+ libraries: pg_ext_libs,
+ extra_cflags: pg_ext_cflags,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+# a .pc depending on the above, but with all our warnings enabled
+pkgconfig.generate(
+ name: 'postgresql-extension-warnings',
+ description: 'PostgreSQL Extension Support - Compiler Warnings',
+ requires: 'postgresql-extension',
+ url: pg_url,
+ extra_cflags: cflags_warn,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+
+
# Shared modules that, on some system, link against the server binary. Only
# enter these after we defined the server build.
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0018-meson-Add-LLVM-bitcode-emission.patch (5.2K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/19-v13-0018-meson-Add-LLVM-bitcode-emission.patch)
download | inline diff:
From 3e93a32d8b50435546654ea23a52b07bc13164dc Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 19:58:45 -0700
Subject: [PATCH v13 18/20] meson: Add LLVM bitcode emission
This needs a bit more love before being ready...
---
src/backend/jit/llvm/meson.build | 21 +++++++++++++++
src/backend/meson.build | 46 ++++++++++++++++++++++++++++++++
meson.build | 2 ++
src/tools/irlink | 43 +++++++++++++++++++++++++++++
4 files changed, 112 insertions(+)
create mode 100644 src/tools/irlink
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index de2e624ab58..ede51503377 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -48,6 +48,19 @@ else
llvm_irgen_command = clang
endif
+llvm_irlink_kw = {
+ 'command': [
+ irlink,
+ '--name', 'postgres',
+ '--lto', llvm_lto,
+ '--outdir', '@OUTPUT0@',
+ '--privdir', '@PRIVATE_DIR@',
+ '@INPUT@',
+ ],
+ 'install': true,
+ 'install_dir': dir_lib_pkg,
+}
+
# XXX: Need to determine proper version of the function cflags for clang
bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
@@ -71,3 +84,11 @@ llvmjit_types = custom_target('llvmjit_types.bc',
depfile: '@BASENAME@.c.bc.d',
)
backend_targets += llvmjit_types
+
+# Figure out -I's needed to build all postgres code, including all its
+# dependencies
+pkg_config = find_program(['pkg-config', 'pkgconf'], required: true)
+r = run_command(pkg_config,
+ ['--cflags-only-I', meson.build_root() / 'meson-uninstalled/postgresql-extension-uninstalled.pc'],
+ check: true)
+bitcode_cflags += r.stdout().split()
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 0598085a240..3f5e9883c0c 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -284,3 +284,49 @@ subdir('replication/libpqwalreceiver')
subdir('replication/pgoutput')
subdir('snowball')
subdir('utils/mb/conversion_procs')
+
+
+
+###############################################################
+# emit LLVM bitcode of backend code for JIT inlining
+###############################################################
+
+if llvm.found()
+
+ # custom_target() insists on targetting files into the current
+ # directory. But we have files with the same name in different
+ # subdirectories. generators() don't have that problem, but their results
+ # are not installable. The irlink command copies the files for us.
+ #
+ # FIXME: this needs to be in a central place
+ #
+ # generators don't accept CustomTargetIndex as input or 'depends', nor do
+ # they like targets with more than one output. However, a custom target
+ # accepts them as input without a problem. So we have the below transitive
+ # target :(
+
+ transitive_depend_target = custom_target('stamp',
+ input: generated_headers + generated_backend_headers + generated_backend_sources,
+ output: 'stamp',
+ command: [touch, '@OUTPUT@'],
+ install: false)
+
+ llvm_gen = generator(llvm_irgen_command,
+ arguments: llvm_irgen_args + bitcode_cflags,
+ depends: transitive_depend_target,
+ depfile: '@BASENAME@.c.bc.d',
+ output: '@PLAINNAME@.bc',
+ )
+
+ bc_backend_sources = llvm_gen.process(backend_sources,
+ preserve_path_from: meson.current_source_dir())
+
+ postgres_llvm = custom_target('bitcode',
+ output: ['bitcode'],
+ input: bc_backend_sources,
+ kwargs: llvm_irlink_kw,
+ )
+
+ backend_targets += postgres_llvm
+
+endif
diff --git a/meson.build b/meson.build
index 31c7dbe0ea0..a56af6ccb0e 100644
--- a/meson.build
+++ b/meson.build
@@ -684,6 +684,8 @@ if not llvmopt.disabled()
ccache = find_program('ccache', native: true, required: false)
clang = find_program(llvm_binpath / 'clang', required: true)
+ llvm_lto = find_program(llvm_binpath / 'llvm-lto', required: true)
+ irlink = find_program('src/tools/irlink', native: true)
endif
else
llvm = not_found_dep
diff --git a/src/tools/irlink b/src/tools/irlink
new file mode 100644
index 00000000000..813bbf13398
--- /dev/null
+++ b/src/tools/irlink
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+import argparse
+
+parser = argparse.ArgumentParser(
+ description='generate PostgreSQL JIT IR module')
+
+parser.add_argument('--name', type=str, required=True)
+parser.add_argument('--lto', type=str, required=True)
+parser.add_argument('--privdir', type=str, required=True)
+parser.add_argument('--outdir', type=str, required=True)
+parser.add_argument('INPUT', type=str, nargs='+')
+
+args = parser.parse_args()
+
+outdir = os.path.realpath(args.outdir)
+privdir = os.path.realpath(args.privdir)
+
+index = '{0}/{1}.index.bc'.format(outdir, args.name)
+destdir = '{0}/{1}'.format(outdir, args.name)
+
+# Remove old contents if exist
+if os.path.exists(destdir):
+ shutil.rmtree(destdir)
+
+shutil.copytree(privdir, destdir)
+
+# Change working directory for irlink to link correctly
+os.chdir(args.outdir)
+
+file_names = []
+for input in args.INPUT:
+ file_names += [args.name + input.replace(args.privdir, '')]
+
+command = [args.lto, '-thinlto', '-thinlto-action=thinlink',
+ '-o', index] + file_names
+res = subprocess.run(command)
+
+exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v13-0019-meson-Add-support-for-building-with-precompiled-.patch (14.9K, ../../20220915022626.5xx3ccgkzpkqw5mq@awork3.anarazel.de/20-v13-0019-meson-Add-support-for-building-with-precompiled-.patch)
download | inline diff:
From 779129f32124314ef8a3672be9f3ba1b5d29295b Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 30 Aug 2022 13:33:00 -0700
Subject: [PATCH v13 19/20] meson: Add support for building with precompiled
headers
This substantially speeds up building for windows. A cross build with mingw
goes from
real 0m29.884s
user 15m41.900s
sys 1m58.257s
to
real 0m13.196s
user 6m52.330s
sys 1m15.140s
The wins on windows are similar-ish (but I don't have a system at hand just
now for actual numbers).
---
src/include/meson.build | 1 +
src/include/pch/c_pch.h | 1 +
src/include/pch/meson.build | 4 ++++
src/include/pch/postgres_fe_pch.h | 1 +
src/include/pch/postgres_pch.h | 1 +
src/common/meson.build | 2 ++
src/port/meson.build | 2 ++
src/backend/meson.build | 5 +++++
src/backend/snowball/meson.build | 1 +
src/fe_utils/meson.build | 1 +
src/bin/pg_dump/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 1 +
src/bin/psql/meson.build | 1 +
src/interfaces/libpq/meson.build | 1 +
src/pl/plperl/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpython/meson.build | 1 +
src/pl/tcl/meson.build | 1 +
contrib/bloom/meson.build | 1 +
contrib/btree_gist/meson.build | 1 +
contrib/hstore/meson.build | 1 +
contrib/pg_trgm/meson.build | 1 +
contrib/pgcrypto/meson.build | 1 +
contrib/pgstattuple/meson.build | 1 +
contrib/sepgsql/meson.build | 1 +
contrib/xml2/meson.build | 1 +
.cirrus.yml | 4 ++--
meson.build | 8 ++++++++
28 files changed, 45 insertions(+), 2 deletions(-)
create mode 100644 src/include/pch/c_pch.h
create mode 100644 src/include/pch/meson.build
create mode 100644 src/include/pch/postgres_fe_pch.h
create mode 100644 src/include/pch/postgres_pch.h
diff --git a/src/include/meson.build b/src/include/meson.build
index e5390df0584..28ed9011c70 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -110,6 +110,7 @@ install_headers(
subdir('catalog')
subdir('nodes')
+subdir('pch')
subdir('storage')
subdir('utils')
diff --git a/src/include/pch/c_pch.h b/src/include/pch/c_pch.h
new file mode 100644
index 00000000000..f40c757ca62
--- /dev/null
+++ b/src/include/pch/c_pch.h
@@ -0,0 +1 @@
+#include "c.h"
diff --git a/src/include/pch/meson.build b/src/include/pch/meson.build
new file mode 100644
index 00000000000..2bcec49c3a2
--- /dev/null
+++ b/src/include/pch/meson.build
@@ -0,0 +1,4 @@
+# See https://github.com/mesonbuild/meson/issues/10338
+pch_c_h = meson.source_root() / meson.current_source_dir() / 'c_pch.h'
+pch_postgres_h = meson.source_root() / meson.current_source_dir() / 'postgres_pch.h'
+pch_postgres_fe_h = meson.source_root() / meson.current_source_dir() / 'postgres_fe_pch.h'
diff --git a/src/include/pch/postgres_fe_pch.h b/src/include/pch/postgres_fe_pch.h
new file mode 100644
index 00000000000..f3ea20912d3
--- /dev/null
+++ b/src/include/pch/postgres_fe_pch.h
@@ -0,0 +1 @@
+#include "postgres_fe.h"
diff --git a/src/include/pch/postgres_pch.h b/src/include/pch/postgres_pch.h
new file mode 100644
index 00000000000..71b2f35f76b
--- /dev/null
+++ b/src/include/pch/postgres_pch.h
@@ -0,0 +1 @@
+#include "postgres.h"
diff --git a/src/common/meson.build b/src/common/meson.build
index 23842e1ffef..1c9b8a3a018 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -147,6 +147,7 @@ foreach name, opts : pgcommon_variants
endif
c_args = opts.get('c_args', []) + common_cflags[cflagname]
cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'sources': sources,
@@ -159,6 +160,7 @@ foreach name, opts : pgcommon_variants
lib = static_library('libpgcommon@0@'.format(name),
link_with: cflag_libs,
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
diff --git a/src/port/meson.build b/src/port/meson.build
index ced2e014db8..c2222696f1b 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -161,6 +161,7 @@ foreach name, opts : pgport_variants
c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
sources,
+ c_pch: pch_c_h,
kwargs: opts + {
'c_args': c_args,
'build_by_default': false,
@@ -172,6 +173,7 @@ foreach name, opts : pgport_variants
lib = static_library('libpgport@0@'.format(name),
pgport_sources,
link_with: cflag_libs,
+ c_pch: pch_c_h,
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
}
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 3f5e9883c0c..36d06c7ca6b 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -62,6 +62,7 @@ postgres_lib = static_library('postgres_lib',
backend_sources + timezone_sources + generated_backend_sources,
link_whole: backend_link_with,
dependencies: backend_build_deps,
+ c_pch: pch_postgres_h,
kwargs: internal_lib_args,
)
@@ -81,6 +82,10 @@ if cc.get_id() == 'msvc'
backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
backend_link_depends += postgres_def
+ # Due to the way msvc and meson's precompiled headers implementation
+ # interact, we need to have symbols from the full library available. Could
+ # be restricted to b_pch=true.
+ backend_link_with += postgres_lib
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 8c6f685cb32..2747026c729 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -60,6 +60,7 @@ stemmer_inc = include_directories('../../include/snowball')
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
+ c_pch: pch_postgres_h,
kwargs: pg_mod_args + {
'include_directories': [stemmer_inc],
}
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index b6bf8e1ca21..f1ba5ac8c14 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -23,6 +23,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
+ c_pch: pch_postgres_fe_h,
include_directories: [postgres_inc, libpq_inc],
dependencies: frontend_common_code,
kwargs: default_lib_args,
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 3527a25c288..e66f632b54e 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -13,6 +13,7 @@ pg_dump_common_sources = files(
pg_dump_common = static_library('libpgdump_common',
pg_dump_common_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq, zlib],
kwargs: internal_lib_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index 02f030e0ccf..372ab47ab92 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -18,6 +18,7 @@ pg_upgrade_sources = files(
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 3474389d3b6..8ec07260d1b 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -46,6 +46,7 @@ endif
psql = executable('psql',
psql_sources,
+ c_pch: pch_postgres_fe_h,
include_directories: include_directories('.'),
dependencies: [frontend_code, libpq, readline],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 2c9edeaa088..72102521edc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -49,6 +49,7 @@ libpq_st = static_library('libpq',
pic: true,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
+ c_pch: pch_postgres_fe_h,
dependencies: libpq_deps,
kwargs: default_lib_args,
)
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 73b733dd50b..9866737c913 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -38,6 +38,7 @@ endforeach
plperl_inc = include_directories('.')
plperl = shared_module('plperl',
plperl_sources,
+ c_pch: pch_postgres_h,
include_directories: [plperl_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [perl_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index dd499fdd151..eb0ddaac376 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -42,6 +42,7 @@ plpgsql_sources += pl_unreserved
plpgsql = shared_module('plpgsql',
plpgsql_sources,
+ c_pch: pch_postgres_h,
include_directories: include_directories('.'),
kwargs: pg_mod_args,
)
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 366b3b171ac..5cecd9aeb0c 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -30,6 +30,7 @@ plpython_inc = include_directories('.')
plpython = shared_module('plpython3',
plpython_sources,
+ c_pch: pch_postgres_h,
include_directories: [plpython_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [python3_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index 9b6addd7fd5..9d31074f0eb 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -16,6 +16,7 @@ pltcl_sources += custom_target('pltclerrcodes.h',
pltcl = shared_module('pltcl',
pltcl_sources,
+ c_pch: pch_postgres_h,
include_directories: [include_directories('.'), postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [tcl_dep, pg_mod_args['dependencies']],
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 1fe7632bdbe..3d9fe8bf930 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -9,6 +9,7 @@ bloom_sources = files(
bloom = shared_module('bloom',
bloom_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += bloom
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index c0a8d238540..4aefe475573 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -27,6 +27,7 @@ btree_gist_sources = files(
btree_gist = shared_module('btree_gist',
btree_gist_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gist
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 07c59f40a97..d472c2591d8 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -10,6 +10,7 @@ hstore = shared_module('hstore',
'hstore_op.c',
'hstore_subs.c',
),
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index a90628d23c6..6e9d5cabdbb 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -5,6 +5,7 @@ pg_trgm = shared_module('pg_trgm',
'trgm_op.c',
'trgm_regexp.c',
),
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index fe0851bf8e8..8e08b2f5ae9 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -72,6 +72,7 @@ endif
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
},
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 8e828692d5c..65318f27e11 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -4,6 +4,7 @@ pgstattuple = shared_module('pgstattuple',
'pgstatindex.c',
'pgstattuple.c',
),
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 60a95e17c2f..fd88b14a3c5 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -16,6 +16,7 @@ sepgsql_sources = files(
sepgsql = shared_module('sepgsql',
sepgsql_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [selinux, contrib_mod_args['dependencies']],
}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 9c0b56f01f6..8b041b4d4cb 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -7,6 +7,7 @@ xml2 = shared_module('pgxml',
'xpath.c',
'xslt_proc.c',
),
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/.cirrus.yml b/.cirrus.yml
index 5a7a93baf4c..cdd2f238c78 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1174,7 +1174,7 @@ task:
configure_script:
- vcvarsall x64
- - meson setup --buildtype debug --backend ninja -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
+ - meson setup --buildtype debug --backend ninja -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
build_script:
- vcvarsall x64
@@ -1201,7 +1201,7 @@ task:
configure_script:
- vcvarsall x64
- - meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
+ - meson setup --buildtype debug --backend vs -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe build
build_script:
- vcvarsall x64
diff --git a/meson.build b/meson.build
index a56af6ccb0e..c4d3ce83954 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,7 @@ project('postgresql',
meson_version: '>=0.54',
default_options: [
'warning_level=1', #-Wall equivalent
+ 'b_pch=false',
'buildtype=release',
]
)
@@ -1769,6 +1770,13 @@ if cc.get_id() == 'msvc'
'/wd4267', # conversion from 'size_t' to 'type', possible loss of data
]
+ # Dirty hack to disable warnings due to some files defining
+ # UMDF_USING_NTSTATUS before including postgres.h. We need a better fix, but
+ # for now this allows us to see "real" warnings.
+ if get_option('b_pch')
+ cflags_warn += '/wd4005' # macro redefinition
+ endif
+
cppflags += [
'/DWIN32',
'/DWINDOWS',
--
2.37.3.542.gdd3f6c4cae
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-15 05:10 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andres Freund <andres@anarazel.de>
2 siblings, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-09-15 05:10 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Thomas Munro <thomas.munro@gmail.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> I'm inclined to build the static lib on windows as long as we do it on other
> platforms.
Maybe I spent too much time working for Red Hat, but I'm kind of
unhappy that we build static libraries at all. They are maintenance
hazards and therefore security hazards by definition, because if
you find a problem in $package_x you will have to find and rebuild
every other package that has statically-embedded code from $package_x.
So Red Hat has, or least had, a policy against packages exporting
such libraries.
I realize that there are people for whom other considerations outweigh
that, but I don't think that we should install static libraries by
default. Long ago it was pretty common for configure scripts to
offer --enable-shared and --enable-static options ... should we
resurrect that?
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-15 05:17 Andres Freund <andres@anarazel.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-15 05:17 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Thomas Munro <thomas.munro@gmail.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-15 01:10:16 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > I'm inclined to build the static lib on windows as long as we do it on other
> > platforms.
>
> Maybe I spent too much time working for Red Hat, but I'm kind of
> unhappy that we build static libraries at all.
Yea, I have been wondering about that too.
Oddly enough, given our current behaviour, the strongest case for static
libraries IMO is on windows, due to the lack of a) rpath b) a general library
search path.
Peter IIRC added the static libraries to the meson port just to keep the set
of installed files the same, which makes sense.
> They are maintenance hazards and therefore security hazards by definition,
> because if you find a problem in $package_x you will have to find and
> rebuild every other package that has statically-embedded code from
> $package_x. So Red Hat has, or least had, a policy against packages
> exporting such libraries.
It obviously is a bad idea for widely used system packages. I think there are
a few situations, e.g. a downloadable self-contained and relocatable
application, where shared libraries provide less of a benefit.
> I realize that there are people for whom other considerations outweigh
> that, but I don't think that we should install static libraries by
> default. Long ago it was pretty common for configure scripts to
> offer --enable-shared and --enable-static options ... should we
> resurrect that?
It'd be easy enough. I don't really have an opinion on whether it's worth
having the options. I think most packaging systems have ways of not including
files even if $software installs them.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-15 21:14 Thomas Munro <thomas.munro@gmail.com>
parent: Andres Freund <andres@anarazel.de>
2 siblings, 2 replies; 81+ messages in thread
From: Thomas Munro @ 2022-09-15 21:14 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Thu, Sep 15, 2022 at 2:26 PM Andres Freund <andres@anarazel.de> wrote:
> - noticed that libpgport.a had and needed a dependency on errcodes.h - that
> seemed wrong. The dependency is due to src/port/*p{read,write}v?.c including
> postgres.h - which seems wrong. So I added a patch changing them to include
> c.h.
Oops. +1
GCC 12 produces a bunch of warnings by default with meson, and that
turned out to be because the default optimisation level is -O3.
That's a change from the make build, which uses -O2. Should we set a
default of 2, or is there some meson-way-of-doing-things reason why
not?
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-15 22:11 Andres Freund <andres@anarazel.de>
parent: Thomas Munro <thomas.munro@gmail.com>
1 sibling, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-15 22:11 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@gmail.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-16 09:14:20 +1200, Thomas Munro wrote:
> GCC 12 produces a bunch of warnings by default with meson, and that
> turned out to be because the default optimisation level is -O3.
> That's a change from the make build, which uses -O2. Should we set a
> default of 2, or is there some meson-way-of-doing-things reason why
> not?
We can change the defaults - the only downside is that there's a convenience
setting 'buildtype' (debug, debugoptimized, release, minsize, custom, plain)
that changes multiple settings (optimization level, amount of debugging
information) and that doesn't work as nicely if you change the default
compiler optimization setting.
They made a similar discovery as us, deriving the defaults of settings based
on other settings quickly can become confusing. I think they're looking at how
to make that UI a bit nicer.
I'd prefer to defer fine-tuning the default settings till a bunch of this has
gone in, but I won't insist on that course.
Their default warning flags passed to compilers trigger a bunch of warnings in
our build (irrespective of -O*), so I lowered the warning level. But I think
their set of settings likely is sensible, an we should just disable a bunch of
warnings we don't care about. But I haven't done that for now, to keep the set
of warning flags the same between meson and autoconf.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-16 18:49 Andres Freund <andres@anarazel.de>
parent: Thomas Munro <thomas.munro@gmail.com>
1 sibling, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-16 18:49 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@gmail.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-16 09:14:20 +1200, Thomas Munro wrote:
> On Thu, Sep 15, 2022 at 2:26 PM Andres Freund <andres@anarazel.de> wrote:
> > - noticed that libpgport.a had and needed a dependency on errcodes.h - that
> > seemed wrong. The dependency is due to src/port/*p{read,write}v?.c including
> > postgres.h - which seems wrong. So I added a patch changing them to include
> > c.h.
>
> Oops. +1
Looks like this has been the case since
0d56acfbaa799553c0c6ea350fd6e68d81025994 in 14. Any opinions on whether we
should backpatch the "fix"?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-16 20:22 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-09-16 20:22 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Thomas Munro <thomas.munro@gmail.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2022-09-16 09:14:20 +1200, Thomas Munro wrote:
>> On Thu, Sep 15, 2022 at 2:26 PM Andres Freund <andres@anarazel.de> wrote:
>>> - noticed that libpgport.a had and needed a dependency on errcodes.h - that
>>> seemed wrong. The dependency is due to src/port/*p{read,write}v?.c including
>>> postgres.h - which seems wrong. So I added a patch changing them to include
>>> c.h.
>> Oops. +1
> Looks like this has been the case since
> 0d56acfbaa799553c0c6ea350fd6e68d81025994 in 14. Any opinions on whether we
> should backpatch the "fix"?
+1, those files have no business including all of postgres.h
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-17 16:58 Andres Freund <andres@anarazel.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-17 16:58 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Thomas Munro <thomas.munro@gmail.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-16 16:22:35 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2022-09-16 09:14:20 +1200, Thomas Munro wrote:
> >> On Thu, Sep 15, 2022 at 2:26 PM Andres Freund <andres@anarazel.de> wrote:
> >>> - noticed that libpgport.a had and needed a dependency on errcodes.h - that
> >>> seemed wrong. The dependency is due to src/port/*p{read,write}v?.c including
> >>> postgres.h - which seems wrong. So I added a patch changing them to include
> >>> c.h.
>
> >> Oops. +1
>
> > Looks like this has been the case since
> > 0d56acfbaa799553c0c6ea350fd6e68d81025994 in 14. Any opinions on whether we
> > should backpatch the "fix"?
>
> +1, those files have no business including all of postgres.h
Done.
I've been wondering whether we should protect against this kind of issue on
the buildsystem level. Whenever building frontend code, add something like
-DBUILDING_FRONTEND, and error out if postgres.h is included without going
through postgres_fe.h.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-19 00:24 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
2 siblings, 1 reply; 81+ messages in thread
From: Peter Eisentraut @ 2022-09-19 00:24 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; +Cc: pgsql-hackers
On 15.09.22 04:26, Andres Freund wrote:
> Attached is v13 of the meson patchset. The biggest changes are:
Did something about warning flags change from the previous patch set? I
see it's building with -Wextra now, which combined with -Werror causes
the build to fail for me. I have never encountered that with any of the
previous patch sets.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-19 00:29 Andres Freund <andres@anarazel.de>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-19 00:29 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; +Cc: pgsql-hackers
Hi,
On September 18, 2022 5:24:06 PM PDT, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>On 15.09.22 04:26, Andres Freund wrote:
>> Attached is v13 of the meson patchset. The biggest changes are:
>
>Did something about warning flags change from the previous patch set? I see it's building with -Wextra now, which combined with -Werror causes the build to fail for me. I have never encountered that with any of the previous patch sets.
In older versions of the patch the default warning level was set to include Wextra, and I had added my local flags to suppress uninteresting warnings. Comparing the warning flags I reduced the warning level and removed the suppressing flags - but changing default options only affects new build trees. To change existing ones do meson configure -Dwarning_level=1
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-19 09:25 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Peter Eisentraut @ 2022-09-19 09:25 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; +Cc: pgsql-hackers
On 19.09.22 02:29, Andres Freund wrote:
> Hi,
>
> On September 18, 2022 5:24:06 PM PDT, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>> On 15.09.22 04:26, Andres Freund wrote:
>>> Attached is v13 of the meson patchset. The biggest changes are:
>>
>> Did something about warning flags change from the previous patch set? I see it's building with -Wextra now, which combined with -Werror causes the build to fail for me. I have never encountered that with any of the previous patch sets.
>
> In older versions of the patch the default warning level was set to include Wextra, and I had added my local flags to suppress uninteresting warnings. Comparing the warning flags I reduced the warning level and removed the suppressing flags - but changing default options only affects new build trees. To change existing ones do meson configure -Dwarning_level=1
Ok that was the reason. It works now.
IMO, the following commits are ready to be pushed now:
b7d7fe009731 Remove DLLTOOL, DLLWRAP from configure / Makefile.global.in
979f26889544 Don't hardcode tmp_check/ as test directory for tap tests
9fc657fbb7e2 Split TESTDIR into TESTLOGDIR and TESTDATADIR
6de8f1de0ffa meson: prereq: Extend gendef.pl in preparation for meson
7054861f0fef meson: prereq: Add src/tools/gen_export.pl
1aa586f2921c meson: prereq: Refactor PG_TEST_EXTRA logic in autoconf build
5a9731dcc2e6 meson: prereq: port: Include c.h instead of postgres.h in *p{read,write}*.c
1939bdcfbfea meson: Add meson based buildsystem
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-20 02:16 Andres Freund <andres@anarazel.de>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 2 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-20 02:16 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-19 05:25:59 -0400, Peter Eisentraut wrote:
> IMO, the following commits are ready to be pushed now:
Slowly working through them.
To have some initial "translation" for other developers I've started a wiki
page with a translation table. Still very WIP:
https://wiki.postgresql.org/wiki/Meson
For now, a bit of polishing aside, I'm just planning to add a minimal
explanation of what's happening, and a reference to this thread.
> b7d7fe009731 Remove DLLTOOL, DLLWRAP from configure / Makefile.global.in
> 979f26889544 Don't hardcode tmp_check/ as test directory for tap tests
> 9fc657fbb7e2 Split TESTDIR into TESTLOGDIR and TESTDATADIR
> 6de8f1de0ffa meson: prereq: Extend gendef.pl in preparation for meson
> 5a9731dcc2e6 meson: prereq: port: Include c.h instead of postgres.h in *p{read,write}*.c
Done
> 7054861f0fef meson: prereq: Add src/tools/gen_export.pl
This one I'm planning to merge with the "main" commit, given there's no other user.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 00:11 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 2 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-21 00:11 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-19 19:16:30 -0700, Andres Freund wrote:
> To have some initial "translation" for other developers I've started a wiki
> page with a translation table. Still very WIP:
> https://wiki.postgresql.org/wiki/Meson
>
> For now, a bit of polishing aside, I'm just planning to add a minimal
> explanation of what's happening, and a reference to this thread.
I added installation instructions for meson for a bunch of platforms, but
failed to figure out how to do so in a rhel9 container. I don't have a rhel
subscription, and apparently the repos with developer tools now require a
subscription. Great way to make it easy for projects to test anything on RHEL.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 02:52 John Naylor <john.naylor@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 1 reply; 81+ messages in thread
From: John Naylor @ 2022-09-21 02:52 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Wed, Sep 21, 2022 at 7:11 AM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2022-09-19 19:16:30 -0700, Andres Freund wrote:
> > To have some initial "translation" for other developers I've started a
wiki
> > page with a translation table. Still very WIP:
> > https://wiki.postgresql.org/wiki/Meson
> >
> > For now, a bit of polishing aside, I'm just planning to add a minimal
> > explanation of what's happening, and a reference to this thread.
>
> I added installation instructions for meson for a bunch of platforms, but
Small typo: The homebrew section is still labeled with "find MacPorts
libraries".
--
John Naylor
EDB: http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 05:15 Andres Freund <andres@anarazel.de>
parent: John Naylor <john.naylor@enterprisedb.com>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-21 05:15 UTC (permalink / raw)
To: John Naylor <john.naylor@enterprisedb.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-21 09:52:48 +0700, John Naylor wrote:
> On Wed, Sep 21, 2022 at 7:11 AM Andres Freund <andres@anarazel.de> wrote:
> >
> > Hi,
> >
> > On 2022-09-19 19:16:30 -0700, Andres Freund wrote:
> > > To have some initial "translation" for other developers I've started a
> wiki
> > > page with a translation table. Still very WIP:
> > > https://wiki.postgresql.org/wiki/Meson
> > >
> > > For now, a bit of polishing aside, I'm just planning to add a minimal
> > > explanation of what's happening, and a reference to this thread.
> >
> > I added installation instructions for meson for a bunch of platforms, but
>
> Small typo: The homebrew section is still labeled with "find MacPorts
> libraries".
Thanks, fixed. I wrote these blindly, so there's probably more wrong than this
- although Thomas was helpful enough to provide some information / testing.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 16:46 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 4 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-21 16:46 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; +Cc: samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-19 19:16:30 -0700, Andres Freund wrote:
> On 2022-09-19 05:25:59 -0400, Peter Eisentraut wrote:
> > IMO, the following commits are ready to be pushed now:
>
> Slowly working through them.
I've attached an updated version of the main meson commit (and pushed all of
them to my git tree obviously). Changes:
- Added a longer commit message
- Stopped building doc/src/sgml/postgres-full.xml by default - somehow I
thought we did so by default for the autoconf build, but that's not the
case. Thomas noticed that that was extremely slow on one of his machines,
which turns out to be because it's downloading the dtd's.
- Added a missing dependency on check_rules.pl's result, lost that in a
cleanup, oops
- Fixed a few typos, via codespell
I'm planning to commit this today, unless somebody wants to argue against
that.
After that I am planning to split the "ci" commit so that it converts a few of
the CI tasks to use meson, without adding all the other platforms I added for
development. I think that's important to get in soon, given that it'll
probably take a bit until the buildfarm grows meson coverage and because it
provides cfbot coverage which seems important for now as well.
I think we should:
- convert windows to build with ninja - it builds faster, runs all tests,
parallelizes tests. That means that msbuild based builds don't have coverage
via CI / cfbot, but we don't currently have the resources to test both.
- add a linux build using meson, we currently can afford building both with
autoconf and meson for linux
I'm less clear on whether we should convert macos / freebsd to meson at this
point?
Greetings,
Andres Freund
Attachments:
[text/x-diff] v14-0001-meson-Add-initial-version-of-meson-based-buildsy.patch (353.2K, ../../20220921164630.wrklkjmifjqjtlwc@awork3.anarazel.de/2-v14-0001-meson-Add-initial-version-of-meson-based-buildsy.patch)
download | inline diff:
From f4650ce105e37266309d8a17ce2c93b4d6e41da9 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 19 Jan 2022 23:36:50 -0800
Subject: [PATCH v14 01/13] meson: Add initial version of meson based
buildsystem
Autoconf is showing its age, fewer and fewer contributors know how to wrangle
it. Recursive make has a lot of hard to resolve dependency issues and slow
incremental rebuilds. Our home-grown MSVC buildsystem is hard to maintain for
developers not using windows and runs tests serially. While these and other
issues could individually be addressed with incremental improvements, together
they seem best addressed by moving to a more modern buildsystem.
After evaluating different buildsystem choices, we chose to use meson, to a
good degree based on the adoption by other open source projects.
We decided that it's more realistic to commit a relatively early version of
the new buildsystem and mature it in tree.
This commit adds an initial version of a meson based buildsystem. It supports
building postgres on at least aix, freebsd, linux, macos, netbsd, openbsd,
solaris and windows (however only gcc is supported on aix, solaris). For
windows/msvc postgres can now be built with ninja (faster, particularly for
incremental builds) and msbuild (supporting the visual studio GUI, but
building slower).
Several aspects (e.g. windows rc file generation, PGXS compatibility, LLVM
bitcode generation, documentation adjustments) are done in subsequent commits
requiring further review. Other aspects (e.g. not installing test-only
extensions) are not yet addressed.
When building on windows with msbuild, builds are slower when using a visual
studio version older than 2019, because those versions do not support
MultiToolTask, required by meson for intra-target parallelism.
The plan is to remove the msvc specific buildsystem in src/tools/msvc soon
after reaching feature parity. However, we're not planning to remove the
autoconf/make buildsystem in the near future. Likely we're going to keep at
least the parts required for PGXS to keep working around until all supported
versions build with meson.
Some initial help for postgres developers is at
https://wiki.postgresql.org/wiki/Meson
With contributions from Thomas Munro, John Naylor, Stone Tickle and others.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Discussion: https://postgr.es/m/20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de
---
src/include/catalog/meson.build | 142 +
src/include/meson.build | 173 +
src/include/nodes/meson.build | 58 +
src/include/pg_config_ext.h.meson | 7 +
src/include/storage/meson.build | 19 +
src/include/utils/meson.build | 57 +
src/common/meson.build | 174 +
src/common/unicode/meson.build | 106 +
src/port/meson.build | 184 +
config/meson.build | 4 +
src/backend/access/brin/meson.build | 12 +
src/backend/access/common/meson.build | 18 +
src/backend/access/gin/meson.build | 17 +
src/backend/access/gist/meson.build | 13 +
src/backend/access/hash/meson.build | 12 +
src/backend/access/heap/meson.build | 11 +
src/backend/access/index/meson.build | 6 +
src/backend/access/meson.build | 13 +
src/backend/access/nbtree/meson.build | 13 +
src/backend/access/rmgrdesc/meson.build | 26 +
src/backend/access/spgist/meson.build | 13 +
src/backend/access/table/meson.build | 6 +
src/backend/access/tablesample/meson.build | 5 +
src/backend/access/transam/meson.build | 31 +
src/backend/backup/meson.build | 13 +
src/backend/bootstrap/meson.build | 28 +
src/backend/catalog/meson.build | 44 +
src/backend/commands/meson.build | 51 +
src/backend/executor/meson.build | 67 +
src/backend/foreign/meson.build | 3 +
src/backend/jit/llvm/meson.build | 73 +
src/backend/jit/meson.build | 3 +
src/backend/lib/meson.build | 12 +
src/backend/libpq/meson.build | 32 +
src/backend/main/meson.build | 2 +
src/backend/meson.build | 190 ++
src/backend/nodes/meson.build | 29 +
src/backend/optimizer/geqo/meson.build | 17 +
src/backend/optimizer/meson.build | 5 +
src/backend/optimizer/path/meson.build | 11 +
src/backend/optimizer/plan/meson.build | 10 +
src/backend/optimizer/prep/meson.build | 7 +
src/backend/optimizer/util/meson.build | 16 +
src/backend/parser/meson.build | 48 +
src/backend/partitioning/meson.build | 5 +
src/backend/po/meson.build | 1 +
src/backend/port/meson.build | 31 +
src/backend/port/win32/meson.build | 6 +
src/backend/postmaster/meson.build | 15 +
src/backend/regex/meson.build | 8 +
.../replication/libpqwalreceiver/meson.build | 13 +
src/backend/replication/logical/meson.build | 14 +
src/backend/replication/meson.build | 51 +
src/backend/replication/pgoutput/meson.build | 10 +
src/backend/rewrite/meson.build | 9 +
src/backend/snowball/meson.build | 88 +
src/backend/statistics/meson.build | 6 +
src/backend/storage/buffer/meson.build | 7 +
src/backend/storage/file/meson.build | 8 +
src/backend/storage/freespace/meson.build | 5 +
src/backend/storage/ipc/meson.build | 20 +
src/backend/storage/large_object/meson.build | 3 +
src/backend/storage/lmgr/meson.build | 13 +
src/backend/storage/meson.build | 9 +
src/backend/storage/page/meson.build | 5 +
src/backend/storage/smgr/meson.build | 4 +
src/backend/storage/sync/meson.build | 4 +
src/backend/tcop/meson.build | 8 +
src/backend/tsearch/meson.build | 21 +
src/backend/utils/activity/meson.build | 18 +
src/backend/utils/adt/meson.build | 131 +
src/backend/utils/cache/meson.build | 16 +
src/backend/utils/error/meson.build | 6 +
src/backend/utils/fmgr/meson.build | 8 +
src/backend/utils/hash/meson.build | 4 +
src/backend/utils/init/meson.build | 4 +
.../utils/mb/conversion_procs/meson.build | 36 +
src/backend/utils/mb/meson.build | 9 +
src/backend/utils/meson.build | 17 +
src/backend/utils/misc/meson.build | 35 +
src/backend/utils/mmgr/meson.build | 10 +
src/backend/utils/resowner/meson.build | 3 +
src/backend/utils/sort/meson.build | 9 +
src/backend/utils/time/meson.build | 4 +
src/fe_utils/meson.build | 29 +
src/bin/initdb/meson.build | 30 +
src/bin/initdb/po/meson.build | 1 +
src/bin/meson.build | 20 +
src/bin/pg_amcheck/meson.build | 27 +
src/bin/pg_amcheck/po/meson.build | 1 +
src/bin/pg_archivecleanup/meson.build | 19 +
src/bin/pg_archivecleanup/po/meson.build | 1 +
src/bin/pg_basebackup/meson.build | 61 +
src/bin/pg_basebackup/po/meson.build | 1 +
src/bin/pg_checksums/meson.build | 21 +
src/bin/pg_checksums/po/meson.build | 1 +
src/bin/pg_config/meson.build | 19 +
src/bin/pg_config/po/meson.build | 1 +
src/bin/pg_controldata/meson.build | 19 +
src/bin/pg_controldata/po/meson.build | 1 +
src/bin/pg_ctl/meson.build | 22 +
src/bin/pg_ctl/po/meson.build | 1 +
src/bin/pg_dump/meson.build | 75 +
src/bin/pg_dump/po/meson.build | 1 +
src/bin/pg_resetwal/meson.build | 20 +
src/bin/pg_resetwal/po/meson.build | 1 +
src/bin/pg_rewind/meson.build | 42 +
src/bin/pg_rewind/po/meson.build | 1 +
src/bin/pg_test_fsync/meson.build | 21 +
src/bin/pg_test_fsync/po/meson.build | 1 +
src/bin/pg_test_timing/meson.build | 19 +
src/bin/pg_test_timing/po/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 40 +
src/bin/pg_upgrade/po/meson.build | 1 +
src/bin/pg_verifybackup/meson.build | 33 +
src/bin/pg_verifybackup/po/meson.build | 1 +
src/bin/pg_waldump/meson.build | 30 +
src/bin/pg_waldump/po/meson.build | 1 +
src/bin/pgbench/meson.build | 38 +
src/bin/pgevent/meson.build | 26 +
src/bin/psql/meson.build | 67 +
src/bin/psql/po/meson.build | 1 +
src/bin/scripts/meson.build | 51 +
src/bin/scripts/po/meson.build | 1 +
src/interfaces/libpq/meson.build | 108 +
src/interfaces/libpq/po/meson.build | 1 +
src/interfaces/libpq/test/meson.build | 15 +
src/pl/meson.build | 5 +
src/pl/plperl/meson.build | 90 +
src/pl/plperl/po/meson.build | 1 +
src/pl/plpgsql/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 84 +
src/pl/plpgsql/src/po/meson.build | 1 +
src/pl/plpython/meson.build | 99 +
src/pl/plpython/po/meson.build | 1 +
src/pl/tcl/meson.build | 55 +
src/pl/tcl/po/meson.build | 1 +
contrib/adminpack/meson.build | 23 +
contrib/amcheck/meson.build | 37 +
contrib/auth_delay/meson.build | 5 +
contrib/auto_explain/meson.build | 16 +
contrib/basebackup_to_shell/meson.build | 22 +
contrib/basic_archive/meson.build | 23 +
contrib/bloom/meson.build | 36 +
contrib/bool_plperl/meson.build | 42 +
contrib/btree_gin/meson.build | 54 +
contrib/btree_gist/meson.build | 84 +
contrib/citext/meson.build | 34 +
contrib/cube/meson.build | 53 +
contrib/dblink/meson.build | 31 +
contrib/dict_int/meson.build | 22 +
contrib/dict_xsyn/meson.build | 29 +
contrib/earthdistance/meson.build | 23 +
contrib/file_fdw/meson.build | 22 +
contrib/fuzzystrmatch/meson.build | 26 +
contrib/hstore/meson.build | 44 +
contrib/hstore_plperl/meson.build | 43 +
contrib/hstore_plpython/meson.build | 37 +
contrib/intagg/meson.build | 6 +
contrib/intarray/meson.build | 37 +
contrib/isn/meson.build | 33 +
contrib/jsonb_plperl/meson.build | 43 +
contrib/jsonb_plpython/meson.build | 36 +
contrib/lo/meson.build | 27 +
contrib/ltree/meson.build | 44 +
contrib/ltree_plpython/meson.build | 37 +
contrib/meson.build | 66 +
contrib/oid2name/meson.build | 17 +
contrib/old_snapshot/meson.build | 15 +
contrib/pageinspect/meson.build | 50 +
contrib/passwordcheck/meson.build | 30 +
contrib/pg_buffercache/meson.build | 27 +
contrib/pg_freespacemap/meson.build | 29 +
contrib/pg_prewarm/meson.build | 27 +
contrib/pg_stat_statements/meson.build | 35 +
contrib/pg_surgery/meson.build | 25 +
contrib/pg_trgm/meson.build | 35 +
contrib/pg_visibility/meson.build | 26 +
contrib/pg_walinspect/meson.build | 27 +
contrib/pgcrypto/meson.build | 100 +
contrib/pgrowlocks/meson.build | 27 +
contrib/pgstattuple/meson.build | 31 +
contrib/postgres_fdw/meson.build | 34 +
contrib/seg/meson.build | 51 +
contrib/sepgsql/meson.build | 34 +
contrib/spi/meson.build | 50 +
contrib/sslinfo/meson.build | 21 +
contrib/tablefunc/meson.build | 24 +
contrib/tcn/meson.build | 25 +
contrib/test_decoding/meson.build | 63 +
contrib/tsm_system_rows/meson.build | 24 +
contrib/tsm_system_time/meson.build | 24 +
contrib/unaccent/meson.build | 32 +
contrib/uuid-ossp/meson.build | 31 +
contrib/vacuumlo/meson.build | 17 +
contrib/xml2/meson.build | 32 +
src/interfaces/ecpg/compatlib/meson.build | 22 +
src/interfaces/ecpg/ecpglib/meson.build | 37 +
src/interfaces/ecpg/ecpglib/po/meson.build | 1 +
src/interfaces/ecpg/include/meson.build | 51 +
src/interfaces/ecpg/meson.build | 9 +
src/interfaces/ecpg/pgtypeslib/meson.build | 30 +
src/interfaces/ecpg/preproc/meson.build | 104 +
src/interfaces/ecpg/preproc/po/meson.build | 1 +
.../ecpg/test/compat_informix/meson.build | 31 +
.../ecpg/test/compat_oracle/meson.build | 20 +
src/interfaces/ecpg/test/connect/meson.build | 20 +
src/interfaces/ecpg/test/meson.build | 79 +
.../ecpg/test/pgtypeslib/meson.build | 21 +
src/interfaces/ecpg/test/preproc/meson.build | 37 +
src/interfaces/ecpg/test/sql/meson.build | 46 +
src/interfaces/ecpg/test/thread/meson.build | 21 +
src/interfaces/meson.build | 2 +
doc/src/sgml/meson.build | 254 ++
doc/src/sgml/version.sgml.in | 2 +
src/test/authentication/meson.build | 11 +
src/test/icu/meson.build | 11 +
src/test/isolation/meson.build | 58 +
src/test/kerberos/meson.build | 15 +
src/test/ldap/meson.build | 11 +
src/test/meson.build | 25 +
src/test/modules/brin/meson.build | 16 +
src/test/modules/commit_ts/meson.build | 18 +
src/test/modules/delay_execution/meson.build | 18 +
src/test/modules/dummy_index_am/meson.build | 23 +
src/test/modules/dummy_seclabel/meson.build | 23 +
src/test/modules/libpq_pipeline/meson.build | 21 +
src/test/modules/meson.build | 27 +
src/test/modules/plsample/meson.build | 23 +
src/test/modules/snapshot_too_old/meson.build | 14 +
src/test/modules/spgist_name_ops/meson.build | 23 +
.../ssl_passphrase_callback/meson.build | 48 +
src/test/modules/test_bloomfilter/meson.build | 23 +
src/test/modules/test_ddl_deparse/meson.build | 43 +
src/test/modules/test_extensions/meson.build | 45 +
.../modules/test_ginpostinglist/meson.build | 23 +
src/test/modules/test_integerset/meson.build | 23 +
src/test/modules/test_lfind/meson.build | 23 +
src/test/modules/test_misc/meson.build | 12 +
src/test/modules/test_oat_hooks/meson.build | 18 +
src/test/modules/test_parser/meson.build | 23 +
src/test/modules/test_pg_dump/meson.build | 22 +
src/test/modules/test_predtest/meson.build | 23 +
src/test/modules/test_rbtree/meson.build | 23 +
src/test/modules/test_regex/meson.build | 24 +
src/test/modules/test_rls_hooks/meson.build | 17 +
src/test/modules/test_shm_mq/meson.build | 27 +
src/test/modules/unsafe_tests/meson.build | 11 +
src/test/modules/worker_spi/meson.build | 26 +
src/test/perl/meson.build | 12 +
src/test/recovery/meson.build | 43 +
src/test/regress/meson.build | 62 +
src/test/ssl/meson.build | 13 +
src/test/subscription/meson.build | 42 +
configure | 6 +
configure.ac | 6 +
meson.build | 3025 +++++++++++++++++
meson_options.txt | 185 +
src/meson.build | 12 +
src/timezone/meson.build | 56 +
src/timezone/tznames/meson.build | 21 +
src/tools/find_meson | 30 +
src/tools/gen_export.pl | 81 +
src/tools/pgflex | 85 +
src/tools/testwrap | 47 +
265 files changed, 10967 insertions(+)
create mode 100644 src/include/catalog/meson.build
create mode 100644 src/include/meson.build
create mode 100644 src/include/nodes/meson.build
create mode 100644 src/include/pg_config_ext.h.meson
create mode 100644 src/include/storage/meson.build
create mode 100644 src/include/utils/meson.build
create mode 100644 src/common/meson.build
create mode 100644 src/common/unicode/meson.build
create mode 100644 src/port/meson.build
create mode 100644 config/meson.build
create mode 100644 src/backend/access/brin/meson.build
create mode 100644 src/backend/access/common/meson.build
create mode 100644 src/backend/access/gin/meson.build
create mode 100644 src/backend/access/gist/meson.build
create mode 100644 src/backend/access/hash/meson.build
create mode 100644 src/backend/access/heap/meson.build
create mode 100644 src/backend/access/index/meson.build
create mode 100644 src/backend/access/meson.build
create mode 100644 src/backend/access/nbtree/meson.build
create mode 100644 src/backend/access/rmgrdesc/meson.build
create mode 100644 src/backend/access/spgist/meson.build
create mode 100644 src/backend/access/table/meson.build
create mode 100644 src/backend/access/tablesample/meson.build
create mode 100644 src/backend/access/transam/meson.build
create mode 100644 src/backend/backup/meson.build
create mode 100644 src/backend/bootstrap/meson.build
create mode 100644 src/backend/catalog/meson.build
create mode 100644 src/backend/commands/meson.build
create mode 100644 src/backend/executor/meson.build
create mode 100644 src/backend/foreign/meson.build
create mode 100644 src/backend/jit/llvm/meson.build
create mode 100644 src/backend/jit/meson.build
create mode 100644 src/backend/lib/meson.build
create mode 100644 src/backend/libpq/meson.build
create mode 100644 src/backend/main/meson.build
create mode 100644 src/backend/meson.build
create mode 100644 src/backend/nodes/meson.build
create mode 100644 src/backend/optimizer/geqo/meson.build
create mode 100644 src/backend/optimizer/meson.build
create mode 100644 src/backend/optimizer/path/meson.build
create mode 100644 src/backend/optimizer/plan/meson.build
create mode 100644 src/backend/optimizer/prep/meson.build
create mode 100644 src/backend/optimizer/util/meson.build
create mode 100644 src/backend/parser/meson.build
create mode 100644 src/backend/partitioning/meson.build
create mode 100644 src/backend/po/meson.build
create mode 100644 src/backend/port/meson.build
create mode 100644 src/backend/port/win32/meson.build
create mode 100644 src/backend/postmaster/meson.build
create mode 100644 src/backend/regex/meson.build
create mode 100644 src/backend/replication/libpqwalreceiver/meson.build
create mode 100644 src/backend/replication/logical/meson.build
create mode 100644 src/backend/replication/meson.build
create mode 100644 src/backend/replication/pgoutput/meson.build
create mode 100644 src/backend/rewrite/meson.build
create mode 100644 src/backend/snowball/meson.build
create mode 100644 src/backend/statistics/meson.build
create mode 100644 src/backend/storage/buffer/meson.build
create mode 100644 src/backend/storage/file/meson.build
create mode 100644 src/backend/storage/freespace/meson.build
create mode 100644 src/backend/storage/ipc/meson.build
create mode 100644 src/backend/storage/large_object/meson.build
create mode 100644 src/backend/storage/lmgr/meson.build
create mode 100644 src/backend/storage/meson.build
create mode 100644 src/backend/storage/page/meson.build
create mode 100644 src/backend/storage/smgr/meson.build
create mode 100644 src/backend/storage/sync/meson.build
create mode 100644 src/backend/tcop/meson.build
create mode 100644 src/backend/tsearch/meson.build
create mode 100644 src/backend/utils/activity/meson.build
create mode 100644 src/backend/utils/adt/meson.build
create mode 100644 src/backend/utils/cache/meson.build
create mode 100644 src/backend/utils/error/meson.build
create mode 100644 src/backend/utils/fmgr/meson.build
create mode 100644 src/backend/utils/hash/meson.build
create mode 100644 src/backend/utils/init/meson.build
create mode 100644 src/backend/utils/mb/conversion_procs/meson.build
create mode 100644 src/backend/utils/mb/meson.build
create mode 100644 src/backend/utils/meson.build
create mode 100644 src/backend/utils/misc/meson.build
create mode 100644 src/backend/utils/mmgr/meson.build
create mode 100644 src/backend/utils/resowner/meson.build
create mode 100644 src/backend/utils/sort/meson.build
create mode 100644 src/backend/utils/time/meson.build
create mode 100644 src/fe_utils/meson.build
create mode 100644 src/bin/initdb/meson.build
create mode 100644 src/bin/initdb/po/meson.build
create mode 100644 src/bin/meson.build
create mode 100644 src/bin/pg_amcheck/meson.build
create mode 100644 src/bin/pg_amcheck/po/meson.build
create mode 100644 src/bin/pg_archivecleanup/meson.build
create mode 100644 src/bin/pg_archivecleanup/po/meson.build
create mode 100644 src/bin/pg_basebackup/meson.build
create mode 100644 src/bin/pg_basebackup/po/meson.build
create mode 100644 src/bin/pg_checksums/meson.build
create mode 100644 src/bin/pg_checksums/po/meson.build
create mode 100644 src/bin/pg_config/meson.build
create mode 100644 src/bin/pg_config/po/meson.build
create mode 100644 src/bin/pg_controldata/meson.build
create mode 100644 src/bin/pg_controldata/po/meson.build
create mode 100644 src/bin/pg_ctl/meson.build
create mode 100644 src/bin/pg_ctl/po/meson.build
create mode 100644 src/bin/pg_dump/meson.build
create mode 100644 src/bin/pg_dump/po/meson.build
create mode 100644 src/bin/pg_resetwal/meson.build
create mode 100644 src/bin/pg_resetwal/po/meson.build
create mode 100644 src/bin/pg_rewind/meson.build
create mode 100644 src/bin/pg_rewind/po/meson.build
create mode 100644 src/bin/pg_test_fsync/meson.build
create mode 100644 src/bin/pg_test_fsync/po/meson.build
create mode 100644 src/bin/pg_test_timing/meson.build
create mode 100644 src/bin/pg_test_timing/po/meson.build
create mode 100644 src/bin/pg_upgrade/meson.build
create mode 100644 src/bin/pg_upgrade/po/meson.build
create mode 100644 src/bin/pg_verifybackup/meson.build
create mode 100644 src/bin/pg_verifybackup/po/meson.build
create mode 100644 src/bin/pg_waldump/meson.build
create mode 100644 src/bin/pg_waldump/po/meson.build
create mode 100644 src/bin/pgbench/meson.build
create mode 100644 src/bin/pgevent/meson.build
create mode 100644 src/bin/psql/meson.build
create mode 100644 src/bin/psql/po/meson.build
create mode 100644 src/bin/scripts/meson.build
create mode 100644 src/bin/scripts/po/meson.build
create mode 100644 src/interfaces/libpq/meson.build
create mode 100644 src/interfaces/libpq/po/meson.build
create mode 100644 src/interfaces/libpq/test/meson.build
create mode 100644 src/pl/meson.build
create mode 100644 src/pl/plperl/meson.build
create mode 100644 src/pl/plperl/po/meson.build
create mode 100644 src/pl/plpgsql/meson.build
create mode 100644 src/pl/plpgsql/src/meson.build
create mode 100644 src/pl/plpgsql/src/po/meson.build
create mode 100644 src/pl/plpython/meson.build
create mode 100644 src/pl/plpython/po/meson.build
create mode 100644 src/pl/tcl/meson.build
create mode 100644 src/pl/tcl/po/meson.build
create mode 100644 contrib/adminpack/meson.build
create mode 100644 contrib/amcheck/meson.build
create mode 100644 contrib/auth_delay/meson.build
create mode 100644 contrib/auto_explain/meson.build
create mode 100644 contrib/basebackup_to_shell/meson.build
create mode 100644 contrib/basic_archive/meson.build
create mode 100644 contrib/bloom/meson.build
create mode 100644 contrib/bool_plperl/meson.build
create mode 100644 contrib/btree_gin/meson.build
create mode 100644 contrib/btree_gist/meson.build
create mode 100644 contrib/citext/meson.build
create mode 100644 contrib/cube/meson.build
create mode 100644 contrib/dblink/meson.build
create mode 100644 contrib/dict_int/meson.build
create mode 100644 contrib/dict_xsyn/meson.build
create mode 100644 contrib/earthdistance/meson.build
create mode 100644 contrib/file_fdw/meson.build
create mode 100644 contrib/fuzzystrmatch/meson.build
create mode 100644 contrib/hstore/meson.build
create mode 100644 contrib/hstore_plperl/meson.build
create mode 100644 contrib/hstore_plpython/meson.build
create mode 100644 contrib/intagg/meson.build
create mode 100644 contrib/intarray/meson.build
create mode 100644 contrib/isn/meson.build
create mode 100644 contrib/jsonb_plperl/meson.build
create mode 100644 contrib/jsonb_plpython/meson.build
create mode 100644 contrib/lo/meson.build
create mode 100644 contrib/ltree/meson.build
create mode 100644 contrib/ltree_plpython/meson.build
create mode 100644 contrib/meson.build
create mode 100644 contrib/oid2name/meson.build
create mode 100644 contrib/old_snapshot/meson.build
create mode 100644 contrib/pageinspect/meson.build
create mode 100644 contrib/passwordcheck/meson.build
create mode 100644 contrib/pg_buffercache/meson.build
create mode 100644 contrib/pg_freespacemap/meson.build
create mode 100644 contrib/pg_prewarm/meson.build
create mode 100644 contrib/pg_stat_statements/meson.build
create mode 100644 contrib/pg_surgery/meson.build
create mode 100644 contrib/pg_trgm/meson.build
create mode 100644 contrib/pg_visibility/meson.build
create mode 100644 contrib/pg_walinspect/meson.build
create mode 100644 contrib/pgcrypto/meson.build
create mode 100644 contrib/pgrowlocks/meson.build
create mode 100644 contrib/pgstattuple/meson.build
create mode 100644 contrib/postgres_fdw/meson.build
create mode 100644 contrib/seg/meson.build
create mode 100644 contrib/sepgsql/meson.build
create mode 100644 contrib/spi/meson.build
create mode 100644 contrib/sslinfo/meson.build
create mode 100644 contrib/tablefunc/meson.build
create mode 100644 contrib/tcn/meson.build
create mode 100644 contrib/test_decoding/meson.build
create mode 100644 contrib/tsm_system_rows/meson.build
create mode 100644 contrib/tsm_system_time/meson.build
create mode 100644 contrib/unaccent/meson.build
create mode 100644 contrib/uuid-ossp/meson.build
create mode 100644 contrib/vacuumlo/meson.build
create mode 100644 contrib/xml2/meson.build
create mode 100644 src/interfaces/ecpg/compatlib/meson.build
create mode 100644 src/interfaces/ecpg/ecpglib/meson.build
create mode 100644 src/interfaces/ecpg/ecpglib/po/meson.build
create mode 100644 src/interfaces/ecpg/include/meson.build
create mode 100644 src/interfaces/ecpg/meson.build
create mode 100644 src/interfaces/ecpg/pgtypeslib/meson.build
create mode 100644 src/interfaces/ecpg/preproc/meson.build
create mode 100644 src/interfaces/ecpg/preproc/po/meson.build
create mode 100644 src/interfaces/ecpg/test/compat_informix/meson.build
create mode 100644 src/interfaces/ecpg/test/compat_oracle/meson.build
create mode 100644 src/interfaces/ecpg/test/connect/meson.build
create mode 100644 src/interfaces/ecpg/test/meson.build
create mode 100644 src/interfaces/ecpg/test/pgtypeslib/meson.build
create mode 100644 src/interfaces/ecpg/test/preproc/meson.build
create mode 100644 src/interfaces/ecpg/test/sql/meson.build
create mode 100644 src/interfaces/ecpg/test/thread/meson.build
create mode 100644 src/interfaces/meson.build
create mode 100644 doc/src/sgml/meson.build
create mode 100644 doc/src/sgml/version.sgml.in
create mode 100644 src/test/authentication/meson.build
create mode 100644 src/test/icu/meson.build
create mode 100644 src/test/isolation/meson.build
create mode 100644 src/test/kerberos/meson.build
create mode 100644 src/test/ldap/meson.build
create mode 100644 src/test/meson.build
create mode 100644 src/test/modules/brin/meson.build
create mode 100644 src/test/modules/commit_ts/meson.build
create mode 100644 src/test/modules/delay_execution/meson.build
create mode 100644 src/test/modules/dummy_index_am/meson.build
create mode 100644 src/test/modules/dummy_seclabel/meson.build
create mode 100644 src/test/modules/libpq_pipeline/meson.build
create mode 100644 src/test/modules/meson.build
create mode 100644 src/test/modules/plsample/meson.build
create mode 100644 src/test/modules/snapshot_too_old/meson.build
create mode 100644 src/test/modules/spgist_name_ops/meson.build
create mode 100644 src/test/modules/ssl_passphrase_callback/meson.build
create mode 100644 src/test/modules/test_bloomfilter/meson.build
create mode 100644 src/test/modules/test_ddl_deparse/meson.build
create mode 100644 src/test/modules/test_extensions/meson.build
create mode 100644 src/test/modules/test_ginpostinglist/meson.build
create mode 100644 src/test/modules/test_integerset/meson.build
create mode 100644 src/test/modules/test_lfind/meson.build
create mode 100644 src/test/modules/test_misc/meson.build
create mode 100644 src/test/modules/test_oat_hooks/meson.build
create mode 100644 src/test/modules/test_parser/meson.build
create mode 100644 src/test/modules/test_pg_dump/meson.build
create mode 100644 src/test/modules/test_predtest/meson.build
create mode 100644 src/test/modules/test_rbtree/meson.build
create mode 100644 src/test/modules/test_regex/meson.build
create mode 100644 src/test/modules/test_rls_hooks/meson.build
create mode 100644 src/test/modules/test_shm_mq/meson.build
create mode 100644 src/test/modules/unsafe_tests/meson.build
create mode 100644 src/test/modules/worker_spi/meson.build
create mode 100644 src/test/perl/meson.build
create mode 100644 src/test/recovery/meson.build
create mode 100644 src/test/regress/meson.build
create mode 100644 src/test/ssl/meson.build
create mode 100644 src/test/subscription/meson.build
create mode 100644 meson.build
create mode 100644 meson_options.txt
create mode 100644 src/meson.build
create mode 100644 src/timezone/meson.build
create mode 100644 src/timezone/tznames/meson.build
create mode 100755 src/tools/find_meson
create mode 100644 src/tools/gen_export.pl
create mode 100755 src/tools/pgflex
create mode 100755 src/tools/testwrap
diff --git a/src/include/catalog/meson.build b/src/include/catalog/meson.build
new file mode 100644
index 00000000000..45ffa99692e
--- /dev/null
+++ b/src/include/catalog/meson.build
@@ -0,0 +1,142 @@
+catalog_headers = [
+ 'pg_proc.h',
+ 'pg_type.h',
+ 'pg_attribute.h',
+ 'pg_class.h',
+ 'pg_attrdef.h',
+ 'pg_constraint.h',
+ 'pg_inherits.h',
+ 'pg_index.h',
+ 'pg_operator.h',
+ 'pg_opfamily.h',
+ 'pg_opclass.h',
+ 'pg_am.h',
+ 'pg_amop.h',
+ 'pg_amproc.h',
+ 'pg_language.h',
+ 'pg_largeobject_metadata.h',
+ 'pg_largeobject.h',
+ 'pg_aggregate.h',
+ 'pg_statistic.h',
+ 'pg_statistic_ext.h',
+ 'pg_statistic_ext_data.h',
+ 'pg_rewrite.h',
+ 'pg_trigger.h',
+ 'pg_event_trigger.h',
+ 'pg_description.h',
+ 'pg_cast.h',
+ 'pg_enum.h',
+ 'pg_namespace.h',
+ 'pg_conversion.h',
+ 'pg_depend.h',
+ 'pg_database.h',
+ 'pg_db_role_setting.h',
+ 'pg_tablespace.h',
+ 'pg_authid.h',
+ 'pg_auth_members.h',
+ 'pg_shdepend.h',
+ 'pg_shdescription.h',
+ 'pg_ts_config.h',
+ 'pg_ts_config_map.h',
+ 'pg_ts_dict.h',
+ 'pg_ts_parser.h',
+ 'pg_ts_template.h',
+ 'pg_extension.h',
+ 'pg_foreign_data_wrapper.h',
+ 'pg_foreign_server.h',
+ 'pg_user_mapping.h',
+ 'pg_foreign_table.h',
+ 'pg_policy.h',
+ 'pg_replication_origin.h',
+ 'pg_default_acl.h',
+ 'pg_init_privs.h',
+ 'pg_seclabel.h',
+ 'pg_shseclabel.h',
+ 'pg_collation.h',
+ 'pg_parameter_acl.h',
+ 'pg_partitioned_table.h',
+ 'pg_range.h',
+ 'pg_transform.h',
+ 'pg_sequence.h',
+ 'pg_publication.h',
+ 'pg_publication_namespace.h',
+ 'pg_publication_rel.h',
+ 'pg_subscription.h',
+ 'pg_subscription_rel.h',
+]
+
+bki_data = [
+ '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',
+]
+bki_data_f = files(bki_data)
+
+
+input = []
+output_files = ['postgres.bki', 'system_constraints.sql', 'schemapg.h', 'system_fk_info.h']
+output_install = [dir_data, dir_data, dir_include_server / 'catalog', dir_include_server / 'catalog']
+
+foreach h : catalog_headers
+ fname = h.split('.h')[0] + '_d.h'
+ input += files(h)
+ output_files += fname
+ output_install += dir_include_server / 'catalog'
+endforeach
+
+generated_catalog_headers = custom_target('generated_catalog_headers',
+ output: output_files,
+ install_dir: output_install,
+ input: input,
+ depend_files: bki_data_f,
+ build_by_default: true,
+ install: true,
+ command: [
+ perl,
+ files('../../backend/catalog/genbki.pl'),
+ '--include-path=@SOURCE_ROOT@/src/include',
+ '--set-version=' + pg_version_major.to_string(),
+ '--output=@OUTDIR@', '@INPUT@'
+ ],
+)
+
+generated_headers += generated_catalog_headers.to_list()
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/catalog': output_files + ['bki-stamp']}
+generated_sources_ac += {'src/include/catalog': ['header-stamp']}
+
+# 'reformat-dat-files' is a convenience target for rewriting the
+# catalog data files in our standard format. This includes collapsing
+# out any entries that are redundant with a BKI_DEFAULT annotation.
+run_target('reformat-dat-files',
+ command: [perl, files('reformat_dat_file.pl'), '--output', '@CURRENT_SOURCE_DIR@', bki_data_f],
+)
+
+# 'expand-dat-files' is a convenience target for expanding out all
+# default values in the catalog data files. This should be run before
+# altering or removing any BKI_DEFAULT annotation.
+run_target('expand-dat-files',
+ command: [perl, files('reformat_dat_file.pl'), '--output', '@CURRENT_SOURCE_DIR@', bki_data_f, '--full-tuples'],
+)
diff --git a/src/include/meson.build b/src/include/meson.build
new file mode 100644
index 00000000000..e5390df0584
--- /dev/null
+++ b/src/include/meson.build
@@ -0,0 +1,173 @@
+pg_config_ext = configure_file(
+ input: 'pg_config_ext.h.meson',
+ output: 'pg_config_ext.h',
+ configuration: cdata,
+ install: true,
+ install_dir: dir_include,
+)
+configure_files += pg_config_ext
+
+pg_config_os = configure_file(
+ output: 'pg_config_os.h',
+ input: files('port/@0@.h'.format(portname)),
+ install: true,
+ install_dir: dir_include,
+ copy: true,
+)
+configure_files += pg_config_os
+
+pg_config = configure_file(
+ output: 'pg_config.h',
+ install: true,
+ install_dir: dir_include,
+ configuration: cdata,
+)
+configure_files += pg_config
+
+
+config_paths_data = configuration_data()
+config_paths_data.set_quoted('PGBINDIR', dir_prefix / dir_bin)
+config_paths_data.set_quoted('PGSHAREDIR', dir_prefix / dir_data)
+config_paths_data.set_quoted('SYSCONFDIR', dir_prefix / dir_sysconf)
+config_paths_data.set_quoted('INCLUDEDIR', dir_prefix / dir_include)
+config_paths_data.set_quoted('PKGINCLUDEDIR', dir_prefix / dir_include_pkg)
+config_paths_data.set_quoted('INCLUDEDIRSERVER', dir_prefix / dir_include_server)
+config_paths_data.set_quoted('LIBDIR', dir_prefix / dir_lib)
+config_paths_data.set_quoted('PKGLIBDIR', dir_prefix / dir_lib_pkg)
+config_paths_data.set_quoted('LOCALEDIR', dir_prefix / dir_locale)
+config_paths_data.set_quoted('DOCDIR', dir_prefix / dir_doc)
+config_paths_data.set_quoted('HTMLDIR', dir_prefix / dir_doc_html)
+config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
+
+
+var_cc = ' '.join(cc.cmd_array())
+var_cpp = ' '.join(cc.cmd_array() + ['-E'])
+var_cflags = ' '.join(cflags + cflags_warn)
+var_cxxflags = ' '.join(cxxflags + cxxflags_warn)
+var_cppflags = ' '.join(cppflags)
+var_cflags_sl = '-fPIC' #FIXME
+var_ldflags = ' '.join(ldflags)
+var_ldflags_sl = ''.join(ldflags_sl)
+var_ldflags_ex = '' # FIXME
+# FIXME - some extensions might directly use symbols from one of libs. If
+# that symbol isn't used by postgres, and statically linked, it'll cause an
+# undefined symbol at runtime. And obviously it'll cause problems for
+# executables, although those are probably less common.
+var_libs = ''
+
+
+pg_config_paths = configure_file(
+ output: 'pg_config_paths.h',
+ configuration: config_paths_data,
+ install: false,
+)
+configure_files += pg_config_paths
+
+install_headers(
+ 'pg_config_manual.h',
+ 'postgres_ext.h',
+)
+
+install_headers(
+ 'libpq/libpq-fs.h',
+ install_dir: dir_include / 'libpq',
+)
+
+install_headers(
+ 'c.h',
+ 'port.h',
+ 'postgres_fe.h',
+ install_dir: dir_include_internal
+)
+
+install_headers(
+ 'libpq/pqcomm.h',
+ install_dir: dir_include_internal / 'libpq',
+)
+
+install_headers(
+ 'c.h',
+ 'fmgr.h',
+ 'funcapi.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',
+ 'windowapi.h',
+ pg_config_ext,
+ pg_config_os,
+ pg_config,
+ install_dir: dir_include_server,
+)
+
+subdir('catalog')
+subdir('nodes')
+subdir('storage')
+subdir('utils')
+
+header_subdirs = [
+ 'access',
+ 'catalog',
+ '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',
+]
+
+# XXX: installing headers this way has the danger of installing editor files
+# etc, unfortunately install_subdir() doesn't allow including / excluding by
+# pattern currently.
+foreach d : header_subdirs
+ if d == 'catalog'
+ continue
+ endif
+ 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',
+ 'reformat_dat_file.pl',
+ 'renumber_oids.pl',
+ 'unused_oids',
+ ] + bki_data,
+)
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/include': ['stamp-h', 'stamp-ext-h']}
diff --git a/src/include/nodes/meson.build b/src/include/nodes/meson.build
new file mode 100644
index 00000000000..b7df232081f
--- /dev/null
+++ b/src/include/nodes/meson.build
@@ -0,0 +1,58 @@
+node_support_input_i = [
+ 'nodes/nodes.h',
+ 'nodes/primnodes.h',
+ 'nodes/parsenodes.h',
+ 'nodes/pathnodes.h',
+ 'nodes/plannodes.h',
+ 'nodes/execnodes.h',
+ 'access/amapi.h',
+ 'access/sdir.h',
+ 'access/tableam.h',
+ 'access/tsmapi.h',
+ 'commands/event_trigger.h',
+ 'commands/trigger.h',
+ 'executor/tuptable.h',
+ 'foreign/fdwapi.h',
+ 'nodes/extensible.h',
+ 'nodes/lockoptions.h',
+ 'nodes/replnodes.h',
+ 'nodes/supportnodes.h',
+ 'nodes/value.h',
+ 'utils/rel.h',
+]
+
+node_support_input = []
+foreach i : node_support_input_i
+ node_support_input += meson.source_root() / 'src' / 'include' / i
+endforeach
+
+node_support_output = [
+ 'nodetags.h',
+ 'outfuncs.funcs.c', 'outfuncs.switch.c',
+ 'readfuncs.funcs.c', 'readfuncs.switch.c',
+ 'copyfuncs.funcs.c', 'copyfuncs.switch.c',
+ 'equalfuncs.funcs.c', 'equalfuncs.switch.c',
+]
+node_support_install = [
+ dir_include_server / 'nodes',
+ false, false,
+ false, false,
+ false, false,
+ false, false,
+]
+
+generated_nodes = custom_target('nodetags.h',
+ input: node_support_input,
+ output: node_support_output,
+ command: [
+ perl, files('../../backend/nodes/gen_node_support.pl'),
+ '-o', '@OUTDIR@',
+ '@INPUT@'],
+ install: true,
+ install_dir: node_support_install,
+)
+generated_headers += generated_nodes[0]
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/nodes': node_support_output + ['node-support-stamp']}
+generated_sources_ac += {'src/include/nodes': ['header-stamp']}
diff --git a/src/include/pg_config_ext.h.meson b/src/include/pg_config_ext.h.meson
new file mode 100644
index 00000000000..57cdfca0cfd
--- /dev/null
+++ b/src/include/pg_config_ext.h.meson
@@ -0,0 +1,7 @@
+/*
+ * src/include/pg_config_ext.h.in. This is generated manually, not by
+ * autoheader, since we want to limit which symbols get defined here.
+ */
+
+/* Define to the name of a signed 64-bit integer type. */
+#mesondefine PG_INT64_TYPE
diff --git a/src/include/storage/meson.build b/src/include/storage/meson.build
new file mode 100644
index 00000000000..eae9f98920e
--- /dev/null
+++ b/src/include/storage/meson.build
@@ -0,0 +1,19 @@
+lwlocknames = custom_target('lwlocknames',
+ input: files('../../backend/storage/lmgr/lwlocknames.txt'),
+ output: ['lwlocknames.h', 'lwlocknames.c'],
+ command: [
+ perl, files('../../backend/storage/lmgr/generate-lwlocknames.pl'),
+ '-o', '@OUTDIR@',
+ '@INPUT@'
+ ],
+ build_by_default: true,
+ install: true,
+ install_dir: [dir_include_server / 'storage', false],
+)
+
+lwlocknames_h = lwlocknames[0]
+
+generated_backend_headers += lwlocknames_h
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/storage/lmgr': ['lwlocknames.c', 'lwlocknames.h']}
diff --git a/src/include/utils/meson.build b/src/include/utils/meson.build
new file mode 100644
index 00000000000..bded105f7ea
--- /dev/null
+++ b/src/include/utils/meson.build
@@ -0,0 +1,57 @@
+errcodes = custom_target('errcodes',
+ input: files('../../backend/utils/errcodes.txt'),
+ output: ['errcodes.h'],
+ command: [
+ perl, files('../../backend/utils/generate-errcodes.pl'),
+ '--outfile', '@OUTPUT@',
+ '@INPUT@',
+ ],
+ install: true,
+ install_dir: dir_include_server / 'utils',
+)
+generated_headers += errcodes
+
+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,
+ 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_output = ['fmgroids.h', 'fmgrprotos.h', 'fmgrtab.c']
+fmgrtab_target = custom_target('fmgrtab',
+ input: '../catalog/pg_proc.dat',
+ output : fmgrtab_output,
+ 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]
+generated_backend_headers += fmgrtab_target[1]
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {
+ 'src/backend/utils': fmgrtab_output + ['errcodes.h', 'probes.h', 'fmgr-stamp'],
+ 'src/include/utils': ['header-stamp'],
+}
diff --git a/src/common/meson.build b/src/common/meson.build
new file mode 100644
index 00000000000..23842e1ffef
--- /dev/null
+++ b/src/common/meson.build
@@ -0,0 +1,174 @@
+common_sources = files(
+ 'archive.c',
+ 'base64.c',
+ 'checksum_helper.c',
+ 'compression.c',
+ 'controldata_utils.c',
+ 'encnames.c',
+ 'exec.c',
+ 'file_perm.c',
+ 'file_utils.c',
+ 'hashfn.c',
+ 'ip.c',
+ 'jsonapi.c',
+ 'keywords.c',
+ 'kwlookup.c',
+ 'link-canary.c',
+ 'md5_common.c',
+ 'pg_get_line.c',
+ 'pg_lzcompress.c',
+ 'pg_prng.c',
+ 'pgfnames.c',
+ 'psprintf.c',
+ 'relpath.c',
+ 'rmtree.c',
+ 'saslprep.c',
+ 'scram-common.c',
+ 'string.c',
+ 'stringinfo.c',
+ 'unicode_norm.c',
+ 'username.c',
+ 'wait_error.c',
+ 'wchar.c',
+)
+
+if ssl.found()
+ common_sources += files(
+ 'cryptohash_openssl.c',
+ 'hmac_openssl.c',
+ 'protocol_openssl.c',
+ )
+else
+ common_sources += files(
+ 'cryptohash.c',
+ 'hmac.c',
+ 'md5.c',
+ 'sha1.c',
+ 'sha2.c',
+ )
+endif
+
+common_kwlist = custom_target('kwlist',
+ input: files('../include/parser/kwlist.h'),
+ output: 'kwlist_d.h',
+ command: [perl, '-I', '@SOURCE_ROOT@/src/tools', files('../tools/gen_keywordlist.pl'),
+ '--extern', '--output', '@OUTDIR@', '@INPUT@'])
+generated_sources += common_kwlist
+common_sources += common_kwlist
+
+# The code imported from Ryu gets a pass on declaration-after-statement,
+# in order to keep it more closely aligned with its upstream.
+ryu_sources = files(
+ 'd2s.c',
+ 'f2s.c',
+)
+ryu_cflags = []
+
+if using_declaration_after_statement_warning
+ ryu_cflags += ['-Wno-declaration-after-statement']
+endif
+
+config_info_sources = files('config_info.c',)
+config_info_cflags = [
+ '-DVAL_CC="@0@"'.format(var_cc),
+ '-DVAL_CPPFLAGS="@0@"'.format(var_cppflags),
+ '-DVAL_CFLAGS="@0@"'.format(var_cflags),
+ '-DVAL_CFLAGS_SL="@0@"'.format(var_cflags_sl),
+ '-DVAL_LDFLAGS="@0@"'.format(var_ldflags),
+ '-DVAL_LDFLAGS_EX="@0@"'.format(var_ldflags_ex),
+ '-DVAL_LDFLAGS_SL="@0@"'.format(var_ldflags_sl),
+ '-DVAL_LIBS="@0@"'.format(var_libs),
+]
+
+# Some files need to be built with different cflags. The different sets are
+# defined here.
+common_cflags = {
+ 'ryu': ryu_cflags,
+ 'config_info': config_info_cflags,
+}
+common_sources_cflags = {
+ 'ryu': ryu_sources,
+ 'config_info': config_info_sources
+}
+
+
+# A few files are currently only built for frontend, not server
+# (Mkvcbuild.pm has a copy of this list, too). logging.c is excluded
+# from OBJS_FRONTEND_SHLIB (shared library) as a matter of policy,
+# because it is not appropriate for general purpose libraries such
+# as libpq to report errors directly.
+
+common_sources_frontend_shlib = common_sources
+common_sources_frontend_shlib += files(
+ 'fe_memutils.c',
+ 'restricted_token.c',
+ 'sprompt.c',
+)
+
+common_sources_frontend_static = common_sources_frontend_shlib
+common_sources_frontend_static += files(
+ 'logging.c',
+)
+
+# Build pgport once for backend, once for use in frontend binaries, and once
+# for use in shared libraries
+#
+# XXX: in most environments we could probably link_whole pgcommon_shlib
+# against pgcommon_static, instead of compiling twice.
+#
+# For the server build of pgcommon, depend on lwlocknames_h, because at least
+# cryptohash_openssl.c, hmac_openssl.c depend on it. That's arguably a
+# layering violation, but ...
+pgcommon = {}
+pgcommon_variants = {
+ '_srv': internal_lib_args + {
+ 'sources': common_sources + [lwlocknames_h],
+ 'dependencies': [backend_common_code],
+ },
+ '': default_lib_args + {
+ 'sources': common_sources_frontend_static,
+ 'dependencies': [frontend_common_code],
+ },
+ '_shlib': default_lib_args + {
+ 'pic': true,
+ 'sources': common_sources_frontend_shlib,
+ 'dependencies': [frontend_common_code],
+ },
+}
+
+foreach name, opts : pgcommon_variants
+
+ # Build internal static libraries for sets of files that need to be built
+ # with different cflags
+ cflag_libs = []
+ foreach cflagname, sources : common_sources_cflags
+ if sources.length() == 0
+ continue
+ endif
+ c_args = opts.get('c_args', []) + common_cflags[cflagname]
+ cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ include_directories: include_directories('.'),
+ kwargs: opts + {
+ 'sources': sources,
+ 'c_args': c_args,
+ 'build_by_default': false,
+ 'install': false,
+ },
+ )
+ endforeach
+
+ lib = static_library('libpgcommon@0@'.format(name),
+ link_with: cflag_libs,
+ include_directories: include_directories('.'),
+ kwargs: opts + {
+ 'dependencies': opts['dependencies'] + [ssl],
+ }
+ )
+ pgcommon += {name: lib}
+endforeach
+
+common_srv = pgcommon['_srv']
+common_shlib = pgcommon['_shlib']
+common_static = pgcommon['']
+
+subdir('unicode')
diff --git a/src/common/unicode/meson.build b/src/common/unicode/meson.build
new file mode 100644
index 00000000000..13965d59f49
--- /dev/null
+++ b/src/common/unicode/meson.build
@@ -0,0 +1,106 @@
+UNICODE_VERSION = '15.0.0'
+
+unicode_data = {}
+unicode_baseurl = 'https://www.unicode.org/Public/@0@/ucd/@1@'
+
+if not wget.found()
+ subdir_done()
+endif
+
+# These files are part of the Unicode Character Database. Download them on
+# demand.
+foreach f : ['UnicodeData.txt', 'EastAsianWidth.txt', 'DerivedNormalizationProps.txt', 'CompositionExclusions.txt', 'NormalizationTest.txt']
+ url = unicode_baseurl.format(UNICODE_VERSION, f)
+ target = custom_target(f,
+ output: f,
+ command: [wget, wget_flags, url],
+ build_by_default: false,
+ )
+ unicode_data += {f: target}
+endforeach
+
+
+update_unicode_targets = []
+
+update_unicode_targets += \
+ custom_target('unicode_norm_table.h',
+ input: [unicode_data['UnicodeData.txt'], unicode_data['CompositionExclusions.txt']],
+ output: ['unicode_norm_table.h', 'unicode_norm_hashfunc.h'],
+ command: [
+ perl, files('generate-unicode_norm_table.pl'),
+ '--outdir', '@OUTDIR@', '@INPUT@'],
+ build_by_default: false,
+ )
+
+update_unicode_targets += \
+ custom_target('unicode_nonspacing_table.h',
+ input: [unicode_data['UnicodeData.txt']],
+ output: ['unicode_nonspacing_table.h'],
+ command: [perl, files('generate-unicode_nonspacing_table.pl'), '@INPUT@'],
+ build_by_default: false,
+ capture: true,
+ )
+
+update_unicode_targets += \
+ custom_target('unicode_east_asian_fw_table.h',
+ input: [unicode_data['EastAsianWidth.txt']],
+ output: ['unicode_east_asian_fw_table.h'],
+ command: [perl, files('generate-unicode_east_asian_fw_table.pl'), '@INPUT@'],
+ build_by_default: false,
+ capture: true,
+ )
+
+update_unicode_targets += \
+ custom_target('unicode_normprops_table.h',
+ input: [unicode_data['DerivedNormalizationProps.txt']],
+ output: ['unicode_normprops_table.h'],
+ command: [perl, files('generate-unicode_normprops_table.pl'), '@INPUT@'],
+ build_by_default: false,
+ capture: true,
+ )
+
+norm_test_table = custom_target('norm_test_table.h',
+ input: [unicode_data['NormalizationTest.txt']],
+ output: ['norm_test_table.h'],
+ command: [perl, files('generate-norm_test_table.pl'), '@INPUT@', '@OUTPUT@'],
+ build_by_default: false,
+ )
+
+inc = include_directories('.')
+
+norm_test = executable('norm_test',
+ ['norm_test.c', norm_test_table],
+ dependencies: [frontend_port_code],
+ include_directories: inc,
+ link_with: [common_static, pgport_static],
+ build_by_default: false,
+ kwargs: default_bin_args + {
+ 'install': false,
+ }
+)
+
+update_unicode_dep = []
+
+if not meson.is_cross_build()
+ update_unicode_dep += custom_target('norm_test.run',
+ output: 'norm_test.run',
+ input: update_unicode_targets,
+ command: [norm_test],
+ build_by_default: false,
+ build_always_stale: true,
+ )
+endif
+
+
+# Use a custom target, as run targets serialize the output, making this harder
+# to debug, and don't deal well with targets with multiple outputs.
+update_unicode = custom_target('update-unicode',
+ depends: update_unicode_dep,
+ output: ['dont-exist'],
+ input: update_unicode_targets,
+ command: ['cp', '@INPUT@', '@SOURCE_ROOT@/src/include/common/'],
+ build_by_default: false,
+ build_always_stale: true,
+)
+
+alias_target('update-unicode', update_unicode)
diff --git a/src/port/meson.build b/src/port/meson.build
new file mode 100644
index 00000000000..ced2e014db8
--- /dev/null
+++ b/src/port/meson.build
@@ -0,0 +1,184 @@
+pgport_sources = [
+ 'bsearch_arg.c',
+ 'chklocale.c',
+ 'inet_net_ntop.c',
+ 'noblock.c',
+ 'path.c',
+ 'pg_bitutils.c',
+ 'pg_strong_random.c',
+ 'pgcheckdir.c',
+ 'pgmkdirp.c',
+ 'pgsleep.c',
+ 'pgstrcasecmp.c',
+ 'pgstrsignal.c',
+ 'pqsignal.c',
+ 'qsort.c',
+ 'qsort_arg.c',
+ 'quotes.c',
+ 'snprintf.c',
+ 'strerror.c',
+ 'tar.c',
+ 'thread.c',
+]
+
+if host_system == 'windows'
+ pgport_sources += files(
+ 'dirmod.c',
+ 'kill.c',
+ 'open.c',
+ 'system.c',
+ 'win32dlopen.c',
+ 'win32env.c',
+ 'win32error.c',
+ 'win32fdatasync.c',
+ 'win32getrusage.c',
+ 'win32link.c',
+ 'win32ntdll.c',
+ 'win32pread.c',
+ 'win32pwrite.c',
+ 'win32security.c',
+ 'win32setlocale.c',
+ 'win32stat.c',
+ )
+endif
+
+if cc.get_id() == 'msvc'
+ pgport_sources += files(
+ 'dirent.c',
+ 'win32gettimeofday.c',
+ )
+endif
+
+# Replacement functionality to be built if corresponding configure symbol
+# is false
+replace_funcs_neg = [
+ ['explicit_bzero'],
+ ['getopt'],
+ ['getopt_long'],
+ ['getpeereid'],
+ ['inet_aton'],
+ ['mkdtemp'],
+ ['preadv', 'HAVE_DECL_PREADV'],
+ ['pwritev', 'HAVE_DECL_PWRITEV'],
+ ['strlcat'],
+ ['strlcpy'],
+ ['strnlen'],
+]
+
+if host_system != 'windows'
+ replace_funcs_neg += [['pthread_barrier_wait']]
+endif
+
+# Replacement functionality to be built if corresponding configure symbol
+# is true
+replace_funcs_pos = [
+ # x86/x64
+ ['pg_crc32c_sse42', 'USE_SSE42_CRC32C'],
+ ['pg_crc32c_sse42', 'USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 'crc'],
+ ['pg_crc32c_sse42_choose', 'USE_SSE42_CRC32C_WITH_RUNTIME_CHECK'],
+ ['pg_crc32c_sb8', 'USE_SSE42_CRC32C_WITH_RUNTIME_CHECK'],
+
+ # arm / aarch64
+ ['pg_crc32c_armv8', 'USE_ARMV8_CRC32C'],
+ ['pg_crc32c_armv8', 'USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK', 'crc'],
+ ['pg_crc32c_armv8_choose', 'USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK'],
+ ['pg_crc32c_sb8', 'USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK'],
+
+ # generic fallback
+ ['pg_crc32c_sb8', 'USE_SLICING_BY_8_CRC32C'],
+]
+
+pgport_cflags = {'crc': cflags_crc}
+pgport_sources_cflags = {'crc': []}
+
+foreach f : replace_funcs_neg
+ func = f.get(0)
+ varname = f.get(1, 'HAVE_@0@'.format(func.to_upper()))
+ filename = '@0@.c'.format(func)
+
+ val = '@0@'.format(cdata.get(varname, 'false'))
+ if val == 'false' or val == '0'
+ pgport_sources += files(filename)
+ endif
+endforeach
+
+foreach f : replace_funcs_pos
+ func = f.get(0)
+ varname = f.get(1, 'HAVE_@0@'.format(func.to_upper()))
+ filename = '@0@.c'.format(func)
+
+ val = '@0@'.format(cdata.get(varname, 'false'))
+ if val == 'true' or val == '1'
+ src = files(filename)
+ if f.length() > 2
+ pgport_sources_cflags += {f[2]: pgport_sources_cflags[f[2]] + src}
+ else
+ pgport_sources += src
+ endif
+ endif
+endforeach
+
+
+if (host_system == 'windows' or host_system == 'cygwin') and \
+ (cc.get_id() != 'msvc' or cc.version().version_compare('<14.0'))
+
+ # Cygwin and (apparently, based on test results) Mingw both
+ # have a broken strtof(), so substitute its implementation.
+ # That's not a perfect fix, since it doesn't avoid double-rounding,
+ # but we have no better options.
+ pgport_sources += files('strtof.c')
+ message('On @0@ with compiler @1@ @2@ we will use our strtof wrapper.'.format(
+ host_system, cc.get_id(), cc.version()))
+endif
+
+
+
+# Build pgport once for backend, once for use in frontend binaries, and once
+# for use in shared libraries
+pgport = {}
+pgport_variants = {
+ '_srv': internal_lib_args + {
+ 'dependencies': [backend_port_code],
+ },
+ '': default_lib_args + {
+ 'dependencies': [frontend_port_code],
+ },
+ '_shlib': default_lib_args + {
+ 'pic': true,
+ 'dependencies': [frontend_port_code],
+ },
+}
+
+foreach name, opts : pgport_variants
+
+ # Build internal static libraries for sets of files that need to be built
+ # with different cflags
+ cflag_libs = []
+ foreach cflagname, sources : pgport_sources_cflags
+ if sources.length() == 0
+ continue
+ endif
+ c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
+ cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
+ sources,
+ kwargs: opts + {
+ 'c_args': c_args,
+ 'build_by_default': false,
+ 'install': false,
+ },
+ )
+ endforeach
+
+ lib = static_library('libpgport@0@'.format(name),
+ pgport_sources,
+ link_with: cflag_libs,
+ kwargs: opts + {
+ 'dependencies': opts['dependencies'] + [ssl],
+ }
+ )
+ pgport += {name: lib}
+endforeach
+
+pgport_srv = pgport['_srv']
+pgport_static = pgport['']
+pgport_shlib = pgport['_shlib']
diff --git a/config/meson.build b/config/meson.build
new file mode 100644
index 00000000000..ab19c380bd2
--- /dev/null
+++ b/config/meson.build
@@ -0,0 +1,4 @@
+install_data(
+ 'install-sh', 'missing',
+ install_dir: dir_pgxs / 'config'
+)
diff --git a/src/backend/access/brin/meson.build b/src/backend/access/brin/meson.build
new file mode 100644
index 00000000000..a54c7532927
--- /dev/null
+++ b/src/backend/access/brin/meson.build
@@ -0,0 +1,12 @@
+backend_sources += files(
+ 'brin.c',
+ 'brin_bloom.c',
+ 'brin_inclusion.c',
+ 'brin_minmax.c',
+ 'brin_minmax_multi.c',
+ 'brin_pageops.c',
+ 'brin_revmap.c',
+ 'brin_tuple.c',
+ 'brin_validate.c',
+ 'brin_xlog.c',
+)
diff --git a/src/backend/access/common/meson.build b/src/backend/access/common/meson.build
new file mode 100644
index 00000000000..857beaa32d3
--- /dev/null
+++ b/src/backend/access/common/meson.build
@@ -0,0 +1,18 @@
+backend_sources += files(
+ 'attmap.c',
+ 'bufmask.c',
+ 'detoast.c',
+ 'heaptuple.c',
+ 'indextuple.c',
+ 'printsimple.c',
+ 'printtup.c',
+ 'relation.c',
+ 'reloptions.c',
+ 'scankey.c',
+ 'session.c',
+ 'syncscan.c',
+ 'toast_compression.c',
+ 'toast_internals.c',
+ 'tupconvert.c',
+ 'tupdesc.c',
+)
diff --git a/src/backend/access/gin/meson.build b/src/backend/access/gin/meson.build
new file mode 100644
index 00000000000..56d6f343d54
--- /dev/null
+++ b/src/backend/access/gin/meson.build
@@ -0,0 +1,17 @@
+backend_sources += files(
+ 'ginarrayproc.c',
+ 'ginbtree.c',
+ 'ginbulk.c',
+ 'gindatapage.c',
+ 'ginentrypage.c',
+ 'ginfast.c',
+ 'ginget.c',
+ 'gininsert.c',
+ 'ginlogic.c',
+ 'ginpostinglist.c',
+ 'ginscan.c',
+ 'ginutil.c',
+ 'ginvacuum.c',
+ 'ginvalidate.c',
+ 'ginxlog.c',
+)
diff --git a/src/backend/access/gist/meson.build b/src/backend/access/gist/meson.build
new file mode 100644
index 00000000000..1a996b5e25d
--- /dev/null
+++ b/src/backend/access/gist/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'gist.c',
+ 'gistbuild.c',
+ 'gistbuildbuffers.c',
+ 'gistget.c',
+ 'gistproc.c',
+ 'gistscan.c',
+ 'gistsplit.c',
+ 'gistutil.c',
+ 'gistvacuum.c',
+ 'gistvalidate.c',
+ 'gistxlog.c',
+)
diff --git a/src/backend/access/hash/meson.build b/src/backend/access/hash/meson.build
new file mode 100644
index 00000000000..22f2c691c34
--- /dev/null
+++ b/src/backend/access/hash/meson.build
@@ -0,0 +1,12 @@
+backend_sources += files(
+ 'hash.c',
+ 'hash_xlog.c',
+ 'hashfunc.c',
+ 'hashinsert.c',
+ 'hashovfl.c',
+ 'hashpage.c',
+ 'hashsearch.c',
+ 'hashsort.c',
+ 'hashutil.c',
+ 'hashvalidate.c',
+)
diff --git a/src/backend/access/heap/meson.build b/src/backend/access/heap/meson.build
new file mode 100644
index 00000000000..f1dca73743c
--- /dev/null
+++ b/src/backend/access/heap/meson.build
@@ -0,0 +1,11 @@
+backend_sources += files(
+ 'heapam.c',
+ 'heapam_handler.c',
+ 'heapam_visibility.c',
+ 'heaptoast.c',
+ 'hio.c',
+ 'pruneheap.c',
+ 'rewriteheap.c',
+ 'vacuumlazy.c',
+ 'visibilitymap.c',
+)
diff --git a/src/backend/access/index/meson.build b/src/backend/access/index/meson.build
new file mode 100644
index 00000000000..18af5533e65
--- /dev/null
+++ b/src/backend/access/index/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'amapi.c',
+ 'amvalidate.c',
+ 'genam.c',
+ 'indexam.c',
+)
diff --git a/src/backend/access/meson.build b/src/backend/access/meson.build
new file mode 100644
index 00000000000..9874291fc0a
--- /dev/null
+++ b/src/backend/access/meson.build
@@ -0,0 +1,13 @@
+subdir('brin')
+subdir('common')
+subdir('gin')
+subdir('gist')
+subdir('hash')
+subdir('heap')
+subdir('index')
+subdir('nbtree')
+subdir('rmgrdesc')
+subdir('spgist')
+subdir('table')
+subdir('tablesample')
+subdir('transam')
diff --git a/src/backend/access/nbtree/meson.build b/src/backend/access/nbtree/meson.build
new file mode 100644
index 00000000000..07dc29e8190
--- /dev/null
+++ b/src/backend/access/nbtree/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'nbtcompare.c',
+ 'nbtdedup.c',
+ 'nbtinsert.c',
+ 'nbtpage.c',
+ 'nbtree.c',
+ 'nbtsearch.c',
+ 'nbtsort.c',
+ 'nbtsplitloc.c',
+ 'nbtutils.c',
+ 'nbtvalidate.c',
+ 'nbtxlog.c',
+)
diff --git a/src/backend/access/rmgrdesc/meson.build b/src/backend/access/rmgrdesc/meson.build
new file mode 100644
index 00000000000..f3a6e0a571b
--- /dev/null
+++ b/src/backend/access/rmgrdesc/meson.build
@@ -0,0 +1,26 @@
+# used by frontend programs like pg_waldump
+rmgr_desc_sources = files(
+ 'brindesc.c',
+ 'clogdesc.c',
+ 'committsdesc.c',
+ 'dbasedesc.c',
+ 'genericdesc.c',
+ 'gindesc.c',
+ 'gistdesc.c',
+ 'hashdesc.c',
+ 'heapdesc.c',
+ 'logicalmsgdesc.c',
+ 'mxactdesc.c',
+ 'nbtdesc.c',
+ 'relmapdesc.c',
+ 'replorigindesc.c',
+ 'seqdesc.c',
+ 'smgrdesc.c',
+ 'spgdesc.c',
+ 'standbydesc.c',
+ 'tblspcdesc.c',
+ 'xactdesc.c',
+ 'xlogdesc.c',
+)
+
+backend_sources += rmgr_desc_sources
diff --git a/src/backend/access/spgist/meson.build b/src/backend/access/spgist/meson.build
new file mode 100644
index 00000000000..f18d0d2e53f
--- /dev/null
+++ b/src/backend/access/spgist/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'spgdoinsert.c',
+ 'spginsert.c',
+ 'spgkdtreeproc.c',
+ 'spgproc.c',
+ 'spgquadtreeproc.c',
+ 'spgscan.c',
+ 'spgtextproc.c',
+ 'spgutils.c',
+ 'spgvacuum.c',
+ 'spgvalidate.c',
+ 'spgxlog.c',
+)
diff --git a/src/backend/access/table/meson.build b/src/backend/access/table/meson.build
new file mode 100644
index 00000000000..66c706d640e
--- /dev/null
+++ b/src/backend/access/table/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'table.c',
+ 'tableam.c',
+ 'tableamapi.c',
+ 'toast_helper.c',
+)
diff --git a/src/backend/access/tablesample/meson.build b/src/backend/access/tablesample/meson.build
new file mode 100644
index 00000000000..63ee8203226
--- /dev/null
+++ b/src/backend/access/tablesample/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'bernoulli.c',
+ 'system.c',
+ 'tablesample.c',
+)
diff --git a/src/backend/access/transam/meson.build b/src/backend/access/transam/meson.build
new file mode 100644
index 00000000000..c32169bd2c6
--- /dev/null
+++ b/src/backend/access/transam/meson.build
@@ -0,0 +1,31 @@
+backend_sources += files(
+ 'clog.c',
+ 'commit_ts.c',
+ 'generic_xlog.c',
+ 'multixact.c',
+ 'parallel.c',
+ 'rmgr.c',
+ 'slru.c',
+ 'subtrans.c',
+ 'timeline.c',
+ 'transam.c',
+ 'twophase.c',
+ 'twophase_rmgr.c',
+ 'varsup.c',
+ 'xact.c',
+ 'xlog.c',
+ 'xlogarchive.c',
+ 'xlogfuncs.c',
+ 'xloginsert.c',
+ 'xlogprefetcher.c',
+ 'xlogrecovery.c',
+ 'xlogstats.c',
+ 'xlogutils.c',
+)
+
+# used by frontend programs to build a frontend xlogreader
+xlogreader_sources = files(
+ 'xlogreader.c',
+)
+
+backend_sources += xlogreader_sources
diff --git a/src/backend/backup/meson.build b/src/backend/backup/meson.build
new file mode 100644
index 00000000000..a09305cadfa
--- /dev/null
+++ b/src/backend/backup/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'backup_manifest.c',
+ 'basebackup.c',
+ 'basebackup_copy.c',
+ 'basebackup_gzip.c',
+ 'basebackup_lz4.c',
+ 'basebackup_progress.c',
+ 'basebackup_server.c',
+ 'basebackup_sink.c',
+ 'basebackup_target.c',
+ 'basebackup_throttle.c',
+ 'basebackup_zstd.c',
+)
diff --git a/src/backend/bootstrap/meson.build b/src/backend/bootstrap/meson.build
new file mode 100644
index 00000000000..55c33dd21c3
--- /dev/null
+++ b/src/backend/bootstrap/meson.build
@@ -0,0 +1,28 @@
+backend_sources += files(
+ 'bootstrap.c')
+
+# see ../parser/meson.build
+boot_parser_sources = []
+
+bootscanner = custom_target('bootscanner',
+ input: 'bootscanner.l',
+ output: 'bootscanner.c',
+ command: flex_cmd,
+)
+generated_sources += bootscanner
+boot_parser_sources += bootscanner
+
+bootparse = custom_target('bootparse',
+ input: 'bootparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += bootparse.to_list()
+boot_parser_sources += bootparse
+
+boot_parser = static_library('boot_parser',
+ boot_parser_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += boot_parser
diff --git a/src/backend/catalog/meson.build b/src/backend/catalog/meson.build
new file mode 100644
index 00000000000..08747914516
--- /dev/null
+++ b/src/backend/catalog/meson.build
@@ -0,0 +1,44 @@
+backend_sources += files(
+ 'aclchk.c',
+ 'catalog.c',
+ 'dependency.c',
+ 'heap.c',
+ 'index.c',
+ 'indexing.c',
+ 'namespace.c',
+ 'objectaccess.c',
+ 'objectaddress.c',
+ 'partition.c',
+ 'pg_aggregate.c',
+ 'pg_attrdef.c',
+ 'pg_cast.c',
+ 'pg_class.c',
+ 'pg_collation.c',
+ 'pg_constraint.c',
+ 'pg_conversion.c',
+ 'pg_db_role_setting.c',
+ 'pg_depend.c',
+ 'pg_enum.c',
+ 'pg_inherits.c',
+ 'pg_largeobject.c',
+ 'pg_namespace.c',
+ 'pg_operator.c',
+ 'pg_parameter_acl.c',
+ 'pg_proc.c',
+ 'pg_publication.c',
+ 'pg_range.c',
+ 'pg_shdepend.c',
+ 'pg_subscription.c',
+ 'pg_type.c',
+ 'storage.c',
+ 'toasting.c',
+)
+
+
+install_data(
+ 'information_schema.sql',
+ 'sql_features.txt',
+ 'system_functions.sql',
+ 'system_views.sql',
+ install_dir: dir_data,
+)
diff --git a/src/backend/commands/meson.build b/src/backend/commands/meson.build
new file mode 100644
index 00000000000..9b350d025ff
--- /dev/null
+++ b/src/backend/commands/meson.build
@@ -0,0 +1,51 @@
+backend_sources += files(
+ 'aggregatecmds.c',
+ 'alter.c',
+ 'amcmds.c',
+ 'analyze.c',
+ 'async.c',
+ 'cluster.c',
+ 'collationcmds.c',
+ 'comment.c',
+ 'constraint.c',
+ 'conversioncmds.c',
+ 'copy.c',
+ 'copyfrom.c',
+ 'copyfromparse.c',
+ 'copyto.c',
+ 'createas.c',
+ 'dbcommands.c',
+ 'define.c',
+ 'discard.c',
+ 'dropcmds.c',
+ 'event_trigger.c',
+ 'explain.c',
+ 'extension.c',
+ 'foreigncmds.c',
+ 'functioncmds.c',
+ 'indexcmds.c',
+ 'lockcmds.c',
+ 'matview.c',
+ 'opclasscmds.c',
+ 'operatorcmds.c',
+ 'policy.c',
+ 'portalcmds.c',
+ 'prepare.c',
+ 'proclang.c',
+ 'publicationcmds.c',
+ 'schemacmds.c',
+ 'seclabel.c',
+ 'sequence.c',
+ 'statscmds.c',
+ 'subscriptioncmds.c',
+ 'tablecmds.c',
+ 'tablespace.c',
+ 'trigger.c',
+ 'tsearchcmds.c',
+ 'typecmds.c',
+ 'user.c',
+ 'vacuum.c',
+ 'vacuumparallel.c',
+ 'variable.c',
+ 'view.c',
+)
diff --git a/src/backend/executor/meson.build b/src/backend/executor/meson.build
new file mode 100644
index 00000000000..518674cfa28
--- /dev/null
+++ b/src/backend/executor/meson.build
@@ -0,0 +1,67 @@
+backend_sources += files(
+ 'execAmi.c',
+ 'execAsync.c',
+ 'execCurrent.c',
+ 'execExpr.c',
+ 'execExprInterp.c',
+ 'execGrouping.c',
+ 'execIndexing.c',
+ 'execJunk.c',
+ 'execMain.c',
+ 'execParallel.c',
+ 'execPartition.c',
+ 'execProcnode.c',
+ 'execReplication.c',
+ 'execSRF.c',
+ 'execScan.c',
+ 'execTuples.c',
+ 'execUtils.c',
+ 'functions.c',
+ 'instrument.c',
+ 'nodeAgg.c',
+ 'nodeAppend.c',
+ 'nodeBitmapAnd.c',
+ 'nodeBitmapHeapscan.c',
+ 'nodeBitmapIndexscan.c',
+ 'nodeBitmapOr.c',
+ 'nodeCtescan.c',
+ 'nodeCustom.c',
+ 'nodeForeignscan.c',
+ 'nodeFunctionscan.c',
+ 'nodeGather.c',
+ 'nodeGatherMerge.c',
+ 'nodeGroup.c',
+ 'nodeHash.c',
+ 'nodeHashjoin.c',
+ 'nodeIncrementalSort.c',
+ 'nodeIndexonlyscan.c',
+ 'nodeIndexscan.c',
+ 'nodeLimit.c',
+ 'nodeLockRows.c',
+ 'nodeMaterial.c',
+ 'nodeMemoize.c',
+ 'nodeMergeAppend.c',
+ 'nodeMergejoin.c',
+ 'nodeModifyTable.c',
+ 'nodeNamedtuplestorescan.c',
+ 'nodeNestloop.c',
+ 'nodeProjectSet.c',
+ 'nodeRecursiveunion.c',
+ 'nodeResult.c',
+ 'nodeSamplescan.c',
+ 'nodeSeqscan.c',
+ 'nodeSetOp.c',
+ 'nodeSort.c',
+ 'nodeSubplan.c',
+ 'nodeSubqueryscan.c',
+ 'nodeTableFuncscan.c',
+ 'nodeTidrangescan.c',
+ 'nodeTidscan.c',
+ 'nodeUnique.c',
+ 'nodeValuesscan.c',
+ 'nodeWindowAgg.c',
+ 'nodeWorktablescan.c',
+ 'spi.c',
+ 'tqueue.c',
+ 'tstoreReceiver.c',
+)
diff --git a/src/backend/foreign/meson.build b/src/backend/foreign/meson.build
new file mode 100644
index 00000000000..57463db92c1
--- /dev/null
+++ b/src/backend/foreign/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'foreign.c'
+)
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
new file mode 100644
index 00000000000..de2e624ab58
--- /dev/null
+++ b/src/backend/jit/llvm/meson.build
@@ -0,0 +1,73 @@
+if not llvm.found()
+ subdir_done()
+endif
+
+# Build LLVM JIT backend module
+
+llvmjit_sources = []
+
+# Infrastructure
+llvmjit_sources += files(
+ 'llvmjit.c',
+ 'llvmjit_error.cpp',
+ 'llvmjit_inline.cpp',
+ 'llvmjit_wrap.cpp',
+)
+
+# Code generation
+llvmjit_sources += files(
+ 'llvmjit_deform.c',
+ 'llvmjit_expr.c',
+)
+
+llvmjit = shared_module('llvmjit',
+ llvmjit_sources,
+ kwargs: pg_mod_args + {
+ 'dependencies': pg_mod_args['dependencies'] + [llvm],
+ }
+)
+
+backend_targets += llvmjit
+
+
+# Define a few bits and pieces used here and elsewhere to generate bitcode
+
+llvm_irgen_args = [
+ '-c', '-o', '@OUTPUT@', '@INPUT@',
+ '-flto=thin', '-emit-llvm',
+ '-MD', '-MQ', '@OUTPUT@', '-MF', '@DEPFILE@',
+ '-O2',
+ '-Wno-ignored-attributes',
+ '-Wno-empty-body',
+]
+
+if ccache.found()
+ llvm_irgen_command = ccache
+ llvm_irgen_args = [clang.path()] + llvm_irgen_args
+else
+ llvm_irgen_command = clang
+endif
+
+
+# XXX: Need to determine proper version of the function cflags for clang
+bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
+bitcode_cflags += cppflags
+
+# XXX: Worth improving on the logic to find directories here
+bitcode_cflags += '-I@BUILD_ROOT@/src/include'
+bitcode_cflags += '-I@BUILD_ROOT@/src/backend/utils/misc'
+bitcode_cflags += '-I@SOURCE_ROOT@/src/include'
+
+
+# Note this is intentionally not installed to bitcodedir, as it's not for
+# inlining
+llvmjit_types = custom_target('llvmjit_types.bc',
+ command: [llvm_irgen_command] + llvm_irgen_args + bitcode_cflags,
+ input: 'llvmjit_types.c',
+ output: 'llvmjit_types.bc',
+ depends: [postgres],
+ install: true,
+ install_dir: dir_lib_pkg,
+ depfile: '@BASENAME@.c.bc.d',
+)
+backend_targets += llvmjit_types
diff --git a/src/backend/jit/meson.build b/src/backend/jit/meson.build
new file mode 100644
index 00000000000..63cd33a4bed
--- /dev/null
+++ b/src/backend/jit/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'jit.c'
+)
diff --git a/src/backend/lib/meson.build b/src/backend/lib/meson.build
new file mode 100644
index 00000000000..48da1bddce7
--- /dev/null
+++ b/src/backend/lib/meson.build
@@ -0,0 +1,12 @@
+backend_sources += files(
+ 'binaryheap.c',
+ 'bipartite_match.c',
+ 'bloomfilter.c',
+ 'dshash.c',
+ 'hyperloglog.c',
+ 'ilist.c',
+ 'integerset.c',
+ 'knapsack.c',
+ 'pairingheap.c',
+ 'rbtree.c',
+)
diff --git a/src/backend/libpq/meson.build b/src/backend/libpq/meson.build
new file mode 100644
index 00000000000..6061269ef13
--- /dev/null
+++ b/src/backend/libpq/meson.build
@@ -0,0 +1,32 @@
+backend_sources += files(
+ 'auth-sasl.c',
+ 'auth-scram.c',
+ 'auth.c',
+ 'be-fsstubs.c',
+ 'be-secure-common.c',
+ 'be-secure.c',
+ 'crypt.c',
+ 'hba.c',
+ 'ifaddr.c',
+ 'pqcomm.c',
+ 'pqformat.c',
+ 'pqmq.c',
+ 'pqsignal.c',
+)
+
+if ssl.found()
+ backend_sources += files('be-secure-openssl.c')
+endif
+
+if gssapi.found()
+ backend_sources += files(
+ 'be-secure-gssapi.c',
+ 'be-gssapi-common.c'
+ )
+endif
+
+install_data(
+ 'pg_hba.conf.sample',
+ 'pg_ident.conf.sample',
+ install_dir: dir_data,
+)
diff --git a/src/backend/main/meson.build b/src/backend/main/meson.build
new file mode 100644
index 00000000000..241e125f089
--- /dev/null
+++ b/src/backend/main/meson.build
@@ -0,0 +1,2 @@
+main_file = files('main.c')
+backend_sources += main_file
diff --git a/src/backend/meson.build b/src/backend/meson.build
new file mode 100644
index 00000000000..fefa40ddb64
--- /dev/null
+++ b/src/backend/meson.build
@@ -0,0 +1,190 @@
+backend_build_deps = [backend_code]
+backend_sources = []
+backend_link_with = [pgport_srv, common_srv]
+
+generated_backend_sources = []
+
+subdir('access')
+subdir('backup')
+subdir('bootstrap')
+subdir('catalog')
+subdir('commands')
+subdir('executor')
+subdir('foreign')
+subdir('jit')
+subdir('lib')
+subdir('libpq')
+subdir('main')
+subdir('nodes')
+subdir('optimizer')
+subdir('parser')
+subdir('partitioning')
+subdir('port')
+subdir('postmaster')
+subdir('regex')
+subdir('replication')
+subdir('rewrite')
+subdir('statistics')
+subdir('storage')
+subdir('tcop')
+subdir('tsearch')
+subdir('utils')
+
+subdir('po', if_found: libintl)
+
+
+backend_link_args = []
+backend_link_depends = []
+
+
+# On windows when compiling with msvc we need to make postgres export all its
+# symbols so that extension libraries can use them. For that we need to scan
+# the constituting objects and generate a file specifying all the functions as
+# exported (variables need an "import" declaration in the header, hence
+# PGDLLEXPORT, but functions work without that, due to import libraries
+# basically being trampolines).
+#
+# For dtrace probes we need to invoke dtrace on all input files, before
+# linking the final executable (see more below).
+#
+#
+# On meson there's currently no easy way to do this that I found. So we build
+# a static library with all the input objects, run our script to generate
+# exports, and build the final executable using that static library
+#
+# We could do that only if either dtrace or msvc is in use, but it seems
+# easier to just always do so.
+#
+# Can't name the static library 'postgres', because msbuild ends up with a
+# conflict for the .pdb file otherwise.
+
+postgres_lib = static_library('postgres_lib',
+ backend_sources + timezone_sources + generated_backend_sources,
+ link_whole: backend_link_with,
+ dependencies: backend_build_deps,
+ kwargs: internal_lib_args,
+)
+
+if cc.get_id() == 'msvc'
+ postgres_def = custom_target('postgres.def',
+ command: [perl, files('../tools/msvc/gendef.pl'),
+ '--arch', host_cpu,
+ '--tempdir', '@PRIVATE_DIR@',
+ '--deffile', '@OUTPUT@',
+ '@INPUT@'],
+ input: [postgres_lib, common_srv, pgport_srv],
+ output: 'postgres.def',
+ depends: [postgres_lib, common_srv, pgport_srv],
+ install: false,
+ build_by_default: false,
+ )
+
+ backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
+ backend_link_depends += postgres_def
+
+elif host_system == 'aix'
+ # The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
+ # main executable, allowing extension libraries to resolve their undefined
+ # symbols to symbols in the postgres binary.
+ postgres_imp = custom_target('postgres.imp',
+ command: [files('port/aix/mkldexport.sh'), '@INPUT@', '.'],
+ input: postgres_lib,
+ output: 'postgres.imp',
+ capture: true,
+ install: true,
+ install_dir: dir_lib,
+ build_by_default: false,
+ )
+ backend_link_args += '-Wl,-bE:@0@'.format(postgres_imp.full_path())
+ backend_link_depends += postgres_imp
+endif
+
+backend_input = []
+backend_objs = [postgres_lib.extract_all_objects(recursive: false)]
+
+# As of 1/2010:
+# The probes.o file is necessary for dtrace support on Solaris, and on recent
+# versions of systemtap. (Older systemtap releases just produce an empty
+# file, but that's okay.) However, macOS's dtrace doesn't use it and doesn't
+# even recognize the -G option. So, build probes.o except on macOS.
+# This might need adjustment as other platforms add dtrace support.
+#
+# On at least linux we don't actually need to pass in all the objects, but
+# at least on FreeBSD and Solaris we have to.
+#
+# XXX: The reason we don't use the objects for generated sources is that
+# hits a meson bug. Luckily we don't don't have probes in generated
+# sources...
+if dtrace.found() and host_system != 'darwin'
+ backend_input += custom_target(
+ 'probes.o',
+ input: ['utils/probes.d', postgres_lib.extract_objects(backend_sources, timezone_sources)],
+ output: 'probes.o',
+ command: [dtrace, '-C', '-G', '-o', '@OUTPUT@', '-s', '@INPUT@'],
+ install: false,
+ )
+endif
+
+postgres = executable('postgres',
+ backend_input,
+ objects: backend_objs,
+ link_args: backend_link_args,
+ link_with: backend_link_with,
+ link_depends: backend_link_depends,
+ export_dynamic: true,
+ implib: true,
+ dependencies: backend_build_deps,
+ kwargs: default_bin_args,
+)
+
+backend_targets += postgres
+
+pg_mod_c_args = cflags_mod
+pg_mod_cpp_args = cxxflags_mod
+pg_mod_link_args = ldflags_sl + ldflags_mod
+pg_mod_link_depend = []
+
+# A few platforms like MacOS and Windows link shared modules against postgres,
+# or a [import] library derived from it. Set up the link flags for that.
+if mod_link_args_fmt.length() > 0
+ # To avoid unnecessary build-time dependencies on other operating systems,
+ # only the dependency when it when necessary.
+ pg_mod_link_depend += postgres
+
+ name = mod_link_with_name.format('postgres')
+ link_with_uninst = meson.current_build_dir() / name
+ link_with_inst = '${@0@}/@1@'.format(mod_link_with_dir, name)
+
+ foreach el : mod_link_args_fmt
+ pg_mod_link_args += el.format(link_with_uninst)
+ endforeach
+endif
+
+
+# Note there's intentionally no dependency on pgport/common here - we want the
+# symbols from the main binary for extension modules, rather than the
+# extension linking separately to pgport/common.
+backend_mod_code = declare_dependency(
+ compile_args: pg_mod_c_args,
+ include_directories: postgres_inc,
+ link_args: pg_mod_link_args,
+ sources: generated_headers + generated_backend_headers,
+ dependencies: backend_mod_deps,
+)
+
+pg_mod_args = default_mod_args + {
+ 'dependencies': [backend_mod_code],
+ 'cpp_args': pg_mod_cpp_args,
+ 'link_depends': pg_mod_link_depend,
+}
+
+
+
+# Shared modules that, on some system, link against the server binary. Only
+# enter these after we defined the server build.
+
+subdir('jit/llvm')
+subdir('replication/libpqwalreceiver')
+subdir('replication/pgoutput')
+subdir('snowball')
+subdir('utils/mb/conversion_procs')
diff --git a/src/backend/nodes/meson.build b/src/backend/nodes/meson.build
new file mode 100644
index 00000000000..8e0d4039f24
--- /dev/null
+++ b/src/backend/nodes/meson.build
@@ -0,0 +1,29 @@
+backend_sources += files(
+ 'bitmapset.c',
+ 'extensible.c',
+ 'list.c',
+ 'makefuncs.c',
+ 'nodeFuncs.c',
+ 'nodes.c',
+ 'params.c',
+ 'print.c',
+ 'read.c',
+ 'tidbitmap.c',
+ 'value.c',
+)
+
+# these include .c files generated in ../../include/nodes, seems nicer to not
+# add that as an include path for the whole backend
+nodefunc_sources = files(
+ 'copyfuncs.c',
+ 'equalfuncs.c',
+ 'outfuncs.c',
+ 'readfuncs.c',
+)
+nodefuncs = static_library('nodefuncs',
+ nodefunc_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('../../include/nodes'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += nodefuncs
diff --git a/src/backend/optimizer/geqo/meson.build b/src/backend/optimizer/geqo/meson.build
new file mode 100644
index 00000000000..c04f1dc2dfd
--- /dev/null
+++ b/src/backend/optimizer/geqo/meson.build
@@ -0,0 +1,17 @@
+backend_sources += files(
+ 'geqo_copy.c',
+ 'geqo_cx.c',
+ 'geqo_erx.c',
+ 'geqo_eval.c',
+ 'geqo_main.c',
+ 'geqo_misc.c',
+ 'geqo_mutation.c',
+ 'geqo_ox1.c',
+ 'geqo_ox2.c',
+ 'geqo_pmx.c',
+ 'geqo_pool.c',
+ 'geqo_px.c',
+ 'geqo_random.c',
+ 'geqo_recombination.c',
+ 'geqo_selection.c',
+)
diff --git a/src/backend/optimizer/meson.build b/src/backend/optimizer/meson.build
new file mode 100644
index 00000000000..1ab1d9934ae
--- /dev/null
+++ b/src/backend/optimizer/meson.build
@@ -0,0 +1,5 @@
+subdir('geqo')
+subdir('path')
+subdir('plan')
+subdir('prep')
+subdir('util')
diff --git a/src/backend/optimizer/path/meson.build b/src/backend/optimizer/path/meson.build
new file mode 100644
index 00000000000..310042e7aee
--- /dev/null
+++ b/src/backend/optimizer/path/meson.build
@@ -0,0 +1,11 @@
+backend_sources += files(
+ 'allpaths.c',
+ 'clausesel.c',
+ 'costsize.c',
+ 'equivclass.c',
+ 'indxpath.c',
+ 'joinpath.c',
+ 'joinrels.c',
+ 'pathkeys.c',
+ 'tidpath.c',
+)
diff --git a/src/backend/optimizer/plan/meson.build b/src/backend/optimizer/plan/meson.build
new file mode 100644
index 00000000000..22ec65a3845
--- /dev/null
+++ b/src/backend/optimizer/plan/meson.build
@@ -0,0 +1,10 @@
+backend_sources += files(
+ 'analyzejoins.c',
+ 'createplan.c',
+ 'initsplan.c',
+ 'planagg.c',
+ 'planmain.c',
+ 'planner.c',
+ 'setrefs.c',
+ 'subselect.c',
+)
diff --git a/src/backend/optimizer/prep/meson.build b/src/backend/optimizer/prep/meson.build
new file mode 100644
index 00000000000..4549a5b0e79
--- /dev/null
+++ b/src/backend/optimizer/prep/meson.build
@@ -0,0 +1,7 @@
+backend_sources += files(
+ 'prepagg.c',
+ 'prepjointree.c',
+ 'prepqual.c',
+ 'preptlist.c',
+ 'prepunion.c',
+)
diff --git a/src/backend/optimizer/util/meson.build b/src/backend/optimizer/util/meson.build
new file mode 100644
index 00000000000..e7ceaf566b5
--- /dev/null
+++ b/src/backend/optimizer/util/meson.build
@@ -0,0 +1,16 @@
+backend_sources += files(
+ 'appendinfo.c',
+ 'clauses.c',
+ 'inherit.c',
+ 'joininfo.c',
+ 'orclauses.c',
+ 'paramassign.c',
+ 'pathnode.c',
+ 'placeholder.c',
+ 'plancat.c',
+ 'predtest.c',
+ 'relnode.c',
+ 'restrictinfo.c',
+ 'tlist.c',
+ 'var.c',
+)
diff --git a/src/backend/parser/meson.build b/src/backend/parser/meson.build
new file mode 100644
index 00000000000..15d5a349eeb
--- /dev/null
+++ b/src/backend/parser/meson.build
@@ -0,0 +1,48 @@
+backend_sources += files(
+ 'analyze.c',
+ 'parse_agg.c',
+ 'parse_clause.c',
+ 'parse_coerce.c',
+ 'parse_collate.c',
+ 'parse_cte.c',
+ 'parse_enr.c',
+ 'parse_expr.c',
+ 'parse_func.c',
+ 'parse_merge.c',
+ 'parse_node.c',
+ 'parse_oper.c',
+ 'parse_param.c',
+ 'parse_relation.c',
+ 'parse_target.c',
+ 'parse_type.c',
+ 'parse_utilcmd.c',
+ 'scansup.c',
+)
+
+# Build a small utility static lib for the parser. The generation of the
+# parser is slow, and building this separately avoids other parts of the
+# backend having to wait till gram.h is generated.
+parser_sources = files('parser.c')
+
+backend_scanner = custom_target('scan',
+ input: 'scan.l',
+ output: 'scan.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-CF', '-p', '-p'],
+)
+generated_sources += backend_scanner
+parser_sources += backend_scanner
+
+backend_parser = custom_target('gram',
+ input: 'gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += backend_parser.to_list()
+parser_sources += backend_parser
+
+parser = static_library('parser',
+ parser_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += parser
diff --git a/src/backend/partitioning/meson.build b/src/backend/partitioning/meson.build
new file mode 100644
index 00000000000..e5e3806a0cc
--- /dev/null
+++ b/src/backend/partitioning/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'partbounds.c',
+ 'partdesc.c',
+ 'partprune.c',
+)
diff --git a/src/backend/po/meson.build b/src/backend/po/meson.build
new file mode 100644
index 00000000000..4ace0554680
--- /dev/null
+++ b/src/backend/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('postgres-' + pg_version_major.to_string())
diff --git a/src/backend/port/meson.build b/src/backend/port/meson.build
new file mode 100644
index 00000000000..a22c25dd952
--- /dev/null
+++ b/src/backend/port/meson.build
@@ -0,0 +1,31 @@
+backend_sources += files(
+ 'atomics.c',
+)
+
+
+if cdata.has('USE_UNNAMED_POSIX_SEMAPHORES') or cdata.has('USE_NAMED_POSIX_SEMAPHORES')
+ backend_sources += files('posix_sema.c')
+endif
+
+if cdata.has('USE_SYSV_SEMAPHORES')
+ backend_sources += files('sysv_sema.c')
+endif
+
+if cdata.has('USE_WIN32_SEMAPHORES')
+ backend_sources += files('win32_sema.c')
+endif
+
+if cdata.has('USE_SYSV_SHARED_MEMORY')
+ backend_sources += files('sysv_shmem.c')
+endif
+
+if cdata.has('USE_WIN32_SHARED_MEMORY')
+ backend_sources += files('win32_shmem.c')
+endif
+
+if host_system == 'windows'
+ subdir('win32')
+endif
+
+# autoconf generates the file there, ensure we get a conflict
+generated_sources_ac += {'src/backend/port': ['pg_sema.c', 'pg_shmem.c', 'tas.s']}
diff --git a/src/backend/port/win32/meson.build b/src/backend/port/win32/meson.build
new file mode 100644
index 00000000000..68fe4cc3cd0
--- /dev/null
+++ b/src/backend/port/win32/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'crashdump.c',
+ 'signal.c',
+ 'socket.c',
+ 'timer.c',
+)
diff --git a/src/backend/postmaster/meson.build b/src/backend/postmaster/meson.build
new file mode 100644
index 00000000000..293a44ca295
--- /dev/null
+++ b/src/backend/postmaster/meson.build
@@ -0,0 +1,15 @@
+backend_sources += files(
+ 'autovacuum.c',
+ 'auxprocess.c',
+ 'bgworker.c',
+ 'bgwriter.c',
+ 'checkpointer.c',
+ 'fork_process.c',
+ 'interrupt.c',
+ 'pgarch.c',
+ 'postmaster.c',
+ 'shell_archive.c',
+ 'startup.c',
+ 'syslogger.c',
+ 'walwriter.c',
+)
diff --git a/src/backend/regex/meson.build b/src/backend/regex/meson.build
new file mode 100644
index 00000000000..c84e57fdba5
--- /dev/null
+++ b/src/backend/regex/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'regcomp.c',
+ 'regerror.c',
+ 'regexec.c',
+ 'regexport.c',
+ 'regfree.c',
+ 'regprefix.c',
+)
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
new file mode 100644
index 00000000000..3fc786c80a0
--- /dev/null
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -0,0 +1,13 @@
+libpqwalreceiver_sources = files(
+ 'libpqwalreceiver.c',
+)
+
+libpqwalreceiver = shared_module('pqwalreceiver',
+ libpqwalreceiver_sources,
+ kwargs: pg_mod_args + {
+ 'name_prefix': 'lib',
+ 'dependencies': pg_mod_args['dependencies'] + [libpq],
+ }
+)
+
+backend_targets += libpqwalreceiver
diff --git a/src/backend/replication/logical/meson.build b/src/backend/replication/logical/meson.build
new file mode 100644
index 00000000000..773583a12ba
--- /dev/null
+++ b/src/backend/replication/logical/meson.build
@@ -0,0 +1,14 @@
+backend_sources += files(
+ 'decode.c',
+ 'launcher.c',
+ 'logical.c',
+ 'logicalfuncs.c',
+ 'message.c',
+ 'origin.c',
+ 'proto.c',
+ 'relation.c',
+ 'reorderbuffer.c',
+ 'snapbuild.c',
+ 'tablesync.c',
+ 'worker.c',
+)
diff --git a/src/backend/replication/meson.build b/src/backend/replication/meson.build
new file mode 100644
index 00000000000..27b9bf13182
--- /dev/null
+++ b/src/backend/replication/meson.build
@@ -0,0 +1,51 @@
+backend_sources += files(
+ 'slot.c',
+ 'slotfuncs.c',
+ 'syncrep.c',
+ 'walreceiver.c',
+ 'walreceiverfuncs.c',
+ 'walsender.c',
+)
+
+# see ../parser/meson.build
+repl_parser_sources = []
+
+repl_scanner = custom_target('repl_scanner',
+ input: 'repl_scanner.l',
+ output: 'repl_scanner.c',
+ command: flex_cmd,
+)
+generated_sources += repl_scanner
+repl_parser_sources += repl_scanner
+
+repl_gram = custom_target('repl_gram',
+ input: 'repl_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += repl_gram.to_list()
+repl_parser_sources += repl_gram
+
+syncrep_scanner = custom_target('syncrep_scanner',
+ input: 'syncrep_scanner.l',
+ output: 'syncrep_scanner.c',
+ command: flex_cmd,
+)
+generated_sources += syncrep_scanner
+repl_parser_sources += syncrep_scanner
+
+syncrep_gram = custom_target('syncrep_gram',
+ input: 'syncrep_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += syncrep_gram.to_list()
+repl_parser_sources += syncrep_gram
+
+repl_parser = static_library('repl_parser',
+ repl_parser_sources,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+backend_link_with += repl_parser
+
+subdir('logical')
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
new file mode 100644
index 00000000000..ab956361a62
--- /dev/null
+++ b/src/backend/replication/pgoutput/meson.build
@@ -0,0 +1,10 @@
+pgoutput_sources = files(
+ 'pgoutput.c',
+)
+
+pgoutput = shared_module('pgoutput',
+ pgoutput_sources,
+ kwargs: pg_mod_args,
+)
+
+backend_targets += pgoutput
diff --git a/src/backend/rewrite/meson.build b/src/backend/rewrite/meson.build
new file mode 100644
index 00000000000..21fa0e230b0
--- /dev/null
+++ b/src/backend/rewrite/meson.build
@@ -0,0 +1,9 @@
+backend_sources += files(
+ 'rewriteDefine.c',
+ 'rewriteHandler.c',
+ 'rewriteManip.c',
+ 'rewriteRemove.c',
+ 'rewriteSearchCycle.c',
+ 'rewriteSupport.c',
+ 'rowsecurity.c',
+)
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
new file mode 100644
index 00000000000..8c6f685cb32
--- /dev/null
+++ b/src/backend/snowball/meson.build
@@ -0,0 +1,88 @@
+dict_snowball_sources = files(
+ 'libstemmer/api.c',
+ 'libstemmer/utilities.c',
+ 'dict_snowball.c',
+)
+
+dict_snowball_sources += files(
+ 'libstemmer/stem_ISO_8859_1_basque.c',
+ 'libstemmer/stem_ISO_8859_1_catalan.c',
+ 'libstemmer/stem_ISO_8859_1_danish.c',
+ 'libstemmer/stem_ISO_8859_1_dutch.c',
+ 'libstemmer/stem_ISO_8859_1_english.c',
+ 'libstemmer/stem_ISO_8859_1_finnish.c',
+ 'libstemmer/stem_ISO_8859_1_french.c',
+ 'libstemmer/stem_ISO_8859_1_german.c',
+ 'libstemmer/stem_ISO_8859_1_indonesian.c',
+ 'libstemmer/stem_ISO_8859_1_irish.c',
+ 'libstemmer/stem_ISO_8859_1_italian.c',
+ 'libstemmer/stem_ISO_8859_1_norwegian.c',
+ 'libstemmer/stem_ISO_8859_1_porter.c',
+ 'libstemmer/stem_ISO_8859_1_portuguese.c',
+ 'libstemmer/stem_ISO_8859_1_spanish.c',
+ 'libstemmer/stem_ISO_8859_1_swedish.c',
+ 'libstemmer/stem_ISO_8859_2_hungarian.c',
+ 'libstemmer/stem_ISO_8859_2_romanian.c',
+ 'libstemmer/stem_KOI8_R_russian.c',
+ 'libstemmer/stem_UTF_8_arabic.c',
+ 'libstemmer/stem_UTF_8_armenian.c',
+ 'libstemmer/stem_UTF_8_basque.c',
+ 'libstemmer/stem_UTF_8_catalan.c',
+ 'libstemmer/stem_UTF_8_danish.c',
+ 'libstemmer/stem_UTF_8_dutch.c',
+ 'libstemmer/stem_UTF_8_english.c',
+ 'libstemmer/stem_UTF_8_finnish.c',
+ 'libstemmer/stem_UTF_8_french.c',
+ 'libstemmer/stem_UTF_8_german.c',
+ 'libstemmer/stem_UTF_8_greek.c',
+ 'libstemmer/stem_UTF_8_hindi.c',
+ 'libstemmer/stem_UTF_8_hungarian.c',
+ 'libstemmer/stem_UTF_8_indonesian.c',
+ 'libstemmer/stem_UTF_8_irish.c',
+ 'libstemmer/stem_UTF_8_italian.c',
+ 'libstemmer/stem_UTF_8_lithuanian.c',
+ 'libstemmer/stem_UTF_8_nepali.c',
+ 'libstemmer/stem_UTF_8_norwegian.c',
+ 'libstemmer/stem_UTF_8_porter.c',
+ 'libstemmer/stem_UTF_8_portuguese.c',
+ 'libstemmer/stem_UTF_8_romanian.c',
+ 'libstemmer/stem_UTF_8_russian.c',
+ 'libstemmer/stem_UTF_8_serbian.c',
+ 'libstemmer/stem_UTF_8_spanish.c',
+ 'libstemmer/stem_UTF_8_swedish.c',
+ 'libstemmer/stem_UTF_8_tamil.c',
+ 'libstemmer/stem_UTF_8_turkish.c',
+ 'libstemmer/stem_UTF_8_yiddish.c',
+)
+
+# see comment in src/include/snowball/header.h
+stemmer_inc = include_directories('../../include/snowball')
+
+dict_snowball = shared_module('dict_snowball',
+ dict_snowball_sources,
+ kwargs: pg_mod_args + {
+ 'include_directories': [stemmer_inc],
+ }
+)
+
+snowball_create = custom_target('snowball_create',
+ output: ['snowball_create.sql'],
+ depfile: 'snowball_create.dep',
+ command: [
+ perl, files('snowball_create.pl'),
+ '--depfile',
+ '--input', '@CURRENT_SOURCE_DIR@',
+ '--outdir', '@OUTDIR@',
+ ],
+ install: true,
+ install_dir: dir_data,
+)
+generated_sources += snowball_create
+
+install_subdir('stopwords',
+ install_dir: dir_data / 'tsearch_data',
+ strip_directory: true,
+)
+
+backend_targets += dict_snowball
+backend_targets += snowball_create
diff --git a/src/backend/statistics/meson.build b/src/backend/statistics/meson.build
new file mode 100644
index 00000000000..8530c55f73c
--- /dev/null
+++ b/src/backend/statistics/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'dependencies.c',
+ 'extended_stats.c',
+ 'mcv.c',
+ 'mvdistinct.c',
+)
diff --git a/src/backend/storage/buffer/meson.build b/src/backend/storage/buffer/meson.build
new file mode 100644
index 00000000000..56a59b52484
--- /dev/null
+++ b/src/backend/storage/buffer/meson.build
@@ -0,0 +1,7 @@
+backend_sources += files(
+ 'buf_init.c',
+ 'buf_table.c',
+ 'bufmgr.c',
+ 'freelist.c',
+ 'localbuf.c',
+)
diff --git a/src/backend/storage/file/meson.build b/src/backend/storage/file/meson.build
new file mode 100644
index 00000000000..e1d5047d4aa
--- /dev/null
+++ b/src/backend/storage/file/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'buffile.c',
+ 'copydir.c',
+ 'fd.c',
+ 'fileset.c',
+ 'reinit.c',
+ 'sharedfileset.c',
+)
diff --git a/src/backend/storage/freespace/meson.build b/src/backend/storage/freespace/meson.build
new file mode 100644
index 00000000000..e4200ea6527
--- /dev/null
+++ b/src/backend/storage/freespace/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'freespace.c',
+ 'fsmpage.c',
+ 'indexfsm.c',
+)
diff --git a/src/backend/storage/ipc/meson.build b/src/backend/storage/ipc/meson.build
new file mode 100644
index 00000000000..516bc1d0193
--- /dev/null
+++ b/src/backend/storage/ipc/meson.build
@@ -0,0 +1,20 @@
+backend_sources += files(
+ 'barrier.c',
+ 'dsm.c',
+ 'dsm_impl.c',
+ 'ipc.c',
+ 'ipci.c',
+ 'latch.c',
+ 'pmsignal.c',
+ 'procarray.c',
+ 'procsignal.c',
+ 'shm_mq.c',
+ 'shm_toc.c',
+ 'shmem.c',
+ 'shmqueue.c',
+ 'signalfuncs.c',
+ 'sinval.c',
+ 'sinvaladt.c',
+ 'standby.c',
+
+)
diff --git a/src/backend/storage/large_object/meson.build b/src/backend/storage/large_object/meson.build
new file mode 100644
index 00000000000..8a181ab9b34
--- /dev/null
+++ b/src/backend/storage/large_object/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'inv_api.c',
+)
diff --git a/src/backend/storage/lmgr/meson.build b/src/backend/storage/lmgr/meson.build
new file mode 100644
index 00000000000..68237c8a2e8
--- /dev/null
+++ b/src/backend/storage/lmgr/meson.build
@@ -0,0 +1,13 @@
+backend_sources += files(
+ 'condition_variable.c',
+ 'deadlock.c',
+ 'lmgr.c',
+ 'lock.c',
+ 'lwlock.c',
+ 'predicate.c',
+ 'proc.c',
+ 's_lock.c',
+ 'spin.c',
+)
+
+generated_backend_sources += lwlocknames[1]
diff --git a/src/backend/storage/meson.build b/src/backend/storage/meson.build
new file mode 100644
index 00000000000..daad628d74c
--- /dev/null
+++ b/src/backend/storage/meson.build
@@ -0,0 +1,9 @@
+subdir('buffer')
+subdir('file')
+subdir('freespace')
+subdir('ipc')
+subdir('large_object')
+subdir('lmgr')
+subdir('page')
+subdir('smgr')
+subdir('sync')
diff --git a/src/backend/storage/page/meson.build b/src/backend/storage/page/meson.build
new file mode 100644
index 00000000000..2ecd16c952c
--- /dev/null
+++ b/src/backend/storage/page/meson.build
@@ -0,0 +1,5 @@
+backend_sources += files(
+ 'bufpage.c',
+ 'checksum.c',
+ 'itemptr.c',
+)
diff --git a/src/backend/storage/smgr/meson.build b/src/backend/storage/smgr/meson.build
new file mode 100644
index 00000000000..fdeb1223b32
--- /dev/null
+++ b/src/backend/storage/smgr/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'md.c',
+ 'smgr.c',
+)
diff --git a/src/backend/storage/sync/meson.build b/src/backend/storage/sync/meson.build
new file mode 100644
index 00000000000..05148b91a8e
--- /dev/null
+++ b/src/backend/storage/sync/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'sync.c',
+
+)
diff --git a/src/backend/tcop/meson.build b/src/backend/tcop/meson.build
new file mode 100644
index 00000000000..fb54aae8122
--- /dev/null
+++ b/src/backend/tcop/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'cmdtag.c',
+ 'dest.c',
+ 'fastpath.c',
+ 'postgres.c',
+ 'pquery.c',
+ 'utility.c',
+)
diff --git a/src/backend/tsearch/meson.build b/src/backend/tsearch/meson.build
new file mode 100644
index 00000000000..4144e9befc5
--- /dev/null
+++ b/src/backend/tsearch/meson.build
@@ -0,0 +1,21 @@
+backend_sources += files(
+ 'dict.c',
+ 'dict_ispell.c',
+ 'dict_simple.c',
+ 'dict_synonym.c',
+ 'dict_thesaurus.c',
+ 'regis.c',
+ 'spell.c',
+ 'to_tsany.c',
+ 'ts_locale.c',
+ 'ts_parse.c',
+ 'ts_selfuncs.c',
+ 'ts_typanalyze.c',
+ 'ts_utils.c',
+ 'wparser.c',
+ 'wparser_def.c',
+)
+
+install_subdir('dicts',
+ install_dir: dir_data / 'tsearch_data',
+ strip_directory: true)
diff --git a/src/backend/utils/activity/meson.build b/src/backend/utils/activity/meson.build
new file mode 100644
index 00000000000..5b3b558a67d
--- /dev/null
+++ b/src/backend/utils/activity/meson.build
@@ -0,0 +1,18 @@
+backend_sources += files(
+ 'backend_progress.c',
+ 'backend_status.c',
+ 'pgstat.c',
+ 'pgstat_archiver.c',
+ 'pgstat_bgwriter.c',
+ 'pgstat_checkpointer.c',
+ 'pgstat_database.c',
+ 'pgstat_function.c',
+ 'pgstat_relation.c',
+ 'pgstat_replslot.c',
+ 'pgstat_shmem.c',
+ 'pgstat_slru.c',
+ 'pgstat_subscription.c',
+ 'pgstat_wal.c',
+ 'pgstat_xact.c',
+ 'wait_event.c',
+)
diff --git a/src/backend/utils/adt/meson.build b/src/backend/utils/adt/meson.build
new file mode 100644
index 00000000000..ed9ceadfef0
--- /dev/null
+++ b/src/backend/utils/adt/meson.build
@@ -0,0 +1,131 @@
+backend_sources += files(
+ 'acl.c',
+ 'amutils.c',
+ 'array_expanded.c',
+ 'array_selfuncs.c',
+ 'array_typanalyze.c',
+ 'array_userfuncs.c',
+ 'arrayfuncs.c',
+ 'arraysubs.c',
+ 'arrayutils.c',
+ 'ascii.c',
+ 'bool.c',
+ 'cash.c',
+ 'char.c',
+ 'cryptohashfuncs.c',
+ 'date.c',
+ 'datetime.c',
+ 'datum.c',
+ 'dbsize.c',
+ 'domains.c',
+ 'encode.c',
+ 'enum.c',
+ 'expandeddatum.c',
+ 'expandedrecord.c',
+ 'float.c',
+ 'format_type.c',
+ 'formatting.c',
+ 'genfile.c',
+ 'geo_ops.c',
+ 'geo_selfuncs.c',
+ 'geo_spgist.c',
+ 'hbafuncs.c',
+ 'inet_cidr_ntop.c',
+ 'inet_net_pton.c',
+ 'int.c',
+ 'int8.c',
+ 'json.c',
+ 'jsonb.c',
+ 'jsonb_gin.c',
+ 'jsonb_op.c',
+ 'jsonb_util.c',
+ 'jsonbsubs.c',
+ 'jsonfuncs.c',
+ 'jsonpath.c',
+ 'jsonpath_exec.c',
+ 'like.c',
+ 'like_support.c',
+ 'lockfuncs.c',
+ 'mac.c',
+ 'mac8.c',
+ 'mcxtfuncs.c',
+ 'misc.c',
+ 'multirangetypes.c',
+ 'multirangetypes_selfuncs.c',
+ 'name.c',
+ 'network.c',
+ 'network_gist.c',
+ 'network_selfuncs.c',
+ 'network_spgist.c',
+ 'numeric.c',
+ 'numutils.c',
+ 'oid.c',
+ 'oracle_compat.c',
+ 'orderedsetaggs.c',
+ 'partitionfuncs.c',
+ 'pg_locale.c',
+ 'pg_lsn.c',
+ 'pg_upgrade_support.c',
+ 'pgstatfuncs.c',
+ 'pseudotypes.c',
+ 'quote.c',
+ 'rangetypes.c',
+ 'rangetypes_gist.c',
+ 'rangetypes_selfuncs.c',
+ 'rangetypes_spgist.c',
+ 'rangetypes_typanalyze.c',
+ 'regexp.c',
+ 'regproc.c',
+ 'ri_triggers.c',
+ 'rowtypes.c',
+ 'ruleutils.c',
+ 'selfuncs.c',
+ 'tid.c',
+ 'timestamp.c',
+ 'trigfuncs.c',
+ 'tsginidx.c',
+ 'tsgistidx.c',
+ 'tsquery.c',
+ 'tsquery_cleanup.c',
+ 'tsquery_gist.c',
+ 'tsquery_op.c',
+ 'tsquery_rewrite.c',
+ 'tsquery_util.c',
+ 'tsrank.c',
+ 'tsvector.c',
+ 'tsvector_op.c',
+ 'tsvector_parser.c',
+ 'uuid.c',
+ 'varbit.c',
+ 'varchar.c',
+ 'varlena.c',
+ 'version.c',
+ 'windowfuncs.c',
+ 'xid.c',
+ 'xid8funcs.c',
+ 'xml.c',
+)
+
+
+jsonpath_scan = custom_target('jsonpath_scan',
+ input: 'jsonpath_scan.l',
+ output: 'jsonpath_scan.c',
+ command: [flex_cmd, '--no-backup', '--', '-CF', '-p', '-p'],
+)
+generated_sources += jsonpath_scan
+
+jsonpath_gram = custom_target('jsonpath_parse',
+ input: 'jsonpath_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += jsonpath_gram.to_list()
+
+# so we don't need to add . as an include dir for the whole backend
+backend_link_with += static_library('jsonpath',
+ jsonpath_scan, jsonpath_gram,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+
+#generated_backend_sources += jsonpath_gram.to_list()
diff --git a/src/backend/utils/cache/meson.build b/src/backend/utils/cache/meson.build
new file mode 100644
index 00000000000..4fe6db6bda6
--- /dev/null
+++ b/src/backend/utils/cache/meson.build
@@ -0,0 +1,16 @@
+backend_sources += files(
+ 'attoptcache.c',
+ 'catcache.c',
+ 'evtcache.c',
+ 'inval.c',
+ 'lsyscache.c',
+ 'partcache.c',
+ 'plancache.c',
+ 'relcache.c',
+ 'relfilenumbermap.c',
+ 'relmapper.c',
+ 'spccache.c',
+ 'syscache.c',
+ 'ts_cache.c',
+ 'typcache.c',
+)
diff --git a/src/backend/utils/error/meson.build b/src/backend/utils/error/meson.build
new file mode 100644
index 00000000000..325446c8f93
--- /dev/null
+++ b/src/backend/utils/error/meson.build
@@ -0,0 +1,6 @@
+backend_sources += files(
+ 'assert.c',
+ 'csvlog.c',
+ 'elog.c',
+ 'jsonlog.c',
+)
diff --git a/src/backend/utils/fmgr/meson.build b/src/backend/utils/fmgr/meson.build
new file mode 100644
index 00000000000..e545b424fd2
--- /dev/null
+++ b/src/backend/utils/fmgr/meson.build
@@ -0,0 +1,8 @@
+backend_sources += files(
+ 'dfmgr.c',
+ 'fmgr.c',
+ 'funcapi.c',
+)
+
+# fmgrtab.c
+generated_backend_sources += fmgrtab_target[2]
diff --git a/src/backend/utils/hash/meson.build b/src/backend/utils/hash/meson.build
new file mode 100644
index 00000000000..242e2f0ecdf
--- /dev/null
+++ b/src/backend/utils/hash/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'dynahash.c',
+ 'pg_crc.c'
+)
diff --git a/src/backend/utils/init/meson.build b/src/backend/utils/init/meson.build
new file mode 100644
index 00000000000..ec9d72c3df1
--- /dev/null
+++ b/src/backend/utils/init/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'globals.c',
+ 'miscinit.c',
+ 'postinit.c')
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
new file mode 100644
index 00000000000..1bc971d1945
--- /dev/null
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -0,0 +1,36 @@
+encodings = {
+ 'cyrillic_and_mic': ['cyrillic_and_mic/cyrillic_and_mic.c'],
+ 'euc2004_sjis2004': ['euc2004_sjis2004/euc2004_sjis2004.c'],
+ 'euc_cn_and_mic': ['euc_cn_and_mic/euc_cn_and_mic.c'],
+ 'euc_jp_and_sjis': ['euc_jp_and_sjis/euc_jp_and_sjis.c'],
+ 'euc_kr_and_mic': ['euc_kr_and_mic/euc_kr_and_mic.c'],
+ 'euc_tw_and_big5': [
+ 'euc_tw_and_big5/euc_tw_and_big5.c',
+ 'euc_tw_and_big5/big5.c',
+ ],
+ 'latin2_and_win1250': ['latin2_and_win1250/latin2_and_win1250.c'],
+ 'latin_and_mic': ['latin_and_mic/latin_and_mic.c'],
+ 'utf8_and_big5': ['utf8_and_big5/utf8_and_big5.c'],
+ 'utf8_and_cyrillic': ['utf8_and_cyrillic/utf8_and_cyrillic.c'],
+ 'utf8_and_euc2004': ['utf8_and_euc2004/utf8_and_euc2004.c'],
+ 'utf8_and_euc_cn': ['utf8_and_euc_cn/utf8_and_euc_cn.c'],
+ 'utf8_and_euc_jp': ['utf8_and_euc_jp/utf8_and_euc_jp.c'],
+ 'utf8_and_euc_kr': ['utf8_and_euc_kr/utf8_and_euc_kr.c'],
+ 'utf8_and_euc_tw': ['utf8_and_euc_tw/utf8_and_euc_tw.c'],
+ 'utf8_and_gb18030': ['utf8_and_gb18030/utf8_and_gb18030.c'],
+ 'utf8_and_gbk': ['utf8_and_gbk/utf8_and_gbk.c'],
+ 'utf8_and_iso8859': ['utf8_and_iso8859/utf8_and_iso8859.c'],
+ 'utf8_and_iso8859_1': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'],
+ 'utf8_and_johab': ['utf8_and_johab/utf8_and_johab.c'],
+ 'utf8_and_sjis': ['utf8_and_sjis/utf8_and_sjis.c'],
+ 'utf8_and_sjis2004': ['utf8_and_sjis2004/utf8_and_sjis2004.c'],
+ 'utf8_and_uhc': ['utf8_and_uhc/utf8_and_uhc.c'],
+ 'utf8_and_win': ['utf8_and_win/utf8_and_win.c'],
+}
+
+foreach encoding, sources : encodings
+ backend_targets += shared_module(encoding,
+ sources,
+ kwargs: pg_mod_args,
+ )
+endforeach
diff --git a/src/backend/utils/mb/meson.build b/src/backend/utils/mb/meson.build
new file mode 100644
index 00000000000..39e45638db0
--- /dev/null
+++ b/src/backend/utils/mb/meson.build
@@ -0,0 +1,9 @@
+backend_sources += files(
+ 'conv.c',
+ 'mbutils.c',
+ 'stringinfo_mb.c',
+ 'wstrcmp.c',
+ 'wstrncmp.c',
+)
+
+# Note we only enter conversion_procs once the backend build is defined
diff --git a/src/backend/utils/meson.build b/src/backend/utils/meson.build
new file mode 100644
index 00000000000..3a916320bb3
--- /dev/null
+++ b/src/backend/utils/meson.build
@@ -0,0 +1,17 @@
+install_data('errcodes.txt',
+ install_dir: dir_data,
+)
+
+subdir('activity')
+subdir('adt')
+subdir('cache')
+subdir('error')
+subdir('fmgr')
+subdir('hash')
+subdir('init')
+subdir('mb')
+subdir('misc')
+subdir('mmgr')
+subdir('resowner')
+subdir('sort')
+subdir('time')
diff --git a/src/backend/utils/misc/meson.build b/src/backend/utils/misc/meson.build
new file mode 100644
index 00000000000..db4de225e18
--- /dev/null
+++ b/src/backend/utils/misc/meson.build
@@ -0,0 +1,35 @@
+backend_sources += files(
+ 'guc.c',
+ 'guc_funcs.c',
+ 'guc_tables.c',
+ 'help_config.c',
+ 'pg_config.c',
+ 'pg_controldata.c',
+ 'pg_rusage.c',
+ 'ps_status.c',
+ 'queryenvironment.c',
+ 'queryjumble.c',
+ 'rls.c',
+ 'sampling.c',
+ 'superuser.c',
+ 'timeout.c',
+ 'tzparser.c',
+)
+
+guc_scan = custom_target('guc_scan',
+ input: 'guc-file.l',
+ output: 'guc-file.c',
+ command: flex_cmd)
+generated_sources += guc_scan
+
+# so we don't need to add . as an include dir for the whole backend
+backend_link_with += static_library('guc-file',
+ guc_scan,
+ dependencies: [backend_code],
+ include_directories: include_directories('.'),
+ kwargs: internal_lib_args,
+)
+
+install_data('postgresql.conf.sample',
+ install_dir: dir_data,
+)
diff --git a/src/backend/utils/mmgr/meson.build b/src/backend/utils/mmgr/meson.build
new file mode 100644
index 00000000000..641bb181ba1
--- /dev/null
+++ b/src/backend/utils/mmgr/meson.build
@@ -0,0 +1,10 @@
+backend_sources += files(
+ 'aset.c',
+ 'dsa.c',
+ 'freepage.c',
+ 'generation.c',
+ 'mcxt.c',
+ 'memdebug.c',
+ 'portalmem.c',
+ 'slab.c',
+)
diff --git a/src/backend/utils/resowner/meson.build b/src/backend/utils/resowner/meson.build
new file mode 100644
index 00000000000..d30891ca027
--- /dev/null
+++ b/src/backend/utils/resowner/meson.build
@@ -0,0 +1,3 @@
+backend_sources += files(
+ 'resowner.c'
+)
diff --git a/src/backend/utils/sort/meson.build b/src/backend/utils/sort/meson.build
new file mode 100644
index 00000000000..1862ceae8c1
--- /dev/null
+++ b/src/backend/utils/sort/meson.build
@@ -0,0 +1,9 @@
+backend_sources += files(
+ 'logtape.c',
+ 'qsort_interruptible.c',
+ 'sharedtuplestore.c',
+ 'sortsupport.c',
+ 'tuplesort.c',
+ 'tuplesortvariants.c',
+ 'tuplestore.c',
+)
diff --git a/src/backend/utils/time/meson.build b/src/backend/utils/time/meson.build
new file mode 100644
index 00000000000..6fff8792bb0
--- /dev/null
+++ b/src/backend/utils/time/meson.build
@@ -0,0 +1,4 @@
+backend_sources += files(
+ 'combocid.c',
+ 'snapmgr.c',
+)
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
new file mode 100644
index 00000000000..b6bf8e1ca21
--- /dev/null
+++ b/src/fe_utils/meson.build
@@ -0,0 +1,29 @@
+fe_utils_sources = files(
+ 'archive.c',
+ 'cancel.c',
+ 'conditional.c',
+ 'connect_utils.c',
+ 'mbprint.c',
+ 'option_utils.c',
+ 'parallel_slot.c',
+ 'print.c',
+ 'query_utils.c',
+ 'recovery_gen.c',
+ 'simple_list.c',
+ 'string_utils.c',
+)
+
+psqlscan = custom_target('psqlscan',
+ input: 'psqlscan.l',
+ output: 'psqlscan.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'],
+)
+generated_sources += psqlscan
+fe_utils_sources += psqlscan
+
+fe_utils = static_library('libpgfeutils',
+ fe_utils_sources + generated_headers,
+ include_directories: [postgres_inc, libpq_inc],
+ dependencies: frontend_common_code,
+ kwargs: default_lib_args,
+)
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
new file mode 100644
index 00000000000..9f213274d2f
--- /dev/null
+++ b/src/bin/initdb/meson.build
@@ -0,0 +1,30 @@
+initdb_sources = files(
+ 'findtimezone.c',
+ 'initdb.c'
+)
+
+initdb_sources += timezone_localtime_source
+
+#fixme: reimplement libpq_pgport logic
+
+initdb = executable('initdb',
+ initdb_sources,
+ include_directories: [timezone_inc],
+ dependencies: [frontend_code, libpq, icu, icu_i18n],
+ kwargs: default_bin_args,
+)
+bin_targets += initdb
+
+tests += {
+ 'name': 'initdb',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_initdb.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/initdb/po/meson.build b/src/bin/initdb/po/meson.build
new file mode 100644
index 00000000000..8b8a9fd2ce1
--- /dev/null
+++ b/src/bin/initdb/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('initdb-' + pg_version_major.to_string())
diff --git a/src/bin/meson.build b/src/bin/meson.build
new file mode 100644
index 00000000000..5fd5a9d2f98
--- /dev/null
+++ b/src/bin/meson.build
@@ -0,0 +1,20 @@
+subdir('initdb')
+subdir('pg_amcheck')
+subdir('pg_archivecleanup')
+subdir('pg_basebackup')
+subdir('pg_checksums')
+subdir('pg_config')
+subdir('pg_controldata')
+subdir('pg_ctl')
+subdir('pg_dump')
+subdir('pg_resetwal')
+subdir('pg_rewind')
+subdir('pg_test_fsync')
+subdir('pg_test_timing')
+subdir('pg_upgrade')
+subdir('pg_verifybackup')
+subdir('pg_waldump')
+subdir('pgbench')
+subdir('pgevent')
+subdir('psql')
+subdir('scripts')
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
new file mode 100644
index 00000000000..8e197eba5f3
--- /dev/null
+++ b/src/bin/pg_amcheck/meson.build
@@ -0,0 +1,27 @@
+pg_amcheck_sources = files(
+ 'pg_amcheck.c'
+)
+
+pg_amcheck = executable('pg_amcheck',
+ pg_amcheck_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_amcheck
+
+tests += {
+ 'name': 'pg_amcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_nonesuch.pl',
+ 't/003_check.pl',
+ 't/004_verify_heapam.pl',
+ 't/005_opclass_damage.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_amcheck/po/meson.build b/src/bin/pg_amcheck/po/meson.build
new file mode 100644
index 00000000000..b255f552c94
--- /dev/null
+++ b/src/bin/pg_amcheck/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_amcheck-' + pg_version_major.to_string())
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
new file mode 100644
index 00000000000..87a0d980c4f
--- /dev/null
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -0,0 +1,19 @@
+pg_archivecleanup = executable('pg_archivecleanup',
+ ['pg_archivecleanup.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_archivecleanup
+
+tests += {
+ 'name': 'pg_archivecleanup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_pg_archivecleanup.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_archivecleanup/po/meson.build b/src/bin/pg_archivecleanup/po/meson.build
new file mode 100644
index 00000000000..37935fcabc4
--- /dev/null
+++ b/src/bin/pg_archivecleanup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_archivecleanup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
new file mode 100644
index 00000000000..d26fed9cd8a
--- /dev/null
+++ b/src/bin/pg_basebackup/meson.build
@@ -0,0 +1,61 @@
+common_sources = files(
+ 'bbstreamer_file.c',
+ 'bbstreamer_gzip.c',
+ 'bbstreamer_inject.c',
+ 'bbstreamer_lz4.c',
+ 'bbstreamer_tar.c',
+ 'bbstreamer_zstd.c',
+ 'receivelog.c',
+ 'streamutil.c',
+ 'walmethods.c',
+)
+
+pg_basebackup_deps = [frontend_code, libpq, lz4, zlib, zstd]
+pg_basebackup_common = static_library('libpg_basebackup_common',
+ common_sources,
+ dependencies: pg_basebackup_deps,
+ kwargs: internal_lib_args,
+)
+
+pg_basebackup = executable('pg_basebackup',
+ 'pg_basebackup.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_basebackup
+
+pg_receivewal = executable('pg_receivewal',
+ 'pg_receivewal.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_receivewal
+
+pg_recvlogical = executable('pg_recvlogical',
+ 'pg_recvlogical.c',
+ link_with: [pg_basebackup_common],
+ dependencies: pg_basebackup_deps,
+ kwargs: default_bin_args,
+)
+bin_targets += pg_recvlogical
+
+tests += {
+ 'name': 'pg_basebackup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'GZIP_PROGRAM': gzip.path(),
+ 'TAR': tar.path(),
+ 'LZ4': program_lz4.found() ? program_lz4.path() : '',
+ 'ZSTD': program_zstd.found() ? program_zstd.path() : ''},
+ 'tests': [
+ 't/010_pg_basebackup.pl',
+ 't/020_pg_receivewal.pl',
+ 't/030_pg_recvlogical.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_basebackup/po/meson.build b/src/bin/pg_basebackup/po/meson.build
new file mode 100644
index 00000000000..cab021153fe
--- /dev/null
+++ b/src/bin/pg_basebackup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_basebackup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
new file mode 100644
index 00000000000..ee1f367bac3
--- /dev/null
+++ b/src/bin/pg_checksums/meson.build
@@ -0,0 +1,21 @@
+pg_checksums = executable('pg_checksums',
+ ['pg_checksums.c'],
+ include_directories: [timezone_inc],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_checksums
+
+tests += {
+ 'name': 'pg_checksums',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_actions.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_checksums/po/meson.build b/src/bin/pg_checksums/po/meson.build
new file mode 100644
index 00000000000..2c47c2338f6
--- /dev/null
+++ b/src/bin/pg_checksums/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_checksums-' + pg_version_major.to_string())
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
new file mode 100644
index 00000000000..0ecbf2f9d28
--- /dev/null
+++ b/src/bin/pg_config/meson.build
@@ -0,0 +1,19 @@
+pg_config = executable('pg_config',
+ ['pg_config.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_config
+
+tests += {
+ 'name': 'pg_config',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pg_config.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_config/po/meson.build b/src/bin/pg_config/po/meson.build
new file mode 100644
index 00000000000..b6fb6db9213
--- /dev/null
+++ b/src/bin/pg_config/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_config-' + pg_version_major.to_string())
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
new file mode 100644
index 00000000000..557e672beb7
--- /dev/null
+++ b/src/bin/pg_controldata/meson.build
@@ -0,0 +1,19 @@
+pg_controldata = executable('pg_controldata',
+ ['pg_controldata.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_controldata
+
+tests += {
+ 'name': 'pg_controldata',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pg_controldata.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_controldata/po/meson.build b/src/bin/pg_controldata/po/meson.build
new file mode 100644
index 00000000000..31b486d002c
--- /dev/null
+++ b/src/bin/pg_controldata/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_controldata-' + pg_version_major.to_string())
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
new file mode 100644
index 00000000000..6812e73e329
--- /dev/null
+++ b/src/bin/pg_ctl/meson.build
@@ -0,0 +1,22 @@
+pg_ctl = executable('pg_ctl',
+ ['pg_ctl.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_ctl
+
+tests += {
+ 'name': 'pg_ctl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_start_stop.pl',
+ 't/002_status.pl',
+ 't/003_promote.pl',
+ 't/004_logrotate.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_ctl/po/meson.build b/src/bin/pg_ctl/po/meson.build
new file mode 100644
index 00000000000..947b5108423
--- /dev/null
+++ b/src/bin/pg_ctl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_ctl-' + pg_version_major.to_string())
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
new file mode 100644
index 00000000000..785ec094dbd
--- /dev/null
+++ b/src/bin/pg_dump/meson.build
@@ -0,0 +1,75 @@
+pg_dump_common_sources = files(
+ 'compress_io.c',
+ 'dumputils.c',
+ 'parallel.c',
+ 'pg_backup_archiver.c',
+ 'pg_backup_custom.c',
+ 'pg_backup_db.c',
+ 'pg_backup_directory.c',
+ 'pg_backup_null.c',
+ 'pg_backup_tar.c',
+ 'pg_backup_utils.c',
+)
+
+pg_dump_common = static_library('libpgdump_common',
+ pg_dump_common_sources,
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: internal_lib_args,
+)
+
+
+pg_dump_sources = files(
+ 'common.c',
+ 'pg_dump.c',
+ 'pg_dump_sort.c',
+)
+
+pg_dump = executable('pg_dump',
+ pg_dump_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_dump
+
+
+pg_dumpall_sources = files(
+ 'pg_dumpall.c',
+)
+
+pg_dumpall = executable('pg_dumpall',
+ pg_dumpall_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_dumpall
+
+
+pg_restore_sources = files(
+ 'pg_restore.c',
+)
+
+pg_restore = executable('pg_restore',
+ pg_restore_sources,
+ link_with: [pg_dump_common],
+ dependencies: [frontend_code, libpq, zlib],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_restore
+
+tests += {
+ 'name': 'pg_dump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_pg_dump.pl',
+ 't/003_pg_dump_with_server.pl',
+ 't/010_dump_connstr.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_dump/po/meson.build b/src/bin/pg_dump/po/meson.build
new file mode 100644
index 00000000000..82e5e537ff4
--- /dev/null
+++ b/src/bin/pg_dump/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_dump-' + pg_version_major.to_string())
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
new file mode 100644
index 00000000000..7c5de134ac0
--- /dev/null
+++ b/src/bin/pg_resetwal/meson.build
@@ -0,0 +1,20 @@
+pg_resetwal = executable('pg_resetwal',
+ files('pg_resetwal.c'),
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_resetwal
+
+tests += {
+ 'name': 'pg_resetwal',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_corrupted.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_resetwal/po/meson.build b/src/bin/pg_resetwal/po/meson.build
new file mode 100644
index 00000000000..d130d3b775f
--- /dev/null
+++ b/src/bin/pg_resetwal/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_resetwal-' + pg_version_major.to_string())
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
new file mode 100644
index 00000000000..d8ec9e482d5
--- /dev/null
+++ b/src/bin/pg_rewind/meson.build
@@ -0,0 +1,42 @@
+pg_rewind_sources = files(
+ 'datapagemap.c',
+ 'file_ops.c',
+ 'filemap.c',
+ 'libpq_source.c',
+ 'local_source.c',
+ 'parsexlog.c',
+ 'pg_rewind.c',
+ 'timeline.c',
+)
+
+pg_rewind_sources += xlogreader_sources
+
+pg_rewind = executable('pg_rewind',
+ pg_rewind_sources,
+ dependencies: [frontend_code, libpq, lz4, zstd],
+ c_args: ['-DFRONTEND'], # needed for xlogreader et al
+ kwargs: default_bin_args,
+)
+bin_targets += pg_rewind
+
+
+tests += {
+ 'name': 'pg_rewind',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_databases.pl',
+ 't/003_extrafiles.pl',
+ 't/004_pg_xlog_symlink.pl',
+ 't/005_same_timeline.pl',
+ 't/006_options.pl',
+ 't/007_standby_source.pl',
+ 't/008_min_recovery_point.pl',
+ 't/009_growing_files.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_rewind/po/meson.build b/src/bin/pg_rewind/po/meson.build
new file mode 100644
index 00000000000..a105600b348
--- /dev/null
+++ b/src/bin/pg_rewind/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_rewind-' + pg_version_major.to_string())
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
new file mode 100644
index 00000000000..2c01831e11f
--- /dev/null
+++ b/src/bin/pg_test_fsync/meson.build
@@ -0,0 +1,21 @@
+test_fsync_sources = files('pg_test_fsync.c')
+
+pg_test_fsync = executable('pg_test_fsync',
+ test_fsync_sources,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_test_fsync
+
+tests += {
+ 'name': 'pg_test_fsync',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_test_fsync/po/meson.build b/src/bin/pg_test_fsync/po/meson.build
new file mode 100644
index 00000000000..2ee1125282d
--- /dev/null
+++ b/src/bin/pg_test_fsync/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_test_fsync-' + pg_version_major.to_string())
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
new file mode 100644
index 00000000000..0a3068f1657
--- /dev/null
+++ b/src/bin/pg_test_timing/meson.build
@@ -0,0 +1,19 @@
+pg_test_timing = executable('pg_test_timing',
+ ['pg_test_timing.c'],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_test_timing
+
+tests += {
+ 'name': 'pg_test_timing',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_test_timing/po/meson.build b/src/bin/pg_test_timing/po/meson.build
new file mode 100644
index 00000000000..cda8615165b
--- /dev/null
+++ b/src/bin/pg_test_timing/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_test_timing-' + pg_version_major.to_string())
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
new file mode 100644
index 00000000000..02f030e0ccf
--- /dev/null
+++ b/src/bin/pg_upgrade/meson.build
@@ -0,0 +1,40 @@
+pg_upgrade_sources = files(
+ 'check.c',
+ 'controldata.c',
+ 'dump.c',
+ 'exec.c',
+ 'file.c',
+ 'function.c',
+ 'info.c',
+ 'option.c',
+ 'parallel.c',
+ 'pg_upgrade.c',
+ 'relfilenumber.c',
+ 'server.c',
+ 'tablespace.c',
+ 'util.c',
+ 'version.c',
+)
+
+pg_upgrade = executable('pg_upgrade',
+ pg_upgrade_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_upgrade
+
+
+tests += {
+ 'name': 'pg_upgrade',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_pg_upgrade.pl',
+ ],
+ 'test_kwargs': {'priority': 40}, # pg_upgrade tests are slow
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_upgrade/po/meson.build b/src/bin/pg_upgrade/po/meson.build
new file mode 100644
index 00000000000..39301cbede8
--- /dev/null
+++ b/src/bin/pg_upgrade/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_upgrade-' + pg_version_major.to_string())
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
new file mode 100644
index 00000000000..4c3b2bb5f97
--- /dev/null
+++ b/src/bin/pg_verifybackup/meson.build
@@ -0,0 +1,33 @@
+pg_verifybackup_sources = files(
+ 'parse_manifest.c',
+ 'pg_verifybackup.c'
+)
+
+pg_verifybackup = executable('pg_verifybackup',
+ pg_verifybackup_sources,
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+bin_targets += pg_verifybackup
+
+tests += {
+ 'name': 'pg_verifybackup',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ 't/002_algorithm.pl',
+ 't/003_corruption.pl',
+ 't/004_options.pl',
+ 't/005_bad_manifest.pl',
+ 't/006_encoding.pl',
+ 't/007_wal.pl',
+ 't/008_untar.pl',
+ 't/009_extract.pl',
+ 't/010_client_untar.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_verifybackup/po/meson.build b/src/bin/pg_verifybackup/po/meson.build
new file mode 100644
index 00000000000..b583f1958ba
--- /dev/null
+++ b/src/bin/pg_verifybackup/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_verifybackup-' + pg_version_major.to_string())
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
new file mode 100644
index 00000000000..95872652ffd
--- /dev/null
+++ b/src/bin/pg_waldump/meson.build
@@ -0,0 +1,30 @@
+pg_waldump_sources = files(
+ 'compat.c',
+ 'pg_waldump.c',
+ 'rmgrdesc.c',
+)
+
+pg_waldump_sources += rmgr_desc_sources
+pg_waldump_sources += xlogreader_sources
+pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+
+pg_waldump = executable('pg_waldump',
+ pg_waldump_sources,
+ dependencies: [frontend_code, lz4, zstd],
+ c_args: ['-DFRONTEND'], # needed for xlogreader et al
+ kwargs: default_bin_args,
+)
+bin_targets += pg_waldump
+
+tests += {
+ 'name': 'pg_waldump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/pg_waldump/po/meson.build b/src/bin/pg_waldump/po/meson.build
new file mode 100644
index 00000000000..f335aa4b360
--- /dev/null
+++ b/src/bin/pg_waldump/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pg_waldump-' + pg_version_major.to_string())
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
new file mode 100644
index 00000000000..6564e54029c
--- /dev/null
+++ b/src/bin/pgbench/meson.build
@@ -0,0 +1,38 @@
+pgbench_sources = files(
+ 'pgbench.c',
+)
+
+exprscan = custom_target('exprscan',
+ input: 'exprscan.l',
+ output: 'exprscan.c',
+ command: flex_cmd,
+)
+generated_sources += exprscan
+pgbench_sources += exprscan
+
+exprparse = custom_target('exprparse',
+ input: 'exprparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += exprparse.to_list()
+pgbench_sources += exprparse
+
+pgbench = executable('pgbench',
+ pgbench_sources,
+ dependencies: [frontend_code, libpq, thread_dep],
+ include_directories: include_directories('.'),
+ kwargs: default_bin_args,
+)
+bin_targets += pgbench
+
+tests += {
+ 'name': 'pgbench',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_pgbench_with_server.pl',
+ 't/002_pgbench_no_server.pl',
+ ],
+ },
+}
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
new file mode 100644
index 00000000000..5852bca4d87
--- /dev/null
+++ b/src/bin/pgevent/meson.build
@@ -0,0 +1,26 @@
+if host_system != 'windows'
+ subdir_done()
+endif
+
+pgevent_sources = files(
+ 'pgevent.c',
+)
+
+pgevent_sources += windows.compile_resources('pgmsgevent.rc')
+
+# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
+pgevent_link_args = []
+if cc.get_id() == 'msvc'
+ pgevent_link_args += '/ignore:4104'
+endif
+
+pgevent = shared_library('pgevent',
+ pgevent_sources,
+ dependencies: [frontend_code],
+ link_args: pgevent_link_args,
+ vs_module_defs: 'pgevent.def',
+ kwargs: default_lib_args + {
+ 'name_prefix': '',
+ },
+)
+bin_targets += pgevent
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
new file mode 100644
index 00000000000..ea850c8fdf5
--- /dev/null
+++ b/src/bin/psql/meson.build
@@ -0,0 +1,67 @@
+psql_sources = files(
+ 'command.c',
+ 'common.c',
+ 'copy.c',
+ 'crosstabview.c',
+ 'describe.c',
+ 'help.c',
+ 'input.c',
+ 'large_obj.c',
+ 'mainloop.c',
+ 'prompt.c',
+ 'startup.c',
+ 'stringutils.c',
+ 'tab-complete.c',
+ 'variables.c',
+)
+
+psqlscanslash = custom_target('psqlscanslash',
+ input: 'psqlscanslash.l',
+ output: 'psqlscanslash.c',
+ command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'])
+generated_sources += psqlscanslash
+psql_sources += psqlscanslash
+bin_targets += psqlscanslash
+
+sql_help = custom_target('psql_help',
+ output: ['sql_help.c', 'sql_help.h'],
+ depfile: 'sql_help.dep',
+ command: [
+ perl, files('create_help.pl'),
+ '--docdir', '@SOURCE_ROOT@/doc/src/sgml/ref',
+ '--depfile', '@DEPFILE@',
+ '--outdir', '@OUTDIR@',
+ '--basename', 'sql_help',
+ ],
+)
+generated_sources += sql_help.to_list()
+psql_sources += sql_help
+bin_targets += sql_help
+
+psql = executable('psql',
+ psql_sources,
+ include_directories: include_directories('.'),
+ dependencies: [frontend_code, libpq, readline],
+ kwargs: default_bin_args,
+)
+bin_targets += psql
+
+install_data('psqlrc.sample',
+ install_dir: dir_data,
+)
+
+tests += {
+ 'name': 'psql',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_readline': readline.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_basic.pl',
+ 't/010_tab_completion.pl',
+ 't/020_cancel.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/psql/po/meson.build b/src/bin/psql/po/meson.build
new file mode 100644
index 00000000000..45fe425298d
--- /dev/null
+++ b/src/bin/psql/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('psql-' + pg_version_major.to_string())
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
new file mode 100644
index 00000000000..eaf250c7f73
--- /dev/null
+++ b/src/bin/scripts/meson.build
@@ -0,0 +1,51 @@
+scripts_common = static_library('libscripts_common',
+ files('common.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: internal_lib_args,
+)
+
+binaries = [
+ 'createdb',
+ 'dropdb',
+ 'createuser',
+ 'dropuser',
+ 'clusterdb',
+ 'vacuumdb',
+ 'reindexdb',
+ 'pg_isready',
+]
+
+foreach binary : binaries
+ binary = executable(binary,
+ files(binary + '.c'),
+ link_with: [scripts_common],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+ )
+ bin_targets += binary
+endforeach
+
+tests += {
+ 'name': 'scripts',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_clusterdb.pl',
+ 't/011_clusterdb_all.pl',
+ 't/020_createdb.pl',
+ 't/040_createuser.pl',
+ 't/050_dropdb.pl',
+ 't/070_dropuser.pl',
+ 't/080_pg_isready.pl',
+ 't/090_reindexdb.pl',
+ 't/091_reindexdb_all.pl',
+ 't/100_vacuumdb.pl',
+ 't/101_vacuumdb_all.pl',
+ 't/102_vacuumdb_stages.pl',
+ 't/200_connstr.pl',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/bin/scripts/po/meson.build b/src/bin/scripts/po/meson.build
new file mode 100644
index 00000000000..3c531459c2d
--- /dev/null
+++ b/src/bin/scripts/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pgscripts-' + pg_version_major.to_string())
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
new file mode 100644
index 00000000000..bc047e00d62
--- /dev/null
+++ b/src/interfaces/libpq/meson.build
@@ -0,0 +1,108 @@
+# test/ is entered via top-level meson.build, that way it can use the default
+# args for executables (which depend on libpq).
+
+libpq_sources = files(
+ 'fe-auth-scram.c',
+ 'fe-auth.c',
+ 'fe-connect.c',
+ 'fe-exec.c',
+ 'fe-lobj.c',
+ 'fe-misc.c',
+ 'fe-print.c',
+ 'fe-protocol3.c',
+ 'fe-secure.c',
+ 'fe-trace.c',
+ 'legacy-pqsignal.c',
+ 'libpq-events.c',
+ 'pqexpbuffer.c',
+)
+
+if host_system == 'windows'
+ libpq_sources += files('pthread-win32.c', 'win32.c')
+endif
+
+if ssl.found()
+ libpq_sources += files('fe-secure-common.c')
+ libpq_sources += files('fe-secure-openssl.c')
+endif
+
+if gssapi.found()
+ libpq_sources += files(
+ 'fe-gssapi-common.c',
+ 'fe-secure-gssapi.c',
+ )
+endif
+
+export_file = custom_target('libpq.exports',
+ kwargs: gen_export_kwargs,
+)
+
+# port needs to be in include path due to pthread-win32.h
+libpq_inc = include_directories('.', '../../port')
+
+libpq_st = static_library('libpq',
+ libpq_sources,
+ pic: true,
+ include_directories: [libpq_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=5'],
+ dependencies: libpq_deps,
+ kwargs: default_lib_args,
+)
+
+# not using both_libraries here, causes problems with precompiled headers and
+# resource files with msbuild
+libpq_so = shared_library('libpq',
+ dependencies: libpq_deps,
+ include_directories: [libpq_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=5'],
+ link_whole: libpq_st,
+ version: '5.' + pg_version_major.to_string(),
+ soversion: host_system != 'windows' ? '5' : '',
+ darwin_versions: ['5', '5.' + pg_version_major.to_string()],
+ link_depends: export_file,
+ link_args: export_fmt.format(export_file.full_path()),
+ kwargs: default_lib_args,
+)
+
+libpq = declare_dependency(
+ link_with: [libpq_so],
+ include_directories: [include_directories('.')]
+)
+
+pkgconfig.generate(
+ libpq_so,
+ name: 'libpq',
+ description: 'PostgreSQL libpq library',
+ url: pg_url,
+)
+
+install_headers(
+ 'libpq-fe.h',
+ 'libpq-events.h',
+)
+
+install_headers(
+ 'libpq-int.h',
+ 'pqexpbuffer.h',
+ 'fe-auth-sasl.h',
+ install_dir: dir_include_internal,
+)
+install_data('pg_service.conf.sample',
+ install_dir: dir_data,
+)
+
+
+tests += {
+ 'name': 'libpq',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_uri.pl',
+ 't/002_api.pl',
+ ],
+ 'env': {'with_ssl': get_option('ssl')},
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/interfaces/libpq/po/meson.build b/src/interfaces/libpq/po/meson.build
new file mode 100644
index 00000000000..eed91110fd6
--- /dev/null
+++ b/src/interfaces/libpq/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('libpq' + '5' + '-' + pg_version_major.to_string())
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
new file mode 100644
index 00000000000..16f94c1ed8b
--- /dev/null
+++ b/src/interfaces/libpq/test/meson.build
@@ -0,0 +1,15 @@
+executable('libpq_uri_regress',
+ files('libpq_uri_regress.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install': false,
+ }
+)
+
+executable('libpq_testclient',
+ files('libpq_testclient.c'),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install': false,
+ }
+)
diff --git a/src/pl/meson.build b/src/pl/meson.build
new file mode 100644
index 00000000000..d9a57465441
--- /dev/null
+++ b/src/pl/meson.build
@@ -0,0 +1,5 @@
+subdir('plpgsql')
+
+subdir('plperl')
+subdir('plpython')
+subdir('tcl')
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
new file mode 100644
index 00000000000..73b733dd50b
--- /dev/null
+++ b/src/pl/plperl/meson.build
@@ -0,0 +1,90 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+plperl_sources = files(
+ 'plperl.c',
+)
+
+subppdir = run_command(perl, '-e', 'use List::Util qw(first); print first { -r "$_/ExtUtils/xsubpp" } @INC',
+ check: true).stdout()
+xsubpp = '@0@/ExtUtils/xsubpp'.format(subppdir)
+typemap = '@0@/ExtUtils/typemap'.format(privlibexp)
+
+plperl_sources += custom_target('perlchunks.h',
+ input: files('plc_perlboot.pl', 'plc_trusted.pl'),
+ output: 'perlchunks.h',
+ capture: true,
+ command: [perl, files('text2macro.pl'), '--strip=^(\#.*|\s*)$', '@INPUT@']
+)
+
+plperl_sources += custom_target('plperl_opmask.h',
+ input: files('plperl_opmask.pl'),
+ output: 'plperl_opmask.h',
+ command: [perl, '@INPUT@', '@OUTPUT@']
+)
+
+foreach n : ['SPI', 'Util']
+ xs = files(n + '.xs')
+ xs_c_name = n + '.c'
+ xs_c = custom_target(xs_c_name,
+ input: xs,
+ output: xs_c_name,
+ command: [perl, xsubpp, '-typemap', typemap, '-output', '@OUTPUT@', '@INPUT@']
+ )
+ plperl_sources += xs_c
+endforeach
+
+plperl_inc = include_directories('.')
+plperl = shared_module('plperl',
+ plperl_sources,
+ include_directories: [plperl_inc, postgres_inc],
+ kwargs: pg_mod_args + {
+ 'dependencies': [perl_dep, pg_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+pl_targets += plperl
+
+install_data(
+ 'plperl.control',
+ 'plperl--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+install_data(
+ 'plperlu.control',
+ 'plperlu--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+install_headers(
+ 'plperl.h',
+ 'ppport.h',
+ install_dir: dir_include_server,
+)
+
+tests += {
+ 'name': 'plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'plperl_setup',
+ 'plperl',
+ 'plperl_lc',
+ 'plperl_trigger',
+ 'plperl_shared',
+ 'plperl_elog',
+ 'plperl_util',
+ 'plperl_init',
+ 'plperlu',
+ 'plperl_array',
+ 'plperl_call',
+ 'plperl_transaction',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/plperl/po/meson.build b/src/pl/plperl/po/meson.build
new file mode 100644
index 00000000000..fe0a715bdf0
--- /dev/null
+++ b/src/pl/plperl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('plperl-' + pg_version_major.to_string())
diff --git a/src/pl/plpgsql/meson.build b/src/pl/plpgsql/meson.build
new file mode 100644
index 00000000000..9537275d67c
--- /dev/null
+++ b/src/pl/plpgsql/meson.build
@@ -0,0 +1 @@
+subdir('src')
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
new file mode 100644
index 00000000000..dd499fdd151
--- /dev/null
+++ b/src/pl/plpgsql/src/meson.build
@@ -0,0 +1,84 @@
+plpgsql_sources = files(
+ 'pl_comp.c',
+ 'pl_exec.c',
+ 'pl_funcs.c',
+ 'pl_handler.c',
+ 'pl_scanner.c',
+)
+
+pl_gram = custom_target('gram',
+ input: 'pl_gram.y',
+ kwargs: bison_kw,
+)
+generated_sources += pl_gram.to_list()
+plpgsql_sources += pl_gram
+
+gen_plerrcodes = files('generate-plerrcodes.pl')
+pl_errcodes = custom_target('plerrcodes',
+ input: ['../../../../src/backend/utils/errcodes.txt'],
+ output: ['plerrcodes.h'],
+ command: [perl, gen_plerrcodes, '@INPUT0@'],
+ capture: true,
+)
+generated_sources += pl_errcodes
+plpgsql_sources += pl_errcodes
+
+gen_keywordlist = files('../../../../src/tools/gen_keywordlist.pl')
+pl_reserved = custom_target('pl_reserved_kwlist',
+ input: ['pl_reserved_kwlist.h'],
+ output: ['pl_reserved_kwlist_d.h'],
+ command: [perl, '-I', '@SOURCE_ROOT@/src/tools', gen_keywordlist, '--output', '@OUTDIR@', '--varname', 'ReservedPLKeywords', '@INPUT@']
+)
+generated_sources += pl_reserved
+plpgsql_sources += pl_reserved
+
+pl_unreserved = custom_target('pl_unreserved_kwlist',
+ input: ['pl_unreserved_kwlist.h'],
+ output: ['pl_unreserved_kwlist_d.h'],
+ command: [perl, '-I', '@SOURCE_ROOT@/src/tools', gen_keywordlist, '--output', '@OUTDIR@', '--varname', 'UnreservedPLKeywords', '@INPUT@']
+)
+generated_sources += pl_unreserved
+plpgsql_sources += pl_unreserved
+
+plpgsql = shared_module('plpgsql',
+ plpgsql_sources,
+ include_directories: include_directories('.'),
+ kwargs: pg_mod_args,
+)
+pl_targets += plpgsql
+
+install_data(
+ 'plpgsql.control',
+ 'plpgsql--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+install_headers(
+ 'plpgsql.h',
+ install_dir: dir_include_server
+)
+
+
+tests += {
+ 'name': 'plpgsql',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'plpgsql_array',
+ 'plpgsql_call',
+ 'plpgsql_control',
+ 'plpgsql_copy',
+ 'plpgsql_domain',
+ 'plpgsql_record',
+ 'plpgsql_cache',
+ 'plpgsql_simple',
+ 'plpgsql_transaction',
+ 'plpgsql_trap',
+ 'plpgsql_trigger',
+ 'plpgsql_varprops',
+ ],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/plpgsql/src/po/meson.build b/src/pl/plpgsql/src/po/meson.build
new file mode 100644
index 00000000000..29e0b74488f
--- /dev/null
+++ b/src/pl/plpgsql/src/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('plpgsql-' + pg_version_major.to_string())
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
new file mode 100644
index 00000000000..366b3b171ac
--- /dev/null
+++ b/src/pl/plpython/meson.build
@@ -0,0 +1,99 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+plpython_sources = files(
+ 'plpy_cursorobject.c',
+ 'plpy_elog.c',
+ 'plpy_exec.c',
+ 'plpy_main.c',
+ 'plpy_planobject.c',
+ 'plpy_plpymodule.c',
+ 'plpy_procedure.c',
+ 'plpy_resultobject.c',
+ 'plpy_spi.c',
+ 'plpy_subxactobject.c',
+ 'plpy_typeio.c',
+ 'plpy_util.c',
+)
+
+plpython_sources += custom_target('spiexceptions.h',
+ input: files('../../backend/utils/errcodes.txt'),
+ output: 'spiexceptions.h',
+ command: [perl, files('generate-spiexceptions.pl'), '@INPUT@'],
+ capture: true,
+)
+
+
+# FIXME: need to duplicate import library ugliness?
+plpython_inc = include_directories('.')
+
+plpython = shared_module('plpython3',
+ plpython_sources,
+ include_directories: [plpython_inc, postgres_inc],
+ kwargs: pg_mod_args + {
+ 'dependencies': [python3_dep, pg_mod_args['dependencies']],
+ },
+)
+pl_targets += plpython
+
+# FIXME: Only install the relevant versions
+install_data(
+ 'plpython3u.control',
+ 'plpython3u--1.0.sql',
+ 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',
+ 'plpython_test',
+ 'plpython_do',
+ 'plpython_global',
+ 'plpython_import',
+ 'plpython_spi',
+ 'plpython_newline',
+ 'plpython_void',
+ 'plpython_call',
+ 'plpython_params',
+ 'plpython_setof',
+ 'plpython_record',
+ 'plpython_trigger',
+ 'plpython_types',
+ 'plpython_error',
+ 'plpython_ereport',
+ 'plpython_unicode',
+ 'plpython_quote',
+ 'plpython_composite',
+ 'plpython_subtransaction',
+ 'plpython_transaction',
+ 'plpython_drop',
+]
+
+tests += {
+ 'name': 'plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': plpython_regress,
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/plpython/po/meson.build b/src/pl/plpython/po/meson.build
new file mode 100644
index 00000000000..542e27fbe1f
--- /dev/null
+++ b/src/pl/plpython/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('plpython-' + pg_version_major.to_string())
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
new file mode 100644
index 00000000000..9b6addd7fd5
--- /dev/null
+++ b/src/pl/tcl/meson.build
@@ -0,0 +1,55 @@
+if not tcl_dep.found()
+ subdir_done()
+endif
+
+pltcl_sources = files(
+ 'pltcl.c',
+)
+
+gen_pltclerrcodes = files('generate-pltclerrcodes.pl')
+pltcl_sources += custom_target('pltclerrcodes.h',
+ input: files('../../backend/utils/errcodes.txt'),
+ output: 'pltclerrcodes.h',
+ capture: true,
+ command: [perl, gen_pltclerrcodes, '@INPUT@']
+)
+
+pltcl = shared_module('pltcl',
+ pltcl_sources,
+ include_directories: [include_directories('.'), postgres_inc],
+ kwargs: pg_mod_args + {
+ 'dependencies': [tcl_dep, pg_mod_args['dependencies']],
+ },
+)
+pl_targets += pltcl
+
+install_data(
+ 'pltcl.control',
+ 'pltcl--1.0.sql',
+ 'pltclu.control',
+ 'pltclu--1.0.sql',
+ install_dir: dir_data_extension,
+)
+
+pltcl_regress = [
+ 'pltcl_setup',
+ 'pltcl_queries',
+ 'pltcl_trigger',
+ 'pltcl_call',
+ 'pltcl_start_proc',
+ 'pltcl_subxact',
+ 'pltcl_unicode',
+ 'pltcl_transaction',
+]
+
+tests += {
+ 'name': 'pltcl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': pltcl_regress,
+ 'regress_args': ['--load-extension=pltcl'],
+ },
+}
+
+subdir('po', if_found: libintl)
diff --git a/src/pl/tcl/po/meson.build b/src/pl/tcl/po/meson.build
new file mode 100644
index 00000000000..cc23ef1eb3b
--- /dev/null
+++ b/src/pl/tcl/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('pltcl-' + pg_version_major.to_string())
diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build
new file mode 100644
index 00000000000..fc2368d02cf
--- /dev/null
+++ b/contrib/adminpack/meson.build
@@ -0,0 +1,23 @@
+adminpack = shared_module('adminpack',
+ ['adminpack.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += adminpack
+
+install_data(
+ 'adminpack.control',
+ 'adminpack--1.0.sql',
+ 'adminpack--1.0--1.1.sql',
+ 'adminpack--1.1--2.0.sql',
+ 'adminpack--2.0--2.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'adminpack',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': ['adminpack'],
+ },
+}
diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build
new file mode 100644
index 00000000000..1db3d20349e
--- /dev/null
+++ b/contrib/amcheck/meson.build
@@ -0,0 +1,37 @@
+amcheck = shared_module('amcheck', [
+ 'verify_heapam.c',
+ 'verify_nbtree.c',
+ ],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += amcheck
+
+install_data(
+ 'amcheck.control',
+ 'amcheck--1.0.sql',
+ 'amcheck--1.0--1.1.sql',
+ 'amcheck--1.1--1.2.sql',
+ 'amcheck--1.2--1.3.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'amcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'check',
+ 'check_btree',
+ 'check_heap',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_verify_heapam.pl',
+ 't/002_cic.pl',
+ 't/003_cic_2pc.pl',
+ ],
+ },
+}
+
diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build
new file mode 100644
index 00000000000..d2e01968f54
--- /dev/null
+++ b/contrib/auth_delay/meson.build
@@ -0,0 +1,5 @@
+autoinc = shared_module('auth_delay',
+ ['auth_delay.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += autoinc
diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build
new file mode 100644
index 00000000000..249a8376faa
--- /dev/null
+++ b/contrib/auto_explain/meson.build
@@ -0,0 +1,16 @@
+auto_explain = shared_module('auto_explain',
+ files('auto_explain.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += auto_explain
+
+tests += {
+ 'name': 'auto_explain',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_auto_explain.pl',
+ ],
+ },
+}
diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build
new file mode 100644
index 00000000000..9f0517f1701
--- /dev/null
+++ b/contrib/basebackup_to_shell/meson.build
@@ -0,0 +1,22 @@
+basebackup_to_shell_sources = files(
+ 'basebackup_to_shell.c',
+)
+
+basebackup_to_shell = shared_module('basebackup_to_shell',
+ basebackup_to_shell_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += basebackup_to_shell
+
+tests += {
+ 'name': 'basebackup_to_shell',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ 'env': {'GZIP_PROGRAM': gzip.path(),
+ 'TAR': tar.path()},
+ },
+}
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
new file mode 100644
index 00000000000..b67cbef60bd
--- /dev/null
+++ b/contrib/basic_archive/meson.build
@@ -0,0 +1,23 @@
+basic_archive_sources = files(
+ 'basic_archive.c',
+)
+
+basic_archive = shared_module('basic_archive',
+ basic_archive_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += basic_archive
+
+tests += {
+ 'name': 'basic_archive',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'basic_archive',
+ ],
+ 'regress_args': [
+ '--temp-config', files('basic_archive.conf'),
+ ],
+ },
+}
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
new file mode 100644
index 00000000000..1fe7632bdbe
--- /dev/null
+++ b/contrib/bloom/meson.build
@@ -0,0 +1,36 @@
+bloom_sources = files(
+ 'blcost.c',
+ 'blinsert.c',
+ 'blscan.c',
+ 'blutils.c',
+ 'blvacuum.c',
+ 'blvalidate.c',
+)
+
+bloom = shared_module('bloom',
+ bloom_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += bloom
+
+install_data(
+ 'bloom.control',
+ 'bloom--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'bloom',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'bloom',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_wal.pl',
+ ],
+ },
+}
diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build
new file mode 100644
index 00000000000..c20b667d75f
--- /dev/null
+++ b/contrib/bool_plperl/meson.build
@@ -0,0 +1,42 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+bool_plperl_sources = files(
+ 'bool_plperl.c',
+)
+
+bool_plperl = shared_module('bool_plperl',
+ bool_plperl_sources,
+ include_directories: [plperl_inc, include_directories('.')],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [perl_dep, contrib_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+contrib_targets += bool_plperl
+
+install_data(
+ 'bool_plperl.control',
+ 'bool_plperl--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'bool_plperlu.control',
+ 'bool_plperlu--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'bool_plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'bool_plperl',
+ 'bool_plperlu',
+ ],
+ },
+}
diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build
new file mode 100644
index 00000000000..15d6d31a6ee
--- /dev/null
+++ b/contrib/btree_gin/meson.build
@@ -0,0 +1,54 @@
+btree_gin = shared_module('btree_gin',
+ files('btree_gin.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += btree_gin
+
+install_data(
+ 'btree_gin.control',
+ 'btree_gin--1.0.sql',
+ 'btree_gin--1.0--1.1.sql',
+ 'btree_gin--1.1--1.2.sql',
+ 'btree_gin--1.2--1.3.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'btree_gin',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'install_btree_gin',
+ 'int2',
+ 'int4',
+ 'int8',
+ 'float4',
+ 'float8',
+ 'money',
+ 'oid',
+ 'timestamp',
+ 'timestamptz',
+ 'time',
+ 'timetz',
+ 'date',
+ 'interval',
+ 'macaddr',
+ 'macaddr8',
+ 'inet',
+ 'cidr',
+ 'text',
+ 'varchar',
+ 'char',
+ 'bytea',
+ 'bit',
+ 'varbit',
+ 'numeric',
+ 'enum',
+ 'uuid',
+ 'name',
+ 'bool',
+ 'bpchar',
+ ],
+ },
+}
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
new file mode 100644
index 00000000000..c0a8d238540
--- /dev/null
+++ b/contrib/btree_gist/meson.build
@@ -0,0 +1,84 @@
+btree_gist_sources = files(
+ 'btree_bit.c',
+ 'btree_bool.c',
+ 'btree_bytea.c',
+ 'btree_cash.c',
+ 'btree_date.c',
+ 'btree_enum.c',
+ 'btree_float4.c',
+ 'btree_float8.c',
+ 'btree_gist.c',
+ 'btree_inet.c',
+ 'btree_int2.c',
+ 'btree_int4.c',
+ 'btree_int8.c',
+ 'btree_interval.c',
+ 'btree_macaddr.c',
+ 'btree_macaddr8.c',
+ 'btree_numeric.c',
+ 'btree_oid.c',
+ 'btree_text.c',
+ 'btree_time.c',
+ 'btree_ts.c',
+ 'btree_utils_num.c',
+ 'btree_utils_var.c',
+ 'btree_uuid.c',
+)
+
+btree_gist = shared_module('btree_gist',
+ btree_gist_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += btree_gist
+
+install_data(
+ 'btree_gist.control',
+ 'btree_gist--1.0--1.1.sql',
+ 'btree_gist--1.1--1.2.sql',
+ 'btree_gist--1.2.sql',
+ 'btree_gist--1.2--1.3.sql',
+ 'btree_gist--1.3--1.4.sql',
+ 'btree_gist--1.4--1.5.sql',
+ 'btree_gist--1.5--1.6.sql',
+ 'btree_gist--1.6--1.7.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'btree_gist',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'init',
+ 'int2',
+ 'int4',
+ 'int8',
+ 'float4',
+ 'float8',
+ 'cash',
+ 'oid',
+ 'timestamp',
+ 'timestamptz',
+ 'time',
+ 'timetz',
+ 'date',
+ 'interval',
+ 'macaddr',
+ 'macaddr8',
+ 'inet',
+ 'cidr',
+ 'text',
+ 'varchar',
+ 'char',
+ 'bytea',
+ 'bit',
+ 'varbit',
+ 'numeric',
+ 'uuid',
+ 'not_equal',
+ 'enum',
+ 'bool',
+ ],
+ },
+}
diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build
new file mode 100644
index 00000000000..ca60eded80b
--- /dev/null
+++ b/contrib/citext/meson.build
@@ -0,0 +1,34 @@
+citext_sources = files(
+ 'citext.c',
+)
+
+citext = shared_module('citext',
+ citext_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += citext
+
+install_data(
+ 'citext.control',
+ 'citext--1.0--1.1.sql',
+ 'citext--1.1--1.2.sql',
+ 'citext--1.2--1.3.sql',
+ 'citext--1.3--1.4.sql',
+ 'citext--1.4.sql',
+ 'citext--1.4--1.5.sql',
+ 'citext--1.5--1.6.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'citext',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'create_index_acl',
+ 'citext',
+ 'citext_utf8',
+ ],
+ },
+}
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
new file mode 100644
index 00000000000..72342b0c82c
--- /dev/null
+++ b/contrib/cube/meson.build
@@ -0,0 +1,53 @@
+cube_sources = files(
+ 'cube.c',
+)
+
+cube_scan = custom_target('cubescan',
+ input: 'cubescan.l',
+ output: 'cubescan.c',
+ command: flex_cmd,
+)
+generated_sources += cube_scan
+cube_sources += cube_scan
+
+cube_parse = custom_target('cubeparse',
+ input: 'cubeparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += cube_parse.to_list()
+cube_sources += cube_parse
+
+cube = shared_module('cube',
+ cube_sources,
+ include_directories: include_directories('.'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += cube
+
+install_data(
+ 'cube.control',
+ 'cube--1.0--1.1.sql',
+ 'cube--1.1--1.2.sql',
+ 'cube--1.2.sql',
+ 'cube--1.2--1.3.sql',
+ 'cube--1.3--1.4.sql',
+ 'cube--1.4--1.5.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'cubedata.h',
+ install_dir: dir_include_extension / 'cube',
+)
+
+tests += {
+ 'name': 'cube',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'cube',
+ 'cube_sci',
+ ],
+ },
+}
diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
new file mode 100644
index 00000000000..d35f7b5d49e
--- /dev/null
+++ b/contrib/dblink/meson.build
@@ -0,0 +1,31 @@
+dblink_sources = files(
+ 'dblink.c',
+)
+
+dblink = shared_module('dblink',
+ dblink_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'] + [libpq],
+ },
+)
+contrib_targets += dblink
+
+install_data(
+ 'dblink.control',
+ 'dblink--1.0--1.1.sql',
+ 'dblink--1.1--1.2.sql',
+ 'dblink--1.2.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dblink',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dblink',
+ ],
+ 'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
+ },
+}
diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build
new file mode 100644
index 00000000000..f00e8085619
--- /dev/null
+++ b/contrib/dict_int/meson.build
@@ -0,0 +1,22 @@
+dict_int = shared_module('dict_int',
+ files('dict_int.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += dict_int
+
+install_data(
+ 'dict_int.control',
+ 'dict_int--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dict_int',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dict_int',
+ ],
+ },
+}
diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build
new file mode 100644
index 00000000000..be53f55bb79
--- /dev/null
+++ b/contrib/dict_xsyn/meson.build
@@ -0,0 +1,29 @@
+dict_xsyn = shared_module('dict_xsyn',
+ files('dict_xsyn.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += dict_xsyn
+
+install_data(
+ 'dict_xsyn.control',
+ 'dict_xsyn--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'xsyn_sample.rules',
+ kwargs: contrib_data_args + {
+ 'install_dir': dir_data / 'tsearch_data'
+ }
+)
+
+tests += {
+ 'name': 'dict_xsyn',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dict_xsyn',
+ ],
+ },
+}
diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build
new file mode 100644
index 00000000000..807f5cb7de3
--- /dev/null
+++ b/contrib/earthdistance/meson.build
@@ -0,0 +1,23 @@
+earthdistance = shared_module('earthdistance',
+ files('earthdistance.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += earthdistance
+
+install_data(
+ 'earthdistance.control',
+ 'earthdistance--1.0--1.1.sql',
+ 'earthdistance--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'earthdistance',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'earthdistance',
+ ],
+ },
+}
diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build
new file mode 100644
index 00000000000..f13efb6e38e
--- /dev/null
+++ b/contrib/file_fdw/meson.build
@@ -0,0 +1,22 @@
+file_fdw = shared_module('file_fdw',
+ files('file_fdw.c'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += file_fdw
+
+install_data(
+ 'file_fdw.control',
+ 'file_fdw--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'file_fdw',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'file_fdw',
+ ],
+ },
+}
diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build
new file mode 100644
index 00000000000..ec278a6211e
--- /dev/null
+++ b/contrib/fuzzystrmatch/meson.build
@@ -0,0 +1,26 @@
+fuzzystrmatch = shared_module('fuzzystrmatch',
+ files(
+ 'fuzzystrmatch.c',
+ 'dmetaphone.c'
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += fuzzystrmatch
+
+install_data(
+ 'fuzzystrmatch.control',
+ 'fuzzystrmatch--1.0--1.1.sql',
+ 'fuzzystrmatch--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'fuzzystrmatch',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'fuzzystrmatch',
+ ],
+ },
+}
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
new file mode 100644
index 00000000000..07c59f40a97
--- /dev/null
+++ b/contrib/hstore/meson.build
@@ -0,0 +1,44 @@
+# .. so that includes of hstore/hstore.h work
+hstore_inc = include_directories('.', '../')
+
+hstore = shared_module('hstore',
+ files(
+ 'hstore_compat.c',
+ 'hstore_gin.c',
+ 'hstore_gist.c',
+ 'hstore_io.c',
+ 'hstore_op.c',
+ 'hstore_subs.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += hstore
+
+install_data(
+ 'hstore.control',
+ 'hstore--1.1--1.2.sql',
+ 'hstore--1.2--1.3.sql',
+ 'hstore--1.3--1.4.sql',
+ 'hstore--1.4.sql',
+ 'hstore--1.4--1.5.sql',
+ 'hstore--1.5--1.6.sql',
+ 'hstore--1.6--1.7.sql',
+ 'hstore--1.7--1.8.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'hstore.h',
+ install_dir: dir_include_extension / 'hstore',
+)
+
+tests += {
+ 'name': 'hstore',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'hstore',
+ ],
+ },
+}
diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build
new file mode 100644
index 00000000000..bbafa0221bd
--- /dev/null
+++ b/contrib/hstore_plperl/meson.build
@@ -0,0 +1,43 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+hstore_plperl_sources = files(
+ 'hstore_plperl.c',
+)
+
+hstore_plperl = shared_module('hstore_plperl',
+ hstore_plperl_sources,
+ include_directories: [plperl_inc, hstore_inc],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [perl_dep, contrib_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+contrib_targets += hstore_plperl
+
+install_data(
+ 'hstore_plperl.control',
+ 'hstore_plperl--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'hstore_plperlu.control',
+ 'hstore_plperlu--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'hstore_plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'hstore_plperl',
+ 'hstore_plperlu',
+ 'create_transform',
+ ],
+ },
+}
diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build
new file mode 100644
index 00000000000..214b48519a9
--- /dev/null
+++ b/contrib/hstore_plpython/meson.build
@@ -0,0 +1,37 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+hstore_plpython_sources = files(
+ 'hstore_plpython.c',
+)
+
+hstore_plpython = shared_module('hstore_plpython3',
+ hstore_plpython_sources,
+ include_directories: [plpython_inc, hstore_inc, ],
+ c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [python3_dep, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += hstore_plpython
+
+install_data(
+ 'hstore_plpython3u--1.0.sql',
+ 'hstore_plpython3u.control',
+ kwargs: contrib_data_args,
+)
+
+hstore_plpython_regress = [
+ 'hstore_plpython'
+]
+
+tests += {
+ 'name': 'hstore_plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': hstore_plpython_regress,
+ 'regress_args': ['--load-extension=hstore'],
+ },
+}
diff --git a/contrib/intagg/meson.build b/contrib/intagg/meson.build
new file mode 100644
index 00000000000..a0f39366f47
--- /dev/null
+++ b/contrib/intagg/meson.build
@@ -0,0 +1,6 @@
+install_data(
+ 'intagg.control',
+ 'intagg--1.0--1.1.sql',
+ 'intagg--1.1.sql',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build
new file mode 100644
index 00000000000..1655bcbb3fd
--- /dev/null
+++ b/contrib/intarray/meson.build
@@ -0,0 +1,37 @@
+intarray_sources = files(
+ '_int_bool.c',
+ '_int_gin.c',
+ '_int_gist.c',
+ '_int_op.c',
+ '_int_selfuncs.c',
+ '_int_tool.c',
+ '_intbig_gist.c',
+)
+
+intarray = shared_module('_int',
+ intarray_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += intarray
+
+install_data(
+ 'intarray.control',
+ 'intarray--1.0--1.1.sql',
+ 'intarray--1.1--1.2.sql',
+ 'intarray--1.2.sql',
+ 'intarray--1.2--1.3.sql',
+ 'intarray--1.3--1.4.sql',
+ 'intarray--1.4--1.5.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'intarray',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ '_int',
+ ],
+ },
+}
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
new file mode 100644
index 00000000000..cc30bbeb55c
--- /dev/null
+++ b/contrib/isn/meson.build
@@ -0,0 +1,33 @@
+isn_sources = files(
+ 'isn.c',
+)
+
+isn = shared_module('isn',
+ isn_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += isn
+
+install_data(
+ 'isn.control',
+ 'isn--1.0--1.1.sql',
+ 'isn--1.1--1.2.sql',
+ 'isn--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'isn.h',
+ install_dir: dir_include_extension / 'isn',
+)
+
+tests += {
+ 'name': 'isn',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'isn',
+ ],
+ },
+}
diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build
new file mode 100644
index 00000000000..5c915d8ed94
--- /dev/null
+++ b/contrib/jsonb_plperl/meson.build
@@ -0,0 +1,43 @@
+if not perl_dep.found()
+ subdir_done()
+endif
+
+jsonb_plperl_sources = files(
+ 'jsonb_plperl.c',
+)
+
+jsonb_plperl = shared_module('jsonb_plperl',
+ jsonb_plperl_sources,
+ include_directories: [plperl_inc],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [perl_dep, contrib_mod_args['dependencies']],
+ 'install_rpath': ':'.join(mod_install_rpaths + ['@0@/CORE'.format(archlibexp)]),
+ 'build_rpath': '@0@/CORE'.format(archlibexp),
+ },
+)
+contrib_targets += jsonb_plperl
+
+install_data(
+ 'jsonb_plperl.control',
+ 'jsonb_plperl--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'jsonb_plperlu.control',
+ 'jsonb_plperlu--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+
+tests += {
+ 'name': 'jsonb_plperl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'jsonb_plperl',
+ 'jsonb_plperlu',
+ ],
+ },
+}
diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build
new file mode 100644
index 00000000000..de8e1105c6a
--- /dev/null
+++ b/contrib/jsonb_plpython/meson.build
@@ -0,0 +1,36 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+jsonb_plpython_sources = files(
+ 'jsonb_plpython.c',
+)
+
+jsonb_plpython = shared_module('jsonb_plpython3',
+ jsonb_plpython_sources,
+ include_directories: [plpython_inc],
+ c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [python3_dep, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += jsonb_plpython
+
+install_data(
+ 'jsonb_plpython3u.control',
+ 'jsonb_plpython3u--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+jsonb_plpython_regress = [
+ 'jsonb_plpython'
+]
+
+tests += {
+ 'name': 'jsonb_plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': jsonb_plpython_regress,
+ },
+}
diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build
new file mode 100644
index 00000000000..9082d5713c7
--- /dev/null
+++ b/contrib/lo/meson.build
@@ -0,0 +1,27 @@
+lo_sources = files(
+ 'lo.c',
+)
+
+lo = shared_module('lo',
+ lo_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += lo
+
+install_data(
+ 'lo.control',
+ 'lo--1.0--1.1.sql',
+ 'lo--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'lo',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'lo',
+ ],
+ },
+}
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
new file mode 100644
index 00000000000..9463fc2c5e5
--- /dev/null
+++ b/contrib/ltree/meson.build
@@ -0,0 +1,44 @@
+ltree_sources = files(
+ '_ltree_gist.c',
+ '_ltree_op.c',
+ 'crc32.c',
+ 'lquery_op.c',
+ 'ltree_gist.c',
+ 'ltree_io.c',
+ 'ltree_op.c',
+ 'ltxtquery_io.c',
+ 'ltxtquery_op.c',
+)
+
+# .. so that includes of ltree/ltree.h work
+ltree_inc = include_directories('.', '../')
+
+ltree = shared_module('ltree',
+ ltree_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += ltree
+
+install_data(
+ 'ltree.control',
+ 'ltree--1.0--1.1.sql',
+ 'ltree--1.1--1.2.sql',
+ 'ltree--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'ltree.h',
+ install_dir: dir_include_extension / 'ltree',
+)
+
+tests += {
+ 'name': 'ltree',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'ltree',
+ ],
+ },
+}
diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build
new file mode 100644
index 00000000000..429d75006aa
--- /dev/null
+++ b/contrib/ltree_plpython/meson.build
@@ -0,0 +1,37 @@
+if not python3_dep.found()
+ subdir_done()
+endif
+
+ltree_plpython_sources = files(
+ 'ltree_plpython.c',
+)
+
+ltree_plpython = shared_module('ltree_plpython3',
+ ltree_plpython_sources,
+ include_directories: [plpython_inc, ltree_inc],
+ c_args: ['-DPLPYTHON_LIBNAME="plpython3"'],
+ kwargs: contrib_mod_args + {
+ 'dependencies': [python3_dep, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += ltree_plpython
+
+install_data(
+ 'ltree_plpython3u--1.0.sql',
+ 'ltree_plpython3u.control',
+ kwargs: contrib_data_args,
+)
+
+ltree_plpython_regress = [
+ 'ltree_plpython'
+]
+
+tests += {
+ 'name': 'ltree_plpython',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': ltree_plpython_regress,
+ 'regress_args': ['--load-extension=ltree'],
+ },
+}
diff --git a/contrib/meson.build b/contrib/meson.build
new file mode 100644
index 00000000000..84752d4bd0f
--- /dev/null
+++ b/contrib/meson.build
@@ -0,0 +1,66 @@
+contrib_mod_args = pg_mod_args
+
+contrib_data_dir = dir_data_extension
+contrib_data_args = {
+ 'install_dir': contrib_data_dir,
+}
+
+subdir('adminpack')
+subdir('amcheck')
+subdir('auth_delay')
+subdir('auto_explain')
+subdir('basic_archive')
+subdir('bloom')
+subdir('basebackup_to_shell')
+subdir('bool_plperl')
+subdir('btree_gin')
+subdir('btree_gist')
+subdir('citext')
+subdir('cube')
+subdir('dblink')
+subdir('dict_int')
+subdir('dict_xsyn')
+subdir('earthdistance')
+subdir('file_fdw')
+subdir('fuzzystrmatch')
+subdir('hstore')
+subdir('hstore_plperl')
+subdir('hstore_plpython')
+subdir('intagg')
+subdir('intarray')
+subdir('isn')
+subdir('jsonb_plperl')
+subdir('jsonb_plpython')
+subdir('lo')
+subdir('ltree')
+subdir('ltree_plpython')
+subdir('oid2name')
+subdir('old_snapshot')
+subdir('pageinspect')
+subdir('passwordcheck')
+subdir('pg_buffercache')
+subdir('pgcrypto')
+subdir('pg_freespacemap')
+subdir('pg_prewarm')
+subdir('pgrowlocks')
+subdir('pg_stat_statements')
+subdir('pgstattuple')
+subdir('pg_surgery')
+subdir('pg_trgm')
+subdir('pg_visibility')
+subdir('pg_walinspect')
+subdir('postgres_fdw')
+subdir('seg')
+subdir('sepgsql')
+subdir('spi')
+subdir('sslinfo')
+# start-scripts doesn't contain build products
+subdir('tablefunc')
+subdir('tcn')
+subdir('test_decoding')
+subdir('tsm_system_rows')
+subdir('tsm_system_time')
+subdir('unaccent')
+subdir('uuid-ossp')
+subdir('vacuumlo')
+subdir('xml2')
diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build
new file mode 100644
index 00000000000..1dad5d8f6e7
--- /dev/null
+++ b/contrib/oid2name/meson.build
@@ -0,0 +1,17 @@
+oid2name = executable('oid2name',
+ ['oid2name.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+contrib_targets += oid2name
+
+tests += {
+ 'name': 'oid2name',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build
new file mode 100644
index 00000000000..8e7ee09a43a
--- /dev/null
+++ b/contrib/old_snapshot/meson.build
@@ -0,0 +1,15 @@
+old_snapshot_sources = files(
+ 'time_mapping.c',
+)
+
+old_snapshot = shared_module('old_snapshot',
+ old_snapshot_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += old_snapshot
+
+install_data(
+ 'old_snapshot.control',
+ 'old_snapshot--1.0.sql',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
new file mode 100644
index 00000000000..4af8153e4fd
--- /dev/null
+++ b/contrib/pageinspect/meson.build
@@ -0,0 +1,50 @@
+pageinspect_sources = files(
+ 'brinfuncs.c',
+ 'btreefuncs.c',
+ 'fsmfuncs.c',
+ 'ginfuncs.c',
+ 'gistfuncs.c',
+ 'hashfuncs.c',
+ 'heapfuncs.c',
+ 'rawpage.c',
+)
+
+pageinspect = shared_module('pageinspect',
+ pageinspect_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pageinspect
+
+install_data(
+ 'pageinspect--1.0--1.1.sql',
+ 'pageinspect--1.1--1.2.sql',
+ 'pageinspect--1.2--1.3.sql',
+ 'pageinspect--1.3--1.4.sql',
+ 'pageinspect--1.4--1.5.sql',
+ 'pageinspect--1.5--1.6.sql',
+ 'pageinspect--1.5.sql',
+ 'pageinspect--1.6--1.7.sql',
+ 'pageinspect--1.7--1.8.sql',
+ 'pageinspect--1.8--1.9.sql',
+ 'pageinspect--1.9--1.10.sql',
+ 'pageinspect.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pageinspect',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'page',
+ 'btree',
+ 'brin',
+ 'gin',
+ 'gist',
+ 'hash',
+ 'checksum',
+ 'oldextversions',
+ ],
+ },
+}
diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build
new file mode 100644
index 00000000000..7da47d02f1d
--- /dev/null
+++ b/contrib/passwordcheck/meson.build
@@ -0,0 +1,30 @@
+passwordcheck_sources = files(
+ 'passwordcheck.c',
+)
+
+passwordcheck_c_args = []
+passwordcheck_deps = []
+
+# uncomment the following two lines to enable cracklib support
+# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
+# passwordcheck_deps += [cc.find_library('crack')]
+
+passwordcheck = shared_module('passwordcheck',
+ passwordcheck_sources,
+ c_args: passwordcheck_c_args,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args.get('dependencies') + passwordcheck_deps,
+ }
+)
+contrib_targets += passwordcheck
+
+tests += {
+ 'name': 'passwordcheck',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'passwordcheck',
+ ],
+ },
+}
diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build
new file mode 100644
index 00000000000..2c69eae3ea2
--- /dev/null
+++ b/contrib/pg_buffercache/meson.build
@@ -0,0 +1,27 @@
+pg_buffercache = shared_module('pg_buffercache',
+ files(
+ 'pg_buffercache_pages.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_buffercache
+
+install_data(
+ 'pg_buffercache--1.0--1.1.sql',
+ 'pg_buffercache--1.1--1.2.sql',
+ 'pg_buffercache--1.2--1.3.sql',
+ 'pg_buffercache--1.2.sql',
+ 'pg_buffercache.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_buffercache',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_buffercache',
+ ],
+ },
+}
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
new file mode 100644
index 00000000000..f795014d7ca
--- /dev/null
+++ b/contrib/pg_freespacemap/meson.build
@@ -0,0 +1,29 @@
+pg_freespacemap = shared_module('pg_freespacemap',
+ files(
+ 'pg_freespacemap.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_freespacemap
+
+install_data(
+ 'pg_freespacemap--1.0--1.1.sql',
+ 'pg_freespacemap--1.1--1.2.sql',
+ 'pg_freespacemap--1.1.sql',
+ 'pg_freespacemap.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_freespacemap',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_freespacemap',
+ ],
+ 'regress_args': [
+ '--temp-config', files('pg_freespacemap.conf')
+ ],
+ },
+}
diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build
new file mode 100644
index 00000000000..bdca9af4f27
--- /dev/null
+++ b/contrib/pg_prewarm/meson.build
@@ -0,0 +1,27 @@
+pg_prewarm = shared_module('pg_prewarm',
+ files(
+ 'autoprewarm.c',
+ 'pg_prewarm.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_prewarm
+
+install_data(
+ 'pg_prewarm--1.0--1.1.sql',
+ 'pg_prewarm--1.1--1.2.sql',
+ 'pg_prewarm--1.1.sql',
+ 'pg_prewarm.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_prewarm',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
new file mode 100644
index 00000000000..ac117d2fc1d
--- /dev/null
+++ b/contrib/pg_stat_statements/meson.build
@@ -0,0 +1,35 @@
+pg_stat_statements = shared_module('pg_stat_statements',
+ files('pg_stat_statements.c'),
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'],
+ },
+)
+contrib_targets += pg_stat_statements
+
+install_data(
+ 'pg_stat_statements.control',
+ 'pg_stat_statements--1.4.sql',
+ 'pg_stat_statements--1.9--1.10.sql',
+ 'pg_stat_statements--1.8--1.9.sql',
+ 'pg_stat_statements--1.7--1.8.sql',
+ 'pg_stat_statements--1.6--1.7.sql',
+ 'pg_stat_statements--1.5--1.6.sql',
+ 'pg_stat_statements--1.4--1.5.sql',
+ 'pg_stat_statements--1.3--1.4.sql',
+ 'pg_stat_statements--1.2--1.3.sql',
+ 'pg_stat_statements--1.1--1.2.sql',
+ 'pg_stat_statements--1.0--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_stat_statements',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_stat_statements',
+ ],
+ 'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
+ },
+}
diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build
new file mode 100644
index 00000000000..ac71caa5276
--- /dev/null
+++ b/contrib/pg_surgery/meson.build
@@ -0,0 +1,25 @@
+pg_surgery = shared_module('pg_surgery',
+ files(
+ 'heap_surgery.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_surgery
+
+install_data(
+ 'pg_surgery--1.0.sql',
+ 'pg_surgery.control',
+ kwargs: contrib_data_args,
+)
+
+
+tests += {
+ 'name': 'pg_surgery',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'heap_surgery',
+ ],
+ },
+}
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
new file mode 100644
index 00000000000..a90628d23c6
--- /dev/null
+++ b/contrib/pg_trgm/meson.build
@@ -0,0 +1,35 @@
+pg_trgm = shared_module('pg_trgm',
+ files(
+ 'trgm_gin.c',
+ 'trgm_gist.c',
+ 'trgm_op.c',
+ 'trgm_regexp.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_trgm
+
+install_data(
+ 'pg_trgm--1.0--1.1.sql',
+ 'pg_trgm--1.1--1.2.sql',
+ 'pg_trgm--1.2--1.3.sql',
+ 'pg_trgm--1.3--1.4.sql',
+ 'pg_trgm--1.3.sql',
+ 'pg_trgm--1.4--1.5.sql',
+ 'pg_trgm--1.5--1.6.sql',
+ 'pg_trgm.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_trgm',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_trgm',
+ 'pg_word_trgm',
+ 'pg_strict_word_trgm',
+ ],
+ },
+}
diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build
new file mode 100644
index 00000000000..933dc99ac4d
--- /dev/null
+++ b/contrib/pg_visibility/meson.build
@@ -0,0 +1,26 @@
+pg_visibility = shared_module('pg_visibility',
+ files(
+ 'pg_visibility.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pg_visibility
+
+install_data(
+ 'pg_visibility--1.0--1.1.sql',
+ 'pg_visibility--1.1--1.2.sql',
+ 'pg_visibility--1.1.sql',
+ 'pg_visibility.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pg_visibility',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pg_visibility',
+ ],
+ },
+}
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
new file mode 100644
index 00000000000..d6b27877dd0
--- /dev/null
+++ b/contrib/pg_walinspect/meson.build
@@ -0,0 +1,27 @@
+pg_walinspect_sources = files('pg_walinspect.c')
+
+pg_walinspect = shared_module('pg_walinspect',
+ pg_walinspect_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'],
+ },
+)
+contrib_targets += pg_walinspect
+
+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')],
+ },
+}
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
new file mode 100644
index 00000000000..fe0851bf8e8
--- /dev/null
+++ b/contrib/pgcrypto/meson.build
@@ -0,0 +1,100 @@
+if not ssl.found()
+ subdir_done()
+endif
+
+pgcrypto_sources = files(
+ 'crypt-blowfish.c',
+ 'crypt-des.c',
+ 'crypt-gensalt.c',
+ 'crypt-md5.c',
+ 'mbuf.c',
+ 'pgcrypto.c',
+ 'pgp-armor.c',
+ 'pgp-cfb.c',
+ 'pgp-compress.c',
+ 'pgp-decrypt.c',
+ 'pgp-encrypt.c',
+ 'pgp-info.c',
+ 'pgp-mpi.c',
+ 'pgp-pgsql.c',
+ 'pgp-pubdec.c',
+ 'pgp-pubenc.c',
+ 'pgp-pubkey.c',
+ 'pgp-s2k.c',
+ 'pgp.c',
+ 'px-crypt.c',
+ 'px-hmac.c',
+ 'px.c',
+)
+
+pgcrypto_regress = [
+ 'init',
+ 'md5',
+ 'sha1',
+ 'hmac-md5',
+ 'hmac-sha1',
+ 'blowfish',
+ 'rijndael',
+ 'sha2',
+ 'des',
+ '3des',
+ 'cast5',
+ 'crypt-des',
+ 'crypt-md5',
+ 'crypt-blowfish',
+ 'crypt-xdes',
+ 'pgp-armor',
+ 'pgp-decrypt',
+ 'pgp-encrypt',
+ 'pgp-pubkey-decrypt',
+ 'pgp-pubkey-encrypt',
+ 'pgp-info',
+]
+
+pgcrypto_openssl_sources = files(
+ 'openssl.c',
+ 'pgp-mpi-openssl.c',
+)
+
+pgcrypto_deps = []
+pgcrypto_link_with = []
+
+pgcrypto_deps += ssl
+pgcrypto_sources += pgcrypto_openssl_sources
+
+if zlib.found()
+ pgcrypto_deps += zlib
+ pgcrypto_regress += 'pgp-compression'
+else
+ pgcrypto_regress += 'pgp-zlib-DISABLED'
+endif
+
+pgcrypto = shared_module('pgcrypto',
+ pgcrypto_sources,
+ link_with: pgcrypto_link_with,
+ kwargs: contrib_mod_args + {
+ 'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
+ },
+)
+contrib_targets += pgcrypto
+
+install_data(
+ 'pgcrypto--1.0--1.1.sql',
+ 'pgcrypto--1.1--1.2.sql',
+ 'pgcrypto--1.2--1.3.sql',
+ 'pgcrypto--1.3.sql',
+ 'pgcrypto.control',
+ kwargs: contrib_data_args,
+)
+
+
+tests += {
+ 'name': 'pgcrypto',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ pgcrypto_regress,
+ ],
+ },
+}
diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build
new file mode 100644
index 00000000000..1b41691a2a3
--- /dev/null
+++ b/contrib/pgrowlocks/meson.build
@@ -0,0 +1,27 @@
+pgrowlocks = shared_module('pgrowlocks',
+ files(
+ 'pgrowlocks.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pgrowlocks
+
+install_data(
+ 'pgrowlocks--1.0--1.1.sql',
+ 'pgrowlocks--1.1--1.2.sql',
+ 'pgrowlocks--1.2.sql',
+ 'pgrowlocks.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pgrowlocks',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'pgrowlocks',
+ ],
+ 'regress_args': ['--load-extension=pgrowlocks'],
+ },
+}
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
new file mode 100644
index 00000000000..8e828692d5c
--- /dev/null
+++ b/contrib/pgstattuple/meson.build
@@ -0,0 +1,31 @@
+pgstattuple = shared_module('pgstattuple',
+ files(
+ 'pgstatapprox.c',
+ 'pgstatindex.c',
+ 'pgstattuple.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += pgstattuple
+
+install_data(
+ 'pgstattuple--1.0--1.1.sql',
+ 'pgstattuple--1.1--1.2.sql',
+ 'pgstattuple--1.2--1.3.sql',
+ 'pgstattuple--1.3--1.4.sql',
+ 'pgstattuple--1.4--1.5.sql',
+ 'pgstattuple--1.4.sql',
+ 'pgstattuple.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'pgstattuple',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'pgstattuple',
+ ],
+ },
+}
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
new file mode 100644
index 00000000000..378885ec93b
--- /dev/null
+++ b/contrib/postgres_fdw/meson.build
@@ -0,0 +1,34 @@
+postgres_fdw_sources = files(
+ 'connection.c',
+ 'deparse.c',
+ 'option.c',
+ 'postgres_fdw.c',
+ 'shippable.c',
+)
+
+postgres_fdw = shared_module('postgres_fdw',
+ postgres_fdw_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': contrib_mod_args['dependencies'] + [libpq],
+ },
+)
+contrib_targets += postgres_fdw
+
+install_data(
+ 'postgres_fdw.control',
+ 'postgres_fdw--1.0.sql',
+ 'postgres_fdw--1.0--1.1.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'postgres_fdw',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'postgres_fdw',
+ ],
+ 'regress_args': ['--dlpath', meson.build_root() / 'src/test/regress'],
+ },
+}
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
new file mode 100644
index 00000000000..e476eab2a77
--- /dev/null
+++ b/contrib/seg/meson.build
@@ -0,0 +1,51 @@
+seg_sources = files(
+ 'seg.c',
+)
+
+seg_scan = custom_target('segscan',
+ input: 'segscan.l',
+ output: 'segscan.c',
+ command: flex_cmd,
+)
+generated_sources += seg_scan
+seg_sources += seg_scan
+
+seg_parse = custom_target('segparse',
+ input: 'segparse.y',
+ kwargs: bison_kw,
+)
+generated_sources += seg_parse.to_list()
+seg_sources += seg_parse
+
+seg = shared_module('seg',
+ seg_sources,
+ include_directories: include_directories('.'),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += seg
+
+install_data(
+ 'seg.control',
+ 'seg--1.0--1.1.sql',
+ 'seg--1.1--1.2.sql',
+ 'seg--1.1.sql',
+ 'seg--1.2--1.3.sql',
+ 'seg--1.3--1.4.sql',
+ kwargs: contrib_data_args,
+)
+
+install_headers(
+ 'segdata.h',
+ install_dir: dir_include_extension / 'seg',
+)
+
+tests += {
+ 'name': 'seg',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'seg',
+ ],
+ },
+}
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
new file mode 100644
index 00000000000..60a95e17c2f
--- /dev/null
+++ b/contrib/sepgsql/meson.build
@@ -0,0 +1,34 @@
+if not selinux.found()
+ subdir_done()
+endif
+
+sepgsql_sources = files(
+ 'database.c',
+ 'dml.c',
+ 'hooks.c',
+ 'label.c',
+ 'proc.c',
+ 'relation.c',
+ 'schema.c',
+ 'selinux.c',
+ 'uavc.c',
+)
+
+sepgsql = shared_module('sepgsql',
+ sepgsql_sources,
+ kwargs: contrib_mod_args + {
+ 'dependencies': [selinux, contrib_mod_args['dependencies']],
+ }
+)
+contrib_targets += sepgsql
+
+custom_target('sepgsql.sql',
+ input: 'sepgsql.sql.in',
+ output: 'sepgsql.sql',
+ command: [sed, '-e', 's,MODULE_PATHNAME,$libdir/sepgsql,g', '@INPUT@'],
+ capture: true,
+ install: true,
+ install_dir: contrib_data_args['install_dir'],
+)
+
+# TODO: implement sepgsql tests
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
new file mode 100644
index 00000000000..98008980ec2
--- /dev/null
+++ b/contrib/spi/meson.build
@@ -0,0 +1,50 @@
+autoinc = shared_module('autoinc',
+ ['autoinc.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += autoinc
+
+install_data('autoinc.control', 'autoinc--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+
+insert_username = shared_module('insert_username',
+ ['insert_username.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += insert_username
+
+install_data(
+ 'insert_username.control',
+ 'insert_username--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+
+moddatetime = shared_module('moddatetime',
+ ['moddatetime.c'],
+ kwargs: contrib_mod_args,
+)
+contrib_targets += moddatetime
+
+install_data(
+ 'moddatetime.control',
+ 'moddatetime--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+# this is needed for the regression tests;
+# comment out if you want a quieter refint package for other uses
+refint_cflags = ['-DREFINT_VERBOSE']
+
+refint = shared_module('refint',
+ ['refint.c'],
+ c_args: refint_cflags,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += refint
+
+install_data('refint.control', 'refint--1.0.sql',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
new file mode 100644
index 00000000000..53f752a08ac
--- /dev/null
+++ b/contrib/sslinfo/meson.build
@@ -0,0 +1,21 @@
+if not ssl.found()
+ subdir_done()
+endif
+
+sslinfo = shared_module('sslinfo',
+ files(
+ 'sslinfo.c',
+ ),
+ kwargs: contrib_mod_args + {
+ 'dependencies': [ssl, contrib_mod_args['dependencies']],
+ }
+)
+contrib_targets += sslinfo
+
+install_data(
+ 'sslinfo--1.0--1.1.sql',
+ 'sslinfo--1.1--1.2.sql',
+ 'sslinfo--1.2.sql',
+ 'sslinfo.control',
+ kwargs: contrib_data_args,
+)
diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build
new file mode 100644
index 00000000000..f4230096c0c
--- /dev/null
+++ b/contrib/tablefunc/meson.build
@@ -0,0 +1,24 @@
+tablefunc = shared_module('tablefunc',
+ files(
+ 'tablefunc.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tablefunc
+
+install_data(
+ 'tablefunc--1.0.sql',
+ 'tablefunc.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tablefunc',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'tablefunc',
+ ],
+ },
+}
diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build
new file mode 100644
index 00000000000..c3a025247d4
--- /dev/null
+++ b/contrib/tcn/meson.build
@@ -0,0 +1,25 @@
+tcn = shared_module('tcn',
+ files(
+ 'tcn.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tcn
+
+install_data(
+ 'tcn--1.0.sql',
+ 'tcn.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tcn',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'tcn',
+ ],
+ 'regress_args': ['--load-extension=tcn'],
+ },
+}
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
new file mode 100644
index 00000000000..dd7cb0101ad
--- /dev/null
+++ b/contrib/test_decoding/meson.build
@@ -0,0 +1,63 @@
+test_decoding_sources = files(
+ 'test_decoding.c',
+)
+
+test_decoding = shared_module('test_decoding',
+ test_decoding_sources,
+ kwargs: contrib_mod_args,
+)
+contrib_targets += test_decoding
+
+tests += {
+ 'name': 'test_decoding',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'ddl',
+ 'xact',
+ 'rewrite',
+ 'toast',
+ 'permissions',
+ 'decoding_in_xact',
+ 'decoding_into_rel',
+ 'binary',
+ 'prepared',
+ 'replorigin',
+ 'time',
+ 'messages',
+ 'spill',
+ 'slot',
+ 'truncate',
+ 'stream',
+ 'stats',
+ 'twophase',
+ 'twophase_stream',
+ ],
+ 'regress_args': [
+ '--temp-config', files('logical.conf'),
+ ],
+ },
+ 'isolation': {
+ 'specs': [
+ 'mxact',
+ 'delayed_startup',
+ 'ondisk_startup',
+ 'concurrent_ddl_dml',
+ 'oldest_xmin',
+ 'snapshot_transfer',
+ 'subxact_without_top',
+ 'concurrent_stream',
+ 'twophase_snapshot',
+ 'slot_creation_error',
+ ],
+ 'regress_args': [
+ '--temp-config', files('logical.conf'),
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_repl_stats.pl',
+ ],
+ },
+}
diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build
new file mode 100644
index 00000000000..b9cd42115a8
--- /dev/null
+++ b/contrib/tsm_system_rows/meson.build
@@ -0,0 +1,24 @@
+tsm_system_rows = shared_module('tsm_system_rows',
+ files(
+ 'tsm_system_rows.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tsm_system_rows
+
+install_data(
+ 'tsm_system_rows--1.0.sql',
+ 'tsm_system_rows.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tsm_system_rows',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'tsm_system_rows',
+ ],
+ },
+}
diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build
new file mode 100644
index 00000000000..18015912ffb
--- /dev/null
+++ b/contrib/tsm_system_time/meson.build
@@ -0,0 +1,24 @@
+tsm_system_time = shared_module('tsm_system_time',
+ files(
+ 'tsm_system_time.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += tsm_system_time
+
+install_data(
+ 'tsm_system_time--1.0.sql',
+ 'tsm_system_time.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'tsm_system_time',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'tsm_system_time',
+ ],
+ },
+}
diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build
new file mode 100644
index 00000000000..872b76e3223
--- /dev/null
+++ b/contrib/unaccent/meson.build
@@ -0,0 +1,32 @@
+unaccent = shared_module('unaccent',
+ files(
+ 'unaccent.c',
+ ),
+ kwargs: contrib_mod_args,
+)
+contrib_targets += unaccent
+
+install_data(
+ 'unaccent--1.0--1.1.sql',
+ 'unaccent--1.1.sql',
+ 'unaccent.control',
+ kwargs: contrib_data_args,
+)
+
+install_data(
+ 'unaccent.rules',
+ install_dir: dir_data / 'tsearch_data'
+)
+
+# XXX: Implement downlo
+tests += {
+ 'name': 'unaccent',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'unaccent',
+ ],
+ 'regress_args': ['--encoding=UTF8'],
+ },
+}
diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build
new file mode 100644
index 00000000000..da6d1d75c12
--- /dev/null
+++ b/contrib/uuid-ossp/meson.build
@@ -0,0 +1,31 @@
+if not uuid.found()
+ subdir_done()
+endif
+
+uuid_ossp = shared_module('uuid-ossp',
+ files(
+ 'uuid-ossp.c',
+ ),
+ kwargs: contrib_mod_args + {
+ 'dependencies': [uuid, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += uuid_ossp
+
+install_data(
+ 'uuid-ossp--1.0--1.1.sql',
+ 'uuid-ossp--1.1.sql',
+ 'uuid-ossp.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'uuid-ossp',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'uuid_ossp',
+ ],
+ },
+}
diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build
new file mode 100644
index 00000000000..7a632b87d1b
--- /dev/null
+++ b/contrib/vacuumlo/meson.build
@@ -0,0 +1,17 @@
+vacuumlo = executable('vacuumlo',
+ ['vacuumlo.c'],
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args,
+)
+contrib_targets += vacuumlo
+
+tests += {
+ 'name': 'vacuumlo',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_basic.pl',
+ ],
+ },
+}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
new file mode 100644
index 00000000000..9c0b56f01f6
--- /dev/null
+++ b/contrib/xml2/meson.build
@@ -0,0 +1,32 @@
+if not libxml.found()
+ subdir_done()
+endif
+
+xml2 = shared_module('pgxml',
+ files(
+ 'xpath.c',
+ 'xslt_proc.c',
+ ),
+ kwargs: contrib_mod_args + {
+ 'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
+ },
+)
+contrib_targets += xml2
+
+install_data(
+ 'xml2--1.0--1.1.sql',
+ 'xml2--1.1.sql',
+ 'xml2.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'xml2',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'xml2',
+ ],
+ },
+}
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
new file mode 100644
index 00000000000..5887cb92b52
--- /dev/null
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -0,0 +1,22 @@
+export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+
+ecpg_compat = both_libraries('libecpg_compat',
+ 'informix.c',
+ include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
+ c_args: ['-DSO_MAJOR_VERSION=3'],
+ dependencies: [frontend_code, thread_dep],
+ link_with: [ecpglib, ecpg_pgtypes],
+ soversion: host_system != 'windows' ? '3' : '',
+ darwin_versions: ['3', '3.' + pg_version_major.to_string()],
+ version: '3.' + pg_version_major.to_string(),
+ link_args: export_fmt.format(export_file.full_path()),
+ link_depends: export_file,
+ kwargs: default_lib_args,
+)
+ecpg_targets += [ecpg_compat.get_shared_lib(), ecpg_compat.get_static_lib()]
+
+pkgconfig.generate(
+ ecpg_compat.get_shared_lib(),
+ description: 'PostgreSQL libecpg_compat library',
+ url: pg_url,
+)
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
new file mode 100644
index 00000000000..2da029ec8ea
--- /dev/null
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -0,0 +1,37 @@
+ecpglib_sources = files(
+ 'connect.c',
+ 'data.c',
+ 'descriptor.c',
+ 'error.c',
+ 'execute.c',
+ 'memory.c',
+ 'misc.c',
+ 'prepare.c',
+ 'sqlda.c',
+ 'typename.c',
+)
+
+export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+
+ecpglib = both_libraries('libecpg',
+ ecpglib_sources,
+ include_directories: ['.', ecpg_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=6'],
+ dependencies: [frontend_code, libpq, thread_dep],
+ link_with: [ecpg_pgtypes],
+ soversion: host_system != 'windows' ? '6' : '',
+ darwin_versions: ['6', '6.' + pg_version_major.to_string()],
+ version: '6.' + pg_version_major.to_string(),
+ link_args: export_fmt.format(export_file.full_path()),
+ link_depends: export_file,
+ kwargs: default_lib_args,
+)
+ecpg_targets += [ecpglib.get_shared_lib(), ecpglib.get_static_lib()]
+
+pkgconfig.generate(
+ ecpglib.get_shared_lib(),
+ description: 'PostgreSQL libecpg library',
+ url: pg_url,
+)
+
+subdir('po', if_found: libintl)
diff --git a/src/interfaces/ecpg/ecpglib/po/meson.build b/src/interfaces/ecpg/ecpglib/po/meson.build
new file mode 100644
index 00000000000..246e399ebd3
--- /dev/null
+++ b/src/interfaces/ecpg/ecpglib/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('ecpglib' + '6' + '-' + pg_version_major.to_string())
diff --git a/src/interfaces/ecpg/include/meson.build b/src/interfaces/ecpg/include/meson.build
new file mode 100644
index 00000000000..c95d0455b9a
--- /dev/null
+++ b/src/interfaces/ecpg/include/meson.build
@@ -0,0 +1,51 @@
+ecpg_inc = include_directories('.')
+
+ecpg_conf_keys = [
+ 'ENABLE_THREAD_SAFETY',
+ 'HAVE_INT64',
+ 'HAVE_LONG_INT_64',
+ 'HAVE_LONG_LONG_INT_64',
+ 'PG_USE_STDBOOL',
+]
+
+ecpg_conf_data = configuration_data()
+
+foreach key : ecpg_conf_keys
+ if cdata.has(key)
+ ecpg_conf_data.set(key, cdata.get(key))
+ endif
+endforeach
+
+ecpg_config_h = configure_file(
+ output: 'ecpg_config.h',
+ configuration: ecpg_conf_data,
+ install_dir: dir_include,
+)
+configure_files += ecpg_config_h
+
+generated_sources_ac += {'src/interfaces/ecpg/include': ['stamp-h']}
+
+install_headers(
+ 'ecpg_informix.h',
+ 'ecpgerrno.h',
+ 'ecpglib.h',
+ 'ecpgtype.h',
+ 'pgtypes.h',
+ 'pgtypes_date.h',
+ 'pgtypes_error.h',
+ 'pgtypes_interval.h',
+ 'pgtypes_numeric.h',
+ 'pgtypes_timestamp.h',
+ 'sql3types.h',
+ 'sqlca.h',
+ 'sqlda.h',
+ 'sqlda-compat.h',
+ 'sqlda-native.h',
+)
+
+install_headers(
+ 'datetime.h',
+ 'decimal.h',
+ 'sqltypes.h',
+ install_dir: dir_include_pkg / 'informix' / 'esql',
+)
diff --git a/src/interfaces/ecpg/meson.build b/src/interfaces/ecpg/meson.build
new file mode 100644
index 00000000000..f079b42269f
--- /dev/null
+++ b/src/interfaces/ecpg/meson.build
@@ -0,0 +1,9 @@
+ecpg_targets = []
+
+subdir('include')
+subdir('pgtypeslib')
+subdir('ecpglib')
+subdir('compatlib')
+subdir('preproc')
+
+alias_target('ecpg', ecpg_targets)
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
new file mode 100644
index 00000000000..96489d9f1d7
--- /dev/null
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -0,0 +1,30 @@
+ecpg_pgtypes_sources = files(
+ 'common.c',
+ 'datetime.c',
+ 'dt_common.c',
+ 'interval.c',
+ 'numeric.c',
+ 'timestamp.c',
+)
+
+export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+
+ecpg_pgtypes = both_libraries('libpgtypes',
+ ecpg_pgtypes_sources,
+ include_directories: ['.', ecpg_inc, postgres_inc],
+ c_args: ['-DSO_MAJOR_VERSION=3'],
+ dependencies: [frontend_code],
+ version: '3.' + pg_version_major.to_string(),
+ soversion: host_system != 'windows' ? '3' : '',
+ darwin_versions: ['3', '3.' + pg_version_major.to_string()],
+ link_args: export_fmt.format(export_file.full_path()),
+ link_depends: export_file,
+ kwargs: default_lib_args,
+)
+ecpg_targets += [ecpg_pgtypes.get_shared_lib(), ecpg_pgtypes.get_static_lib()]
+
+pkgconfig.generate(
+ ecpg_pgtypes.get_shared_lib(),
+ description: 'PostgreSQL libpgtypes library',
+ url: pg_url,
+)
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
new file mode 100644
index 00000000000..1be49c8c27f
--- /dev/null
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -0,0 +1,104 @@
+ecpg_sources = files(
+ '../ecpglib/typename.c',
+ 'c_keywords.c',
+ 'descriptor.c',
+ 'ecpg.c',
+ 'ecpg_keywords.c',
+ 'keywords.c',
+ 'output.c',
+ 'parser.c',
+ 'type.c',
+ 'variable.c',
+)
+
+pgc = custom_target('pgc.c',
+ input: 'pgc.l',
+ output: 'pgc.c',
+ command: flex_cmd,
+)
+generated_sources += pgc
+ecpg_sources += pgc
+
+ecpg_files = [
+ 'ecpg.addons',
+ 'ecpg.header',
+ 'ecpg.tokens',
+ 'ecpg.trailer',
+ 'ecpg.type',
+]
+
+preproc_y = custom_target('preproc.y',
+ input: [
+ '../../../backend/parser/gram.y',
+ ecpg_files,
+ ],
+ output: ['preproc.y'],
+ command: [
+ perl, files('parse.pl'),
+ '--srcdir', '@CURRENT_SOURCE_DIR@',
+ '--parser', '@INPUT0@',
+ '--output', '@OUTPUT0@',
+ ],
+)
+generated_sources += preproc_y
+
+check_rules = custom_target('preproc.y.check_rules',
+ input: [
+ '../../../backend/parser/gram.y',
+ ecpg_files,
+ ],
+ output: 'preproc.y.check_rules',
+ command: [
+ perl, files('check_rules.pl'),
+ '--srcdir', '@CURRENT_SOURCE_DIR@',
+ '--parser', '@INPUT0@',
+ '--stamp', '@OUTPUT0@',
+ ],
+)
+
+preproc = custom_target('preproc.c',
+ input: preproc_y,
+ kwargs: bison_kw,
+)
+generated_sources += preproc.to_list()
+ecpg_sources += preproc
+
+c_kwlist = custom_target('c_kwlist_d.h',
+ input: ['c_kwlist.h'],
+ output: ['c_kwlist_d.h'],
+ depends: check_rules,
+ command: [
+ perl,
+ '-I', '@SOURCE_ROOT@/src/tools',
+ '@SOURCE_ROOT@/src/tools/gen_keywordlist.pl',
+ '--output', '@OUTDIR@',
+ '--varname', 'ScanCKeywords',
+ '--no-case-fold', '@INPUT0@',
+ ],
+)
+generated_sources += c_kwlist
+ecpg_sources += c_kwlist
+
+ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
+ input: ['ecpg_kwlist.h'],
+ output: ['ecpg_kwlist_d.h'],
+ command: [
+ perl, '-I',
+ '@SOURCE_ROOT@/src/tools',
+ '@SOURCE_ROOT@/src/tools/gen_keywordlist.pl',
+ '--output', '@OUTDIR@',
+ '--varname', 'ScanECPGKeywords', '@INPUT0@',
+ ]
+)
+generated_sources += ecpg_kwlist
+ecpg_sources += ecpg_kwlist
+
+ecpg_exe = executable('ecpg',
+ ecpg_sources,
+ include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args,
+)
+ecpg_targets += ecpg_exe
+
+subdir('po', if_found: libintl)
diff --git a/src/interfaces/ecpg/preproc/po/meson.build b/src/interfaces/ecpg/preproc/po/meson.build
new file mode 100644
index 00000000000..d73b05afd5e
--- /dev/null
+++ b/src/interfaces/ecpg/preproc/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext('ecpg-' + pg_version_major.to_string())
diff --git a/src/interfaces/ecpg/test/compat_informix/meson.build b/src/interfaces/ecpg/test/compat_informix/meson.build
new file mode 100644
index 00000000000..6bb0d980761
--- /dev/null
+++ b/src/interfaces/ecpg/test/compat_informix/meson.build
@@ -0,0 +1,31 @@
+pgc_files = [
+ 'charfuncs',
+ 'dec_test',
+ 'describe',
+ 'rfmtdate',
+ 'rfmtlong',
+ 'rnull',
+ 'sqlda',
+ 'test_informix',
+ 'test_informix2',
+]
+
+pgc_extra_flags = {
+ 'rnull': ['-r', 'no_indicator',],
+}
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ ['-C', 'INFORMIX',] +
+ pgc_extra_flags.get(pgc_file, []) +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/compat_oracle/meson.build b/src/interfaces/ecpg/test/compat_oracle/meson.build
new file mode 100644
index 00000000000..2e8794ba386
--- /dev/null
+++ b/src/interfaces/ecpg/test/compat_oracle/meson.build
@@ -0,0 +1,20 @@
+pgc_files = [
+ 'char_array',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ output: '@BASENAME@.c',
+ command: ecpg_preproc_test_command_start +
+ ['-C', 'ORACLE',] +
+ ecpg_preproc_test_command_end,
+ install: false,
+ build_by_default: false,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/connect/meson.build b/src/interfaces/ecpg/test/connect/meson.build
new file mode 100644
index 00000000000..0b1c3593146
--- /dev/null
+++ b/src/interfaces/ecpg/test/connect/meson.build
@@ -0,0 +1,20 @@
+pgc_files = [
+ 'test1',
+ 'test2',
+ 'test3',
+ 'test4',
+ 'test5',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start + ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
new file mode 100644
index 00000000000..bd2489f2bb1
--- /dev/null
+++ b/src/interfaces/ecpg/test/meson.build
@@ -0,0 +1,79 @@
+pg_regress_ecpg_sources = pg_regress_c + files(
+ 'pg_regress_ecpg.c',
+)
+
+pg_regress_ecpg = executable('pg_regress_ecpg',
+ pg_regress_ecpg_sources,
+ c_args: pg_regress_cflags,
+ include_directories: [pg_regress_inc, include_directories('.')],
+ dependencies: [frontend_code],
+ kwargs: default_bin_args + {
+ 'install': false
+ },
+)
+testprep_targets += pg_regress_ecpg
+
+# create .c files and executables from .pgc files
+ecpg_test_exec_kw = {
+ 'dependencies': [frontend_code, libpq],
+ 'include_directories': [ecpg_inc],
+ 'link_with': [ecpglib, ecpg_compat, ecpg_pgtypes],
+ 'build_by_default': false,
+ 'install': false,
+}
+
+ecpg_preproc_kw = {
+ 'output': '@BASENAME@.c',
+ 'install': false,
+ 'build_by_default': false,
+}
+
+ecpg_preproc_test_command_start = [
+ ecpg_exe,
+ '--regression',
+ '-I@CURRENT_SOURCE_DIR@',
+ '-I@SOURCE_ROOT@' + '/src/interfaces/ecpg/include/',
+]
+ecpg_preproc_test_command_end = [
+ '-o', '@OUTPUT@', '@INPUT@'
+]
+
+ecpg_test_dependencies = []
+
+subdir('compat_informix')
+subdir('compat_oracle')
+subdir('connect')
+subdir('pgtypeslib')
+subdir('preproc')
+subdir('sql')
+subdir('thread')
+
+testprep_targets += ecpg_test_dependencies
+
+ecpg_test_files = files(
+ 'ecpg_schedule',
+)
+
+ecpg_regress_args = [
+ '--dbname=ecpg1_regression,ecpg2_regression',
+ '--create-role=regress_ecpg_user1,regress_ecpg_user2',
+ '--encoding=SQL_ASCII',
+]
+
+tests += {
+ 'name': 'ecpg',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'ecpg': {
+ 'expecteddir': meson.current_source_dir(),
+ 'inputdir': meson.current_build_dir(),
+ 'schedule': ecpg_test_files,
+ 'sql': [
+ 'sql/twophase',
+ ],
+ 'test_kwargs': {
+ 'depends': meson.is_cross_build() ? [] : ecpg_test_dependencies,
+ },
+ 'regress_args': ecpg_regress_args,
+ },
+}
diff --git a/src/interfaces/ecpg/test/pgtypeslib/meson.build b/src/interfaces/ecpg/test/pgtypeslib/meson.build
new file mode 100644
index 00000000000..2957f12abfc
--- /dev/null
+++ b/src/interfaces/ecpg/test/pgtypeslib/meson.build
@@ -0,0 +1,21 @@
+pgc_files = [
+ 'dt_test',
+ 'dt_test2',
+ 'num_test',
+ 'num_test2',
+ 'nan_test',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/preproc/meson.build b/src/interfaces/ecpg/test/preproc/meson.build
new file mode 100644
index 00000000000..0608df2f2a2
--- /dev/null
+++ b/src/interfaces/ecpg/test/preproc/meson.build
@@ -0,0 +1,37 @@
+pgc_files = [
+ 'array_of_struct',
+ 'autoprep',
+ 'comment',
+ 'cursor',
+ 'define',
+ 'init',
+ 'outofscope',
+ 'pointer_to_struct',
+ 'strings',
+ 'type',
+ 'variable',
+ 'whenever',
+ 'whenever_do_continue',
+]
+
+pgc_extra_flags = {
+ 'array_of_struct': ['-c'],
+ 'pointer_to_struct': ['-c'],
+ 'autoprep': ['-r', 'prepare'],
+ 'strings': ['-i'],
+}
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ pgc_extra_flags.get(pgc_file, []) +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/sql/meson.build b/src/interfaces/ecpg/test/sql/meson.build
new file mode 100644
index 00000000000..bec7d4ed8f6
--- /dev/null
+++ b/src/interfaces/ecpg/test/sql/meson.build
@@ -0,0 +1,46 @@
+pgc_files = [
+ 'array',
+ 'binary',
+ 'bytea',
+ 'code100',
+ 'copystdout',
+ 'createtableas',
+ 'declare',
+ 'define',
+ 'desc',
+ 'describe',
+ 'dynalloc',
+ 'dynalloc2',
+ 'dyntest',
+ 'execute',
+ 'fetch',
+ 'func',
+ 'indicators',
+ 'insupd',
+ 'oldexec',
+ 'parser',
+ 'prepareas',
+ 'quote',
+ 'show',
+ 'sqlda',
+ 'twophase',
+]
+
+pgc_extra_flags = {
+ 'oldexec': ['-r', 'questionmarks'],
+}
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ pgc_extra_flags.get(pgc_file, []) +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw,
+ )
+endforeach
diff --git a/src/interfaces/ecpg/test/thread/meson.build b/src/interfaces/ecpg/test/thread/meson.build
new file mode 100644
index 00000000000..2f1629e266b
--- /dev/null
+++ b/src/interfaces/ecpg/test/thread/meson.build
@@ -0,0 +1,21 @@
+pgc_files = [
+ 'thread_implicit',
+ 'thread',
+ 'prep',
+ 'descriptor',
+ 'alloc',
+]
+
+foreach pgc_file : pgc_files
+ exe_input = custom_target('@0@.c'.format(pgc_file),
+ input: '@0@.pgc'.format(pgc_file),
+ command: ecpg_preproc_test_command_start +
+ ecpg_preproc_test_command_end,
+ kwargs: ecpg_preproc_kw,
+ )
+
+ ecpg_test_dependencies += executable(pgc_file,
+ exe_input,
+ kwargs: ecpg_test_exec_kw + {'dependencies': [frontend_code, libpq, thread_dep,]},
+ )
+endforeach
diff --git a/src/interfaces/meson.build b/src/interfaces/meson.build
new file mode 100644
index 00000000000..73fffbee394
--- /dev/null
+++ b/src/interfaces/meson.build
@@ -0,0 +1,2 @@
+# NB: libpq is entered directly from the toplevel meson file
+subdir('ecpg')
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
new file mode 100644
index 00000000000..ba2a261e7a4
--- /dev/null
+++ b/doc/src/sgml/meson.build
@@ -0,0 +1,254 @@
+docs = []
+alldocs = []
+doc_generated = []
+
+xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
+
+
+version_sgml = configure_file(
+ input: 'version.sgml.in',
+ output: 'version.sgml',
+ configuration: cdata,
+)
+configure_files += version_sgml
+
+doc_generated += custom_target('features-supported.sgml',
+ input: files(
+ '../../../src/backend/catalog/sql_feature_packages.txt',
+ '../../../src/backend/catalog/sql_features.txt',
+ ),
+ output: 'features-supported.sgml',
+ command: [perl, files('mk_feature_tables.pl'), 'YES', '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+doc_generated += custom_target('features-unsupported.sgml',
+ input: files(
+ '../../../src/backend/catalog/sql_feature_packages.txt',
+ '../../../src/backend/catalog/sql_features.txt',
+ ),
+ output: 'features-unsupported.sgml',
+ command: [perl, files('mk_feature_tables.pl'), 'NO', '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+doc_generated += custom_target('errcodes-table.sgml',
+ input: files(
+ '../../../src/backend/utils/errcodes.txt'),
+ output: 'errcodes-table.sgml',
+ command: [perl, files('generate-errcodes-table.pl'), '@INPUT@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+# FIXME: this actually has further inputs, adding depfile support to
+# generate-keywords-table.pl is probably the best way to address that
+# robustly.
+doc_generated += custom_target('keywords-table.sgml',
+ input: files(
+ '../../../src/include/parser/kwlist.h'),
+ output: 'keywords-table.sgml',
+ command: [perl, files('generate-keywords-table.pl'), '@CURRENT_SOURCE_DIR@'],
+ build_by_default: false,
+ install: false,
+ capture: true,
+)
+
+# For everything else we need at least xmllint
+if not xmllint.found()
+ subdir_done()
+endif
+
+pandoc = find_program('pandoc', native: true, required: false)
+xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
+fop = find_program('fop', native: true, required: false)
+
+# Run validation only once, common to all subsequent targets. While
+# we're at it, also resolve all entities (that is, copy all included
+# files into one big file). This helps tools that don't understand
+# vpath builds (such as dbtoepub).
+postgres_full_xml = custom_target('postgres-full.xml',
+ input: 'postgres.sgml',
+ output: 'postgres-full.xml',
+ command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
+ depends: doc_generated,
+ build_by_default: false,
+)
+docs += postgres_full_xml
+alldocs += postgres_full_xml
+
+
+#
+# Full documentation as html, text
+#
+if xsltproc.found()
+ xsltproc_flags = [
+ '--stringparam', 'pg.version', pg_version,
+ '--param', 'website.stylesheet', '1'
+ ]
+
+
+ # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
+ # depfile
+ html = custom_target('html',
+ input: ['stylesheet.xsl', postgres_full_xml],
+ output: 'html',
+ depends: doc_generated,
+ command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += html
+
+ # build multi-page html docs as part of docs target
+ docs += html
+
+ html_help = custom_target('html_help',
+ input: ['stylesheet-hh.xsl', postgres_full_xml],
+ output: 'htmlhelp',
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += html_help
+
+
+ # single-page HTML
+ postgres_html = custom_target('postgres.html',
+ input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
+ output: 'postgres.html',
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_html
+
+ # single-page text
+ if pandoc.found()
+ postgres_txt = custom_target('postgres.txt',
+ input: [postgres_html],
+ output: 'postgres.txt',
+ depends: doc_generated,
+ command: [pandoc, '-t', 'plain', '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_txt
+ endif
+endif
+
+
+#
+# INSTALL in html, text
+#
+if xsltproc.found()
+ install_xml = custom_target('INSTALL.xml',
+ input: ['standalone-profile.xsl', 'standalone-install.xml'],
+ output: 'INSTALL.xml',
+ depends: doc_generated + [postgres_full_xml],
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
+ build_by_default: false,
+ )
+ install_html = custom_target('INSTALL.html',
+ input: ['stylesheet-text.xsl', install_xml],
+ output: 'INSTALL.html',
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += install_html
+
+ if pandoc.found()
+ # XXX: Makefile does an iconv translit here, but unclear why?
+ install = custom_target('INSTALL',
+ input: [install_html],
+ output: 'INSTALL',
+ command: [pandoc, '-t', 'plain', '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += install
+ endif
+
+endif
+
+
+#
+# Man pages
+#
+if xsltproc.found()
+ # FIXME: implement / consider sqlmansectnum logic
+ man = custom_target('man',
+ input: ['stylesheet-man.xsl', postgres_full_xml],
+ output: ['man1', 'man3', 'man7'],
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
+ build_by_default: false,
+ )
+
+ # build by default as part of docs target
+ docs += man
+endif
+
+
+#
+# Full documentation as PDF
+#
+if fop.found() and xsltproc.found()
+ xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
+
+ foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
+ postgres_x_fo_f = 'postgres-@0@.fo'.format(format)
+ postgres_x_pdf_f = 'postgres-@0@.pdf'.format(format)
+
+ postgres_x_fo = custom_target(postgres_x_fo_f,
+ input: ['stylesheet-fo.xsl', postgres_full_xml],
+ output: [postgres_x_fo_f],
+ depends: doc_generated,
+ command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
+ '--stringparam', 'paper.type', detail,
+ '-o', '@OUTPUT@', '@INPUT@'],
+ build_by_default: false,
+ )
+
+ postgres_x_pdf = custom_target(postgres_x_pdf_f,
+ input: [postgres_x_fo],
+ output: [postgres_x_pdf_f],
+ command: [fop, '-fo', '@INPUT@', '-pdf', '@OUTPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_x_pdf
+ endforeach
+endif
+
+
+#
+# epub
+#
+
+# This was previously implemented using dbtoepub - but that doesn't seem to
+# support running in build != source directory (i.e. VPATH builds already
+# weren't supported).
+if pandoc.found() and xsltproc.found()
+ postgres_epub = custom_target('postgres.epub',
+ input: postgres_full_xml,
+ output: 'postgres.epub',
+ command: [pandoc, '-f', 'docbook', '-t', 'epub', '-o', '@OUTPUT@', '--resource-path=@CURRENT_SOURCE_DIR@',
+ '@INPUT@'],
+ build_by_default: false,
+ )
+ alldocs += postgres_epub
+endif
+
+if docs.length() == 0
+ run_target('docs', command: [missing, 'xsltproc'])
+else
+ alias_target('docs', docs)
+endif
+
+if alldocs.length() == 0
+ run_target('alldocs', command: [missing, 'xsltproc'])
+else
+ alias_target('alldocs', alldocs)
+endif
diff --git a/doc/src/sgml/version.sgml.in b/doc/src/sgml/version.sgml.in
new file mode 100644
index 00000000000..fa5ff343f40
--- /dev/null
+++ b/doc/src/sgml/version.sgml.in
@@ -0,0 +1,2 @@
+<!ENTITY version @PG_VERSION@>
+<!ENTITY majorversion @PG_MAJORVERSION@>
diff --git a/src/test/authentication/meson.build b/src/test/authentication/meson.build
new file mode 100644
index 00000000000..2374028cbda
--- /dev/null
+++ b/src/test/authentication/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'authentication',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_password.pl',
+ 't/002_saslprep.pl',
+ ],
+ },
+}
diff --git a/src/test/icu/meson.build b/src/test/icu/meson.build
new file mode 100644
index 00000000000..5a4f53f37ff
--- /dev/null
+++ b/src/test/icu/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'icu',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/010_database.pl',
+ ],
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ },
+}
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
new file mode 100644
index 00000000000..c7656fd4609
--- /dev/null
+++ b/src/test/isolation/meson.build
@@ -0,0 +1,58 @@
+# pg_regress_c helpfully provided by regress/meson.build
+
+isolation_sources = pg_regress_c + files(
+ 'isolation_main.c',
+)
+
+isolationtester_sources = files(
+ 'isolationtester.c',
+)
+
+spec_scanner = custom_target('specscanner',
+ input: 'specscanner.l',
+ output: 'specscanner.c',
+ command: flex_cmd,
+)
+isolationtester_sources += spec_scanner
+generated_sources += spec_scanner
+
+spec_parser = custom_target('specparse',
+ input: 'specparse.y',
+ kwargs: bison_kw,
+)
+isolationtester_sources += spec_parser
+generated_sources += spec_parser.to_list()
+
+pg_isolation_regress = executable('pg_isolation_regress',
+ isolation_sources,
+ c_args: pg_regress_cflags,
+ include_directories: pg_regress_inc,
+ dependencies: frontend_code,
+ kwargs: default_bin_args + {
+ 'install_dir': dir_pgxs / 'src/test/isolation',
+ },
+)
+bin_targets += pg_isolation_regress
+
+isolationtester = executable('isolationtester',
+ isolationtester_sources,
+ include_directories: include_directories('.'),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install_dir': dir_pgxs / 'src/test/isolation',
+ },
+)
+bin_targets += isolationtester
+
+tests += {
+ 'name': 'main',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'schedule': files('isolation_schedule'),
+ 'test_kwargs': {
+ 'priority': 40,
+ 'timeout': 1000,
+ },
+ },
+}
diff --git a/src/test/kerberos/meson.build b/src/test/kerberos/meson.build
new file mode 100644
index 00000000000..7e2b6733fcc
--- /dev/null
+++ b/src/test/kerberos/meson.build
@@ -0,0 +1,15 @@
+tests += {
+ 'name': 'kerberos',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'test_kwargs': {'priority': 40}, # kerberos tests are slow, start early
+ 'tests': [
+ 't/001_auth.pl',
+ ],
+ 'env': {
+ 'with_gssapi': gssapi.found() ? 'yes' : 'no',
+ 'with_krb_srvnam': 'postgres',
+ },
+ },
+}
diff --git a/src/test/ldap/meson.build b/src/test/ldap/meson.build
new file mode 100644
index 00000000000..2211bd5e3ec
--- /dev/null
+++ b/src/test/ldap/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'ldap',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_auth.pl',
+ ],
+ 'env': {'with_ldap': ldap.found() ? 'yes' : 'no'},
+ },
+}
diff --git a/src/test/meson.build b/src/test/meson.build
new file mode 100644
index 00000000000..241d9d48aa5
--- /dev/null
+++ b/src/test/meson.build
@@ -0,0 +1,25 @@
+subdir('regress')
+subdir('isolation')
+
+subdir('authentication')
+subdir('recovery')
+subdir('subscription')
+subdir('modules')
+
+if ssl.found()
+ subdir('ssl')
+endif
+
+if ldap.found()
+ subdir('ldap')
+endif
+
+if gssapi.found()
+ subdir('kerberos')
+endif
+
+if icu.found()
+ subdir('icu')
+endif
+
+subdir('perl')
diff --git a/src/test/modules/brin/meson.build b/src/test/modules/brin/meson.build
new file mode 100644
index 00000000000..58254d093a4
--- /dev/null
+++ b/src/test/modules/brin/meson.build
@@ -0,0 +1,16 @@
+tests += {
+ 'name': 'brin',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'summarization-and-inprogress-insertion',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/01_workitems.pl',
+ 't/02_wal_consistency.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/commit_ts/meson.build b/src/test/modules/commit_ts/meson.build
new file mode 100644
index 00000000000..60cb12164d2
--- /dev/null
+++ b/src/test/modules/commit_ts/meson.build
@@ -0,0 +1,18 @@
+tests += {
+ 'name': 'commit_ts',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'commit_timestamp',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_base.pl',
+ 't/002_standby.pl',
+ 't/003_standby_2.pl',
+ 't/004_restart.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build
new file mode 100644
index 00000000000..cf4bdaba637
--- /dev/null
+++ b/src/test/modules/delay_execution/meson.build
@@ -0,0 +1,18 @@
+# FIXME: prevent install during main install, but not during test :/
+delay_execution = shared_module('delay_execution',
+ ['delay_execution.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += delay_execution
+
+tests += {
+ 'name': 'delay_execution',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'specs': [
+ 'partition-addition',
+ 'partition-removal-1',
+ ],
+ },
+}
diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build
new file mode 100644
index 00000000000..56ff5f48001
--- /dev/null
+++ b/src/test/modules/dummy_index_am/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+dummy_index_am = shared_module('dummy_index_am',
+ ['dummy_index_am.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += dummy_index_am
+
+install_data(
+ 'dummy_index_am.control',
+ 'dummy_index_am--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dummy_index_am',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'reloptions',
+ ],
+ },
+}
diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build
new file mode 100644
index 00000000000..21b7cf8f353
--- /dev/null
+++ b/src/test/modules/dummy_seclabel/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+dummy_seclabel = shared_module('dummy_seclabel',
+ ['dummy_seclabel.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += dummy_seclabel
+
+install_data(
+ 'dummy_seclabel.control',
+ 'dummy_seclabel--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'dummy_seclabel',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'dummy_seclabel',
+ ],
+ },
+}
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
new file mode 100644
index 00000000000..8384b6e3b2a
--- /dev/null
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -0,0 +1,21 @@
+libpq_pipeline = executable('libpq_pipeline',
+ files(
+ 'libpq_pipeline.c',
+ ),
+ dependencies: [frontend_code, libpq],
+ kwargs: default_bin_args + {
+ 'install': false,
+ },
+)
+testprep_targets += libpq_pipeline
+
+tests += {
+ 'name': 'libpq_pipeline',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_libpq_pipeline.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/meson.build b/src/test/modules/meson.build
new file mode 100644
index 00000000000..a80e6e2ce29
--- /dev/null
+++ b/src/test/modules/meson.build
@@ -0,0 +1,27 @@
+subdir('brin')
+subdir('commit_ts')
+subdir('delay_execution')
+subdir('dummy_index_am')
+subdir('dummy_seclabel')
+subdir('libpq_pipeline')
+subdir('plsample')
+subdir('snapshot_too_old')
+subdir('spgist_name_ops')
+subdir('ssl_passphrase_callback')
+subdir('test_bloomfilter')
+subdir('test_ddl_deparse')
+subdir('test_extensions')
+subdir('test_ginpostinglist')
+subdir('test_integerset')
+subdir('test_lfind')
+subdir('test_misc')
+subdir('test_oat_hooks')
+subdir('test_parser')
+subdir('test_pg_dump')
+subdir('test_predtest')
+subdir('test_rbtree')
+subdir('test_regex')
+subdir('test_rls_hooks')
+subdir('test_shm_mq')
+subdir('unsafe_tests')
+subdir('worker_spi')
diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build
new file mode 100644
index 00000000000..45de3f1990d
--- /dev/null
+++ b/src/test/modules/plsample/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+plsample = shared_module('plsample',
+ ['plsample.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += plsample
+
+install_data(
+ 'plsample.control',
+ 'plsample--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'plsample',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'plsample',
+ ],
+ },
+}
diff --git a/src/test/modules/snapshot_too_old/meson.build b/src/test/modules/snapshot_too_old/meson.build
new file mode 100644
index 00000000000..efd3f1f113b
--- /dev/null
+++ b/src/test/modules/snapshot_too_old/meson.build
@@ -0,0 +1,14 @@
+tests += {
+ 'name': 'snapshot_too_old',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'isolation': {
+ 'test_kwargs': {'priority': 40}, # sto tests are slow, start early
+ 'specs': [
+ 'sto_using_cursor',
+ 'sto_using_select',
+ 'sto_using_hash_index',
+ ],
+ 'regress_args': ['--temp-config', files('sto.conf')],
+ },
+}
diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build
new file mode 100644
index 00000000000..857fc7e140e
--- /dev/null
+++ b/src/test/modules/spgist_name_ops/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+spgist_name_ops = shared_module('spgist_name_ops',
+ ['spgist_name_ops.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += spgist_name_ops
+
+install_data(
+ 'spgist_name_ops.control',
+ 'spgist_name_ops--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'spgist_name_ops',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'spgist_name_ops',
+ ],
+ },
+}
diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build
new file mode 100644
index 00000000000..a57bd0693a3
--- /dev/null
+++ b/src/test/modules/ssl_passphrase_callback/meson.build
@@ -0,0 +1,48 @@
+if not ssl.found()
+ subdir_done()
+endif
+
+# FIXME: prevent install during main install, but not during test :/
+ssl_passphrase_callback = shared_module('ssl_passphrase_func',
+ ['ssl_passphrase_func.c'],
+ kwargs: pg_mod_args + {
+ 'dependencies': [ssl, pg_mod_args['dependencies']],
+ },
+)
+testprep_targets += ssl_passphrase_callback
+
+# Targets to generate or remove the ssl certificate and key. Need to be copied
+# to the source afterwards. Normally not needed.
+
+openssl = find_program('openssl', native: true, required: false)
+
+if openssl.found()
+ cert = custom_target('server.crt',
+ output: ['server.crt', 'server.ckey'],
+ command: [openssl, 'req', '-new', '-x509', '-days', '10000', '-nodes', '-out', '@OUTPUT0@',
+ '-keyout', '@OUTPUT1@', '-subj', '/CN=localhost'],
+ build_by_default: false,
+ install: false,
+ )
+
+ # needs to agree with what's in the test script
+ pass = 'FooBaR1'
+
+ custom_target('server.key',
+ input: [cert[1]],
+ output: ['server.key'],
+ command: [openssl, 'rsa', '-aes256', '-in', '@INPUT0@', '-out', '@OUTPUT0@', '-passout', 'pass:@0@'.format(pass)]
+ )
+endif
+
+tests += {
+ 'name': 'ssl_passphrase_callback',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_testfunc.pl',
+ ],
+ 'env': {'with_ssl': 'openssl'},
+ },
+}
diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build
new file mode 100644
index 00000000000..945eb5a70c4
--- /dev/null
+++ b/src/test/modules/test_bloomfilter/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_bloomfilter = shared_module('test_bloomfilter',
+ ['test_bloomfilter.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_bloomfilter
+
+install_data(
+ 'test_bloomfilter.control',
+ 'test_bloomfilter--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_bloomfilter',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_bloomfilter',
+ ],
+ },
+}
diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build
new file mode 100644
index 00000000000..81ad5adc526
--- /dev/null
+++ b/src/test/modules/test_ddl_deparse/meson.build
@@ -0,0 +1,43 @@
+# FIXME: prevent install during main install, but not during test :/
+test_ddl_deparse = shared_module('test_ddl_deparse',
+ ['test_ddl_deparse.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_ddl_deparse
+
+install_data(
+ 'test_ddl_deparse.control',
+ 'test_ddl_deparse--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_ddl_deparse',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_ddl_deparse',
+ 'create_extension',
+ 'create_schema',
+ 'create_type',
+ 'create_conversion',
+ 'create_domain',
+ 'create_sequence_1',
+ 'create_table',
+ 'create_transform',
+ 'alter_table',
+ 'create_view',
+ 'create_trigger',
+ 'create_rule',
+ 'comment_on',
+ 'alter_function',
+ 'alter_sequence',
+ 'alter_ts_config',
+ 'alter_type_enum',
+ 'opfamily',
+ 'defprivs',
+ 'matviews',
+ ],
+ },
+}
diff --git a/src/test/modules/test_extensions/meson.build b/src/test/modules/test_extensions/meson.build
new file mode 100644
index 00000000000..e95a9f2e7eb
--- /dev/null
+++ b/src/test/modules/test_extensions/meson.build
@@ -0,0 +1,45 @@
+# FIXME: prevent install during main install, but not during test :/
+install_data(
+ 'test_ext1--1.0.sql',
+ 'test_ext1.control',
+ 'test_ext2--1.0.sql',
+ 'test_ext2.control',
+ 'test_ext3--1.0.sql',
+ 'test_ext3.control',
+ 'test_ext4--1.0.sql',
+ 'test_ext4.control',
+ 'test_ext5--1.0.sql',
+ 'test_ext5.control',
+ 'test_ext6--1.0.sql',
+ 'test_ext6.control',
+ 'test_ext7--1.0--2.0.sql',
+ 'test_ext7--1.0.sql',
+ 'test_ext7.control',
+ 'test_ext8--1.0.sql',
+ 'test_ext8.control',
+ 'test_ext_cine--1.0.sql',
+ 'test_ext_cine--1.0--1.1.sql',
+ 'test_ext_cine.control',
+ 'test_ext_cor--1.0.sql',
+ 'test_ext_cor.control',
+ 'test_ext_cyclic1--1.0.sql',
+ 'test_ext_cyclic1.control',
+ 'test_ext_cyclic2--1.0.sql',
+ 'test_ext_cyclic2.control',
+ 'test_ext_evttrig--1.0--2.0.sql',
+ 'test_ext_evttrig--1.0.sql',
+ 'test_ext_evttrig.control',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_extensions',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_extensions',
+ 'test_extdepend',
+ ],
+ },
+}
diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build
new file mode 100644
index 00000000000..abf0a3b0430
--- /dev/null
+++ b/src/test/modules/test_ginpostinglist/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_ginpostinglist = shared_module('test_ginpostinglist',
+ ['test_ginpostinglist.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_ginpostinglist
+
+install_data(
+ 'test_ginpostinglist.control',
+ 'test_ginpostinglist--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_ginpostinglist',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_ginpostinglist',
+ ],
+ },
+}
diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build
new file mode 100644
index 00000000000..c32c469c69a
--- /dev/null
+++ b/src/test/modules/test_integerset/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_integerset = shared_module('test_integerset',
+ ['test_integerset.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_integerset
+
+install_data(
+ 'test_integerset.control',
+ 'test_integerset--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_integerset',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_integerset',
+ ],
+ },
+}
diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build
new file mode 100644
index 00000000000..a388de1156a
--- /dev/null
+++ b/src/test/modules/test_lfind/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_lfind = shared_module('test_lfind',
+ ['test_lfind.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_lfind
+
+install_data(
+ 'test_lfind.control',
+ 'test_lfind--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_lfind',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_lfind',
+ ],
+ },
+}
diff --git a/src/test/modules/test_misc/meson.build b/src/test/modules/test_misc/meson.build
new file mode 100644
index 00000000000..cfc830ff399
--- /dev/null
+++ b/src/test/modules/test_misc/meson.build
@@ -0,0 +1,12 @@
+tests += {
+ 'name': 'test_misc',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'tests': [
+ 't/001_constraint_validation.pl',
+ 't/002_tablespace.pl',
+ 't/003_check_guc.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
new file mode 100644
index 00000000000..5faf0459777
--- /dev/null
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -0,0 +1,18 @@
+# FIXME: prevent install during main install, but not during test :/
+test_oat_hooks = shared_module('test_oat_hooks',
+ ['test_oat_hooks.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_oat_hooks
+
+tests += {
+ 'name': 'test_oat_hooks',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_oat_hooks',
+ ],
+ 'regress_args': ['--no-locale', '--encoding=UTF8'],
+ },
+}
diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build
new file mode 100644
index 00000000000..b59960f615e
--- /dev/null
+++ b/src/test/modules/test_parser/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_parser = shared_module('test_parser',
+ ['test_parser.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_parser
+
+install_data(
+ 'test_parser.control',
+ 'test_parser--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_parser',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_parser',
+ ],
+ },
+}
diff --git a/src/test/modules/test_pg_dump/meson.build b/src/test/modules/test_pg_dump/meson.build
new file mode 100644
index 00000000000..41021829f3a
--- /dev/null
+++ b/src/test/modules/test_pg_dump/meson.build
@@ -0,0 +1,22 @@
+# FIXME: prevent install during main install, but not during test :/
+install_data(
+ 'test_pg_dump.control',
+ 'test_pg_dump--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_pg_dump',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_pg_dump',
+ ],
+ },
+ 'tap': {
+ 'tests': [
+ 't/001_base.pl',
+ ],
+ },
+}
diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build
new file mode 100644
index 00000000000..1cfa84b3609
--- /dev/null
+++ b/src/test/modules/test_predtest/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_predtest = shared_module('test_predtest',
+ ['test_predtest.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_predtest
+
+install_data(
+ 'test_predtest.control',
+ 'test_predtest--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_predtest',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_predtest',
+ ],
+ },
+}
diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build
new file mode 100644
index 00000000000..34cbc3e1624
--- /dev/null
+++ b/src/test/modules/test_rbtree/meson.build
@@ -0,0 +1,23 @@
+# FIXME: prevent install during main install, but not during test :/
+test_rbtree = shared_module('test_rbtree',
+ ['test_rbtree.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_rbtree
+
+install_data(
+ 'test_rbtree.control',
+ 'test_rbtree--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_rbtree',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_rbtree',
+ ],
+ },
+}
diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build
new file mode 100644
index 00000000000..867a64e57c3
--- /dev/null
+++ b/src/test/modules/test_regex/meson.build
@@ -0,0 +1,24 @@
+# FIXME: prevent install during main install, but not during test :/
+test_regex = shared_module('test_regex',
+ ['test_regex.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_regex
+
+install_data(
+ 'test_regex.control',
+ 'test_regex--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_regex',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_regex',
+ 'test_regex_utf8',
+ ],
+ },
+}
diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build
new file mode 100644
index 00000000000..80d8adda332
--- /dev/null
+++ b/src/test/modules/test_rls_hooks/meson.build
@@ -0,0 +1,17 @@
+# FIXME: prevent install during main install, but not during test :/
+test_rls_hooks = shared_module('test_rls_hooks',
+ ['test_rls_hooks.c'],
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_rls_hooks
+
+tests += {
+ 'name': 'test_rls_hooks',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_rls_hooks',
+ ],
+ },
+}
diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build
new file mode 100644
index 00000000000..b663543d616
--- /dev/null
+++ b/src/test/modules/test_shm_mq/meson.build
@@ -0,0 +1,27 @@
+# FIXME: prevent install during main install, but not during test :/
+test_shm_mq = shared_module('test_shm_mq',
+ files(
+ 'setup.c',
+ 'test.c',
+ 'worker.c',
+ ),
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_shm_mq
+
+install_data(
+ 'test_shm_mq.control',
+ 'test_shm_mq--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'test_shm_mq',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'test_shm_mq',
+ ],
+ },
+}
diff --git a/src/test/modules/unsafe_tests/meson.build b/src/test/modules/unsafe_tests/meson.build
new file mode 100644
index 00000000000..d69b0e7ce44
--- /dev/null
+++ b/src/test/modules/unsafe_tests/meson.build
@@ -0,0 +1,11 @@
+tests += {
+ 'name': 'unsafe_tests',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'rolenames',
+ 'alter_system_table',
+ ],
+ },
+}
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
new file mode 100644
index 00000000000..32acad883b2
--- /dev/null
+++ b/src/test/modules/worker_spi/meson.build
@@ -0,0 +1,26 @@
+# FIXME: prevent install during main install, but not during test :/
+test_worker_spi = shared_module('worker_spi',
+ files(
+ 'worker_spi.c',
+ ),
+ kwargs: pg_mod_args,
+)
+testprep_targets += test_worker_spi
+
+install_data(
+ 'worker_spi.control',
+ 'worker_spi--1.0.sql',
+ kwargs: contrib_data_args,
+)
+
+tests += {
+ 'name': 'worker_spi',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'sql': [
+ 'worker_spi',
+ ],
+ 'regress_args': ['--temp-config', files('dynamic.conf'), '--dbname=contrib_regression'],
+ },
+}
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
new file mode 100644
index 00000000000..901bae7a564
--- /dev/null
+++ b/src/test/perl/meson.build
@@ -0,0 +1,12 @@
+# could use install_data's preserve_path option in >=0.64.0
+
+install_data(
+ 'PostgreSQL/Version.pm',
+ install_dir: dir_pgxs / 'src/test/perl/PostgreSQL')
+
+install_data(
+ 'PostgreSQL/Test/Utils.pm',
+ 'PostgreSQL/Test/SimpleTee.pm',
+ 'PostgreSQL/Test/RecursiveCopy.pm',
+ 'PostgreSQL/Test/Cluster.pm',
+ install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
diff --git a/src/test/recovery/meson.build b/src/test/recovery/meson.build
new file mode 100644
index 00000000000..b0e398363f7
--- /dev/null
+++ b/src/test/recovery/meson.build
@@ -0,0 +1,43 @@
+tests += {
+ 'name': 'recovery',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'test_kwargs': {'priority': 40}, # recovery tests are slow, start early
+ 'tests': [
+ 't/001_stream_rep.pl',
+ 't/002_archiving.pl',
+ 't/003_recovery_targets.pl',
+ 't/004_timeline_switch.pl',
+ 't/005_replay_delay.pl',
+ 't/006_logical_decoding.pl',
+ 't/007_sync_rep.pl',
+ 't/008_fsm_truncation.pl',
+ 't/009_twophase.pl',
+ 't/010_logical_decoding_timelines.pl',
+ 't/011_crash_recovery.pl',
+ 't/012_subtransactions.pl',
+ 't/013_crash_restart.pl',
+ 't/014_unlogged_reinit.pl',
+ 't/015_promotion_pages.pl',
+ 't/016_min_consistency.pl',
+ 't/017_shm.pl',
+ 't/018_wal_optimize.pl',
+ 't/019_replslot_limit.pl',
+ 't/020_archive_status.pl',
+ 't/021_row_visibility.pl',
+ 't/022_crash_temp_files.pl',
+ 't/023_pitr_prepared_xact.pl',
+ 't/024_archive_recovery.pl',
+ 't/025_stuck_on_old_timeline.pl',
+ 't/026_overwrite_contrecord.pl',
+ 't/027_stream_regress.pl',
+ 't/028_pitr_timelines.pl',
+ 't/029_stats_restart.pl',
+ 't/030_stats_cleanup_replica.pl',
+ 't/031_recovery_conflict.pl',
+ 't/032_relfilenode_reuse.pl',
+ 't/033_replay_tsp_drops.pl',
+ ],
+ },
+}
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
new file mode 100644
index 00000000000..fd8ee995b79
--- /dev/null
+++ b/src/test/regress/meson.build
@@ -0,0 +1,62 @@
+# also used by isolationtester and ecpg tests
+pg_regress_c = files('pg_regress.c')
+pg_regress_inc = include_directories('.')
+
+regress_sources = pg_regress_c + files(
+ 'pg_regress_main.c'
+)
+
+pg_regress_cflags = ['-DHOST_TUPLE="frak"', '-DSHELLPROG="/bin/sh"']
+
+pg_regress = executable('pg_regress',
+ regress_sources,
+ c_args: pg_regress_cflags,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args + {
+ 'install_dir': dir_pgxs / 'src/test/regress',
+ },
+)
+bin_targets += pg_regress
+
+regress_module = shared_module('regress',
+ ['regress.c'],
+ kwargs: pg_mod_args + {
+ 'install': false,
+ },
+)
+testprep_targets += regress_module
+
+# Get some extra C modules from contrib/spi but mark them as not to be
+# installed.
+# FIXME: avoid the duplication.
+
+autoinc_regress = shared_module('autoinc',
+ ['../../../contrib/spi/autoinc.c'],
+ kwargs: pg_mod_args + {
+ 'install': false,
+ },
+)
+testprep_targets += autoinc_regress
+
+refint_regress = shared_module('refint',
+ ['../../../contrib/spi/refint.c'],
+ c_args: refint_cflags,
+ kwargs: pg_mod_args + {
+ 'install': false,
+ },
+)
+testprep_targets += refint_regress
+
+
+tests += {
+ 'name': 'main',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'regress': {
+ 'schedule': files('parallel_schedule'),
+ 'test_kwargs': {
+ 'priority': 50,
+ 'timeout': 1000,
+ },
+ },
+}
diff --git a/src/test/ssl/meson.build b/src/test/ssl/meson.build
new file mode 100644
index 00000000000..e2f021d884a
--- /dev/null
+++ b/src/test/ssl/meson.build
@@ -0,0 +1,13 @@
+tests += {
+ 'name': 'ssl',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_ssl': get_option('ssl')},
+ 'tests': [
+ 't/001_ssltests.pl',
+ 't/002_scram.pl',
+ 't/003_sslinfo.pl',
+ ],
+ },
+}
diff --git a/src/test/subscription/meson.build b/src/test/subscription/meson.build
new file mode 100644
index 00000000000..85d1dd92951
--- /dev/null
+++ b/src/test/subscription/meson.build
@@ -0,0 +1,42 @@
+tests += {
+ 'name': 'subscription',
+ 'sd': meson.current_source_dir(),
+ 'bd': meson.current_build_dir(),
+ 'tap': {
+ 'env': {'with_icu': icu.found() ? 'yes' : 'no'},
+ 'tests': [
+ 't/001_rep_changes.pl',
+ 't/002_types.pl',
+ 't/003_constraints.pl',
+ 't/004_sync.pl',
+ 't/005_encoding.pl',
+ 't/006_rewrite.pl',
+ 't/007_ddl.pl',
+ 't/008_diff_schema.pl',
+ 't/009_matviews.pl',
+ 't/010_truncate.pl',
+ 't/011_generated.pl',
+ 't/012_collation.pl',
+ 't/013_partition.pl',
+ 't/014_binary.pl',
+ 't/015_stream.pl',
+ 't/016_stream_subxact.pl',
+ 't/017_stream_ddl.pl',
+ 't/018_stream_subxact_abort.pl',
+ 't/019_stream_subxact_ddl_abort.pl',
+ 't/020_messages.pl',
+ 't/021_twophase.pl',
+ 't/022_twophase_cascade.pl',
+ 't/023_twophase_stream.pl',
+ 't/024_add_drop_pub.pl',
+ 't/025_rep_changes_for_schema.pl',
+ 't/026_stats.pl',
+ 't/027_nosuperuser.pl',
+ 't/028_row_filter.pl',
+ 't/029_on_error.pl',
+ 't/030_origin.pl',
+ 't/031_column_list.pl',
+ 't/100_bugs.pl',
+ ],
+ },
+}
diff --git a/configure b/configure
index 4efed743a1a..1caca21b625 100755
--- a/configure
+++ b/configure
@@ -20658,3 +20658,9 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
+
+# Ensure that any meson build directories would reconfigure and see that
+# there's a conflicting in-tree build and can error out.
+if test "$vpath_build"="no"; then
+ touch meson.build
+fi
diff --git a/configure.ac b/configure.ac
index 967f7e72090..10fa55dd154 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2472,3 +2472,9 @@ AC_CONFIG_HEADERS([src/interfaces/ecpg/include/ecpg_config.h],
[echo >src/interfaces/ecpg/include/stamp-h])
AC_OUTPUT
+
+# Ensure that any meson build directories would reconfigure and see that
+# there's a conflicting in-tree build and can error out.
+if test "$vpath_build"="no"; then
+ touch meson.build
+fi
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..b1464ec7413
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,3025 @@
+# Entry point for building PostgreSQL with meson
+#
+# Good starting points for writing meson.build files are:
+# - https://mesonbuild.com/Syntax.html
+# - https://mesonbuild.com/Reference-manual.html
+
+project('postgresql',
+ ['c'],
+ version: '16devel',
+ license: 'PostgreSQL',
+
+ # We want < 0.56 for python 3.5 compatibility on old platforms. EPEL for
+ # RHEL 7 has 0.55. < 0.54 would require replacing some uses of the fs
+ # module, < 0.53 all uses of fs. So far there's no need to go to >=0.56.
+ meson_version: '>=0.54',
+ default_options: [
+ 'warning_level=1', #-Wall equivalent
+ 'buildtype=release',
+ ]
+)
+
+
+
+###############################################################
+# Basic prep
+###############################################################
+
+fs = import('fs')
+pkgconfig = import('pkgconfig')
+
+host_system = host_machine.system()
+host_cpu = host_machine.cpu_family()
+
+cc = meson.get_compiler('c')
+
+not_found_dep = dependency('', required: false)
+thread_dep = dependency('threads')
+
+
+
+###############################################################
+# Safety first
+###############################################################
+
+# It's very easy to get into confusing states when the source directory
+# contains an in-place build. E.g. the wrong pg_config.h will be used. So just
+# refuse to build in that case.
+#
+# There's a more elaborate check later, that checks for conflicts around all
+# generated files. But we can only do that much further down the line, so this
+# quick check seems worth it. Adhering to this advice should clean up the
+# conflict, but won't protect against somebody doing make distclean or just
+# removing pg_config.h
+errmsg_nonclean_base = '''
+****
+Non-clean source code directory detected.
+
+To build with meson the source tree may not have an in-place, ./configure
+style, build configured. You can have both meson and ./configure style builds
+for the same source tree by building out-of-source / VPATH with
+configure. Alternatively use a separate check out for meson based builds.
+
+@0@
+****'''
+if fs.exists(meson.current_source_dir() / 'src' / 'include' / 'pg_config.h')
+ errmsg_cleanup = 'To clean up, run make maintainer-clean in the source tree.'
+ error(errmsg_nonclean_base.format(errmsg_cleanup))
+endif
+
+
+
+###############################################################
+# Variables to be determined
+###############################################################
+
+postgres_inc_d = ['src/include']
+postgres_inc_d += get_option('extra_include_dirs')
+
+postgres_lib_d = get_option('extra_lib_dirs')
+
+cppflags = []
+
+cflags = []
+cxxflags = []
+cflags_warn = []
+cxxflags_warn = []
+cflags_mod = []
+cxxflags_mod = []
+
+ldflags = []
+ldflags_be = []
+ldflags_sl = []
+ldflags_mod = []
+
+test_c_args = []
+
+os_deps = []
+backend_both_deps = []
+backend_deps = []
+libpq_deps = []
+
+pg_sysroot = ''
+
+# source of data for pg_config.h etc
+cdata = configuration_data()
+
+
+
+###############################################################
+# Version and other metadata
+###############################################################
+
+pg_version = meson.project_version()
+
+if pg_version.endswith('devel')
+ pg_version_arr = [pg_version.split('devel')[0], '0']
+elif pg_version.contains('beta')
+ pg_version_arr = [pg_version.split('beta')[0], '0']
+elif pg_version.contains('rc')
+ pg_version_arr = [pg_version.split('rc')[0], '0']
+else
+ pg_version_arr = pg_version.split('.')
+endif
+
+pg_version_major = pg_version_arr[0].to_int()
+pg_version_minor = pg_version_arr[1].to_int()
+pg_version_num = (pg_version_major * 10000) + pg_version_minor
+
+pg_url = 'https://www.postgresql.org/'
+
+cdata.set_quoted('PACKAGE_NAME', 'PostgreSQL')
+cdata.set_quoted('PACKAGE_BUGREPORT', 'pgsql-bugs@lists.postgresql.org')
+cdata.set_quoted('PACKAGE_URL', pg_url)
+cdata.set_quoted('PACKAGE_VERSION', pg_version)
+cdata.set_quoted('PACKAGE_STRING', 'PostgreSQL @0@'.format(pg_version))
+cdata.set_quoted('PACKAGE_TARNAME', 'postgresql')
+
+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, build_machine.cpu_family(), cc.get_id(), cc.version()))
+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)
+cdata.set_quoted('CONFIGURE_ARGS', '')
+
+
+
+###############################################################
+# Basic platform specific configuration
+###############################################################
+
+# meson's system names don't quite map to our "traditional" names. In some
+# places we need the "traditional" name, e.g., for mapping
+# src/include/port/$os.h to src/include/pg_config_os.h. Define portname for
+# that purpose.
+portname = host_system
+
+exesuffix = '' # overridden below where necessary
+dlsuffix = '.so' # overridden below where necessary
+library_path_var = 'LD_LIBRARY_PATH'
+
+# Format of file to control exports from libraries, and how to pass them to
+# the compiler. For export_fmt @0@ is the path to the file export file.
+export_file_format = 'gnu'
+export_file_suffix = 'list'
+export_fmt = '-Wl,--version-script=@0@'
+
+# Flags to add when linking a postgres extension, @0@ is path to
+# the relevant object on the platform.
+mod_link_args_fmt = []
+
+memset_loop_limit = 1024
+
+# Choice of shared memory and semaphore implementation
+shmem_kind = 'sysv'
+sema_kind = 'sysv'
+
+# We implement support for some operating systems by pretending they're
+# another. Map here, before determining system properties below
+if host_system == 'dragonfly'
+ # apparently the most similar
+ host_system = 'netbsd'
+endif
+
+if host_system == 'aix'
+ ld_library_path_var = 'LIBPATH'
+
+ export_file_format = 'aix'
+ export_fmt = '-Wl,-bE:@0@'
+ mod_link_args_fmt = ['-Wl,-bI:@0@']
+ mod_link_with_dir = 'libdir'
+ mod_link_with_name = '@0@.imp'
+
+ # M:SRE sets a flag indicating that an object is a shared library. Seems to
+ # work in some circumstances without, but required in others.
+ ldflags_sl += '-Wl,-bM:SRE'
+ ldflags_be += '-Wl,-brtllib'
+
+ # Native memset() is faster, tested on:
+ # - AIX 5.1 and 5.2, XLC 6.0 (IBM's cc)
+ # - AIX 5.3 ML3, gcc 4.0.1
+ memset_loop_limit = 0
+
+elif host_system == 'cygwin'
+ cppflags += '-D_GNU_SOURCE'
+
+elif host_system == 'darwin'
+ dlsuffix = '.dylib'
+ ld_library_path_var = 'DYLD_LIBRARY_PATH'
+
+ export_file_format = 'darwin'
+ export_fmt = '-exported_symbols_list=@0@'
+
+ mod_link_args_fmt = ['-bundle_loader', '@0@']
+ mod_link_with_dir = 'bindir'
+ mod_link_with_name = '@0@'
+
+ sysroot_args = [files('src/tools/darwin_sysroot'), get_option('darwin_sysroot')]
+ pg_sysroot = run_command(sysroot_args, check:true).stdout().strip()
+ message('darwin sysroot: @0@'.format(pg_sysroot))
+ cflags += ['-isysroot', pg_sysroot]
+ ldflags += ['-isysroot', pg_sysroot]
+
+elif host_system == 'freebsd'
+ sema_kind = 'unnamed_posix'
+
+elif host_system == 'linux'
+ sema_kind = 'unnamed_posix'
+ cppflags += '-D_GNU_SOURCE'
+
+elif host_system == 'netbsd'
+ # We must resolve all dynamic linking in the core server at program start.
+ # Otherwise the postmaster can self-deadlock due to signals interrupting
+ # resolution of calls, since NetBSD's linker takes a lock while doing that
+ # and some postmaster signal handlers do things that will also acquire that
+ # lock. As long as we need "-z now", might as well specify "-z relro" too.
+ # While there's not a hard reason to adopt these settings for our other
+ # executables, there's also little reason not to, so just add them to
+ # LDFLAGS.
+ ldflags += ['-Wl,-z,now', '-Wl,-z,relro']
+
+elif host_system == 'openbsd'
+ # you're ok
+
+elif host_system == 'sunos'
+ portname = 'solaris'
+ export_fmt = '-Wl,-M@0@'
+ cppflags += '-D_POSIX_PTHREAD_SEMANTICS'
+
+elif host_system == 'windows'
+ portname = 'win32'
+ exesuffix = '.exe'
+ dlsuffix = '.dll'
+ ld_library_path_var = ''
+
+ export_file_format = 'win'
+ export_file_suffix = 'def'
+ if cc.get_id() == 'msvc'
+ export_fmt = '/DEF:@0@'
+ mod_link_with_name = '@0@.exe.lib'
+ else
+ export_fmt = '@0@'
+ mod_link_with_name = 'lib@0@.exe.a'
+ endif
+ mod_link_args_fmt = ['@0@']
+ mod_link_with_dir = 'libdir'
+
+ shmem_kind = 'win32'
+ sema_kind = 'win32'
+
+ cdata.set('WIN32_STACK_RLIMIT', 4194304)
+ if cc.get_id() == 'msvc'
+ ldflags += '/INCREMENTAL:NO'
+ ldflags += '/STACK:@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))
+ # ldflags += '/nxcompat' # generated by msbuild, should have it for ninja?
+ else
+ ldflags += '-Wl,--stack,@0@'.format(cdata.get('WIN32_STACK_RLIMIT'))
+ endif
+
+ os_deps += cc.find_library('ws2_32', required: true)
+ secur32_dep = cc.find_library('secur32', required: true)
+ backend_deps += secur32_dep
+ libpq_deps += secur32_dep
+
+ postgres_inc_d += 'src/include/port/win32'
+ if cc.get_id() == 'msvc'
+ postgres_inc_d += 'src/include/port/win32_msvc'
+ endif
+
+ windows = import('windows')
+
+else
+ # XXX: Should we add an option to override the host_system as an escape
+ # hatch?
+ error('unknown host system: @0@'.format(host_system))
+endif
+
+
+
+###############################################################
+# Program paths
+###############################################################
+
+# External programs
+perl = find_program(get_option('PERL'), required: true, native: true)
+python = find_program(get_option('PYTHON'), required: true, native: true)
+flex = find_program(get_option('FLEX'), native: true, version: '>= 2.5.31')
+bison = find_program(get_option('BISON'), native: true, version: '>= 1.875')
+sed = find_program(get_option('SED'), 'sed', native: true)
+prove = find_program(get_option('PROVE'), native: true)
+tar = find_program(get_option('TAR'), native: true)
+gzip = find_program(get_option('GZIP'), native: true)
+program_lz4 = find_program(get_option('LZ4'), native: true, required: false)
+touch = find_program('touch', native: true)
+program_zstd = find_program(get_option('ZSTD'), native: true, required: false)
+dtrace = find_program(get_option('DTRACE'), native: true, required: get_option('dtrace'))
+missing = find_program('config/missing', native: true)
+
+# used by PGXS
+install_sh = find_program('config/install-sh', native: true)
+
+bison_flags = []
+if bison.found()
+ bison_version_c = run_command(bison, '--version', check: true)
+ # bison version string helpfully is something like
+ # >>bison (GNU bison) 3.8.1<<
+ bison_version = bison_version_c.stdout().split(' ')[3].split('\n')[0]
+ if bison_version.version_compare('>=3.0')
+ bison_flags += ['-Wno-deprecated']
+ endif
+endif
+bison_cmd = [bison, bison_flags, '-o', '@OUTPUT0@', '-d', '@INPUT@']
+bison_kw = {
+ 'output': ['@BASENAME@.c', '@BASENAME@.h'],
+ 'command': bison_cmd,
+}
+
+flex_flags = []
+flex_wrapper = files('src/tools/pgflex')
+flex_cmd = [python, flex_wrapper,
+ '--builddir', '@BUILD_ROOT@',
+ '--srcdir', '@SOURCE_ROOT@',
+ '--privatedir', '@PRIVATE_DIR@',
+ '--flex', flex, '--perl', perl,
+ '-i', '@INPUT@', '-o', '@OUTPUT0@',
+]
+
+wget = find_program('wget', required: false, native: true)
+wget_flags = ['-O', '@OUTPUT0@', '--no-use-server-timestamps']
+
+
+
+###############################################################
+# Path to meson (for tests etc)
+###############################################################
+
+# NB: this should really be part of meson, see
+# 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() == ''
+ error('huh, could not run find_meson.\nerrcode: @0@\nstdout: @1@\nstderr: @2@'.format(
+ meson_binpath_r.returncode(),
+ meson_binpath_r.stdout(),
+ meson_binpath_r.stderr()))
+endif
+
+meson_binpath_s = meson_binpath_r.stdout().split('\n')
+meson_binpath_len = meson_binpath_s.length()
+
+if meson_binpath_len < 1
+ error('unexpected introspect line @0@'.format(meson_binpath_r.stdout()))
+endif
+
+i = 0
+meson_impl = ''
+meson_binpath = ''
+meson_args = []
+foreach e : meson_binpath_s
+ if i == 0
+ meson_impl = e
+ elif i == 1
+ meson_binpath = e
+ else
+ meson_args += e
+ endif
+ i += 1
+endforeach
+
+if meson_impl not in ['muon', 'meson']
+ error('unknown meson implementation "@0@"'.format(meson_impl))
+endif
+
+meson_bin = find_program(meson_binpath, native: true)
+
+
+
+###############################################################
+# Option Handling
+###############################################################
+
+cdata.set('USE_ASSERT_CHECKING', get_option('cassert') ? 1 : false)
+
+cdata.set('BLCKSZ', get_option('blocksize').to_int() * 1024, description:
+'''Size of a disk block --- this also limits the size of a tuple. You can set
+ it bigger if you need bigger tuples (although TOAST should reduce the need
+ to have large tuples, since fields can be spread across multiple tuples).
+ BLCKSZ must be a power of 2. The maximum possible value of BLCKSZ is
+ currently 2^15 (32768). This is determined by the 15-bit widths of the
+ lp_off and lp_len fields in ItemIdData (see include/storage/itemid.h).
+ Changing BLCKSZ requires an initdb.''')
+
+cdata.set('XLOG_BLCKSZ', get_option('wal_blocksize').to_int() * 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').to_string())
+cdata.set_quoted('PG_KRB_SRVNAM', get_option('krb_srvnam'))
+if get_option('system_tzdata') != ''
+ cdata.set_quoted('SYSTEMTZDIR', get_option('system_tzdata'))
+endif
+
+
+
+###############################################################
+# Directories
+###############################################################
+
+# These are set by the equivalent --xxxdir configure options. We
+# append "postgresql" to some of them, if the string does not already
+# contain "pgsql" or "postgres", in order to avoid directory clutter.
+
+pkg = 'postgresql'
+
+dir_prefix = get_option('prefix')
+
+dir_bin = get_option('bindir')
+
+dir_data = get_option('datadir')
+if not (dir_data.contains('pgsql') or dir_data.contains('postgres'))
+ dir_data = dir_data / pkg
+endif
+
+dir_sysconf = get_option('sysconfdir')
+if not (dir_sysconf.contains('pgsql') or dir_sysconf.contains('postgres'))
+ dir_sysconf = dir_sysconf / pkg
+endif
+
+dir_lib = get_option('libdir')
+
+dir_lib_pkg = dir_lib
+if not (dir_lib_pkg.contains('pgsql') or dir_lib_pkg.contains('postgres'))
+ dir_lib_pkg = dir_lib_pkg / pkg
+endif
+
+dir_pgxs = dir_lib_pkg / 'pgxs'
+
+dir_include = get_option('includedir')
+
+dir_include_pkg = dir_include
+dir_include_pkg_rel = ''
+if not (dir_include_pkg.contains('pgsql') or dir_include_pkg.contains('postgres'))
+ dir_include_pkg = dir_include_pkg / pkg
+ dir_include_pkg_rel = pkg
+endif
+
+dir_man = get_option('mandir')
+
+# FIXME: These used to be separately configurable - worth adding?
+dir_doc = get_option('datadir') / 'doc' / 'postgresql'
+dir_doc_html = dir_doc
+
+dir_locale = get_option('localedir')
+
+
+# Derived values
+dir_bitcode = dir_lib_pkg / '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'
+
+
+
+###############################################################
+# Search paths, preparation for compiler tests
+#
+# NB: Arguments added later are not automatically used for subsequent
+# configuration-time checks (so they are more isolated). If they should be
+# used, they need to be added to test_c_args as well.
+###############################################################
+
+postgres_inc = [include_directories(postgres_inc_d)]
+test_lib_d = postgres_lib_d
+test_c_args = cppflags + cflags
+
+
+
+###############################################################
+# Library: bsd-auth
+###############################################################
+
+bsd_authopt = get_option('bsd_auth')
+bsd_auth = not_found_dep
+if cc.check_header('bsd_auth.h', required: bsd_authopt,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('USE_BSD_AUTH', 1)
+ bsd_auth = declare_dependency()
+endif
+
+
+
+###############################################################
+# Library: bonjour
+#
+# For now don't search for DNSServiceRegister in a library - only Apple's
+# Bonjour implementation, which is always linked, works.
+###############################################################
+
+bonjouropt = get_option('bonjour')
+bonjour = dependency('', required : false)
+if cc.check_header('dns_sd.h', required: bonjouropt,
+ args: test_c_args, include_directories: postgres_inc) and \
+ cc.has_function('DNSServiceRegister',
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('USE_BONJOUR', 1)
+ bonjour = declare_dependency()
+endif
+
+
+
+###############################################################
+# Library: GSSAPI
+###############################################################
+
+gssapiopt = get_option('gssapi')
+krb_srvtab = ''
+have_gssapi = false
+if not gssapiopt.disabled()
+ gssapi = dependency('krb5-gssapi', required: gssapiopt)
+ have_gssapi = gssapi.found()
+
+ if not have_gssapi
+ elif cc.check_header('gssapi/gssapi.h', dependencies: gssapi, required: false,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_GSSAPI_GSSAPI_H', 1)
+ elif cc.check_header('gssapi.h', args: test_c_args, dependencies: gssapi, required: gssapiopt)
+ cdata.set('HAVE_GSSAPI_H', 1)
+ else
+ have_gssapi = false
+ endif
+
+ if not have_gssapi
+ elif cc.has_function('gss_init_sec_context', dependencies: gssapi,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('ENABLE_GSS', 1)
+
+ krb_srvtab = 'FILE:/@0@/krb5.keytab)'.format(get_option('sysconfdir'))
+ cdata.set_quoted('PG_KRB_SRVTAB', krb_srvtab)
+ elif gssapiopt.enabled()
+ error('''could not find function 'gss_init_sec_context' required for GSSAPI''')
+ else
+ have_gssapi = false
+ endif
+endif
+if not have_gssapi
+ gssapi = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: ldap
+###############################################################
+
+ldapopt = get_option('ldap')
+if host_system == 'windows'
+ ldap = cc.find_library('wldap32', required: ldapopt)
+ ldap_r = ldap
+else
+ # macos framework dependency is buggy for ldap (one can argue whether it's
+ # Apple's or meson's fault), leading to an endless recursion with ldap.h
+ # including itself. See https://github.com/mesonbuild/meson/issues/10002
+ # Luckily we only need pkg-config support, so the workaround isn't
+ # complicated.
+ ldap = dependency('ldap', method: 'pkg-config', required: false)
+ ldap_r = ldap
+
+ # Before 2.5 openldap didn't have a pkg-config file, and it might not be
+ # installed
+ if not ldap.found()
+ ldap = cc.find_library('ldap', required: ldapopt, dirs: test_lib_d,
+ has_headers: 'ldap.h', header_include_directories: postgres_inc)
+
+ # The separate ldap_r library only exists in OpenLDAP < 2.5, and if we
+ # have 2.5 or later, we shouldn't even probe for ldap_r (we might find a
+ # library from a separate OpenLDAP installation). The most reliable
+ # way to check that is to check for a function introduced in 2.5.
+ if not ldap.found()
+ # don't have ldap, we shouldn't check for ldap_r
+ elif cc.has_function('ldap_verify_credentials',
+ dependencies: ldap, args: test_c_args)
+ ldap_r = ldap # ldap >= 2.5, no need for ldap_r
+ else
+
+ # Use ldap_r for FE if available, else assume ldap is thread-safe.
+ ldap_r = cc.find_library('ldap_r', required: false, dirs: test_lib_d,
+ has_headers: 'ldap.h', header_include_directories: postgres_inc)
+ if not ldap_r.found()
+ ldap_r = ldap
+ else
+ # On some platforms ldap_r fails to link without PTHREAD_LIBS.
+ ldap_r = declare_dependency(dependencies: [ldap_r, thread_dep])
+ endif
+
+ # PostgreSQL sometimes loads libldap_r and plain libldap into the same
+ # process. Check for OpenLDAP versions known not to tolerate doing so;
+ # assume non-OpenLDAP implementations are safe. The dblink test suite
+ # exercises the hazardous interaction directly.
+ compat_test_code = '''
+#include <ldap.h>
+#if !defined(LDAP_VENDOR_VERSION) || \
+ (defined(LDAP_API_FEATURE_X_OPENLDAP) && \
+ LDAP_VENDOR_VERSION >= 20424 && LDAP_VENDOR_VERSION <= 20431)
+choke me
+#endif
+'''
+ if not cc.compiles(compat_test_code,
+ name: 'LDAP implementation compatible',
+ dependencies: ldap, args: test_c_args)
+ warning('''
+*** With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, each backend
+*** process that loads libpq (via WAL receiver, dblink, or postgres_fdw) and
+*** also uses LDAP will crash on exit.''')
+ endif
+ 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)
+ endif
+endif
+
+if ldap.found()
+ assert(ldap_r.found())
+ cdata.set('USE_LDAP', 1)
+else
+ assert(not ldap_r.found())
+endif
+
+
+
+###############################################################
+# Library: LLVM
+###############################################################
+
+llvmopt = get_option('llvm')
+if not llvmopt.disabled()
+ add_languages('cpp', required: true, native: false)
+ llvm = dependency('llvm', version: '>=3.9', method: 'config-tool', required: llvmopt)
+
+ if llvm.found()
+
+ cdata.set('USE_LLVM', 1)
+
+ cpp = meson.get_compiler('cpp')
+
+ llvm_binpath = llvm.get_variable(configtool: 'bindir')
+
+ ccache = find_program('ccache', native: true, required: false)
+ clang = find_program(llvm_binpath / 'clang', required: true)
+ endif
+else
+ llvm = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: icu
+###############################################################
+
+icuopt = get_option('icu')
+if not icuopt.disabled()
+ icu = dependency('icu-uc', required: icuopt.enabled())
+ icu_i18n = dependency('icu-i18n', required: icuopt.enabled())
+
+ if icu.found()
+ cdata.set('USE_ICU', 1)
+ endif
+
+else
+ icu = not_found_dep
+ icu_i18n = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: libxml
+###############################################################
+
+libxmlopt = get_option('libxml')
+if not libxmlopt.disabled()
+ libxml = dependency('libxml-2.0', required: libxmlopt, version: '>= 2.6.23')
+
+ if libxml.found()
+ cdata.set('USE_LIBXML', 1)
+ endif
+else
+ libxml = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: libxslt
+###############################################################
+
+libxsltopt = get_option('libxslt')
+if not libxsltopt.disabled()
+ libxslt = dependency('libxslt', required: libxsltopt)
+
+ if libxslt.found()
+ cdata.set('USE_LIBXSLT', 1)
+ endif
+else
+ libxslt = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: lz4
+###############################################################
+
+lz4opt = get_option('lz4')
+if not lz4opt.disabled()
+ lz4 = dependency('liblz4', required: lz4opt)
+
+ if lz4.found()
+ cdata.set('USE_LZ4', 1)
+ cdata.set('HAVE_LIBLZ4', 1)
+ endif
+
+else
+ lz4 = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: Tcl (for pltcl)
+#
+# NB: tclConfig.sh is used in autoconf build for getting
+# TCL_SHARED_BUILD, TCL_INCLUDE_SPEC, TCL_LIBS and TCL_LIB_SPEC
+# variables. For now we have not seen a need to copy
+# that behaviour to the meson build.
+###############################################################
+
+tclopt = get_option('pltcl')
+tcl_version = get_option('tcl_version')
+tcl_dep = not_found_dep
+if not tclopt.disabled()
+
+ # via pkg-config
+ tcl_dep = dependency(tcl_version, required: false)
+
+ if not tcl_dep.found()
+ tcl_dep = cc.find_library(tcl_version,
+ required: tclopt,
+ dirs: test_lib_d)
+ endif
+
+ if not cc.has_header('tcl.h', dependencies: tcl_dep, required: tclopt)
+ tcl_dep = not_found_dep
+ endif
+endif
+
+
+
+###############################################################
+# Library: pam
+###############################################################
+
+pamopt = get_option('pam')
+if not pamopt.disabled()
+ pam = dependency('pam', required: false)
+
+ if not pam.found()
+ pam = cc.find_library('pam', required: pamopt, dirs: test_lib_d)
+ endif
+
+ if pam.found()
+ pam_header_found = false
+
+ # header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.
+ if cc.check_header('security/pam_appl.h', dependencies: pam, required: false,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_SECURITY_PAM_APPL_H', 1)
+ pam_header_found = true
+ elif cc.check_header('pam/pam_appl.h', dependencies: pam, required: pamopt,
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_PAM_PAM_APPL_H', 1)
+ pam_header_found = true
+ endif
+
+ if pam_header_found
+ cdata.set('USE_PAM', 1)
+ else
+ pam = not_found_dep
+ endif
+ endif
+else
+ pam = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: Perl (for plperl)
+###############################################################
+
+perlopt = get_option('plperl')
+perl_dep = not_found_dep
+if not perlopt.disabled()
+ perl_may_work = true
+
+ # First verify that perl has the necessary dependencies installed
+ perl_mods = run_command(
+ [perl,
+ '-MConfig', '-MOpcode', '-MExtUtils::Embed', '-MExtUtils::ParseXS',
+ '-e', ''],
+ check: false)
+ if perl_mods.returncode() != 0
+ perl_may_work = false
+ perl_msg = 'perl installation does not have the required modules'
+ endif
+
+ # Then inquire perl about its configuration
+ if perl_may_work
+ perl_conf_cmd = [perl, '-MConfig', '-e', 'print $Config{$ARGV[0]}']
+ perlversion = run_command(perl_conf_cmd, 'api_versionstring', check: true).stdout()
+ archlibexp = run_command(perl_conf_cmd, 'archlibexp', check: true).stdout()
+ privlibexp = run_command(perl_conf_cmd, 'privlibexp', check: true).stdout()
+ useshrplib = run_command(perl_conf_cmd, 'useshrplib', check: true).stdout()
+
+ perl_inc_dir = '@0@/CORE'.format(archlibexp)
+
+ if useshrplib != 'true'
+ perl_may_work = false
+ perl_msg = 'need a shared perl'
+ endif
+ endif
+
+ if perl_may_work
+ # 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(pg_sysroot, perl_inc_dir))
+ perl_ccflags = ['-iwithsysroot', perl_inc_dir]
+ endif
+
+ # check compiler finds header
+ if not cc.has_header('perl.h', required: false,
+ args: test_c_args + perl_ccflags, include_directories: postgres_inc)
+ perl_may_work = false
+ perl_msg = 'missing perl.h'
+ endif
+ endif
+
+ if perl_may_work
+ perl_ccflags_r = run_command(perl_conf_cmd, 'ccflags', check: true).stdout()
+
+ # See comments for PGAC_CHECK_PERL_EMBED_CCFLAGS in perl.m4
+ foreach flag : perl_ccflags_r.split(' ')
+ if flag.startswith('-D') and \
+ (not flag.startswith('-D_') or flag == '_USE_32BIT_TIME_T')
+ perl_ccflags += flag
+ endif
+ endforeach
+
+ if host_system == 'windows'
+ perl_ccflags += ['-DPLPERL_HAVE_UID_GID']
+ endif
+
+ message('CCFLAGS recommended by perl: @0@'.format(perl_ccflags_r))
+ message('CCFLAGS for embedding perl: @0@'.format(' '.join(perl_ccflags)))
+
+ # We are after Embed's ldopts, but without the subset mentioned in
+ # Config's ccdlflags and ldflags. (Those are the choices of those who
+ # built the Perl installation, which are not necessarily appropriate
+ # for building PostgreSQL.)
+ ldopts = run_command(perl, '-MExtUtils::Embed', '-e', 'ldopts', check: true).stdout().strip()
+ undesired = run_command(perl_conf_cmd, 'ccdlflags', check: true).stdout().split()
+ undesired += run_command(perl_conf_cmd, 'ldflags', check: true).stdout().split()
+
+ perl_ldopts = []
+ foreach ldopt : ldopts.split(' ')
+ if ldopt == '' or ldopt in undesired
+ continue
+ endif
+
+ perl_ldopts += ldopt.strip('"')
+ endforeach
+
+ message('LDFLAGS recommended by perl: "@0@"'.format(ldopts))
+ message('LDFLAGS for embedding perl: "@0@"'.format(' '.join(perl_ldopts)))
+
+ perl_dep_int = declare_dependency(
+ compile_args: perl_ccflags,
+ link_args: perl_ldopts,
+ version: perlversion,
+ )
+
+ # While we're at it, check that we can link to libperl.
+ # On most platforms, if perl.h is there then libperl.so will be too, but
+ # at this writing Debian packages them separately.
+ perl_link_test = '''
+/* see plperl.h */
+#ifdef _MSC_VER
+#define __inline__ inline
+#endif
+#include <EXTERN.h>
+#include <perl.h>
+int main(void)
+{
+perl_alloc();
+}'''
+ if not cc.links(perl_link_test, name: 'libperl',
+ args: test_c_args + perl_ccflags + perl_ldopts,
+ include_directories: postgres_inc)
+ perl_may_work = false
+ perl_msg = 'missing libperl'
+ endif
+
+ endif # perl_may_work
+
+ if perl_may_work
+ perl_dep = perl_dep_int
+ else
+ if perlopt.enabled()
+ error('dependency plperl failed: @0@'.format(perl_msg))
+ else
+ message('disabling optional dependency plperl: @0@'.format(perl_msg))
+ endif
+ endif
+endif
+
+
+
+###############################################################
+# Library: Python (for plpython)
+###############################################################
+
+pyopt = get_option('plpython')
+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
+ endif
+else
+ python3_dep = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: Readline
+###############################################################
+
+if not get_option('readline').disabled()
+ libedit_preferred = get_option('libedit_preferred')
+ # Set the order of readline dependencies
+ check_readline_deps = libedit_preferred ? \
+ ['libedit', 'readline'] : ['readline', 'libedit']
+
+ foreach readline_dep : check_readline_deps
+ readline = dependency(readline_dep, required: false)
+ if not readline.found()
+ readline = cc.find_library(readline_dep,
+ required: get_option('readline').enabled(),
+ dirs: test_lib_d)
+ endif
+ if readline.found()
+ break
+ endif
+ endforeach
+
+ if readline.found()
+ cdata.set('HAVE_LIBREADLINE', 1)
+
+ editline_prefix = {
+ 'header_prefix': 'editline/',
+ 'flag_prefix': 'EDITLINE_',
+ }
+ readline_prefix = {
+ 'header_prefix': 'readline/',
+ 'flag_prefix': 'READLINE_',
+ }
+ default_prefix = {
+ 'header_prefix': '',
+ 'flag_prefix': '',
+ }
+
+ # Set the order of prefixes
+ prefixes = libedit_preferred ? \
+ [editline_prefix, default_prefix, readline_prefix] : \
+ [readline_prefix, default_prefix, editline_prefix]
+
+ at_least_one_header_found = false
+ foreach header : ['history', 'readline']
+ is_found = false
+ foreach prefix : prefixes
+ header_file = '@0@@1@.h'.format(prefix['header_prefix'], header)
+ # Check history.h and readline.h
+ if not is_found and cc.has_header(header_file,
+ args: test_c_args, include_directories: postgres_inc,
+ dependencies: [readline], required: false)
+ if header == 'readline'
+ readline_h = header_file
+ endif
+ cdata.set('HAVE_@0@@1@_H'.format(prefix['flag_prefix'], header).to_upper(), 1)
+ is_found = true
+ at_least_one_header_found = true
+ endif
+ endforeach
+ endforeach
+
+ if not at_least_one_header_found
+ error('''readline header not found
+If you have @0@ already installed, see 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))
+ endif
+
+ check_funcs = [
+ 'append_history',
+ 'history_truncate_file',
+ 'rl_completion_matches',
+ 'rl_filename_completion_function',
+ 'rl_reset_screen_size',
+ 'rl_variable_bind',
+ ]
+
+ 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)
+ endforeach
+
+ check_vars = [
+ 'rl_completion_suppress_quote',
+ 'rl_filename_quote_characters',
+ 'rl_filename_quoting_function',
+ ]
+
+ foreach var : check_vars
+ 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>',
+ dependencies: [readline]) ? 1 : false)
+ endforeach
+
+ # If found via cc.find_library() ensure headers are found when using the
+ # dependency. On meson < 0.57 one cannot do compiler checks using the
+ # dependency returned by declare_dependency(), so we can't do this above.
+ if readline.type_name() == 'library'
+ readline = declare_dependency(dependencies: readline,
+ include_directories: postgres_inc)
+ endif
+ endif
+
+ # XXX: Figure out whether to implement mingw warning equivalent
+else
+ readline = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: selinux
+###############################################################
+
+selinux = not_found_dep
+selinuxopt = get_option('selinux')
+if meson.version().version_compare('>=0.59')
+ selinuxopt = selinuxopt.disable_auto_if(host_system != 'linux')
+endif
+selinux = dependency('libselinux', required: selinuxopt, version: '>= 2.1.10')
+cdata.set('HAVE_LIBSELINUX',
+ selinux.found() ? 1 : false)
+
+
+
+###############################################################
+# Library: systemd
+###############################################################
+
+systemd = not_found_dep
+systemdopt = get_option('systemd')
+if meson.version().version_compare('>=0.59')
+ systemdopt = systemdopt.disable_auto_if(host_system != 'linux')
+endif
+systemd = dependency('libsystemd', required: systemdopt)
+cdata.set('USE_SYSTEMD', systemd.found() ? 1 : false)
+
+
+
+###############################################################
+# Library: SSL
+###############################################################
+
+if get_option('ssl') == 'openssl'
+
+ # Try to find openssl via pkg-config et al, if that doesn't work
+ # (e.g. because it's provided as part of the OS, like on FreeBSD), look for
+ # the library names that we know about.
+
+ # via pkg-config et al
+ ssl = dependency('openssl', required: false)
+
+ # via library + headers
+ if not ssl.found()
+ ssl_lib = cc.find_library('ssl',
+ dirs: test_lib_d,
+ header_include_directories: postgres_inc,
+ has_headers: ['openssl/ssl.h', 'openssl/err.h'])
+ crypto_lib = cc.find_library('crypto',
+ dirs: test_lib_d,
+ header_include_directories: postgres_inc)
+ ssl_int = [ssl_lib, crypto_lib]
+
+ ssl = declare_dependency(dependencies: ssl_int,
+ include_directories: postgres_inc)
+ else
+ cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: true)
+ cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: true)
+
+ ssl_int = [ssl]
+ endif
+
+ check_funcs = [
+ ['CRYPTO_new_ex_data', {'required': true}],
+ ['SSL_new', {'required': true}],
+
+ # Function introduced in OpenSSL 1.0.2.
+ ['X509_get_signature_nid'],
+
+ # Functions introduced in OpenSSL 1.1.0. We used to check for
+ # OPENSSL_VERSION_NUMBER, but that didn't work with 1.1.0, because LibreSSL
+ # defines OPENSSL_VERSION_NUMBER to claim version 2.0.0, even though it
+ # doesn't have these OpenSSL 1.1.0 functions. So check for individual
+ # functions.
+ ['OPENSSL_init_ssl'],
+ ['BIO_get_data'],
+ ['BIO_meth_new'],
+ ['ASN1_STRING_get0_data'],
+ ['HMAC_CTX_new'],
+ ['HMAC_CTX_free'],
+
+ # OpenSSL versions before 1.1.0 required setting callback functions, for
+ # thread-safety. In 1.1.0, it's no longer required, and CRYPTO_lock()
+ # function was removed.
+ ['CRYPTO_lock'],
+ ]
+
+ foreach c : check_funcs
+ func = c.get(0)
+ val = cc.has_function(func, args: test_c_args, dependencies: ssl_int)
+ required = c.get(1, {}).get('required', false)
+ if required and not val
+ error('openssl function @0@ is required'.format(func))
+ elif not required
+ cdata.set('HAVE_' + func.to_upper(), val ? 1 : false)
+ endif
+ endforeach
+
+ 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.''')
+else
+ ssl = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: uuid
+###############################################################
+
+uuidopt = get_option('uuid')
+if uuidopt != 'none'
+ uuidname = uuidopt.to_upper()
+ if uuidopt == 'e2fs'
+ uuid = dependency('uuid', required: true)
+ uuidfunc = 'uuid_generate'
+ uuidheader = 'uuid/uuid.h'
+ elif uuidopt == 'bsd'
+ # libc should have uuid function
+ uuid = declare_dependency()
+ uuidfunc = 'uuid_to_string'
+ uuidheader = 'uuid.h'
+ elif uuidopt == 'ossp'
+ uuid = dependency('ossp-uuid', required: true)
+ uuidfunc = 'uuid_export'
+ uuidheader = 'ossp/uuid.h'
+ else
+ error('huh')
+ endif
+
+ if not cc.has_header_symbol(uuidheader, uuidfunc, args: test_c_args, dependencies: uuid)
+ error('uuid library @0@ missing required function @1@'.format(uuidopt, uuidfunc))
+ endif
+ cdata.set('HAVE_@0@'.format(uuidheader.underscorify().to_upper()), 1)
+
+ cdata.set('HAVE_UUID_@0@'.format(uuidname), 1,
+ description: 'Define to 1 if you have @0@ UUID support.'.format(uuidname))
+else
+ uuid = not_found_dep
+endif
+
+
+
+###############################################################
+# Library: zlib
+###############################################################
+
+zlibopt = get_option('zlib')
+zlib = not_found_dep
+if not zlibopt.disabled()
+ zlib_t = dependency('zlib', required: zlibopt)
+
+ if zlib_t.type_name() == 'internal'
+ # if fallback was used, we don't need to test if headers are present (they
+ # aren't built yet, so we can't test)
+ zlib = zlib_t
+ elif not zlib_t.found()
+ warning('did not find zlib')
+ elif not cc.has_header('zlib.h',
+ args: test_c_args, include_directories: postgres_inc,
+ dependencies: [zlib_t], required: zlibopt.enabled())
+ warning('zlib header not found')
+ elif not cc.has_type('z_streamp',
+ dependencies: [zlib_t], prefix: '#include <zlib.h>',
+ args: test_c_args, include_directories: postgres_inc)
+ if zlibopt.enabled()
+ error('zlib version is too old')
+ else
+ warning('zlib version is too old')
+ endif
+ else
+ zlib = zlib_t
+ endif
+
+ if zlib.found()
+ cdata.set('HAVE_LIBZ', 1)
+ endif
+endif
+
+
+
+###############################################################
+# Library: tap test dependencies
+###############################################################
+
+# Check whether tap tests are enabled or not
+tap_tests_enabled = false
+tapopt = get_option('tap_tests')
+if not tapopt.disabled()
+ # Checking for perl modules for tap tests
+ perl_ipc_run_check = run_command(perl, 'config/check_modules.pl', check: false)
+ if perl_ipc_run_check.returncode() != 0
+ message(perl_ipc_run_check.stderr().strip())
+ if tapopt.enabled()
+ error('Additional Perl modules are required to run TAP tests.')
+ else
+ warning('Additional Perl modules are required to run TAP tests.')
+ endif
+ else
+ tap_tests_enabled = true
+ endif
+endif
+
+
+
+###############################################################
+# Library: zstd
+###############################################################
+
+zstdopt = get_option('zstd')
+if not zstdopt.disabled()
+ zstd = dependency('libzstd', required: zstdopt, version: '>=1.4.0')
+
+ if zstd.found()
+ cdata.set('USE_ZSTD', 1)
+ cdata.set('HAVE_LIBZSTD', 1)
+ endif
+
+else
+ zstd = not_found_dep
+endif
+
+
+
+###############################################################
+# Compiler tests
+###############################################################
+
+# Do we need -std=c99 to compile C99 code? We don't want to add -std=c99
+# unnecessarily, because we optionally rely on newer features.
+c99_test = '''
+#include <stdbool.h>
+#include <complex.h>
+#include <tgmath.h>
+#include <inttypes.h>
+
+struct named_init_test {
+ int a;
+ int b;
+};
+
+extern void structfunc(struct named_init_test);
+
+int main(int argc, char **argv)
+{
+ struct named_init_test nit = {
+ .a = 3,
+ .b = 5,
+ };
+
+ for (int loop_var = 0; loop_var < 3; loop_var++)
+ {
+ nit.a += nit.b;
+ }
+
+ structfunc((struct named_init_test){1, 0});
+
+ return nit.a != 0;
+}
+'''
+
+if not cc.compiles(c99_test, name: 'c99', args: test_c_args)
+ if cc.compiles(c99_test, name: 'c99 with -std=c99',
+ args: test_c_args + ['-std=c99'])
+ test_c_args += '-std=c99'
+ cflags += '-std=c99'
+ else
+ error('C compiler does not support C99')
+ endif
+endif
+
+sizeof_long = cc.sizeof('long', args: test_c_args)
+cdata.set('SIZEOF_LONG', sizeof_long)
+if sizeof_long == 8
+ cdata.set('HAVE_LONG_INT_64', 1)
+ cdata.set('PG_INT64_TYPE', 'long int')
+ cdata.set_quoted('INT64_MODIFIER', 'l')
+elif sizeof_long == 4 and cc.sizeof('long long', args: test_c_args) == 8
+ cdata.set('HAVE_LONG_LONG_INT_64', 1)
+ cdata.set('PG_INT64_TYPE', 'long long int')
+ cdata.set_quoted('INT64_MODIFIER', 'll')
+else
+ error('do not know how to get a 64bit int')
+endif
+
+if host_machine.endian() == 'big'
+ cdata.set('WORDS_BIGENDIAN', 1)
+endif
+
+alignof_types = ['short', 'int', 'long', 'double']
+maxalign = 0
+foreach t : alignof_types
+ align = cc.alignment(t, args: test_c_args)
+ if maxalign < align
+ maxalign = align
+ endif
+ cdata.set('ALIGNOF_@0@'.format(t.to_upper()), align)
+endforeach
+cdata.set('MAXIMUM_ALIGNOF', maxalign)
+
+cdata.set('SIZEOF_VOID_P', cc.sizeof('void *', args: test_c_args))
+cdata.set('SIZEOF_SIZE_T', cc.sizeof('size_t', args: test_c_args))
+
+
+# Check if __int128 is a working 128 bit integer type, and if so
+# define PG_INT128_TYPE to that typename.
+#
+# This currently only detects a GCC/clang extension, but support for other
+# environments may be added in the future.
+#
+# For the moment we only test for support for 128bit math; support for
+# 128bit literals and snprintf is not required.
+if cc.links('''
+ /*
+ * We don't actually run this test, just link it to verify that any support
+ * functions needed for __int128 are present.
+ *
+ * These are globals to discourage the compiler from folding all the
+ * arithmetic tests down to compile-time constants. We do not have
+ * convenient support for 128bit literals at this point...
+ */
+ __int128 a = 48828125;
+ __int128 b = 97656250;
+
+ int main(void)
+ {
+ __int128 c,d;
+ a = (a << 12) + 1; /* 200000000001 */
+ b = (b << 12) + 5; /* 400000000005 */
+ /* try the most relevant arithmetic ops */
+ c = a * b;
+ d = (c + b) / b;
+ /* must use the results, else compiler may optimize arithmetic away */
+ return d != a+1;
+ }''',
+ name: '__int128',
+ args: test_c_args)
+
+ buggy_int128 = false
+
+ # Use of non-default alignment with __int128 tickles bugs in some compilers.
+ # If not cross-compiling, we can test for bugs and disable use of __int128
+ # with buggy compilers. If cross-compiling, hope for the best.
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83925
+ if not meson.is_cross_build()
+ r = cc.run('''
+ /* This must match the corresponding code in c.h: */
+ #if defined(__GNUC__) || defined(__SUNPRO_C) || defined(__IBMC__)
+ #define pg_attribute_aligned(a) __attribute__((aligned(a)))
+ #endif
+ typedef __int128 int128a
+ #if defined(pg_attribute_aligned)
+ pg_attribute_aligned(8)
+ #endif
+ ;
+
+ int128a holder;
+ void pass_by_val(void *buffer, int128a par) { holder = par; }
+
+ int main(void)
+ {
+ long int i64 = 97656225L << 12;
+ int128a q;
+ pass_by_val(main, (int128a) i64);
+ q = (int128a) i64;
+ return q != holder;
+ }''',
+ name: '__int128 alignment bug',
+ args: test_c_args)
+ assert(r.compiled())
+ if r.returncode() != 0
+ buggy_int128 = true
+ message('__int128 support present but buggy and thus disabled')
+ endif
+ endif
+
+ if not buggy_int128
+ cdata.set('PG_INT128_TYPE', '__int128')
+ cdata.set('ALIGNOF_PG_INT128_TYPE', cc.
+ alignment('__int128', args: test_c_args))
+ endif
+endif
+
+
+# Check if the C compiler knows computed gotos (gcc extension, also
+# available in at least clang). If so, define HAVE_COMPUTED_GOTO.
+#
+# Checking whether computed gotos are supported syntax-wise ought to
+# be enough, as the syntax is otherwise illegal.
+if cc.compiles('''
+ static inline int foo(void)
+ {
+ void *labeladdrs[] = {&&my_label};
+ goto *labeladdrs[0];
+ my_label:
+ return 1;
+ }''',
+ args: test_c_args)
+ cdata.set('HAVE_COMPUTED_GOTO', 1)
+endif
+
+
+# Check if the C compiler understands _Static_assert(),
+# and define HAVE__STATIC_ASSERT if so.
+#
+# We actually check the syntax ({ _Static_assert(...) }), because we need
+# gcc-style compound expressions to be able to wrap the thing into macros.
+if cc.compiles('''
+ int main(int arg, char **argv)
+ {
+ ({ _Static_assert(1, "foo"); });
+ }
+ ''',
+ args: test_c_args)
+ cdata.set('HAVE__STATIC_ASSERT', 1)
+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
+ cdata.set('HAVE__BOOL', 1)
+ cdata.set('PG_USE_STDBOOL', 1)
+endif
+
+
+# Need to check a call with %m because netbsd supports gnu_printf but emits a
+# warning for each use of %m.
+printf_attributes = ['gnu_printf', '__syslog__', 'printf']
+testsrc = '''
+extern void emit_log(int ignore, const char *fmt,...) __attribute__((format(@0@, 2,3)));
+static void call_log(void)
+{
+ emit_log(0, "error: %s: %m", "foo");
+}
+'''
+attrib_error_args = cc.get_supported_arguments('-Werror=format', '-Werror=ignored-attributes')
+foreach a : printf_attributes
+ if cc.compiles(testsrc.format(a),
+ args: test_c_args + attrib_error_args, name: 'format ' + a)
+ cdata.set('PG_PRINTF_ATTRIBUTE', a)
+ break
+ endif
+endforeach
+
+
+if cc.has_function_attribute('visibility:default') and \
+ cc.has_function_attribute('visibility:hidden')
+ 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
+ # flags into exported files (pgxs, .pc files).
+ cflags_mod += '-fvisibility=hidden'
+ cxxflags_mod += ['-fvisibility=hidden', '-fvisibility-inlines-hidden']
+ ldflags_mod += '-fvisibility=hidden'
+endif
+
+
+# Check if various builtins exist. Some builtins are tested separately,
+# because we want to test something more complicated than the generic case.
+builtins = [
+ 'bswap16',
+ 'bswap32',
+ 'bswap64',
+ 'clz',
+ 'ctz',
+ 'constant_p',
+ 'frame_address',
+ 'popcount',
+ 'unreachable',
+]
+
+foreach builtin : builtins
+ fname = '__builtin_@0@'.format(builtin)
+ if cc.has_function(fname, args: test_c_args)
+ cdata.set('HAVE@0@'.format(fname.to_upper()), 1)
+ endif
+endforeach
+
+
+# Check if the C compiler understands __builtin_types_compatible_p,
+# and define HAVE__BUILTIN_TYPES_COMPATIBLE_P if so.
+#
+# We check usage with __typeof__, though it's unlikely any compiler would
+# have the former and not the latter.
+if cc.compiles('''
+ static int x;
+ static int y[__builtin_types_compatible_p(__typeof__(x), int)];
+ ''',
+ name: '__builtin_types_compatible_p',
+ args: test_c_args)
+ cdata.set('HAVE__BUILTIN_TYPES_COMPATIBLE_P', 1)
+endif
+
+
+# Check if the C compiler understands __builtin_$op_overflow(),
+# and define HAVE__BUILTIN_OP_OVERFLOW if so.
+#
+# Check for the most complicated case, 64 bit multiplication, as a
+# proxy for all of the operations. To detect the case where the compiler
+# knows the function but library support is missing, we must link not just
+# compile, and store the results in global variables so the compiler doesn't
+# optimize away the call.
+if cc.links('''
+ INT64 a = 1;
+ INT64 b = 1;
+ INT64 result;
+
+ int main(void)
+ {
+ return __builtin_mul_overflow(a, b, &result);
+ }''',
+ name: '__builtin_mul_overflow',
+ args: test_c_args + ['-DINT64=@0@'.format(cdata.get('PG_INT64_TYPE'))],
+ )
+ cdata.set('HAVE__BUILTIN_OP_OVERFLOW', 1)
+endif
+
+
+# XXX: The configure.ac check for __cpuid() is broken, we don't copy that
+# here. To prevent problems due to two detection methods working, stop
+# checking after one.
+if cc.links('''
+ #include <cpuid.h>
+ int main(int arg, char **argv)
+ {
+ unsigned int exx[4] = {0, 0, 0, 0};
+ __get_cpuid(1, &exx[0], &exx[1], &exx[2], &exx[3]);
+ }
+ ''', name: '__get_cpuid',
+ args: test_c_args)
+ cdata.set('HAVE__GET_CPUID', 1)
+elif cc.links('''
+ #include <intrin.h>
+ int main(int arg, char **argv)
+ {
+ unsigned int exx[4] = {0, 0, 0, 0};
+ __cpuid(exx, 1);
+ }
+ ''', name: '__cpuid',
+ args: test_c_args)
+ cdata.set('HAVE__CPUID', 1)
+endif
+
+
+# Defend against clang being used on x86-32 without SSE2 enabled. As current
+# versions of clang do not understand -fexcess-precision=standard, the use of
+# x87 floating point operations leads to problems like isinf possibly returning
+# false for a value that is infinite when converted from the 80bit register to
+# the 8byte memory representation.
+#
+# Only perform the test if the compiler doesn't understand
+# -fexcess-precision=standard, that way a potentially fixed compiler will work
+# automatically.
+if '-fexcess-precision=standard' not in cflags
+ if not cc.compiles('''
+#if defined(__clang__) && defined(__i386__) && !defined(__SSE2_MATH__)
+choke me
+#endif''',
+ name: '', args: test_c_args)
+ error('Compiling PostgreSQL with clang, on 32bit x86, requires SSE2 support. Use -msse2 or use gcc.')
+ endif
+endif
+
+
+
+###############################################################
+# Compiler flags
+###############################################################
+
+common_functional_flags = [
+ # Disable strict-aliasing rules; needed for gcc 3.3+
+ '-fno-strict-aliasing',
+ # Disable optimizations that assume no overflow; needed for gcc 4.3+
+ '-fwrapv',
+ '-fexcess-precision=standard',
+]
+
+cflags += cc.get_supported_arguments(common_functional_flags)
+if llvm.found()
+ cxxflags += cpp.get_supported_arguments(common_functional_flags)
+endif
+
+vectorize_cflags = cc.get_supported_arguments(['-ftree-vectorize'])
+unroll_loops_cflags = cc.get_supported_arguments(['-funroll-loops'])
+
+common_warning_flags = [
+ '-Wmissing-prototypes',
+ '-Wpointer-arith',
+ # Really don't want VLAs to be used in our dialect of C
+ '-Werror=vla',
+ # On macOS, complain about usage of symbols newer than the deployment target
+ '-Werror=unguarded-availability-new',
+ '-Wendif-labels',
+ '-Wmissing-format-attribute',
+ '-Wimplicit-fallthrough=3',
+ '-Wcast-function-type',
+ # This was included in -Wall/-Wformat in older GCC versions
+ '-Wformat-security',
+]
+
+cflags_warn += cc.get_supported_arguments(common_warning_flags)
+if llvm.found()
+ cxxflags_warn += cpp.get_supported_arguments(common_warning_flags)
+endif
+
+# A few places with imported code get a pass on -Wdeclaration-after-statement, remember
+# the result for them
+if cc.has_argument('-Wdeclaration-after-statement')
+ cflags_warn += '-Wdeclaration-after-statement'
+ using_declaration_after_statement_warning = true
+else
+ using_declaration_after_statement_warning = false
+endif
+
+
+# The following tests want to suppress various unhelpful warnings by adding
+# -Wno-foo switches. But gcc won't complain about unrecognized -Wno-foo
+# switches, so we have to test for the positive form and if that works,
+# add the negative form.
+
+negative_warning_flags = [
+ # Suppress clang's unhelpful unused-command-line-argument warnings.
+ 'unused-command-line-argument',
+
+ # Remove clang 12+'s compound-token-split-by-macro, as this causes a lot
+ # of warnings when building plperl because of usages in the Perl headers.
+ 'compound-token-split-by-macro',
+
+ # Similarly disable useless truncation warnings from gcc 8+
+ 'format-truncation',
+ 'stringop-truncation',
+
+ # To make warning_level=2 / -Wextra work, we'd need at least the following
+ # 'clobbered',
+ # 'missing-field-initializers',
+ # 'sign-compare',
+ # 'unused-parameter',
+]
+
+foreach w : negative_warning_flags
+ if cc.has_argument('-W' + w)
+ cflags_warn += '-Wno-' + w
+ endif
+ if llvm.found() and cpp.has_argument('-W' + w)
+ cxxflags_warn += '-Wno-' + w
+ endif
+endforeach
+
+
+# From Project.pm
+if cc.get_id() == 'msvc'
+ cflags_warn += [
+ '/wd4018', # signed/unsigned mismatch
+ '/wd4244', # conversion from 'type1' to 'type2', possible loss of data
+ '/wd4273', # inconsistent DLL linkage
+ '/wd4101', # unreferenced local variable
+ '/wd4102', # unreferenced label
+ '/wd4090', # different 'modifier' qualifiers
+ '/wd4267', # conversion from 'size_t' to 'type', possible loss of data
+ ]
+
+ cppflags += [
+ '/DWIN32',
+ '/DWINDOWS',
+ '/D__WINDOWS__',
+ '/D__WIN32__',
+ '/D_CRT_SECURE_NO_DEPRECATE',
+ '/D_CRT_NONSTDC_NO_DEPRECATE',
+ ]
+
+ # We never need export libraries. As link.exe reports their creation, they
+ # are unnecessarily noisy. Similarly, we don't need import library for
+ # modules, we only import them dynamically, and they're also noisy.
+ ldflags += '/NOEXP'
+ ldflags_mod += '/NOIMPLIB'
+endif
+
+
+
+###############################################################
+# Atomics
+###############################################################
+
+if not get_option('spinlocks')
+ warning('Not using spinlocks will cause poor performance')
+else
+ cdata.set('HAVE_SPINLOCKS', 1)
+endif
+
+if not get_option('atomics')
+ warning('Not using atomics will cause poor performance')
+else
+ # XXX: perhaps we should require some atomics support in this case these
+ # days?
+ cdata.set('HAVE_ATOMICS', 1)
+
+ atomic_checks = [
+ {'name': 'HAVE_GCC__SYNC_CHAR_TAS',
+ 'desc': '__sync_lock_test_and_set(char)',
+ 'test': '''
+char lock = 0;
+__sync_lock_test_and_set(&lock, 1);
+__sync_lock_release(&lock);'''},
+
+ {'name': 'HAVE_GCC__SYNC_INT32_TAS',
+ 'desc': '__sync_lock_test_and_set(int32)',
+ 'test': '''
+int lock = 0;
+__sync_lock_test_and_set(&lock, 1);
+__sync_lock_release(&lock);'''},
+
+ {'name': 'HAVE_GCC__SYNC_INT32_CAS',
+ 'desc': '__sync_val_compare_and_swap(int32)',
+ 'test': '''
+int val = 0;
+__sync_val_compare_and_swap(&val, 0, 37);'''},
+
+ {'name': 'HAVE_GCC__SYNC_INT64_CAS',
+ 'desc': '__sync_val_compare_and_swap(int64)',
+ 'test': '''
+INT64 val = 0;
+__sync_val_compare_and_swap(&val, 0, 37);'''},
+
+ {'name': 'HAVE_GCC__ATOMIC_INT32_CAS',
+ 'desc': ' __atomic_compare_exchange_n(int32)',
+ 'test': '''
+int val = 0;
+int expect = 0;
+__atomic_compare_exchange_n(&val, &expect, 37, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);'''},
+
+ {'name': 'HAVE_GCC__ATOMIC_INT64_CAS',
+ 'desc': ' __atomic_compare_exchange_n(int64)',
+ 'test': '''
+INT64 val = 0;
+INT64 expect = 0;
+__atomic_compare_exchange_n(&val, &expect, 37, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);'''},
+ ]
+
+ foreach check : atomic_checks
+ test = '''
+int main(void)
+{
+@0@
+}'''.format(check['test'])
+
+ cdata.set(check['name'],
+ cc.links(test,
+ name: check['desc'],
+ args: test_c_args + ['-DINT64=@0@'.format(cdata.get('PG_INT64_TYPE'))]) ? 1 : false
+ )
+ endforeach
+
+endif
+
+
+
+###############################################################
+# Select CRC-32C implementation.
+#
+# If we are targeting a processor that has Intel SSE 4.2 instructions, we can
+# use the special CRC instructions for calculating CRC-32C. If we're not
+# targeting such a processor, but we can nevertheless produce code that uses
+# the SSE intrinsics, perhaps with some extra CFLAGS, compile both
+# implementations and select which one to use at runtime, depending on whether
+# SSE 4.2 is supported by the processor we're running on.
+#
+# Similarly, if we are targeting an ARM processor that has the CRC
+# instructions that are part of the ARMv8 CRC Extension, use them. And if
+# we're not targeting such a processor, but can nevertheless produce code that
+# uses the CRC instructions, compile both, and select at runtime.
+###############################################################
+
+have_optimized_crc = false
+cflags_crc = []
+if host_cpu == 'x86' or host_cpu == 'x86_64'
+
+ if cc.get_id() == 'msvc'
+ cdata.set('USE_SSE42_CRC32C', false)
+ cdata.set('USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 1)
+ have_optimized_crc = true
+ else
+
+ prog = '''
+#include <nmmintrin.h>
+
+int main(void)
+{
+ unsigned int crc = 0;
+ crc = _mm_crc32_u8(crc, 0);
+ crc = _mm_crc32_u32(crc, 0);
+ /* return computed value, to prevent the above being optimized away */
+ return crc == 0;
+}
+'''
+
+ if cc.links(prog, name: '_mm_crc32_u8 and _mm_crc32_u32 without -msse4.2',
+ args: test_c_args)
+ # Use Intel SSE 4.2 unconditionally.
+ cdata.set('USE_SSE42_CRC32C', 1)
+ have_optimized_crc = true
+ elif cc.links(prog, name: '_mm_crc32_u8 and _mm_crc32_u32 with -msse4.2',
+ args: test_c_args + ['-msse4.2'])
+ # Use Intel SSE 4.2, with runtime check. The CPUID instruction is needed for
+ # the runtime check.
+ cflags_crc += '-msse4.2'
+ cdata.set('USE_SSE42_CRC32C', false)
+ cdata.set('USE_SSE42_CRC32C_WITH_RUNTIME_CHECK', 1)
+ have_optimized_crc = true
+ endif
+
+ endif
+
+elif host_cpu == 'arm' or host_cpu == 'aarch64'
+
+ prog = '''
+#include <arm_acle.h>
+
+int main(void)
+{
+ unsigned int crc = 0;
+ crc = __crc32cb(crc, 0);
+ crc = __crc32ch(crc, 0);
+ crc = __crc32cw(crc, 0);
+ crc = __crc32cd(crc, 0);
+
+ /* return computed value, to prevent the above being optimized away */
+ return crc == 0;
+}
+'''
+
+ if cc.links(prog, name: '__crc32cb, __crc32ch, __crc32cw, and __crc32cd without -march=armv8-a+crc',
+ args: test_c_args)
+ # Use ARM CRC Extension unconditionally
+ cdata.set('USE_ARMV8_CRC32C', 1)
+ have_optimized_crc = true
+ elif cc.links(prog, name: '__crc32cb, __crc32ch, __crc32cw, and __crc32cd with -march=armv8-a+crc',
+ args: test_c_args + ['-march=armv8-a+crc'])
+ # Use ARM CRC Extension, with runtime check
+ cflags_crc += '-march=armv8-a+crc'
+ cdata.set('USE_ARMV8_CRC32C', false)
+ cdata.set('USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK', 1)
+ have_optimized_crc = true
+ endif
+endif
+
+if not have_optimized_crc
+ # fall back to slicing-by-8 algorithm, which doesn't require any special CPU
+ # support.
+ cdata.set('USE_SLICING_BY_8_CRC32C', 1)
+endif
+
+
+
+###############################################################
+# Other CPU specific stuff
+###############################################################
+
+if host_cpu == 'x86_64'
+
+ if cc.compiles('''
+ void main(void)
+ {
+ long long x = 1; long long r;
+ __asm__ __volatile__ (" popcntq %1,%0\n" : "=q"(r) : "rm"(x));
+ }''',
+ name: '@0@: popcntq instruction'.format(host_cpu),
+ args: test_c_args)
+ cdata.set('HAVE_X86_64_POPCNTQ', 1)
+ endif
+
+elif host_cpu == 'ppc' or host_cpu == 'ppc64'
+ # Check if compiler accepts "i"(x) when __builtin_constant_p(x).
+ if cdata.has('HAVE__BUILTIN_CONSTANT_P')
+ if cc.compiles('''
+ static inline int
+ addi(int ra, int si)
+ {
+ int res = 0;
+ if (__builtin_constant_p(si))
+ __asm__ __volatile__(
+ " addi %0,%1,%2\n" : "=r"(res) : "b"(ra), "i"(si));
+ return res;
+ }
+ int test_adds(int x) { return addi(3, x) + addi(x, 5); }
+ ''',
+ args: test_c_args)
+ cdata.set('HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P', 1)
+ endif
+ endif
+endif
+
+
+
+###############################################################
+# Library / OS tests
+###############################################################
+
+# XXX: Might be worth conditioning some checks on the OS, to avoid doing
+# unnecessary checks over and over, particularly on windows.
+header_checks = [
+ 'atomic.h',
+ 'copyfile.h',
+ 'crtdefs.h',
+ 'execinfo.h',
+ 'getopt.h',
+ 'ifaddrs.h',
+ 'langinfo.h',
+ 'mbarrier.h',
+ 'stdbool.h',
+ 'strings.h',
+ 'sys/epoll.h',
+ 'sys/event.h',
+ 'sys/personality.h',
+ 'sys/prctl.h',
+ 'sys/procctl.h',
+ 'sys/signalfd.h',
+ 'sys/ucred.h',
+ 'termios.h',
+ 'ucred.h',
+]
+
+foreach header : header_checks
+ varname = 'HAVE_' + header.underscorify().to_upper()
+
+ # Emulate autoconf behaviour of not-found->undef, found->1
+ found = cc.has_header(header,
+ include_directories: postgres_inc, args: test_c_args)
+ cdata.set(varname, found ? 1 : false,
+ description: 'Define to 1 if you have the <@0@> header file.'.format(header))
+endforeach
+
+
+decl_checks = [
+ ['F_FULLFSYNC', 'fcntl.h'],
+ ['fdatasync', 'unistd.h'],
+ ['posix_fadvise', 'fcntl.h'],
+ ['strlcat', 'string.h'],
+ ['strlcpy', 'string.h'],
+ ['strnlen', 'string.h'],
+]
+
+# Need to check for function declarations for these functions, because
+# checking for library symbols wouldn't handle deployment target
+# restrictions on macOS
+decl_checks += [
+ ['preadv', 'sys/uio.h'],
+ ['pwritev', 'sys/uio.h'],
+]
+
+foreach c : decl_checks
+ func = c.get(0)
+ header = c.get(1)
+ args = c.get(2, {})
+ varname = 'HAVE_DECL_' + func.underscorify().to_upper()
+
+ found = cc.has_header_symbol(header, func,
+ args: test_c_args, include_directories: postgres_inc,
+ kwargs: args)
+ cdata.set10(varname, found, description:
+'''Define to 1 if you have the declaration of `@0@', and to 0 if you
+ don't.'''.format(func))
+endforeach
+
+
+if cc.has_type('struct cmsgcred',
+ args: test_c_args + ['@0@'.format(cdata.get('HAVE_SYS_UCRED_H')) == 'false' ? '' : '-DHAVE_SYS_UCRED_H'],
+ include_directories: postgres_inc,
+ prefix: '''
+#include <sys/socket.h>
+#include <sys/param.h>
+#ifdef HAVE_SYS_UCRED_H
+#include <sys/ucred.h>
+#endif''')
+ cdata.set('HAVE_STRUCT_CMSGCRED', 1)
+else
+ cdata.set('HAVE_STRUCT_CMSGCRED', false)
+endif
+
+if cc.has_type('struct option',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '@0@'.format(cdata.get('HAVE_GETOPT_H')) == '1' ? '#include <getopt.h>' : '')
+ cdata.set('HAVE_STRUCT_OPTION', 1)
+endif
+
+
+foreach c : ['opterr', 'optreset']
+ varname = 'HAVE_INT_' + c.underscorify().to_upper()
+
+ if cc.links('''
+#include <unistd.h>
+int main(void)
+{
+ extern int @0@;
+ @0@ = 1;
+}
+'''.format(c), name: c, args: test_c_args)
+ cdata.set(varname, 1)
+ else
+ cdata.set(varname, false)
+ endif
+endforeach
+
+if cc.has_type('socklen_t',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '''
+#include <sys/socket.h>''')
+ cdata.set('HAVE_SOCKLEN_T', 1)
+endif
+
+if cc.has_member('struct sockaddr', 'sa_len',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/socket.h>''')
+ cdata.set('HAVE_STRUCT_SOCKADDR_SA_LEN', 1)
+endif
+
+if cc.has_member('struct tm', 'tm_zone',
+ args: test_c_args, include_directories: postgres_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <time.h>
+''')
+ cdata.set('HAVE_STRUCT_TM_TM_ZONE', 1)
+endif
+
+if cc.compiles('''
+#include <time.h>
+extern int foo(void);
+int foo(void)
+{
+ return timezone / 60;
+}
+''',
+ name: 'global variable `timezone\' exists',
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('HAVE_INT_TIMEZONE', 1)
+else
+ cdata.set('HAVE_INT_TIMEZONE', false)
+endif
+
+if cc.has_type('union semun',
+ args: test_c_args,
+ include_directories: postgres_inc,
+ prefix: '''
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+''')
+ cdata.set('HAVE_UNION_SEMUN', 1)
+endif
+
+if cc.compiles('''
+#include <string.h>
+int main(void)
+{
+ char buf[100];
+ switch (strerror_r(1, buf, sizeof(buf)))
+ { case 0: break; default: break; }
+}''',
+ name: 'strerror_r',
+ args: test_c_args, include_directories: postgres_inc)
+ cdata.set('STRERROR_R_INT', 1)
+else
+ cdata.set('STRERROR_R_INT', false)
+endif
+
+# Check for the locale_t type and find the right header file. macOS
+# 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', 1)
+elif cc.has_type('locale_t', prefix: '#include <xlocale.h>')
+ cdata.set('HAVE_LOCALE_T', 1)
+ cdata.set('LOCALE_T_IN_XLOCALE', 1)
+endif
+
+# Check if the C compiler understands typeof or a variant. Define
+# HAVE_TYPEOF if so, and define 'typeof' to the actual key word.
+foreach kw : ['typeof', '__typeof__', 'decltype']
+ if cc.compiles('''
+int main(void)
+{
+ int x = 0;
+ @0@(x) y;
+ y = x;
+ return y;
+}
+'''.format(kw),
+ name: 'typeof()',
+ args: test_c_args, include_directories: postgres_inc)
+
+ cdata.set('HAVE_TYPEOF', 1)
+ if kw != 'typeof'
+ cdata.set('typeof', kw)
+ endif
+
+ break
+ endif
+endforeach
+
+
+# Try to find a declaration for wcstombs_l(). It might be in stdlib.h
+# (following the POSIX requirement for wcstombs()), or in locale.h, or in
+# xlocale.h. If it's in the latter, define WCSTOMBS_L_IN_XLOCALE.
+wcstombs_l_test = '''
+#include <stdlib.h>
+#include <locale.h>
+@0@
+
+void main(void)
+{
+#ifndef wcstombs_l
+ (void) wcstombs_l;
+#endif
+}
+'''
+if (not cc.compiles(wcstombs_l_test.format(''),
+ name: 'wcstombs_l') and
+ cc.compiles(wcstombs_l_test.format('#include <xlocale.h>'),
+ name: 'wcstombs_l in xlocale.h'))
+ cdata.set('WCSTOMBS_L_IN_XLOCALE', 1)
+endif
+
+
+# MSVC doesn't cope well with defining restrict to __restrict, the spelling it
+# understands, because it conflicts with __declspec(restrict). Therefore we
+# define pg_restrict to the appropriate definition, which presumably won't
+# conflict.
+#
+# We assume C99 support, so we don't need to make this conditional.
+#
+# XXX: Historically we allowed platforms to disable restrict in template
+# files, but that was only added for AIX when building with XLC, which we
+# don't support yet.
+cdata.set('pg_restrict', '__restrict')
+
+
+if cc.links('''
+#include <machine/vmparam.h>
+#include <sys/exec.h>
+
+int main(void)
+{
+ PS_STRINGS->ps_nargvstr = 1;
+ PS_STRINGS->ps_argvstr = "foo";
+}
+''',
+ name: 'PS_STRINGS', args: test_c_args)
+ cdata.set('HAVE_PS_STRINGS', 1)
+else
+ cdata.set('HAVE_PS_STRINGS', false)
+endif
+
+
+# Most libraries are included only if they demonstrably provide a function we
+# need, but libm is an exception: always include it, because there are too
+# many compilers that play cute optimization games that will break probes for
+# standard functions such as pow().
+os_deps += cc.find_library('m', required: false)
+
+rt_dep = cc.find_library('rt', required: false)
+
+dl_dep = cc.find_library('dl', required: false)
+
+util_dep = cc.find_library('util', required: false)
+posix4_dep = cc.find_library('posix4', required: false)
+
+getopt_dep = cc.find_library('getopt', required: false)
+gnugetopt_dep = cc.find_library('gnugetopt', required: false)
+
+# Required on BSDs
+execinfo_dep = cc.find_library('execinfo', required: false)
+
+if host_system == 'cygwin'
+ cygipc_dep = cc.find_library('cygipc', required: false)
+else
+ cygipc_dep = not_found_dep
+endif
+
+if host_system == 'sunos'
+ socket_dep = cc.find_library('socket', required: false)
+else
+ socket_dep = not_found_dep
+endif
+
+# XXX: Might be worth conditioning some checks on the OS, to avoid doing
+# unnecessary checks over and over, particularly on windows.
+func_checks = [
+ ['_configthreadlocale', {'skip': host_system != 'windows'}],
+ ['backtrace_symbols', {'dependencies': [execinfo_dep]}],
+ ['clock_gettime', {'dependencies': [rt_dep, posix4_dep], 'define': false}],
+ ['copyfile'],
+ # gcc/clang's sanitizer helper library provides dlopen but not dlsym, thus
+ # when enabling asan the dlopen check doesn't notice that -ldl is actually
+ # required. Just checking for dlsym() ought to suffice.
+ ['dlsym', {'dependencies': [dl_dep], 'define': false}],
+ ['explicit_bzero'],
+ ['fdatasync', {'dependencies': [rt_dep, posix4_dep], 'define': false}], # Solaris
+ ['getifaddrs'],
+ ['getopt', {'dependencies': [getopt_dep, gnugetopt_dep]}],
+ ['getopt_long', {'dependencies': [getopt_dep, gnugetopt_dep]}],
+ ['getpeereid'],
+ ['getpeerucred'],
+ ['inet_aton'],
+ ['inet_pton'],
+ ['kqueue'],
+ ['mbstowcs_l'],
+ ['memset_s'],
+ ['mkdtemp'],
+ ['posix_fadvise'],
+ ['posix_fallocate'],
+ ['ppoll'],
+ ['pstat'],
+ ['pthread_barrier_wait', {'dependencies': [thread_dep]}],
+ ['pthread_is_threaded_np', {'dependencies': [thread_dep]}],
+ ['sem_init', {'dependencies': [rt_dep, thread_dep], 'skip': sema_kind != 'unnamed_posix', 'define': false}],
+ ['setproctitle', {'dependencies': [util_dep]}],
+ ['setproctitle_fast'],
+ ['shm_open', {'dependencies': [rt_dep], 'define': false}],
+ ['shm_unlink', {'dependencies': [rt_dep], 'define': false}],
+ ['shmget', {'dependencies': [cygipc_dep], 'define': false}],
+ ['socket', {'dependencies': [socket_dep], 'define': false}],
+ ['strchrnul'],
+ ['strerror_r', {'dependencies': [thread_dep]}],
+ ['strlcat'],
+ ['strlcpy'],
+ ['strnlen'],
+ ['strsignal'],
+ ['sync_file_range'],
+ ['syncfs'],
+ ['uselocale'],
+ ['wcstombs_l'],
+]
+
+func_check_results = {}
+foreach c : func_checks
+ func = c.get(0)
+ kwargs = c.get(1, {})
+ deps = kwargs.get('dependencies', [])
+
+ if kwargs.get('skip', false)
+ continue
+ endif
+
+ found = cc.has_function(func, args: test_c_args)
+
+ if not found
+ foreach dep : deps
+ if not dep.found()
+ continue
+ endif
+ found = cc.has_function(func, args: test_c_args,
+ dependencies: [dep])
+ if found
+ os_deps += dep
+ break
+ endif
+ endforeach
+ endif
+
+ func_check_results += {func: found}
+
+ if kwargs.get('define', true)
+ # Emulate autoconf behaviour of not-found->undef, found->1
+ cdata.set('HAVE_' + func.underscorify().to_upper(),
+ found ? 1 : false,
+ description: 'Define to 1 if you have the `@0@\' function.'.format(func))
+ endif
+endforeach
+
+
+if cc.has_function('syslog', args: test_c_args) and \
+ cc.check_header('syslog.h', args: test_c_args)
+ cdata.set('HAVE_SYSLOG', 1)
+endif
+
+
+# if prerequisites for unnamed posix semas aren't fulfilled, fall back to sysv
+# semaphores
+if sema_kind == 'unnamed_posix' and \
+ not func_check_results.get('sem_init', false)
+ sema_kind = 'sysv'
+endif
+
+cdata.set('USE_@0@_SHARED_MEMORY'.format(shmem_kind.to_upper()), 1)
+cdata.set('USE_@0@_SEMAPHORES'.format(sema_kind.to_upper()), 1)
+
+cdata.set('MEMSET_LOOP_LIMIT', memset_loop_limit)
+cdata.set_quoted('DLSUFFIX', dlsuffix)
+
+
+
+###############################################################
+# Threading
+###############################################################
+
+# XXX: About to rely on thread safety in the autoconf build, so not worth
+# implementing a fallback.
+cdata.set('ENABLE_THREAD_SAFETY', 1)
+
+
+
+###############################################################
+# NLS / Gettext
+###############################################################
+
+nlsopt = get_option('nls')
+libintl = not_found_dep
+
+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)
+
+ # meson 0.59 has this wrapped in dependency('int')
+ if (msgfmt.found() and
+ cc.check_header('libintl.h', required: nlsopt,
+ args: test_c_args, include_directories: postgres_inc))
+
+ # in libc
+ if cc.has_function('ngettext')
+ libintl = declare_dependency()
+ else
+ libintl = cc.find_library('intl',
+ has_headers: ['libintl.h'], required: nlsopt,
+ header_include_directories: postgres_inc,
+ dirs: test_lib_d)
+ endif
+ endif
+
+ if libintl.found()
+ i18n = import('i18n')
+ cdata.set('ENABLE_NLS', 1)
+ endif
+endif
+
+
+
+###############################################################
+# Build
+###############################################################
+
+# Set up compiler / linker arguments to be used everywhere, individual targets
+# can add further args directly, or indirectly via dependencies
+add_project_arguments(cflags, language: ['c'])
+add_project_arguments(cppflags, language: ['c'])
+add_project_arguments(cflags_warn, language: ['c'])
+add_project_arguments(cxxflags, language: ['cpp'])
+add_project_arguments(cppflags, language: ['cpp'])
+add_project_arguments(cxxflags_warn, language: ['cpp'])
+add_project_link_arguments(ldflags, language: ['c', 'cpp'])
+
+
+# Collect a number of lists of things while recursing through the source
+# tree. Later steps then can use those.
+
+# list of targets for various alias targets
+backend_targets = []
+bin_targets = []
+pl_targets = []
+contrib_targets = []
+testprep_targets = []
+
+
+# Define the tests to distribute them to the correct test styles later
+test_deps = []
+tests = []
+
+
+# Default options for targets
+
+# First identify rpaths
+bin_install_rpaths = []
+lib_install_rpaths = []
+mod_install_rpaths = []
+
+# Add extra_lib_dirs to rpath. Not needed on darwin, as the install_name of
+# libraries in extra_lib_dirs will be used anyway.
+if host_system != 'darwin'
+ bin_install_rpaths += postgres_lib_d
+ lib_install_rpaths += postgres_lib_d
+ mod_install_rpaths += postgres_lib_d
+endif
+
+
+# Define arguments for default targets
+
+default_target_args = {
+ 'implicit_include_directories': false,
+ 'install': true,
+}
+
+default_lib_args = default_target_args + {
+ 'name_prefix': '',
+ 'install_rpath': ':'.join(lib_install_rpaths),
+}
+
+internal_lib_args = default_lib_args + {
+ 'build_by_default': false,
+ 'install': false,
+}
+
+default_mod_args = default_lib_args + {
+ 'name_prefix': '',
+ 'install_dir': dir_lib_pkg,
+ 'install_rpath': ':'.join(mod_install_rpaths),
+}
+
+default_bin_args = default_target_args + {
+ 'install_dir': dir_bin,
+ 'install_rpath': ':'.join(bin_install_rpaths),
+}
+
+
+
+# Helper for exporting a limited number of symbols
+gen_export_kwargs = {
+ 'input': 'exports.txt',
+ 'output': '@BASENAME@.'+export_file_suffix,
+ 'command': [perl, files('src/tools/gen_export.pl'),
+ '--format', export_file_format,
+ '--input', '@INPUT0@', '--output', '@OUTPUT0@'],
+ 'build_by_default': false,
+ 'install': false,
+}
+
+
+
+# headers that the whole build tree depends on
+generated_headers = []
+# headers that the backend build depends on
+generated_backend_headers = []
+# configure_files() output, needs a way of converting to file names
+configure_files = []
+
+# generated files that might conflict with a partial in-tree autoconf build
+generated_sources = []
+# same, for paths that differ between autoconf / meson builds
+# elements are [dir, [files]]
+generated_sources_ac = {}
+
+
+# First visit src/include - all targets creating headers are defined
+# within. That makes it easy to add the necessary dependencies for the
+# subsequent build steps.
+
+subdir('src/include')
+
+subdir('config')
+
+# Then through src/port and src/common, as most other things depend on them
+
+frontend_port_code = declare_dependency(
+ compile_args: ['-DFRONTEND'],
+ include_directories: [postgres_inc],
+ dependencies: os_deps,
+)
+
+backend_port_code = declare_dependency(
+ compile_args: ['-DBUILDING_DLL'],
+ include_directories: [postgres_inc],
+ sources: [errcodes], # errcodes.h is needed due to use of ereport
+ dependencies: os_deps,
+)
+
+subdir('src/port')
+
+frontend_common_code = declare_dependency(
+ compile_args: ['-DFRONTEND'],
+ include_directories: [postgres_inc],
+ sources: generated_headers,
+ dependencies: [os_deps, zlib, zstd],
+)
+
+backend_common_code = declare_dependency(
+ compile_args: ['-DBUILDING_DLL'],
+ include_directories: [postgres_inc],
+ sources: generated_headers,
+ dependencies: [os_deps, zlib, zstd],
+)
+
+subdir('src/common')
+
+frontend_shlib_code = declare_dependency(
+ compile_args: ['-DFRONTEND'],
+ include_directories: [postgres_inc],
+ link_args: ldflags_sl,
+ link_with: [pgport_shlib, common_shlib],
+ sources: generated_headers,
+ dependencies: [os_deps, libintl],
+)
+
+libpq_deps += [
+ frontend_shlib_code,
+ thread_dep,
+
+ gssapi,
+ ldap_r,
+ libintl,
+ ssl,
+]
+
+subdir('src/interfaces/libpq')
+# fe_utils depends on libpq
+subdir('src/fe_utils')
+
+frontend_code = declare_dependency(
+ include_directories: [postgres_inc],
+ link_with: [fe_utils, common_static, pgport_static],
+ sources: generated_headers,
+ dependencies: [os_deps, libintl],
+)
+
+backend_both_deps += [
+ thread_dep,
+ bsd_auth,
+ gssapi,
+ icu,
+ icu_i18n,
+ ldap,
+ libintl,
+ libxml,
+ lz4,
+ pam,
+ ssl,
+ systemd,
+ zlib,
+ zstd,
+]
+
+backend_mod_deps = backend_both_deps + os_deps
+
+backend_code = declare_dependency(
+ compile_args: ['-DBUILDING_DLL'],
+ include_directories: [postgres_inc],
+ link_args: ldflags_be,
+ link_with: [],
+ sources: generated_headers + generated_backend_headers,
+ dependencies: os_deps + backend_both_deps + backend_deps,
+)
+
+# src/backend/meson.build defines backend_mod_code used for extension
+# libraries.
+
+
+# Then through the main sources. That way contrib can have dependencies on
+# main sources. Note that this explicitly doesn't enter src/test, right now a
+# few regression tests depend on contrib files.
+
+subdir('src')
+
+subdir('contrib')
+
+subdir('src/test')
+subdir('src/interfaces/libpq/test')
+subdir('src/interfaces/ecpg/test')
+
+subdir('doc/src/sgml')
+
+generated_sources_ac += {'': ['GNUmakefile']}
+
+
+# If there are any files in the source directory that we also generate in the
+# build directory, they might get preferred over the newly generated files,
+# e.g. because of a #include "file", which always will search in the current
+# directory first.
+message('checking for file conflicts between source and build directory')
+conflicting_files = []
+potentially_conflicting_files_t = []
+potentially_conflicting_files_t += generated_headers
+potentially_conflicting_files_t += generated_backend_headers
+potentially_conflicting_files_t += generated_backend_sources
+potentially_conflicting_files_t += generated_sources
+
+potentially_conflicting_files = []
+
+# convert all sources of potentially conflicting files into uniform shape
+foreach t : potentially_conflicting_files_t
+ potentially_conflicting_files += t.full_path()
+endforeach
+foreach t : configure_files
+ t = '@0@'.format(t)
+ potentially_conflicting_files += meson.current_build_dir() / t
+endforeach
+foreach sub, fnames : generated_sources_ac
+ sub = meson.build_root() / sub
+ foreach fname : fnames
+ potentially_conflicting_files += sub / fname
+ endforeach
+endforeach
+
+# find and report conflicting files
+foreach build_path : potentially_conflicting_files
+ build_path = host_system == 'windows' ? fs.as_posix(build_path) : build_path
+ # str.replace is in 0.56
+ src_path = meson.current_source_dir() / build_path.split(meson.current_build_dir() / '')[1]
+ if fs.exists(src_path) or fs.is_symlink(src_path)
+ conflicting_files += src_path
+ endif
+endforeach
+# XXX: Perhaps we should generate a file that would clean these up? The list
+# can be long.
+if conflicting_files.length() > 0
+ errmsg_cleanup = '''
+Conflicting files in source directory:
+ @0@
+
+The conflicting files need to be removed, either by removing the files listed
+above, or by running configure and then make maintainer-clean.
+'''
+ errmsg_cleanup = errmsg_cleanup.format(' '.join(conflicting_files))
+ error(errmsg_nonclean_base.format(errmsg_cleanup))
+endif
+
+
+
+###############################################################
+# Test prep
+###############################################################
+
+# The determination of where a DESTDIR install points to is ugly, it's somewhat hard
+# to combine two absolute paths portably...
+
+prefix = get_option('prefix')
+
+test_prefix = prefix
+
+if fs.is_absolute(get_option('prefix'))
+ if host_system == 'windows'
+ if prefix.split(':\\').length() == 1
+ # just a drive
+ test_prefix = ''
+ else
+ test_prefix = prefix.split(':\\')[1]
+ endif
+ else
+ assert(prefix.startswith('/'))
+ test_prefix = './@0@'.format(prefix)
+ endif
+endif
+
+# DESTDIR for the installation used to run tests in
+test_install_destdir = meson.build_root() / 'tmp_install/'
+# DESTDIR + prefix appropriately munged
+test_install_location = test_install_destdir / test_prefix
+
+
+meson_install_args = meson_args + ['install'] + {
+ 'meson': ['--quiet', '--only-changed', '--no-rebuild'],
+ 'muon': []
+}[meson_impl]
+
+test('tmp_install',
+ meson_bin, args: meson_install_args ,
+ env: {'DESTDIR':test_install_destdir},
+ priority: 100,
+ timeout: 300,
+ is_parallel: false,
+ suite: ['setup'])
+
+test_result_dir = meson.build_root() / 'testrun'
+
+
+# XXX: pg_regress doesn't assign unique ports on windows. To avoid the
+# inevitable conflicts from running tests in parallel, hackishly assign
+# different ports for different tests.
+
+testport = 40000
+
+test_env = environment()
+
+temp_install_bindir = test_install_location / get_option('bindir')
+test_env.set('PG_REGRESS', pg_regress.full_path())
+test_env.set('REGRESS_SHLIB', regress_module.full_path())
+
+# Test suites that are not safe by default but can be run if selected
+# by the user via the whitespace-separated list in variable PG_TEST_EXTRA.
+# Export PG_TEST_EXTRA so it can be checked in individual tap tests.
+test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA'))
+
+# Add the temporary installation to the library search path on platforms where
+# that works (everything but windows, basically). On windows everything
+# library-like gets installed into bindir, solving that issue.
+if library_path_var != ''
+ test_env.prepend(library_path_var, test_install_location / get_option('libdir'))
+endif
+
+
+
+###############################################################
+# Test Generation
+###############################################################
+
+testwrap = files('src/tools/testwrap')
+
+foreach test_dir : tests
+ testwrap_base = [
+ testwrap,
+ '--basedir', meson.build_root(),
+ '--srcdir', test_dir['sd'],
+ '--testgroup', test_dir['name'],
+ ]
+
+ foreach kind, v : test_dir
+ if kind in ['sd', 'bd', 'name']
+ continue
+ endif
+
+ t = test_dir[kind]
+
+ if kind in ['regress', 'isolation', 'ecpg']
+ if kind == 'regress'
+ runner = pg_regress
+ elif kind == 'isolation'
+ runner = pg_isolation_regress
+ elif kind == 'ecpg'
+ runner = pg_regress_ecpg
+ endif
+
+ test_output = test_result_dir / test_dir['name'] / kind
+
+ test_command = [
+ runner.full_path(),
+ '--inputdir', t.get('inputdir', test_dir['sd']),
+ '--expecteddir', t.get('expecteddir', test_dir['sd']),
+ '--outputdir', test_output,
+ '--temp-instance', test_output / 'tmp_check',
+ '--bindir', '',
+ '--dlpath', test_dir['bd'],
+ '--max-concurrent-tests=20',
+ '--port', testport.to_string(),
+ ] + t.get('regress_args', [])
+
+ if t.has_key('schedule')
+ test_command += ['--schedule', t['schedule'],]
+ endif
+
+ if kind == 'isolation'
+ test_command += t.get('specs', [])
+ else
+ test_command += t.get('sql', [])
+ endif
+
+ env = test_env
+ env.prepend('PATH', temp_install_bindir, test_dir['bd'])
+
+ test_kwargs = {
+ 'suite': [test_dir['name']],
+ 'priority': 10,
+ 'timeout': 1000,
+ 'depends': test_deps + t.get('deps', []),
+ 'env': env,
+ } + t.get('test_kwargs', {})
+
+ test(test_dir['name'] / kind,
+ python,
+ args: testwrap_base + [
+ '--testname', kind,
+ '--', test_command,
+ ],
+ kwargs: test_kwargs,
+ )
+
+ testport += 1
+ elif kind == 'tap'
+ if not tap_tests_enabled
+ continue
+ endif
+
+ test_command = [
+ perl.path(),
+ '-I', meson.source_root() / 'src/test/perl',
+ '-I', test_dir['sd'],
+ ]
+
+ # Add temporary install, the build directory for non-installed binaries and
+ # also test/ for non-installed test binaries built separately.
+ env = test_env
+ env.prepend('PATH', temp_install_bindir, test_dir['bd'], test_dir['bd'] / 'test')
+
+ foreach name, value : t.get('env', {})
+ env.set(name, value)
+ endforeach
+
+ test_kwargs = {
+ 'protocol': 'tap',
+ 'suite': [test_dir['name']],
+ 'timeout': 1000,
+ 'depends': test_deps + t.get('deps', []),
+ 'env': env,
+ } + t.get('test_kwargs', {})
+
+ foreach onetap : t['tests']
+ # Make tap test names prettier, remove t/ and .pl
+ onetap_p = onetap
+ if onetap_p.startswith('t/')
+ onetap_p = onetap.split('t/')[1]
+ endif
+ if onetap_p.endswith('.pl')
+ onetap_p = fs.stem(onetap_p)
+ endif
+
+ test(test_dir['name'] / onetap_p,
+ python,
+ kwargs: test_kwargs,
+ args: testwrap_base + [
+ '--testname', onetap_p,
+ '--', test_command,
+ test_dir['sd'] / onetap,
+ ],
+ )
+ endforeach
+ else
+ error('unknown kind @0@ of test in @1@'.format(kind, test_dir['sd']))
+ endif
+
+ endforeach # kinds of tests
+
+endforeach # directories with tests
+
+
+
+###############################################################
+# Pseudo targets
+###############################################################
+
+alias_target('backend', backend_targets)
+alias_target('bin', bin_targets + [libpq_st])
+alias_target('pl', pl_targets)
+alias_target('contrib', contrib_targets)
+alias_target('testprep', testprep_targets)
+
+
+
+###############################################################
+# The End, The End, My Friend
+###############################################################
+
+if meson.version().version_compare('>=0.57')
+
+ summary(
+ {
+ 'data block size': cdata.get('BLCKSZ'),
+ 'WAL block size': cdata.get('XLOG_BLCKSZ') / 1024,
+ 'segment size': cdata.get('RELSEG_SIZE') / 131072,
+ },
+ section: 'Data layout',
+ )
+
+ summary(
+ {
+ 'host system': '@0@ @1@'.format(host_system, host_cpu),
+ 'build system': '@0@ @1@'.format(build_machine.system(),
+ build_machine.cpu_family()),
+ },
+ section: 'System',
+ )
+
+ summary(
+ {
+ 'linker': '@0@'.format(cc.get_linker_id()),
+ 'C compiler': '@0@ @1@'.format(cc.get_id(), cc.version()),
+ },
+ section: 'Compiler',
+ )
+
+ summary(
+ {
+ 'CPP FLAGS': ' '.join(cppflags),
+ 'C FLAGS, functional': ' '.join(cflags),
+ 'C FLAGS, warnings': ' '.join(cflags_warn),
+ },
+ section: 'Compiler Flags',
+ )
+
+ if llvm.found()
+ summary(
+ {
+ 'C++ compiler': '@0@ @1@'.format(cpp.get_id(), cpp.version()),
+ },
+ section: 'Compiler',
+ )
+
+ summary(
+ {
+ 'C++ FLAGS, functional': ' '.join(cxxflags),
+ 'C++ FLAGS, warnings': ' '.join(cxxflags_warn),
+ },
+ section: 'Compiler Flags',
+ )
+ endif
+
+ summary(
+ {
+ 'bison': '@0@ @1@'.format(bison.full_path(), bison_version),
+ 'dtrace': dtrace,
+ },
+ section: 'Programs',
+ )
+
+ summary(
+ {
+ 'bonjour': bonjour,
+ 'bsd_auth': bsd_auth,
+ 'gss': gssapi,
+ 'icu': icu,
+ 'ldap': ldap,
+ 'libxml': libxml,
+ 'libxslt': libxslt,
+ 'llvm': llvm,
+ 'lz4': lz4,
+ 'nls': libintl,
+ 'pam': pam,
+ 'plperl': perl_dep,
+ 'plpython': python3_dep,
+ 'pltcl': tcl_dep,
+ 'readline': readline,
+ 'selinux': selinux,
+ 'ssl': ssl,
+ 'systemd': systemd,
+ 'uuid': uuid,
+ 'zlib': zlib,
+ 'zstd': zstd,
+ },
+ section: 'External libraries',
+ )
+
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..b629cd8d689
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,185 @@
+# Data layout influencing options
+
+option('blocksize', type : 'combo',
+ choices : ['1', '2', '4', '8', '16', '32'],
+ value : '8',
+ description: 'set relation block size in kB')
+
+option('wal_blocksize', type : 'combo',
+ choices: ['1', '2', '4', '8', '16', '32', '64'],
+ value: '8',
+ description : '''WAL block size, in kilobytes''')
+
+option('segsize', type : 'integer', value : 1,
+ description : '''Segment size, in gigabytes''')
+
+
+# Miscellaneous options
+
+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')
+
+
+# Defaults
+
+option('pgport', type : 'integer', value : 5432,
+ min: 1, max: 65535,
+ description : '''Default port number for server and clients''')
+
+
+# Developer options
+
+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')
+
+option('PG_TEST_EXTRA', type : 'string', value: '',
+ description: 'Enable selected extra tests')
+
+option('atomics', type : 'boolean', value: true,
+ description: 'whether to use atomic operations')
+
+option('spinlocks', type : 'boolean', value: true,
+ description: 'whether to use spinlocks')
+
+
+# Compilation options
+
+option('extra_include_dirs', type : 'array', value: [],
+ 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')
+
+option('extra_version', type : 'string', value: '',
+ description: 'append STRING to the PostgreSQL version number')
+
+option('darwin_sysroot', type : 'string', value: '',
+ description: 'select a non-default sysroot path')
+
+
+# External dependencies
+
+option('bonjour', type : 'feature', value: 'auto',
+ description: 'build with Bonjour support')
+
+option('bsd_auth', type : 'feature', value: 'auto',
+ description: 'build with BSD Authentication support')
+
+option('dtrace', type : 'feature', value: 'disabled',
+ description: 'DTrace support')
+
+option('gssapi', type : 'feature', value: 'auto',
+ description: 'GSSAPI support')
+
+option('icu', type : 'feature', value: 'auto',
+ description: 'ICU support')
+
+option('ldap', type : 'feature', value: 'auto',
+ description: 'LDAP support')
+
+option('libedit_preferred', type : 'boolean', value: false,
+ description: 'Prefer BSD Libedit over GNU Readline')
+
+option('libxml', type : 'feature', value: 'auto',
+ description: 'XML support')
+
+option('libxslt', type : 'feature', value: 'auto',
+ description: 'XSLT support in contrib/xml2')
+
+option('llvm', type : 'feature', value: 'disabled',
+ description: 'whether to use llvm')
+
+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',
+ description: 'build with PAM support')
+
+option('plperl', type : 'feature', value: 'auto',
+ description: 'build Perl modules (PL/Perl)')
+
+option('plpython', type : 'feature', value: 'auto',
+ description: 'build Python modules (PL/Python)')
+
+option('pltcl', type : 'feature', value: 'auto',
+ description: 'build with TCL support')
+
+option('tcl_version', type : 'string', value : 'tcl',
+ description: 'specify 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')
+
+option('ssl', type : 'combo', choices : ['none', 'openssl'],
+ value : 'none',
+ description: 'use LIB for SSL/TLS support (openssl)')
+
+option('systemd', type : 'feature', value: 'auto',
+ description: 'build with systemd support')
+
+option('uuid', type : 'combo', choices : ['none', 'bsd', 'e2fs', 'ossp'],
+ value : 'none',
+ description: 'build contrib/uuid-ossp using LIB')
+
+option('zlib', type : 'feature', value: 'auto',
+ description: 'whether to use zlib')
+
+option('zstd', type : 'feature', value: 'auto',
+ description: 'whether to use zstd')
+
+
+# Programs
+
+option('BISON', type : 'array', value: ['bison', 'win_bison'],
+ description: 'path to bison binary')
+
+option('DTRACE', type : 'string', value: 'dtrace',
+ description: 'path to dtrace binary')
+
+option('FLEX', type : 'array', value: ['flex', 'win_flex'],
+ description: 'path to flex binary')
+
+option('GZIP', type : 'string', value: 'gzip',
+ description: 'path to gzip binary')
+
+option('LZ4', type : 'string', value: 'lz4',
+ description: 'path to lz4 binary')
+
+option('PERL', type : 'string', value: 'perl',
+ description: 'path to perl binary')
+
+option('PROVE', type : 'string', value: 'prove',
+ description: 'path to prove binary')
+
+option('PYTHON', type : 'array', value: ['python3', 'python'],
+ description: 'path to python binary')
+
+option('SED', type : 'string', value: 'gsed',
+ description: 'path to sed binary')
+
+option('TAR', type : 'string', value: 'tar',
+ description: 'path to tar binary')
+
+option('XMLLINT', type : 'string', value: 'xmllint',
+ description: 'path to xmllint binary')
+
+option('XSLTPROC', type : 'string', value: 'xsltproc',
+ description: 'path to xsltproc binary')
+
+option('ZSTD', type : 'string', value: 'zstd',
+ description: 'path to zstd binary')
+
+option('ZIC', type : 'string', value: 'zic',
+ description: 'path to zic binary, when cross-compiling')
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000000..b515af15bfa
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,12 @@
+# libraries that other subsystems might depend upon first, in their respective
+# dependency order
+
+subdir('timezone')
+
+subdir('backend')
+
+subdir('bin')
+
+subdir('pl')
+
+subdir('interfaces')
diff --git a/src/timezone/meson.build b/src/timezone/meson.build
new file mode 100644
index 00000000000..daf8b4aa44f
--- /dev/null
+++ b/src/timezone/meson.build
@@ -0,0 +1,56 @@
+# files to build into backend
+timezone_sources = files(
+ 'localtime.c',
+ 'pgtz.c',
+ 'strftime.c',
+)
+
+
+timezone_inc = include_directories('.')
+
+timezone_localtime_source = files('localtime.c')
+
+# files needed to build zic utility program
+zic_sources = files(
+ 'zic.c'
+)
+
+# we now distribute the timezone data as a single file
+tzdata = files(
+ 'data/tzdata.zi'
+)
+
+
+if get_option('system_tzdata') == ''
+ # FIXME: For cross builds, it would need a native built libpgport/pgcommon to
+ # build our zic. But for that we'd need to run a good chunk of the configure
+ # tests both natively and cross. Unclear if it's worth it.
+ if meson.is_cross_build()
+ zic = find_program(get_option('ZIC'), native: true, required: true)
+ else
+ zic = executable('zic', zic_sources,
+ dependencies: [frontend_code],
+ kwargs: default_bin_args + {'install': false}
+ )
+ endif
+
+ tzdata = custom_target('tzdata',
+ input: tzdata,
+ output: ['timezone'],
+ command: [zic, '-d', '@OUTPUT@', '@INPUT@'],
+ install: true,
+ install_dir: dir_data,
+ )
+
+ bin_targets += tzdata
+
+ # FIXME: make sorts this - but the file isn't actually used, so ...
+ custom_target('abbrevs.txt',
+ input: tzdata,
+ output: ['abbrevs.txt'],
+ command: [zic, '-P', '-b', 'fat', 'junkdir', '@INPUT@'],
+ capture: true)
+
+endif
+
+subdir('tznames')
diff --git a/src/timezone/tznames/meson.build b/src/timezone/tznames/meson.build
new file mode 100644
index 00000000000..7e0a682bd9e
--- /dev/null
+++ b/src/timezone/tznames/meson.build
@@ -0,0 +1,21 @@
+tznames = files(
+ 'Africa.txt',
+ 'America.txt',
+ 'Antarctica.txt',
+ 'Asia.txt',
+ 'Atlantic.txt',
+ 'Australia.txt',
+ 'Etc.txt',
+ 'Europe.txt',
+ 'Indian.txt',
+ 'Pacific.txt',
+)
+
+tznames_sets = files(
+ 'Default',
+ 'Australia',
+ 'India')
+
+install_data(tznames, tznames_sets,
+ install_dir: dir_data / 'timezonesets',
+)
diff --git a/src/tools/find_meson b/src/tools/find_meson
new file mode 100755
index 00000000000..50e501a8011
--- /dev/null
+++ b/src/tools/find_meson
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+# Returns the path to the meson binary, for cases where we need to call it as
+# part of the build, e.g. to install into tmp_install/ for the tests.
+
+import os
+import shlex
+import sys
+
+to_print = []
+
+if 'MUON_PATH' in os.environ:
+ to_print += ['muon', os.environ['MUON_PATH']]
+else:
+ mesonintrospect = os.environ['MESONINTROSPECT']
+ components = shlex.split(mesonintrospect)
+
+ if len(components) < 2:
+ print('expected more than two components, got: %s' % components)
+ sys.exit(1)
+
+ if components[-1] != 'introspect':
+ print('expected introspection at the end')
+ sys.exit(1)
+
+ to_print += ['meson'] + components[:-1]
+
+print('\n'.join(to_print), end='')
+
+sys.exit(0)
diff --git a/src/tools/gen_export.pl b/src/tools/gen_export.pl
new file mode 100644
index 00000000000..68b3ab86614
--- /dev/null
+++ b/src/tools/gen_export.pl
@@ -0,0 +1,81 @@
+use strict;
+use warnings;
+use Getopt::Long;
+
+my $format;
+my $libname;
+my $input;
+my $output;
+
+GetOptions(
+ 'format:s' => \$format,
+ 'libname:s' => \$libname,
+ 'input:s' => \$input,
+ 'output:s' => \$output) or die "wrong arguments";
+
+if (not ($format eq 'aix' or $format eq 'darwin' or $format eq 'gnu' or $format eq 'win'))
+{
+ die "$0: $format is not yet handled (only aix, darwin, gnu, win are)\n";
+}
+
+open(my $input_handle, '<', $input)
+ or die "$0: could not open input file '$input': $!\n";
+
+open(my $output_handle, '>', $output)
+ or die "$0: could not open output file '$output': $!\n";
+
+
+if ($format eq 'gnu')
+{
+ print $output_handle "{
+ global:
+";
+}
+elsif ($format eq 'win')
+{
+ # XXX: Looks like specifying LIBRARY $libname is optional, which makes it
+ # easier to build a generic command for generating export files...
+ if ($libname)
+ {
+ print $output_handle "LIBRARY $libname\n";
+ }
+ print $output_handle "EXPORTS\n";
+}
+
+while (<$input_handle>)
+{
+ if (/^#/)
+ {
+ # don't do anything with a comment
+ }
+ elsif (/^(\S+)\s+(\S+)/)
+ {
+ if ($format eq 'aix')
+ {
+ print $output_handle "$1\n";
+ }
+ elsif ($format eq 'darwin')
+ {
+ print $output_handle "_$1\n";
+ }
+ elsif ($format eq 'gnu')
+ {
+ print $output_handle " $1;\n";
+ }
+ elsif ($format eq 'win')
+ {
+ print $output_handle "$1 @ $2\n";
+ }
+ }
+ else
+ {
+ die "$0: unexpected line $_\n";
+ }
+}
+
+if ($format eq 'gnu')
+{
+ print $output_handle " local: *;
+};
+";
+}
diff --git a/src/tools/pgflex b/src/tools/pgflex
new file mode 100755
index 00000000000..baabe2df1c8
--- /dev/null
+++ b/src/tools/pgflex
@@ -0,0 +1,85 @@
+#!/usr/bin/env python3
+
+#
+# Wrapper around flex that:
+# - ensures lex.backup is created in a private directory
+# - can error out if lex.backup is created (--no-backup)
+# - can fix warnings (--fix-warnings)
+# - works around concurrency issues with win_flex.exe:
+# https://github.com/lexxmark/winflexbison/issues/86
+
+import argparse
+import os
+import subprocess
+import sys
+from os.path import abspath
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--flex', type=abspath, required=True)
+parser.add_argument('--perl', type=abspath, required=True)
+parser.add_argument('--builddir', type=abspath, required=True)
+parser.add_argument('--srcdir', type=abspath, required=True)
+parser.add_argument('--privatedir', type=abspath, required=True,
+ help='private directory for target')
+
+parser.add_argument('-o', dest='output_file', type=abspath, required=True,
+ help='output file')
+parser.add_argument('-i', dest='input_file', type=abspath, help='input file')
+
+
+parser.add_argument('--fix-warnings', action='store_true',
+ help='whether to fix warnings in generated file')
+parser.add_argument('--no-backup', action='store_true',
+ help='whether no_backup is enabled or not')
+
+parser.add_argument('flex_flags', nargs='*', help='flags passed on to flex')
+
+args = parser.parse_args()
+
+# Since 'lex.backup' is always named that and ninja uses the top level build
+# directory as current directory for all commands, change directory to
+# temporary directory to avoid conflicts between concurrent flex
+# invocations. Only unreleased versions of flex have an argument to change
+# lex.filename to be named differently.
+if not os.path.isdir(args.privatedir):
+ os.mkdir(args.privatedir)
+os.chdir(args.privatedir)
+
+# win_flex.exe generates names in a racy way, sometimes leading to random
+# "error deleting file" failures and sometimes to intermingled file
+# contents. Set FLEX_TMP_DIR to the target private directory to avoid
+# that. That environment variable isn't consulted on other platforms, so we
+# don't even need to make this conditional.
+env = {'FLEX_TMP_DIR': args.privatedir}
+
+# build flex invocation
+command = [args.flex, '-o', args.output_file]
+if args.no_backup:
+ command += ['-b']
+command += args.flex_flags
+command += [args.input_file]
+
+# create .c file from .l file
+sp = subprocess.run(command, env=env)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# check lex.backup
+if args.no_backup:
+ with open('lex.backup') as lex:
+ if len(lex.readlines()) != 1:
+ sys.exit('Scanner requires backup; see lex.backup.')
+ os.remove('lex.backup')
+
+# fix warnings
+if args.fix_warnings:
+ fix_warning_script = os.path.join(args.srcdir,
+ 'src/tools/fix-old-flex-code.pl')
+
+ command = [args.perl, fix_warning_script, args.output_file]
+ sp = subprocess.run(command)
+ if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+sys.exit(0)
diff --git a/src/tools/testwrap b/src/tools/testwrap
new file mode 100755
index 00000000000..7a64fe76a2d
--- /dev/null
+++ b/src/tools/testwrap
@@ -0,0 +1,47 @@
+#!/usr/bin/env python3
+
+import argparse
+import shutil
+import subprocess
+import os
+import sys
+
+parser = argparse.ArgumentParser()
+
+parser.add_argument('--srcdir', help='source directory of test', type=str)
+parser.add_argument('--basedir', help='base directory of test', type=str)
+parser.add_argument('--testgroup', help='test group', type=str)
+parser.add_argument('--testname', help='test name', type=str)
+parser.add_argument('test_command', nargs='*')
+
+args = parser.parse_args()
+
+testdir = '{}/testrun/{}/{}'.format(
+ args.basedir, args.testgroup, args.testname)
+
+print('# executing test in {} group {} test {}'.format(
+ testdir, args.testgroup, args.testname))
+sys.stdout.flush()
+
+if os.path.exists(testdir) and os.path.isdir(testdir):
+ shutil.rmtree(testdir)
+os.makedirs(testdir)
+
+os.chdir(args.srcdir)
+
+# mark test as having started
+open(os.path.join(testdir, 'test.start'), 'x')
+
+env_dict = {**os.environ,
+ 'TESTDATADIR': os.path.join(testdir, 'data'),
+ 'TESTLOGDIR': os.path.join(testdir, 'log')}
+
+sp = subprocess.run(args.test_command, env=env_dict)
+
+if sp.returncode == 0:
+ print('# test succeeded')
+ open(os.path.join(testdir, 'test.success'), 'x')
+else:
+ print('# test failed')
+ open(os.path.join(testdir, 'test.fail'), 'x')
+sys.exit(sp.returncode)
--
2.37.3.542.gdd3f6c4cae
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 17:56 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andres Freund <andres@anarazel.de>
3 siblings, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-09-21 17:56 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> I think we should:
> - convert windows to build with ninja - it builds faster, runs all tests,
> parallelizes tests. That means that msbuild based builds don't have coverage
> via CI / cfbot, but we don't currently have the resources to test both.
Check. The sooner we can get rid of the custom MSVC scripts, the better,
because now we'll be on the hook to maintain *three* build systems.
> - add a linux build using meson, we currently can afford building both with
> autoconf and meson for linux
Right.
> I'm less clear on whether we should convert macos / freebsd to meson at this
> point?
We certainly could debug/polish the meson stuff just on linux and windows
for now, but is there a reason to wait on the others?
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 18:21 Andres Freund <andres@anarazel.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-21 18:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-21 13:56:37 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > I think we should:
>
> > - convert windows to build with ninja - it builds faster, runs all tests,
> > parallelizes tests. That means that msbuild based builds don't have coverage
> > via CI / cfbot, but we don't currently have the resources to test both.
>
> Check. The sooner we can get rid of the custom MSVC scripts, the better,
> because now we'll be on the hook to maintain *three* build systems.
Agreed. I think the only "major" missing thing is the windows resource file
generation stuff, which is mostly done in one of the "later" commits. Also
need to test a few more of the optional dependencies (ICU, gettext, ...) on
windows (I did test zlib, lz4, zstd). And of course get a bit of wider
exposure than "just me and CI".
> > I'm less clear on whether we should convert macos / freebsd to meson at this
> > point?
>
> We certainly could debug/polish the meson stuff just on linux and windows
> for now, but is there a reason to wait on the others?
No - freebsd and macos have worked in CI for a long time. I was wondering
whether we want more coverage for autoconf in CI, but thinking about it
futher, it's more important to have the meson coverage.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 18:22 Justin Pryzby <pryzby@telsasoft.com>
parent: Andres Freund <andres@anarazel.de>
3 siblings, 0 replies; 81+ messages in thread
From: Justin Pryzby @ 2022-09-21 18:22 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Wed, Sep 21, 2022 at 09:46:30AM -0700, Andres Freund wrote:
> I think we should:
>
> - convert windows to build with ninja - it builds faster, runs all tests,
> parallelizes tests. That means that msbuild based builds don't have coverage
> via CI / cfbot, but we don't currently have the resources to test both.
+1
If multiple Windows (or other) tasks are going to exist, I think they
should have separate "ci-os-only" conditions, like windows-msvc,
windows-ninja, ... It should be possible to run only one.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-21 23:10 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
3 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-21 23:10 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; +Cc: samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-21 09:46:30 -0700, Andres Freund wrote:
> After that I am planning to split the "ci" commit so that it converts a few of
> the CI tasks to use meson, without adding all the other platforms I added for
> development. I think that's important to get in soon, given that it'll
> probably take a bit until the buildfarm grows meson coverage and because it
> provides cfbot coverage which seems important for now as well.
>
> I think we should:
>
> - convert windows to build with ninja - it builds faster, runs all tests,
> parallelizes tests. That means that msbuild based builds don't have coverage
> via CI / cfbot, but we don't currently have the resources to test both.
I was working on that and hit an issue that took me a while to resolve: Once I
tested only the "main" meson commit plus CI the windows task was running out
of memory. There was an outage of the CI provider at the same time, so I first
blamed it on that. But it turns out to be "legitimately" high memory usage
related to debug symbols - the only reason CI didn't show that before was that
it's incidentally fixed as a indirect consequence of using precompiled
headers, in a later commit. Argh. It can also be fixed by the option required
to use ccache at some point, so I'll do that for now.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 05:57 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
3 siblings, 2 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-22 05:57 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; +Cc: samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-21 09:46:30 -0700, Andres Freund wrote:
> I'm planning to commit this today, unless somebody wants to argue against
> that.
And done!
Changes:
- fixed a few typos (thanks Thomas)
- less duplication in the CI tasks
- removed an incomplete implementation of the target for abbrevs.txt - do we
even want to have that?
- plenty hand wringing on my part
I also rebased my meson git tree, which still has plenty additional test
platforms (netbsd, openbsd, debian sid, fedora rawhide, centos 8, centos 7,
opensuse tumbleweed), but without the autoconf versions of those targets. I
also added a commit that translates most of the CompilerWarnings task to
meson. Still need to add a headerscheck / cpluspluscheck target.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 08:29 Andrew Dunstan <andrew@dunslane.net>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 2 replies; 81+ messages in thread
From: Andrew Dunstan @ 2022-09-22 08:29 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; +Cc: samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 2022-09-22 Th 01:57, Andres Freund wrote:
> Hi,
>
> On 2022-09-21 09:46:30 -0700, Andres Freund wrote:
>> I'm planning to commit this today, unless somebody wants to argue against
>> that.
> And done!
>
> Changes:
> - fixed a few typos (thanks Thomas)
> - less duplication in the CI tasks
> - removed an incomplete implementation of the target for abbrevs.txt - do we
> even want to have that?
> - plenty hand wringing on my part
>
>
> I also rebased my meson git tree, which still has plenty additional test
> platforms (netbsd, openbsd, debian sid, fedora rawhide, centos 8, centos 7,
> opensuse tumbleweed), but without the autoconf versions of those targets. I
> also added a commit that translates most of the CompilerWarnings task to
> meson. Still need to add a headerscheck / cpluspluscheck target.
>
Great. Now I'll start on buildfarm support. Given my current
commitments, this will take me a while, but I hope to have a working
client by about the beginning of November.
cheers
andrew
--
Andrew Dunstan
EDB: https://www.enterprisedb.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 14:49 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-09-22 14:49 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2022-09-21 09:46:30 -0700, Andres Freund wrote:
>> I'm planning to commit this today, unless somebody wants to argue against
>> that.
> And done!
Yay!
Initial reports from the cfbot are mostly promising, but there are a few
patches where all the meson builds fail while all the autoconf ones pass,
so there's something for you to look at. So far CF entries 3464, 3733,
3771, 3808 look that way.
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 14:56 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 81+ messages in thread
From: Alvaro Herrera @ 2022-09-22 14:56 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 2022-Sep-22, Tom Lane wrote:
> Initial reports from the cfbot are mostly promising, but there are a few
> patches where all the meson builds fail while all the autoconf ones pass,
> so there's something for you to look at. So far CF entries 3464, 3733,
> 3771, 3808 look that way.
Hmm, but those patches add files, which means they're now outdated: they
need to add these files to the respective meson.build file.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"La experiencia nos dice que el hombre peló millones de veces las patatas,
pero era forzoso admitir la posibilidad de que en un caso entre millones,
las patatas pelarían al hombre" (Ijon Tichy)
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 15:04 Tom Lane <tgl@sss.pgh.pa.us>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
1 sibling, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-09-22 15:04 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Andres Freund <andres@anarazel.de>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2022-Sep-22, Tom Lane wrote:
>> Initial reports from the cfbot are mostly promising, but there are a few
>> patches where all the meson builds fail while all the autoconf ones pass,
>> so there's something for you to look at. So far CF entries 3464, 3733,
>> 3771, 3808 look that way.
> Hmm, but those patches add files, which means they're now outdated: they
> need to add these files to the respective meson.build file.
Ah, right, the joys of maintaining multiple build systems. I wonder
if there's any way to avoid that by scraping file lists from one
group to the other. We got a little spoiled perhaps by the MSVC
scripts managing to do that in most cases.
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 15:05 Andres Freund <andres@anarazel.de>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
1 sibling, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-22 15:05 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-22 16:56:57 +0200, Alvaro Herrera wrote:
> On 2022-Sep-22, Tom Lane wrote:
> > Initial reports from the cfbot are mostly promising, but there are a few
> > patches where all the meson builds fail while all the autoconf ones pass,
> > so there's something for you to look at. So far CF entries 3464, 3733,
> > 3771, 3808 look that way.
>
> Hmm, but those patches add files, which means they're now outdated: they
> need to add these files to the respective meson.build file.
Yea, I looked through all of these and they all need need a simple addition of
a file to be built or installed.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 15:05 Andres Freund <andres@anarazel.de>
parent: Andrew Dunstan <andrew@dunslane.net>
1 sibling, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-22 15:05 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-22 04:29:15 -0400, Andrew Dunstan wrote:
> Great. Now I'll start on buildfarm support. Given my current
> commitments, this will take me a while, but I hope to have a working
> client by about the beginning of November.
Great! Let me know if there's something I can do to help.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 15:21 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 81+ messages in thread
From: Alvaro Herrera @ 2022-09-22 15:21 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 2022-Sep-22, Tom Lane wrote:
> Ah, right, the joys of maintaining multiple build systems. I wonder
> if there's any way to avoid that by scraping file lists from one
> group to the other.
Or maybe we could have a file common to both, say OBJS, which both
scrape in their own way. That could be easier than one scraping the
other.
> We got a little spoiled perhaps by the MSVC scripts managing to do
> that in most cases.
Right ... and it was so annoying in the cases it couldn't.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Aprender sin pensar es inútil; pensar sin aprender, peligroso" (Confucio)
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 20:05 Nathan Bossart <nathandbossart@gmail.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 2 replies; 81+ messages in thread
From: Nathan Bossart @ 2022-09-22 20:05 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
I gave the meson build system a try, and it seems to work nicely. It
didn't take long at all to adapt my workflow.
A few notes from my experience:
* I'm using an Ubuntu-based distribution, and the version of meson that apt
installed was not new enough for Postgres. I ended up cloning meson [0]
and using the newest tag. This is no big deal.
* The installed binaries were unable to locate libraries like libpq. I
ended up setting the extra_lib_dirs option to the directory where these
libraries were installed to fix this. This one is probably worth
investigating further.
* meson really doesn't like it when there are things leftover from
configure/make. Whenever I switch from make to meson, I have to run 'make
maintainer-clean'.
Otherwise, all of my usual build options, ccache, etc. are working just
like before. Nice work!
[0] https://github.com/mesonbuild/meson
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 20:21 Peter Geoghegan <pg@bowt.ie>
parent: Nathan Bossart <nathandbossart@gmail.com>
1 sibling, 1 reply; 81+ messages in thread
From: Peter Geoghegan @ 2022-09-22 20:21 UTC (permalink / raw)
To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Andres Freund <andres@anarazel.de>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Thu, Sep 22, 2022 at 1:05 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
> Otherwise, all of my usual build options, ccache, etc. are working just
> like before. Nice work!
+1
Is it generally recommended that individual hackers mostly switch over
to Meson for their day to day work soon? I'm guessing that this
question doesn't really have a clear answer yet, but thought I'd ask,
just in case.
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 20:28 Andres Freund <andres@anarazel.de>
parent: Nathan Bossart <nathandbossart@gmail.com>
1 sibling, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-22 20:28 UTC (permalink / raw)
To: Nathan Bossart <nathandbossart@gmail.com>; +Cc: Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-22 13:05:33 -0700, Nathan Bossart wrote:
> I gave the meson build system a try, and it seems to work nicely. It
> didn't take long at all to adapt my workflow.
>
> A few notes from my experience:
>
> * I'm using an Ubuntu-based distribution, and the version of meson that apt
> installed was not new enough for Postgres. I ended up cloning meson [0]
> and using the newest tag. This is no big deal.
I assume this is 20.04 LTS? If so, we're missing it by one version of meson
currently. There's unfortunately a few features that'd be a bit painful to not
have.
> * The installed binaries were unable to locate libraries like libpq. I
> ended up setting the extra_lib_dirs option to the directory where these
> libraries were installed to fix this. This one is probably worth
> investigating further.
I think that should be "fixed" in a later commit in the meson tree - any
chance you could try that?
https://github.com/anarazel/postgres/tree/meson
> * meson really doesn't like it when there are things leftover from
> configure/make. Whenever I switch from make to meson, I have to run 'make
> maintainer-clean'.
Yes. I recommend building out-of-tree with autoconf as well.
> Otherwise, all of my usual build options, ccache, etc. are working just
> like before. Nice work!
Cool!
Thanks for testing,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 21:50 Andres Freund <andres@anarazel.de>
parent: Peter Geoghegan <pg@bowt.ie>
0 siblings, 2 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-22 21:50 UTC (permalink / raw)
To: Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-22 13:21:28 -0700, Peter Geoghegan wrote:
> Is it generally recommended that individual hackers mostly switch over
> to Meson for their day to day work soon? I'm guessing that this
> question doesn't really have a clear answer yet, but thought I'd ask,
> just in case.
It'll probably depend on who you ask ;)
I'm likely the most biased person on this, but for me the reliable incremental
builds and the readability of the test output are big enough wins that the
answer is pretty clear... Doesn't hurt that running all tests is faster too.
The currently existing limitations are imo mostly around making it usable for
production, particularly on windows.
time to run all tests (cassert, -Og), in a fully built tree:
make:
time make -j48 -s -Otarget check-world
real 2m44.206s
user 6m29.121s
sys 1m54.069s
time make -j48 -s -Otarget check-world PROVE_FLAGS='-j4'
real 1m1.577s
user 7m32.579s
sys 2m17.767s
meson:
time meson test
real 0m42.178s
user 7m8.533s
sys 2m17.711s
FWIW, I just rebased my older patch to cache and copy initdb during the
tests. The %user saved is impressive enough to pursue it again...
time make -j48 -s -Otarget check-world PROVE_FLAGS='-j4'
real 0m52.655s
user 2m19.504s
sys 1m26.264s
time meson test:
real 0m36.370s
user 2m14.748s
sys 1m36.741s
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 22:04 Peter Geoghegan <pg@bowt.ie>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 0 replies; 81+ messages in thread
From: Peter Geoghegan @ 2022-09-22 22:04 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Thu, Sep 22, 2022 at 2:50 PM Andres Freund <andres@anarazel.de> wrote:
> I'm likely the most biased person on this, but for me the reliable incremental
> builds and the readability of the test output are big enough wins that the
> answer is pretty clear... Doesn't hurt that running all tests is faster too.
It's nice that things are much more discoverable now. For example, if
you want to run some random test on its own then you just...do it in
the obvious, discoverable way. It took me about 2 minutes to figure
out how to do that, without reading any documentation.
OTOH doing the same thing with the old autoconf-based build system
requires the user to know the exact magical incantation for Postgres
tests. You just have to know to run the 2 or 3 tests that are
undocumented (or poorly documented) dependencies first. That seems
like an enormous usability improvement, especially for those of us
that haven't been working on Postgres for years.
> time to run all tests (cassert, -Og), in a fully built tree:
> time make -j48 -s -Otarget check-world PROVE_FLAGS='-j4'
> real 1m1.577s
> user 7m32.579s
> sys 2m17.767s
> time meson test
> real 0m42.178s
> user 7m8.533s
> sys 2m17.711s
Sold!
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-22 22:37 Nathan Bossart <nathandbossart@gmail.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Nathan Bossart @ 2022-09-22 22:37 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Thu, Sep 22, 2022 at 01:28:09PM -0700, Andres Freund wrote:
> On 2022-09-22 13:05:33 -0700, Nathan Bossart wrote:
>> * I'm using an Ubuntu-based distribution, and the version of meson that apt
>> installed was not new enough for Postgres. I ended up cloning meson [0]
>> and using the newest tag. This is no big deal.
>
> I assume this is 20.04 LTS? If so, we're missing it by one version of meson
> currently. There's unfortunately a few features that'd be a bit painful to not
> have.
Yes. I imagine I'll upgrade to 22.04 LTS soon, which appears to provide a
new enough version of meson.
>> * The installed binaries were unable to locate libraries like libpq. I
>> ended up setting the extra_lib_dirs option to the directory where these
>> libraries were installed to fix this. This one is probably worth
>> investigating further.
>
> I think that should be "fixed" in a later commit in the meson tree - any
> chance you could try that?
Yup, after cherry-picking 9bc60bc, this is fixed.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-24 17:52 Tom Lane <tgl@sss.pgh.pa.us>
parent: Nathan Bossart <nathandbossart@gmail.com>
0 siblings, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-09-24 17:52 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
... btw, shouldn't the CF entry [1] get closed now?
The cfbot's unhappy that the last patch no longer applies.
regards, tom lane
[1] https://commitfest.postgresql.org/39/3395/
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-24 18:09 Andres Freund <andres@anarazel.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-24 18:09 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-24 13:52:29 -0400, Tom Lane wrote:
> ... btw, shouldn't the CF entry [1] get closed now?
Unfortunately not - there's quite a few followup patches that haven't been
[fully] reviewed and thus not applied yet.
> The cfbot's unhappy that the last patch no longer applies.
Rebased patches attached.
Several patches here are quite trivial (e.g. 0003) or just part of the series
to increase cfbot/ci coverage (0002).
Greetings,
Andres Freund
Attachments:
[text/x-diff] v15-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch (5.5K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/2-v15-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch)
download | inline diff:
From 7cd0ecdc3085e8d5c02411194eebf24ed4fcd682 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 20:36:36 -0700
Subject: [PATCH v15 01/14] meson: ci: wip: move compilerwarnings task to meson
---
.cirrus.yml | 92 +++++++++++++-------------
src/tools/ci/linux-mingw-w64-64bit.txt | 13 ++++
2 files changed, 59 insertions(+), 46 deletions(-)
create mode 100644 src/tools/ci/linux-mingw-w64-64bit.txt
diff --git a/.cirrus.yml b/.cirrus.yml
index 0e3b2d42681..3b14563ae27 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -465,6 +465,10 @@ task:
ccache_cache:
folder: $CCACHE_DIR
+ ccache_stats_start_script:
+ ccache -s
+ ccache -z
+
setup_additional_packages_script: |
#apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y install ...
@@ -473,8 +477,6 @@ task:
# Test that code can be built with gcc/clang without warnings
###
- setup_script: echo "COPT=-Werror" > src/Makefile.custom
-
# Trace probes have a history of getting accidentally broken. Use the
# different compilers to build with different combinations of dtrace on/off
# and cassert on/off.
@@ -482,57 +484,58 @@ task:
# gcc, cassert off, dtrace on
always:
gcc_warning_script: |
- time ./configure \
- --cache gcc.cache \
- --enable-dtrace \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ mkdir build && cd build
+ CC="ccache gcc" CXX="ccache g++" \
+ meson setup \
+ -Dwerror=true \
+ -Dcassert=false \
+ -Ddtrace=enabled \
+ ${LINUX_MESON_FEATURES} \
+ ..
+ time ninja -j${BUILD_JOBS}
# gcc, cassert on, dtrace off
always:
gcc_a_warning_script: |
- time ./configure \
- --cache gcc.cache \
- --enable-cassert \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ cd build
+ meson configure \
+ -Dcassert=true \
+ -Ddtrace=disabled
+ time ninja -j${BUILD_JOBS}
# clang, cassert off, dtrace off
always:
clang_warning_script: |
- time ./configure \
- --cache clang.cache \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ rm -rf build
+ mkdir build && cd build
+ CC="ccache clang" CXX="ccache clang++" \
+ meson setup \
+ -Dwerror=true \
+ -Dcassert=false \
+ -Ddtrace=disabled \
+ ${LINUX_MESON_FEATURES} \
+ ..
+ time ninja -j${BUILD_JOBS}
# clang, cassert on, dtrace on
always:
clang_a_warning_script: |
- time ./configure \
- --cache clang.cache \
- --enable-cassert \
- --enable-dtrace \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ cd build
+ meson configure \
+ -Dcassert=true \
+ -Ddtrace=enabled
+ time ninja -j${BUILD_JOBS}
# cross-compile to windows
always:
mingw_cross_warning_script: |
- time ./configure \
- --host=x86_64-w64-mingw32 \
- --enable-cassert \
- CC="ccache x86_64-w64-mingw32-gcc" \
- CXX="ccache x86_64-w64-mingw32-g++"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ mkdir build-w64 && cd build-w64
+ meson setup \
+ --cross-file=../src/tools/ci/linux-mingw-w64-64bit.txt \
+ -Dwerror=true \
+ -Dcassert=true \
+ ..
+ time ninja -j${BUILD_JOBS}
###
# Verify docs can be built
@@ -540,13 +543,8 @@ task:
# XXX: Only do this if there have been changes in doc/ since last build
always:
docs_build_script: |
- time ./configure \
- --cache gcc.cache \
- CC="ccache gcc" \
- CXX="ccache g++" \
- CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} -C doc
+ cd build
+ time ninja docs
###
# Verify headerscheck / cpluspluscheck succeed
@@ -565,11 +563,13 @@ task:
${LINUX_CONFIGURE_FEATURES} \
--without-icu \
--quiet \
- CC="gcc" CXX"=g++" CLANG="clang"
- make -s -j${BUILD_JOBS} clean
+ CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
+ make -s -j${BUILD_JOBS} world-bin
time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
headers_cpluspluscheck_script: |
time make -s cpluspluscheck EXTRAFLAGS='-Wno-register -fmax-errors=10'
always:
+ ccache_stats_end_script:
+ ccache -s
upload_caches: ccache
diff --git a/src/tools/ci/linux-mingw-w64-64bit.txt b/src/tools/ci/linux-mingw-w64-64bit.txt
new file mode 100644
index 00000000000..9d43b6dcfbc
--- /dev/null
+++ b/src/tools/ci/linux-mingw-w64-64bit.txt
@@ -0,0 +1,13 @@
+[binaries]
+c = ['ccache', '/usr/bin/x86_64-w64-mingw32-gcc']
+cpp = ['ccache', '/usr/bin/x86_64-w64-mingw32-g++']
+ar = '/usr/bin/x86_64-w64-mingw32-ar'
+strip = '/usr/bin/x86_64-w64-mingw32-strip'
+pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
+windres = '/usr/bin/x86_64-w64-mingw32-windres'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch (14.5K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/3-v15-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch)
download | inline diff:
From eb6475e0284426f7c02b3380578ff5c64d8bdae2 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 22:08:00 -0700
Subject: [PATCH v15 02/14] meson: ci: dontmerge: Add additional CI coverage
This is part of the series to be able to test meson on more platforms than
normally part of CI.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Justin Pryzby <pryzby@telsasoft.com>
---
.cirrus.yml | 253 ++++++++++++++++--
src/tools/ci/docker/linux_centos7 | 57 ++++
src/tools/ci/docker/linux_centos8 | 54 ++++
src/tools/ci/docker/linux_fedora_rawhide | 49 ++++
src/tools/ci/docker/linux_opensuse_tumbleweed | 56 ++++
5 files changed, 453 insertions(+), 16 deletions(-)
create mode 100644 src/tools/ci/docker/linux_centos7
create mode 100644 src/tools/ci/docker/linux_centos8
create mode 100644 src/tools/ci/docker/linux_fedora_rawhide
create mode 100644 src/tools/ci/docker/linux_opensuse_tumbleweed
diff --git a/.cirrus.yml b/.cirrus.yml
index 3b14563ae27..965483550d1 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -126,6 +126,90 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ env:
+ CPUS: 2
+ BUILD_JOBS: 3
+ TEST_JOBS: 3
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+
+ # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+ # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+
+ matrix:
+ - name: NetBSD - 9 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+ env:
+ IMAGE_NAME: pg-ci-netbsd-9-postgres
+ PLATFORM: netbsd
+ INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include
+
+ - name: OpenBSD - 7 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+ env:
+ IMAGE_NAME: pg-ci-openbsd-7-postgres
+ PLATFORM: openbsd
+ INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
+ UUID: -Duuid=e2fs
+
+ compute_engine_instance:
+ image_project: $IMAGE_PROJECT
+ image: family/${IMAGE_NAME}
+ platform: ${PLATFORM}
+ cpu: $CPUS
+ memory: 4G
+ disk: 25
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ export
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on netBSD & openBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on netBSD
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl ${UUID} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ ${INCLUDE_DIRS} \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
@@ -152,6 +236,22 @@ LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
-Duuid=e2fs
+# configure preparation scripts, shared between tasks running the linux tests
+linux_preparation_scripts_template: &linux_preparation_scripts_template
+ sysinfo_script: |
+ id
+ uname -a
+ cat /proc/cmdline
+ ulimit -a -H && ulimit -a -S
+ export
+ create_user_script: |
+ useradd -m -U postgres
+ chown -R postgres:postgres .
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:postgres ${CCACHE_DIR}
+ su postgres -c "ulimit -l -H && ulimit -l -S"
+
+
task:
env:
CPUS: 4
@@ -181,19 +281,9 @@ task:
ccache_cache:
folder: ${CCACHE_DIR}
- sysinfo_script: |
- id
- uname -a
- cat /proc/cmdline
- ulimit -a -H && ulimit -a -S
- export
- create_user_script: |
- useradd -m postgres
- chown -R postgres:postgres .
- mkdir -p ${CCACHE_DIR}
- chown -R postgres:postgres ${CCACHE_DIR}
+ set_limits_script: |
echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
- su postgres -c "ulimit -l -H && ulimit -l -S"
+ <<: *linux_preparation_scripts_template
setup_core_files_script: |
mkdir -m 770 /tmp/cores
chown root:postgres /tmp/cores
@@ -227,7 +317,13 @@ task:
on_failure:
<<: *on_failure_ac
- - name: Linux - Debian Bullseye - Meson
+ - matrix:
+ - name: Linux - Debian Bullseye - Meson
+ - name: Linux - Debian Sid - Meson
+ trigger_type: manual
+
+ compute_engine_instance:
+ image: family/pg-ci-sid
configure_script: |
su postgres <<-EOF
@@ -255,6 +351,81 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
+task:
+ env:
+ CPUS: 4
+ BUILD_JOBS: 4
+ TEST_JOBS: 8 # experimentally derived to be a decent choice
+
+ CCACHE_DIR: /tmp/ccache_dir
+ DEBUGINFOD_URLS: ${DEBUGINFO}
+
+ TCL_DIR: /usr/lib64/
+ UUID: e2fs
+
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
+ LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
+
+ container:
+ dockerfile: ${DOCKERFILE_PATH}
+ cpu: $CPUS
+ memory: 4G
+
+ ccache_cache:
+ folder: ${CCACHE_DIR}
+
+ <<: *linux_preparation_scripts_template
+
+ matrix:
+ - name: Linux - OpenSuse Tumbleweed (LLVM) - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_opensuse_tumbleweed
+ DEBUGINFO: "https://debuginfod.opensuse.org/"
+ LLVM: -Dllvm=enabled
+
+ - trigger_type: manual
+ matrix:
+ - name: Linux - Fedora Rawhide - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_fedora_rawhide
+ DEBUGINFO: "https://debuginfod.fedoraproject.org/"
+
+ - name: Linux - Centos 8 - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ - name: Linux - Centos 7 - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl -Duuid=e2fs ${LLVM} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
task:
name: macOS - Monterey - Meson
@@ -355,9 +526,7 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
-task:
- name: Windows - Server 2019, VS 2019 - Meson & ninja
-
+windows_template: &windows_template
env:
# Half the allowed per-user CPU cores
CPUS: 4
@@ -373,6 +542,20 @@ task:
# Avoids port conflicts between concurrent tap test runs
PG_TEST_USE_UNIX_SOCKETS: 1
PG_REGRESS_SOCK_DIR: "c:/cirrus/"
+ # -m enables parallelism
+ # verbosity:minimal + Summary reduce verbosity, while keeping a summary of
+ # errors/warnings
+ # ForceNoAlign prevents msbuild from introducing line-breaks for long lines
+ # disable file tracker, we're never going to rebuild, and it slows down the
+ # build
+ MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo
+
+ # If tests hang forever, cirrus eventually times out. In that case log
+ # output etc is not uploaded, making the problem hard to debug. Of course
+ # tests internally should have shorter timeouts, but that's proven to not
+ # be sufficient. 15min currently is fast enough to finish individual test
+ # "suites".
+ T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m"
# startcreate_script starts a postgres instance that we don't want to get
# killed at the end of that script (it's stopped in stop_script). Can't
@@ -406,6 +589,16 @@ task:
setup_additional_packages_script: |
REM choco install -y --no-progress ...
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & ninja
+
+ meson_install_wraps_script: |
+ mkdir subprojects
+ meson wrap install lz4
+ meson wrap install zlib
+
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
@@ -426,6 +619,34 @@ task:
type: text/plain
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & msbuild
+
+ meson_install_wraps_script: |
+ mkdir subprojects
+ meson wrap install lz4
+ meson wrap install zlib
+
+ configure_script: |
+ vcvarsall x64
+ meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+
+ build_script: |
+ vcvarsall x64
+ msbuild %MSBFLAGS% build\postgresql.sln
+
+ check_world_script: |
+ vcvarsall x64
+ meson test %MTEST_ARGS% --num-processes %TEST_JOBS%
+
+ on_failure:
+ <<: *on_failure_meson
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+ type: text/plain
+
+
task:
name: CompilerWarnings
diff --git a/src/tools/ci/docker/linux_centos7 b/src/tools/ci/docker/linux_centos7
new file mode 100644
index 00000000000..3742890d961
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos7
@@ -0,0 +1,57 @@
+FROM centos:centos7
+# Enable powertools, EPEL and devtoolset repository
+RUN \
+ yum -y install dnf-plugins-core \
+ epel-release \
+ centos-release-scl-rh && \
+ \
+ yum -y update && \
+ yum -y install \
+ \
+ git \
+ perl \
+ perl-ExtUtils-Embed \
+ perl-IPC-Run \
+ perl-Test-Harness \
+ perl-Test-Simple \
+ \
+ bison \
+ ccache \
+ clang \
+ devtoolset-7-make \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ && \
+ pip3 install meson && \
+ pip3 install ninja && \
+ yum clean all
+
+# Make version is 3.82 but required is > 4, adding devtoolset-7-make to the PATH
+ENV PATH="/opt/rh/devtoolset-7/root/usr/bin/:${PATH}"
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_centos8 b/src/tools/ci/docker/linux_centos8
new file mode 100644
index 00000000000..58f95847ef1
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos8
@@ -0,0 +1,54 @@
+FROM quay.io/centos/centos:stream8
+# Enable powertools and EPEL repository
+RUN \
+ dnf -y install dnf-plugins-core && \
+ dnf config-manager --set-enabled powertools && \
+ dnf -y install epel-release && \
+ dnf -y update && \
+ dnf -y install \
+ \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ diffutils \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ glibc-langpack-en \
+ \
+ && \
+ pip3 install ninja && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_fedora_rawhide b/src/tools/ci/docker/linux_fedora_rawhide
new file mode 100644
index 00000000000..c95027cd6a7
--- /dev/null
+++ b/src/tools/ci/docker/linux_fedora_rawhide
@@ -0,0 +1,49 @@
+FROM fedora:rawhide
+RUN \
+ dnf -y update && \
+ dnf -y install \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gettext \
+ ninja-build \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ langpacks-en \
+ glibc-langpack-en \
+ \
+ && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_opensuse_tumbleweed b/src/tools/ci/docker/linux_opensuse_tumbleweed
new file mode 100644
index 00000000000..07364ee85ff
--- /dev/null
+++ b/src/tools/ci/docker/linux_opensuse_tumbleweed
@@ -0,0 +1,56 @@
+FROM opensuse/tumbleweed
+RUN \
+ zypper -n clean -a && \
+ zypper -n ref && \
+ zypper -n dup && \
+ zypper -n update && \
+ zypper -n install \
+ diffutils \
+ git \
+ icu \
+ make \
+ meson \
+ perl-IPC-Run \
+ shadow \
+ systemd-devel \
+ util-linux \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gcc-c++ \
+ gettext-runtime \
+ ninja \
+ \
+ krb5-devel \
+ libicu-devel \
+ libldapcpp-devel \
+ liblz4-devel \
+ libopenssl-devel \
+ libselinux-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ pam-devel \
+ python38-devel \
+ readline-devel \
+ tcl-devel \
+ \
+ openldap2 \
+ openldap2-client \
+ \
+ krb5-client \
+ krb5-plugin-kdb-ldap \
+ krb5-server \
+ lz4 \
+ zstd \
+ \
+ && \
+ zypper -n clean -a
+
+# Fixing ICU errors caused by locale being set to 'POSIX'
+ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0003-meson-prereq-De-special-case-pgevent-s-rc-file-h.patch (1.9K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/4-v15-0003-meson-prereq-De-special-case-pgevent-s-rc-file-h.patch)
download | inline diff:
From 06a8962dc47979071641028b3bda5ae21bab09c9 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 13 Sep 2022 10:07:18 -0700
Subject: [PATCH v15 03/14] meson: prereq: De-special-case pgevent's rc file
handling
There's really no need to build win32ver.rc as part of building pgmsgevent.rc.
---
src/bin/pgevent/Makefile | 5 +++--
src/bin/pgevent/pgmsgevent.rc | 2 --
src/tools/msvc/Mkvcbuild.pm | 1 -
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/bin/pgevent/Makefile b/src/bin/pgevent/Makefile
index dea79d3f137..04d49711d8d 100644
--- a/src/bin/pgevent/Makefile
+++ b/src/bin/pgevent/Makefile
@@ -17,7 +17,8 @@ ifeq ($(PORTNAME), win32)
OBJS = \
pgevent.o \
- pgmsgevent.o
+ pgmsgevent.o \
+ $(WIN32RES)
NAME=pgevent
SHLIB_LINK =
@@ -29,7 +30,7 @@ install: all install-lib
include $(top_srcdir)/src/Makefile.shlib
-pgmsgevent.o: pgmsgevent.rc win32ver.rc
+pgmsgevent.o: pgmsgevent.rc
$(WINDRES) $< -o $@ --include-dir=$(top_builddir)/src/include --include-dir=$(top_srcdir)/src/include --include-dir=$(srcdir) --include-dir=.
clean distclean: clean-lib
diff --git a/src/bin/pgevent/pgmsgevent.rc b/src/bin/pgevent/pgmsgevent.rc
index e69862e882c..0885a897e6f 100644
--- a/src/bin/pgevent/pgmsgevent.rc
+++ b/src/bin/pgevent/pgmsgevent.rc
@@ -1,4 +1,2 @@
LANGUAGE 0x9,0x1
1 11 MSG00001.bin
-
-#include "win32ver.rc"
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 098bc3f1b09..ddb4f25eb12 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -425,7 +425,6 @@ sub mkvcbuild
$pgevent->AddFiles('src/bin/pgevent', 'pgevent.c', 'pgmsgevent.rc');
$pgevent->AddResourceFile('src/bin/pgevent', 'Eventlog message formatter',
'win32');
- $pgevent->RemoveFile('src/bin/pgevent/win32ver.rc');
$pgevent->UseDef('src/bin/pgevent/pgevent.def');
$pgevent->DisableLinkerWarnings('4104');
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0004-meson-prereq-win-remove-date-from-version-number.patch (1.1K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/5-v15-0004-meson-prereq-win-remove-date-from-version-number.patch)
download | inline diff:
From 7593fd13d95b4f7aafa84ae31ee86cbe182a637e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 14 Sep 2022 16:43:47 -0700
Subject: [PATCH v15 04/14] meson: prereq: win: remove date from version number
in win32ver.rc
This may have served a purpose at some point, but these days it just
contributes to a non-reproducible build.
Discussion: https://postgr.es/m/1cef5b48-32bd-5cbf-fb62-fb648860f5ef@enterprisedb.com
---
src/makefiles/Makefile.win32 | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
index 17d68196442..d268b3ebafd 100644
--- a/src/makefiles/Makefile.win32
+++ b/src/makefiles/Makefile.win32
@@ -69,7 +69,6 @@ win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
sed -e 's;FILEDESC;$(PGFILEDESC);' \
-e 's;VFT_APP;$(PGFTYPE);' \
-e 's;_ICO_;$(PGICOSTR);' \
- -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \
-e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
-e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
$< >$@
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0005-meson-Add-windows-resource-files.patch (93.9K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/6-v15-0005-meson-Add-windows-resource-files.patch)
download | inline diff:
From 523551f8117d2db1a607e29d94704a52cd5679aa Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 11:03:07 -0700
Subject: [PATCH v15 05/14] meson: Add windows resource files
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
---
src/backend/jit/llvm/meson.build | 6 +
.../replication/libpqwalreceiver/meson.build | 6 +
src/backend/replication/pgoutput/meson.build | 6 +
src/backend/snowball/meson.build | 6 +
.../utils/mb/conversion_procs/meson.build | 144 ++++++++++++++----
src/bin/initdb/meson.build | 6 +
src/bin/pg_amcheck/meson.build | 8 +-
src/bin/pg_archivecleanup/meson.build | 12 +-
src/bin/pg_basebackup/meson.build | 38 ++++-
src/bin/pg_checksums/meson.build | 12 +-
src/bin/pg_config/meson.build | 12 +-
src/bin/pg_controldata/meson.build | 12 +-
src/bin/pg_ctl/meson.build | 12 +-
src/bin/pg_dump/meson.build | 18 +++
src/bin/pg_resetwal/meson.build | 12 +-
src/bin/pg_rewind/meson.build | 6 +
src/bin/pg_test_fsync/meson.build | 10 +-
src/bin/pg_test_timing/meson.build | 12 +-
src/bin/pg_upgrade/meson.build | 6 +
src/bin/pg_verifybackup/meson.build | 6 +
src/bin/pg_waldump/meson.build | 6 +
src/bin/pgbench/meson.build | 6 +
src/bin/pgevent/meson.build | 6 +
src/bin/psql/meson.build | 6 +
src/bin/scripts/meson.build | 10 +-
src/interfaces/libpq/meson.build | 5 +
src/interfaces/libpq/test/meson.build | 25 ++-
src/pl/plperl/meson.build | 7 +
src/pl/plpgsql/src/meson.build | 6 +
src/pl/plpython/meson.build | 6 +
src/pl/tcl/meson.build | 6 +
contrib/adminpack/meson.build | 12 +-
contrib/amcheck/meson.build | 17 ++-
contrib/auth_delay/meson.build | 12 +-
contrib/auto_explain/meson.build | 12 +-
contrib/basebackup_to_shell/meson.build | 6 +
contrib/basic_archive/meson.build | 6 +
contrib/bloom/meson.build | 6 +
contrib/bool_plperl/meson.build | 6 +
contrib/btree_gin/meson.build | 12 +-
contrib/btree_gist/meson.build | 6 +
contrib/citext/meson.build | 6 +
contrib/cube/meson.build | 6 +
contrib/dblink/meson.build | 6 +
contrib/dict_int/meson.build | 12 +-
contrib/dict_xsyn/meson.build | 12 +-
contrib/earthdistance/meson.build | 12 +-
contrib/file_fdw/meson.build | 12 +-
contrib/fuzzystrmatch/meson.build | 16 +-
contrib/hstore/meson.build | 24 ++-
contrib/hstore_plperl/meson.build | 6 +
contrib/hstore_plpython/meson.build | 6 +
contrib/intarray/meson.build | 6 +
contrib/isn/meson.build | 6 +
contrib/jsonb_plperl/meson.build | 6 +
contrib/jsonb_plpython/meson.build | 6 +
contrib/lo/meson.build | 6 +
contrib/ltree/meson.build | 6 +
contrib/ltree_plpython/meson.build | 6 +
contrib/oid2name/meson.build | 12 +-
contrib/old_snapshot/meson.build | 6 +
contrib/pageinspect/meson.build | 6 +
contrib/passwordcheck/meson.build | 6 +
contrib/pg_buffercache/meson.build | 14 +-
contrib/pg_freespacemap/meson.build | 14 +-
contrib/pg_prewarm/meson.build | 16 +-
contrib/pg_stat_statements/meson.build | 12 +-
contrib/pg_surgery/meson.build | 14 +-
contrib/pg_trgm/meson.build | 20 ++-
contrib/pg_visibility/meson.build | 14 +-
contrib/pg_walinspect/meson.build | 6 +
contrib/pgcrypto/meson.build | 6 +
contrib/pgrowlocks/meson.build | 14 +-
contrib/pgstattuple/meson.build | 18 ++-
contrib/postgres_fdw/meson.build | 6 +
contrib/seg/meson.build | 6 +
contrib/sepgsql/meson.build | 6 +
contrib/spi/meson.build | 48 +++++-
contrib/sslinfo/meson.build | 14 +-
contrib/tablefunc/meson.build | 14 +-
contrib/tcn/meson.build | 14 +-
contrib/test_decoding/meson.build | 6 +
contrib/tsm_system_rows/meson.build | 14 +-
contrib/tsm_system_time/meson.build | 14 +-
contrib/unaccent/meson.build | 14 +-
contrib/uuid-ossp/meson.build | 14 +-
contrib/vacuumlo/meson.build | 12 +-
contrib/xml2/meson.build | 16 +-
src/interfaces/ecpg/compatlib/meson.build | 6 +-
src/interfaces/ecpg/preproc/meson.build | 6 +
src/interfaces/ecpg/test/meson.build | 6 +
src/test/isolation/meson.build | 13 ++
src/test/modules/delay_execution/meson.build | 13 +-
src/test/modules/dummy_index_am/meson.build | 13 +-
src/test/modules/dummy_seclabel/meson.build | 13 +-
src/test/modules/libpq_pipeline/meson.build | 14 +-
src/test/modules/plsample/meson.build | 13 +-
src/test/modules/spgist_name_ops/meson.build | 13 +-
.../ssl_passphrase_callback/meson.build | 13 +-
src/test/modules/test_bloomfilter/meson.build | 13 +-
src/test/modules/test_ddl_deparse/meson.build | 13 +-
.../modules/test_ginpostinglist/meson.build | 13 +-
src/test/modules/test_integerset/meson.build | 13 +-
src/test/modules/test_lfind/meson.build | 13 +-
src/test/modules/test_oat_hooks/meson.build | 13 +-
src/test/modules/test_parser/meson.build | 13 +-
src/test/modules/test_predtest/meson.build | 13 +-
src/test/modules/test_rbtree/meson.build | 13 +-
src/test/modules/test_regex/meson.build | 13 +-
src/test/modules/test_rls_hooks/meson.build | 13 +-
src/test/modules/test_shm_mq/meson.build | 19 ++-
src/test/modules/worker_spi/meson.build | 15 +-
src/test/regress/meson.build | 6 +
meson.build | 61 ++++++++
src/timezone/meson.build | 6 +
src/tools/rcgen | 99 ++++++++++++
116 files changed, 1383 insertions(+), 159 deletions(-)
create mode 100755 src/tools/rcgen
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index de2e624ab58..5fb63768358 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -20,6 +20,12 @@ llvmjit_sources += files(
'llvmjit_expr.c',
)
+if host_system == 'windows'
+ llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'llvmjit',
+ '--FILEDESC', 'llvmjit - JIT using LLVM',])
+endif
+
llvmjit = shared_module('llvmjit',
llvmjit_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
index 3fc786c80a0..4c653a05d36 100644
--- a/src/backend/replication/libpqwalreceiver/meson.build
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -2,6 +2,12 @@ libpqwalreceiver_sources = files(
'libpqwalreceiver.c',
)
+if host_system == 'windows'
+ libpqwalreceiver_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pqwalreceiver',
+ '--FILEDESC', 'libpqwalreceiver - receive WAL during streaming replication',])
+endif
+
libpqwalreceiver = shared_module('pqwalreceiver',
libpqwalreceiver_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
index ab956361a62..5df27d7b764 100644
--- a/src/backend/replication/pgoutput/meson.build
+++ b/src/backend/replication/pgoutput/meson.build
@@ -2,6 +2,12 @@ pgoutput_sources = files(
'pgoutput.c',
)
+if host_system == 'windows'
+ pgoutput_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgoutput',
+ '--FILEDESC', 'pgoutput - standard logical replication output plugin',])
+endif
+
pgoutput = shared_module('pgoutput',
pgoutput_sources,
kwargs: pg_mod_args,
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 8c6f685cb32..974401d187e 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -58,6 +58,12 @@ dict_snowball_sources += files(
# see comment in src/include/snowball/header.h
stemmer_inc = include_directories('../../include/snowball')
+if host_system == 'windows'
+ dict_snowball_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_snowball',
+ '--FILEDESC', 'snowball - natural language stemmers',])
+endif
+
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
index 1bc971d1945..00e721a2453 100644
--- a/src/backend/utils/mb/conversion_procs/meson.build
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -1,36 +1,122 @@
encodings = {
- 'cyrillic_and_mic': ['cyrillic_and_mic/cyrillic_and_mic.c'],
- 'euc2004_sjis2004': ['euc2004_sjis2004/euc2004_sjis2004.c'],
- 'euc_cn_and_mic': ['euc_cn_and_mic/euc_cn_and_mic.c'],
- 'euc_jp_and_sjis': ['euc_jp_and_sjis/euc_jp_and_sjis.c'],
- 'euc_kr_and_mic': ['euc_kr_and_mic/euc_kr_and_mic.c'],
- 'euc_tw_and_big5': [
- 'euc_tw_and_big5/euc_tw_and_big5.c',
- 'euc_tw_and_big5/big5.c',
- ],
- 'latin2_and_win1250': ['latin2_and_win1250/latin2_and_win1250.c'],
- 'latin_and_mic': ['latin_and_mic/latin_and_mic.c'],
- 'utf8_and_big5': ['utf8_and_big5/utf8_and_big5.c'],
- 'utf8_and_cyrillic': ['utf8_and_cyrillic/utf8_and_cyrillic.c'],
- 'utf8_and_euc2004': ['utf8_and_euc2004/utf8_and_euc2004.c'],
- 'utf8_and_euc_cn': ['utf8_and_euc_cn/utf8_and_euc_cn.c'],
- 'utf8_and_euc_jp': ['utf8_and_euc_jp/utf8_and_euc_jp.c'],
- 'utf8_and_euc_kr': ['utf8_and_euc_kr/utf8_and_euc_kr.c'],
- 'utf8_and_euc_tw': ['utf8_and_euc_tw/utf8_and_euc_tw.c'],
- 'utf8_and_gb18030': ['utf8_and_gb18030/utf8_and_gb18030.c'],
- 'utf8_and_gbk': ['utf8_and_gbk/utf8_and_gbk.c'],
- 'utf8_and_iso8859': ['utf8_and_iso8859/utf8_and_iso8859.c'],
- 'utf8_and_iso8859_1': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'],
- 'utf8_and_johab': ['utf8_and_johab/utf8_and_johab.c'],
- 'utf8_and_sjis': ['utf8_and_sjis/utf8_and_sjis.c'],
- 'utf8_and_sjis2004': ['utf8_and_sjis2004/utf8_and_sjis2004.c'],
- 'utf8_and_uhc': ['utf8_and_uhc/utf8_and_uhc.c'],
- 'utf8_and_win': ['utf8_and_win/utf8_and_win.c'],
+ 'cyrillic_and_mic': {
+ 'sources': ['cyrillic_and_mic/cyrillic_and_mic.c'],
+ 'description': 'cyrillic <-> mic text conversions',
+ },
+ 'euc2004_sjis2004': {
+ 'sources': ['euc2004_sjis2004/euc2004_sjis2004.c'],
+ 'description': 'euc2004 <-> sjis2004 text conversions',
+ },
+ 'euc_cn_and_mic': {
+ 'sources': ['euc_cn_and_mic/euc_cn_and_mic.c'],
+ 'description': 'euc_cn <-> mic text conversions',
+ },
+ 'euc_jp_and_sjis': {
+ 'sources': ['euc_jp_and_sjis/euc_jp_and_sjis.c'],
+ 'description': 'euc_jp <-> sjis text conversions',
+ },
+ 'euc_kr_and_mic': {
+ 'sources': ['euc_kr_and_mic/euc_kr_and_mic.c'],
+ 'description': 'euc_kr <-> mic text conversions',
+ },
+ 'euc_tw_and_big5': {
+ 'sources': [
+ 'euc_tw_and_big5/euc_tw_and_big5.c',
+ 'euc_tw_and_big5/big5.c',
+ ],
+ 'description': 'euc_tw <-> big5 text conversions',
+ },
+ 'latin2_and_win1250': {
+ 'sources': ['latin2_and_win1250/latin2_and_win1250.c'],
+ 'description': 'latin2 <-> win1250 text conversions',
+ },
+ 'latin_and_mic': {
+ 'sources': ['latin_and_mic/latin_and_mic.c'],
+ 'description': 'latin <-> mic text conversions',
+ },
+ 'utf8_and_big5': {
+ 'sources': ['utf8_and_big5/utf8_and_big5.c'],
+ 'description': 'utf8 <-> big5 text conversions',
+ },
+ 'utf8_and_cyrillic': {
+ 'sources': ['utf8_and_cyrillic/utf8_and_cyrillic.c'],
+ 'description': 'utf8 <-> cyrillic text conversions',
+ },
+ 'utf8_and_euc2004': {
+ 'sources': ['utf8_and_euc2004/utf8_and_euc2004.c'],
+ 'description': 'utf8 <-> euc2004 text conversions',
+ },
+ 'utf8_and_euc_cn': {
+ 'sources': ['utf8_and_euc_cn/utf8_and_euc_cn.c'],
+ 'description': 'utf8 <-> euc_cn text conversions',
+ },
+ 'utf8_and_euc_jp': {
+ 'sources': ['utf8_and_euc_jp/utf8_and_euc_jp.c'],
+ 'description': 'utf8 <-> euc_jp text conversions',
+ },
+ 'utf8_and_euc_kr': {
+ 'sources': ['utf8_and_euc_kr/utf8_and_euc_kr.c'],
+ 'description': 'utf8 <-> euc_kr text conversions',
+ },
+ 'utf8_and_euc_tw': {
+ 'sources': ['utf8_and_euc_tw/utf8_and_euc_tw.c'],
+ 'description': 'utf8 <-> euc_tw text conversions',
+ },
+ 'utf8_and_gb18030': {
+ 'sources': ['utf8_and_gb18030/utf8_and_gb18030.c'],
+ 'description': 'utf8 <-> gb18030 text conversions',
+ },
+ 'utf8_and_gbk': {
+ 'sources': ['utf8_and_gbk/utf8_and_gbk.c'],
+ 'description': 'utf8 <-> gbk text conversions',
+ },
+ 'utf8_and_iso8859': {
+ 'sources': ['utf8_and_iso8859/utf8_and_iso8859.c'],
+ 'description': 'utf8 <-> iso8859 text conversions',
+ },
+ 'utf8_and_iso8859_1': {
+ 'sources': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'],
+ 'description': 'utf8 <-> iso8859_1 text conversions',
+ },
+ 'utf8_and_johab': {
+ 'sources': ['utf8_and_johab/utf8_and_johab.c'],
+ 'description': 'utf8 <-> johab text conversions',
+ },
+ 'utf8_and_sjis': {
+ 'sources': ['utf8_and_sjis/utf8_and_sjis.c'],
+ 'description': 'utf8 <-> sjis text conversions',
+ },
+ 'utf8_and_sjis2004': {
+ 'sources': ['utf8_and_sjis2004/utf8_and_sjis2004.c'],
+ 'description': 'utf8 <-> sjis2004 text conversions',
+ },
+ 'utf8_and_uhc': {
+ 'sources': ['utf8_and_uhc/utf8_and_uhc.c'],
+ 'description': 'utf8 <-> uhc text conversions',
+ },
+ 'utf8_and_win': {
+ 'sources': ['utf8_and_win/utf8_and_win.c'],
+ 'description': 'utf8 <-> win text conversions',
+ },
}
-foreach encoding, sources : encodings
+foreach encoding, values: encodings
+ sources = values['sources']
+ description = values['description']
+
+ source_files = files()
+ foreach source: sources
+ source_files += files(source)
+ endforeach
+
+ if host_system == 'windows'
+ source_files += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', encoding,
+ '--FILEDESC', description,])
+ endif
+
backend_targets += shared_module(encoding,
- sources,
+ source_files,
kwargs: pg_mod_args,
)
endforeach
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
index 9f213274d2f..6ced9a31b80 100644
--- a/src/bin/initdb/meson.build
+++ b/src/bin/initdb/meson.build
@@ -7,6 +7,12 @@ initdb_sources += timezone_localtime_source
#fixme: reimplement libpq_pgport logic
+if host_system == 'windows'
+ initdb_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'initdb',
+ '--FILEDESC', 'initdb - initialize a new database cluster',])
+endif
+
initdb = executable('initdb',
initdb_sources,
include_directories: [timezone_inc],
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
index 8e197eba5f3..25f5e7a0948 100644
--- a/src/bin/pg_amcheck/meson.build
+++ b/src/bin/pg_amcheck/meson.build
@@ -1,7 +1,13 @@
pg_amcheck_sources = files(
- 'pg_amcheck.c'
+ 'pg_amcheck.c',
)
+if host_system == 'windows'
+ pg_amcheck_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_amcheck',
+ '--FILEDESC', 'pg_amcheck - detect corruption within database relations',])
+endif
+
pg_amcheck = executable('pg_amcheck',
pg_amcheck_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
index 87a0d980c4f..aaa2e76977f 100644
--- a/src/bin/pg_archivecleanup/meson.build
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -1,5 +1,15 @@
+pg_archivecleanup_sources = files(
+ 'pg_archivecleanup.c',
+)
+
+if host_system == 'windows'
+ pg_archivecleanup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_archivecleanup',
+ '--FILEDESC', 'pg_archivecleanup - cleans archive when used with streaming replication',])
+endif
+
pg_archivecleanup = executable('pg_archivecleanup',
- ['pg_archivecleanup.c'],
+ pg_archivecleanup_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
index d26fed9cd8a..2c934e0c26e 100644
--- a/src/bin/pg_basebackup/meson.build
+++ b/src/bin/pg_basebackup/meson.build
@@ -17,24 +17,56 @@ pg_basebackup_common = static_library('libpg_basebackup_common',
kwargs: internal_lib_args,
)
-pg_basebackup = executable('pg_basebackup',
+pg_basebackup_sources = files(
'pg_basebackup.c',
+)
+
+if host_system == 'windows'
+ pg_basebackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_basebackup',
+ '--FILEDESC', 'pg_basebackup - streaming WAL and backup receivers',])
+endif
+
+pg_basebackup = executable('pg_basebackup',
+ pg_basebackup_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_basebackup
-pg_receivewal = executable('pg_receivewal',
+
+pg_receivewal_sources = files(
'pg_receivewal.c',
+)
+
+if host_system == 'windows'
+ pg_receivewal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_receivewal',
+ '--FILEDESC', 'pg_receivewal - streaming WAL and backup receivers',])
+endif
+
+pg_receivewal = executable('pg_receivewal',
+ pg_receivewal_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_receivewal
-pg_recvlogical = executable('pg_recvlogical',
+
+pg_recvlogical_sources = files(
'pg_recvlogical.c',
+)
+
+if host_system == 'windows'
+ pg_recvlogical_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_recvlogical',
+ '--FILEDESC', 'pg_recvlogical - streaming WAL and backup receivers',])
+endif
+
+pg_recvlogical = executable('pg_recvlogical',
+ pg_recvlogical_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
index ee1f367bac3..d07ebc999b3 100644
--- a/src/bin/pg_checksums/meson.build
+++ b/src/bin/pg_checksums/meson.build
@@ -1,5 +1,15 @@
+pg_checksums_sources = files(
+ 'pg_checksums.c',
+)
+
+if host_system == 'windows'
+ pg_checksums_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_checksums',
+ '--FILEDESC', 'pg_checksums - verify data checksums in an offline cluster',])
+endif
+
pg_checksums = executable('pg_checksums',
- ['pg_checksums.c'],
+ pg_checksums_sources,
include_directories: [timezone_inc],
dependencies: [frontend_code],
kwargs: default_bin_args,
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
index 0ecbf2f9d28..4be2fdc84ae 100644
--- a/src/bin/pg_config/meson.build
+++ b/src/bin/pg_config/meson.build
@@ -1,5 +1,15 @@
+pg_config_sources = files(
+ 'pg_config.c',
+)
+
+if host_system == 'windows'
+ pg_config_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_config',
+ '--FILEDESC', 'pg_config - report configuration information',])
+endif
+
pg_config = executable('pg_config',
- ['pg_config.c'],
+ pg_config_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
index 557e672beb7..7fc239dbe65 100644
--- a/src/bin/pg_controldata/meson.build
+++ b/src/bin/pg_controldata/meson.build
@@ -1,5 +1,15 @@
+pg_controldata_sources = files(
+ 'pg_controldata.c',
+)
+
+if host_system == 'windows'
+ pg_controldata_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_controldata',
+ '--FILEDESC', 'pg_controldata - reads the data from pg_control',])
+endif
+
pg_controldata = executable('pg_controldata',
- ['pg_controldata.c'],
+ pg_controldata_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
index 6812e73e329..96f962fa762 100644
--- a/src/bin/pg_ctl/meson.build
+++ b/src/bin/pg_ctl/meson.build
@@ -1,5 +1,15 @@
+pg_ctl_sources = files(
+ 'pg_ctl.c',
+)
+
+if host_system == 'windows'
+ pg_ctl_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_ctl',
+ '--FILEDESC', 'pg_ctl - starts/stops/restarts the PostgreSQL server',])
+endif
+
pg_ctl = executable('pg_ctl',
- ['pg_ctl.c'],
+ pg_ctl_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 785ec094dbd..3527a25c288 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -24,6 +24,12 @@ pg_dump_sources = files(
'pg_dump_sort.c',
)
+if host_system == 'windows'
+ pg_dump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dump',
+ '--FILEDESC', 'pg_dump - backup one PostgreSQL database',])
+endif
+
pg_dump = executable('pg_dump',
pg_dump_sources,
link_with: [pg_dump_common],
@@ -37,6 +43,12 @@ pg_dumpall_sources = files(
'pg_dumpall.c',
)
+if host_system == 'windows'
+ pg_dumpall_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dumpall',
+ '--FILEDESC', 'pg_dumpall - backup PostgreSQL databases'])
+endif
+
pg_dumpall = executable('pg_dumpall',
pg_dumpall_sources,
link_with: [pg_dump_common],
@@ -50,6 +62,12 @@ pg_restore_sources = files(
'pg_restore.c',
)
+if host_system == 'windows'
+ pg_restore_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_restore',
+ '--FILEDESC', 'pg_restore - restore PostgreSQL databases'])
+endif
+
pg_restore = executable('pg_restore',
pg_restore_sources,
link_with: [pg_dump_common],
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
index 7c5de134ac0..d503db97b71 100644
--- a/src/bin/pg_resetwal/meson.build
+++ b/src/bin/pg_resetwal/meson.build
@@ -1,5 +1,15 @@
+pg_resetwal_sources = files(
+ 'pg_resetwal.c',
+)
+
+if host_system == 'windows'
+ pg_resetwal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_resetwal',
+ '--FILEDESC', 'pg_resetwal - reset PostgreSQL WAL log'])
+endif
+
pg_resetwal = executable('pg_resetwal',
- files('pg_resetwal.c'),
+ pg_resetwal_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
index d8ec9e482d5..6cd970909a2 100644
--- a/src/bin/pg_rewind/meson.build
+++ b/src/bin/pg_rewind/meson.build
@@ -11,6 +11,12 @@ pg_rewind_sources = files(
pg_rewind_sources += xlogreader_sources
+if host_system == 'windows'
+ pg_rewind_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_rewind',
+ '--FILEDESC', 'pg_rewind - synchronize a data directory with another one forked from'])
+endif
+
pg_rewind = executable('pg_rewind',
pg_rewind_sources,
dependencies: [frontend_code, libpq, lz4, zstd],
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
index 2c01831e11f..31d288ba6da 100644
--- a/src/bin/pg_test_fsync/meson.build
+++ b/src/bin/pg_test_fsync/meson.build
@@ -1,4 +1,12 @@
-test_fsync_sources = files('pg_test_fsync.c')
+test_fsync_sources = files(
+ 'pg_test_fsync.c',
+)
+
+if host_system == 'windows'
+ test_fsync_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_fsync',
+ '--FILEDESC', 'pg_test_fsync - test various disk sync methods'])
+endif
pg_test_fsync = executable('pg_test_fsync',
test_fsync_sources,
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
index 0a3068f1657..0aed03ea32f 100644
--- a/src/bin/pg_test_timing/meson.build
+++ b/src/bin/pg_test_timing/meson.build
@@ -1,5 +1,15 @@
+pg_test_timing_sources = files(
+ 'pg_test_timing.c'
+)
+
+if host_system == 'windows'
+ pg_test_timing_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_timing',
+ '--FILEDESC', 'pg_test_timing - test timing overhead'])
+endif
+
pg_test_timing = executable('pg_test_timing',
- ['pg_test_timing.c'],
+ pg_test_timing_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index 02f030e0ccf..a7b927a45c7 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -16,6 +16,12 @@ pg_upgrade_sources = files(
'version.c',
)
+if host_system == 'windows'
+ pg_upgrade_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_upgrade',
+ '--FILEDESC', 'pg_upgrade - an in-place binary upgrade utility'])
+endif
+
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
index 4c3b2bb5f97..b934a408443 100644
--- a/src/bin/pg_verifybackup/meson.build
+++ b/src/bin/pg_verifybackup/meson.build
@@ -3,6 +3,12 @@ pg_verifybackup_sources = files(
'pg_verifybackup.c'
)
+if host_system == 'windows'
+ pg_verifybackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_verifybackup',
+ '--FILEDESC', 'pg_verifybackup - verify a backup against using a backup manifest'])
+endif
+
pg_verifybackup = executable('pg_verifybackup',
pg_verifybackup_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index 95872652ffd..9605976870d 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -8,6 +8,12 @@ pg_waldump_sources += rmgr_desc_sources
pg_waldump_sources += xlogreader_sources
pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+if host_system == 'windows'
+ pg_waldump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_waldump',
+ '--FILEDESC', 'pg_waldump - decode and display WA'])
+endif
+
pg_waldump = executable('pg_waldump',
pg_waldump_sources,
dependencies: [frontend_code, lz4, zstd],
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index 6564e54029c..a32eb51fe07 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -17,6 +17,12 @@ exprparse = custom_target('exprparse',
generated_sources += exprparse.to_list()
pgbench_sources += exprparse
+if host_system == 'windows'
+ pgbench_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgbench',
+ '--FILEDESC', 'pgbench - a simple program for running benchmark tests'])
+endif
+
pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
index 7a468879fd2..2e9aea4b0e1 100644
--- a/src/bin/pgevent/meson.build
+++ b/src/bin/pgevent/meson.build
@@ -6,6 +6,12 @@ pgevent_sources = files(
'pgevent.c',
)
+pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgevent',
+ '--FILEDESC', 'Eventlog message formatter',])
+
+pgevent_sources += windows.compile_resources('pgmsgevent.rc')
+
# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
pgevent_link_args = []
if cc.get_id() == 'msvc'
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index ea850c8fdf5..3474389d3b6 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -38,6 +38,12 @@ generated_sources += sql_help.to_list()
psql_sources += sql_help
bin_targets += sql_help
+if host_system == 'windows'
+ psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'psql',
+ '--FILEDESC', 'psql - the PostgreSQL interactive terminal',])
+endif
+
psql = executable('psql',
psql_sources,
include_directories: include_directories('.'),
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
index eaf250c7f73..837562c24e5 100644
--- a/src/bin/scripts/meson.build
+++ b/src/bin/scripts/meson.build
@@ -16,8 +16,16 @@ binaries = [
]
foreach binary : binaries
+ binary_sources = files('@0@.c'.format(binary))
+
+ if host_system == 'windows'
+ binary_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', binary,
+ '--FILEDESC', '@0@ - PostgreSQL utility'.format(binary),])
+ endif
+
binary = executable(binary,
- files(binary + '.c'),
+ binary_sources,
link_with: [scripts_common],
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index bc047e00d62..2c9edeaa088 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -16,9 +16,13 @@ libpq_sources = files(
'libpq-events.c',
'pqexpbuffer.c',
)
+libpq_so_sources = [] # only for shared lib, in addition to above
if host_system == 'windows'
libpq_sources += files('pthread-win32.c', 'win32.c')
+ libpq_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq',
+ '--FILEDESC', 'PostgreSQL Access Library',])
endif
if ssl.found()
@@ -52,6 +56,7 @@ libpq_st = static_library('libpq',
# not using both_libraries here, causes problems with precompiled headers and
# resource files with msbuild
libpq_so = shared_library('libpq',
+ libpq_so_sources,
dependencies: libpq_deps,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
index 16f94c1ed8b..017f729d435 100644
--- a/src/interfaces/libpq/test/meson.build
+++ b/src/interfaces/libpq/test/meson.build
@@ -1,13 +1,34 @@
+libpq_uri_regress_sources = files(
+ 'libpq_uri_regress.c',
+)
+
+if host_system == 'windows'
+ libpq_uri_regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_uri_regress',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_uri_regress',
- files('libpq_uri_regress.c'),
+ libpq_uri_regress_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
}
)
+
+libpq_testclient_sources = files(
+ 'libpq_testclient.c',
+)
+
+if host_system == 'windows'
+ libpq_testclient_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_testclient',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_testclient',
- files('libpq_testclient.c'),
+ libpq_testclient_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 73b733dd50b..535660085dd 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -36,6 +36,13 @@ foreach n : ['SPI', 'Util']
endforeach
plperl_inc = include_directories('.')
+
+if host_system == 'windows'
+ plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plperl',
+ '--FILEDESC', 'PL/Perl - procedural language',])
+endif
+
plperl = shared_module('plperl',
plperl_sources,
include_directories: [plperl_inc, postgres_inc],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index dd499fdd151..c46c0a1da2a 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -40,6 +40,12 @@ pl_unreserved = custom_target('pl_unreserved_kwlist',
generated_sources += pl_unreserved
plpgsql_sources += pl_unreserved
+if host_system == 'windows'
+ plpgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpgsql',
+ '--FILEDESC', 'PL/pgSQL - procedural language',])
+endif
+
plpgsql = shared_module('plpgsql',
plpgsql_sources,
include_directories: include_directories('.'),
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 366b3b171ac..40888386b5f 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -28,6 +28,12 @@ plpython_sources += custom_target('spiexceptions.h',
# FIXME: need to duplicate import library ugliness?
plpython_inc = include_directories('.')
+if host_system == 'windows'
+ plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpython3',
+ '--FILEDESC', 'PL/Python - procedural language',])
+endif
+
plpython = shared_module('plpython3',
plpython_sources,
include_directories: [plpython_inc, postgres_inc],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index 9b6addd7fd5..f09bb14c950 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -14,6 +14,12 @@ pltcl_sources += custom_target('pltclerrcodes.h',
command: [perl, gen_pltclerrcodes, '@INPUT@']
)
+if host_system == 'windows'
+ pltcl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pltcl',
+ '--FILEDESC', 'PL/Tcl - procedural language',])
+endif
+
pltcl = shared_module('pltcl',
pltcl_sources,
include_directories: [include_directories('.'), postgres_inc],
diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build
index fc2368d02cf..7efec0efbc0 100644
--- a/contrib/adminpack/meson.build
+++ b/contrib/adminpack/meson.build
@@ -1,5 +1,15 @@
+adminpack_sources = files(
+ 'adminpack.c',
+)
+
+if host_system == 'windows'
+ adminpack_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'adminpack',
+ '--FILEDESC', 'adminpack - support functions for pgAdmin',])
+endif
+
adminpack = shared_module('adminpack',
- ['adminpack.c'],
+ adminpack_sources,
kwargs: contrib_mod_args,
)
contrib_targets += adminpack
diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build
index 1db3d20349e..fa807b72d98 100644
--- a/contrib/amcheck/meson.build
+++ b/contrib/amcheck/meson.build
@@ -1,7 +1,16 @@
-amcheck = shared_module('amcheck', [
- 'verify_heapam.c',
- 'verify_nbtree.c',
- ],
+amcheck_sources = files(
+ 'verify_heapam.c',
+ 'verify_nbtree.c',
+)
+
+if host_system == 'windows'
+ amcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'amcheck',
+ '--FILEDESC', 'amcheck - function for verifying relation integrity',])
+endif
+
+amcheck = shared_module('amcheck',
+ amcheck_sources,
kwargs: contrib_mod_args,
)
contrib_targets += amcheck
diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build
index d2e01968f54..c4ffb0663bc 100644
--- a/contrib/auth_delay/meson.build
+++ b/contrib/auth_delay/meson.build
@@ -1,5 +1,15 @@
+auth_delay_sources = files(
+ 'auth_delay.c',
+)
+
+if host_system == 'windows'
+ auth_delay_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auth_delay',
+ '--FILEDESC', 'auth_delay - delay authentication failure reports',])
+endif
+
autoinc = shared_module('auth_delay',
- ['auth_delay.c'],
+ auth_delay_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build
index 249a8376faa..76f86617850 100644
--- a/contrib/auto_explain/meson.build
+++ b/contrib/auto_explain/meson.build
@@ -1,5 +1,15 @@
+auto_explain_sources = files(
+ 'auto_explain.c',
+)
+
+if host_system == 'windows'
+ auto_explain_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auto_explain',
+ '--FILEDESC', 'auto_explain - logging facility for execution plans',])
+endif
+
auto_explain = shared_module('auto_explain',
- files('auto_explain.c'),
+ auto_explain_sources,
kwargs: contrib_mod_args,
)
contrib_targets += auto_explain
diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build
index 9f0517f1701..3a389de9175 100644
--- a/contrib/basebackup_to_shell/meson.build
+++ b/contrib/basebackup_to_shell/meson.build
@@ -2,6 +2,12 @@ basebackup_to_shell_sources = files(
'basebackup_to_shell.c',
)
+if host_system == 'windows'
+ basebackup_to_shell_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basebackup_to_shell',
+ '--FILEDESC', 'basebackup_to_shell - target basebackup to shell command',])
+endif
+
basebackup_to_shell = shared_module('basebackup_to_shell',
basebackup_to_shell_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index b67cbef60bd..c30dcfa5d41 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -2,6 +2,12 @@ basic_archive_sources = files(
'basic_archive.c',
)
+if host_system == 'windows'
+ basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basic_archive',
+ '--FILEDESC', 'basic_archive - basic archive module',])
+endif
+
basic_archive = shared_module('basic_archive',
basic_archive_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 1fe7632bdbe..16f3b83e4d2 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -7,6 +7,12 @@ bloom_sources = files(
'blvalidate.c',
)
+if host_system == 'windows'
+ bloom_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bloom',
+ '--FILEDESC', 'bloom access method - signature file based index',])
+endif
+
bloom = shared_module('bloom',
bloom_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build
index c20b667d75f..a68daab0dcd 100644
--- a/contrib/bool_plperl/meson.build
+++ b/contrib/bool_plperl/meson.build
@@ -6,6 +6,12 @@ bool_plperl_sources = files(
'bool_plperl.c',
)
+if host_system == 'windows'
+ bool_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bool_plperl',
+ '--FILEDESC', 'bool_plperl - bool transform for plperl',])
+endif
+
bool_plperl = shared_module('bool_plperl',
bool_plperl_sources,
include_directories: [plperl_inc, include_directories('.')],
diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build
index 15d6d31a6ee..fd4c76767a7 100644
--- a/contrib/btree_gin/meson.build
+++ b/contrib/btree_gin/meson.build
@@ -1,5 +1,15 @@
+btree_gin_sources = files(
+ 'btree_gin.c',
+)
+
+if host_system == 'windows'
+ btree_gin_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gin',
+ '--FILEDESC', 'btree_gin - B-tree equivalent GIN operator classes',])
+endif
+
btree_gin = shared_module('btree_gin',
- files('btree_gin.c'),
+ btree_gin_sources,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gin
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index c0a8d238540..e98c91dacc8 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -25,6 +25,12 @@ btree_gist_sources = files(
'btree_uuid.c',
)
+if host_system == 'windows'
+ btree_gist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gist',
+ '--FILEDESC', 'btree_gist - B-tree equivalent GiST operator classes',])
+endif
+
btree_gist = shared_module('btree_gist',
btree_gist_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build
index ca60eded80b..26a101a19bd 100644
--- a/contrib/citext/meson.build
+++ b/contrib/citext/meson.build
@@ -2,6 +2,12 @@ citext_sources = files(
'citext.c',
)
+if host_system == 'windows'
+ citext_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'citext',
+ '--FILEDESC', 'citext - case-insensitive character string data type',])
+endif
+
citext = shared_module('citext',
citext_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
index 72342b0c82c..041acf95a90 100644
--- a/contrib/cube/meson.build
+++ b/contrib/cube/meson.build
@@ -17,6 +17,12 @@ cube_parse = custom_target('cubeparse',
generated_sources += cube_parse.to_list()
cube_sources += cube_parse
+if host_system == 'windows'
+ cube_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'cube',
+ '--FILEDESC', 'cube - multidimensional cube data type',])
+endif
+
cube = shared_module('cube',
cube_sources,
include_directories: include_directories('.'),
diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
index d35f7b5d49e..66eeb03b736 100644
--- a/contrib/dblink/meson.build
+++ b/contrib/dblink/meson.build
@@ -2,6 +2,12 @@ dblink_sources = files(
'dblink.c',
)
+if host_system == 'windows'
+ dblink_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dblink',
+ '--FILEDESC', 'dblink - connect to other PostgreSQL databases',])
+endif
+
dblink = shared_module('dblink',
dblink_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build
index f00e8085619..6fff921adda 100644
--- a/contrib/dict_int/meson.build
+++ b/contrib/dict_int/meson.build
@@ -1,5 +1,15 @@
+dict_int_sources = files(
+ 'dict_int.c',
+)
+
+if host_system == 'windows'
+ dict_int_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_int',
+ '--FILEDESC', 'dict_int - add-on dictionary template for full-text search',])
+endif
+
dict_int = shared_module('dict_int',
- files('dict_int.c'),
+ dict_int_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_int
diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build
index be53f55bb79..fabd505a7df 100644
--- a/contrib/dict_xsyn/meson.build
+++ b/contrib/dict_xsyn/meson.build
@@ -1,5 +1,15 @@
+dict_xsyn_sources = files(
+ 'dict_xsyn.c',
+)
+
+if host_system == 'windows'
+ dict_xsyn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_xsyn',
+ '--FILEDESC', 'dict_xsyn - add-on dictionary template for full-text search',])
+endif
+
dict_xsyn = shared_module('dict_xsyn',
- files('dict_xsyn.c'),
+ dict_xsyn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_xsyn
diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build
index 807f5cb7de3..78dc29c3da3 100644
--- a/contrib/earthdistance/meson.build
+++ b/contrib/earthdistance/meson.build
@@ -1,5 +1,15 @@
+earthdistance_sources = files(
+ 'earthdistance.c',
+)
+
+if host_system == 'windows'
+ earthdistance_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'earthdistance',
+ '--FILEDESC', 'earthdistance - calculate distances on the surface of the Earth',])
+endif
+
earthdistance = shared_module('earthdistance',
- files('earthdistance.c'),
+ earthdistance_sources,
kwargs: contrib_mod_args,
)
contrib_targets += earthdistance
diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build
index f13efb6e38e..c4071faa669 100644
--- a/contrib/file_fdw/meson.build
+++ b/contrib/file_fdw/meson.build
@@ -1,5 +1,15 @@
+file_fdw_sources = files(
+ 'file_fdw.c',
+)
+
+if host_system == 'windows'
+ file_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'file_fdw',
+ '--FILEDESC', 'file_fdw - foreign data wrapper for files',])
+endif
+
file_fdw = shared_module('file_fdw',
- files('file_fdw.c'),
+ file_fdw_sources,
kwargs: contrib_mod_args,
)
contrib_targets += file_fdw
diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build
index ec278a6211e..e6d06149cec 100644
--- a/contrib/fuzzystrmatch/meson.build
+++ b/contrib/fuzzystrmatch/meson.build
@@ -1,8 +1,16 @@
+fuzzystrmatch_sources = files(
+ 'fuzzystrmatch.c',
+ 'dmetaphone.c',
+)
+
+if host_system == 'windows'
+ fuzzystrmatch_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'fuzzystrmatch',
+ '--FILEDESC', 'fuzzystrmatch - similarities and distance between strings',])
+endif
+
fuzzystrmatch = shared_module('fuzzystrmatch',
- files(
- 'fuzzystrmatch.c',
- 'dmetaphone.c'
- ),
+ fuzzystrmatch_sources,
kwargs: contrib_mod_args,
)
contrib_targets += fuzzystrmatch
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 07c59f40a97..2bb26bb772b 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -1,15 +1,23 @@
# .. so that includes of hstore/hstore.h work
hstore_inc = include_directories('.', '../')
+hstore_sources = files(
+ 'hstore_compat.c',
+ 'hstore_gin.c',
+ 'hstore_gist.c',
+ 'hstore_io.c',
+ 'hstore_op.c',
+ 'hstore_subs.c',
+)
+
+if host_system == 'windows'
+ hstore_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore',
+ '--FILEDESC', 'hstore - key/value pair data type',])
+endif
+
hstore = shared_module('hstore',
- files(
- 'hstore_compat.c',
- 'hstore_gin.c',
- 'hstore_gist.c',
- 'hstore_io.c',
- 'hstore_op.c',
- 'hstore_subs.c',
- ),
+ hstore_sources,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build
index bbafa0221bd..a238fee6a26 100644
--- a/contrib/hstore_plperl/meson.build
+++ b/contrib/hstore_plperl/meson.build
@@ -6,6 +6,12 @@ hstore_plperl_sources = files(
'hstore_plperl.c',
)
+if host_system == 'windows'
+ hstore_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plperl',
+ '--FILEDESC', 'hstore_plperl - hstore transform for plperl',])
+endif
+
hstore_plperl = shared_module('hstore_plperl',
hstore_plperl_sources,
include_directories: [plperl_inc, hstore_inc],
diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build
index 214b48519a9..6071aaeb4b3 100644
--- a/contrib/hstore_plpython/meson.build
+++ b/contrib/hstore_plpython/meson.build
@@ -6,6 +6,12 @@ hstore_plpython_sources = files(
'hstore_plpython.c',
)
+if host_system == 'windows'
+ hstore_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plpython3',
+ '--FILEDESC', 'hstore_plpython - hstore transform for plpython',])
+endif
+
hstore_plpython = shared_module('hstore_plpython3',
hstore_plpython_sources,
include_directories: [plpython_inc, hstore_inc, ],
diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build
index 1655bcbb3fd..b7cf1ce0cad 100644
--- a/contrib/intarray/meson.build
+++ b/contrib/intarray/meson.build
@@ -8,6 +8,12 @@ intarray_sources = files(
'_intbig_gist.c',
)
+if host_system == 'windows'
+ intarray_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', '_int',
+ '--FILEDESC', 'intarray - functions and operators for arrays of integers',])
+endif
+
intarray = shared_module('_int',
intarray_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
index cc30bbeb55c..db68a718313 100644
--- a/contrib/isn/meson.build
+++ b/contrib/isn/meson.build
@@ -2,6 +2,12 @@ isn_sources = files(
'isn.c',
)
+if host_system == 'windows'
+ isn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isn',
+ '--FILEDESC', 'isn - data types for international product numbering standards',])
+endif
+
isn = shared_module('isn',
isn_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build
index 5c915d8ed94..071a7a98d2c 100644
--- a/contrib/jsonb_plperl/meson.build
+++ b/contrib/jsonb_plperl/meson.build
@@ -6,6 +6,12 @@ jsonb_plperl_sources = files(
'jsonb_plperl.c',
)
+if host_system == 'windows'
+ jsonb_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plperl',
+ '--FILEDESC', 'jsonb_plperl - jsonb transform for plperl',])
+endif
+
jsonb_plperl = shared_module('jsonb_plperl',
jsonb_plperl_sources,
include_directories: [plperl_inc],
diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build
index de8e1105c6a..84dc1161e8b 100644
--- a/contrib/jsonb_plpython/meson.build
+++ b/contrib/jsonb_plpython/meson.build
@@ -6,6 +6,12 @@ jsonb_plpython_sources = files(
'jsonb_plpython.c',
)
+if host_system == 'windows'
+ jsonb_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plpython3',
+ '--FILEDESC', 'jsonb_plpython - jsonb transform for plpython',])
+endif
+
jsonb_plpython = shared_module('jsonb_plpython3',
jsonb_plpython_sources,
include_directories: [plpython_inc],
diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build
index 9082d5713c7..61ae131f1cc 100644
--- a/contrib/lo/meson.build
+++ b/contrib/lo/meson.build
@@ -2,6 +2,12 @@ lo_sources = files(
'lo.c',
)
+if host_system == 'windows'
+ lo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'lo',
+ '--FILEDESC', 'lo - management for large objects',])
+endif
+
lo = shared_module('lo',
lo_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
index 9463fc2c5e5..421292cea9d 100644
--- a/contrib/ltree/meson.build
+++ b/contrib/ltree/meson.build
@@ -13,6 +13,12 @@ ltree_sources = files(
# .. so that includes of ltree/ltree.h work
ltree_inc = include_directories('.', '../')
+if host_system == 'windows'
+ ltree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree',
+ '--FILEDESC', 'ltree - hierarchical label data type',])
+endif
+
ltree = shared_module('ltree',
ltree_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build
index 429d75006aa..acf5e4a6fc8 100644
--- a/contrib/ltree_plpython/meson.build
+++ b/contrib/ltree_plpython/meson.build
@@ -6,6 +6,12 @@ ltree_plpython_sources = files(
'ltree_plpython.c',
)
+if host_system == 'windows'
+ ltree_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree_plpython3',
+ '--FILEDESC', 'ltree_plpython - ltree transform for plpython',])
+endif
+
ltree_plpython = shared_module('ltree_plpython3',
ltree_plpython_sources,
include_directories: [plpython_inc, ltree_inc],
diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build
index 1dad5d8f6e7..1a248f19260 100644
--- a/contrib/oid2name/meson.build
+++ b/contrib/oid2name/meson.build
@@ -1,5 +1,15 @@
+oid2name_sources = files(
+ 'oid2name.c',
+)
+
+if host_system == 'windows'
+ oid2name_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'oid2name',
+ '--FILEDESC', 'oid2name - examine the file structure',])
+endif
+
oid2name = executable('oid2name',
- ['oid2name.c'],
+ oid2name_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build
index 8e7ee09a43a..77276c3715a 100644
--- a/contrib/old_snapshot/meson.build
+++ b/contrib/old_snapshot/meson.build
@@ -2,6 +2,12 @@ old_snapshot_sources = files(
'time_mapping.c',
)
+if host_system == 'windows'
+ old_snapshot_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'old_snapshot',
+ '--FILEDESC', 'old_snapshot - utilities in support of old_snapshot_threshold',])
+endif
+
old_snapshot = shared_module('old_snapshot',
old_snapshot_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
index 4af8153e4fd..3ec50b9445e 100644
--- a/contrib/pageinspect/meson.build
+++ b/contrib/pageinspect/meson.build
@@ -9,6 +9,12 @@ pageinspect_sources = files(
'rawpage.c',
)
+if host_system == 'windows'
+ pageinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pageinspect',
+ '--FILEDESC', 'pageinspect - functions to inspect contents of database pages',])
+endif
+
pageinspect = shared_module('pageinspect',
pageinspect_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build
index 7da47d02f1d..383d7df372a 100644
--- a/contrib/passwordcheck/meson.build
+++ b/contrib/passwordcheck/meson.build
@@ -9,6 +9,12 @@ passwordcheck_deps = []
# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
# passwordcheck_deps += [cc.find_library('crack')]
+if host_system == 'windows'
+ passwordcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'passwordcheck',
+ '--FILEDESC', 'passwordcheck - strengthen user password checks',])
+endif
+
passwordcheck = shared_module('passwordcheck',
passwordcheck_sources,
c_args: passwordcheck_c_args,
diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build
index 2c69eae3ea2..dd9948e5f0b 100644
--- a/contrib/pg_buffercache/meson.build
+++ b/contrib/pg_buffercache/meson.build
@@ -1,7 +1,15 @@
+pg_buffercache_sources = files(
+ 'pg_buffercache_pages.c',
+)
+
+if host_system == 'windows'
+ pg_buffercache_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_buffercache',
+ '--FILEDESC', 'pg_buffercache - monitoring of shared buffer cache in real-time',])
+endif
+
pg_buffercache = shared_module('pg_buffercache',
- files(
- 'pg_buffercache_pages.c',
- ),
+ pg_buffercache_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_buffercache
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index f795014d7ca..904b37b6e9b 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -1,7 +1,15 @@
+pg_freespacemap_sources = files(
+ 'pg_freespacemap.c',
+)
+
+if host_system == 'windows'
+ pg_freespacemap_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_freespacemap',
+ '--FILEDESC', 'pg_freespacemap - monitoring of free space map',])
+endif
+
pg_freespacemap = shared_module('pg_freespacemap',
- files(
- 'pg_freespacemap.c',
- ),
+ pg_freespacemap_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_freespacemap
diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build
index bdca9af4f27..b7140cee34b 100644
--- a/contrib/pg_prewarm/meson.build
+++ b/contrib/pg_prewarm/meson.build
@@ -1,8 +1,16 @@
+pg_prewarm_sources = files(
+ 'autoprewarm.c',
+ 'pg_prewarm.c',
+)
+
+if host_system == 'windows'
+ pg_prewarm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_prewarm',
+ '--FILEDESC', 'pg_prewarm - preload relation data into system buffer cache',])
+endif
+
pg_prewarm = shared_module('pg_prewarm',
- files(
- 'autoprewarm.c',
- 'pg_prewarm.c',
- ),
+ pg_prewarm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_prewarm
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index ac117d2fc1d..854df138e76 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -1,5 +1,15 @@
+pg_stat_statements_sources = files(
+ 'pg_stat_statements.c',
+)
+
+if host_system == 'windows'
+ pg_stat_statements_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_stat_statements',
+ '--FILEDESC', 'pg_stat_statements - execution statistics of SQL statements',])
+endif
+
pg_stat_statements = shared_module('pg_stat_statements',
- files('pg_stat_statements.c'),
+ pg_stat_statements_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build
index ac71caa5276..7b5c5999f4b 100644
--- a/contrib/pg_surgery/meson.build
+++ b/contrib/pg_surgery/meson.build
@@ -1,7 +1,15 @@
+pg_surgery_sources = files(
+ 'heap_surgery.c',
+)
+
+if host_system == 'windows'
+ pg_surgery_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_surgery',
+ '--FILEDESC', 'pg_surgery - perform surgery on a damaged relation',])
+endif
+
pg_surgery = shared_module('pg_surgery',
- files(
- 'heap_surgery.c',
- ),
+ pg_surgery_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_surgery
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index a90628d23c6..c8c7c07b308 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -1,10 +1,18 @@
+pg_trgm_sources = files(
+ 'trgm_gin.c',
+ 'trgm_gist.c',
+ 'trgm_op.c',
+ 'trgm_regexp.c',
+)
+
+if host_system == 'windows'
+ pg_trgm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_trgm',
+ '--FILEDESC', 'pg_trgm - trigram matching',])
+endif
+
pg_trgm = shared_module('pg_trgm',
- files(
- 'trgm_gin.c',
- 'trgm_gist.c',
- 'trgm_op.c',
- 'trgm_regexp.c',
- ),
+ pg_trgm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build
index 933dc99ac4d..263a0d08b82 100644
--- a/contrib/pg_visibility/meson.build
+++ b/contrib/pg_visibility/meson.build
@@ -1,7 +1,15 @@
+pg_visibility_sources = files(
+ 'pg_visibility.c',
+)
+
+if host_system == 'windows'
+ pg_visibility_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_visibility',
+ '--FILEDESC', 'pg_visibility - page visibility information',])
+endif
+
pg_visibility = shared_module('pg_visibility',
- files(
- 'pg_visibility.c',
- ),
+ pg_visibility_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_visibility
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index d6b27877dd0..4314a3182a2 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -1,5 +1,11 @@
pg_walinspect_sources = files('pg_walinspect.c')
+if host_system == 'windows'
+ pg_walinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_walinspect',
+ '--FILEDESC', 'pg_walinspect - functions to inspect contents of PostgreSQL Write-Ahead Log',])
+endif
+
pg_walinspect = shared_module('pg_walinspect',
pg_walinspect_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index fe0851bf8e8..7fc7bbc7ca1 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -69,6 +69,12 @@ else
pgcrypto_regress += 'pgp-zlib-DISABLED'
endif
+if host_system == 'windows'
+ pgcrypto_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgcrypto',
+ '--FILEDESC', 'pgcrypto - cryptographic functions',])
+endif
+
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build
index 1b41691a2a3..8092f0d4a64 100644
--- a/contrib/pgrowlocks/meson.build
+++ b/contrib/pgrowlocks/meson.build
@@ -1,7 +1,15 @@
+pgrowlocks_sources = files(
+ 'pgrowlocks.c',
+)
+
+if host_system == 'windows'
+ pgrowlocks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgrowlocks',
+ '--FILEDESC', 'pgrowlocks - display row locking information',])
+endif
+
pgrowlocks = shared_module('pgrowlocks',
- files(
- 'pgrowlocks.c',
- ),
+ pgrowlocks_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgrowlocks
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 8e828692d5c..05e4cd46a5c 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -1,9 +1,17 @@
+pgstattuple_sources = files(
+ 'pgstatapprox.c',
+ 'pgstatindex.c',
+ 'pgstattuple.c',
+)
+
+if host_system == 'windows'
+ pgstattuple_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgstattuple',
+ '--FILEDESC', 'pgstattuple - tuple-level statistics',])
+endif
+
pgstattuple = shared_module('pgstattuple',
- files(
- 'pgstatapprox.c',
- 'pgstatindex.c',
- 'pgstattuple.c',
- ),
+ pgstattuple_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
index 378885ec93b..d3746ff135c 100644
--- a/contrib/postgres_fdw/meson.build
+++ b/contrib/postgres_fdw/meson.build
@@ -6,6 +6,12 @@ postgres_fdw_sources = files(
'shippable.c',
)
+if host_system == 'windows'
+ postgres_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'postgres_fdw',
+ '--FILEDESC', 'postgres_fdw - foreign data wrapper for PostgreSQL',])
+endif
+
postgres_fdw = shared_module('postgres_fdw',
postgres_fdw_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
index e476eab2a77..c6fbb22999b 100644
--- a/contrib/seg/meson.build
+++ b/contrib/seg/meson.build
@@ -17,6 +17,12 @@ seg_parse = custom_target('segparse',
generated_sources += seg_parse.to_list()
seg_sources += seg_parse
+if host_system == 'windows'
+ seg_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'seg',
+ '--FILEDESC', 'seg - line segment data type',])
+endif
+
seg = shared_module('seg',
seg_sources,
include_directories: include_directories('.'),
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 60a95e17c2f..8bef239e3c2 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -14,6 +14,12 @@ sepgsql_sources = files(
'uavc.c',
)
+if host_system == 'windows'
+ sepgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sepgsql',
+ '--FILEDESC', 'sepgsql - SELinux integration',])
+endif
+
sepgsql = shared_module('sepgsql',
sepgsql_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
index 98008980ec2..e7d78189ef5 100644
--- a/contrib/spi/meson.build
+++ b/contrib/spi/meson.build
@@ -1,5 +1,15 @@
+autoinc_sources = files(
+ 'autoinc.c',
+)
+
+if host_system == 'windows'
+ autoinc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'autoinc',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
autoinc = shared_module('autoinc',
- ['autoinc.c'],
+ autoinc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
@@ -9,8 +19,18 @@ install_data('autoinc.control', 'autoinc--1.0.sql',
)
+insert_username_sources = files(
+ 'insert_username.c',
+)
+
+if host_system == 'windows'
+ insert_username_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'insert_username',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
insert_username = shared_module('insert_username',
- ['insert_username.c'],
+ insert_username_sources,
kwargs: contrib_mod_args,
)
contrib_targets += insert_username
@@ -22,8 +42,18 @@ install_data(
)
+moddatetime_sources = files(
+ 'moddatetime.c',
+)
+
+if host_system == 'windows'
+ moddatetime_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'moddatetime',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
moddatetime = shared_module('moddatetime',
- ['moddatetime.c'],
+ moddatetime_sources,
kwargs: contrib_mod_args,
)
contrib_targets += moddatetime
@@ -38,8 +68,18 @@ install_data(
# comment out if you want a quieter refint package for other uses
refint_cflags = ['-DREFINT_VERBOSE']
+refint_sources = files(
+ 'refint.c',
+)
+
+if host_system == 'windows'
+ refint_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'refint',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
refint = shared_module('refint',
- ['refint.c'],
+ refint_sources,
c_args: refint_cflags,
kwargs: contrib_mod_args,
)
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
index 53f752a08ac..136983e783d 100644
--- a/contrib/sslinfo/meson.build
+++ b/contrib/sslinfo/meson.build
@@ -2,10 +2,18 @@ if not ssl.found()
subdir_done()
endif
+sslinfo_sources = files(
+ 'sslinfo.c',
+)
+
+if host_system == 'windows'
+ sslinfo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sslinfo',
+ '--FILEDESC', 'sslinfo - information about client SSL certificate',])
+endif
+
sslinfo = shared_module('sslinfo',
- files(
- 'sslinfo.c',
- ),
+ sslinfo_sources,
kwargs: contrib_mod_args + {
'dependencies': [ssl, contrib_mod_args['dependencies']],
}
diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build
index f4230096c0c..d2ddc8d3b39 100644
--- a/contrib/tablefunc/meson.build
+++ b/contrib/tablefunc/meson.build
@@ -1,7 +1,15 @@
+tablefunc_sources = files(
+ 'tablefunc.c',
+)
+
+if host_system == 'windows'
+ tablefunc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tablefunc',
+ '--FILEDESC', 'tablefunc - various functions that return tables',])
+endif
+
tablefunc = shared_module('tablefunc',
- files(
- 'tablefunc.c',
- ),
+ tablefunc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tablefunc
diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build
index c3a025247d4..71261c3b0a2 100644
--- a/contrib/tcn/meson.build
+++ b/contrib/tcn/meson.build
@@ -1,7 +1,15 @@
+tcn_sources = files(
+ 'tcn.c',
+)
+
+if host_system == 'windows'
+ tcn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tcn',
+ '--FILEDESC', 'tcn - trigger function notifying listeners',])
+endif
+
tcn = shared_module('tcn',
- files(
- 'tcn.c',
- ),
+ tcn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tcn
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index dd7cb0101ad..6376103c689 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -2,6 +2,12 @@ test_decoding_sources = files(
'test_decoding.c',
)
+if host_system == 'windows'
+ test_decoding_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_decoding',
+ '--FILEDESC', 'test_decoding - example of a logical decoding output plugin',])
+endif
+
test_decoding = shared_module('test_decoding',
test_decoding_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build
index b9cd42115a8..380abb49883 100644
--- a/contrib/tsm_system_rows/meson.build
+++ b/contrib/tsm_system_rows/meson.build
@@ -1,7 +1,15 @@
+tsm_system_rows_sources = files(
+ 'tsm_system_rows.c',
+)
+
+if host_system == 'windows'
+ tsm_system_rows_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_rows',
+ '--FILEDESC', 'tsm_system_rows - TABLESAMPLE method which accepts number of rows as a limit',])
+endif
+
tsm_system_rows = shared_module('tsm_system_rows',
- files(
- 'tsm_system_rows.c',
- ),
+ tsm_system_rows_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_rows
diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build
index 18015912ffb..e57a2702c60 100644
--- a/contrib/tsm_system_time/meson.build
+++ b/contrib/tsm_system_time/meson.build
@@ -1,7 +1,15 @@
+tsm_system_time_sources = files(
+ 'tsm_system_time.c',
+)
+
+if host_system == 'windows'
+ tsm_system_time_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_time',
+ '--FILEDESC', 'tsm_system_time - TABLESAMPLE method which accepts time in milliseconds as a limit',])
+endif
+
tsm_system_time = shared_module('tsm_system_time',
- files(
- 'tsm_system_time.c',
- ),
+ tsm_system_time_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_time
diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build
index 872b76e3223..438035132f8 100644
--- a/contrib/unaccent/meson.build
+++ b/contrib/unaccent/meson.build
@@ -1,7 +1,15 @@
+unaccent_sources = files(
+ 'unaccent.c',
+)
+
+if host_system == 'windows'
+ unaccent_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'unaccent',
+ '--FILEDESC', 'unaccent - text search dictionary that removes accents',])
+endif
+
unaccent = shared_module('unaccent',
- files(
- 'unaccent.c',
- ),
+ unaccent_sources,
kwargs: contrib_mod_args,
)
contrib_targets += unaccent
diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build
index da6d1d75c12..28730f398f0 100644
--- a/contrib/uuid-ossp/meson.build
+++ b/contrib/uuid-ossp/meson.build
@@ -2,10 +2,18 @@ if not uuid.found()
subdir_done()
endif
+uuid_ossp_sources = files(
+ 'uuid-ossp.c',
+)
+
+if host_system == 'windows'
+ uuid_ossp_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'uuid-ossp',
+ '--FILEDESC', 'uuid-ossp - UUID generation',])
+endif
+
uuid_ossp = shared_module('uuid-ossp',
- files(
- 'uuid-ossp.c',
- ),
+ uuid_ossp_sources,
kwargs: contrib_mod_args + {
'dependencies': [uuid, contrib_mod_args['dependencies']],
},
diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build
index 7a632b87d1b..846de47dbd1 100644
--- a/contrib/vacuumlo/meson.build
+++ b/contrib/vacuumlo/meson.build
@@ -1,5 +1,15 @@
+vacuumlo_sources = files(
+ 'vacuumlo.c',
+)
+
+if host_system == 'windows'
+ vacuumlo_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'vacuumlo',
+ '--FILEDESC', 'vacuumlo - removes orphaned large objects',])
+endif
+
vacuumlo = executable('vacuumlo',
- ['vacuumlo.c'],
+ vacuumlo_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 9c0b56f01f6..89b0d677516 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -2,11 +2,19 @@ if not libxml.found()
subdir_done()
endif
+xml2_sources = files(
+ 'xpath.c',
+ 'xslt_proc.c',
+)
+
+if host_system == 'windows'
+ xml2_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgxml',
+ '--FILEDESC', 'xml2 - XPath querying and XSLT',])
+endif
+
xml2 = shared_module('pgxml',
- files(
- 'xpath.c',
- 'xslt_proc.c',
- ),
+ xml2_sources,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 5887cb92b52..e5dc0edc04b 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -1,7 +1,11 @@
export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
-ecpg_compat = both_libraries('libecpg_compat',
+ecpg_compat_sources = files(
'informix.c',
+)
+
+ecpg_compat = both_libraries('libecpg_compat',
+ ecpg_compat_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
c_args: ['-DSO_MAJOR_VERSION=3'],
dependencies: [frontend_code, thread_dep],
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 1be49c8c27f..74876f039c9 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -93,6 +93,12 @@ ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
generated_sources += ecpg_kwlist
ecpg_sources += ecpg_kwlist
+if host_system == 'windows'
+ ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ecpg',
+ '--FILEDESC', 'ecpg - embedded SQL precompiler for C',])
+endif
+
ecpg_exe = executable('ecpg',
ecpg_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index f0ace641f0c..f67f2dffb71 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -7,6 +7,12 @@ pg_regress_ecpg_sources = pg_regress_c + files(
'pg_regress_ecpg.c',
)
+if host_system == 'windows'
+ pg_regress_ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress_ecpg',
+ '--FILEDESC', 'ECPG Test - regression tests for ECPG',])
+endif
+
pg_regress_ecpg = executable('pg_regress_ecpg',
pg_regress_ecpg_sources,
c_args: pg_regress_cflags,
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index c7656fd4609..ba27b8c1d44 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -23,6 +23,12 @@ spec_parser = custom_target('specparse',
isolationtester_sources += spec_parser
generated_sources += spec_parser.to_list()
+if host_system == 'windows'
+ isolation_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_isolation_regress',
+ '--FILEDESC', 'pg_isolation_regress - multi-client test driver',])
+endif
+
pg_isolation_regress = executable('pg_isolation_regress',
isolation_sources,
c_args: pg_regress_cflags,
@@ -34,6 +40,13 @@ pg_isolation_regress = executable('pg_isolation_regress',
)
bin_targets += pg_isolation_regress
+
+if host_system == 'windows'
+ isolationtester_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isolationtester',
+ '--FILEDESC', 'isolationtester - multi-client test driver',])
+endif
+
isolationtester = executable('isolationtester',
isolationtester_sources,
include_directories: include_directories('.'),
diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build
index cf4bdaba637..a0c3ab6afe7 100644
--- a/src/test/modules/delay_execution/meson.build
+++ b/src/test/modules/delay_execution/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+delay_execution_sources = files(
+ 'delay_execution.c',
+)
+
+if host_system == 'windows'
+ delay_execution_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'delay_execution',
+ '--FILEDESC', 'delay_execution - allow delay between parsing and execution',])
+endif
+
delay_execution = shared_module('delay_execution',
- ['delay_execution.c'],
+ delay_execution_sources,
kwargs: pg_mod_args,
)
testprep_targets += delay_execution
diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build
index 56ff5f48001..4ce82491135 100644
--- a/src/test/modules/dummy_index_am/meson.build
+++ b/src/test/modules/dummy_index_am/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_index_am_sources = files(
+ 'dummy_index_am.c',
+)
+
+if host_system == 'windows'
+ dummy_index_am_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_index_am',
+ '--FILEDESC', 'dummy_index_am - index access method template',])
+endif
+
dummy_index_am = shared_module('dummy_index_am',
- ['dummy_index_am.c'],
+ dummy_index_am_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_index_am
diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build
index 21b7cf8f353..81b626e496c 100644
--- a/src/test/modules/dummy_seclabel/meson.build
+++ b/src/test/modules/dummy_seclabel/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_seclabel_sources = files(
+ 'dummy_seclabel.c',
+)
+
+if host_system == 'windows'
+ dummy_seclabel_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_seclabel',
+ '--FILEDESC', 'dummy_seclabel - regression testing of the SECURITY LABEL statement',])
+endif
+
dummy_seclabel = shared_module('dummy_seclabel',
- ['dummy_seclabel.c'],
+ dummy_seclabel_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_seclabel
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
index 8384b6e3b2a..de0e2d15626 100644
--- a/src/test/modules/libpq_pipeline/meson.build
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -1,7 +1,15 @@
+libpq_pipeline_sources = files(
+ 'libpq_pipeline.c',
+)
+
+if host_system == 'windows'
+ libpq_pipeline_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_pipeline',
+ '--FILEDESC', 'libpq_pipeline - test program for pipeline execution',])
+endif
+
libpq_pipeline = executable('libpq_pipeline',
- files(
- 'libpq_pipeline.c',
- ),
+ libpq_pipeline_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build
index 45de3f1990d..e1ea2c7a16f 100644
--- a/src/test/modules/plsample/meson.build
+++ b/src/test/modules/plsample/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+plsample_sources = files(
+ 'plsample.c',
+)
+
+if host_system == 'windows'
+ plsample_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plsample',
+ '--FILEDESC', 'PL/Sample - template for procedural language',])
+endif
+
plsample = shared_module('plsample',
- ['plsample.c'],
+ plsample_sources,
kwargs: pg_mod_args,
)
testprep_targets += plsample
diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build
index 857fc7e140e..445296fee0b 100644
--- a/src/test/modules/spgist_name_ops/meson.build
+++ b/src/test/modules/spgist_name_ops/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+spgist_name_ops_sources = files(
+ 'spgist_name_ops.c',
+)
+
+if host_system == 'windows'
+ spgist_name_ops_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'spgist_name_ops',
+ '--FILEDESC', 'spgist_name_ops - test opclass for SP-GiST',])
+endif
+
spgist_name_ops = shared_module('spgist_name_ops',
- ['spgist_name_ops.c'],
+ spgist_name_ops_sources,
kwargs: pg_mod_args,
)
testprep_targets += spgist_name_ops
diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build
index a57bd0693a3..a9eb4c564da 100644
--- a/src/test/modules/ssl_passphrase_callback/meson.build
+++ b/src/test/modules/ssl_passphrase_callback/meson.build
@@ -3,8 +3,19 @@ if not ssl.found()
endif
# FIXME: prevent install during main install, but not during test :/
+
+ssl_passphrase_callback_sources = files(
+ 'ssl_passphrase_func.c',
+)
+
+if host_system == 'windows'
+ ssl_passphrase_callback_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ssl_passphrase_func',
+ '--FILEDESC', 'callback function to provide a passphrase',])
+endif
+
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
- ['ssl_passphrase_func.c'],
+ ssl_passphrase_callback_sources,
kwargs: pg_mod_args + {
'dependencies': [ssl, pg_mod_args['dependencies']],
},
diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build
index 945eb5a70c4..3cf6b05754f 100644
--- a/src/test/modules/test_bloomfilter/meson.build
+++ b/src/test/modules/test_bloomfilter/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_bloomfilter_sources = files(
+ 'test_bloomfilter.c',
+)
+
+if host_system == 'windows'
+ test_bloomfilter_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_bloomfilter',
+ '--FILEDESC', 'test_bloomfilter - test code for Bloom filter library',])
+endif
+
test_bloomfilter = shared_module('test_bloomfilter',
- ['test_bloomfilter.c'],
+ test_bloomfilter_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_bloomfilter
diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build
index 81ad5adc526..54d44f9b2b4 100644
--- a/src/test/modules/test_ddl_deparse/meson.build
+++ b/src/test/modules/test_ddl_deparse/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ddl_deparse_sources = files(
+ 'test_ddl_deparse.c',
+)
+
+if host_system == 'windows'
+ test_ddl_deparse_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ddl_deparse',
+ '--FILEDESC', 'test_ddl_deparse - regression testing for DDL deparsing',])
+endif
+
test_ddl_deparse = shared_module('test_ddl_deparse',
- ['test_ddl_deparse.c'],
+ test_ddl_deparse_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ddl_deparse
diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build
index abf0a3b0430..b3b49c56122 100644
--- a/src/test/modules/test_ginpostinglist/meson.build
+++ b/src/test/modules/test_ginpostinglist/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ginpostinglist_sources = files(
+ 'test_ginpostinglist.c',
+)
+
+if host_system == 'windows'
+ test_ginpostinglist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ginpostinglist',
+ '--FILEDESC', 'test_ginpostinglist - test code for src/backend/access/gin//ginpostinglist.c',])
+endif
+
test_ginpostinglist = shared_module('test_ginpostinglist',
- ['test_ginpostinglist.c'],
+ test_ginpostinglist_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ginpostinglist
diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build
index c32c469c69a..4bd75af4b5e 100644
--- a/src/test/modules/test_integerset/meson.build
+++ b/src/test/modules/test_integerset/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_integerset_sources = files(
+ 'test_integerset.c',
+)
+
+if host_system == 'windows'
+ test_integerset_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_integerset',
+ '--FILEDESC', 'test_integerset - test code for src/backend/lib/integerset.c',])
+endif
+
test_integerset = shared_module('test_integerset',
- ['test_integerset.c'],
+ test_integerset_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_integerset
diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build
index a388de1156a..c5405b8f878 100644
--- a/src/test/modules/test_lfind/meson.build
+++ b/src/test/modules/test_lfind/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_lfind_sources = files(
+ 'test_lfind.c',
+)
+
+if host_system == 'windows'
+ test_lfind_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_lfind',
+ '--FILEDESC', 'test_lfind - test code for optimized linear search functions',])
+endif
+
test_lfind = shared_module('test_lfind',
- ['test_lfind.c'],
+ test_lfind_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_lfind
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 5faf0459777..8802bbbac55 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_oat_hooks_sources = files(
+ 'test_oat_hooks.c',
+)
+
+if host_system == 'windows'
+ test_oat_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_oat_hooks',
+ '--FILEDESC', 'test_oat_hooks - example use of object access hooks',])
+endif
+
test_oat_hooks = shared_module('test_oat_hooks',
- ['test_oat_hooks.c'],
+ test_oat_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_oat_hooks
diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build
index b59960f615e..1c17113347f 100644
--- a/src/test/modules/test_parser/meson.build
+++ b/src/test/modules/test_parser/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_parser_sources = files(
+ 'test_parser.c',
+)
+
+if host_system == 'windows'
+ test_parser_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_parser',
+ '--FILEDESC', 'test_parser - example of a custom parser for full-text search',])
+endif
+
test_parser = shared_module('test_parser',
- ['test_parser.c'],
+ test_parser_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_parser
diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build
index 1cfa84b3609..9a5be43c9c0 100644
--- a/src/test/modules/test_predtest/meson.build
+++ b/src/test/modules/test_predtest/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_predtest_sources = files(
+ 'test_predtest.c',
+)
+
+if host_system == 'windows'
+ test_predtest_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_predtest',
+ '--FILEDESC', 'test_predtest - test code for optimizer/util/predtest.c',])
+endif
+
test_predtest = shared_module('test_predtest',
- ['test_predtest.c'],
+ test_predtest_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_predtest
diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build
index 34cbc3e1624..f067e08d321 100644
--- a/src/test/modules/test_rbtree/meson.build
+++ b/src/test/modules/test_rbtree/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rbtree_sources = files(
+ 'test_rbtree.c',
+)
+
+if host_system == 'windows'
+ test_rbtree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rbtree',
+ '--FILEDESC', 'test_rbtree - test code for red-black tree library',])
+endif
+
test_rbtree = shared_module('test_rbtree',
- ['test_rbtree.c'],
+ test_rbtree_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rbtree
diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build
index 867a64e57c3..cfb938d9f1e 100644
--- a/src/test/modules/test_regex/meson.build
+++ b/src/test/modules/test_regex/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_regex_sources = files(
+ 'test_regex.c',
+)
+
+if host_system == 'windows'
+ test_regex_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_regex',
+ '--FILEDESC', 'test_regex - test code for backend/regex/',])
+endif
+
test_regex = shared_module('test_regex',
- ['test_regex.c'],
+ test_regex_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_regex
diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build
index 80d8adda332..3fb273b2934 100644
--- a/src/test/modules/test_rls_hooks/meson.build
+++ b/src/test/modules/test_rls_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rls_hooks_sources = files(
+ 'test_rls_hooks.c',
+)
+
+if host_system == 'windows'
+ test_rls_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rls_hooks',
+ '--FILEDESC', 'test_rls_hooks - example use of RLS hooks',])
+endif
+
test_rls_hooks = shared_module('test_rls_hooks',
- ['test_rls_hooks.c'],
+ test_rls_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rls_hooks
diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build
index b663543d616..16c8fdb57f4 100644
--- a/src/test/modules/test_shm_mq/meson.build
+++ b/src/test/modules/test_shm_mq/meson.build
@@ -1,10 +1,19 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_shm_mq_sources = files(
+ 'setup.c',
+ 'test.c',
+ 'worker.c',
+)
+
+if host_system == 'windows'
+ test_shm_mq_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_shm_mq',
+ '--FILEDESC', 'test_shm_mq - example use of shared memory message queue',])
+endif
+
test_shm_mq = shared_module('test_shm_mq',
- files(
- 'setup.c',
- 'test.c',
- 'worker.c',
- ),
+ test_shm_mq_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_shm_mq
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index 32acad883b2..a4a158c75b9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -1,8 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_worker_spi_sources = files(
+ 'worker_spi.c',
+)
+
+if host_system == 'windows'
+ test_worker_spi_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'worker_spi',
+ '--FILEDESC', 'worker_spi - background worker example',])
+endif
+
test_worker_spi = shared_module('worker_spi',
- files(
- 'worker_spi.c',
- ),
+ test_worker_spi_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_worker_spi
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index fd8ee995b79..963c0f64ed5 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -8,6 +8,12 @@ regress_sources = pg_regress_c + files(
pg_regress_cflags = ['-DHOST_TUPLE="frak"', '-DSHELLPROG="/bin/sh"']
+if host_system == 'windows'
+ regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress',
+ '--FILEDESC', 'pg_regress - test driver',])
+endif
+
pg_regress = executable('pg_regress',
regress_sources,
c_args: pg_regress_cflags,
diff --git a/meson.build b/meson.build
index 6ffae59ba03..4ad06b25213 100644
--- a/meson.build
+++ b/meson.build
@@ -2523,6 +2523,67 @@ gen_export_kwargs = {
+###
+### windows resources related stuff
+###
+
+if host_system == 'windows'
+ pg_ico = meson.source_root() / 'src' / 'port' / 'win32.ico'
+ win32ver_rc = files('src/port/win32ver.rc')
+ rcgen = find_program('src/tools/rcgen', native: true)
+
+ rcgen_base_args = [
+ '--srcdir', '@SOURCE_DIR@',
+ '--builddir', meson.build_root(),
+ '--rcout', '@OUTPUT0@',
+ '--out', '@OUTPUT1@',
+ '--input', '@INPUT@',
+ '@EXTRA_ARGS@',
+ ]
+
+ if cc.get_argument_syntax() == 'msvc'
+ rcgen_base_args += [
+ '--rc', find_program('rc', required: true).path(),
+ ]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.res']
+ else
+ rcgen_base_args += [
+ '--windres', find_program('windres', required: true).path(),
+ ]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.obj']
+ endif
+
+ # msbuild backend doesn't support this atm
+ if meson.backend() == 'ninja'
+ rcgen_base_args += ['--depfile', '@DEPFILE@']
+ endif
+
+ rcgen_bin_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_APP',
+ '--FILEENDING', 'exe',
+ '--ICO', pg_ico
+ ]
+
+ rcgen_lib_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_DLL',
+ '--FILEENDING', 'dll',
+ ]
+
+ rc_bin_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_bin_args,
+ output: rcgen_outputs,
+ )
+
+ rc_lib_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_lib_args,
+ output: rcgen_outputs,
+ )
+endif
+
+
+
# headers that the whole build tree depends on
generated_headers = []
# headers that the backend build depends on
diff --git a/src/timezone/meson.build b/src/timezone/meson.build
index 16f082ecfa8..9e0934c000b 100644
--- a/src/timezone/meson.build
+++ b/src/timezone/meson.build
@@ -28,6 +28,12 @@ if get_option('system_tzdata') == ''
if meson.is_cross_build()
zic = find_program(get_option('ZIC'), native: true, required: true)
else
+ if host_system == 'windows'
+ zic_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'zic',
+ '--FILEDESC', 'zic - time zone compiler',])
+ endif
+
zic = executable('zic', zic_sources,
dependencies: [frontend_code],
kwargs: default_bin_args + {'install': false}
diff --git a/src/tools/rcgen b/src/tools/rcgen
new file mode 100755
index 00000000000..5b62bfe5410
--- /dev/null
+++ b/src/tools/rcgen
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+
+import argparse
+import os
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(description='generate PostgreSQL rc file')
+
+parser.add_argument('--srcdir', type=os.path.abspath,
+ required=True)
+parser.add_argument('--builddir', type=os.path.abspath,
+ required=True)
+
+binaries = parser.add_argument_group('binaries')
+binaries.add_argument('--windres', type=os.path.abspath)
+binaries.add_argument('--rc', type=os.path.abspath)
+
+inout = parser.add_argument_group('inout')
+inout.add_argument('--depfile', type=argparse.FileType('w'))
+inout.add_argument('--input', type=argparse.FileType('r'),
+ required=True)
+inout.add_argument('--rcout', type=argparse.FileType('w'),
+ required=True)
+inout.add_argument('--out', type=str,
+ required=True)
+
+replacements = parser.add_argument_group('replacements')
+replacements.add_argument('--FILEDESC', type=str)
+replacements.add_argument('--NAME', type=str, required=True)
+replacements.add_argument('--VFT_TYPE', type=str, required=True)
+replacements.add_argument('--FILEENDING', type=str, required=True)
+replacements.add_argument('--ICO', type=str)
+
+args = parser.parse_args()
+
+# determine replacement strings
+
+internal_name = '"{0}"'.format(args.NAME)
+original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING)
+
+# if no description is passed in, generate one based on the name
+if args.FILEDESC:
+ filedesc = args.FILEDESC
+elif args.NAME:
+ if args.VFT_TYPE == 'VFT_DLL':
+ filedesc = 'PostgreSQL {0} library'.format(args.NAME)
+ else:
+ filedesc = 'PostgreSQL {0} binary'.format(args.NAME)
+filedesc = '"{0}"'.format(filedesc)
+
+
+if args.ICO:
+ ico = 'IDI_ICON ICON "{0}"'.format(args.ICO)
+ if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO))
+else:
+ ico = ''
+
+
+data = args.input.read()
+
+data = data.replace('VFT_APP', args.VFT_TYPE)
+data = data.replace('_INTERNAL_NAME_', internal_name)
+data = data.replace('_ORIGINAL_NAME_', original_name)
+data = data.replace('FILEDESC', filedesc)
+data = data.replace("_ICO_", ico)
+
+args.rcout.write(data)
+args.rcout.close()
+
+if args.windres:
+ cmd = [
+ args.windres,
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '-o', args.out, '-i', args.rcout.name,
+ ]
+elif args.rc:
+ cmd = [
+ args.rc, '/nologo',
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '/fo', args.out, args.rcout.name,
+ ]
+else:
+ sys.exit('either --windres or --rc needs to be specified')
+
+sp = subprocess.run(cmd)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# It'd be nicer if we could generate correct dependencies here, but 'rc'
+# doesn't support doing so. It's unlikely we'll ever need more, so...
+if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(
+ args.rcout.name, args.input.name))
+ args.depfile.write("{0} : {1}/{2}\n".format(
+ args.out, args.builddir, 'src/include/pg_config.h'))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0006-meson-Add-support-for-relative-rpaths-fixing-tes.patch (7.3K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/7-v15-0006-meson-Add-support-for-relative-rpaths-fixing-tes.patch)
download | inline diff:
From a6d2f96ef0d46374d972fc95714bf71ee8f03f97 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 13:48:46 -0700
Subject: [PATCH v15 06/14] meson: Add support for relative rpaths, fixing
tests on MacOS w/ SIP
---
meson.build | 47 ++++++++--
.../relativize_shared_library_references | 88 +++++++++++++++++++
src/tools/relpath.py | 6 ++
3 files changed, 136 insertions(+), 5 deletions(-)
create mode 100755 src/tools/relativize_shared_library_references
create mode 100755 src/tools/relpath.py
diff --git a/meson.build b/meson.build
index 4ad06b25213..8323adf772b 100644
--- a/meson.build
+++ b/meson.build
@@ -159,6 +159,7 @@ portname = host_system
exesuffix = '' # overridden below where necessary
dlsuffix = '.so' # overridden below where necessary
+rpath_origin = '$ORIGIN'
library_path_var = 'LD_LIBRARY_PATH'
# Format of file to control exports from libraries, and how to pass them to
@@ -209,6 +210,7 @@ elif host_system == 'cygwin'
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
+ rpath_origin = '@loader_path'
export_file_format = 'darwin'
export_fmt = '-exported_symbols_list=@0@'
@@ -241,8 +243,16 @@ elif host_system == 'netbsd'
# LDFLAGS.
ldflags += ['-Wl,-z,now', '-Wl,-z,relro']
+ # netbsd patched their meson in a broken way:
+ # https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=56959
+ # until there's a way out of that, disable rpath_origin
+ rpath_origin = ''
+
elif host_system == 'openbsd'
- # you're ok
+ # openbsd's $ORIGIN doesn't use an absolute path to the binary, but argv[0]
+ # (i.e. absolute when invoked with an absolute name, but e.g. not absolute
+ # when invoked via PATH search).
+ rpath_origin = ''
elif host_system == 'sunos'
portname = 'solaris'
@@ -254,6 +264,7 @@ elif host_system == 'windows'
exesuffix = '.exe'
dlsuffix = '.dll'
library_path_var = ''
+ rpath_origin = ''
export_file_format = 'win'
export_file_suffix = 'def'
@@ -2479,6 +2490,25 @@ if host_system != 'darwin'
mod_install_rpaths += postgres_lib_d
endif
+# If the host can form relative rpaths, use that to make the installation
+# properly relocatable
+if rpath_origin != ''
+ # PG binaries might need to link to libpq, use relative path to reference
+ bin_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_bin, dir_lib, check: true).stdout().strip()
+ bin_install_rpaths += rpath_origin / bin_to_lib
+
+ # PG extensions might need to link to libpq, use relative path to reference
+ # (often just .)
+ mod_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_lib_pkg, dir_lib, check: true).stdout().strip()
+ mod_install_rpaths += rpath_origin / mod_to_lib
+
+ test_use_library_path_var = false
+else
+ test_use_library_path_var = true
+endif
+
# Define arguments for default targets
@@ -2771,6 +2801,14 @@ above, or by running configure and then make maintainer-clean.
endif
+# To make MacOS installation work without a prior make install, even with SIP
+# enabled, make rpaths relative after installation. This also makes the
+# installation relocatable.
+if host_system == 'darwin'
+ meson.add_install_script('src/tools/relativize_shared_library_references')
+endif
+
+
###############################################################
# Test prep
@@ -2836,10 +2874,9 @@ test_env.set('REGRESS_SHLIB', regress_module.full_path())
# Export PG_TEST_EXTRA so it can be checked in individual tap tests.
test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA'))
-# Add the temporary installation to the library search path on platforms where
-# that works (everything but windows, basically). On windows everything
-# library-like gets installed into bindir, solving that issue.
-if library_path_var != ''
+# On platforms without $ORIGIN support we need to add the temporary
+# installation to the library search path.
+if test_use_library_path_var and library_path_var != ''
test_env.prepend(library_path_var, test_install_location / get_option('libdir'))
endif
diff --git a/src/tools/relativize_shared_library_references b/src/tools/relativize_shared_library_references
new file mode 100755
index 00000000000..280bd48fd32
--- /dev/null
+++ b/src/tools/relativize_shared_library_references
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+# -*-python-*-
+
+# This script updates a macos postgres installation to reference all internal
+# shared libraries using rpaths, leaving absolute install_names in the
+# libraries themselves intact.
+
+import os
+import sys
+import json
+import subprocess
+import shutil
+
+
+def installed_path(destdir, path):
+ if destdir is not None:
+ return f'{destdir}{path}'
+ else:
+ return path
+
+
+def collect_information():
+ shared_libraries = []
+ executables = []
+ shared_modules = []
+
+ meson_info_p = os.path.join(build_root, 'meson-info')
+ targets = json.load(
+ open(os.path.join(meson_info_p, 'intro-targets.json')))
+ installed = json.load(
+ open(os.path.join(meson_info_p, 'intro-installed.json')))
+
+ for target in targets:
+ if not target['installed']:
+ continue
+
+ filenames = target['filename']
+
+ if target['type'] == 'shared library':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+
+ shared_libraries.append(installed[filename])
+
+ if target['type'] == 'executable':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ executables.append(installed[filename])
+
+ if target['type'] == 'shared module':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ shared_modules.append(installed[filename])
+
+ return shared_libraries, executables, shared_modules
+
+
+def patch_references(destdir, shared_libraries, executables, shared_modules):
+ install_name_tool = [shutil.which('install_name_tool')]
+
+ for lib in shared_libraries:
+ libname = os.path.basename(lib)
+ libpath = installed_path(destdir, lib)
+ newref = f'@rpath/{libname}'
+
+ for patch in shared_modules + executables:
+ patchpath = installed_path(destdir, patch)
+
+ # print(f'in {patchpath} replace reference to {libpath} with {newref}')
+ if not os.path.exists(patchpath):
+ print(f"path {patchpath} doesn't exist", file=sys.stderr)
+ sys.exit(1)
+
+ cmd = install_name_tool + ['-change', lib, newref, patchpath]
+ subprocess.check_call(cmd)
+
+
+if __name__ == '__main__':
+ build_root = os.environ['MESON_BUILD_ROOT']
+ destdir = os.environ.get('DESTDIR', None)
+
+ print(f'making references to shared libraries relative, destdir is {destdir}',
+ file=sys.stderr)
+
+ shared_libraries, executables, shared_modules = collect_information()
+ patch_references(destdir, shared_libraries, executables, shared_modules)
+
+ sys.exit(0)
diff --git a/src/tools/relpath.py b/src/tools/relpath.py
new file mode 100755
index 00000000000..87bcb496ab5
--- /dev/null
+++ b/src/tools/relpath.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+print(os.path.relpath(sys.argv[2], start=sys.argv[1]))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0007-meson-Add-docs-for-building-with-meson.patch (77.6K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/8-v15-0007-meson-Add-docs-for-building-with-meson.patch)
download | inline diff:
From 7e1b6e3396986236d03c83685d2728795c2a0560 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:55:20 -0700
Subject: [PATCH v15 07/14] meson: Add docs for building with meson
Author: Samay Sharma <smilingsamay@gmail.com>
---
doc/src/sgml/installation.sgml | 1841 ++++++++++++++++++++++++++++++--
doc/src/sgml/monitoring.sgml | 2 +-
doc/src/sgml/runtime.sgml | 2 +-
doc/src/sgml/sourcerepo.sgml | 5 +-
4 files changed, 1743 insertions(+), 107 deletions(-)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 319c7e69660..3d4018badd3 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -31,7 +31,144 @@ documentation. See standalone-profile.xsl for details.
C++</productname>, see <xref linkend="install-windows"/> instead.
</para>
- <sect1 id="install-short">
+ <sect1 id="supported-platforms">
+ <title>Supported Platforms</title>
+
+ <para>
+ A platform (that is, a CPU architecture and operating system combination)
+ is considered supported by the <productname>PostgreSQL</productname> development
+ community if the code contains provisions to work on that platform and
+ it has recently been verified to build and pass its regression tests
+ on that platform. Currently, most testing of platform compatibility
+ is done automatically by test machines in the
+ <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
+ If you are interested in using <productname>PostgreSQL</productname> on a platform
+ that is not represented in the build farm, but on which the code works
+ or can be made to work, you are strongly encouraged to set up a build
+ farm member machine so that continued compatibility can be assured.
+ </para>
+
+ <para>
+ In general, <productname>PostgreSQL</productname> can be expected to work on
+ these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
+ and PA-RISC, including
+ big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
+ It is often
+ possible to build on an unsupported CPU type by configuring with
+ <option>--disable-spinlocks</option>, but performance will be poor.
+ </para>
+
+ <para>
+ <productname>PostgreSQL</productname> can be expected to work on current
+ versions of these operating systems: Linux, Windows,
+ FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
+ Other Unix-like systems may also work but are not currently
+ being tested. In most cases, all CPU architectures supported by
+ a given operating system will work. Look in
+ <xref linkend="installation-platform-notes"/> below to see if
+ there is information
+ specific to your operating system, particularly if using an older system.
+ </para>
+
+ <para>
+ If you have installation problems on a platform that is known
+ to be supported according to recent build farm results, please report
+ it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
+ in porting <productname>PostgreSQL</productname> to a new platform,
+ <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
+ to discuss that.
+ </para>
+
+ <para>
+ Historical versions of <productname>PostgreSQL</productname> or POSTGRES
+ also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
+ M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
+ BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
+ Tru64 UNIX, and ULTRIX.
+ </para>
+ </sect1>
+
+ <sect1 id="get-source">
+ <title>Getting the Source</title>
+
+ <para>
+ You can download the source code in two ways - via git or the source code
+ tarballs.
+ </para>
+
+ <sect2 id="get-source-git">
+ <title>Getting the Source via <productname>Git</productname></title>
+ <para>
+ With <productname>Git</productname>, you can make a copy of the entire code repository
+ on your local machine, so you will have access to all history and branches
+ offline. This is the fastest and most flexible way to develop or test
+ patches.
+ </para>
+
+ <procedure>
+ <step>
+ <para>
+ To begin using the Git repository, make a clone of the official mirror:
+
+<programlisting>
+git clone https://git.postgresql.org/git/postgresql.git
+</programlisting>
+
+ This will copy the full repository to your local machine, so it may take
+ a while to complete, especially if you have a slow Internet connection.
+ The files will be placed in a new subdirectory <filename>postgresql</filename> of
+ your current directory.
+ </para>
+
+ </step>
+
+ <step>
+ <para>
+ Whenever you want to get the latest updates in the system, <command>cd</command>
+ into the repository, and run:
+
+<programlisting>
+git pull
+</programlisting>
+ </para>
+ </step>
+ </procedure>
+
+ <para>
+ <productname>Git</productname> can do a lot more things than just fetch the source.
+ Our wiki, <ulink
+ url="https://wiki.postgresql.org/wiki/Working_with_Git"></ulink>,
+ has some discussion on working with Git. For more information, consult the
+ <productname>Git</productname> man pages, or see the website at
+ <ulink url="https://git-scm.com"></ulink>.
+ </para>
+ </sect2>
+ <sect2 id="get-source-tarball">
+ <title>Getting the Source via Tarballs</title>
+
+ <para>
+ The <productname>PostgreSQL</productname> source code for released versions
+ can also be obtained from the download section of our website:
+ <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
+ Download the
+ <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
+ or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
+ file you're interested in, then unpack it:
+<screen>
+<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
+</screen>
+ This will create a directory
+ <filename>postgresql-<replaceable>version</replaceable></filename> under
+ the current directory with the <productname>PostgreSQL</productname> sources.
+ Change into that directory for the rest of the installation procedure.
+ </para>
+ </sect2>
+ </sect1>
+
+<sect1 id="install-make">
+ <title>Building and Installation with autoconf and make</title>
+
+ <sect2 id="install-short-make">
<title>Short Version</title>
<para>
@@ -50,12 +187,12 @@ su - postgres
/usr/local/pgsql/bin/psql test
</synopsis>
The long version is the rest of this
- <phrase>chapter</phrase>.
+ <phrase>section</phrase>.
</para>
- </sect1>
+ </sect2>
- <sect1 id="install-requirements">
+ <sect2 id="install-requirements-make">
<title>Requirements</title>
<para>
@@ -343,45 +480,9 @@ su - postgres
url="ftp://ftp.gnu.org/gnu/"></ulink>.
</para>
- <para>
- Also check that you have sufficient disk space. You will need about
- 350 MB for the source tree during compilation and about 60 MB for
- the installation directory. An empty database cluster takes about
- 40 MB; databases take about five times the amount of space that a
- flat text file with the same data would take. If you are going to
- run the regression tests you will temporarily need up to an extra
- 300 MB. Use the <command>df</command> command to check free disk
- space.
- </para>
- </sect1>
+ </sect2>
- <sect1 id="install-getsource">
- <title>Getting the Source</title>
-
- <para>
- The <productname>PostgreSQL</productname> source code for released versions
- can be obtained from the download section of our website:
- <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
- Download the
- <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
- or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
- file you're interested in, then unpack it:
-<screen>
-<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
-</screen>
- This will create a directory
- <filename>postgresql-<replaceable>version</replaceable></filename> under
- the current directory with the <productname>PostgreSQL</productname> sources.
- Change into that directory for the rest of the installation procedure.
- </para>
-
- <para>
- Alternatively, you can use the Git version control system; see
- <xref linkend="git"/> for more information.
- </para>
- </sect1>
-
- <sect1 id="install-procedure">
+ <sect2 id="install-procedure-make">
<title>Installation Procedure</title>
<procedure>
@@ -630,6 +731,7 @@ build-postgresql:
rebuilding. Without this, your changes in configuration choices
might not propagate everywhere they need to.
</para>
+ </sect2>
<sect2 id="configure-options">
<title><filename>configure</filename> Options</title>
@@ -844,7 +946,7 @@ build-postgresql:
various <productname>PostgreSQL</productname> features that are not
built by default. Most of these are non-default only because they
require additional software, as described in
- <xref linkend="install-requirements"/>.
+ <xref linkend="install-requirements-make"/>.
</para>
<variablelist>
@@ -1672,9 +1774,7 @@ build-postgresql:
</sect3>
- </sect2>
-
- <sect2 id="configure-envvars">
+ <sect3 id="configure-envvars">
<title><filename>configure</filename> Environment Variables</title>
<indexterm zone="configure-envvars">
@@ -1955,9 +2055,1600 @@ build-postgresql:
adjustments, while <envar>COPT</envar> might be kept set all the time.
</para>
</note>
+ </sect3>
</sect2>
</sect1>
+ <sect1 id="install-meson">
+ <title>Building and Installation with meson</title>
+
+ <sect2 id="install-short-meson">
+ <title>Short Version</title>
+
+ <para>
+<synopsis>
+
+# create working directory
+mkdir postgres
+cd postgres
+
+# fetch source code
+# git clone https://git.postgresql.org/git/postgresql.git src
+
+# current instructions for testing (to be removed when merging)
+git clone -b meson https://github.com/anarazel/postgres.git src
+
+# setup and enter build directory (done only first time)
+meson setup build src --prefix=$PWD/install
+cd build
+
+# Compile source
+ninja
+
+# Install to the prefix directory specified above
+ninja install
+
+# Run all tests (optional, takes time)
+meson test
+
+# Initialize a new database
+../install/bin/initdb -D ../data
+
+# Start database
+../install/bin/pg_ctl -D ../data/ -l logfile start
+
+# Connect to the database
+../install/bin/psql -d postgres
+
+</synopsis>
+ The long version is the rest of this
+ <phrase>section</phrase>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-requirements-meson">
+ <title>Requirements</title>
+
+ <para>
+ In general, a modern Unix-compatible platform or Windows should be able
+ to build <productname>PostgreSQL</productname> with meson and run it.
+ The platforms which have received specific testing at the time of release are:
+
+ <itemizedlist spacing="compact">
+ <listitem><simpara>Linux</simpara></listitem>
+ <listitem><simpara>Windows</simpara></listitem>
+ <listitem><simpara>OpenBSD</simpara></listitem>
+ <listitem><simpara>NetBSD</simpara></listitem>
+ <listitem><simpara>FreeBSD</simpara></listitem>
+ <listitem><simpara>macOS</simpara></listitem>
+ </itemizedlist>
+ </para>
+
+ <sect3 id="required-packages">
+ <title>Required packages</title>
+
+ <para>
+ The following software packages are required for building
+ <productname>PostgreSQL</productname>:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can download the source code in two ways - via git or by downloading
+ the source code tarballs. For the former, you will need an installed version of
+ <productname>Git</productname>, which you can get from
+ <ulink url="https://git-scm.com"></ulink>. Many systems already
+ have a recent version of <productname>Git</productname>
+ installed by default, or available in their package distribution system.
+ If you download the source code tarballs, you will need
+ <application>tar</application> in addition to
+ <application>gzip</application> or <application>bzip2</application>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>meson</primary>
+ </indexterm>
+ You need to install <application>
+ <ulink url="https://mesonbuild.com/">meson</ulink></application> version
+ 0.54 or later to be able to build <productname>PostgreSQL</productname>
+ with it. If your operating system provides a package manager, you can install
+ <application>meson</application> with that. If not, you
+ can download a <ulink url="https://github.com/mesonbuild/meson">meson release</ulink>
+ from github and run <literal>./meson.py</literal> from the git repository
+ itself. Lastly, Meson is also available in the python package index and can
+ be installed with <literal>pip</literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ You need an <acronym>ISO</acronym>/<acronym>ANSI</acronym> C compiler (at least
+ C99-compliant). Recent
+ versions of <productname>GCC</productname> are recommended, but
+ <productname>PostgreSQL</productname> is known to build using a wide variety
+ of compilers from different vendors.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>flex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>lex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>bison</primary>
+ </indexterm>
+ <indexterm>
+ <primary>yacc</primary>
+ </indexterm>
+
+ <application>Flex</application> and <application>Bison</application>
+ are needed to build <productname>PostgreSQL</productname> using
+ <application>meson</application>. Be sure to get
+ <application>Flex</application> 2.5.31 or later and
+ <application>Bison</application> 1.875 or later from your package manager.
+ Other <application>lex</application> and <application>yacc</application>
+ programs cannot be used.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>perl</primary>
+ </indexterm>
+ <application>Perl</application> 5.8.3 or later is needed to build PostgreSQL
+ using <application>meson</application> and to run some test suites.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="recommended-packages">
+ <title>Recommended packages</title>
+
+ <para>
+ The following packages are not required to build
+ <application>PostgreSQL</application> but are strongly recommended:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>readline</primary>
+ </indexterm>
+ <indexterm>
+ <primary>libedit</primary>
+ </indexterm>
+
+ The <acronym>GNU</acronym> <productname>Readline</productname> library
+ allows <application>psql</application> (the PostgreSQL command line
+ SQL interpreter) to remember each command you type, and allows you to
+ use arrow keys to recall and edit previous commands. This is very
+ helpful and is strongly recommended. As an alternative, you can often
+ use the BSD-licensed <filename>libedit</filename> library, originally
+ developed on <productname>NetBSD</productname>. The
+ <filename>libedit</filename> library is GNU
+ <productname>Readline</productname>-compatible and is used if
+ <filename>libreadline</filename> is not found, or if
+ <option>libedit_preferred</option> is enabled as an
+ option to <filename>meson configure</filename>. If you are using a
+ package-based Linux distribution, be aware that you need both the
+ <literal>readline</literal> and <literal>readline-devel</literal> packages, if
+ those are separate in your distribution.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+
+ The <productname>zlib</productname> compression library is
+ used to provide support for compressed archives in
+ <application>pg_dump</application> and
+ <application>pg_restore</application> and is recommended.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Various tests, particularly the client program tests under
+ <filename>src/bin</filename>, use the Perl TAP tools. Running
+ these tests is recommended for development. These TAP tests
+ require the Perl module <literal>IPC::Run</literal> which is
+ available from CPAN or an operating system package.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="optional-packages">
+ <title>Optional packages</title>
+
+ <para>
+ The following packages are optional. They are not required in the
+ default configuration, but they are needed when certain build
+ options are enabled, as explained below:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You need <productname>OpenSSL</productname>, if you want to support
+ encrypted client connections. <productname>OpenSSL</productname> is
+ also required for random number generation on platforms that do not
+ have <filename>/dev/urandom</filename> (except Windows). The minimum
+ required version is 1.0.1.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>LZ4</productname>, if you want to support
+ compression of data with that method; see
+ <xref linkend="guc-default-toast-compression"/> and
+ <xref linkend="guc-wal-compression"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>Zstandard</productname>, if you want to support
+ compression of data or backups with that method; see
+ <xref linkend="guc-wal-compression"/>.
+ The minimum required version is 1.4.0.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <application>Kerberos</application>, <productname>OpenLDAP</productname>,
+ and/or <application>PAM</application>, if you want to support authentication
+ using those services.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the server programming language
+ <application>PL/Perl</application> you need a full
+ <productname>Perl</productname> installation, including the
+ <filename>libperl</filename> library and the header files.
+ The minimum required version is <productname>Perl</productname> 5.8.3.
+ Since <application>PL/Perl</application> will be a shared
+ library, the <indexterm><primary>libperl</primary></indexterm>
+ <filename>libperl</filename> library must be a shared library
+ also on most platforms. This appears to be the default in
+ recent <productname>Perl</productname> versions, but it was not
+ in earlier versions, and in any case it is the choice of whomever
+ installed Perl at your site. <filename>configure</filename> will fail
+ if building <application>PL/Perl</application> is selected but it cannot
+ find a shared <filename>libperl</filename>. In that case, you will have
+ to rebuild and install <productname>Perl</productname> manually to be
+ able to build <application>PL/Perl</application>. During the
+ configuration process for <productname>Perl</productname>, request a
+ shared library.
+ </para>
+
+ <para>
+ If you intend to make more than incidental use of
+ <application>PL/Perl</application>, you should ensure that the
+ <productname>Perl</productname> installation was built with the
+ <literal>usemultiplicity</literal> option enabled (<literal>perl -V</literal>
+ will show whether this is the case).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Python</application> server programming
+ language, you need a <productname>Python</productname>
+ installation with the header files and
+ the <application>sysconfig</application> module. The minimum
+ required version is <productname>Python</productname> 3.2.
+ </para>
+
+ <para>
+ Since <application>PL/Python</application> will be a shared
+ library, the <indexterm><primary>libpython</primary></indexterm>
+ <filename>libpython</filename> library must be a shared library
+ also on most platforms. This is not the case in a default
+ <productname>Python</productname> installation built from source, but a
+ shared library is available in many operating system
+ distributions. <filename>configure</filename> will fail if
+ building <application>PL/Python</application> is selected but it cannot
+ find a shared <filename>libpython</filename>. That might mean that you
+ either have to install additional packages or rebuild (part of) your
+ <productname>Python</productname> installation to provide this shared
+ library. When building from source, run <productname>Python</productname>'s
+ configure with the <literal>--enable-shared</literal> flag.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Tcl</application>
+ procedural language, you of course need a <productname>Tcl</productname>
+ installation. The minimum required version is
+ <productname>Tcl</productname> 8.4.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To enable Native Language Support (<acronym>NLS</acronym>), that
+ is, the ability to display a program's messages in a language
+ other than English, you need an implementation of the
+ <application>Gettext</application> <acronym>API</acronym>. Some operating
+ systems have this built-in (e.g., <systemitem
+ class="osname">Linux</systemitem>, <systemitem class="osname">NetBSD</systemitem>,
+ <systemitem class="osname">Solaris</systemitem>), for other systems you
+ can download an add-on package from <ulink
+ url="https://www.gnu.org/software/gettext/"></ulink>.
+ If you are using the <application>Gettext</application> implementation in
+ the <acronym>GNU</acronym> C library then you will additionally
+ need the <productname>GNU Gettext</productname> package for some
+ utility programs. For any of the other implementations you will
+ not need it.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <productname>PostgreSQL</productname> documentation,
+ there is a separate set of requirements; see
+ <xref linkend="docguide-toolsets"/>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="configure-meson">
+ <title>Configuring the build</title>
+
+ <para>
+ The first step of the installation procedure is to configure the
+ source tree for your system and choose the options you would like. To
+ create and configure the build directory, you can start with the
+ <literal>meson setup</literal> command.
+ </para>
+
+<screen>
+<userinput>meson setup build</userinput>
+</screen>
+
+ <para>
+ The setup command takes a <literal>builddir</literal> and a <literal>srcdir</literal>
+ argument. If no <literal>srcdir</literal> is given Meson will deduce the
+ <literal>srcdir</literal> based on the current directory and the location
+ of <literal>meson.build</literal>. The <literal>builddir</literal> is mandatory.
+ </para>
+
+ <para>
+ Meson then loads the build configuration file and sets up the build directory.
+ Additionally, the invocation can pass options to Meson. The list of commonly
+ used options is in subsequent sections. A few examples of specifying different
+ build options are:
+
+<screen>
+#Setup build directory with a different installation prefix
+meson setup build --prefix=/home/user/pg-install
+
+#Setup build directory to generate a debug build
+meson setup build --buildtype=debug
+
+#Setup build directory with ssl (Use -D for project specific options)
+meson setup build -Dssl=openssl
+</screen>
+
+ Setting up the build directory is a one-time step. To reconfigure before a
+ new build, you can simply use the <literal>meson configure</literal> command
+ </para>
+
+<para>
+<screen>
+meson configure -Dcassert=true
+</screen>
+</para>
+
+<para>
+ <command>meson configure</command>'s commonly used command line options
+ are explained below. This list is not exhaustive (use
+ <literal>meson configure --help</literal> to get one that is).
+ The options not covered here are meant for advanced use-cases, and are
+ documented in the standard meson
+ <ulink url="https://mesonbuild.com/Commands.html#configure">documentation</ulink>.
+ These arguments can be used with <command>meson setup</command> as well.
+</para>
+
+ <sect3 id="configure-install-locations">
+ <title>Installation Locations</title>
+
+ <para>
+ These options control where <literal>ninja install (or meson install)</literal> will put
+ the files. The <option>--prefix</option> option is sufficient for
+ most cases. If you have special needs, you can customize the
+ installation subdirectories with the other options described in this
+ section. Beware however that changing the relative locations of the
+ different subdirectories may render the installation non-relocatable,
+ meaning you won't be able to move it after installation.
+ (The <literal>man</literal> and <literal>doc</literal> locations are
+ not affected by this restriction.)
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
+ <listitem>
+ <para>
+ Install all files under the directory <replaceable>PREFIX</replaceable>
+ instead of <filename>/usr/local/pgsql</filename>. The actual
+ files will be installed into various subdirectories; no files
+ will ever be installed directly into the
+ <replaceable>PREFIX</replaceable> directory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the directory for executable programs. The default
+ is <filename><replaceable>PREFIX</replaceable>/bin</filename>, which
+ normally means <filename>/usr/local/pgsql/bin</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for various configuration files,
+ <filename><replaceable>PREFIX</replaceable>/etc</filename> by default.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <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>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing C and C++ header files. The
+ default is <filename><replaceable>PREFIX</replaceable>/include</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for read-only data files used by the
+ installed programs. The default is
+ <filename><replaceable>PREFIX</replaceable>/share</filename>. Note that this has
+ nothing to do with where your database files will be placed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing locale data, in particular
+ message translation catalog files. The default is
+ <filename><replaceable>DATADIR</replaceable>/locale</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ The man pages that come with <productname>PostgreSQL</productname> will be installed under
+ this directory, in their respective
+ <filename>man<replaceable>x</replaceable></filename> subdirectories.
+ The default is <filename><replaceable>DATADIR</replaceable>/man</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <note>
+ <para>
+ Care has been taken to make it possible to install
+ <productname>PostgreSQL</productname> into shared installation locations
+ (such as <filename>/usr/local/include</filename>) without
+ interfering with the namespace of the rest of the system. First,
+ the string <quote><literal>/postgresql</literal></quote> is
+ automatically appended to <varname>datadir</varname>,
+ <varname>sysconfdir</varname>, and <varname>docdir</varname>,
+ unless the fully expanded directory name already contains the
+ string <quote><literal>postgres</literal></quote> or
+ <quote><literal>pgsql</literal></quote>. For example, if you choose
+ <filename>/usr/local</filename> as prefix, the documentation will
+ be installed in <filename>/usr/local/doc/postgresql</filename>,
+ but if the prefix is <filename>/opt/postgres</filename>, then it
+ will be in <filename>/opt/postgres/doc</filename>. The public C
+ header files of the client interfaces are installed into
+ <varname>includedir</varname> and are namespace-clean. The
+ internal header files and the server header files are installed
+ into private directories under <varname>includedir</varname>. See
+ the documentation of each interface for information about how to
+ access its header files. Finally, a private subdirectory will
+ also be created, if appropriate, under <varname>libdir</varname>
+ for dynamically loadable modules.
+ </para>
+ </note>
+ </sect3>
+
+ <sect3 id="configure-pg-features">
+ <title><productname>PostgreSQL</productname> Features</title>
+
+ <para>
+ The options described in this section enable building of
+ various <productname>PostgreSQL</productname> features that are not
+ built by default. Most of these are non-default only because they
+ require additional software, as described in
+ <xref linkend="install-requirements-meson"/>. To specify PostgreSQL
+ specific options, the name of the option should be prefixed by -D.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dnls=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Enables or disables Native Language Support (<acronym>NLS</acronym>),
+ that is, the ability to display a program's messages in a
+ language other than English. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To use this option, you will need an implementation of the
+ <application>Gettext</application> API.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplperl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Perl</application> server-side language. It
+ defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplpython=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Python</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpltcl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Tcl</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtcl_version=<replaceable>TCL_VERSION</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the TCL version to use when building PL/Tcl.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dicu=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for
+ the <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
+ library, enabling use of ICU collation
+ features<phrase condition="standalone-ignore"> (see
+ <xref linkend="collation"/>)</phrase>.
+ This requires the <productname>ICU4C</productname> package
+ to be installed. The minimum required version
+ of <productname>ICU4C</productname> is currently 4.2.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+
+ <para>
+ By default,
+ <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm>
+ will be used to find the required compilation options. This is
+ supported for <productname>ICU4C</productname> version 4.6 and later.
+ <!-- Add description for older ICU4C versions and when pkg-config isn't available-->
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-with-llvm-meson">
+ <term><option>-Dllvm=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for <productname>LLVM</productname> based
+ <acronym>JIT</acronym> compilation<phrase
+ condition="standalone-ignore"> (see <xref
+ linkend="jit"/>)</phrase>. This
+ requires the <productname>LLVM</productname> library to be installed.
+ The minimum required version of <productname>LLVM</productname> is
+ currently 3.9. It is set to disabled by default.
+ </para>
+ <para>
+ <command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm>
+ will be used to find the required compilation options.
+ <command>llvm-config</command>, and then
+ <command>llvm-config-$major-$minor</command> for all supported
+ versions, will be searched for in your <envar>PATH</envar>.
+ <!--Add substitute for LLVM_CONFIG when llvm-config is not in PATH-->
+ </para>
+
+ <para>
+ <productname>LLVM</productname> support requires a compatible
+ <command>clang</command> compiler (specified, if necessary, using the
+ <envar>CLANG</envar> environment variable), and a working C++
+ compiler (specified, if necessary, using the <envar>CXX</envar>
+ environment variable).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlz4=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>LZ4</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzstd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>Zstandard</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option>
+ <indexterm>
+ <primary>OpenSSL</primary>
+ <seealso>SSL</seealso>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Build with support for <acronym>SSL</acronym> (encrypted)
+ connections. The only <replaceable>LIBRARY</replaceable>
+ supported is <option>openssl</option>. This requires the
+ <productname>OpenSSL</productname> package to be installed.
+ <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenSSL</productname> installation is sufficient
+ before proceeding. The default for this option is none.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dgssapi=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for GSSAPI authentication. On many systems, the
+ GSSAPI system (usually a part of the Kerberos installation) is not
+ installed in a location
+ that is searched by default (e.g., <filename>/usr/include</filename>,
+ <filename>/usr/lib</filename>), so you must use the options
+ <option>-Dextra_include_dirs</option> and <option>-Dextra_lib_dirs</option> in
+ addition to this option. <filename>meson configure</filename> will check
+ for the required header files and libraries to make sure that
+ your GSSAPI installation is sufficient before proceeding.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dldap=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>LDAP</acronym><indexterm><primary>LDAP</primary></indexterm>
+ support for authentication and connection parameter lookup (see
+ <phrase id="install-ldap-links-meson"><xref linkend="libpq-ldap"/> and
+ <xref linkend="auth-ldap"/></phrase> for more information). On Unix,
+ this requires the <productname>OpenLDAP</productname> package to be
+ installed. On Windows, the default <productname>WinLDAP</productname>
+ library is used. <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenLDAP</productname> installation is sufficient before
+ proceeding. It defaults to auto, meaning that it will be enabled automatically
+ if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpam=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>PAM</acronym><indexterm><primary>PAM</primary></indexterm>
+ (Pluggable Authentication Modules) support. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbsd_auth=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with BSD Authentication support. (The BSD Authentication framework is
+ currently only available on OpenBSD.) It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystemd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support
+ for <application>systemd</application><indexterm><primary>systemd</primary></indexterm>
+ service notifications. This improves integration if the server
+ is started under <application>systemd</application> but has no impact
+ otherwise<phrase condition="standalone-ignore">; see <xref linkend="server-start"/> for more
+ information</phrase>. <application>libsystemd</application> and the
+ associated header files need to be installed to use this option.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbonjour=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for Bonjour automatic service discovery.
+ This requires Bonjour support in your operating system.
+ Recommended on macOS. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <xref linkend="uuid-ossp"/> module
+ (which provides functions to generate UUIDs), using the specified
+ UUID library.<indexterm><primary>UUID</primary></indexterm>
+ <replaceable>LIBRARY</replaceable> must be one of:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <option>none</option> to not build the ussp module. This is the default.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>bsd</option> to use the UUID functions found in FreeBSD, NetBSD,
+ and some other BSD-derived systems
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>e2fs</option> to use the UUID library created by
+ the <literal>e2fsprogs</literal> project; this library is present in most
+ Linux systems and in macOS, and can be obtained for other
+ platforms as well
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>ossp</option> to use the <ulink
+ url="http://www.ossp.org/pkg/lib/uuid/">OSSP UUID library</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxml=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxml2, enabling SQL/XML support. Libxml2 version 2.6.23 or
+ later is required for this feature. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To detect the required compiler and linker options, PostgreSQL will
+ query <command>pkg-config</command>, if that is installed and knows
+ about libxml2. Otherwise the program <command>xml2-config</command>,
+ which is installed by libxml2, will be used if it is found. Use
+ of <command>pkg-config</command> is preferred, because it can deal
+ with multi-architecture installations better.
+ </para>
+
+ <para>
+ To use a libxml2 installation that is in an unusual location, you
+ can set <command>pkg-config</command>-related environment
+ variables (see its documentation).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxslt=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxslt, enabling the
+ <xref linkend="xml2"/>
+ module to perform XSL transformations of XML.
+ <option>-Dlibxml</option> must be specified as well.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dreadline=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Allows use of the <application>Readline</application> library
+ (and <application>libedit</application> as well). This option enables
+ command-line editing and history in
+ <application>psql</application> and is strongly recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibedit_preferred=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this to true favors the use of the BSD-licensed <application>libedit</application> library
+ rather than GPL-licensed <application>Readline</application>. This option
+ is significant only if you have both libraries installed; the
+ default is false that is to use <application>Readline</application>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzlib=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+ Enabls use of the <application>Zlib</application> library.
+ This enables
+ support for compressed archives in <application>pg_dump</application>
+ and <application>pg_restore</application> and is recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dspinlocks=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true by default and
+ setting it to false will allow the build to succeed even if <productname>PostgreSQL</productname>
+ has no CPU spinlock support for the platform. The lack of
+ spinlock support will result in very poor performance; therefore,
+ this option should only be changed if the build aborts and
+ informs you that the platform lacks spinlock support. If setting this
+ option to false is required to build <productname>PostgreSQL</productname> on
+ your platform, please report the problem to the
+ <productname>PostgreSQL</productname> developers.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Datomics=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true and setting it to false will
+ disable use of CPU atomic operations. The option does nothing on
+ platforms that lack such operations. On platforms that do have
+ them, disabling atomics will result in poor performance. Changing
+ this option is only useful for debugging or making performance comparisons.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-build-process">
+ <title>Build Process Details</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>--auto_features=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this option allows you to override value of all 'auto' features.
+ This can be useful when you want to disable or enable all the "optional"
+ features at once without having to set each of them manually. The default
+ value for this parameter is auto.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--backend=<replaceable>BACKEND</replaceable></option></term>
+ <listitem>
+ <para>
+ The default backend meson uses is ninja and that should suffice for most use cases.
+ However, if you'd like to fully integrate with visual studio, you can set the
+ BACKEND to <command>vs</command>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C compiler.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_link_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C linker.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_include_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories that will be added to the list the compiler
+ searches for header files. If you have optional packages
+ (such as GNU <application>Readline</application>) installed in a non-standard
+ location,
+ you have to use this option and probably also the corresponding
+ <option>-Dextra_lib_dirs</option> option.
+ </para>
+ <para>
+ Example: <literal>-Dextra_include_dirs=/opt/gnu/include:/usr/sup/include</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_lib_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories to search for libraries. You will probably have
+ to use this option (and the corresponding
+ <option>-Dextra_include_dirs</option> option) if you have packages
+ installed in non-standard locations.
+ </para>
+ <para>
+ Example: <literal>-Dextra_lib_dirs=/opt/gnu/lib:/usr/sup/lib</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystem_tzdata=<replaceable>DIRECTORY</replaceable></option>
+ <indexterm>
+ <primary>time zone data</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ <productname>PostgreSQL</productname> includes its own time zone database,
+ which it requires for date and time operations. This time zone
+ database is in fact compatible with the IANA time zone
+ database provided by many operating systems such as FreeBSD,
+ Linux, and Solaris, so it would be redundant to install it again.
+ When this option is used, the system-supplied time zone database
+ in <replaceable>DIRECTORY</replaceable> is used instead of the one
+ included in the PostgreSQL source distribution.
+ <replaceable>DIRECTORY</replaceable> must be specified as an
+ absolute path. <filename>/usr/share/zoneinfo</filename> is a
+ likely directory on some operating systems. Note that the
+ installation routine will not detect mismatching or erroneous time
+ zone data. If you use this option, you are advised to run the
+ regression tests to verify that the time zone data you have
+ pointed to works correctly with <productname>PostgreSQL</productname>.
+ </para>
+
+ <indexterm><primary>cross compilation</primary></indexterm>
+
+ <para>
+ This option is mainly aimed at binary package distributors
+ who know their target operating system well. The main
+ advantage of using this option is that the PostgreSQL package
+ won't need to be upgraded whenever any of the many local
+ daylight-saving time rules change. Another advantage is that
+ PostgreSQL can be cross-compiled more straightforwardly if the
+ time zone database files do not need to be built during the
+ installation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term>
+ <listitem>
+ <para>
+ Append <replaceable>STRING</replaceable> to the PostgreSQL version number. You
+ can use this, for example, to mark binaries built from unreleased Git
+ snapshots or containing custom patches with an extra version string,
+ such as a <command>git describe</command> identifier or a
+ distribution package release number.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
+ <listitem>
+ <para>
+ If you have the binaries for certain by programs required to build
+ Postgres (with or without optional flags) stored at non-standard
+ paths, you could specify them manually to meson configure. The complete
+ list of programs for whom this is supported can be found by running
+ <literal>meson configure</literal>. An example is included below.
+<programlisting>meson configure -DBISON=PATH_TO_BISON</programlisting>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-layout">
+ <title>Data layout</title>
+
+ <para>
+ These options affect how PostgreSQL lays out data on disk.
+ Note that changing these breaks on-disk database compatibility,
+ meaning you cannot use <command>pg_upgrade</command> to upgrade to
+ a build with a different value of these options.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>segment size</firstterm>, in gigabytes. Large tables are
+ divided into multiple operating-system files, each of size equal
+ to the segment size. This avoids problems with file size limits
+ that exist on many platforms. The default segment size, 1 gigabyte,
+ is safe on all supported platforms. If your operating system has
+ <quote>largefile</quote> support (which most do, nowadays), you can use
+ a larger segment size. This can be helpful to reduce the number of
+ file descriptors consumed when working with very large tables.
+ But be careful not to select a value larger than is supported
+ by your platform and the file systems you intend to use. Other
+ tools you might wish to use, such as <application>tar</application>, could
+ also set limits on the usable file size.
+ It is recommended, though not absolutely required, that this value
+ be a power of 2.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within tables. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 32 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>WAL block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within the WAL log. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 64 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-devel">
+ <title>Developer Options</title>
+
+ <para>
+ Most of the options in this section are only of interest for
+ developing or debugging <productname>PostgreSQL</productname>.
+ They are not recommended for production builds, except
+ for <option>--debug</option>, which can be useful to enable
+ detailed bug reports in the unlucky event that you encounter a bug.
+ On platforms supporting DTrace, <option>-Ddtrace</option>
+ may also be reasonable to use in production.
+ </para>
+
+ <para>
+ When building an installation that will be used to develop code inside
+ the server, it is recommended to use at least the <option>--buildtype=debug</option>
+ and <option>-Dcassert</option> options.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to specify the buildtype to use; defaults
+ to release. If you'd like finer control on the debug symbols
+ and optimization levels than what this option provides, you can
+ refer to the --debug and --optimization flags.
+
+ The following build types are generally used:
+ <variablelist>
+ <varlistentry>
+ <term><literal>plain</literal></term>
+ <listitem>
+ <para>
+ No extra build flags are used, even for compiler warnings,
+ useful for distro packagers and other cases where you need to
+ specify all arguments by yourself.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debug</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated but the result is not optimized.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debugoptimized</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated and the code is optimized (on most compilers
+ this means <literal>-g -O2</literal>)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>release</literal></term>
+ <listitem>
+ <para>
+ This enables full optimization and no debug info is generated. This is
+ the default.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--debug</option></term>
+ <listitem>
+ <para>
+ Compiles all programs and libraries with debugging symbols.
+ This means that you can run the programs in a debugger
+ to analyze problems. This enlarges the size of the installed
+ executables considerably, and on non-GCC compilers it usually
+ also disables compiler optimization, causing slowdowns. However,
+ having the symbols available is extremely helpful for dealing
+ with any problems that might arise. Currently, this option is
+ recommended for production installations only if you use GCC.
+ But you should always have it on if you are doing development work
+ or running a beta version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term>
+ <listitem>
+ <para>
+ Specify the optimization level. LEVEL can be set to any of {0,g,1,2,3,s}.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--werror</option></term>
+ <listitem>
+ <para>
+ Setting this option asks the compiler to treat warnings as errors. This can
+ be useful for code development purposes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dcassert</option></term>
+ <listitem>
+ <para>
+ Enables <firstterm>assertion</firstterm> checks in the server, which test for
+ many <quote>cannot happen</quote> conditions. This is invaluable for
+ code development purposes, but the tests can slow down the
+ server significantly.
+ Also, having the tests turned on won't necessarily enhance the
+ stability of your server! The assertion checks are not categorized
+ for severity, and so what might be a relatively harmless bug will
+ still lead to server restarts if it triggers an assertion
+ failure. This option is not recommended for production use, but
+ you should have it on for development work or when running a beta
+ version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtap-tests</option></term>
+ <listitem>
+ <para>
+ Enable tests using the Perl TAP tools. This requires a Perl
+ installation and the Perl module <literal>IPC::Run</literal>.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-tap"/> for more information.</phrase>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-DPG_TEST_EXTRA=<replaceable>TEST_SUITES</replaceable></option></term>
+ <listitem>
+ <para>
+ Enable test suites which require special software to run. This option
+ accepts arguments via a whitespace-separated list. The following values
+ are currently supported:
+ <variablelist>
+ <varlistentry>
+ <term><literal>kerberos</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/kerberos</filename>. This
+ requires an MIT Kerberos installation and opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ldap</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ldap</filename>. This
+ requires an <productname>OpenLDAP</productname> installation and opens
+ TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ssl</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ssl</filename>. This opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>wal_consistency_checking</literal></term>
+ <listitem>
+ <para>
+ Uses <literal>wal_consistency_checking=all</literal> while running
+ certain tests under <filename>src/test/recovery</filename>. Not
+ enabled by default because it is resource intensive.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ Tests for features that are not supported by the current build
+ configuration are not run even if they are mentioned in
+ <varname>PG_TEST_EXTRA</varname>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--errorlogs</option></term>
+ <listitem>
+ <para>
+ This option can be used to print the logs from the failing tests
+ making debugging easier.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Db_coverage</option></term>
+ <listitem>
+ <para>
+ If using GCC, all programs and libraries are compiled with
+ code coverage testing instrumentation. When run, they
+ generate files in the build directory with code coverage
+ metrics.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-coverage"/>
+ for more information.</phrase> This option is for use only with GCC
+ and when doing development work.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Ddtrace=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>DTrace</primary>
+ </indexterm>
+ Enabling this compiles <productname>PostgreSQL</productname> with support for the
+ dynamic tracing tool DTrace.
+ <phrase condition="standalone-ignore">See <xref linkend="dynamic-trace"/>
+ for more information.</phrase>
+ </para>
+
+ <para>
+ To point to the <command>dtrace</command> program, the
+ environment variable <envar>DTRACE</envar> can be set. This
+ will often be necessary because <command>dtrace</command> is
+ typically installed under <filename>/usr/sbin</filename>,
+ which might not be in your <envar>PATH</envar>.
+ </para>
+
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-misc">
+ <title>Miscellaneous</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term>
+ <listitem>
+ <para>
+ Set <replaceable>NUMBER</replaceable> as the 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
+ <productname>PostgreSQL</productname> servers on the same machine.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term>
+ <listitem>
+ <para>
+ The default name of the Kerberos service principal used
+ by GSSAPI.
+ <literal>postgres</literal> is the default. There's usually no
+ reason to change this unless you are building for a Windows
+ environment, in which case it must be set to upper case
+ <literal>POSTGRES</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="build-meson">
+ <title>Building the source</title>
+ <para>
+ By default, <productname>Meson</productname> uses the
+ <ulink url="https://ninja-build.org/"> Ninja build system</ulink>.
+ To build <productname>PostgreSQL</productname> from source using meson, you can
+ simply use the <literal>ninja</literal> command in the build directory.
+<screen>
+ninja
+</screen>
+ Ninja will automatically detect the number of CPUs in your computer and
+ parallelize itself accordingly. You can override the amount of parallel
+ processes used with the command line argument <literal>-j</literal>.
+ </para>
+
+ <para>
+ It should be noted that after the initial configure step
+ <command>ninja</command> is the only command you ever need to type to
+ compile. No matter how you alter your source tree (short of moving it to
+ a completely new location), Meson will detect the changes and regenerate
+ itself accordingly. This is especially handy if you have multiple build
+ directories. Often one of them is used for development (the "debug" build)
+ and others only every now and then (such as a "static analysis" build).
+ Any configuration can be built just by cd'ing to the corresponding directory
+ and running Ninja.
+ </para>
+
+ <para>
+ If you'd like to build with a backend other that ninja, you can use configure
+ with the <option>--backend</option> option to select the one you want to use and then
+ build using <literal>meson compile</literal>. To learn more about these
+ backends and other arguments you can provide to ninja, you can refer to the
+ meson <ulink url="https://mesonbuild.com/Running-Meson.html#building-from-the-source">
+ documentation</ulink>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-files-meson">
+ <title>Installing the files</title>
+ <para>
+ Once Postgres is built, you can install it by simply running the
+ <literal>ninja install</literal> command.
+
+<screen>
+ninja install
+</screen>
+ </para>
+
+ <para>
+ This will install files into the directories that were specified
+ in <xref linkend="configure-meson"/>. Make sure that you have appropriate
+ permissions to write into that area. You might need to do this
+ step as root. Alternatively, you can create the target directories
+ in advance and arrange for appropriate permissions to be granted.
+ The standard installation provides all the header files needed for client
+ application development as well as for server-side program
+ development, such as custom functions or data types written in C.
+ </para>
+
+ <para>
+ <literal>ninja install</literal> should work for most cases
+ but if you'd like to use more options, you could also use
+ <literal>meson install</literal> instead. You can learn more about
+ <ulink url="https://mesonbuild.com/Commands.html#install">meson install</ulink>
+ and it's options in the meson documentation.
+ </para>
+
+ <para>
+ Depending on your platform and setup, you might have to perform a
+ few steps after installation. Those are outlined in
+ <xref linkend="install-post"/>.
+ </para>
+
+ <formalpara>
+ <title>Uninstallation:</title>
+ <para>
+ To undo the installation, you can use the <command>ninja
+ uninstall</command> command.
+ </para>
+ </formalpara>
+
+ <formalpara>
+ <title>Cleaning:</title>
+ <para>
+ After the installation you can free disk space by removing the built
+ files from the source tree with the <command>ninja clean</command>
+ command.
+ </para>
+ </formalpara>
+
+ </sect2>
+
+ <sect2 id="running-tests">
+ <title>Running tests</title>
+ <para>
+ If you want to test the newly built server, you can run the regression
+ tests. The regression tests are a collection of test suites to verify
+ that <productname>PostgreSQL</productname> runs on your machine in
+ the way the developers expected it to. To run them, simply type:
+<screen>
+<userinput>meson test</userinput>
+</screen>
+ You can repeat this at any later time by issuing the same command.
+ </para>
+
+ <para>Meson also allows you to list tests and run specific tests or suites.
+<screen>
+# List all tests
+<userinput>meson test --list</userinput>
+
+# Run a specific test
+<userinput>meson test recovery/001_stream_rep</userinput>
+
+# Run the main pg_regress and isolation tests
+<userinput>meson test --suite main</userinput>
+</screen>
+ </para>
+
+ <para>
+ To learn more about running the tests and how to interpret the results
+ you can refer to the documentation for interpreting test results.
+ <literal>meson test</literal> also provides a number of additional
+ options you can use which can be found in the
+ <ulink url="https://mesonbuild.com/Unit-tests.html#testing-tool">meson test documentation</ulink>.
+ </para>
+
+ </sect2>
+
+ </sect1>
+
<sect1 id="install-post">
<title>Post-Installation Setup</title>
@@ -2106,62 +3797,6 @@ export MANPATH
</sect2>
</sect1>
- <sect1 id="supported-platforms">
- <title>Supported Platforms</title>
-
- <para>
- A platform (that is, a CPU architecture and operating system combination)
- is considered supported by the <productname>PostgreSQL</productname> development
- community if the code contains provisions to work on that platform and
- it has recently been verified to build and pass its regression tests
- on that platform. Currently, most testing of platform compatibility
- is done automatically by test machines in the
- <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
- If you are interested in using <productname>PostgreSQL</productname> on a platform
- that is not represented in the build farm, but on which the code works
- or can be made to work, you are strongly encouraged to set up a build
- farm member machine so that continued compatibility can be assured.
- </para>
-
- <para>
- In general, <productname>PostgreSQL</productname> can be expected to work on
- these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
- and PA-RISC, including
- big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
- It is often
- possible to build on an unsupported CPU type by configuring with
- <option>--disable-spinlocks</option>, but performance will be poor.
- </para>
-
- <para>
- <productname>PostgreSQL</productname> can be expected to work on current
- versions of these operating systems: Linux, Windows,
- FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
- Other Unix-like systems may also work but are not currently
- being tested. In most cases, all CPU architectures supported by
- a given operating system will work. Look in
- <xref linkend="installation-platform-notes"/> below to see if
- there is information
- specific to your operating system, particularly if using an older system.
- </para>
-
- <para>
- If you have installation problems on a platform that is known
- to be supported according to recent build farm results, please report
- it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
- in porting <productname>PostgreSQL</productname> to a new platform,
- <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
- to discuss that.
- </para>
-
- <para>
- Historical versions of <productname>PostgreSQL</productname> or POSTGRES
- also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
- M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
- BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
- Tru64 UNIX, and ULTRIX.
- </para>
- </sect1>
<sect1 id="installation-platform-notes">
<title>Platform-Specific Notes</title>
@@ -2170,7 +3805,7 @@ export MANPATH
This section documents additional platform-specific issues
regarding the installation and setup of PostgreSQL. Be sure to
read the installation instructions, and in
- particular <xref linkend="install-requirements"/> as well. Also,
+ particular <xref linkend="install-requirements-make"/> as well. Also,
check <xref linkend="regress"/> regarding the
interpretation of regression test results.
</para>
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 1d9509a2f66..214e1b1d551 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -7072,7 +7072,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
explicitly tell the configure script to make the probes available
in <productname>PostgreSQL</productname>. To include DTrace support
specify <option>--enable-dtrace</option> to configure. See <xref
- linkend="install-procedure"/> for further information.
+ linkend="configure-options-devel"/> for further information.
</para>
</sect2>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index f268265a838..7a1d220175b 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1855,7 +1855,7 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
<step>
<para>
Install the new version of <productname>PostgreSQL</productname> as
- outlined in <xref linkend="install-procedure"/>.
+ outlined in <xref linkend="installation"/>.
</para>
</step>
diff --git a/doc/src/sgml/sourcerepo.sgml b/doc/src/sgml/sourcerepo.sgml
index 0ed7f8a3fea..f16be29a61a 100644
--- a/doc/src/sgml/sourcerepo.sgml
+++ b/doc/src/sgml/sourcerepo.sgml
@@ -20,9 +20,10 @@
Note that building <productname>PostgreSQL</productname> from the source
repository requires reasonably up-to-date versions of <application>bison</application>,
<application>flex</application>, and <application>Perl</application>. These tools are not needed
- to build from a distribution tarball, because the files that these tools
+ to build from a distribution tarball if building via make, because the files that these tools
are used to build are included in the tarball. Other tool requirements
- are the same as shown in <xref linkend="install-requirements"/>.
+ are the same as shown in <xref linkend="install-requirements-make"/> and
+ <xref linkend="install-requirements-meson"/>.
</para>
<sect1 id="git">
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0008-meson-Add-PGXS-compatibility.patch (7.4K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/9-v15-0008-meson-Add-PGXS-compatibility.patch)
download | inline diff:
From 5935b41b7f3fc01e786e63de8834e099ca534a9d Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 20:27:17 -0700
Subject: [PATCH v15 08/14] meson: Add PGXS compatibility
This works for some extensions on some operating systems, but could use plenty
of cleanups.
---
src/meson.build | 259 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 259 insertions(+)
diff --git a/src/meson.build b/src/meson.build
index b515af15bfa..ca99db42baa 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -10,3 +10,262 @@ subdir('bin')
subdir('pl')
subdir('interfaces')
+
+
+### Generate a Makefile.global that's complete enough for PGXS to work.
+#
+# This is somewhat ugly, but allows extensions to only use a single
+# buildsystem across all the supported postgres versions. Once all supported
+# PG versions support meson, we can remove all of this.
+#
+# XXX: Should we make this optional?
+
+pgxs_kv = {
+ 'PACKAGE_URL': pg_url,
+ 'PACKAGE_VERSION': pg_version,
+ 'PG_MAJORVERSION': pg_version_major,
+ 'PG_VERSION_NUM': pg_version_num,
+ 'configure_input': 'meson',
+
+ 'vpath_build': 'yes',
+ 'autodepend': 'no', # XXX: Should we just set this to true when possible?
+
+ 'host_cpu': host_cpu,
+ 'host': '@0@-@1@'.format(host_cpu, host_system),
+ 'host_os': host_system,
+ 'build_os': build_machine.system(),
+ 'PORTNAME': portname,
+ 'PG_SYSROOT': pg_sysroot,
+
+ 'abs_top_builddir': meson.build_root(),
+ 'abs_top_srcdir': meson.source_root(),
+
+ 'enable_thread_safety': 'yes',
+ 'enable_rpath': 'yes',
+ 'enable_nls': libintl.found() ? 'yes' : 'no',
+ 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
+ 'enable_debug': get_option('debug') ? 'yes' : 'no',
+ 'enable_coverage': get_option('b_coverage') ? 'yes' : 'no',
+ 'enable_dtrace': dtrace.found() ? 'yes' : 'no',
+
+ 'DLSUFFIX': dlsuffix,
+ 'EXEEXT': exesuffix,
+
+ 'SUN_STUDIO_CC': 'no', # not supported so far
+
+ 'default_port': get_option('pgport'),
+ 'with_system_tzdata': get_option('system_tzdata'),
+
+ 'with_krb_srvnam': get_option('krb_srvnam'),
+ 'krb_srvtab': krb_srvtab,
+
+ # FIXME: implement programs.m4 logic in PGAC_CHECK_STRIP
+ 'STRIP': 'strip',
+ 'STRIP_STATIC_LIB': 'strip -x',
+ 'STRIP_SHARED_LIB': 'strip --strip-unneeded',
+
+ # Just always use the install_sh fallback that autoconf uses. Unlikely to
+ # matter performance-wise for extensions. If it turns out to do, we can
+ # improve that later.
+ 'MKDIR_P': ' '.join([install_sh.path(), '-d']),
+
+ 'CC': var_cc,
+ 'CPP': var_cpp,
+ 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
+ 'with_gnu_ld': (cc.get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.lld'] ? 'yes' : 'no'),
+
+ 'CFLAGS': var_cflags,
+ 'CPPFLAGS': var_cppflags,
+ 'CXXFLAGS': var_cxxflags,
+ 'CFLAGS_SL': var_cflags_sl,
+ 'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
+ 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
+ 'CFLAGS_SSE42': ' '.join(cflags_crc),
+ 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
+ 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
+
+ # FIXME:
+ 'CFLAGS_ARMV8_CRC32C': '',
+ 'BITCODE_CFLAGS': '',
+ 'BITCODE_CXXFLAGS': '',
+
+ 'LDFLAGS': var_ldflags,
+ 'LDFLAGS_EX': var_ldflags_ex,
+ 'LDFLAGS_SL': var_ldflags_sl,
+
+ 'BISONFLAGS': ' '.join(bison_flags),
+ 'FLEXFLAGS': ' '.join(flex_flags),
+
+ 'LIBS': var_libs,
+}
+
+if llvm.found()
+ pgxs_kv += {
+ 'CLANG': clang.path(),
+ 'CXX': ' '.join(cpp.cmd_array()),
+ 'LLVM_BINPATH': llvm_binpath,
+ }
+else
+ pgxs_kv += {
+ 'CLANG': '',
+ 'CXX': '',
+ 'LLVM_BINPATH': '',
+ }
+endif
+
+pgxs_cdata = configuration_data(pgxs_kv)
+
+# FIXME: figure out which platforms we still need the linker "directly" -
+# can't be many?
+
+ld_program = find_program(cc.get_linker_id(), native: true, required: false)
+
+pgxs_bins = {
+ 'BISON': bison,
+ 'FLEX': flex,
+ 'GZIP': gzip,
+ 'LZ4': program_lz4,
+ 'PERL': perl,
+ 'PROVE': prove,
+ 'PYTHON': python,
+ 'TAR': tar,
+ 'ZSTD': program_zstd,
+ 'DTRACE': dtrace,
+ 'LD': ld_program,
+ 'install_bin': install_sh,
+}
+foreach b, p : pgxs_bins
+ pgxs_cdata.set(b, p.found() ? p.path() : '')
+endforeach
+
+pgxs_empty = [
+ 'PERMIT_DECLARATION_AFTER_STATEMENT',
+ 'ICU_CFLAGS', # needs to be added, included by public server headers
+
+ # probably need most of these?
+ 'RANLIB',
+ 'WINDRES',
+ 'LN_S',
+ 'AR',
+ 'AWK',
+
+ # hard to see why we'd need either?
+ 'ZIC',
+ 'TCLSH',
+
+ # docs don't seem to be supported by pgxs
+ 'XMLLINT',
+ 'XSLTPROC',
+ 'DBTOEPUB',
+ 'FOP',
+
+ # supporting coverage for pgxs-in-meson build doesn't seem worth it
+ 'GENHTML',
+ 'LCOV',
+ 'GCOV',
+ 'MSGFMT_FLAGS',
+
+ # translation doesn't appear to be supported by pgxs
+ 'MSGFMT',
+ 'XGETTEXT',
+ 'MSGMERGE',
+ 'WANTED_LANGUAGES',
+
+ # Not needed because we don't build the server / PLs with the generated makefile
+ 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
+ 'DTRACEFLAGS', # only server has dtrace probes
+
+ 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
+ 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
+
+ # possible that some of these are referenced explicitly in pgxs makefiles?
+ # For now not worth it.
+ 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
+
+ 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
+
+ 'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
+
+ 'UUID_LIBS',
+
+ 'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
+
+ 'ICU_LIBS',
+]
+
+foreach pe : pgxs_empty
+ pgxs_cdata.set(pe, '')
+endforeach
+
+pgxs_dirs = {
+ 'prefix': get_option('prefix'),
+
+ 'bindir': '${exec_prefix}' / get_option('bindir'),
+ 'datarootdir': '${prefix}' / get_option('datadir'),
+ 'datadir': '${datarootdir}',
+ 'docdir': '${prefix}' / dir_doc,
+ 'exec_prefix': '${prefix}',
+ 'htmldir': '${prefix}' / dir_doc_html, #?
+ 'includedir': '${prefix}' / get_option('includedir'),
+ 'libdir': '${exec_prefix}' / get_option('libdir'),
+ 'localedir': '${prefix}' / get_option('localedir'),
+ 'mandir': '${prefix}' / get_option('mandir'),
+ 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
+}
+
+foreach d, p : pgxs_dirs
+ pgxs_cdata.set(d, p)
+endforeach
+
+pgxs_deps = {
+ 'bonjour': bonjour,
+ 'bsd_auth': bsd_auth,
+ 'gssapi': gssapi,
+ 'icu': icu,
+ 'ldap': ldap,
+ 'libxml': libxml,
+ 'libxslt': libxslt,
+ 'llvm': llvm,
+ 'lz4': lz4,
+ 'nls': libintl,
+ 'pam': pam,
+ 'perl': perl_dep,
+ 'python': python3_dep,
+ 'readline': readline,
+ 'selinux': selinux,
+ 'systemd': systemd,
+ 'tcl': tcl_dep,
+ 'zlib': zlib,
+ 'zstd': zstd,
+}
+foreach d, v : pgxs_deps
+ pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')
+endforeach
+
+pgxs_cdata.set('with_ssl', get_option('ssl'))
+pgxs_cdata.set('with_uuid', uuidopt)
+
+makefile_global = configure_file(
+ input: 'Makefile.global.in',
+ output: 'Makefile.global',
+ configuration: pgxs_cdata,
+ install: true,
+ install_dir: dir_pgxs / 'src',
+)
+configure_files += makefile_global
+
+# FIXME: check if exists
+makefile_port = configure_file(
+ input: 'makefiles' / 'Makefile.@0@'.format(portname),
+ output: 'Makefile.port',
+ copy: true,
+ install_dir: dir_pgxs / 'src')
+configure_files += makefile_port
+
+install_data(
+ 'Makefile.shlib', 'nls-global.mk',
+ install_dir: dir_pgxs / 'src')
+
+install_data(
+ 'makefiles/pgxs.mk',
+ install_dir: dir_pgxs / 'src' / 'makefiles')
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0009-meson-Add-postgresql-extension.pc-for-building-e.patch (3.7K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/10-v15-0009-meson-Add-postgresql-extension.pc-for-building-e.patch)
download | inline diff:
From 3cd5f97d7ab63b5ecf6a8aedfa67afc285714269 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:52:03 -0700
Subject: [PATCH v15 09/14] meson: Add postgresql-extension.pc for building
extension libraries
This should work with several other buildsystems.
TODO: Docs and example
---
src/backend/meson.build | 96 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index fefa40ddb64..0598085a240 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -180,6 +180,102 @@ pg_mod_args = default_mod_args + {
+###############################################################
+# Define a .pc file that can be used to build server extensions
+###############################################################
+
+pg_ext_vars = []
+pg_ext_vars_inst = []
+pg_ext_vars_uninst = []
+
+pg_ext_cflags = pg_mod_c_args
+pg_ext_libs = [backend_mod_code, thread_dep, ldflags, ldflags_mod]
+pg_ext_subdirs = ['']
+
+# Compute directories to add include directories to the .pc files for.
+# This is a bit more complicated due to port/win32 etc.
+i = 0
+foreach incdir : postgres_inc_d
+ if incdir.startswith('src/include')
+ subincdir = dir_include_pkg_rel / 'server' / incdir.split('src/include/').get(1, '')
+ else
+ subincdir = ''
+ endif
+ pg_ext_subdirs += subincdir
+
+ # Add directories in source / build dir containing headers to cflags for the
+ # -uninstalled.pc
+ pg_ext_vars_uninst += [
+ 'build_inc@0@=-I${prefix}/@1@'.format(i, incdir),
+ 'src_inc@0@=-I${srcdir}/@1@'.format(i, incdir),
+ ]
+ pg_ext_cflags += [
+ '${build_inc@0@}'.format(i),
+ '${src_inc@0@}'.format(i)
+ ]
+
+ i += 1
+endforeach
+
+
+# Extension modules should likely also use -fwrapv etc. But it it's a bit odd
+# to expose it to a .pc file?
+pg_ext_cflags += cflags
+
+# Directories for extensions to install into
+# XXX: more needed
+pg_ext_vars += 'pkglibdir=${prefix}/@0@'.format(dir_lib_pkg)
+pg_ext_vars += 'dir_mod=${pkglibdir}'
+pg_ext_vars += 'dir_data=${prefix}/@0@'.format(dir_data_extension)
+# referenced on some platforms, via mod_link_with_dir
+pg_ext_vars += 'bindir=${prefix}/@0@'.format(dir_bin)
+
+# XXX: Define variables making it easy to define tests, too
+
+# Some platforms need linker flags to link with binary, they are the same
+# between building with meson and .pc file, except that we have have to
+# reference a variable to make it work for both normal and -uninstalled .pc
+# files.
+if mod_link_args_fmt.length() != 0
+ assert(link_with_inst != '')
+ assert(link_with_uninst != '')
+
+ pg_ext_vars_inst += 'mod_link_with=@0@'.format(link_with_inst)
+ pg_ext_vars_uninst += 'mod_link_with=@0@'.format(link_with_uninst)
+
+ foreach el : mod_link_args_fmt
+ pg_ext_libs += el.format('${mod_link_with}')
+ endforeach
+endif
+
+# main .pc to build extensions
+pkgconfig.generate(
+ name: 'postgresql-extension',
+ description: 'PostgreSQL Extension Support',
+ url: pg_url,
+
+ subdirs: pg_ext_subdirs,
+ libraries: pg_ext_libs,
+ extra_cflags: pg_ext_cflags,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+# a .pc depending on the above, but with all our warnings enabled
+pkgconfig.generate(
+ name: 'postgresql-extension-warnings',
+ description: 'PostgreSQL Extension Support - Compiler Warnings',
+ requires: 'postgresql-extension',
+ url: pg_url,
+ extra_cflags: cflags_warn,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+
+
# Shared modules that, on some system, link against the server binary. Only
# enter these after we defined the server build.
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0010-meson-Add-LLVM-bitcode-emission.patch (5.2K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/11-v15-0010-meson-Add-LLVM-bitcode-emission.patch)
download | inline diff:
From 59120464e1c497eb4c8faf11a69b5a8ea7523304 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 19:58:45 -0700
Subject: [PATCH v15 10/14] meson: Add LLVM bitcode emission
This needs a bit more love before being ready...
---
src/backend/jit/llvm/meson.build | 21 +++++++++++++++
src/backend/meson.build | 46 ++++++++++++++++++++++++++++++++
meson.build | 2 ++
src/tools/irlink | 43 +++++++++++++++++++++++++++++
4 files changed, 112 insertions(+)
create mode 100644 src/tools/irlink
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index 5fb63768358..5b339e33934 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -54,6 +54,19 @@ else
llvm_irgen_command = clang
endif
+llvm_irlink_kw = {
+ 'command': [
+ irlink,
+ '--name', 'postgres',
+ '--lto', llvm_lto,
+ '--outdir', '@OUTPUT0@',
+ '--privdir', '@PRIVATE_DIR@',
+ '@INPUT@',
+ ],
+ 'install': true,
+ 'install_dir': dir_lib_pkg,
+}
+
# XXX: Need to determine proper version of the function cflags for clang
bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
@@ -77,3 +90,11 @@ llvmjit_types = custom_target('llvmjit_types.bc',
depfile: '@BASENAME@.c.bc.d',
)
backend_targets += llvmjit_types
+
+# Figure out -I's needed to build all postgres code, including all its
+# dependencies
+pkg_config = find_program(['pkg-config', 'pkgconf'], required: true)
+r = run_command(pkg_config,
+ ['--cflags-only-I', meson.build_root() / 'meson-uninstalled/postgresql-extension-uninstalled.pc'],
+ check: true)
+bitcode_cflags += r.stdout().split()
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 0598085a240..1cb4cd3431f 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -284,3 +284,49 @@ subdir('replication/libpqwalreceiver')
subdir('replication/pgoutput')
subdir('snowball')
subdir('utils/mb/conversion_procs')
+
+
+
+###############################################################
+# emit LLVM bitcode of backend code for JIT inlining
+###############################################################
+
+if llvm.found()
+
+ # custom_target() insists on targeting files into the current
+ # directory. But we have files with the same name in different
+ # subdirectories. generators() don't have that problem, but their results
+ # are not installable. The irlink command copies the files for us.
+ #
+ # FIXME: this needs to be in a central place
+ #
+ # generators don't accept CustomTargetIndex as input or 'depends', nor do
+ # they like targets with more than one output. However, a custom target
+ # accepts them as input without a problem. So we have the below transitive
+ # target :(
+
+ transitive_depend_target = custom_target('stamp',
+ input: generated_headers + generated_backend_headers + generated_backend_sources,
+ output: 'stamp',
+ command: [touch, '@OUTPUT@'],
+ install: false)
+
+ llvm_gen = generator(llvm_irgen_command,
+ arguments: llvm_irgen_args + bitcode_cflags,
+ depends: transitive_depend_target,
+ depfile: '@BASENAME@.c.bc.d',
+ output: '@PLAINNAME@.bc',
+ )
+
+ bc_backend_sources = llvm_gen.process(backend_sources,
+ preserve_path_from: meson.current_source_dir())
+
+ postgres_llvm = custom_target('bitcode',
+ output: ['bitcode'],
+ input: bc_backend_sources,
+ kwargs: llvm_irlink_kw,
+ )
+
+ backend_targets += postgres_llvm
+
+endif
diff --git a/meson.build b/meson.build
index 8323adf772b..2b0cbb9a5a7 100644
--- a/meson.build
+++ b/meson.build
@@ -684,6 +684,8 @@ if not llvmopt.disabled()
ccache = find_program('ccache', native: true, required: false)
clang = find_program(llvm_binpath / 'clang', required: true)
+ llvm_lto = find_program(llvm_binpath / 'llvm-lto', required: true)
+ irlink = find_program('src/tools/irlink', native: true)
endif
else
llvm = not_found_dep
diff --git a/src/tools/irlink b/src/tools/irlink
new file mode 100644
index 00000000000..813bbf13398
--- /dev/null
+++ b/src/tools/irlink
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+import argparse
+
+parser = argparse.ArgumentParser(
+ description='generate PostgreSQL JIT IR module')
+
+parser.add_argument('--name', type=str, required=True)
+parser.add_argument('--lto', type=str, required=True)
+parser.add_argument('--privdir', type=str, required=True)
+parser.add_argument('--outdir', type=str, required=True)
+parser.add_argument('INPUT', type=str, nargs='+')
+
+args = parser.parse_args()
+
+outdir = os.path.realpath(args.outdir)
+privdir = os.path.realpath(args.privdir)
+
+index = '{0}/{1}.index.bc'.format(outdir, args.name)
+destdir = '{0}/{1}'.format(outdir, args.name)
+
+# Remove old contents if exist
+if os.path.exists(destdir):
+ shutil.rmtree(destdir)
+
+shutil.copytree(privdir, destdir)
+
+# Change working directory for irlink to link correctly
+os.chdir(args.outdir)
+
+file_names = []
+for input in args.INPUT:
+ file_names += [args.name + input.replace(args.privdir, '')]
+
+command = [args.lto, '-thinlto', '-thinlto-action=thinlink',
+ '-o', index] + file_names
+res = subprocess.run(command)
+
+exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0011-meson-Add-support-for-building-with-precompiled-.patch (14.8K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/12-v15-0011-meson-Add-support-for-building-with-precompiled-.patch)
download | inline diff:
From e3d1e4a4ef68d50fd1ae9a31e0f7eed96b387972 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 23 Sep 2022 12:19:17 -0700
Subject: [PATCH v15 11/14] meson: Add support for building with precompiled
headers
This substantially speeds up building for windows. A cross build with mingw
goes from
real 0m29.884s
user 15m41.900s
sys 1m58.257s
to
real 0m13.196s
user 6m52.330s
sys 1m15.140s
The wins on windows are similar-ish (but I don't have a system at hand just
now for actual numbers).
---
src/include/meson.build | 1 +
src/include/pch/c_pch.h | 1 +
src/include/pch/meson.build | 4 ++++
src/include/pch/postgres_fe_pch.h | 1 +
src/include/pch/postgres_pch.h | 1 +
src/common/meson.build | 2 ++
src/port/meson.build | 2 ++
src/backend/meson.build | 5 +++++
src/backend/snowball/meson.build | 1 +
src/fe_utils/meson.build | 1 +
src/bin/pg_dump/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 1 +
src/bin/psql/meson.build | 1 +
src/interfaces/libpq/meson.build | 1 +
src/pl/plperl/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpython/meson.build | 1 +
src/pl/tcl/meson.build | 1 +
contrib/bloom/meson.build | 1 +
contrib/btree_gist/meson.build | 1 +
contrib/hstore/meson.build | 1 +
contrib/pg_trgm/meson.build | 1 +
contrib/pgcrypto/meson.build | 1 +
contrib/pgstattuple/meson.build | 1 +
contrib/sepgsql/meson.build | 1 +
contrib/xml2/meson.build | 1 +
.cirrus.yml | 4 ++--
meson.build | 8 ++++++++
28 files changed, 45 insertions(+), 2 deletions(-)
create mode 100644 src/include/pch/c_pch.h
create mode 100644 src/include/pch/meson.build
create mode 100644 src/include/pch/postgres_fe_pch.h
create mode 100644 src/include/pch/postgres_pch.h
diff --git a/src/include/meson.build b/src/include/meson.build
index e5390df0584..28ed9011c70 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -110,6 +110,7 @@ install_headers(
subdir('catalog')
subdir('nodes')
+subdir('pch')
subdir('storage')
subdir('utils')
diff --git a/src/include/pch/c_pch.h b/src/include/pch/c_pch.h
new file mode 100644
index 00000000000..f40c757ca62
--- /dev/null
+++ b/src/include/pch/c_pch.h
@@ -0,0 +1 @@
+#include "c.h"
diff --git a/src/include/pch/meson.build b/src/include/pch/meson.build
new file mode 100644
index 00000000000..2bcec49c3a2
--- /dev/null
+++ b/src/include/pch/meson.build
@@ -0,0 +1,4 @@
+# See https://github.com/mesonbuild/meson/issues/10338
+pch_c_h = meson.source_root() / meson.current_source_dir() / 'c_pch.h'
+pch_postgres_h = meson.source_root() / meson.current_source_dir() / 'postgres_pch.h'
+pch_postgres_fe_h = meson.source_root() / meson.current_source_dir() / 'postgres_fe_pch.h'
diff --git a/src/include/pch/postgres_fe_pch.h b/src/include/pch/postgres_fe_pch.h
new file mode 100644
index 00000000000..f3ea20912d3
--- /dev/null
+++ b/src/include/pch/postgres_fe_pch.h
@@ -0,0 +1 @@
+#include "postgres_fe.h"
diff --git a/src/include/pch/postgres_pch.h b/src/include/pch/postgres_pch.h
new file mode 100644
index 00000000000..71b2f35f76b
--- /dev/null
+++ b/src/include/pch/postgres_pch.h
@@ -0,0 +1 @@
+#include "postgres.h"
diff --git a/src/common/meson.build b/src/common/meson.build
index 23842e1ffef..1c9b8a3a018 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -147,6 +147,7 @@ foreach name, opts : pgcommon_variants
endif
c_args = opts.get('c_args', []) + common_cflags[cflagname]
cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'sources': sources,
@@ -159,6 +160,7 @@ foreach name, opts : pgcommon_variants
lib = static_library('libpgcommon@0@'.format(name),
link_with: cflag_libs,
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
diff --git a/src/port/meson.build b/src/port/meson.build
index ced2e014db8..c2222696f1b 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -161,6 +161,7 @@ foreach name, opts : pgport_variants
c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
sources,
+ c_pch: pch_c_h,
kwargs: opts + {
'c_args': c_args,
'build_by_default': false,
@@ -172,6 +173,7 @@ foreach name, opts : pgport_variants
lib = static_library('libpgport@0@'.format(name),
pgport_sources,
link_with: cflag_libs,
+ c_pch: pch_c_h,
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
}
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 1cb4cd3431f..a535543ee9e 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -62,6 +62,7 @@ postgres_lib = static_library('postgres_lib',
backend_sources + timezone_sources + generated_backend_sources,
link_whole: backend_link_with,
dependencies: backend_build_deps,
+ c_pch: pch_postgres_h,
kwargs: internal_lib_args,
)
@@ -81,6 +82,10 @@ if cc.get_id() == 'msvc'
backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
backend_link_depends += postgres_def
+ # Due to the way msvc and meson's precompiled headers implementation
+ # interact, we need to have symbols from the full library available. Could
+ # be restricted to b_pch=true.
+ backend_link_with += postgres_lib
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 974401d187e..72959fa29d6 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -66,6 +66,7 @@ endif
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
+ c_pch: pch_postgres_h,
kwargs: pg_mod_args + {
'include_directories': [stemmer_inc],
}
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index b6bf8e1ca21..f1ba5ac8c14 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -23,6 +23,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
+ c_pch: pch_postgres_fe_h,
include_directories: [postgres_inc, libpq_inc],
dependencies: frontend_common_code,
kwargs: default_lib_args,
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 3527a25c288..e66f632b54e 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -13,6 +13,7 @@ pg_dump_common_sources = files(
pg_dump_common = static_library('libpgdump_common',
pg_dump_common_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq, zlib],
kwargs: internal_lib_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index a7b927a45c7..212bc9ce6ef 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -24,6 +24,7 @@ endif
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 3474389d3b6..8ec07260d1b 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -46,6 +46,7 @@ endif
psql = executable('psql',
psql_sources,
+ c_pch: pch_postgres_fe_h,
include_directories: include_directories('.'),
dependencies: [frontend_code, libpq, readline],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 2c9edeaa088..72102521edc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -49,6 +49,7 @@ libpq_st = static_library('libpq',
pic: true,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
+ c_pch: pch_postgres_fe_h,
dependencies: libpq_deps,
kwargs: default_lib_args,
)
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 535660085dd..cd3894e6a73 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -45,6 +45,7 @@ endif
plperl = shared_module('plperl',
plperl_sources,
+ c_pch: pch_postgres_h,
include_directories: [plperl_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [perl_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index c46c0a1da2a..27b2f5ef529 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -48,6 +48,7 @@ endif
plpgsql = shared_module('plpgsql',
plpgsql_sources,
+ c_pch: pch_postgres_h,
include_directories: include_directories('.'),
kwargs: pg_mod_args,
)
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 40888386b5f..7bd683580e8 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -36,6 +36,7 @@ endif
plpython = shared_module('plpython3',
plpython_sources,
+ c_pch: pch_postgres_h,
include_directories: [plpython_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [python3_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index f09bb14c950..7a708776c99 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -22,6 +22,7 @@ endif
pltcl = shared_module('pltcl',
pltcl_sources,
+ c_pch: pch_postgres_h,
include_directories: [include_directories('.'), postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [tcl_dep, pg_mod_args['dependencies']],
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 16f3b83e4d2..163a93c98fb 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -15,6 +15,7 @@ endif
bloom = shared_module('bloom',
bloom_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += bloom
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index e98c91dacc8..bfb7865d213 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -33,6 +33,7 @@ endif
btree_gist = shared_module('btree_gist',
btree_gist_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gist
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 2bb26bb772b..a2a4ec36cb0 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -18,6 +18,7 @@ endif
hstore = shared_module('hstore',
hstore_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index c8c7c07b308..839d6c4a7f6 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -13,6 +13,7 @@ endif
pg_trgm = shared_module('pg_trgm',
pg_trgm_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index 7fc7bbc7ca1..cc782578b49 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -78,6 +78,7 @@ endif
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
},
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 05e4cd46a5c..42d0b0e6ce9 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -12,6 +12,7 @@ endif
pgstattuple = shared_module('pgstattuple',
pgstattuple_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 8bef239e3c2..1ac0fa388ab 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -22,6 +22,7 @@ endif
sepgsql = shared_module('sepgsql',
sepgsql_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [selinux, contrib_mod_args['dependencies']],
}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 89b0d677516..92ab3368428 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -15,6 +15,7 @@ endif
xml2 = shared_module('pgxml',
xml2_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/.cirrus.yml b/.cirrus.yml
index 965483550d1..a0e7acf5ec9 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -602,7 +602,7 @@ task:
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
- meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
@@ -630,7 +630,7 @@ task:
configure_script: |
vcvarsall x64
- meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --buildtype debug --backend vs -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
diff --git a/meson.build b/meson.build
index 2b0cbb9a5a7..6ee9bbb3f46 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,7 @@ project('postgresql',
meson_version: '>=0.54',
default_options: [
'warning_level=1', #-Wall equivalent
+ 'b_pch=false',
'buildtype=release',
]
)
@@ -1767,6 +1768,13 @@ if cc.get_id() == 'msvc'
'/wd4267', # conversion from 'size_t' to 'type', possible loss of data
]
+ # Dirty hack to disable warnings due to some files defining
+ # UMDF_USING_NTSTATUS before including postgres.h. We need a better fix, but
+ # for now this allows us to see "real" warnings.
+ if get_option('b_pch')
+ cflags_warn += '/wd4005' # macro redefinition
+ endif
+
cppflags += [
'/DWIN32',
'/DWINDOWS',
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0012-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch (7.8K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/13-v15-0012-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch)
download | inline diff:
From cdd31870ecfb682ff1a405e1fcef3af4e13cb733 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 08:49:45 -0700
Subject: [PATCH v15 12/14] meson: Add xmllint/xsltproc wrapper script to
handle dependencies automatically
---
doc/src/sgml/meson.build | 38 ++++++++++++++------
doc/src/sgml/xmltools_dep_wrapper | 60 +++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 10 deletions(-)
create mode 100644 doc/src/sgml/xmltools_dep_wrapper
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index ba2a261e7a4..e6781d0deae 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -2,7 +2,7 @@ docs = []
alldocs = []
doc_generated = []
-xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
+xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false)
version_sgml = configure_file(
@@ -60,14 +60,23 @@ doc_generated += custom_target('keywords-table.sgml',
)
# For everything else we need at least xmllint
-if not xmllint.found()
+if not xmllint_bin.found()
subdir_done()
endif
pandoc = find_program('pandoc', native: true, required: false)
-xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
+xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false)
fop = find_program('fop', native: true, required: false)
+xmltools_wrapper = [
+ python, files('xmltools_dep_wrapper'),
+ '--targetname', '@OUTPUT@', '--depfile', '@DEPFILE@'
+]
+
+xmllint = xmltools_wrapper + [
+ '--tool', xmllint_bin, '--',
+]
+
# Run validation only once, common to all subsequent targets. While
# we're at it, also resolve all entities (that is, copy all included
# files into one big file). This helps tools that don't understand
@@ -75,6 +84,7 @@ fop = find_program('fop', native: true, required: false)
postgres_full_xml = custom_target('postgres-full.xml',
input: 'postgres.sgml',
output: 'postgres-full.xml',
+ depfile: 'postgres-full.xml.d',
command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
depends: doc_generated,
build_by_default: false,
@@ -86,18 +96,20 @@ alldocs += postgres_full_xml
#
# Full documentation as html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
xsltproc_flags = [
'--stringparam', 'pg.version', pg_version,
'--param', 'website.stylesheet', '1'
]
+ xsltproc = xmltools_wrapper + [
+ '--tool', xsltproc_bin, '--',
+ ]
- # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
- # depfile
html = custom_target('html',
input: ['stylesheet.xsl', postgres_full_xml],
output: 'html',
+ depfile: 'html.d',
depends: doc_generated,
command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -110,6 +122,7 @@ if xsltproc.found()
html_help = custom_target('html_help',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
+ depfile: 'htmlhelp.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -121,6 +134,7 @@ if xsltproc.found()
postgres_html = custom_target('postgres.html',
input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
output: 'postgres.html',
+ depfile: 'postgres.html.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -144,10 +158,11 @@ endif
#
# INSTALL in html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
install_xml = custom_target('INSTALL.xml',
input: ['standalone-profile.xsl', 'standalone-install.xml'],
output: 'INSTALL.xml',
+ depfile: 'INSTALL.xml.d',
depends: doc_generated + [postgres_full_xml],
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
@@ -155,6 +170,7 @@ if xsltproc.found()
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
+ depfile: 'INSTALL.html.d',
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
@@ -177,11 +193,12 @@ endif
#
# Man pages
#
-if xsltproc.found()
+if xsltproc_bin.found()
# FIXME: implement / consider sqlmansectnum logic
man = custom_target('man',
input: ['stylesheet-man.xsl', postgres_full_xml],
output: ['man1', 'man3', 'man7'],
+ depfile: 'man.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -195,7 +212,7 @@ endif
#
# Full documentation as PDF
#
-if fop.found() and xsltproc.found()
+if fop.found() and xsltproc_bin.found()
xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
@@ -206,6 +223,7 @@ if fop.found() and xsltproc.found()
input: ['stylesheet-fo.xsl', postgres_full_xml],
output: [postgres_x_fo_f],
depends: doc_generated,
+ depfile: postgres_x_fo_f + '.d',
command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
'--stringparam', 'paper.type', detail,
'-o', '@OUTPUT@', '@INPUT@'],
@@ -230,7 +248,7 @@ endif
# This was previously implemented using dbtoepub - but that doesn't seem to
# support running in build != source directory (i.e. VPATH builds already
# weren't supported).
-if pandoc.found() and xsltproc.found()
+if pandoc.found() and xsltproc_bin.found()
postgres_epub = custom_target('postgres.epub',
input: postgres_full_xml,
output: 'postgres.epub',
diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper
new file mode 100644
index 00000000000..52b94e3fcaf
--- /dev/null
+++ b/doc/src/sgml/xmltools_dep_wrapper
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(
+ description='generate dependency file for docs')
+
+parser.add_argument('--targetname', type=str, required=False, nargs='+')
+parser.add_argument('--depfile', type=str, required=False)
+parser.add_argument('--tool', type=str, required=True)
+
+parser.add_argument('flags', nargs='*')
+
+args = parser.parse_args()
+
+if args.depfile:
+ depfile_result_list = []
+
+ command = [args.tool, '--load-trace'] + args.flags
+ # --load-trace flag displays all the documents
+ # loaded during the processing to stderr
+ res = subprocess.run(command, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ # if exit code is different than 0, exit
+ if res.returncode:
+ exit(res.returncode)
+
+ # get line start from targetname
+ line_start = ''
+ for name in args.targetname:
+ line_start = line_start + name + ' '
+ line_start = line_start.strip() + ': '
+
+ # collect only file paths
+ line_re = re.compile('^Loaded URL="([^"]+)"')
+ with open(args.depfile, 'w') as f:
+ for line in res.stderr.split('\n'):
+ if line == '':
+ continue
+ m = re.match(line_re, line)
+
+ # continue to show errors
+ if m is None:
+ print(line, file=sys.stderr)
+ continue
+
+ fname = m.group(1)
+ if fname.startswith('http:'):
+ continue
+ if fname.startswith('file://'):
+ fname = fname.split('file://')[1]
+ f.write(line_start + fname + '\n')
+
+else:
+ command = [args.tool] + args.flags
+ res = subprocess.run(command)
+ exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0013-meson-Remove-non-binary-targets-added-to-bin_tar.patch (1.0K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/14-v15-0013-meson-Remove-non-binary-targets-added-to-bin_tar.patch)
download | inline diff:
From 0daba6f4cf617d777f27be47861e670eff5b6db4 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 24 Sep 2022 11:01:41 -0700
Subject: [PATCH v15 13/14] meson: Remove non-binary targets added to
bin_targets.
---
src/bin/psql/meson.build | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 8ec07260d1b..a4c46bf5385 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -21,7 +21,6 @@ psqlscanslash = custom_target('psqlscanslash',
command: [flex_cmd, '--no-backup', '--fix-warnings', '--', '-Cfe', '-p', '-p'])
generated_sources += psqlscanslash
psql_sources += psqlscanslash
-bin_targets += psqlscanslash
sql_help = custom_target('psql_help',
output: ['sql_help.c', 'sql_help.h'],
@@ -36,7 +35,6 @@ sql_help = custom_target('psql_help',
)
generated_sources += sql_help.to_list()
psql_sources += sql_help
-bin_targets += sql_help
if host_system == 'windows'
psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v15-0014-meson-wip-headerchecks-cpluspluschecks.patch (3.2K, ../../20220924180955.2hevwoniwsj2q2tm@awork3.anarazel.de/15-v15-0014-meson-wip-headerchecks-cpluspluschecks.patch)
download | inline diff:
From 8d5e8b15b85ae47f203ce8224414e75dae52437b Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 24 Sep 2022 11:02:21 -0700
Subject: [PATCH v15 14/14] meson: wip: headerchecks cpluspluschecks
---
src/include/meson.build | 4 ++--
src/meson.build | 7 +++++++
src/tools/pginclude/cpluspluscheck | 5 +++--
src/tools/pginclude/headerscheck | 4 ++--
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/include/meson.build b/src/include/meson.build
index 28ed9011c70..0f4ac9fdf68 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -42,8 +42,8 @@ config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
var_cc = ' '.join(cc.cmd_array())
var_cpp = ' '.join(cc.cmd_array() + ['-E'])
-var_cflags = ' '.join(cflags + cflags_warn)
-var_cxxflags = ' '.join(cxxflags + cxxflags_warn)
+var_cflags = ' '.join([cflags, cflags_warn, '-Wall'])
+var_cxxflags = ' '.join([cxxflags, cxxflags_warn, '-Wall'])
var_cppflags = ' '.join(cppflags)
var_cflags_sl = '-fPIC' #FIXME
var_ldflags = ' '.join(ldflags)
diff --git a/src/meson.build b/src/meson.build
index ca99db42baa..1891e11cb26 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -269,3 +269,10 @@ install_data(
install_data(
'makefiles/pgxs.mk',
install_dir: dir_pgxs / 'src' / 'makefiles')
+
+
+run_target('headerscheck',
+ command: [files('tools/pginclude/headerscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@'])
+
+run_target('cpluspluscheck',
+ command: [files('tools/pginclude/cpluspluscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@'])
diff --git a/src/tools/pginclude/cpluspluscheck b/src/tools/pginclude/cpluspluscheck
index b393f2a2eaa..37f3bfcaaf1 100755
--- a/src/tools/pginclude/cpluspluscheck
+++ b/src/tools/pginclude/cpluspluscheck
@@ -31,6 +31,7 @@ me=`basename $0`
# These switches are g++ specific, you may override if necessary.
CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
+CXXFLAGS="$CXXFLAGS -Wno-register"
# Pull some info from configure's results.
MGLOB="$builddir/src/Makefile.global"
@@ -166,9 +167,9 @@ do
# Some subdirectories need extra -I switches.
case "$f" in
src/pl/plperl/*)
- EXTRAINCLUDES="$perl_includespec" ;;
+ EXTRAINCLUDES="$perl_includespec"; continue; ;;
src/pl/plpython/*)
- EXTRAINCLUDES="$python_includespec" ;;
+ EXTRAINCLUDES="$python_includespec"; continue; ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 2a39856f88c..cc195ccc88f 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -149,9 +149,9 @@ do
# Some subdirectories need extra -I switches.
case "$f" in
src/pl/plperl/*)
- EXTRAINCLUDES="$perl_includespec" ;;
+ EXTRAINCLUDES="$perl_includespec"; continue; ;;
src/pl/plpython/*)
- EXTRAINCLUDES="$python_includespec" ;;
+ EXTRAINCLUDES="$python_includespec"; continue; ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
--
2.37.3.542.gdd3f6c4cae
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-24 23:56 Peter Geoghegan <pg@bowt.ie>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 1 reply; 81+ messages in thread
From: Peter Geoghegan @ 2022-09-24 23:56 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Thu, Sep 22, 2022 at 2:50 PM Andres Freund <andres@anarazel.de> wrote:
> meson:
>
> time meson test
> real 0m42.178s
> user 7m8.533s
> sys 2m17.711s
I find that a more or less comparable test run on my workstation
(which has a Ryzen 9 5950X) takes just over 38 seconds. I think that
the improvement is far more pronounced on that machine compared to a
much older workstation.
One more question about this, that wasn't covered by the Wiki page: is
there some equivalent to "make installcheck" with meson builds?
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-25 00:13 Andres Freund <andres@anarazel.de>
parent: Peter Geoghegan <pg@bowt.ie>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-25 00:13 UTC (permalink / raw)
To: Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-24 16:56:20 -0700, Peter Geoghegan wrote:
> On Thu, Sep 22, 2022 at 2:50 PM Andres Freund <andres@anarazel.de> wrote:
> > meson:
> >
> > time meson test
> > real 0m42.178s
> > user 7m8.533s
> > sys 2m17.711s
>
> I find that a more or less comparable test run on my workstation
> (which has a Ryzen 9 5950X) takes just over 38 seconds. I think that
> the improvement is far more pronounced on that machine compared to a
> much older workstation.
Cool!
> One more question about this, that wasn't covered by the Wiki page: is
> there some equivalent to "make installcheck" with meson builds?
Not yet. Nothing impossible, just not done yet. Partially because installcheck
is so poorly defined (run against an already running server for pg_regress vs
using "system" installed binaries for tap tests).
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-25 00:33 Peter Geoghegan <pg@bowt.ie>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Peter Geoghegan @ 2022-09-25 00:33 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Sat, Sep 24, 2022 at 5:13 PM Andres Freund <andres@anarazel.de> wrote:
> > One more question about this, that wasn't covered by the Wiki page: is
> > there some equivalent to "make installcheck" with meson builds?
>
> Not yet. Nothing impossible, just not done yet. Partially because installcheck
> is so poorly defined (run against an already running server for pg_regress vs
> using "system" installed binaries for tap tests).
Got it. I can work around that by just having an old autoconf-based
vpath build directory. I'll need to do this when I run Valgrind.
My workaround would be annoying if I needed to run "installcheck"
anywhere near as frequently as I run "make check-world". But that
isn't the case. meson delivers a significant improvement in the metric
that really matters to me, so I can't really complain.
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-25 19:38 Andres Freund <andres@anarazel.de>
parent: Peter Geoghegan <pg@bowt.ie>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-25 19:38 UTC (permalink / raw)
To: Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-24 17:33:49 -0700, Peter Geoghegan wrote:
> On Sat, Sep 24, 2022 at 5:13 PM Andres Freund <andres@anarazel.de> wrote:
> > > One more question about this, that wasn't covered by the Wiki page: is
> > > there some equivalent to "make installcheck" with meson builds?
> >
> > Not yet. Nothing impossible, just not done yet. Partially because installcheck
> > is so poorly defined (run against an already running server for pg_regress vs
> > using "system" installed binaries for tap tests).
>
> Got it. I can work around that by just having an old autoconf-based
> vpath build directory. I'll need to do this when I run Valgrind.
>
> My workaround would be annoying if I needed to run "installcheck"
> anywhere near as frequently as I run "make check-world". But that
> isn't the case. meson delivers a significant improvement in the metric
> that really matters to me, so I can't really complain.
My gut feeling is that we should use this opportunity to split 'installcheck'
into two. "test a running server" and "test installed binaries".
I think the cleanest way to do this with meson would be to utilize meson
tests's "setups".
$ meson test --setup 'running-server'
would run all [selected] tests compatible with running against a running
server. And
$ meson test --setup 'installed'
would test installed binaries.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 00:38 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 3 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-26 00:38 UTC (permalink / raw)
To: Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-25 12:38:06 -0700, Andres Freund wrote:
> On 2022-09-24 17:33:49 -0700, Peter Geoghegan wrote:
> > On Sat, Sep 24, 2022 at 5:13 PM Andres Freund <andres@anarazel.de> wrote:
> > > > One more question about this, that wasn't covered by the Wiki page: is
> > > > there some equivalent to "make installcheck" with meson builds?
> > >
> > > Not yet. Nothing impossible, just not done yet. Partially because installcheck
> > > is so poorly defined (run against an already running server for pg_regress vs
> > > using "system" installed binaries for tap tests).
> >
> > Got it. I can work around that by just having an old autoconf-based
> > vpath build directory. I'll need to do this when I run Valgrind.
> >
> > My workaround would be annoying if I needed to run "installcheck"
> > anywhere near as frequently as I run "make check-world". But that
> > isn't the case. meson delivers a significant improvement in the metric
> > that really matters to me, so I can't really complain.
>
> My gut feeling is that we should use this opportunity to split 'installcheck'
> into two. "test a running server" and "test installed binaries".
>
> I think the cleanest way to do this with meson would be to utilize meson
> tests's "setups".
> $ meson test --setup 'running-server'
> would run all [selected] tests compatible with running against a running
> server. And
> $ meson test --setup 'installed'
> would test installed binaries.
I've added support for a 'running' setup in the attached rebased series. A
bunch of preparatory changes were necessary - as it turns out we've introduced
a bunch of role name conflicts between tests.
I had to set it up so that the main regress and isolationtester tests don't
run in parallel with other tests, because they don't pass reliably due to
checking pg_locks etc.
I also found a problem independent of meson [1] / installcheck.
# run all tests that support running against existing server
meson test --setup running
# run just the main pg_regress tests against existing server
meson test --setup running main/regress-running
I've also worked some more on cleaning up other patches in the series,
particularly the precompiled headers one (interesting because it reduces
windows compile times noticably).
Peter, would this address your use case?
I think it'd make sense to add a few toplevel targets to run tests in certain
ways, but I've not done that here.
Greetings,
Andres Freund
[1] https://postgr.es/m/20220925232237.p6uskba2dw6fnwj2%40awork3.anarazel.de
Attachments:
[text/x-diff] v16-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch (5.5K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/2-v16-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch)
download | inline diff:
From 30d9c004dc001790e3df871805b6c9943e948f46 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 20:36:36 -0700
Subject: [PATCH v16 01/16] meson: ci: wip: move compilerwarnings task to meson
---
.cirrus.yml | 92 +++++++++++++-------------
src/tools/ci/linux-mingw-w64-64bit.txt | 13 ++++
2 files changed, 59 insertions(+), 46 deletions(-)
create mode 100644 src/tools/ci/linux-mingw-w64-64bit.txt
diff --git a/.cirrus.yml b/.cirrus.yml
index 7b5cb021027..eb33fdc4855 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -465,6 +465,10 @@ task:
ccache_cache:
folder: $CCACHE_DIR
+ ccache_stats_start_script:
+ ccache -s
+ ccache -z
+
setup_additional_packages_script: |
#apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y install ...
@@ -473,8 +477,6 @@ task:
# Test that code can be built with gcc/clang without warnings
###
- setup_script: echo "COPT=-Werror" > src/Makefile.custom
-
# Trace probes have a history of getting accidentally broken. Use the
# different compilers to build with different combinations of dtrace on/off
# and cassert on/off.
@@ -482,57 +484,58 @@ task:
# gcc, cassert off, dtrace on
always:
gcc_warning_script: |
- time ./configure \
- --cache gcc.cache \
- --enable-dtrace \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ mkdir build && cd build
+ CC="ccache gcc" CXX="ccache g++" \
+ meson setup \
+ -Dwerror=true \
+ -Dcassert=false \
+ -Ddtrace=enabled \
+ ${LINUX_MESON_FEATURES} \
+ ..
+ time ninja -j${BUILD_JOBS}
# gcc, cassert on, dtrace off
always:
gcc_a_warning_script: |
- time ./configure \
- --cache gcc.cache \
- --enable-cassert \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ cd build
+ meson configure \
+ -Dcassert=true \
+ -Ddtrace=disabled
+ time ninja -j${BUILD_JOBS}
# clang, cassert off, dtrace off
always:
clang_warning_script: |
- time ./configure \
- --cache clang.cache \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ rm -rf build
+ mkdir build && cd build
+ CC="ccache clang" CXX="ccache clang++" \
+ meson setup \
+ -Dwerror=true \
+ -Dcassert=false \
+ -Ddtrace=disabled \
+ ${LINUX_MESON_FEATURES} \
+ ..
+ time ninja -j${BUILD_JOBS}
# clang, cassert on, dtrace on
always:
clang_a_warning_script: |
- time ./configure \
- --cache clang.cache \
- --enable-cassert \
- --enable-dtrace \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ cd build
+ meson configure \
+ -Dcassert=true \
+ -Ddtrace=enabled
+ time ninja -j${BUILD_JOBS}
# cross-compile to windows
always:
mingw_cross_warning_script: |
- time ./configure \
- --host=x86_64-w64-mingw32 \
- --enable-cassert \
- CC="ccache x86_64-w64-mingw32-gcc" \
- CXX="ccache x86_64-w64-mingw32-g++"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ mkdir build-w64 && cd build-w64
+ meson setup \
+ --cross-file=../src/tools/ci/linux-mingw-w64-64bit.txt \
+ -Dwerror=true \
+ -Dcassert=true \
+ ..
+ time ninja -j${BUILD_JOBS}
###
# Verify docs can be built
@@ -540,13 +543,8 @@ task:
# XXX: Only do this if there have been changes in doc/ since last build
always:
docs_build_script: |
- time ./configure \
- --cache gcc.cache \
- CC="ccache gcc" \
- CXX="ccache g++" \
- CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} -C doc
+ cd build
+ time ninja docs
###
# Verify headerscheck / cpluspluscheck succeed
@@ -563,11 +561,13 @@ task:
${LINUX_CONFIGURE_FEATURES} \
--without-icu \
--quiet \
- CC="gcc" CXX"=g++" CLANG="clang"
- make -s -j${BUILD_JOBS} clean
+ CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
+ make -s -j${BUILD_JOBS} world-bin
time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
headers_cpluspluscheck_script: |
time make -s cpluspluscheck EXTRAFLAGS='-fmax-errors=10'
always:
+ ccache_stats_end_script:
+ ccache -s
upload_caches: ccache
diff --git a/src/tools/ci/linux-mingw-w64-64bit.txt b/src/tools/ci/linux-mingw-w64-64bit.txt
new file mode 100644
index 00000000000..9d43b6dcfbc
--- /dev/null
+++ b/src/tools/ci/linux-mingw-w64-64bit.txt
@@ -0,0 +1,13 @@
+[binaries]
+c = ['ccache', '/usr/bin/x86_64-w64-mingw32-gcc']
+cpp = ['ccache', '/usr/bin/x86_64-w64-mingw32-g++']
+ar = '/usr/bin/x86_64-w64-mingw32-ar'
+strip = '/usr/bin/x86_64-w64-mingw32-strip'
+pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
+windres = '/usr/bin/x86_64-w64-mingw32-windres'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch (17.1K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/3-v16-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch)
download | inline diff:
From 24ee6cfac5af51983da53ca8ee720974eba8d5b3 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 22:08:00 -0700
Subject: [PATCH v16 02/16] meson: ci: dontmerge: Add additional CI coverage
This is part of the series to be able to test meson on more platforms than
normally part of CI.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Justin Pryzby <pryzby@telsasoft.com>
---
.cirrus.yml | 322 +++++++++++++++++-
src/tools/ci/docker/linux_centos7 | 57 ++++
src/tools/ci/docker/linux_centos8 | 54 +++
src/tools/ci/docker/linux_fedora_rawhide | 49 +++
src/tools/ci/docker/linux_opensuse_tumbleweed | 56 +++
5 files changed, 522 insertions(+), 16 deletions(-)
create mode 100644 src/tools/ci/docker/linux_centos7
create mode 100644 src/tools/ci/docker/linux_centos8
create mode 100644 src/tools/ci/docker/linux_fedora_rawhide
create mode 100644 src/tools/ci/docker/linux_opensuse_tumbleweed
diff --git a/.cirrus.yml b/.cirrus.yml
index eb33fdc4855..efb2d2c4832 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -126,6 +126,90 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ env:
+ CPUS: 2
+ BUILD_JOBS: 3
+ TEST_JOBS: 3
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+
+ # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+ # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+
+ matrix:
+ - name: NetBSD - 9 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+ env:
+ IMAGE_NAME: pg-ci-netbsd-9-postgres
+ PLATFORM: netbsd
+ INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include
+
+ - name: OpenBSD - 7 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+ env:
+ IMAGE_NAME: pg-ci-openbsd-7-postgres
+ PLATFORM: openbsd
+ INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
+ UUID: -Duuid=e2fs
+
+ compute_engine_instance:
+ image_project: $IMAGE_PROJECT
+ image: family/${IMAGE_NAME}
+ platform: ${PLATFORM}
+ cpu: $CPUS
+ memory: 4G
+ disk: 25
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ export
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on netBSD & openBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on netBSD
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl ${UUID} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ ${INCLUDE_DIRS} \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
@@ -152,6 +236,22 @@ LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
-Duuid=e2fs
+# configure preparation scripts, shared between tasks running the linux tests
+linux_preparation_scripts_template: &linux_preparation_scripts_template
+ sysinfo_script: |
+ id
+ uname -a
+ cat /proc/cmdline
+ ulimit -a -H && ulimit -a -S
+ export
+ create_user_script: |
+ useradd -m -U postgres
+ chown -R postgres:postgres .
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:postgres ${CCACHE_DIR}
+ su postgres -c "ulimit -l -H && ulimit -l -S"
+
+
task:
env:
CPUS: 4
@@ -181,19 +281,9 @@ task:
ccache_cache:
folder: ${CCACHE_DIR}
- sysinfo_script: |
- id
- uname -a
- cat /proc/cmdline
- ulimit -a -H && ulimit -a -S
- export
- create_user_script: |
- useradd -m postgres
- chown -R postgres:postgres .
- mkdir -p ${CCACHE_DIR}
- chown -R postgres:postgres ${CCACHE_DIR}
+ set_limits_script: |
echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
- su postgres -c "ulimit -l -H && ulimit -l -S"
+ <<: *linux_preparation_scripts_template
setup_core_files_script: |
mkdir -m 770 /tmp/cores
chown root:postgres /tmp/cores
@@ -227,7 +317,13 @@ task:
on_failure:
<<: *on_failure_ac
- - name: Linux - Debian Bullseye - Meson
+ - matrix:
+ - name: Linux - Debian Bullseye - Meson
+ - name: Linux - Debian Sid - Meson
+ trigger_type: manual
+
+ compute_engine_instance:
+ image: family/pg-ci-sid
configure_script: |
su postgres <<-EOF
@@ -255,6 +351,81 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
+task:
+ env:
+ CPUS: 4
+ BUILD_JOBS: 4
+ TEST_JOBS: 8 # experimentally derived to be a decent choice
+
+ CCACHE_DIR: /tmp/ccache_dir
+ DEBUGINFOD_URLS: ${DEBUGINFO}
+
+ TCL_DIR: /usr/lib64/
+ UUID: e2fs
+
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
+ LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
+
+ container:
+ dockerfile: ${DOCKERFILE_PATH}
+ cpu: $CPUS
+ memory: 4G
+
+ ccache_cache:
+ folder: ${CCACHE_DIR}
+
+ <<: *linux_preparation_scripts_template
+
+ matrix:
+ - name: Linux - OpenSuse Tumbleweed (LLVM) - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_opensuse_tumbleweed
+ DEBUGINFO: "https://debuginfod.opensuse.org/"
+ LLVM: -Dllvm=enabled
+
+ - trigger_type: manual
+ matrix:
+ - name: Linux - Fedora Rawhide - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_fedora_rawhide
+ DEBUGINFO: "https://debuginfod.fedoraproject.org/"
+
+ - name: Linux - Centos 8 - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ - name: Linux - Centos 7 - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl -Duuid=e2fs ${LLVM} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
task:
name: macOS - Monterey - Meson
@@ -355,9 +526,7 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
-task:
- name: Windows - Server 2019, VS 2019 - Meson & ninja
-
+windows_template: &windows_template
env:
# Half the allowed per-user CPU cores
CPUS: 4
@@ -373,6 +542,20 @@ task:
# Avoids port conflicts between concurrent tap test runs
PG_TEST_USE_UNIX_SOCKETS: 1
PG_REGRESS_SOCK_DIR: "c:/cirrus/"
+ # -m enables parallelism
+ # verbosity:minimal + Summary reduce verbosity, while keeping a summary of
+ # errors/warnings
+ # ForceNoAlign prevents msbuild from introducing line-breaks for long lines
+ # disable file tracker, we're never going to rebuild, and it slows down the
+ # build
+ MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo
+
+ # If tests hang forever, cirrus eventually times out. In that case log
+ # output etc is not uploaded, making the problem hard to debug. Of course
+ # tests internally should have shorter timeouts, but that's proven to not
+ # be sufficient. 15min currently is fast enough to finish individual test
+ # "suites".
+ T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m"
# startcreate_script starts a postgres instance that we don't want to get
# killed at the end of that script (it's stopped in stop_script). Can't
@@ -406,6 +589,16 @@ task:
setup_additional_packages_script: |
REM choco install -y --no-progress ...
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & ninja
+
+ meson_install_wraps_script: |
+ mkdir subprojects
+ meson wrap install lz4
+ meson wrap install zlib
+
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
@@ -426,6 +619,103 @@ task:
type: text/plain
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & msbuild
+
+ meson_install_wraps_script: |
+ mkdir subprojects
+ meson wrap install lz4
+ meson wrap install zlib
+
+ configure_script: |
+ vcvarsall x64
+ meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+
+ build_script: |
+ vcvarsall x64
+ msbuild %MSBFLAGS% build\postgresql.sln
+
+ check_world_script: |
+ vcvarsall x64
+ meson test %MTEST_ARGS% --num-processes %TEST_JOBS%
+
+ on_failure:
+ <<: *on_failure_meson
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+ type: text/plain
+
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Homegrown
+
+ env:
+ # Our windows infrastructure doesn't have test concurrency above the level
+ # of a single vcregress test target. Due to that, it's useful to run prove
+ # with multiple jobs. For the other tasks it isn't, because two sources
+ # (make and prove) of concurrency can overload machines.
+ #
+ # The concrete choice of 10 is based on a small bit of experimentation and
+ # likely can be improved upon further.
+ PROVE_FLAGS: -j10 --timer
+
+ configure_script:
+ # copy errors out when using forward slashes
+ - copy src\tools\ci\windows_build_config.pl src\tools\msvc\config.pl
+ - vcvarsall x64
+ - perl src/tools/msvc/mkvcbuild.pl
+ build_script:
+ - vcvarsall x64
+ - msbuild %MSBFLAGS% pgsql.sln
+ tempinstall_script:
+ # Installation on windows currently only completely works from src/tools/msvc
+ - cd src/tools/msvc && perl install.pl %CIRRUS_WORKING_DIR%/tmp_install
+
+ test_regress_parallel_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl check parallel
+ startcreate_script: |
+ rem paths to binaries need backslashes
+ tmp_install\bin\pg_ctl.exe initdb -D tmp_check/db -l tmp_check/initdb.log --options=--no-sync
+ echo include '%TEMP_CONFIG%' >> tmp_check/db/postgresql.conf
+ tmp_install\bin\pg_ctl.exe start -D tmp_check/db -l tmp_check/postmaster.log
+
+ test_pl_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl plcheck
+ test_isolation_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl isolationcheck
+ test_modules_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl modulescheck
+ test_contrib_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl contribcheck
+ stop_script: |
+ tmp_install\bin\pg_ctl.exe stop -D tmp_check/db -l tmp_check/postmaster.log
+ test_ssl_script: |
+ set with_ssl=openssl
+ %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/ssl/
+ test_subscription_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/subscription/
+ test_authentication_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/authentication/
+ test_recovery_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl recoverycheck
+ test_bin_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl bincheck
+ test_ecpg_script: |
+ rem tries to build additional stuff
+ vcvarsall x64
+ rem References ecpg_regression.proj in the current dir
+ cd src/tools/msvc
+ %T_C% perl vcregress.pl ecpgcheck
+
+ on_failure:
+ <<: *on_failure_ac
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+ type: text/plain
+
+
task:
name: CompilerWarnings
diff --git a/src/tools/ci/docker/linux_centos7 b/src/tools/ci/docker/linux_centos7
new file mode 100644
index 00000000000..3742890d961
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos7
@@ -0,0 +1,57 @@
+FROM centos:centos7
+# Enable powertools, EPEL and devtoolset repository
+RUN \
+ yum -y install dnf-plugins-core \
+ epel-release \
+ centos-release-scl-rh && \
+ \
+ yum -y update && \
+ yum -y install \
+ \
+ git \
+ perl \
+ perl-ExtUtils-Embed \
+ perl-IPC-Run \
+ perl-Test-Harness \
+ perl-Test-Simple \
+ \
+ bison \
+ ccache \
+ clang \
+ devtoolset-7-make \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ && \
+ pip3 install meson && \
+ pip3 install ninja && \
+ yum clean all
+
+# Make version is 3.82 but required is > 4, adding devtoolset-7-make to the PATH
+ENV PATH="/opt/rh/devtoolset-7/root/usr/bin/:${PATH}"
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_centos8 b/src/tools/ci/docker/linux_centos8
new file mode 100644
index 00000000000..58f95847ef1
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos8
@@ -0,0 +1,54 @@
+FROM quay.io/centos/centos:stream8
+# Enable powertools and EPEL repository
+RUN \
+ dnf -y install dnf-plugins-core && \
+ dnf config-manager --set-enabled powertools && \
+ dnf -y install epel-release && \
+ dnf -y update && \
+ dnf -y install \
+ \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ diffutils \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ glibc-langpack-en \
+ \
+ && \
+ pip3 install ninja && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_fedora_rawhide b/src/tools/ci/docker/linux_fedora_rawhide
new file mode 100644
index 00000000000..c95027cd6a7
--- /dev/null
+++ b/src/tools/ci/docker/linux_fedora_rawhide
@@ -0,0 +1,49 @@
+FROM fedora:rawhide
+RUN \
+ dnf -y update && \
+ dnf -y install \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gettext \
+ ninja-build \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ langpacks-en \
+ glibc-langpack-en \
+ \
+ && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_opensuse_tumbleweed b/src/tools/ci/docker/linux_opensuse_tumbleweed
new file mode 100644
index 00000000000..07364ee85ff
--- /dev/null
+++ b/src/tools/ci/docker/linux_opensuse_tumbleweed
@@ -0,0 +1,56 @@
+FROM opensuse/tumbleweed
+RUN \
+ zypper -n clean -a && \
+ zypper -n ref && \
+ zypper -n dup && \
+ zypper -n update && \
+ zypper -n install \
+ diffutils \
+ git \
+ icu \
+ make \
+ meson \
+ perl-IPC-Run \
+ shadow \
+ systemd-devel \
+ util-linux \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gcc-c++ \
+ gettext-runtime \
+ ninja \
+ \
+ krb5-devel \
+ libicu-devel \
+ libldapcpp-devel \
+ liblz4-devel \
+ libopenssl-devel \
+ libselinux-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ pam-devel \
+ python38-devel \
+ readline-devel \
+ tcl-devel \
+ \
+ openldap2 \
+ openldap2-client \
+ \
+ krb5-client \
+ krb5-plugin-kdb-ldap \
+ krb5-server \
+ lz4 \
+ zstd \
+ \
+ && \
+ zypper -n clean -a
+
+# Fixing ICU errors caused by locale being set to 'POSIX'
+ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0003-meson-prereq-win-remove-date-from-version-number.patch (1.8K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/4-v16-0003-meson-prereq-win-remove-date-from-version-number.patch)
download | inline diff:
From 3f3442a76e2b628f7d2feec6419dded7a84bebf7 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 14 Sep 2022 16:43:47 -0700
Subject: [PATCH v16 03/16] meson: prereq: win: remove date from version number
in win32ver.rc
This may have served a purpose at some point, but these days it just
contributes to a non-reproducible build.
Discussion: https://postgr.es/m/1cef5b48-32bd-5cbf-fb62-fb648860f5ef@enterprisedb.com
---
src/makefiles/Makefile.win32 | 1 -
src/tools/msvc/Project.pm | 5 -----
2 files changed, 6 deletions(-)
diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
index 17d68196442..d268b3ebafd 100644
--- a/src/makefiles/Makefile.win32
+++ b/src/makefiles/Makefile.win32
@@ -69,7 +69,6 @@ win32ver.rc: $(top_srcdir)/src/port/win32ver.rc
sed -e 's;FILEDESC;$(PGFILEDESC);' \
-e 's;VFT_APP;$(PGFTYPE);' \
-e 's;_ICO_;$(PGICOSTR);' \
- -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' \
-e '/_INTERNAL_NAME_/$(if $(shlib),s;_INTERNAL_NAME_;"$(basename $(shlib))";,d)' \
-e '/_ORIGINAL_NAME_/$(if $(shlib),s;_ORIGINAL_NAME_;"$(shlib)";,d)' \
$< >$@
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index b24a2a98155..ec449c864c1 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -367,10 +367,6 @@ sub AddResourceFile
{
my ($self, $dir, $desc, $ico) = @_;
- my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
- localtime(time);
- my $d = sprintf("%02d%03d", ($year - 100), $yday);
-
if (Solution::IsNewer("$dir/win32ver.rc", 'src/port/win32ver.rc'))
{
print "Generating win32ver.rc for $dir\n";
@@ -383,7 +379,6 @@ sub AddResourceFile
{
s/FILEDESC/"$desc"/gm;
s/_ICO_/$icostr/gm;
- s/(VERSION.*),0/$1,$d/;
if ($self->{type} eq "dll")
{
s/VFT_APP/VFT_DLL/gm;
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0004-meson-Add-windows-resource-files.patch (93.9K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/5-v16-0004-meson-Add-windows-resource-files.patch)
download | inline diff:
From 3eb0ca196084da314d94d1e51c7b775012a4773c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 11:03:07 -0700
Subject: [PATCH v16 04/16] meson: Add windows resource files
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
---
src/backend/jit/llvm/meson.build | 6 +
.../replication/libpqwalreceiver/meson.build | 6 +
src/backend/replication/pgoutput/meson.build | 6 +
src/backend/snowball/meson.build | 6 +
.../utils/mb/conversion_procs/meson.build | 144 ++++++++++++++----
src/bin/initdb/meson.build | 6 +
src/bin/pg_amcheck/meson.build | 8 +-
src/bin/pg_archivecleanup/meson.build | 12 +-
src/bin/pg_basebackup/meson.build | 38 ++++-
src/bin/pg_checksums/meson.build | 12 +-
src/bin/pg_config/meson.build | 12 +-
src/bin/pg_controldata/meson.build | 12 +-
src/bin/pg_ctl/meson.build | 12 +-
src/bin/pg_dump/meson.build | 18 +++
src/bin/pg_resetwal/meson.build | 12 +-
src/bin/pg_rewind/meson.build | 6 +
src/bin/pg_test_fsync/meson.build | 10 +-
src/bin/pg_test_timing/meson.build | 12 +-
src/bin/pg_upgrade/meson.build | 6 +
src/bin/pg_verifybackup/meson.build | 6 +
src/bin/pg_waldump/meson.build | 6 +
src/bin/pgbench/meson.build | 6 +
src/bin/pgevent/meson.build | 6 +
src/bin/psql/meson.build | 6 +
src/bin/scripts/meson.build | 10 +-
src/interfaces/libpq/meson.build | 5 +
src/interfaces/libpq/test/meson.build | 25 ++-
src/pl/plperl/meson.build | 7 +
src/pl/plpgsql/src/meson.build | 6 +
src/pl/plpython/meson.build | 6 +
src/pl/tcl/meson.build | 6 +
contrib/adminpack/meson.build | 12 +-
contrib/amcheck/meson.build | 17 ++-
contrib/auth_delay/meson.build | 12 +-
contrib/auto_explain/meson.build | 12 +-
contrib/basebackup_to_shell/meson.build | 6 +
contrib/basic_archive/meson.build | 6 +
contrib/bloom/meson.build | 6 +
contrib/bool_plperl/meson.build | 6 +
contrib/btree_gin/meson.build | 12 +-
contrib/btree_gist/meson.build | 6 +
contrib/citext/meson.build | 6 +
contrib/cube/meson.build | 6 +
contrib/dblink/meson.build | 6 +
contrib/dict_int/meson.build | 12 +-
contrib/dict_xsyn/meson.build | 12 +-
contrib/earthdistance/meson.build | 12 +-
contrib/file_fdw/meson.build | 12 +-
contrib/fuzzystrmatch/meson.build | 16 +-
contrib/hstore/meson.build | 24 ++-
contrib/hstore_plperl/meson.build | 6 +
contrib/hstore_plpython/meson.build | 6 +
contrib/intarray/meson.build | 6 +
contrib/isn/meson.build | 6 +
contrib/jsonb_plperl/meson.build | 6 +
contrib/jsonb_plpython/meson.build | 6 +
contrib/lo/meson.build | 6 +
contrib/ltree/meson.build | 6 +
contrib/ltree_plpython/meson.build | 6 +
contrib/oid2name/meson.build | 12 +-
contrib/old_snapshot/meson.build | 6 +
contrib/pageinspect/meson.build | 6 +
contrib/passwordcheck/meson.build | 6 +
contrib/pg_buffercache/meson.build | 14 +-
contrib/pg_freespacemap/meson.build | 14 +-
contrib/pg_prewarm/meson.build | 16 +-
contrib/pg_stat_statements/meson.build | 12 +-
contrib/pg_surgery/meson.build | 14 +-
contrib/pg_trgm/meson.build | 20 ++-
contrib/pg_visibility/meson.build | 14 +-
contrib/pg_walinspect/meson.build | 6 +
contrib/pgcrypto/meson.build | 6 +
contrib/pgrowlocks/meson.build | 14 +-
contrib/pgstattuple/meson.build | 18 ++-
contrib/postgres_fdw/meson.build | 6 +
contrib/seg/meson.build | 6 +
contrib/sepgsql/meson.build | 6 +
contrib/spi/meson.build | 48 +++++-
contrib/sslinfo/meson.build | 14 +-
contrib/tablefunc/meson.build | 14 +-
contrib/tcn/meson.build | 14 +-
contrib/test_decoding/meson.build | 6 +
contrib/tsm_system_rows/meson.build | 14 +-
contrib/tsm_system_time/meson.build | 14 +-
contrib/unaccent/meson.build | 14 +-
contrib/uuid-ossp/meson.build | 14 +-
contrib/vacuumlo/meson.build | 12 +-
contrib/xml2/meson.build | 16 +-
src/interfaces/ecpg/compatlib/meson.build | 6 +-
src/interfaces/ecpg/preproc/meson.build | 6 +
src/interfaces/ecpg/test/meson.build | 6 +
src/test/isolation/meson.build | 13 ++
src/test/modules/delay_execution/meson.build | 13 +-
src/test/modules/dummy_index_am/meson.build | 13 +-
src/test/modules/dummy_seclabel/meson.build | 13 +-
src/test/modules/libpq_pipeline/meson.build | 14 +-
src/test/modules/plsample/meson.build | 13 +-
src/test/modules/spgist_name_ops/meson.build | 13 +-
.../ssl_passphrase_callback/meson.build | 13 +-
src/test/modules/test_bloomfilter/meson.build | 13 +-
src/test/modules/test_ddl_deparse/meson.build | 13 +-
.../modules/test_ginpostinglist/meson.build | 13 +-
src/test/modules/test_integerset/meson.build | 13 +-
src/test/modules/test_lfind/meson.build | 13 +-
src/test/modules/test_oat_hooks/meson.build | 13 +-
src/test/modules/test_parser/meson.build | 13 +-
src/test/modules/test_predtest/meson.build | 13 +-
src/test/modules/test_rbtree/meson.build | 13 +-
src/test/modules/test_regex/meson.build | 13 +-
src/test/modules/test_rls_hooks/meson.build | 13 +-
src/test/modules/test_shm_mq/meson.build | 19 ++-
src/test/modules/worker_spi/meson.build | 15 +-
src/test/regress/meson.build | 6 +
meson.build | 61 ++++++++
src/timezone/meson.build | 6 +
src/tools/rcgen | 99 ++++++++++++
116 files changed, 1383 insertions(+), 159 deletions(-)
create mode 100755 src/tools/rcgen
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index de2e624ab58..5fb63768358 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -20,6 +20,12 @@ llvmjit_sources += files(
'llvmjit_expr.c',
)
+if host_system == 'windows'
+ llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'llvmjit',
+ '--FILEDESC', 'llvmjit - JIT using LLVM',])
+endif
+
llvmjit = shared_module('llvmjit',
llvmjit_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
index 3fc786c80a0..4c653a05d36 100644
--- a/src/backend/replication/libpqwalreceiver/meson.build
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -2,6 +2,12 @@ libpqwalreceiver_sources = files(
'libpqwalreceiver.c',
)
+if host_system == 'windows'
+ libpqwalreceiver_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pqwalreceiver',
+ '--FILEDESC', 'libpqwalreceiver - receive WAL during streaming replication',])
+endif
+
libpqwalreceiver = shared_module('pqwalreceiver',
libpqwalreceiver_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
index ab956361a62..5df27d7b764 100644
--- a/src/backend/replication/pgoutput/meson.build
+++ b/src/backend/replication/pgoutput/meson.build
@@ -2,6 +2,12 @@ pgoutput_sources = files(
'pgoutput.c',
)
+if host_system == 'windows'
+ pgoutput_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgoutput',
+ '--FILEDESC', 'pgoutput - standard logical replication output plugin',])
+endif
+
pgoutput = shared_module('pgoutput',
pgoutput_sources,
kwargs: pg_mod_args,
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 8c6f685cb32..974401d187e 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -58,6 +58,12 @@ dict_snowball_sources += files(
# see comment in src/include/snowball/header.h
stemmer_inc = include_directories('../../include/snowball')
+if host_system == 'windows'
+ dict_snowball_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_snowball',
+ '--FILEDESC', 'snowball - natural language stemmers',])
+endif
+
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
index 1bc971d1945..00e721a2453 100644
--- a/src/backend/utils/mb/conversion_procs/meson.build
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -1,36 +1,122 @@
encodings = {
- 'cyrillic_and_mic': ['cyrillic_and_mic/cyrillic_and_mic.c'],
- 'euc2004_sjis2004': ['euc2004_sjis2004/euc2004_sjis2004.c'],
- 'euc_cn_and_mic': ['euc_cn_and_mic/euc_cn_and_mic.c'],
- 'euc_jp_and_sjis': ['euc_jp_and_sjis/euc_jp_and_sjis.c'],
- 'euc_kr_and_mic': ['euc_kr_and_mic/euc_kr_and_mic.c'],
- 'euc_tw_and_big5': [
- 'euc_tw_and_big5/euc_tw_and_big5.c',
- 'euc_tw_and_big5/big5.c',
- ],
- 'latin2_and_win1250': ['latin2_and_win1250/latin2_and_win1250.c'],
- 'latin_and_mic': ['latin_and_mic/latin_and_mic.c'],
- 'utf8_and_big5': ['utf8_and_big5/utf8_and_big5.c'],
- 'utf8_and_cyrillic': ['utf8_and_cyrillic/utf8_and_cyrillic.c'],
- 'utf8_and_euc2004': ['utf8_and_euc2004/utf8_and_euc2004.c'],
- 'utf8_and_euc_cn': ['utf8_and_euc_cn/utf8_and_euc_cn.c'],
- 'utf8_and_euc_jp': ['utf8_and_euc_jp/utf8_and_euc_jp.c'],
- 'utf8_and_euc_kr': ['utf8_and_euc_kr/utf8_and_euc_kr.c'],
- 'utf8_and_euc_tw': ['utf8_and_euc_tw/utf8_and_euc_tw.c'],
- 'utf8_and_gb18030': ['utf8_and_gb18030/utf8_and_gb18030.c'],
- 'utf8_and_gbk': ['utf8_and_gbk/utf8_and_gbk.c'],
- 'utf8_and_iso8859': ['utf8_and_iso8859/utf8_and_iso8859.c'],
- 'utf8_and_iso8859_1': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'],
- 'utf8_and_johab': ['utf8_and_johab/utf8_and_johab.c'],
- 'utf8_and_sjis': ['utf8_and_sjis/utf8_and_sjis.c'],
- 'utf8_and_sjis2004': ['utf8_and_sjis2004/utf8_and_sjis2004.c'],
- 'utf8_and_uhc': ['utf8_and_uhc/utf8_and_uhc.c'],
- 'utf8_and_win': ['utf8_and_win/utf8_and_win.c'],
+ 'cyrillic_and_mic': {
+ 'sources': ['cyrillic_and_mic/cyrillic_and_mic.c'],
+ 'description': 'cyrillic <-> mic text conversions',
+ },
+ 'euc2004_sjis2004': {
+ 'sources': ['euc2004_sjis2004/euc2004_sjis2004.c'],
+ 'description': 'euc2004 <-> sjis2004 text conversions',
+ },
+ 'euc_cn_and_mic': {
+ 'sources': ['euc_cn_and_mic/euc_cn_and_mic.c'],
+ 'description': 'euc_cn <-> mic text conversions',
+ },
+ 'euc_jp_and_sjis': {
+ 'sources': ['euc_jp_and_sjis/euc_jp_and_sjis.c'],
+ 'description': 'euc_jp <-> sjis text conversions',
+ },
+ 'euc_kr_and_mic': {
+ 'sources': ['euc_kr_and_mic/euc_kr_and_mic.c'],
+ 'description': 'euc_kr <-> mic text conversions',
+ },
+ 'euc_tw_and_big5': {
+ 'sources': [
+ 'euc_tw_and_big5/euc_tw_and_big5.c',
+ 'euc_tw_and_big5/big5.c',
+ ],
+ 'description': 'euc_tw <-> big5 text conversions',
+ },
+ 'latin2_and_win1250': {
+ 'sources': ['latin2_and_win1250/latin2_and_win1250.c'],
+ 'description': 'latin2 <-> win1250 text conversions',
+ },
+ 'latin_and_mic': {
+ 'sources': ['latin_and_mic/latin_and_mic.c'],
+ 'description': 'latin <-> mic text conversions',
+ },
+ 'utf8_and_big5': {
+ 'sources': ['utf8_and_big5/utf8_and_big5.c'],
+ 'description': 'utf8 <-> big5 text conversions',
+ },
+ 'utf8_and_cyrillic': {
+ 'sources': ['utf8_and_cyrillic/utf8_and_cyrillic.c'],
+ 'description': 'utf8 <-> cyrillic text conversions',
+ },
+ 'utf8_and_euc2004': {
+ 'sources': ['utf8_and_euc2004/utf8_and_euc2004.c'],
+ 'description': 'utf8 <-> euc2004 text conversions',
+ },
+ 'utf8_and_euc_cn': {
+ 'sources': ['utf8_and_euc_cn/utf8_and_euc_cn.c'],
+ 'description': 'utf8 <-> euc_cn text conversions',
+ },
+ 'utf8_and_euc_jp': {
+ 'sources': ['utf8_and_euc_jp/utf8_and_euc_jp.c'],
+ 'description': 'utf8 <-> euc_jp text conversions',
+ },
+ 'utf8_and_euc_kr': {
+ 'sources': ['utf8_and_euc_kr/utf8_and_euc_kr.c'],
+ 'description': 'utf8 <-> euc_kr text conversions',
+ },
+ 'utf8_and_euc_tw': {
+ 'sources': ['utf8_and_euc_tw/utf8_and_euc_tw.c'],
+ 'description': 'utf8 <-> euc_tw text conversions',
+ },
+ 'utf8_and_gb18030': {
+ 'sources': ['utf8_and_gb18030/utf8_and_gb18030.c'],
+ 'description': 'utf8 <-> gb18030 text conversions',
+ },
+ 'utf8_and_gbk': {
+ 'sources': ['utf8_and_gbk/utf8_and_gbk.c'],
+ 'description': 'utf8 <-> gbk text conversions',
+ },
+ 'utf8_and_iso8859': {
+ 'sources': ['utf8_and_iso8859/utf8_and_iso8859.c'],
+ 'description': 'utf8 <-> iso8859 text conversions',
+ },
+ 'utf8_and_iso8859_1': {
+ 'sources': ['utf8_and_iso8859_1/utf8_and_iso8859_1.c'],
+ 'description': 'utf8 <-> iso8859_1 text conversions',
+ },
+ 'utf8_and_johab': {
+ 'sources': ['utf8_and_johab/utf8_and_johab.c'],
+ 'description': 'utf8 <-> johab text conversions',
+ },
+ 'utf8_and_sjis': {
+ 'sources': ['utf8_and_sjis/utf8_and_sjis.c'],
+ 'description': 'utf8 <-> sjis text conversions',
+ },
+ 'utf8_and_sjis2004': {
+ 'sources': ['utf8_and_sjis2004/utf8_and_sjis2004.c'],
+ 'description': 'utf8 <-> sjis2004 text conversions',
+ },
+ 'utf8_and_uhc': {
+ 'sources': ['utf8_and_uhc/utf8_and_uhc.c'],
+ 'description': 'utf8 <-> uhc text conversions',
+ },
+ 'utf8_and_win': {
+ 'sources': ['utf8_and_win/utf8_and_win.c'],
+ 'description': 'utf8 <-> win text conversions',
+ },
}
-foreach encoding, sources : encodings
+foreach encoding, values: encodings
+ sources = values['sources']
+ description = values['description']
+
+ source_files = files()
+ foreach source: sources
+ source_files += files(source)
+ endforeach
+
+ if host_system == 'windows'
+ source_files += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', encoding,
+ '--FILEDESC', description,])
+ endif
+
backend_targets += shared_module(encoding,
- sources,
+ source_files,
kwargs: pg_mod_args,
)
endforeach
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
index 9f213274d2f..6ced9a31b80 100644
--- a/src/bin/initdb/meson.build
+++ b/src/bin/initdb/meson.build
@@ -7,6 +7,12 @@ initdb_sources += timezone_localtime_source
#fixme: reimplement libpq_pgport logic
+if host_system == 'windows'
+ initdb_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'initdb',
+ '--FILEDESC', 'initdb - initialize a new database cluster',])
+endif
+
initdb = executable('initdb',
initdb_sources,
include_directories: [timezone_inc],
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
index 8e197eba5f3..25f5e7a0948 100644
--- a/src/bin/pg_amcheck/meson.build
+++ b/src/bin/pg_amcheck/meson.build
@@ -1,7 +1,13 @@
pg_amcheck_sources = files(
- 'pg_amcheck.c'
+ 'pg_amcheck.c',
)
+if host_system == 'windows'
+ pg_amcheck_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_amcheck',
+ '--FILEDESC', 'pg_amcheck - detect corruption within database relations',])
+endif
+
pg_amcheck = executable('pg_amcheck',
pg_amcheck_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
index 87a0d980c4f..aaa2e76977f 100644
--- a/src/bin/pg_archivecleanup/meson.build
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -1,5 +1,15 @@
+pg_archivecleanup_sources = files(
+ 'pg_archivecleanup.c',
+)
+
+if host_system == 'windows'
+ pg_archivecleanup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_archivecleanup',
+ '--FILEDESC', 'pg_archivecleanup - cleans archive when used with streaming replication',])
+endif
+
pg_archivecleanup = executable('pg_archivecleanup',
- ['pg_archivecleanup.c'],
+ pg_archivecleanup_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
index d26fed9cd8a..2c934e0c26e 100644
--- a/src/bin/pg_basebackup/meson.build
+++ b/src/bin/pg_basebackup/meson.build
@@ -17,24 +17,56 @@ pg_basebackup_common = static_library('libpg_basebackup_common',
kwargs: internal_lib_args,
)
-pg_basebackup = executable('pg_basebackup',
+pg_basebackup_sources = files(
'pg_basebackup.c',
+)
+
+if host_system == 'windows'
+ pg_basebackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_basebackup',
+ '--FILEDESC', 'pg_basebackup - streaming WAL and backup receivers',])
+endif
+
+pg_basebackup = executable('pg_basebackup',
+ pg_basebackup_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_basebackup
-pg_receivewal = executable('pg_receivewal',
+
+pg_receivewal_sources = files(
'pg_receivewal.c',
+)
+
+if host_system == 'windows'
+ pg_receivewal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_receivewal',
+ '--FILEDESC', 'pg_receivewal - streaming WAL and backup receivers',])
+endif
+
+pg_receivewal = executable('pg_receivewal',
+ pg_receivewal_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_receivewal
-pg_recvlogical = executable('pg_recvlogical',
+
+pg_recvlogical_sources = files(
'pg_recvlogical.c',
+)
+
+if host_system == 'windows'
+ pg_recvlogical_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_recvlogical',
+ '--FILEDESC', 'pg_recvlogical - streaming WAL and backup receivers',])
+endif
+
+pg_recvlogical = executable('pg_recvlogical',
+ pg_recvlogical_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
index ee1f367bac3..d07ebc999b3 100644
--- a/src/bin/pg_checksums/meson.build
+++ b/src/bin/pg_checksums/meson.build
@@ -1,5 +1,15 @@
+pg_checksums_sources = files(
+ 'pg_checksums.c',
+)
+
+if host_system == 'windows'
+ pg_checksums_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_checksums',
+ '--FILEDESC', 'pg_checksums - verify data checksums in an offline cluster',])
+endif
+
pg_checksums = executable('pg_checksums',
- ['pg_checksums.c'],
+ pg_checksums_sources,
include_directories: [timezone_inc],
dependencies: [frontend_code],
kwargs: default_bin_args,
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
index 0ecbf2f9d28..4be2fdc84ae 100644
--- a/src/bin/pg_config/meson.build
+++ b/src/bin/pg_config/meson.build
@@ -1,5 +1,15 @@
+pg_config_sources = files(
+ 'pg_config.c',
+)
+
+if host_system == 'windows'
+ pg_config_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_config',
+ '--FILEDESC', 'pg_config - report configuration information',])
+endif
+
pg_config = executable('pg_config',
- ['pg_config.c'],
+ pg_config_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
index 557e672beb7..7fc239dbe65 100644
--- a/src/bin/pg_controldata/meson.build
+++ b/src/bin/pg_controldata/meson.build
@@ -1,5 +1,15 @@
+pg_controldata_sources = files(
+ 'pg_controldata.c',
+)
+
+if host_system == 'windows'
+ pg_controldata_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_controldata',
+ '--FILEDESC', 'pg_controldata - reads the data from pg_control',])
+endif
+
pg_controldata = executable('pg_controldata',
- ['pg_controldata.c'],
+ pg_controldata_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
index 6812e73e329..96f962fa762 100644
--- a/src/bin/pg_ctl/meson.build
+++ b/src/bin/pg_ctl/meson.build
@@ -1,5 +1,15 @@
+pg_ctl_sources = files(
+ 'pg_ctl.c',
+)
+
+if host_system == 'windows'
+ pg_ctl_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_ctl',
+ '--FILEDESC', 'pg_ctl - starts/stops/restarts the PostgreSQL server',])
+endif
+
pg_ctl = executable('pg_ctl',
- ['pg_ctl.c'],
+ pg_ctl_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 785ec094dbd..3527a25c288 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -24,6 +24,12 @@ pg_dump_sources = files(
'pg_dump_sort.c',
)
+if host_system == 'windows'
+ pg_dump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dump',
+ '--FILEDESC', 'pg_dump - backup one PostgreSQL database',])
+endif
+
pg_dump = executable('pg_dump',
pg_dump_sources,
link_with: [pg_dump_common],
@@ -37,6 +43,12 @@ pg_dumpall_sources = files(
'pg_dumpall.c',
)
+if host_system == 'windows'
+ pg_dumpall_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dumpall',
+ '--FILEDESC', 'pg_dumpall - backup PostgreSQL databases'])
+endif
+
pg_dumpall = executable('pg_dumpall',
pg_dumpall_sources,
link_with: [pg_dump_common],
@@ -50,6 +62,12 @@ pg_restore_sources = files(
'pg_restore.c',
)
+if host_system == 'windows'
+ pg_restore_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_restore',
+ '--FILEDESC', 'pg_restore - restore PostgreSQL databases'])
+endif
+
pg_restore = executable('pg_restore',
pg_restore_sources,
link_with: [pg_dump_common],
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
index 7c5de134ac0..d503db97b71 100644
--- a/src/bin/pg_resetwal/meson.build
+++ b/src/bin/pg_resetwal/meson.build
@@ -1,5 +1,15 @@
+pg_resetwal_sources = files(
+ 'pg_resetwal.c',
+)
+
+if host_system == 'windows'
+ pg_resetwal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_resetwal',
+ '--FILEDESC', 'pg_resetwal - reset PostgreSQL WAL log'])
+endif
+
pg_resetwal = executable('pg_resetwal',
- files('pg_resetwal.c'),
+ pg_resetwal_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
index d8ec9e482d5..6cd970909a2 100644
--- a/src/bin/pg_rewind/meson.build
+++ b/src/bin/pg_rewind/meson.build
@@ -11,6 +11,12 @@ pg_rewind_sources = files(
pg_rewind_sources += xlogreader_sources
+if host_system == 'windows'
+ pg_rewind_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_rewind',
+ '--FILEDESC', 'pg_rewind - synchronize a data directory with another one forked from'])
+endif
+
pg_rewind = executable('pg_rewind',
pg_rewind_sources,
dependencies: [frontend_code, libpq, lz4, zstd],
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
index 2c01831e11f..31d288ba6da 100644
--- a/src/bin/pg_test_fsync/meson.build
+++ b/src/bin/pg_test_fsync/meson.build
@@ -1,4 +1,12 @@
-test_fsync_sources = files('pg_test_fsync.c')
+test_fsync_sources = files(
+ 'pg_test_fsync.c',
+)
+
+if host_system == 'windows'
+ test_fsync_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_fsync',
+ '--FILEDESC', 'pg_test_fsync - test various disk sync methods'])
+endif
pg_test_fsync = executable('pg_test_fsync',
test_fsync_sources,
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
index 0a3068f1657..0aed03ea32f 100644
--- a/src/bin/pg_test_timing/meson.build
+++ b/src/bin/pg_test_timing/meson.build
@@ -1,5 +1,15 @@
+pg_test_timing_sources = files(
+ 'pg_test_timing.c'
+)
+
+if host_system == 'windows'
+ pg_test_timing_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_timing',
+ '--FILEDESC', 'pg_test_timing - test timing overhead'])
+endif
+
pg_test_timing = executable('pg_test_timing',
- ['pg_test_timing.c'],
+ pg_test_timing_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index 02f030e0ccf..a7b927a45c7 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -16,6 +16,12 @@ pg_upgrade_sources = files(
'version.c',
)
+if host_system == 'windows'
+ pg_upgrade_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_upgrade',
+ '--FILEDESC', 'pg_upgrade - an in-place binary upgrade utility'])
+endif
+
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
index 4c3b2bb5f97..b934a408443 100644
--- a/src/bin/pg_verifybackup/meson.build
+++ b/src/bin/pg_verifybackup/meson.build
@@ -3,6 +3,12 @@ pg_verifybackup_sources = files(
'pg_verifybackup.c'
)
+if host_system == 'windows'
+ pg_verifybackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_verifybackup',
+ '--FILEDESC', 'pg_verifybackup - verify a backup against using a backup manifest'])
+endif
+
pg_verifybackup = executable('pg_verifybackup',
pg_verifybackup_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index 95872652ffd..9605976870d 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -8,6 +8,12 @@ pg_waldump_sources += rmgr_desc_sources
pg_waldump_sources += xlogreader_sources
pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+if host_system == 'windows'
+ pg_waldump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_waldump',
+ '--FILEDESC', 'pg_waldump - decode and display WA'])
+endif
+
pg_waldump = executable('pg_waldump',
pg_waldump_sources,
dependencies: [frontend_code, lz4, zstd],
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index 6564e54029c..a32eb51fe07 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -17,6 +17,12 @@ exprparse = custom_target('exprparse',
generated_sources += exprparse.to_list()
pgbench_sources += exprparse
+if host_system == 'windows'
+ pgbench_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgbench',
+ '--FILEDESC', 'pgbench - a simple program for running benchmark tests'])
+endif
+
pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
index 7a468879fd2..2e9aea4b0e1 100644
--- a/src/bin/pgevent/meson.build
+++ b/src/bin/pgevent/meson.build
@@ -6,6 +6,12 @@ pgevent_sources = files(
'pgevent.c',
)
+pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgevent',
+ '--FILEDESC', 'Eventlog message formatter',])
+
+pgevent_sources += windows.compile_resources('pgmsgevent.rc')
+
# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
pgevent_link_args = []
if cc.get_id() == 'msvc'
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 410788e4767..1264fc19fbd 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -36,6 +36,12 @@ sql_help = custom_target('psql_help',
generated_sources += sql_help.to_list()
psql_sources += sql_help
+if host_system == 'windows'
+ psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'psql',
+ '--FILEDESC', 'psql - the PostgreSQL interactive terminal',])
+endif
+
psql = executable('psql',
psql_sources,
include_directories: include_directories('.'),
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
index eaf250c7f73..837562c24e5 100644
--- a/src/bin/scripts/meson.build
+++ b/src/bin/scripts/meson.build
@@ -16,8 +16,16 @@ binaries = [
]
foreach binary : binaries
+ binary_sources = files('@0@.c'.format(binary))
+
+ if host_system == 'windows'
+ binary_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', binary,
+ '--FILEDESC', '@0@ - PostgreSQL utility'.format(binary),])
+ endif
+
binary = executable(binary,
- files(binary + '.c'),
+ binary_sources,
link_with: [scripts_common],
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index bc047e00d62..2c9edeaa088 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -16,9 +16,13 @@ libpq_sources = files(
'libpq-events.c',
'pqexpbuffer.c',
)
+libpq_so_sources = [] # only for shared lib, in addition to above
if host_system == 'windows'
libpq_sources += files('pthread-win32.c', 'win32.c')
+ libpq_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq',
+ '--FILEDESC', 'PostgreSQL Access Library',])
endif
if ssl.found()
@@ -52,6 +56,7 @@ libpq_st = static_library('libpq',
# not using both_libraries here, causes problems with precompiled headers and
# resource files with msbuild
libpq_so = shared_library('libpq',
+ libpq_so_sources,
dependencies: libpq_deps,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
index 16f94c1ed8b..017f729d435 100644
--- a/src/interfaces/libpq/test/meson.build
+++ b/src/interfaces/libpq/test/meson.build
@@ -1,13 +1,34 @@
+libpq_uri_regress_sources = files(
+ 'libpq_uri_regress.c',
+)
+
+if host_system == 'windows'
+ libpq_uri_regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_uri_regress',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_uri_regress',
- files('libpq_uri_regress.c'),
+ libpq_uri_regress_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
}
)
+
+libpq_testclient_sources = files(
+ 'libpq_testclient.c',
+)
+
+if host_system == 'windows'
+ libpq_testclient_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_testclient',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_testclient',
- files('libpq_testclient.c'),
+ libpq_testclient_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 73b733dd50b..535660085dd 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -36,6 +36,13 @@ foreach n : ['SPI', 'Util']
endforeach
plperl_inc = include_directories('.')
+
+if host_system == 'windows'
+ plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plperl',
+ '--FILEDESC', 'PL/Perl - procedural language',])
+endif
+
plperl = shared_module('plperl',
plperl_sources,
include_directories: [plperl_inc, postgres_inc],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index dd499fdd151..c46c0a1da2a 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -40,6 +40,12 @@ pl_unreserved = custom_target('pl_unreserved_kwlist',
generated_sources += pl_unreserved
plpgsql_sources += pl_unreserved
+if host_system == 'windows'
+ plpgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpgsql',
+ '--FILEDESC', 'PL/pgSQL - procedural language',])
+endif
+
plpgsql = shared_module('plpgsql',
plpgsql_sources,
include_directories: include_directories('.'),
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 366b3b171ac..40888386b5f 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -28,6 +28,12 @@ plpython_sources += custom_target('spiexceptions.h',
# FIXME: need to duplicate import library ugliness?
plpython_inc = include_directories('.')
+if host_system == 'windows'
+ plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpython3',
+ '--FILEDESC', 'PL/Python - procedural language',])
+endif
+
plpython = shared_module('plpython3',
plpython_sources,
include_directories: [plpython_inc, postgres_inc],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index 9b6addd7fd5..f09bb14c950 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -14,6 +14,12 @@ pltcl_sources += custom_target('pltclerrcodes.h',
command: [perl, gen_pltclerrcodes, '@INPUT@']
)
+if host_system == 'windows'
+ pltcl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pltcl',
+ '--FILEDESC', 'PL/Tcl - procedural language',])
+endif
+
pltcl = shared_module('pltcl',
pltcl_sources,
include_directories: [include_directories('.'), postgres_inc],
diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build
index fc2368d02cf..7efec0efbc0 100644
--- a/contrib/adminpack/meson.build
+++ b/contrib/adminpack/meson.build
@@ -1,5 +1,15 @@
+adminpack_sources = files(
+ 'adminpack.c',
+)
+
+if host_system == 'windows'
+ adminpack_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'adminpack',
+ '--FILEDESC', 'adminpack - support functions for pgAdmin',])
+endif
+
adminpack = shared_module('adminpack',
- ['adminpack.c'],
+ adminpack_sources,
kwargs: contrib_mod_args,
)
contrib_targets += adminpack
diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build
index 1db3d20349e..fa807b72d98 100644
--- a/contrib/amcheck/meson.build
+++ b/contrib/amcheck/meson.build
@@ -1,7 +1,16 @@
-amcheck = shared_module('amcheck', [
- 'verify_heapam.c',
- 'verify_nbtree.c',
- ],
+amcheck_sources = files(
+ 'verify_heapam.c',
+ 'verify_nbtree.c',
+)
+
+if host_system == 'windows'
+ amcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'amcheck',
+ '--FILEDESC', 'amcheck - function for verifying relation integrity',])
+endif
+
+amcheck = shared_module('amcheck',
+ amcheck_sources,
kwargs: contrib_mod_args,
)
contrib_targets += amcheck
diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build
index d2e01968f54..c4ffb0663bc 100644
--- a/contrib/auth_delay/meson.build
+++ b/contrib/auth_delay/meson.build
@@ -1,5 +1,15 @@
+auth_delay_sources = files(
+ 'auth_delay.c',
+)
+
+if host_system == 'windows'
+ auth_delay_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auth_delay',
+ '--FILEDESC', 'auth_delay - delay authentication failure reports',])
+endif
+
autoinc = shared_module('auth_delay',
- ['auth_delay.c'],
+ auth_delay_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build
index 249a8376faa..76f86617850 100644
--- a/contrib/auto_explain/meson.build
+++ b/contrib/auto_explain/meson.build
@@ -1,5 +1,15 @@
+auto_explain_sources = files(
+ 'auto_explain.c',
+)
+
+if host_system == 'windows'
+ auto_explain_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auto_explain',
+ '--FILEDESC', 'auto_explain - logging facility for execution plans',])
+endif
+
auto_explain = shared_module('auto_explain',
- files('auto_explain.c'),
+ auto_explain_sources,
kwargs: contrib_mod_args,
)
contrib_targets += auto_explain
diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build
index 9f0517f1701..3a389de9175 100644
--- a/contrib/basebackup_to_shell/meson.build
+++ b/contrib/basebackup_to_shell/meson.build
@@ -2,6 +2,12 @@ basebackup_to_shell_sources = files(
'basebackup_to_shell.c',
)
+if host_system == 'windows'
+ basebackup_to_shell_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basebackup_to_shell',
+ '--FILEDESC', 'basebackup_to_shell - target basebackup to shell command',])
+endif
+
basebackup_to_shell = shared_module('basebackup_to_shell',
basebackup_to_shell_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index b67cbef60bd..c30dcfa5d41 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -2,6 +2,12 @@ basic_archive_sources = files(
'basic_archive.c',
)
+if host_system == 'windows'
+ basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basic_archive',
+ '--FILEDESC', 'basic_archive - basic archive module',])
+endif
+
basic_archive = shared_module('basic_archive',
basic_archive_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 1fe7632bdbe..16f3b83e4d2 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -7,6 +7,12 @@ bloom_sources = files(
'blvalidate.c',
)
+if host_system == 'windows'
+ bloom_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bloom',
+ '--FILEDESC', 'bloom access method - signature file based index',])
+endif
+
bloom = shared_module('bloom',
bloom_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build
index c20b667d75f..a68daab0dcd 100644
--- a/contrib/bool_plperl/meson.build
+++ b/contrib/bool_plperl/meson.build
@@ -6,6 +6,12 @@ bool_plperl_sources = files(
'bool_plperl.c',
)
+if host_system == 'windows'
+ bool_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bool_plperl',
+ '--FILEDESC', 'bool_plperl - bool transform for plperl',])
+endif
+
bool_plperl = shared_module('bool_plperl',
bool_plperl_sources,
include_directories: [plperl_inc, include_directories('.')],
diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build
index 15d6d31a6ee..fd4c76767a7 100644
--- a/contrib/btree_gin/meson.build
+++ b/contrib/btree_gin/meson.build
@@ -1,5 +1,15 @@
+btree_gin_sources = files(
+ 'btree_gin.c',
+)
+
+if host_system == 'windows'
+ btree_gin_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gin',
+ '--FILEDESC', 'btree_gin - B-tree equivalent GIN operator classes',])
+endif
+
btree_gin = shared_module('btree_gin',
- files('btree_gin.c'),
+ btree_gin_sources,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gin
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index c0a8d238540..e98c91dacc8 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -25,6 +25,12 @@ btree_gist_sources = files(
'btree_uuid.c',
)
+if host_system == 'windows'
+ btree_gist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gist',
+ '--FILEDESC', 'btree_gist - B-tree equivalent GiST operator classes',])
+endif
+
btree_gist = shared_module('btree_gist',
btree_gist_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build
index ca60eded80b..26a101a19bd 100644
--- a/contrib/citext/meson.build
+++ b/contrib/citext/meson.build
@@ -2,6 +2,12 @@ citext_sources = files(
'citext.c',
)
+if host_system == 'windows'
+ citext_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'citext',
+ '--FILEDESC', 'citext - case-insensitive character string data type',])
+endif
+
citext = shared_module('citext',
citext_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
index 72342b0c82c..041acf95a90 100644
--- a/contrib/cube/meson.build
+++ b/contrib/cube/meson.build
@@ -17,6 +17,12 @@ cube_parse = custom_target('cubeparse',
generated_sources += cube_parse.to_list()
cube_sources += cube_parse
+if host_system == 'windows'
+ cube_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'cube',
+ '--FILEDESC', 'cube - multidimensional cube data type',])
+endif
+
cube = shared_module('cube',
cube_sources,
include_directories: include_directories('.'),
diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
index d35f7b5d49e..66eeb03b736 100644
--- a/contrib/dblink/meson.build
+++ b/contrib/dblink/meson.build
@@ -2,6 +2,12 @@ dblink_sources = files(
'dblink.c',
)
+if host_system == 'windows'
+ dblink_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dblink',
+ '--FILEDESC', 'dblink - connect to other PostgreSQL databases',])
+endif
+
dblink = shared_module('dblink',
dblink_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build
index f00e8085619..6fff921adda 100644
--- a/contrib/dict_int/meson.build
+++ b/contrib/dict_int/meson.build
@@ -1,5 +1,15 @@
+dict_int_sources = files(
+ 'dict_int.c',
+)
+
+if host_system == 'windows'
+ dict_int_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_int',
+ '--FILEDESC', 'dict_int - add-on dictionary template for full-text search',])
+endif
+
dict_int = shared_module('dict_int',
- files('dict_int.c'),
+ dict_int_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_int
diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build
index be53f55bb79..fabd505a7df 100644
--- a/contrib/dict_xsyn/meson.build
+++ b/contrib/dict_xsyn/meson.build
@@ -1,5 +1,15 @@
+dict_xsyn_sources = files(
+ 'dict_xsyn.c',
+)
+
+if host_system == 'windows'
+ dict_xsyn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_xsyn',
+ '--FILEDESC', 'dict_xsyn - add-on dictionary template for full-text search',])
+endif
+
dict_xsyn = shared_module('dict_xsyn',
- files('dict_xsyn.c'),
+ dict_xsyn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_xsyn
diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build
index 807f5cb7de3..78dc29c3da3 100644
--- a/contrib/earthdistance/meson.build
+++ b/contrib/earthdistance/meson.build
@@ -1,5 +1,15 @@
+earthdistance_sources = files(
+ 'earthdistance.c',
+)
+
+if host_system == 'windows'
+ earthdistance_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'earthdistance',
+ '--FILEDESC', 'earthdistance - calculate distances on the surface of the Earth',])
+endif
+
earthdistance = shared_module('earthdistance',
- files('earthdistance.c'),
+ earthdistance_sources,
kwargs: contrib_mod_args,
)
contrib_targets += earthdistance
diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build
index f13efb6e38e..c4071faa669 100644
--- a/contrib/file_fdw/meson.build
+++ b/contrib/file_fdw/meson.build
@@ -1,5 +1,15 @@
+file_fdw_sources = files(
+ 'file_fdw.c',
+)
+
+if host_system == 'windows'
+ file_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'file_fdw',
+ '--FILEDESC', 'file_fdw - foreign data wrapper for files',])
+endif
+
file_fdw = shared_module('file_fdw',
- files('file_fdw.c'),
+ file_fdw_sources,
kwargs: contrib_mod_args,
)
contrib_targets += file_fdw
diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build
index ec278a6211e..e6d06149cec 100644
--- a/contrib/fuzzystrmatch/meson.build
+++ b/contrib/fuzzystrmatch/meson.build
@@ -1,8 +1,16 @@
+fuzzystrmatch_sources = files(
+ 'fuzzystrmatch.c',
+ 'dmetaphone.c',
+)
+
+if host_system == 'windows'
+ fuzzystrmatch_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'fuzzystrmatch',
+ '--FILEDESC', 'fuzzystrmatch - similarities and distance between strings',])
+endif
+
fuzzystrmatch = shared_module('fuzzystrmatch',
- files(
- 'fuzzystrmatch.c',
- 'dmetaphone.c'
- ),
+ fuzzystrmatch_sources,
kwargs: contrib_mod_args,
)
contrib_targets += fuzzystrmatch
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 07c59f40a97..2bb26bb772b 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -1,15 +1,23 @@
# .. so that includes of hstore/hstore.h work
hstore_inc = include_directories('.', '../')
+hstore_sources = files(
+ 'hstore_compat.c',
+ 'hstore_gin.c',
+ 'hstore_gist.c',
+ 'hstore_io.c',
+ 'hstore_op.c',
+ 'hstore_subs.c',
+)
+
+if host_system == 'windows'
+ hstore_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore',
+ '--FILEDESC', 'hstore - key/value pair data type',])
+endif
+
hstore = shared_module('hstore',
- files(
- 'hstore_compat.c',
- 'hstore_gin.c',
- 'hstore_gist.c',
- 'hstore_io.c',
- 'hstore_op.c',
- 'hstore_subs.c',
- ),
+ hstore_sources,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build
index bbafa0221bd..a238fee6a26 100644
--- a/contrib/hstore_plperl/meson.build
+++ b/contrib/hstore_plperl/meson.build
@@ -6,6 +6,12 @@ hstore_plperl_sources = files(
'hstore_plperl.c',
)
+if host_system == 'windows'
+ hstore_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plperl',
+ '--FILEDESC', 'hstore_plperl - hstore transform for plperl',])
+endif
+
hstore_plperl = shared_module('hstore_plperl',
hstore_plperl_sources,
include_directories: [plperl_inc, hstore_inc],
diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build
index 214b48519a9..6071aaeb4b3 100644
--- a/contrib/hstore_plpython/meson.build
+++ b/contrib/hstore_plpython/meson.build
@@ -6,6 +6,12 @@ hstore_plpython_sources = files(
'hstore_plpython.c',
)
+if host_system == 'windows'
+ hstore_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plpython3',
+ '--FILEDESC', 'hstore_plpython - hstore transform for plpython',])
+endif
+
hstore_plpython = shared_module('hstore_plpython3',
hstore_plpython_sources,
include_directories: [plpython_inc, hstore_inc, ],
diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build
index 1655bcbb3fd..b7cf1ce0cad 100644
--- a/contrib/intarray/meson.build
+++ b/contrib/intarray/meson.build
@@ -8,6 +8,12 @@ intarray_sources = files(
'_intbig_gist.c',
)
+if host_system == 'windows'
+ intarray_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', '_int',
+ '--FILEDESC', 'intarray - functions and operators for arrays of integers',])
+endif
+
intarray = shared_module('_int',
intarray_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
index cc30bbeb55c..db68a718313 100644
--- a/contrib/isn/meson.build
+++ b/contrib/isn/meson.build
@@ -2,6 +2,12 @@ isn_sources = files(
'isn.c',
)
+if host_system == 'windows'
+ isn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isn',
+ '--FILEDESC', 'isn - data types for international product numbering standards',])
+endif
+
isn = shared_module('isn',
isn_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build
index 5c915d8ed94..071a7a98d2c 100644
--- a/contrib/jsonb_plperl/meson.build
+++ b/contrib/jsonb_plperl/meson.build
@@ -6,6 +6,12 @@ jsonb_plperl_sources = files(
'jsonb_plperl.c',
)
+if host_system == 'windows'
+ jsonb_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plperl',
+ '--FILEDESC', 'jsonb_plperl - jsonb transform for plperl',])
+endif
+
jsonb_plperl = shared_module('jsonb_plperl',
jsonb_plperl_sources,
include_directories: [plperl_inc],
diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build
index de8e1105c6a..84dc1161e8b 100644
--- a/contrib/jsonb_plpython/meson.build
+++ b/contrib/jsonb_plpython/meson.build
@@ -6,6 +6,12 @@ jsonb_plpython_sources = files(
'jsonb_plpython.c',
)
+if host_system == 'windows'
+ jsonb_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plpython3',
+ '--FILEDESC', 'jsonb_plpython - jsonb transform for plpython',])
+endif
+
jsonb_plpython = shared_module('jsonb_plpython3',
jsonb_plpython_sources,
include_directories: [plpython_inc],
diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build
index 9082d5713c7..61ae131f1cc 100644
--- a/contrib/lo/meson.build
+++ b/contrib/lo/meson.build
@@ -2,6 +2,12 @@ lo_sources = files(
'lo.c',
)
+if host_system == 'windows'
+ lo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'lo',
+ '--FILEDESC', 'lo - management for large objects',])
+endif
+
lo = shared_module('lo',
lo_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
index 9463fc2c5e5..421292cea9d 100644
--- a/contrib/ltree/meson.build
+++ b/contrib/ltree/meson.build
@@ -13,6 +13,12 @@ ltree_sources = files(
# .. so that includes of ltree/ltree.h work
ltree_inc = include_directories('.', '../')
+if host_system == 'windows'
+ ltree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree',
+ '--FILEDESC', 'ltree - hierarchical label data type',])
+endif
+
ltree = shared_module('ltree',
ltree_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build
index 429d75006aa..acf5e4a6fc8 100644
--- a/contrib/ltree_plpython/meson.build
+++ b/contrib/ltree_plpython/meson.build
@@ -6,6 +6,12 @@ ltree_plpython_sources = files(
'ltree_plpython.c',
)
+if host_system == 'windows'
+ ltree_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree_plpython3',
+ '--FILEDESC', 'ltree_plpython - ltree transform for plpython',])
+endif
+
ltree_plpython = shared_module('ltree_plpython3',
ltree_plpython_sources,
include_directories: [plpython_inc, ltree_inc],
diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build
index 1dad5d8f6e7..1a248f19260 100644
--- a/contrib/oid2name/meson.build
+++ b/contrib/oid2name/meson.build
@@ -1,5 +1,15 @@
+oid2name_sources = files(
+ 'oid2name.c',
+)
+
+if host_system == 'windows'
+ oid2name_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'oid2name',
+ '--FILEDESC', 'oid2name - examine the file structure',])
+endif
+
oid2name = executable('oid2name',
- ['oid2name.c'],
+ oid2name_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build
index 8e7ee09a43a..77276c3715a 100644
--- a/contrib/old_snapshot/meson.build
+++ b/contrib/old_snapshot/meson.build
@@ -2,6 +2,12 @@ old_snapshot_sources = files(
'time_mapping.c',
)
+if host_system == 'windows'
+ old_snapshot_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'old_snapshot',
+ '--FILEDESC', 'old_snapshot - utilities in support of old_snapshot_threshold',])
+endif
+
old_snapshot = shared_module('old_snapshot',
old_snapshot_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
index 4af8153e4fd..3ec50b9445e 100644
--- a/contrib/pageinspect/meson.build
+++ b/contrib/pageinspect/meson.build
@@ -9,6 +9,12 @@ pageinspect_sources = files(
'rawpage.c',
)
+if host_system == 'windows'
+ pageinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pageinspect',
+ '--FILEDESC', 'pageinspect - functions to inspect contents of database pages',])
+endif
+
pageinspect = shared_module('pageinspect',
pageinspect_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build
index 7da47d02f1d..383d7df372a 100644
--- a/contrib/passwordcheck/meson.build
+++ b/contrib/passwordcheck/meson.build
@@ -9,6 +9,12 @@ passwordcheck_deps = []
# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
# passwordcheck_deps += [cc.find_library('crack')]
+if host_system == 'windows'
+ passwordcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'passwordcheck',
+ '--FILEDESC', 'passwordcheck - strengthen user password checks',])
+endif
+
passwordcheck = shared_module('passwordcheck',
passwordcheck_sources,
c_args: passwordcheck_c_args,
diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build
index 2c69eae3ea2..dd9948e5f0b 100644
--- a/contrib/pg_buffercache/meson.build
+++ b/contrib/pg_buffercache/meson.build
@@ -1,7 +1,15 @@
+pg_buffercache_sources = files(
+ 'pg_buffercache_pages.c',
+)
+
+if host_system == 'windows'
+ pg_buffercache_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_buffercache',
+ '--FILEDESC', 'pg_buffercache - monitoring of shared buffer cache in real-time',])
+endif
+
pg_buffercache = shared_module('pg_buffercache',
- files(
- 'pg_buffercache_pages.c',
- ),
+ pg_buffercache_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_buffercache
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index f795014d7ca..904b37b6e9b 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -1,7 +1,15 @@
+pg_freespacemap_sources = files(
+ 'pg_freespacemap.c',
+)
+
+if host_system == 'windows'
+ pg_freespacemap_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_freespacemap',
+ '--FILEDESC', 'pg_freespacemap - monitoring of free space map',])
+endif
+
pg_freespacemap = shared_module('pg_freespacemap',
- files(
- 'pg_freespacemap.c',
- ),
+ pg_freespacemap_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_freespacemap
diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build
index bdca9af4f27..b7140cee34b 100644
--- a/contrib/pg_prewarm/meson.build
+++ b/contrib/pg_prewarm/meson.build
@@ -1,8 +1,16 @@
+pg_prewarm_sources = files(
+ 'autoprewarm.c',
+ 'pg_prewarm.c',
+)
+
+if host_system == 'windows'
+ pg_prewarm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_prewarm',
+ '--FILEDESC', 'pg_prewarm - preload relation data into system buffer cache',])
+endif
+
pg_prewarm = shared_module('pg_prewarm',
- files(
- 'autoprewarm.c',
- 'pg_prewarm.c',
- ),
+ pg_prewarm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_prewarm
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index ac117d2fc1d..854df138e76 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -1,5 +1,15 @@
+pg_stat_statements_sources = files(
+ 'pg_stat_statements.c',
+)
+
+if host_system == 'windows'
+ pg_stat_statements_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_stat_statements',
+ '--FILEDESC', 'pg_stat_statements - execution statistics of SQL statements',])
+endif
+
pg_stat_statements = shared_module('pg_stat_statements',
- files('pg_stat_statements.c'),
+ pg_stat_statements_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build
index ac71caa5276..7b5c5999f4b 100644
--- a/contrib/pg_surgery/meson.build
+++ b/contrib/pg_surgery/meson.build
@@ -1,7 +1,15 @@
+pg_surgery_sources = files(
+ 'heap_surgery.c',
+)
+
+if host_system == 'windows'
+ pg_surgery_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_surgery',
+ '--FILEDESC', 'pg_surgery - perform surgery on a damaged relation',])
+endif
+
pg_surgery = shared_module('pg_surgery',
- files(
- 'heap_surgery.c',
- ),
+ pg_surgery_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_surgery
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index a90628d23c6..c8c7c07b308 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -1,10 +1,18 @@
+pg_trgm_sources = files(
+ 'trgm_gin.c',
+ 'trgm_gist.c',
+ 'trgm_op.c',
+ 'trgm_regexp.c',
+)
+
+if host_system == 'windows'
+ pg_trgm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_trgm',
+ '--FILEDESC', 'pg_trgm - trigram matching',])
+endif
+
pg_trgm = shared_module('pg_trgm',
- files(
- 'trgm_gin.c',
- 'trgm_gist.c',
- 'trgm_op.c',
- 'trgm_regexp.c',
- ),
+ pg_trgm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build
index 933dc99ac4d..263a0d08b82 100644
--- a/contrib/pg_visibility/meson.build
+++ b/contrib/pg_visibility/meson.build
@@ -1,7 +1,15 @@
+pg_visibility_sources = files(
+ 'pg_visibility.c',
+)
+
+if host_system == 'windows'
+ pg_visibility_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_visibility',
+ '--FILEDESC', 'pg_visibility - page visibility information',])
+endif
+
pg_visibility = shared_module('pg_visibility',
- files(
- 'pg_visibility.c',
- ),
+ pg_visibility_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_visibility
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index d6b27877dd0..4314a3182a2 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -1,5 +1,11 @@
pg_walinspect_sources = files('pg_walinspect.c')
+if host_system == 'windows'
+ pg_walinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_walinspect',
+ '--FILEDESC', 'pg_walinspect - functions to inspect contents of PostgreSQL Write-Ahead Log',])
+endif
+
pg_walinspect = shared_module('pg_walinspect',
pg_walinspect_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index fe0851bf8e8..7fc7bbc7ca1 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -69,6 +69,12 @@ else
pgcrypto_regress += 'pgp-zlib-DISABLED'
endif
+if host_system == 'windows'
+ pgcrypto_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgcrypto',
+ '--FILEDESC', 'pgcrypto - cryptographic functions',])
+endif
+
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build
index 1b41691a2a3..8092f0d4a64 100644
--- a/contrib/pgrowlocks/meson.build
+++ b/contrib/pgrowlocks/meson.build
@@ -1,7 +1,15 @@
+pgrowlocks_sources = files(
+ 'pgrowlocks.c',
+)
+
+if host_system == 'windows'
+ pgrowlocks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgrowlocks',
+ '--FILEDESC', 'pgrowlocks - display row locking information',])
+endif
+
pgrowlocks = shared_module('pgrowlocks',
- files(
- 'pgrowlocks.c',
- ),
+ pgrowlocks_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgrowlocks
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 8e828692d5c..05e4cd46a5c 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -1,9 +1,17 @@
+pgstattuple_sources = files(
+ 'pgstatapprox.c',
+ 'pgstatindex.c',
+ 'pgstattuple.c',
+)
+
+if host_system == 'windows'
+ pgstattuple_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgstattuple',
+ '--FILEDESC', 'pgstattuple - tuple-level statistics',])
+endif
+
pgstattuple = shared_module('pgstattuple',
- files(
- 'pgstatapprox.c',
- 'pgstatindex.c',
- 'pgstattuple.c',
- ),
+ pgstattuple_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
index 378885ec93b..d3746ff135c 100644
--- a/contrib/postgres_fdw/meson.build
+++ b/contrib/postgres_fdw/meson.build
@@ -6,6 +6,12 @@ postgres_fdw_sources = files(
'shippable.c',
)
+if host_system == 'windows'
+ postgres_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'postgres_fdw',
+ '--FILEDESC', 'postgres_fdw - foreign data wrapper for PostgreSQL',])
+endif
+
postgres_fdw = shared_module('postgres_fdw',
postgres_fdw_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
index e476eab2a77..c6fbb22999b 100644
--- a/contrib/seg/meson.build
+++ b/contrib/seg/meson.build
@@ -17,6 +17,12 @@ seg_parse = custom_target('segparse',
generated_sources += seg_parse.to_list()
seg_sources += seg_parse
+if host_system == 'windows'
+ seg_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'seg',
+ '--FILEDESC', 'seg - line segment data type',])
+endif
+
seg = shared_module('seg',
seg_sources,
include_directories: include_directories('.'),
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 60a95e17c2f..8bef239e3c2 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -14,6 +14,12 @@ sepgsql_sources = files(
'uavc.c',
)
+if host_system == 'windows'
+ sepgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sepgsql',
+ '--FILEDESC', 'sepgsql - SELinux integration',])
+endif
+
sepgsql = shared_module('sepgsql',
sepgsql_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
index 98008980ec2..e7d78189ef5 100644
--- a/contrib/spi/meson.build
+++ b/contrib/spi/meson.build
@@ -1,5 +1,15 @@
+autoinc_sources = files(
+ 'autoinc.c',
+)
+
+if host_system == 'windows'
+ autoinc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'autoinc',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
autoinc = shared_module('autoinc',
- ['autoinc.c'],
+ autoinc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
@@ -9,8 +19,18 @@ install_data('autoinc.control', 'autoinc--1.0.sql',
)
+insert_username_sources = files(
+ 'insert_username.c',
+)
+
+if host_system == 'windows'
+ insert_username_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'insert_username',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
insert_username = shared_module('insert_username',
- ['insert_username.c'],
+ insert_username_sources,
kwargs: contrib_mod_args,
)
contrib_targets += insert_username
@@ -22,8 +42,18 @@ install_data(
)
+moddatetime_sources = files(
+ 'moddatetime.c',
+)
+
+if host_system == 'windows'
+ moddatetime_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'moddatetime',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
moddatetime = shared_module('moddatetime',
- ['moddatetime.c'],
+ moddatetime_sources,
kwargs: contrib_mod_args,
)
contrib_targets += moddatetime
@@ -38,8 +68,18 @@ install_data(
# comment out if you want a quieter refint package for other uses
refint_cflags = ['-DREFINT_VERBOSE']
+refint_sources = files(
+ 'refint.c',
+)
+
+if host_system == 'windows'
+ refint_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'refint',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
refint = shared_module('refint',
- ['refint.c'],
+ refint_sources,
c_args: refint_cflags,
kwargs: contrib_mod_args,
)
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
index 53f752a08ac..136983e783d 100644
--- a/contrib/sslinfo/meson.build
+++ b/contrib/sslinfo/meson.build
@@ -2,10 +2,18 @@ if not ssl.found()
subdir_done()
endif
+sslinfo_sources = files(
+ 'sslinfo.c',
+)
+
+if host_system == 'windows'
+ sslinfo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sslinfo',
+ '--FILEDESC', 'sslinfo - information about client SSL certificate',])
+endif
+
sslinfo = shared_module('sslinfo',
- files(
- 'sslinfo.c',
- ),
+ sslinfo_sources,
kwargs: contrib_mod_args + {
'dependencies': [ssl, contrib_mod_args['dependencies']],
}
diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build
index f4230096c0c..d2ddc8d3b39 100644
--- a/contrib/tablefunc/meson.build
+++ b/contrib/tablefunc/meson.build
@@ -1,7 +1,15 @@
+tablefunc_sources = files(
+ 'tablefunc.c',
+)
+
+if host_system == 'windows'
+ tablefunc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tablefunc',
+ '--FILEDESC', 'tablefunc - various functions that return tables',])
+endif
+
tablefunc = shared_module('tablefunc',
- files(
- 'tablefunc.c',
- ),
+ tablefunc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tablefunc
diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build
index c3a025247d4..71261c3b0a2 100644
--- a/contrib/tcn/meson.build
+++ b/contrib/tcn/meson.build
@@ -1,7 +1,15 @@
+tcn_sources = files(
+ 'tcn.c',
+)
+
+if host_system == 'windows'
+ tcn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tcn',
+ '--FILEDESC', 'tcn - trigger function notifying listeners',])
+endif
+
tcn = shared_module('tcn',
- files(
- 'tcn.c',
- ),
+ tcn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tcn
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index dd7cb0101ad..6376103c689 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -2,6 +2,12 @@ test_decoding_sources = files(
'test_decoding.c',
)
+if host_system == 'windows'
+ test_decoding_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_decoding',
+ '--FILEDESC', 'test_decoding - example of a logical decoding output plugin',])
+endif
+
test_decoding = shared_module('test_decoding',
test_decoding_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build
index b9cd42115a8..380abb49883 100644
--- a/contrib/tsm_system_rows/meson.build
+++ b/contrib/tsm_system_rows/meson.build
@@ -1,7 +1,15 @@
+tsm_system_rows_sources = files(
+ 'tsm_system_rows.c',
+)
+
+if host_system == 'windows'
+ tsm_system_rows_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_rows',
+ '--FILEDESC', 'tsm_system_rows - TABLESAMPLE method which accepts number of rows as a limit',])
+endif
+
tsm_system_rows = shared_module('tsm_system_rows',
- files(
- 'tsm_system_rows.c',
- ),
+ tsm_system_rows_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_rows
diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build
index 18015912ffb..e57a2702c60 100644
--- a/contrib/tsm_system_time/meson.build
+++ b/contrib/tsm_system_time/meson.build
@@ -1,7 +1,15 @@
+tsm_system_time_sources = files(
+ 'tsm_system_time.c',
+)
+
+if host_system == 'windows'
+ tsm_system_time_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_time',
+ '--FILEDESC', 'tsm_system_time - TABLESAMPLE method which accepts time in milliseconds as a limit',])
+endif
+
tsm_system_time = shared_module('tsm_system_time',
- files(
- 'tsm_system_time.c',
- ),
+ tsm_system_time_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_time
diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build
index 872b76e3223..438035132f8 100644
--- a/contrib/unaccent/meson.build
+++ b/contrib/unaccent/meson.build
@@ -1,7 +1,15 @@
+unaccent_sources = files(
+ 'unaccent.c',
+)
+
+if host_system == 'windows'
+ unaccent_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'unaccent',
+ '--FILEDESC', 'unaccent - text search dictionary that removes accents',])
+endif
+
unaccent = shared_module('unaccent',
- files(
- 'unaccent.c',
- ),
+ unaccent_sources,
kwargs: contrib_mod_args,
)
contrib_targets += unaccent
diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build
index da6d1d75c12..28730f398f0 100644
--- a/contrib/uuid-ossp/meson.build
+++ b/contrib/uuid-ossp/meson.build
@@ -2,10 +2,18 @@ if not uuid.found()
subdir_done()
endif
+uuid_ossp_sources = files(
+ 'uuid-ossp.c',
+)
+
+if host_system == 'windows'
+ uuid_ossp_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'uuid-ossp',
+ '--FILEDESC', 'uuid-ossp - UUID generation',])
+endif
+
uuid_ossp = shared_module('uuid-ossp',
- files(
- 'uuid-ossp.c',
- ),
+ uuid_ossp_sources,
kwargs: contrib_mod_args + {
'dependencies': [uuid, contrib_mod_args['dependencies']],
},
diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build
index 7a632b87d1b..846de47dbd1 100644
--- a/contrib/vacuumlo/meson.build
+++ b/contrib/vacuumlo/meson.build
@@ -1,5 +1,15 @@
+vacuumlo_sources = files(
+ 'vacuumlo.c',
+)
+
+if host_system == 'windows'
+ vacuumlo_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'vacuumlo',
+ '--FILEDESC', 'vacuumlo - removes orphaned large objects',])
+endif
+
vacuumlo = executable('vacuumlo',
- ['vacuumlo.c'],
+ vacuumlo_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 9c0b56f01f6..89b0d677516 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -2,11 +2,19 @@ if not libxml.found()
subdir_done()
endif
+xml2_sources = files(
+ 'xpath.c',
+ 'xslt_proc.c',
+)
+
+if host_system == 'windows'
+ xml2_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgxml',
+ '--FILEDESC', 'xml2 - XPath querying and XSLT',])
+endif
+
xml2 = shared_module('pgxml',
- files(
- 'xpath.c',
- 'xslt_proc.c',
- ),
+ xml2_sources,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 5887cb92b52..e5dc0edc04b 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -1,7 +1,11 @@
export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
-ecpg_compat = both_libraries('libecpg_compat',
+ecpg_compat_sources = files(
'informix.c',
+)
+
+ecpg_compat = both_libraries('libecpg_compat',
+ ecpg_compat_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
c_args: ['-DSO_MAJOR_VERSION=3'],
dependencies: [frontend_code, thread_dep],
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 1be49c8c27f..74876f039c9 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -93,6 +93,12 @@ ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
generated_sources += ecpg_kwlist
ecpg_sources += ecpg_kwlist
+if host_system == 'windows'
+ ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ecpg',
+ '--FILEDESC', 'ecpg - embedded SQL precompiler for C',])
+endif
+
ecpg_exe = executable('ecpg',
ecpg_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index f0ace641f0c..f67f2dffb71 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -7,6 +7,12 @@ pg_regress_ecpg_sources = pg_regress_c + files(
'pg_regress_ecpg.c',
)
+if host_system == 'windows'
+ pg_regress_ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress_ecpg',
+ '--FILEDESC', 'ECPG Test - regression tests for ECPG',])
+endif
+
pg_regress_ecpg = executable('pg_regress_ecpg',
pg_regress_ecpg_sources,
c_args: pg_regress_cflags,
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index c7656fd4609..ba27b8c1d44 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -23,6 +23,12 @@ spec_parser = custom_target('specparse',
isolationtester_sources += spec_parser
generated_sources += spec_parser.to_list()
+if host_system == 'windows'
+ isolation_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_isolation_regress',
+ '--FILEDESC', 'pg_isolation_regress - multi-client test driver',])
+endif
+
pg_isolation_regress = executable('pg_isolation_regress',
isolation_sources,
c_args: pg_regress_cflags,
@@ -34,6 +40,13 @@ pg_isolation_regress = executable('pg_isolation_regress',
)
bin_targets += pg_isolation_regress
+
+if host_system == 'windows'
+ isolationtester_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isolationtester',
+ '--FILEDESC', 'isolationtester - multi-client test driver',])
+endif
+
isolationtester = executable('isolationtester',
isolationtester_sources,
include_directories: include_directories('.'),
diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build
index cf4bdaba637..a0c3ab6afe7 100644
--- a/src/test/modules/delay_execution/meson.build
+++ b/src/test/modules/delay_execution/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+delay_execution_sources = files(
+ 'delay_execution.c',
+)
+
+if host_system == 'windows'
+ delay_execution_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'delay_execution',
+ '--FILEDESC', 'delay_execution - allow delay between parsing and execution',])
+endif
+
delay_execution = shared_module('delay_execution',
- ['delay_execution.c'],
+ delay_execution_sources,
kwargs: pg_mod_args,
)
testprep_targets += delay_execution
diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build
index 56ff5f48001..4ce82491135 100644
--- a/src/test/modules/dummy_index_am/meson.build
+++ b/src/test/modules/dummy_index_am/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_index_am_sources = files(
+ 'dummy_index_am.c',
+)
+
+if host_system == 'windows'
+ dummy_index_am_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_index_am',
+ '--FILEDESC', 'dummy_index_am - index access method template',])
+endif
+
dummy_index_am = shared_module('dummy_index_am',
- ['dummy_index_am.c'],
+ dummy_index_am_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_index_am
diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build
index 21b7cf8f353..81b626e496c 100644
--- a/src/test/modules/dummy_seclabel/meson.build
+++ b/src/test/modules/dummy_seclabel/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_seclabel_sources = files(
+ 'dummy_seclabel.c',
+)
+
+if host_system == 'windows'
+ dummy_seclabel_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_seclabel',
+ '--FILEDESC', 'dummy_seclabel - regression testing of the SECURITY LABEL statement',])
+endif
+
dummy_seclabel = shared_module('dummy_seclabel',
- ['dummy_seclabel.c'],
+ dummy_seclabel_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_seclabel
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
index 8384b6e3b2a..de0e2d15626 100644
--- a/src/test/modules/libpq_pipeline/meson.build
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -1,7 +1,15 @@
+libpq_pipeline_sources = files(
+ 'libpq_pipeline.c',
+)
+
+if host_system == 'windows'
+ libpq_pipeline_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_pipeline',
+ '--FILEDESC', 'libpq_pipeline - test program for pipeline execution',])
+endif
+
libpq_pipeline = executable('libpq_pipeline',
- files(
- 'libpq_pipeline.c',
- ),
+ libpq_pipeline_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build
index 45de3f1990d..e1ea2c7a16f 100644
--- a/src/test/modules/plsample/meson.build
+++ b/src/test/modules/plsample/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+plsample_sources = files(
+ 'plsample.c',
+)
+
+if host_system == 'windows'
+ plsample_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plsample',
+ '--FILEDESC', 'PL/Sample - template for procedural language',])
+endif
+
plsample = shared_module('plsample',
- ['plsample.c'],
+ plsample_sources,
kwargs: pg_mod_args,
)
testprep_targets += plsample
diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build
index 857fc7e140e..445296fee0b 100644
--- a/src/test/modules/spgist_name_ops/meson.build
+++ b/src/test/modules/spgist_name_ops/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+spgist_name_ops_sources = files(
+ 'spgist_name_ops.c',
+)
+
+if host_system == 'windows'
+ spgist_name_ops_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'spgist_name_ops',
+ '--FILEDESC', 'spgist_name_ops - test opclass for SP-GiST',])
+endif
+
spgist_name_ops = shared_module('spgist_name_ops',
- ['spgist_name_ops.c'],
+ spgist_name_ops_sources,
kwargs: pg_mod_args,
)
testprep_targets += spgist_name_ops
diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build
index a57bd0693a3..a9eb4c564da 100644
--- a/src/test/modules/ssl_passphrase_callback/meson.build
+++ b/src/test/modules/ssl_passphrase_callback/meson.build
@@ -3,8 +3,19 @@ if not ssl.found()
endif
# FIXME: prevent install during main install, but not during test :/
+
+ssl_passphrase_callback_sources = files(
+ 'ssl_passphrase_func.c',
+)
+
+if host_system == 'windows'
+ ssl_passphrase_callback_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ssl_passphrase_func',
+ '--FILEDESC', 'callback function to provide a passphrase',])
+endif
+
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
- ['ssl_passphrase_func.c'],
+ ssl_passphrase_callback_sources,
kwargs: pg_mod_args + {
'dependencies': [ssl, pg_mod_args['dependencies']],
},
diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build
index 945eb5a70c4..3cf6b05754f 100644
--- a/src/test/modules/test_bloomfilter/meson.build
+++ b/src/test/modules/test_bloomfilter/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_bloomfilter_sources = files(
+ 'test_bloomfilter.c',
+)
+
+if host_system == 'windows'
+ test_bloomfilter_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_bloomfilter',
+ '--FILEDESC', 'test_bloomfilter - test code for Bloom filter library',])
+endif
+
test_bloomfilter = shared_module('test_bloomfilter',
- ['test_bloomfilter.c'],
+ test_bloomfilter_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_bloomfilter
diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build
index 81ad5adc526..54d44f9b2b4 100644
--- a/src/test/modules/test_ddl_deparse/meson.build
+++ b/src/test/modules/test_ddl_deparse/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ddl_deparse_sources = files(
+ 'test_ddl_deparse.c',
+)
+
+if host_system == 'windows'
+ test_ddl_deparse_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ddl_deparse',
+ '--FILEDESC', 'test_ddl_deparse - regression testing for DDL deparsing',])
+endif
+
test_ddl_deparse = shared_module('test_ddl_deparse',
- ['test_ddl_deparse.c'],
+ test_ddl_deparse_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ddl_deparse
diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build
index abf0a3b0430..b3b49c56122 100644
--- a/src/test/modules/test_ginpostinglist/meson.build
+++ b/src/test/modules/test_ginpostinglist/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ginpostinglist_sources = files(
+ 'test_ginpostinglist.c',
+)
+
+if host_system == 'windows'
+ test_ginpostinglist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ginpostinglist',
+ '--FILEDESC', 'test_ginpostinglist - test code for src/backend/access/gin//ginpostinglist.c',])
+endif
+
test_ginpostinglist = shared_module('test_ginpostinglist',
- ['test_ginpostinglist.c'],
+ test_ginpostinglist_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ginpostinglist
diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build
index c32c469c69a..4bd75af4b5e 100644
--- a/src/test/modules/test_integerset/meson.build
+++ b/src/test/modules/test_integerset/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_integerset_sources = files(
+ 'test_integerset.c',
+)
+
+if host_system == 'windows'
+ test_integerset_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_integerset',
+ '--FILEDESC', 'test_integerset - test code for src/backend/lib/integerset.c',])
+endif
+
test_integerset = shared_module('test_integerset',
- ['test_integerset.c'],
+ test_integerset_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_integerset
diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build
index a388de1156a..c5405b8f878 100644
--- a/src/test/modules/test_lfind/meson.build
+++ b/src/test/modules/test_lfind/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_lfind_sources = files(
+ 'test_lfind.c',
+)
+
+if host_system == 'windows'
+ test_lfind_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_lfind',
+ '--FILEDESC', 'test_lfind - test code for optimized linear search functions',])
+endif
+
test_lfind = shared_module('test_lfind',
- ['test_lfind.c'],
+ test_lfind_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_lfind
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 5faf0459777..8802bbbac55 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_oat_hooks_sources = files(
+ 'test_oat_hooks.c',
+)
+
+if host_system == 'windows'
+ test_oat_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_oat_hooks',
+ '--FILEDESC', 'test_oat_hooks - example use of object access hooks',])
+endif
+
test_oat_hooks = shared_module('test_oat_hooks',
- ['test_oat_hooks.c'],
+ test_oat_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_oat_hooks
diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build
index b59960f615e..1c17113347f 100644
--- a/src/test/modules/test_parser/meson.build
+++ b/src/test/modules/test_parser/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_parser_sources = files(
+ 'test_parser.c',
+)
+
+if host_system == 'windows'
+ test_parser_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_parser',
+ '--FILEDESC', 'test_parser - example of a custom parser for full-text search',])
+endif
+
test_parser = shared_module('test_parser',
- ['test_parser.c'],
+ test_parser_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_parser
diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build
index 1cfa84b3609..9a5be43c9c0 100644
--- a/src/test/modules/test_predtest/meson.build
+++ b/src/test/modules/test_predtest/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_predtest_sources = files(
+ 'test_predtest.c',
+)
+
+if host_system == 'windows'
+ test_predtest_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_predtest',
+ '--FILEDESC', 'test_predtest - test code for optimizer/util/predtest.c',])
+endif
+
test_predtest = shared_module('test_predtest',
- ['test_predtest.c'],
+ test_predtest_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_predtest
diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build
index 34cbc3e1624..f067e08d321 100644
--- a/src/test/modules/test_rbtree/meson.build
+++ b/src/test/modules/test_rbtree/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rbtree_sources = files(
+ 'test_rbtree.c',
+)
+
+if host_system == 'windows'
+ test_rbtree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rbtree',
+ '--FILEDESC', 'test_rbtree - test code for red-black tree library',])
+endif
+
test_rbtree = shared_module('test_rbtree',
- ['test_rbtree.c'],
+ test_rbtree_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rbtree
diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build
index 867a64e57c3..cfb938d9f1e 100644
--- a/src/test/modules/test_regex/meson.build
+++ b/src/test/modules/test_regex/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_regex_sources = files(
+ 'test_regex.c',
+)
+
+if host_system == 'windows'
+ test_regex_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_regex',
+ '--FILEDESC', 'test_regex - test code for backend/regex/',])
+endif
+
test_regex = shared_module('test_regex',
- ['test_regex.c'],
+ test_regex_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_regex
diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build
index 80d8adda332..3fb273b2934 100644
--- a/src/test/modules/test_rls_hooks/meson.build
+++ b/src/test/modules/test_rls_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rls_hooks_sources = files(
+ 'test_rls_hooks.c',
+)
+
+if host_system == 'windows'
+ test_rls_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rls_hooks',
+ '--FILEDESC', 'test_rls_hooks - example use of RLS hooks',])
+endif
+
test_rls_hooks = shared_module('test_rls_hooks',
- ['test_rls_hooks.c'],
+ test_rls_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rls_hooks
diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build
index b663543d616..16c8fdb57f4 100644
--- a/src/test/modules/test_shm_mq/meson.build
+++ b/src/test/modules/test_shm_mq/meson.build
@@ -1,10 +1,19 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_shm_mq_sources = files(
+ 'setup.c',
+ 'test.c',
+ 'worker.c',
+)
+
+if host_system == 'windows'
+ test_shm_mq_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_shm_mq',
+ '--FILEDESC', 'test_shm_mq - example use of shared memory message queue',])
+endif
+
test_shm_mq = shared_module('test_shm_mq',
- files(
- 'setup.c',
- 'test.c',
- 'worker.c',
- ),
+ test_shm_mq_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_shm_mq
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index 32acad883b2..a4a158c75b9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -1,8 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_worker_spi_sources = files(
+ 'worker_spi.c',
+)
+
+if host_system == 'windows'
+ test_worker_spi_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'worker_spi',
+ '--FILEDESC', 'worker_spi - background worker example',])
+endif
+
test_worker_spi = shared_module('worker_spi',
- files(
- 'worker_spi.c',
- ),
+ test_worker_spi_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_worker_spi
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index fd8ee995b79..963c0f64ed5 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -8,6 +8,12 @@ regress_sources = pg_regress_c + files(
pg_regress_cflags = ['-DHOST_TUPLE="frak"', '-DSHELLPROG="/bin/sh"']
+if host_system == 'windows'
+ regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress',
+ '--FILEDESC', 'pg_regress - test driver',])
+endif
+
pg_regress = executable('pg_regress',
regress_sources,
c_args: pg_regress_cflags,
diff --git a/meson.build b/meson.build
index 6ffae59ba03..4ad06b25213 100644
--- a/meson.build
+++ b/meson.build
@@ -2523,6 +2523,67 @@ gen_export_kwargs = {
+###
+### windows resources related stuff
+###
+
+if host_system == 'windows'
+ pg_ico = meson.source_root() / 'src' / 'port' / 'win32.ico'
+ win32ver_rc = files('src/port/win32ver.rc')
+ rcgen = find_program('src/tools/rcgen', native: true)
+
+ rcgen_base_args = [
+ '--srcdir', '@SOURCE_DIR@',
+ '--builddir', meson.build_root(),
+ '--rcout', '@OUTPUT0@',
+ '--out', '@OUTPUT1@',
+ '--input', '@INPUT@',
+ '@EXTRA_ARGS@',
+ ]
+
+ if cc.get_argument_syntax() == 'msvc'
+ rcgen_base_args += [
+ '--rc', find_program('rc', required: true).path(),
+ ]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.res']
+ else
+ rcgen_base_args += [
+ '--windres', find_program('windres', required: true).path(),
+ ]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.obj']
+ endif
+
+ # msbuild backend doesn't support this atm
+ if meson.backend() == 'ninja'
+ rcgen_base_args += ['--depfile', '@DEPFILE@']
+ endif
+
+ rcgen_bin_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_APP',
+ '--FILEENDING', 'exe',
+ '--ICO', pg_ico
+ ]
+
+ rcgen_lib_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_DLL',
+ '--FILEENDING', 'dll',
+ ]
+
+ rc_bin_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_bin_args,
+ output: rcgen_outputs,
+ )
+
+ rc_lib_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_lib_args,
+ output: rcgen_outputs,
+ )
+endif
+
+
+
# headers that the whole build tree depends on
generated_headers = []
# headers that the backend build depends on
diff --git a/src/timezone/meson.build b/src/timezone/meson.build
index 16f082ecfa8..9e0934c000b 100644
--- a/src/timezone/meson.build
+++ b/src/timezone/meson.build
@@ -28,6 +28,12 @@ if get_option('system_tzdata') == ''
if meson.is_cross_build()
zic = find_program(get_option('ZIC'), native: true, required: true)
else
+ if host_system == 'windows'
+ zic_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'zic',
+ '--FILEDESC', 'zic - time zone compiler',])
+ endif
+
zic = executable('zic', zic_sources,
dependencies: [frontend_code],
kwargs: default_bin_args + {'install': false}
diff --git a/src/tools/rcgen b/src/tools/rcgen
new file mode 100755
index 00000000000..5b62bfe5410
--- /dev/null
+++ b/src/tools/rcgen
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+
+import argparse
+import os
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(description='generate PostgreSQL rc file')
+
+parser.add_argument('--srcdir', type=os.path.abspath,
+ required=True)
+parser.add_argument('--builddir', type=os.path.abspath,
+ required=True)
+
+binaries = parser.add_argument_group('binaries')
+binaries.add_argument('--windres', type=os.path.abspath)
+binaries.add_argument('--rc', type=os.path.abspath)
+
+inout = parser.add_argument_group('inout')
+inout.add_argument('--depfile', type=argparse.FileType('w'))
+inout.add_argument('--input', type=argparse.FileType('r'),
+ required=True)
+inout.add_argument('--rcout', type=argparse.FileType('w'),
+ required=True)
+inout.add_argument('--out', type=str,
+ required=True)
+
+replacements = parser.add_argument_group('replacements')
+replacements.add_argument('--FILEDESC', type=str)
+replacements.add_argument('--NAME', type=str, required=True)
+replacements.add_argument('--VFT_TYPE', type=str, required=True)
+replacements.add_argument('--FILEENDING', type=str, required=True)
+replacements.add_argument('--ICO', type=str)
+
+args = parser.parse_args()
+
+# determine replacement strings
+
+internal_name = '"{0}"'.format(args.NAME)
+original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING)
+
+# if no description is passed in, generate one based on the name
+if args.FILEDESC:
+ filedesc = args.FILEDESC
+elif args.NAME:
+ if args.VFT_TYPE == 'VFT_DLL':
+ filedesc = 'PostgreSQL {0} library'.format(args.NAME)
+ else:
+ filedesc = 'PostgreSQL {0} binary'.format(args.NAME)
+filedesc = '"{0}"'.format(filedesc)
+
+
+if args.ICO:
+ ico = 'IDI_ICON ICON "{0}"'.format(args.ICO)
+ if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO))
+else:
+ ico = ''
+
+
+data = args.input.read()
+
+data = data.replace('VFT_APP', args.VFT_TYPE)
+data = data.replace('_INTERNAL_NAME_', internal_name)
+data = data.replace('_ORIGINAL_NAME_', original_name)
+data = data.replace('FILEDESC', filedesc)
+data = data.replace("_ICO_", ico)
+
+args.rcout.write(data)
+args.rcout.close()
+
+if args.windres:
+ cmd = [
+ args.windres,
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '-o', args.out, '-i', args.rcout.name,
+ ]
+elif args.rc:
+ cmd = [
+ args.rc, '/nologo',
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '/fo', args.out, args.rcout.name,
+ ]
+else:
+ sys.exit('either --windres or --rc needs to be specified')
+
+sp = subprocess.run(cmd)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# It'd be nicer if we could generate correct dependencies here, but 'rc'
+# doesn't support doing so. It's unlikely we'll ever need more, so...
+if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(
+ args.rcout.name, args.input.name))
+ args.depfile.write("{0} : {1}/{2}\n".format(
+ args.out, args.builddir, 'src/include/pg_config.h'))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0005-meson-Add-support-for-relative-rpaths-fixing-tes.patch (7.3K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/6-v16-0005-meson-Add-support-for-relative-rpaths-fixing-tes.patch)
download | inline diff:
From f9be71eb3f6e74a8a83723e1f96ac487426af88f Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 13:48:46 -0700
Subject: [PATCH v16 05/16] meson: Add support for relative rpaths, fixing
tests on MacOS w/ SIP
---
meson.build | 47 ++++++++--
.../relativize_shared_library_references | 88 +++++++++++++++++++
src/tools/relpath.py | 6 ++
3 files changed, 136 insertions(+), 5 deletions(-)
create mode 100755 src/tools/relativize_shared_library_references
create mode 100755 src/tools/relpath.py
diff --git a/meson.build b/meson.build
index 4ad06b25213..8323adf772b 100644
--- a/meson.build
+++ b/meson.build
@@ -159,6 +159,7 @@ portname = host_system
exesuffix = '' # overridden below where necessary
dlsuffix = '.so' # overridden below where necessary
+rpath_origin = '$ORIGIN'
library_path_var = 'LD_LIBRARY_PATH'
# Format of file to control exports from libraries, and how to pass them to
@@ -209,6 +210,7 @@ elif host_system == 'cygwin'
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
+ rpath_origin = '@loader_path'
export_file_format = 'darwin'
export_fmt = '-exported_symbols_list=@0@'
@@ -241,8 +243,16 @@ elif host_system == 'netbsd'
# LDFLAGS.
ldflags += ['-Wl,-z,now', '-Wl,-z,relro']
+ # netbsd patched their meson in a broken way:
+ # https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=56959
+ # until there's a way out of that, disable rpath_origin
+ rpath_origin = ''
+
elif host_system == 'openbsd'
- # you're ok
+ # openbsd's $ORIGIN doesn't use an absolute path to the binary, but argv[0]
+ # (i.e. absolute when invoked with an absolute name, but e.g. not absolute
+ # when invoked via PATH search).
+ rpath_origin = ''
elif host_system == 'sunos'
portname = 'solaris'
@@ -254,6 +264,7 @@ elif host_system == 'windows'
exesuffix = '.exe'
dlsuffix = '.dll'
library_path_var = ''
+ rpath_origin = ''
export_file_format = 'win'
export_file_suffix = 'def'
@@ -2479,6 +2490,25 @@ if host_system != 'darwin'
mod_install_rpaths += postgres_lib_d
endif
+# If the host can form relative rpaths, use that to make the installation
+# properly relocatable
+if rpath_origin != ''
+ # PG binaries might need to link to libpq, use relative path to reference
+ bin_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_bin, dir_lib, check: true).stdout().strip()
+ bin_install_rpaths += rpath_origin / bin_to_lib
+
+ # PG extensions might need to link to libpq, use relative path to reference
+ # (often just .)
+ mod_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_lib_pkg, dir_lib, check: true).stdout().strip()
+ mod_install_rpaths += rpath_origin / mod_to_lib
+
+ test_use_library_path_var = false
+else
+ test_use_library_path_var = true
+endif
+
# Define arguments for default targets
@@ -2771,6 +2801,14 @@ above, or by running configure and then make maintainer-clean.
endif
+# To make MacOS installation work without a prior make install, even with SIP
+# enabled, make rpaths relative after installation. This also makes the
+# installation relocatable.
+if host_system == 'darwin'
+ meson.add_install_script('src/tools/relativize_shared_library_references')
+endif
+
+
###############################################################
# Test prep
@@ -2836,10 +2874,9 @@ test_env.set('REGRESS_SHLIB', regress_module.full_path())
# Export PG_TEST_EXTRA so it can be checked in individual tap tests.
test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA'))
-# Add the temporary installation to the library search path on platforms where
-# that works (everything but windows, basically). On windows everything
-# library-like gets installed into bindir, solving that issue.
-if library_path_var != ''
+# On platforms without $ORIGIN support we need to add the temporary
+# installation to the library search path.
+if test_use_library_path_var and library_path_var != ''
test_env.prepend(library_path_var, test_install_location / get_option('libdir'))
endif
diff --git a/src/tools/relativize_shared_library_references b/src/tools/relativize_shared_library_references
new file mode 100755
index 00000000000..280bd48fd32
--- /dev/null
+++ b/src/tools/relativize_shared_library_references
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+# -*-python-*-
+
+# This script updates a macos postgres installation to reference all internal
+# shared libraries using rpaths, leaving absolute install_names in the
+# libraries themselves intact.
+
+import os
+import sys
+import json
+import subprocess
+import shutil
+
+
+def installed_path(destdir, path):
+ if destdir is not None:
+ return f'{destdir}{path}'
+ else:
+ return path
+
+
+def collect_information():
+ shared_libraries = []
+ executables = []
+ shared_modules = []
+
+ meson_info_p = os.path.join(build_root, 'meson-info')
+ targets = json.load(
+ open(os.path.join(meson_info_p, 'intro-targets.json')))
+ installed = json.load(
+ open(os.path.join(meson_info_p, 'intro-installed.json')))
+
+ for target in targets:
+ if not target['installed']:
+ continue
+
+ filenames = target['filename']
+
+ if target['type'] == 'shared library':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+
+ shared_libraries.append(installed[filename])
+
+ if target['type'] == 'executable':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ executables.append(installed[filename])
+
+ if target['type'] == 'shared module':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ shared_modules.append(installed[filename])
+
+ return shared_libraries, executables, shared_modules
+
+
+def patch_references(destdir, shared_libraries, executables, shared_modules):
+ install_name_tool = [shutil.which('install_name_tool')]
+
+ for lib in shared_libraries:
+ libname = os.path.basename(lib)
+ libpath = installed_path(destdir, lib)
+ newref = f'@rpath/{libname}'
+
+ for patch in shared_modules + executables:
+ patchpath = installed_path(destdir, patch)
+
+ # print(f'in {patchpath} replace reference to {libpath} with {newref}')
+ if not os.path.exists(patchpath):
+ print(f"path {patchpath} doesn't exist", file=sys.stderr)
+ sys.exit(1)
+
+ cmd = install_name_tool + ['-change', lib, newref, patchpath]
+ subprocess.check_call(cmd)
+
+
+if __name__ == '__main__':
+ build_root = os.environ['MESON_BUILD_ROOT']
+ destdir = os.environ.get('DESTDIR', None)
+
+ print(f'making references to shared libraries relative, destdir is {destdir}',
+ file=sys.stderr)
+
+ shared_libraries, executables, shared_modules = collect_information()
+ patch_references(destdir, shared_libraries, executables, shared_modules)
+
+ sys.exit(0)
diff --git a/src/tools/relpath.py b/src/tools/relpath.py
new file mode 100755
index 00000000000..87bcb496ab5
--- /dev/null
+++ b/src/tools/relpath.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+print(os.path.relpath(sys.argv[2], start=sys.argv[1]))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0006-meson-Add-docs-for-building-with-meson.patch (77.6K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/7-v16-0006-meson-Add-docs-for-building-with-meson.patch)
download | inline diff:
From 103e073de719f19d4f31201d5b4e740957506ed3 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:55:20 -0700
Subject: [PATCH v16 06/16] meson: Add docs for building with meson
Author: Samay Sharma <smilingsamay@gmail.com>
---
doc/src/sgml/installation.sgml | 1841 ++++++++++++++++++++++++++++++--
doc/src/sgml/monitoring.sgml | 2 +-
doc/src/sgml/runtime.sgml | 2 +-
doc/src/sgml/sourcerepo.sgml | 5 +-
4 files changed, 1743 insertions(+), 107 deletions(-)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 319c7e69660..3d4018badd3 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -31,7 +31,144 @@ documentation. See standalone-profile.xsl for details.
C++</productname>, see <xref linkend="install-windows"/> instead.
</para>
- <sect1 id="install-short">
+ <sect1 id="supported-platforms">
+ <title>Supported Platforms</title>
+
+ <para>
+ A platform (that is, a CPU architecture and operating system combination)
+ is considered supported by the <productname>PostgreSQL</productname> development
+ community if the code contains provisions to work on that platform and
+ it has recently been verified to build and pass its regression tests
+ on that platform. Currently, most testing of platform compatibility
+ is done automatically by test machines in the
+ <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
+ If you are interested in using <productname>PostgreSQL</productname> on a platform
+ that is not represented in the build farm, but on which the code works
+ or can be made to work, you are strongly encouraged to set up a build
+ farm member machine so that continued compatibility can be assured.
+ </para>
+
+ <para>
+ In general, <productname>PostgreSQL</productname> can be expected to work on
+ these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
+ and PA-RISC, including
+ big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
+ It is often
+ possible to build on an unsupported CPU type by configuring with
+ <option>--disable-spinlocks</option>, but performance will be poor.
+ </para>
+
+ <para>
+ <productname>PostgreSQL</productname> can be expected to work on current
+ versions of these operating systems: Linux, Windows,
+ FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
+ Other Unix-like systems may also work but are not currently
+ being tested. In most cases, all CPU architectures supported by
+ a given operating system will work. Look in
+ <xref linkend="installation-platform-notes"/> below to see if
+ there is information
+ specific to your operating system, particularly if using an older system.
+ </para>
+
+ <para>
+ If you have installation problems on a platform that is known
+ to be supported according to recent build farm results, please report
+ it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
+ in porting <productname>PostgreSQL</productname> to a new platform,
+ <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
+ to discuss that.
+ </para>
+
+ <para>
+ Historical versions of <productname>PostgreSQL</productname> or POSTGRES
+ also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
+ M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
+ BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
+ Tru64 UNIX, and ULTRIX.
+ </para>
+ </sect1>
+
+ <sect1 id="get-source">
+ <title>Getting the Source</title>
+
+ <para>
+ You can download the source code in two ways - via git or the source code
+ tarballs.
+ </para>
+
+ <sect2 id="get-source-git">
+ <title>Getting the Source via <productname>Git</productname></title>
+ <para>
+ With <productname>Git</productname>, you can make a copy of the entire code repository
+ on your local machine, so you will have access to all history and branches
+ offline. This is the fastest and most flexible way to develop or test
+ patches.
+ </para>
+
+ <procedure>
+ <step>
+ <para>
+ To begin using the Git repository, make a clone of the official mirror:
+
+<programlisting>
+git clone https://git.postgresql.org/git/postgresql.git
+</programlisting>
+
+ This will copy the full repository to your local machine, so it may take
+ a while to complete, especially if you have a slow Internet connection.
+ The files will be placed in a new subdirectory <filename>postgresql</filename> of
+ your current directory.
+ </para>
+
+ </step>
+
+ <step>
+ <para>
+ Whenever you want to get the latest updates in the system, <command>cd</command>
+ into the repository, and run:
+
+<programlisting>
+git pull
+</programlisting>
+ </para>
+ </step>
+ </procedure>
+
+ <para>
+ <productname>Git</productname> can do a lot more things than just fetch the source.
+ Our wiki, <ulink
+ url="https://wiki.postgresql.org/wiki/Working_with_Git"></ulink>,
+ has some discussion on working with Git. For more information, consult the
+ <productname>Git</productname> man pages, or see the website at
+ <ulink url="https://git-scm.com"></ulink>.
+ </para>
+ </sect2>
+ <sect2 id="get-source-tarball">
+ <title>Getting the Source via Tarballs</title>
+
+ <para>
+ The <productname>PostgreSQL</productname> source code for released versions
+ can also be obtained from the download section of our website:
+ <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
+ Download the
+ <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
+ or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
+ file you're interested in, then unpack it:
+<screen>
+<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
+</screen>
+ This will create a directory
+ <filename>postgresql-<replaceable>version</replaceable></filename> under
+ the current directory with the <productname>PostgreSQL</productname> sources.
+ Change into that directory for the rest of the installation procedure.
+ </para>
+ </sect2>
+ </sect1>
+
+<sect1 id="install-make">
+ <title>Building and Installation with autoconf and make</title>
+
+ <sect2 id="install-short-make">
<title>Short Version</title>
<para>
@@ -50,12 +187,12 @@ su - postgres
/usr/local/pgsql/bin/psql test
</synopsis>
The long version is the rest of this
- <phrase>chapter</phrase>.
+ <phrase>section</phrase>.
</para>
- </sect1>
+ </sect2>
- <sect1 id="install-requirements">
+ <sect2 id="install-requirements-make">
<title>Requirements</title>
<para>
@@ -343,45 +480,9 @@ su - postgres
url="ftp://ftp.gnu.org/gnu/"></ulink>.
</para>
- <para>
- Also check that you have sufficient disk space. You will need about
- 350 MB for the source tree during compilation and about 60 MB for
- the installation directory. An empty database cluster takes about
- 40 MB; databases take about five times the amount of space that a
- flat text file with the same data would take. If you are going to
- run the regression tests you will temporarily need up to an extra
- 300 MB. Use the <command>df</command> command to check free disk
- space.
- </para>
- </sect1>
+ </sect2>
- <sect1 id="install-getsource">
- <title>Getting the Source</title>
-
- <para>
- The <productname>PostgreSQL</productname> source code for released versions
- can be obtained from the download section of our website:
- <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
- Download the
- <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
- or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
- file you're interested in, then unpack it:
-<screen>
-<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
-</screen>
- This will create a directory
- <filename>postgresql-<replaceable>version</replaceable></filename> under
- the current directory with the <productname>PostgreSQL</productname> sources.
- Change into that directory for the rest of the installation procedure.
- </para>
-
- <para>
- Alternatively, you can use the Git version control system; see
- <xref linkend="git"/> for more information.
- </para>
- </sect1>
-
- <sect1 id="install-procedure">
+ <sect2 id="install-procedure-make">
<title>Installation Procedure</title>
<procedure>
@@ -630,6 +731,7 @@ build-postgresql:
rebuilding. Without this, your changes in configuration choices
might not propagate everywhere they need to.
</para>
+ </sect2>
<sect2 id="configure-options">
<title><filename>configure</filename> Options</title>
@@ -844,7 +946,7 @@ build-postgresql:
various <productname>PostgreSQL</productname> features that are not
built by default. Most of these are non-default only because they
require additional software, as described in
- <xref linkend="install-requirements"/>.
+ <xref linkend="install-requirements-make"/>.
</para>
<variablelist>
@@ -1672,9 +1774,7 @@ build-postgresql:
</sect3>
- </sect2>
-
- <sect2 id="configure-envvars">
+ <sect3 id="configure-envvars">
<title><filename>configure</filename> Environment Variables</title>
<indexterm zone="configure-envvars">
@@ -1955,9 +2055,1600 @@ build-postgresql:
adjustments, while <envar>COPT</envar> might be kept set all the time.
</para>
</note>
+ </sect3>
</sect2>
</sect1>
+ <sect1 id="install-meson">
+ <title>Building and Installation with meson</title>
+
+ <sect2 id="install-short-meson">
+ <title>Short Version</title>
+
+ <para>
+<synopsis>
+
+# create working directory
+mkdir postgres
+cd postgres
+
+# fetch source code
+# git clone https://git.postgresql.org/git/postgresql.git src
+
+# current instructions for testing (to be removed when merging)
+git clone -b meson https://github.com/anarazel/postgres.git src
+
+# setup and enter build directory (done only first time)
+meson setup build src --prefix=$PWD/install
+cd build
+
+# Compile source
+ninja
+
+# Install to the prefix directory specified above
+ninja install
+
+# Run all tests (optional, takes time)
+meson test
+
+# Initialize a new database
+../install/bin/initdb -D ../data
+
+# Start database
+../install/bin/pg_ctl -D ../data/ -l logfile start
+
+# Connect to the database
+../install/bin/psql -d postgres
+
+</synopsis>
+ The long version is the rest of this
+ <phrase>section</phrase>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-requirements-meson">
+ <title>Requirements</title>
+
+ <para>
+ In general, a modern Unix-compatible platform or Windows should be able
+ to build <productname>PostgreSQL</productname> with meson and run it.
+ The platforms which have received specific testing at the time of release are:
+
+ <itemizedlist spacing="compact">
+ <listitem><simpara>Linux</simpara></listitem>
+ <listitem><simpara>Windows</simpara></listitem>
+ <listitem><simpara>OpenBSD</simpara></listitem>
+ <listitem><simpara>NetBSD</simpara></listitem>
+ <listitem><simpara>FreeBSD</simpara></listitem>
+ <listitem><simpara>macOS</simpara></listitem>
+ </itemizedlist>
+ </para>
+
+ <sect3 id="required-packages">
+ <title>Required packages</title>
+
+ <para>
+ The following software packages are required for building
+ <productname>PostgreSQL</productname>:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can download the source code in two ways - via git or by downloading
+ the source code tarballs. For the former, you will need an installed version of
+ <productname>Git</productname>, which you can get from
+ <ulink url="https://git-scm.com"></ulink>. Many systems already
+ have a recent version of <productname>Git</productname>
+ installed by default, or available in their package distribution system.
+ If you download the source code tarballs, you will need
+ <application>tar</application> in addition to
+ <application>gzip</application> or <application>bzip2</application>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>meson</primary>
+ </indexterm>
+ You need to install <application>
+ <ulink url="https://mesonbuild.com/">meson</ulink></application> version
+ 0.54 or later to be able to build <productname>PostgreSQL</productname>
+ with it. If your operating system provides a package manager, you can install
+ <application>meson</application> with that. If not, you
+ can download a <ulink url="https://github.com/mesonbuild/meson">meson release</ulink>
+ from github and run <literal>./meson.py</literal> from the git repository
+ itself. Lastly, Meson is also available in the python package index and can
+ be installed with <literal>pip</literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ You need an <acronym>ISO</acronym>/<acronym>ANSI</acronym> C compiler (at least
+ C99-compliant). Recent
+ versions of <productname>GCC</productname> are recommended, but
+ <productname>PostgreSQL</productname> is known to build using a wide variety
+ of compilers from different vendors.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>flex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>lex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>bison</primary>
+ </indexterm>
+ <indexterm>
+ <primary>yacc</primary>
+ </indexterm>
+
+ <application>Flex</application> and <application>Bison</application>
+ are needed to build <productname>PostgreSQL</productname> using
+ <application>meson</application>. Be sure to get
+ <application>Flex</application> 2.5.31 or later and
+ <application>Bison</application> 1.875 or later from your package manager.
+ Other <application>lex</application> and <application>yacc</application>
+ programs cannot be used.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>perl</primary>
+ </indexterm>
+ <application>Perl</application> 5.8.3 or later is needed to build PostgreSQL
+ using <application>meson</application> and to run some test suites.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="recommended-packages">
+ <title>Recommended packages</title>
+
+ <para>
+ The following packages are not required to build
+ <application>PostgreSQL</application> but are strongly recommended:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>readline</primary>
+ </indexterm>
+ <indexterm>
+ <primary>libedit</primary>
+ </indexterm>
+
+ The <acronym>GNU</acronym> <productname>Readline</productname> library
+ allows <application>psql</application> (the PostgreSQL command line
+ SQL interpreter) to remember each command you type, and allows you to
+ use arrow keys to recall and edit previous commands. This is very
+ helpful and is strongly recommended. As an alternative, you can often
+ use the BSD-licensed <filename>libedit</filename> library, originally
+ developed on <productname>NetBSD</productname>. The
+ <filename>libedit</filename> library is GNU
+ <productname>Readline</productname>-compatible and is used if
+ <filename>libreadline</filename> is not found, or if
+ <option>libedit_preferred</option> is enabled as an
+ option to <filename>meson configure</filename>. If you are using a
+ package-based Linux distribution, be aware that you need both the
+ <literal>readline</literal> and <literal>readline-devel</literal> packages, if
+ those are separate in your distribution.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+
+ The <productname>zlib</productname> compression library is
+ used to provide support for compressed archives in
+ <application>pg_dump</application> and
+ <application>pg_restore</application> and is recommended.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Various tests, particularly the client program tests under
+ <filename>src/bin</filename>, use the Perl TAP tools. Running
+ these tests is recommended for development. These TAP tests
+ require the Perl module <literal>IPC::Run</literal> which is
+ available from CPAN or an operating system package.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="optional-packages">
+ <title>Optional packages</title>
+
+ <para>
+ The following packages are optional. They are not required in the
+ default configuration, but they are needed when certain build
+ options are enabled, as explained below:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You need <productname>OpenSSL</productname>, if you want to support
+ encrypted client connections. <productname>OpenSSL</productname> is
+ also required for random number generation on platforms that do not
+ have <filename>/dev/urandom</filename> (except Windows). The minimum
+ required version is 1.0.1.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>LZ4</productname>, if you want to support
+ compression of data with that method; see
+ <xref linkend="guc-default-toast-compression"/> and
+ <xref linkend="guc-wal-compression"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>Zstandard</productname>, if you want to support
+ compression of data or backups with that method; see
+ <xref linkend="guc-wal-compression"/>.
+ The minimum required version is 1.4.0.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <application>Kerberos</application>, <productname>OpenLDAP</productname>,
+ and/or <application>PAM</application>, if you want to support authentication
+ using those services.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the server programming language
+ <application>PL/Perl</application> you need a full
+ <productname>Perl</productname> installation, including the
+ <filename>libperl</filename> library and the header files.
+ The minimum required version is <productname>Perl</productname> 5.8.3.
+ Since <application>PL/Perl</application> will be a shared
+ library, the <indexterm><primary>libperl</primary></indexterm>
+ <filename>libperl</filename> library must be a shared library
+ also on most platforms. This appears to be the default in
+ recent <productname>Perl</productname> versions, but it was not
+ in earlier versions, and in any case it is the choice of whomever
+ installed Perl at your site. <filename>configure</filename> will fail
+ if building <application>PL/Perl</application> is selected but it cannot
+ find a shared <filename>libperl</filename>. In that case, you will have
+ to rebuild and install <productname>Perl</productname> manually to be
+ able to build <application>PL/Perl</application>. During the
+ configuration process for <productname>Perl</productname>, request a
+ shared library.
+ </para>
+
+ <para>
+ If you intend to make more than incidental use of
+ <application>PL/Perl</application>, you should ensure that the
+ <productname>Perl</productname> installation was built with the
+ <literal>usemultiplicity</literal> option enabled (<literal>perl -V</literal>
+ will show whether this is the case).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Python</application> server programming
+ language, you need a <productname>Python</productname>
+ installation with the header files and
+ the <application>sysconfig</application> module. The minimum
+ required version is <productname>Python</productname> 3.2.
+ </para>
+
+ <para>
+ Since <application>PL/Python</application> will be a shared
+ library, the <indexterm><primary>libpython</primary></indexterm>
+ <filename>libpython</filename> library must be a shared library
+ also on most platforms. This is not the case in a default
+ <productname>Python</productname> installation built from source, but a
+ shared library is available in many operating system
+ distributions. <filename>configure</filename> will fail if
+ building <application>PL/Python</application> is selected but it cannot
+ find a shared <filename>libpython</filename>. That might mean that you
+ either have to install additional packages or rebuild (part of) your
+ <productname>Python</productname> installation to provide this shared
+ library. When building from source, run <productname>Python</productname>'s
+ configure with the <literal>--enable-shared</literal> flag.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Tcl</application>
+ procedural language, you of course need a <productname>Tcl</productname>
+ installation. The minimum required version is
+ <productname>Tcl</productname> 8.4.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To enable Native Language Support (<acronym>NLS</acronym>), that
+ is, the ability to display a program's messages in a language
+ other than English, you need an implementation of the
+ <application>Gettext</application> <acronym>API</acronym>. Some operating
+ systems have this built-in (e.g., <systemitem
+ class="osname">Linux</systemitem>, <systemitem class="osname">NetBSD</systemitem>,
+ <systemitem class="osname">Solaris</systemitem>), for other systems you
+ can download an add-on package from <ulink
+ url="https://www.gnu.org/software/gettext/"></ulink>.
+ If you are using the <application>Gettext</application> implementation in
+ the <acronym>GNU</acronym> C library then you will additionally
+ need the <productname>GNU Gettext</productname> package for some
+ utility programs. For any of the other implementations you will
+ not need it.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <productname>PostgreSQL</productname> documentation,
+ there is a separate set of requirements; see
+ <xref linkend="docguide-toolsets"/>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="configure-meson">
+ <title>Configuring the build</title>
+
+ <para>
+ The first step of the installation procedure is to configure the
+ source tree for your system and choose the options you would like. To
+ create and configure the build directory, you can start with the
+ <literal>meson setup</literal> command.
+ </para>
+
+<screen>
+<userinput>meson setup build</userinput>
+</screen>
+
+ <para>
+ The setup command takes a <literal>builddir</literal> and a <literal>srcdir</literal>
+ argument. If no <literal>srcdir</literal> is given Meson will deduce the
+ <literal>srcdir</literal> based on the current directory and the location
+ of <literal>meson.build</literal>. The <literal>builddir</literal> is mandatory.
+ </para>
+
+ <para>
+ Meson then loads the build configuration file and sets up the build directory.
+ Additionally, the invocation can pass options to Meson. The list of commonly
+ used options is in subsequent sections. A few examples of specifying different
+ build options are:
+
+<screen>
+#Setup build directory with a different installation prefix
+meson setup build --prefix=/home/user/pg-install
+
+#Setup build directory to generate a debug build
+meson setup build --buildtype=debug
+
+#Setup build directory with ssl (Use -D for project specific options)
+meson setup build -Dssl=openssl
+</screen>
+
+ Setting up the build directory is a one-time step. To reconfigure before a
+ new build, you can simply use the <literal>meson configure</literal> command
+ </para>
+
+<para>
+<screen>
+meson configure -Dcassert=true
+</screen>
+</para>
+
+<para>
+ <command>meson configure</command>'s commonly used command line options
+ are explained below. This list is not exhaustive (use
+ <literal>meson configure --help</literal> to get one that is).
+ The options not covered here are meant for advanced use-cases, and are
+ documented in the standard meson
+ <ulink url="https://mesonbuild.com/Commands.html#configure">documentation</ulink>.
+ These arguments can be used with <command>meson setup</command> as well.
+</para>
+
+ <sect3 id="configure-install-locations">
+ <title>Installation Locations</title>
+
+ <para>
+ These options control where <literal>ninja install (or meson install)</literal> will put
+ the files. The <option>--prefix</option> option is sufficient for
+ most cases. If you have special needs, you can customize the
+ installation subdirectories with the other options described in this
+ section. Beware however that changing the relative locations of the
+ different subdirectories may render the installation non-relocatable,
+ meaning you won't be able to move it after installation.
+ (The <literal>man</literal> and <literal>doc</literal> locations are
+ not affected by this restriction.)
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
+ <listitem>
+ <para>
+ Install all files under the directory <replaceable>PREFIX</replaceable>
+ instead of <filename>/usr/local/pgsql</filename>. The actual
+ files will be installed into various subdirectories; no files
+ will ever be installed directly into the
+ <replaceable>PREFIX</replaceable> directory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the directory for executable programs. The default
+ is <filename><replaceable>PREFIX</replaceable>/bin</filename>, which
+ normally means <filename>/usr/local/pgsql/bin</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for various configuration files,
+ <filename><replaceable>PREFIX</replaceable>/etc</filename> by default.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <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>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing C and C++ header files. The
+ default is <filename><replaceable>PREFIX</replaceable>/include</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for read-only data files used by the
+ installed programs. The default is
+ <filename><replaceable>PREFIX</replaceable>/share</filename>. Note that this has
+ nothing to do with where your database files will be placed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing locale data, in particular
+ message translation catalog files. The default is
+ <filename><replaceable>DATADIR</replaceable>/locale</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ The man pages that come with <productname>PostgreSQL</productname> will be installed under
+ this directory, in their respective
+ <filename>man<replaceable>x</replaceable></filename> subdirectories.
+ The default is <filename><replaceable>DATADIR</replaceable>/man</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <note>
+ <para>
+ Care has been taken to make it possible to install
+ <productname>PostgreSQL</productname> into shared installation locations
+ (such as <filename>/usr/local/include</filename>) without
+ interfering with the namespace of the rest of the system. First,
+ the string <quote><literal>/postgresql</literal></quote> is
+ automatically appended to <varname>datadir</varname>,
+ <varname>sysconfdir</varname>, and <varname>docdir</varname>,
+ unless the fully expanded directory name already contains the
+ string <quote><literal>postgres</literal></quote> or
+ <quote><literal>pgsql</literal></quote>. For example, if you choose
+ <filename>/usr/local</filename> as prefix, the documentation will
+ be installed in <filename>/usr/local/doc/postgresql</filename>,
+ but if the prefix is <filename>/opt/postgres</filename>, then it
+ will be in <filename>/opt/postgres/doc</filename>. The public C
+ header files of the client interfaces are installed into
+ <varname>includedir</varname> and are namespace-clean. The
+ internal header files and the server header files are installed
+ into private directories under <varname>includedir</varname>. See
+ the documentation of each interface for information about how to
+ access its header files. Finally, a private subdirectory will
+ also be created, if appropriate, under <varname>libdir</varname>
+ for dynamically loadable modules.
+ </para>
+ </note>
+ </sect3>
+
+ <sect3 id="configure-pg-features">
+ <title><productname>PostgreSQL</productname> Features</title>
+
+ <para>
+ The options described in this section enable building of
+ various <productname>PostgreSQL</productname> features that are not
+ built by default. Most of these are non-default only because they
+ require additional software, as described in
+ <xref linkend="install-requirements-meson"/>. To specify PostgreSQL
+ specific options, the name of the option should be prefixed by -D.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dnls=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Enables or disables Native Language Support (<acronym>NLS</acronym>),
+ that is, the ability to display a program's messages in a
+ language other than English. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To use this option, you will need an implementation of the
+ <application>Gettext</application> API.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplperl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Perl</application> server-side language. It
+ defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplpython=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Python</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpltcl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Tcl</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtcl_version=<replaceable>TCL_VERSION</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the TCL version to use when building PL/Tcl.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dicu=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for
+ the <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
+ library, enabling use of ICU collation
+ features<phrase condition="standalone-ignore"> (see
+ <xref linkend="collation"/>)</phrase>.
+ This requires the <productname>ICU4C</productname> package
+ to be installed. The minimum required version
+ of <productname>ICU4C</productname> is currently 4.2.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+
+ <para>
+ By default,
+ <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm>
+ will be used to find the required compilation options. This is
+ supported for <productname>ICU4C</productname> version 4.6 and later.
+ <!-- Add description for older ICU4C versions and when pkg-config isn't available-->
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-with-llvm-meson">
+ <term><option>-Dllvm=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for <productname>LLVM</productname> based
+ <acronym>JIT</acronym> compilation<phrase
+ condition="standalone-ignore"> (see <xref
+ linkend="jit"/>)</phrase>. This
+ requires the <productname>LLVM</productname> library to be installed.
+ The minimum required version of <productname>LLVM</productname> is
+ currently 3.9. It is set to disabled by default.
+ </para>
+ <para>
+ <command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm>
+ will be used to find the required compilation options.
+ <command>llvm-config</command>, and then
+ <command>llvm-config-$major-$minor</command> for all supported
+ versions, will be searched for in your <envar>PATH</envar>.
+ <!--Add substitute for LLVM_CONFIG when llvm-config is not in PATH-->
+ </para>
+
+ <para>
+ <productname>LLVM</productname> support requires a compatible
+ <command>clang</command> compiler (specified, if necessary, using the
+ <envar>CLANG</envar> environment variable), and a working C++
+ compiler (specified, if necessary, using the <envar>CXX</envar>
+ environment variable).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlz4=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>LZ4</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzstd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>Zstandard</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option>
+ <indexterm>
+ <primary>OpenSSL</primary>
+ <seealso>SSL</seealso>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Build with support for <acronym>SSL</acronym> (encrypted)
+ connections. The only <replaceable>LIBRARY</replaceable>
+ supported is <option>openssl</option>. This requires the
+ <productname>OpenSSL</productname> package to be installed.
+ <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenSSL</productname> installation is sufficient
+ before proceeding. The default for this option is none.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dgssapi=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for GSSAPI authentication. On many systems, the
+ GSSAPI system (usually a part of the Kerberos installation) is not
+ installed in a location
+ that is searched by default (e.g., <filename>/usr/include</filename>,
+ <filename>/usr/lib</filename>), so you must use the options
+ <option>-Dextra_include_dirs</option> and <option>-Dextra_lib_dirs</option> in
+ addition to this option. <filename>meson configure</filename> will check
+ for the required header files and libraries to make sure that
+ your GSSAPI installation is sufficient before proceeding.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dldap=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>LDAP</acronym><indexterm><primary>LDAP</primary></indexterm>
+ support for authentication and connection parameter lookup (see
+ <phrase id="install-ldap-links-meson"><xref linkend="libpq-ldap"/> and
+ <xref linkend="auth-ldap"/></phrase> for more information). On Unix,
+ this requires the <productname>OpenLDAP</productname> package to be
+ installed. On Windows, the default <productname>WinLDAP</productname>
+ library is used. <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenLDAP</productname> installation is sufficient before
+ proceeding. It defaults to auto, meaning that it will be enabled automatically
+ if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpam=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>PAM</acronym><indexterm><primary>PAM</primary></indexterm>
+ (Pluggable Authentication Modules) support. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbsd_auth=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with BSD Authentication support. (The BSD Authentication framework is
+ currently only available on OpenBSD.) It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystemd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support
+ for <application>systemd</application><indexterm><primary>systemd</primary></indexterm>
+ service notifications. This improves integration if the server
+ is started under <application>systemd</application> but has no impact
+ otherwise<phrase condition="standalone-ignore">; see <xref linkend="server-start"/> for more
+ information</phrase>. <application>libsystemd</application> and the
+ associated header files need to be installed to use this option.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbonjour=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for Bonjour automatic service discovery.
+ This requires Bonjour support in your operating system.
+ Recommended on macOS. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <xref linkend="uuid-ossp"/> module
+ (which provides functions to generate UUIDs), using the specified
+ UUID library.<indexterm><primary>UUID</primary></indexterm>
+ <replaceable>LIBRARY</replaceable> must be one of:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <option>none</option> to not build the ussp module. This is the default.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>bsd</option> to use the UUID functions found in FreeBSD, NetBSD,
+ and some other BSD-derived systems
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>e2fs</option> to use the UUID library created by
+ the <literal>e2fsprogs</literal> project; this library is present in most
+ Linux systems and in macOS, and can be obtained for other
+ platforms as well
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>ossp</option> to use the <ulink
+ url="http://www.ossp.org/pkg/lib/uuid/">OSSP UUID library</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxml=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxml2, enabling SQL/XML support. Libxml2 version 2.6.23 or
+ later is required for this feature. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To detect the required compiler and linker options, PostgreSQL will
+ query <command>pkg-config</command>, if that is installed and knows
+ about libxml2. Otherwise the program <command>xml2-config</command>,
+ which is installed by libxml2, will be used if it is found. Use
+ of <command>pkg-config</command> is preferred, because it can deal
+ with multi-architecture installations better.
+ </para>
+
+ <para>
+ To use a libxml2 installation that is in an unusual location, you
+ can set <command>pkg-config</command>-related environment
+ variables (see its documentation).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxslt=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxslt, enabling the
+ <xref linkend="xml2"/>
+ module to perform XSL transformations of XML.
+ <option>-Dlibxml</option> must be specified as well.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dreadline=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Allows use of the <application>Readline</application> library
+ (and <application>libedit</application> as well). This option enables
+ command-line editing and history in
+ <application>psql</application> and is strongly recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibedit_preferred=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this to true favors the use of the BSD-licensed <application>libedit</application> library
+ rather than GPL-licensed <application>Readline</application>. This option
+ is significant only if you have both libraries installed; the
+ default is false that is to use <application>Readline</application>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzlib=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+ Enabls use of the <application>Zlib</application> library.
+ This enables
+ support for compressed archives in <application>pg_dump</application>
+ and <application>pg_restore</application> and is recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dspinlocks=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true by default and
+ setting it to false will allow the build to succeed even if <productname>PostgreSQL</productname>
+ has no CPU spinlock support for the platform. The lack of
+ spinlock support will result in very poor performance; therefore,
+ this option should only be changed if the build aborts and
+ informs you that the platform lacks spinlock support. If setting this
+ option to false is required to build <productname>PostgreSQL</productname> on
+ your platform, please report the problem to the
+ <productname>PostgreSQL</productname> developers.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Datomics=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true and setting it to false will
+ disable use of CPU atomic operations. The option does nothing on
+ platforms that lack such operations. On platforms that do have
+ them, disabling atomics will result in poor performance. Changing
+ this option is only useful for debugging or making performance comparisons.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-build-process">
+ <title>Build Process Details</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>--auto_features=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this option allows you to override value of all 'auto' features.
+ This can be useful when you want to disable or enable all the "optional"
+ features at once without having to set each of them manually. The default
+ value for this parameter is auto.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--backend=<replaceable>BACKEND</replaceable></option></term>
+ <listitem>
+ <para>
+ The default backend meson uses is ninja and that should suffice for most use cases.
+ However, if you'd like to fully integrate with visual studio, you can set the
+ BACKEND to <command>vs</command>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C compiler.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_link_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C linker.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_include_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories that will be added to the list the compiler
+ searches for header files. If you have optional packages
+ (such as GNU <application>Readline</application>) installed in a non-standard
+ location,
+ you have to use this option and probably also the corresponding
+ <option>-Dextra_lib_dirs</option> option.
+ </para>
+ <para>
+ Example: <literal>-Dextra_include_dirs=/opt/gnu/include:/usr/sup/include</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_lib_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories to search for libraries. You will probably have
+ to use this option (and the corresponding
+ <option>-Dextra_include_dirs</option> option) if you have packages
+ installed in non-standard locations.
+ </para>
+ <para>
+ Example: <literal>-Dextra_lib_dirs=/opt/gnu/lib:/usr/sup/lib</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystem_tzdata=<replaceable>DIRECTORY</replaceable></option>
+ <indexterm>
+ <primary>time zone data</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ <productname>PostgreSQL</productname> includes its own time zone database,
+ which it requires for date and time operations. This time zone
+ database is in fact compatible with the IANA time zone
+ database provided by many operating systems such as FreeBSD,
+ Linux, and Solaris, so it would be redundant to install it again.
+ When this option is used, the system-supplied time zone database
+ in <replaceable>DIRECTORY</replaceable> is used instead of the one
+ included in the PostgreSQL source distribution.
+ <replaceable>DIRECTORY</replaceable> must be specified as an
+ absolute path. <filename>/usr/share/zoneinfo</filename> is a
+ likely directory on some operating systems. Note that the
+ installation routine will not detect mismatching or erroneous time
+ zone data. If you use this option, you are advised to run the
+ regression tests to verify that the time zone data you have
+ pointed to works correctly with <productname>PostgreSQL</productname>.
+ </para>
+
+ <indexterm><primary>cross compilation</primary></indexterm>
+
+ <para>
+ This option is mainly aimed at binary package distributors
+ who know their target operating system well. The main
+ advantage of using this option is that the PostgreSQL package
+ won't need to be upgraded whenever any of the many local
+ daylight-saving time rules change. Another advantage is that
+ PostgreSQL can be cross-compiled more straightforwardly if the
+ time zone database files do not need to be built during the
+ installation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term>
+ <listitem>
+ <para>
+ Append <replaceable>STRING</replaceable> to the PostgreSQL version number. You
+ can use this, for example, to mark binaries built from unreleased Git
+ snapshots or containing custom patches with an extra version string,
+ such as a <command>git describe</command> identifier or a
+ distribution package release number.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
+ <listitem>
+ <para>
+ If you have the binaries for certain by programs required to build
+ Postgres (with or without optional flags) stored at non-standard
+ paths, you could specify them manually to meson configure. The complete
+ list of programs for whom this is supported can be found by running
+ <literal>meson configure</literal>. An example is included below.
+<programlisting>meson configure -DBISON=PATH_TO_BISON</programlisting>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-layout">
+ <title>Data layout</title>
+
+ <para>
+ These options affect how PostgreSQL lays out data on disk.
+ Note that changing these breaks on-disk database compatibility,
+ meaning you cannot use <command>pg_upgrade</command> to upgrade to
+ a build with a different value of these options.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>segment size</firstterm>, in gigabytes. Large tables are
+ divided into multiple operating-system files, each of size equal
+ to the segment size. This avoids problems with file size limits
+ that exist on many platforms. The default segment size, 1 gigabyte,
+ is safe on all supported platforms. If your operating system has
+ <quote>largefile</quote> support (which most do, nowadays), you can use
+ a larger segment size. This can be helpful to reduce the number of
+ file descriptors consumed when working with very large tables.
+ But be careful not to select a value larger than is supported
+ by your platform and the file systems you intend to use. Other
+ tools you might wish to use, such as <application>tar</application>, could
+ also set limits on the usable file size.
+ It is recommended, though not absolutely required, that this value
+ be a power of 2.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within tables. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 32 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>WAL block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within the WAL log. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 64 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-devel">
+ <title>Developer Options</title>
+
+ <para>
+ Most of the options in this section are only of interest for
+ developing or debugging <productname>PostgreSQL</productname>.
+ They are not recommended for production builds, except
+ for <option>--debug</option>, which can be useful to enable
+ detailed bug reports in the unlucky event that you encounter a bug.
+ On platforms supporting DTrace, <option>-Ddtrace</option>
+ may also be reasonable to use in production.
+ </para>
+
+ <para>
+ When building an installation that will be used to develop code inside
+ the server, it is recommended to use at least the <option>--buildtype=debug</option>
+ and <option>-Dcassert</option> options.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to specify the buildtype to use; defaults
+ to release. If you'd like finer control on the debug symbols
+ and optimization levels than what this option provides, you can
+ refer to the --debug and --optimization flags.
+
+ The following build types are generally used:
+ <variablelist>
+ <varlistentry>
+ <term><literal>plain</literal></term>
+ <listitem>
+ <para>
+ No extra build flags are used, even for compiler warnings,
+ useful for distro packagers and other cases where you need to
+ specify all arguments by yourself.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debug</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated but the result is not optimized.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debugoptimized</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated and the code is optimized (on most compilers
+ this means <literal>-g -O2</literal>)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>release</literal></term>
+ <listitem>
+ <para>
+ This enables full optimization and no debug info is generated. This is
+ the default.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--debug</option></term>
+ <listitem>
+ <para>
+ Compiles all programs and libraries with debugging symbols.
+ This means that you can run the programs in a debugger
+ to analyze problems. This enlarges the size of the installed
+ executables considerably, and on non-GCC compilers it usually
+ also disables compiler optimization, causing slowdowns. However,
+ having the symbols available is extremely helpful for dealing
+ with any problems that might arise. Currently, this option is
+ recommended for production installations only if you use GCC.
+ But you should always have it on if you are doing development work
+ or running a beta version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term>
+ <listitem>
+ <para>
+ Specify the optimization level. LEVEL can be set to any of {0,g,1,2,3,s}.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--werror</option></term>
+ <listitem>
+ <para>
+ Setting this option asks the compiler to treat warnings as errors. This can
+ be useful for code development purposes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dcassert</option></term>
+ <listitem>
+ <para>
+ Enables <firstterm>assertion</firstterm> checks in the server, which test for
+ many <quote>cannot happen</quote> conditions. This is invaluable for
+ code development purposes, but the tests can slow down the
+ server significantly.
+ Also, having the tests turned on won't necessarily enhance the
+ stability of your server! The assertion checks are not categorized
+ for severity, and so what might be a relatively harmless bug will
+ still lead to server restarts if it triggers an assertion
+ failure. This option is not recommended for production use, but
+ you should have it on for development work or when running a beta
+ version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtap-tests</option></term>
+ <listitem>
+ <para>
+ Enable tests using the Perl TAP tools. This requires a Perl
+ installation and the Perl module <literal>IPC::Run</literal>.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-tap"/> for more information.</phrase>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-DPG_TEST_EXTRA=<replaceable>TEST_SUITES</replaceable></option></term>
+ <listitem>
+ <para>
+ Enable test suites which require special software to run. This option
+ accepts arguments via a whitespace-separated list. The following values
+ are currently supported:
+ <variablelist>
+ <varlistentry>
+ <term><literal>kerberos</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/kerberos</filename>. This
+ requires an MIT Kerberos installation and opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ldap</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ldap</filename>. This
+ requires an <productname>OpenLDAP</productname> installation and opens
+ TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ssl</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ssl</filename>. This opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>wal_consistency_checking</literal></term>
+ <listitem>
+ <para>
+ Uses <literal>wal_consistency_checking=all</literal> while running
+ certain tests under <filename>src/test/recovery</filename>. Not
+ enabled by default because it is resource intensive.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ Tests for features that are not supported by the current build
+ configuration are not run even if they are mentioned in
+ <varname>PG_TEST_EXTRA</varname>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--errorlogs</option></term>
+ <listitem>
+ <para>
+ This option can be used to print the logs from the failing tests
+ making debugging easier.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Db_coverage</option></term>
+ <listitem>
+ <para>
+ If using GCC, all programs and libraries are compiled with
+ code coverage testing instrumentation. When run, they
+ generate files in the build directory with code coverage
+ metrics.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-coverage"/>
+ for more information.</phrase> This option is for use only with GCC
+ and when doing development work.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Ddtrace=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>DTrace</primary>
+ </indexterm>
+ Enabling this compiles <productname>PostgreSQL</productname> with support for the
+ dynamic tracing tool DTrace.
+ <phrase condition="standalone-ignore">See <xref linkend="dynamic-trace"/>
+ for more information.</phrase>
+ </para>
+
+ <para>
+ To point to the <command>dtrace</command> program, the
+ environment variable <envar>DTRACE</envar> can be set. This
+ will often be necessary because <command>dtrace</command> is
+ typically installed under <filename>/usr/sbin</filename>,
+ which might not be in your <envar>PATH</envar>.
+ </para>
+
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-misc">
+ <title>Miscellaneous</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term>
+ <listitem>
+ <para>
+ Set <replaceable>NUMBER</replaceable> as the 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
+ <productname>PostgreSQL</productname> servers on the same machine.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term>
+ <listitem>
+ <para>
+ The default name of the Kerberos service principal used
+ by GSSAPI.
+ <literal>postgres</literal> is the default. There's usually no
+ reason to change this unless you are building for a Windows
+ environment, in which case it must be set to upper case
+ <literal>POSTGRES</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="build-meson">
+ <title>Building the source</title>
+ <para>
+ By default, <productname>Meson</productname> uses the
+ <ulink url="https://ninja-build.org/"> Ninja build system</ulink>.
+ To build <productname>PostgreSQL</productname> from source using meson, you can
+ simply use the <literal>ninja</literal> command in the build directory.
+<screen>
+ninja
+</screen>
+ Ninja will automatically detect the number of CPUs in your computer and
+ parallelize itself accordingly. You can override the amount of parallel
+ processes used with the command line argument <literal>-j</literal>.
+ </para>
+
+ <para>
+ It should be noted that after the initial configure step
+ <command>ninja</command> is the only command you ever need to type to
+ compile. No matter how you alter your source tree (short of moving it to
+ a completely new location), Meson will detect the changes and regenerate
+ itself accordingly. This is especially handy if you have multiple build
+ directories. Often one of them is used for development (the "debug" build)
+ and others only every now and then (such as a "static analysis" build).
+ Any configuration can be built just by cd'ing to the corresponding directory
+ and running Ninja.
+ </para>
+
+ <para>
+ If you'd like to build with a backend other that ninja, you can use configure
+ with the <option>--backend</option> option to select the one you want to use and then
+ build using <literal>meson compile</literal>. To learn more about these
+ backends and other arguments you can provide to ninja, you can refer to the
+ meson <ulink url="https://mesonbuild.com/Running-Meson.html#building-from-the-source">
+ documentation</ulink>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-files-meson">
+ <title>Installing the files</title>
+ <para>
+ Once Postgres is built, you can install it by simply running the
+ <literal>ninja install</literal> command.
+
+<screen>
+ninja install
+</screen>
+ </para>
+
+ <para>
+ This will install files into the directories that were specified
+ in <xref linkend="configure-meson"/>. Make sure that you have appropriate
+ permissions to write into that area. You might need to do this
+ step as root. Alternatively, you can create the target directories
+ in advance and arrange for appropriate permissions to be granted.
+ The standard installation provides all the header files needed for client
+ application development as well as for server-side program
+ development, such as custom functions or data types written in C.
+ </para>
+
+ <para>
+ <literal>ninja install</literal> should work for most cases
+ but if you'd like to use more options, you could also use
+ <literal>meson install</literal> instead. You can learn more about
+ <ulink url="https://mesonbuild.com/Commands.html#install">meson install</ulink>
+ and it's options in the meson documentation.
+ </para>
+
+ <para>
+ Depending on your platform and setup, you might have to perform a
+ few steps after installation. Those are outlined in
+ <xref linkend="install-post"/>.
+ </para>
+
+ <formalpara>
+ <title>Uninstallation:</title>
+ <para>
+ To undo the installation, you can use the <command>ninja
+ uninstall</command> command.
+ </para>
+ </formalpara>
+
+ <formalpara>
+ <title>Cleaning:</title>
+ <para>
+ After the installation you can free disk space by removing the built
+ files from the source tree with the <command>ninja clean</command>
+ command.
+ </para>
+ </formalpara>
+
+ </sect2>
+
+ <sect2 id="running-tests">
+ <title>Running tests</title>
+ <para>
+ If you want to test the newly built server, you can run the regression
+ tests. The regression tests are a collection of test suites to verify
+ that <productname>PostgreSQL</productname> runs on your machine in
+ the way the developers expected it to. To run them, simply type:
+<screen>
+<userinput>meson test</userinput>
+</screen>
+ You can repeat this at any later time by issuing the same command.
+ </para>
+
+ <para>Meson also allows you to list tests and run specific tests or suites.
+<screen>
+# List all tests
+<userinput>meson test --list</userinput>
+
+# Run a specific test
+<userinput>meson test recovery/001_stream_rep</userinput>
+
+# Run the main pg_regress and isolation tests
+<userinput>meson test --suite main</userinput>
+</screen>
+ </para>
+
+ <para>
+ To learn more about running the tests and how to interpret the results
+ you can refer to the documentation for interpreting test results.
+ <literal>meson test</literal> also provides a number of additional
+ options you can use which can be found in the
+ <ulink url="https://mesonbuild.com/Unit-tests.html#testing-tool">meson test documentation</ulink>.
+ </para>
+
+ </sect2>
+
+ </sect1>
+
<sect1 id="install-post">
<title>Post-Installation Setup</title>
@@ -2106,62 +3797,6 @@ export MANPATH
</sect2>
</sect1>
- <sect1 id="supported-platforms">
- <title>Supported Platforms</title>
-
- <para>
- A platform (that is, a CPU architecture and operating system combination)
- is considered supported by the <productname>PostgreSQL</productname> development
- community if the code contains provisions to work on that platform and
- it has recently been verified to build and pass its regression tests
- on that platform. Currently, most testing of platform compatibility
- is done automatically by test machines in the
- <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
- If you are interested in using <productname>PostgreSQL</productname> on a platform
- that is not represented in the build farm, but on which the code works
- or can be made to work, you are strongly encouraged to set up a build
- farm member machine so that continued compatibility can be assured.
- </para>
-
- <para>
- In general, <productname>PostgreSQL</productname> can be expected to work on
- these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
- and PA-RISC, including
- big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
- It is often
- possible to build on an unsupported CPU type by configuring with
- <option>--disable-spinlocks</option>, but performance will be poor.
- </para>
-
- <para>
- <productname>PostgreSQL</productname> can be expected to work on current
- versions of these operating systems: Linux, Windows,
- FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
- Other Unix-like systems may also work but are not currently
- being tested. In most cases, all CPU architectures supported by
- a given operating system will work. Look in
- <xref linkend="installation-platform-notes"/> below to see if
- there is information
- specific to your operating system, particularly if using an older system.
- </para>
-
- <para>
- If you have installation problems on a platform that is known
- to be supported according to recent build farm results, please report
- it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
- in porting <productname>PostgreSQL</productname> to a new platform,
- <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
- to discuss that.
- </para>
-
- <para>
- Historical versions of <productname>PostgreSQL</productname> or POSTGRES
- also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
- M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
- BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
- Tru64 UNIX, and ULTRIX.
- </para>
- </sect1>
<sect1 id="installation-platform-notes">
<title>Platform-Specific Notes</title>
@@ -2170,7 +3805,7 @@ export MANPATH
This section documents additional platform-specific issues
regarding the installation and setup of PostgreSQL. Be sure to
read the installation instructions, and in
- particular <xref linkend="install-requirements"/> as well. Also,
+ particular <xref linkend="install-requirements-make"/> as well. Also,
check <xref linkend="regress"/> regarding the
interpretation of regression test results.
</para>
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 1d9509a2f66..214e1b1d551 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -7072,7 +7072,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
explicitly tell the configure script to make the probes available
in <productname>PostgreSQL</productname>. To include DTrace support
specify <option>--enable-dtrace</option> to configure. See <xref
- linkend="install-procedure"/> for further information.
+ linkend="configure-options-devel"/> for further information.
</para>
</sect2>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index f268265a838..7a1d220175b 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1855,7 +1855,7 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
<step>
<para>
Install the new version of <productname>PostgreSQL</productname> as
- outlined in <xref linkend="install-procedure"/>.
+ outlined in <xref linkend="installation"/>.
</para>
</step>
diff --git a/doc/src/sgml/sourcerepo.sgml b/doc/src/sgml/sourcerepo.sgml
index 0ed7f8a3fea..f16be29a61a 100644
--- a/doc/src/sgml/sourcerepo.sgml
+++ b/doc/src/sgml/sourcerepo.sgml
@@ -20,9 +20,10 @@
Note that building <productname>PostgreSQL</productname> from the source
repository requires reasonably up-to-date versions of <application>bison</application>,
<application>flex</application>, and <application>Perl</application>. These tools are not needed
- to build from a distribution tarball, because the files that these tools
+ to build from a distribution tarball if building via make, because the files that these tools
are used to build are included in the tarball. Other tool requirements
- are the same as shown in <xref linkend="install-requirements"/>.
+ are the same as shown in <xref linkend="install-requirements-make"/> and
+ <xref linkend="install-requirements-meson"/>.
</para>
<sect1 id="git">
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0007-meson-Add-PGXS-compatibility.patch (7.4K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/8-v16-0007-meson-Add-PGXS-compatibility.patch)
download | inline diff:
From 6d2a49f68340acaf4974ed5e9c35d9261a5be9cf Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 20:27:17 -0700
Subject: [PATCH v16 07/16] meson: Add PGXS compatibility
This works for some extensions on some operating systems, but could use plenty
of cleanups.
---
src/meson.build | 259 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 259 insertions(+)
diff --git a/src/meson.build b/src/meson.build
index b515af15bfa..ca99db42baa 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -10,3 +10,262 @@ subdir('bin')
subdir('pl')
subdir('interfaces')
+
+
+### Generate a Makefile.global that's complete enough for PGXS to work.
+#
+# This is somewhat ugly, but allows extensions to only use a single
+# buildsystem across all the supported postgres versions. Once all supported
+# PG versions support meson, we can remove all of this.
+#
+# XXX: Should we make this optional?
+
+pgxs_kv = {
+ 'PACKAGE_URL': pg_url,
+ 'PACKAGE_VERSION': pg_version,
+ 'PG_MAJORVERSION': pg_version_major,
+ 'PG_VERSION_NUM': pg_version_num,
+ 'configure_input': 'meson',
+
+ 'vpath_build': 'yes',
+ 'autodepend': 'no', # XXX: Should we just set this to true when possible?
+
+ 'host_cpu': host_cpu,
+ 'host': '@0@-@1@'.format(host_cpu, host_system),
+ 'host_os': host_system,
+ 'build_os': build_machine.system(),
+ 'PORTNAME': portname,
+ 'PG_SYSROOT': pg_sysroot,
+
+ 'abs_top_builddir': meson.build_root(),
+ 'abs_top_srcdir': meson.source_root(),
+
+ 'enable_thread_safety': 'yes',
+ 'enable_rpath': 'yes',
+ 'enable_nls': libintl.found() ? 'yes' : 'no',
+ 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
+ 'enable_debug': get_option('debug') ? 'yes' : 'no',
+ 'enable_coverage': get_option('b_coverage') ? 'yes' : 'no',
+ 'enable_dtrace': dtrace.found() ? 'yes' : 'no',
+
+ 'DLSUFFIX': dlsuffix,
+ 'EXEEXT': exesuffix,
+
+ 'SUN_STUDIO_CC': 'no', # not supported so far
+
+ 'default_port': get_option('pgport'),
+ 'with_system_tzdata': get_option('system_tzdata'),
+
+ 'with_krb_srvnam': get_option('krb_srvnam'),
+ 'krb_srvtab': krb_srvtab,
+
+ # FIXME: implement programs.m4 logic in PGAC_CHECK_STRIP
+ 'STRIP': 'strip',
+ 'STRIP_STATIC_LIB': 'strip -x',
+ 'STRIP_SHARED_LIB': 'strip --strip-unneeded',
+
+ # Just always use the install_sh fallback that autoconf uses. Unlikely to
+ # matter performance-wise for extensions. If it turns out to do, we can
+ # improve that later.
+ 'MKDIR_P': ' '.join([install_sh.path(), '-d']),
+
+ 'CC': var_cc,
+ 'CPP': var_cpp,
+ 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
+ 'with_gnu_ld': (cc.get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.lld'] ? 'yes' : 'no'),
+
+ 'CFLAGS': var_cflags,
+ 'CPPFLAGS': var_cppflags,
+ 'CXXFLAGS': var_cxxflags,
+ 'CFLAGS_SL': var_cflags_sl,
+ 'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
+ 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
+ 'CFLAGS_SSE42': ' '.join(cflags_crc),
+ 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
+ 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
+
+ # FIXME:
+ 'CFLAGS_ARMV8_CRC32C': '',
+ 'BITCODE_CFLAGS': '',
+ 'BITCODE_CXXFLAGS': '',
+
+ 'LDFLAGS': var_ldflags,
+ 'LDFLAGS_EX': var_ldflags_ex,
+ 'LDFLAGS_SL': var_ldflags_sl,
+
+ 'BISONFLAGS': ' '.join(bison_flags),
+ 'FLEXFLAGS': ' '.join(flex_flags),
+
+ 'LIBS': var_libs,
+}
+
+if llvm.found()
+ pgxs_kv += {
+ 'CLANG': clang.path(),
+ 'CXX': ' '.join(cpp.cmd_array()),
+ 'LLVM_BINPATH': llvm_binpath,
+ }
+else
+ pgxs_kv += {
+ 'CLANG': '',
+ 'CXX': '',
+ 'LLVM_BINPATH': '',
+ }
+endif
+
+pgxs_cdata = configuration_data(pgxs_kv)
+
+# FIXME: figure out which platforms we still need the linker "directly" -
+# can't be many?
+
+ld_program = find_program(cc.get_linker_id(), native: true, required: false)
+
+pgxs_bins = {
+ 'BISON': bison,
+ 'FLEX': flex,
+ 'GZIP': gzip,
+ 'LZ4': program_lz4,
+ 'PERL': perl,
+ 'PROVE': prove,
+ 'PYTHON': python,
+ 'TAR': tar,
+ 'ZSTD': program_zstd,
+ 'DTRACE': dtrace,
+ 'LD': ld_program,
+ 'install_bin': install_sh,
+}
+foreach b, p : pgxs_bins
+ pgxs_cdata.set(b, p.found() ? p.path() : '')
+endforeach
+
+pgxs_empty = [
+ 'PERMIT_DECLARATION_AFTER_STATEMENT',
+ 'ICU_CFLAGS', # needs to be added, included by public server headers
+
+ # probably need most of these?
+ 'RANLIB',
+ 'WINDRES',
+ 'LN_S',
+ 'AR',
+ 'AWK',
+
+ # hard to see why we'd need either?
+ 'ZIC',
+ 'TCLSH',
+
+ # docs don't seem to be supported by pgxs
+ 'XMLLINT',
+ 'XSLTPROC',
+ 'DBTOEPUB',
+ 'FOP',
+
+ # supporting coverage for pgxs-in-meson build doesn't seem worth it
+ 'GENHTML',
+ 'LCOV',
+ 'GCOV',
+ 'MSGFMT_FLAGS',
+
+ # translation doesn't appear to be supported by pgxs
+ 'MSGFMT',
+ 'XGETTEXT',
+ 'MSGMERGE',
+ 'WANTED_LANGUAGES',
+
+ # Not needed because we don't build the server / PLs with the generated makefile
+ 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
+ 'DTRACEFLAGS', # only server has dtrace probes
+
+ 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
+ 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
+
+ # possible that some of these are referenced explicitly in pgxs makefiles?
+ # For now not worth it.
+ 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
+
+ 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
+
+ 'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
+
+ 'UUID_LIBS',
+
+ 'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
+
+ 'ICU_LIBS',
+]
+
+foreach pe : pgxs_empty
+ pgxs_cdata.set(pe, '')
+endforeach
+
+pgxs_dirs = {
+ 'prefix': get_option('prefix'),
+
+ 'bindir': '${exec_prefix}' / get_option('bindir'),
+ 'datarootdir': '${prefix}' / get_option('datadir'),
+ 'datadir': '${datarootdir}',
+ 'docdir': '${prefix}' / dir_doc,
+ 'exec_prefix': '${prefix}',
+ 'htmldir': '${prefix}' / dir_doc_html, #?
+ 'includedir': '${prefix}' / get_option('includedir'),
+ 'libdir': '${exec_prefix}' / get_option('libdir'),
+ 'localedir': '${prefix}' / get_option('localedir'),
+ 'mandir': '${prefix}' / get_option('mandir'),
+ 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
+}
+
+foreach d, p : pgxs_dirs
+ pgxs_cdata.set(d, p)
+endforeach
+
+pgxs_deps = {
+ 'bonjour': bonjour,
+ 'bsd_auth': bsd_auth,
+ 'gssapi': gssapi,
+ 'icu': icu,
+ 'ldap': ldap,
+ 'libxml': libxml,
+ 'libxslt': libxslt,
+ 'llvm': llvm,
+ 'lz4': lz4,
+ 'nls': libintl,
+ 'pam': pam,
+ 'perl': perl_dep,
+ 'python': python3_dep,
+ 'readline': readline,
+ 'selinux': selinux,
+ 'systemd': systemd,
+ 'tcl': tcl_dep,
+ 'zlib': zlib,
+ 'zstd': zstd,
+}
+foreach d, v : pgxs_deps
+ pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')
+endforeach
+
+pgxs_cdata.set('with_ssl', get_option('ssl'))
+pgxs_cdata.set('with_uuid', uuidopt)
+
+makefile_global = configure_file(
+ input: 'Makefile.global.in',
+ output: 'Makefile.global',
+ configuration: pgxs_cdata,
+ install: true,
+ install_dir: dir_pgxs / 'src',
+)
+configure_files += makefile_global
+
+# FIXME: check if exists
+makefile_port = configure_file(
+ input: 'makefiles' / 'Makefile.@0@'.format(portname),
+ output: 'Makefile.port',
+ copy: true,
+ install_dir: dir_pgxs / 'src')
+configure_files += makefile_port
+
+install_data(
+ 'Makefile.shlib', 'nls-global.mk',
+ install_dir: dir_pgxs / 'src')
+
+install_data(
+ 'makefiles/pgxs.mk',
+ install_dir: dir_pgxs / 'src' / 'makefiles')
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0008-meson-Add-postgresql-extension.pc-for-building-e.patch (3.7K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/9-v16-0008-meson-Add-postgresql-extension.pc-for-building-e.patch)
download | inline diff:
From 28d7143ad8d35c097d1d22609d838c19b5b5b984 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:52:03 -0700
Subject: [PATCH v16 08/16] meson: Add postgresql-extension.pc for building
extension libraries
This should work with several other buildsystems.
TODO: Docs and example
---
src/backend/meson.build | 96 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index fefa40ddb64..0598085a240 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -180,6 +180,102 @@ pg_mod_args = default_mod_args + {
+###############################################################
+# Define a .pc file that can be used to build server extensions
+###############################################################
+
+pg_ext_vars = []
+pg_ext_vars_inst = []
+pg_ext_vars_uninst = []
+
+pg_ext_cflags = pg_mod_c_args
+pg_ext_libs = [backend_mod_code, thread_dep, ldflags, ldflags_mod]
+pg_ext_subdirs = ['']
+
+# Compute directories to add include directories to the .pc files for.
+# This is a bit more complicated due to port/win32 etc.
+i = 0
+foreach incdir : postgres_inc_d
+ if incdir.startswith('src/include')
+ subincdir = dir_include_pkg_rel / 'server' / incdir.split('src/include/').get(1, '')
+ else
+ subincdir = ''
+ endif
+ pg_ext_subdirs += subincdir
+
+ # Add directories in source / build dir containing headers to cflags for the
+ # -uninstalled.pc
+ pg_ext_vars_uninst += [
+ 'build_inc@0@=-I${prefix}/@1@'.format(i, incdir),
+ 'src_inc@0@=-I${srcdir}/@1@'.format(i, incdir),
+ ]
+ pg_ext_cflags += [
+ '${build_inc@0@}'.format(i),
+ '${src_inc@0@}'.format(i)
+ ]
+
+ i += 1
+endforeach
+
+
+# Extension modules should likely also use -fwrapv etc. But it it's a bit odd
+# to expose it to a .pc file?
+pg_ext_cflags += cflags
+
+# Directories for extensions to install into
+# XXX: more needed
+pg_ext_vars += 'pkglibdir=${prefix}/@0@'.format(dir_lib_pkg)
+pg_ext_vars += 'dir_mod=${pkglibdir}'
+pg_ext_vars += 'dir_data=${prefix}/@0@'.format(dir_data_extension)
+# referenced on some platforms, via mod_link_with_dir
+pg_ext_vars += 'bindir=${prefix}/@0@'.format(dir_bin)
+
+# XXX: Define variables making it easy to define tests, too
+
+# Some platforms need linker flags to link with binary, they are the same
+# between building with meson and .pc file, except that we have have to
+# reference a variable to make it work for both normal and -uninstalled .pc
+# files.
+if mod_link_args_fmt.length() != 0
+ assert(link_with_inst != '')
+ assert(link_with_uninst != '')
+
+ pg_ext_vars_inst += 'mod_link_with=@0@'.format(link_with_inst)
+ pg_ext_vars_uninst += 'mod_link_with=@0@'.format(link_with_uninst)
+
+ foreach el : mod_link_args_fmt
+ pg_ext_libs += el.format('${mod_link_with}')
+ endforeach
+endif
+
+# main .pc to build extensions
+pkgconfig.generate(
+ name: 'postgresql-extension',
+ description: 'PostgreSQL Extension Support',
+ url: pg_url,
+
+ subdirs: pg_ext_subdirs,
+ libraries: pg_ext_libs,
+ extra_cflags: pg_ext_cflags,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+# a .pc depending on the above, but with all our warnings enabled
+pkgconfig.generate(
+ name: 'postgresql-extension-warnings',
+ description: 'PostgreSQL Extension Support - Compiler Warnings',
+ requires: 'postgresql-extension',
+ url: pg_url,
+ extra_cflags: cflags_warn,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+
+
# Shared modules that, on some system, link against the server binary. Only
# enter these after we defined the server build.
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0009-meson-Add-LLVM-bitcode-emission.patch (5.2K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/10-v16-0009-meson-Add-LLVM-bitcode-emission.patch)
download | inline diff:
From d769f2afca679643e1b7f63358fceee23fb46491 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 19:58:45 -0700
Subject: [PATCH v16 09/16] meson: Add LLVM bitcode emission
This needs a bit more love before being ready...
---
src/backend/jit/llvm/meson.build | 21 +++++++++++++++
src/backend/meson.build | 46 ++++++++++++++++++++++++++++++++
meson.build | 2 ++
src/tools/irlink | 43 +++++++++++++++++++++++++++++
4 files changed, 112 insertions(+)
create mode 100644 src/tools/irlink
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index 5fb63768358..5b339e33934 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -54,6 +54,19 @@ else
llvm_irgen_command = clang
endif
+llvm_irlink_kw = {
+ 'command': [
+ irlink,
+ '--name', 'postgres',
+ '--lto', llvm_lto,
+ '--outdir', '@OUTPUT0@',
+ '--privdir', '@PRIVATE_DIR@',
+ '@INPUT@',
+ ],
+ 'install': true,
+ 'install_dir': dir_lib_pkg,
+}
+
# XXX: Need to determine proper version of the function cflags for clang
bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
@@ -77,3 +90,11 @@ llvmjit_types = custom_target('llvmjit_types.bc',
depfile: '@BASENAME@.c.bc.d',
)
backend_targets += llvmjit_types
+
+# Figure out -I's needed to build all postgres code, including all its
+# dependencies
+pkg_config = find_program(['pkg-config', 'pkgconf'], required: true)
+r = run_command(pkg_config,
+ ['--cflags-only-I', meson.build_root() / 'meson-uninstalled/postgresql-extension-uninstalled.pc'],
+ check: true)
+bitcode_cflags += r.stdout().split()
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 0598085a240..1cb4cd3431f 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -284,3 +284,49 @@ subdir('replication/libpqwalreceiver')
subdir('replication/pgoutput')
subdir('snowball')
subdir('utils/mb/conversion_procs')
+
+
+
+###############################################################
+# emit LLVM bitcode of backend code for JIT inlining
+###############################################################
+
+if llvm.found()
+
+ # custom_target() insists on targeting files into the current
+ # directory. But we have files with the same name in different
+ # subdirectories. generators() don't have that problem, but their results
+ # are not installable. The irlink command copies the files for us.
+ #
+ # FIXME: this needs to be in a central place
+ #
+ # generators don't accept CustomTargetIndex as input or 'depends', nor do
+ # they like targets with more than one output. However, a custom target
+ # accepts them as input without a problem. So we have the below transitive
+ # target :(
+
+ transitive_depend_target = custom_target('stamp',
+ input: generated_headers + generated_backend_headers + generated_backend_sources,
+ output: 'stamp',
+ command: [touch, '@OUTPUT@'],
+ install: false)
+
+ llvm_gen = generator(llvm_irgen_command,
+ arguments: llvm_irgen_args + bitcode_cflags,
+ depends: transitive_depend_target,
+ depfile: '@BASENAME@.c.bc.d',
+ output: '@PLAINNAME@.bc',
+ )
+
+ bc_backend_sources = llvm_gen.process(backend_sources,
+ preserve_path_from: meson.current_source_dir())
+
+ postgres_llvm = custom_target('bitcode',
+ output: ['bitcode'],
+ input: bc_backend_sources,
+ kwargs: llvm_irlink_kw,
+ )
+
+ backend_targets += postgres_llvm
+
+endif
diff --git a/meson.build b/meson.build
index 8323adf772b..2b0cbb9a5a7 100644
--- a/meson.build
+++ b/meson.build
@@ -684,6 +684,8 @@ if not llvmopt.disabled()
ccache = find_program('ccache', native: true, required: false)
clang = find_program(llvm_binpath / 'clang', required: true)
+ llvm_lto = find_program(llvm_binpath / 'llvm-lto', required: true)
+ irlink = find_program('src/tools/irlink', native: true)
endif
else
llvm = not_found_dep
diff --git a/src/tools/irlink b/src/tools/irlink
new file mode 100644
index 00000000000..813bbf13398
--- /dev/null
+++ b/src/tools/irlink
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+import argparse
+
+parser = argparse.ArgumentParser(
+ description='generate PostgreSQL JIT IR module')
+
+parser.add_argument('--name', type=str, required=True)
+parser.add_argument('--lto', type=str, required=True)
+parser.add_argument('--privdir', type=str, required=True)
+parser.add_argument('--outdir', type=str, required=True)
+parser.add_argument('INPUT', type=str, nargs='+')
+
+args = parser.parse_args()
+
+outdir = os.path.realpath(args.outdir)
+privdir = os.path.realpath(args.privdir)
+
+index = '{0}/{1}.index.bc'.format(outdir, args.name)
+destdir = '{0}/{1}'.format(outdir, args.name)
+
+# Remove old contents if exist
+if os.path.exists(destdir):
+ shutil.rmtree(destdir)
+
+shutil.copytree(privdir, destdir)
+
+# Change working directory for irlink to link correctly
+os.chdir(args.outdir)
+
+file_names = []
+for input in args.INPUT:
+ file_names += [args.name + input.replace(args.privdir, '')]
+
+command = [args.lto, '-thinlto', '-thinlto-action=thinlink',
+ '-o', index] + file_names
+res = subprocess.run(command)
+
+exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0010-windows-Set-UMDF_USING_NTSTATUS-globally-include.patch (3.7K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/11-v16-0010-windows-Set-UMDF_USING_NTSTATUS-globally-include.patch)
download | inline diff:
From 6eaef1813979d0d6da7a949765327077559bf939 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 11:06:20 -0700
Subject: [PATCH v16 10/16] windows: Set UMDF_USING_NTSTATUS globally, include
ntstatus.h
We'd like to use precompiled headers on windows to reduce compile times. Right
now we rely on defining WIN32_NO_STATUS before including postgres.h in a few
select places - which doesn't work with precompiled headers. Instead define
it globally.
When UMDF_USING_NTSTATUS is defined we need to explicitly include ntstatus.h,
winternl.h to get a comparable set of symbols. Right now these includes would
be required in a number of non-platform-specific .c files - to avoid that,
include them in win32_port.h. Based on my measurements that doesn't increase
compile times measurably.
---
src/include/port/win32_port.h | 9 +++++++++
src/include/port/win32ntdll.h | 6 ------
src/port/open.c | 2 --
src/port/win32fdatasync.c | 2 --
src/port/win32ntdll.c | 2 --
src/port/win32stat.c | 2 --
6 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index 707f8760cab..67382245504 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -48,12 +48,21 @@
* significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to
* remove the include of windows.h (as well as indirect inclusions of it) from
* such a central place, but until then...
+ *
+ * To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by
+ * temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about
+ * macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in
+ * turn requires including ntstatus.h, winternl.h to get common symbols.
*/
#define WIN32_LEAN_AND_MEAN
+#define UMDF_USING_NTSTATUS
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
+#include <ntstatus.h>
+#include <winternl.h>
+
#undef small
#include <process.h>
#include <signal.h>
diff --git a/src/include/port/win32ntdll.h b/src/include/port/win32ntdll.h
index 34cebddd542..6d13a18b395 100644
--- a/src/include/port/win32ntdll.h
+++ b/src/include/port/win32ntdll.h
@@ -14,12 +14,6 @@
#ifndef WIN32NTDLL_H
#define WIN32NTDLL_H
-/*
- * Because this includes NT headers that normally conflict with Win32 headers,
- * any translation unit that includes it should #define UMDF_USING_NTSTATUS
- * before including <windows.h>.
- */
-
#include <ntstatus.h>
#include <winternl.h>
diff --git a/src/port/open.c b/src/port/open.c
index 8c09c7c1f77..fd4faf604ea 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -13,8 +13,6 @@
#ifdef WIN32
-#define UMDF_USING_NTSTATUS
-
#ifndef FRONTEND
#include "postgres.h"
#else
diff --git a/src/port/win32fdatasync.c b/src/port/win32fdatasync.c
index 31d631c6962..a5431615ab2 100644
--- a/src/port/win32fdatasync.c
+++ b/src/port/win32fdatasync.c
@@ -11,8 +11,6 @@
*-------------------------------------------------------------------------
*/
-#define UMDF_USING_NTSTATUS
-
#ifdef FRONTEND
#include "postgres_fe.h"
#else
diff --git a/src/port/win32ntdll.c b/src/port/win32ntdll.c
index eb614077543..db3e5fa251f 100644
--- a/src/port/win32ntdll.c
+++ b/src/port/win32ntdll.c
@@ -13,8 +13,6 @@
*-------------------------------------------------------------------------
*/
-#define UMDF_USING_NTSTATUS
-
#include "c.h"
#include "port/win32ntdll.h"
diff --git a/src/port/win32stat.c b/src/port/win32stat.c
index 26443293d78..5f3d0d22ff4 100644
--- a/src/port/win32stat.c
+++ b/src/port/win32stat.c
@@ -15,8 +15,6 @@
#ifdef WIN32
-#define UMDF_USING_NTSTATUS
-
#include "c.h"
#include "port/win32ntdll.h"
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0011-windows-adjust-FD_SETSIZE-via-commandline-define.patch (5.5K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/12-v16-0011-windows-adjust-FD_SETSIZE-via-commandline-define.patch)
download | inline diff:
From 03df45cc055bb3adbc3882e0036a7e3537f8af0c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 12:07:29 -0700
Subject: [PATCH v16 11/16] windows: adjust FD_SETSIZE via commandline define
This is a prerequisite to using precompiled headers.
---
src/fe_utils/Makefile | 4 ++++
src/fe_utils/meson.build | 1 +
src/fe_utils/parallel_slot.c | 4 ++--
src/bin/pgbench/Makefile | 2 ++
src/bin/pgbench/meson.build | 2 ++
src/bin/pgbench/pgbench.c | 4 ++--
src/tools/msvc/Mkvcbuild.pm | 17 +++++++++++++++--
7 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/fe_utils/Makefile b/src/fe_utils/Makefile
index 44bc7a1215d..40d4b1d8698 100644
--- a/src/fe_utils/Makefile
+++ b/src/fe_utils/Makefile
@@ -34,6 +34,10 @@ OBJS = \
simple_list.o \
string_utils.o
+ifeq ($(PORTNAME), win32)
+override CFLAGS += -DFD_SETSIZE=1024
+endif
+
all: libpgfeutils.a
libpgfeutils.a: $(OBJS)
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index b6bf8e1ca21..3e226c260ac 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -24,6 +24,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
include_directories: [postgres_inc, libpq_inc],
+ c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
dependencies: frontend_common_code,
kwargs: default_lib_args,
)
diff --git a/src/fe_utils/parallel_slot.c b/src/fe_utils/parallel_slot.c
index 2be2903c9c6..767256757f2 100644
--- a/src/fe_utils/parallel_slot.c
+++ b/src/fe_utils/parallel_slot.c
@@ -12,8 +12,8 @@
*-------------------------------------------------------------------------
*/
-#ifdef WIN32
-#define FD_SETSIZE 1024 /* must set before winsock2.h is included */
+#if defined(WIN32) && FD_SETSIZE < 1024
+#error FD_SETSIZE needs to have been increased
#endif
#include "postgres_fe.h"
diff --git a/src/bin/pgbench/Makefile b/src/bin/pgbench/Makefile
index 6647c9fe97d..68e9f03e79f 100644
--- a/src/bin/pgbench/Makefile
+++ b/src/bin/pgbench/Makefile
@@ -18,6 +18,8 @@ LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
ifneq ($(PORTNAME), win32)
override CFLAGS += $(PTHREAD_CFLAGS)
+else
+override CFLAGS += -DFD_SETSIZE=1024
endif
LIBS += $(PTHREAD_LIBS)
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index a32eb51fe07..1a3ec5d1295 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -27,6 +27,8 @@ pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
include_directories: include_directories('.'),
+ c_pch: pch_postgres_fe_h,
+ c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
kwargs: default_bin_args,
)
bin_targets += pgbench
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index aa1a3541fe6..7da7c36fbe6 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -27,8 +27,8 @@
*
*/
-#ifdef WIN32
-#define FD_SETSIZE 1024 /* must set before winsock2.h is included */
+#if defined(WIN32) && FD_SETSIZE < 1024
+#error FD_SETSIZE needs to have been increased
#endif
#include "postgres_fe.h"
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index ddb4f25eb12..4d1e4f4e4d4 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -35,6 +35,7 @@ my $libpq;
my @unlink_on_exit;
# Set of variables for modules in contrib/ and src/test/modules/
+my $contrib_defines = {};
my @contrib_uselibpq = ();
my @contrib_uselibpgport = ();
my @contrib_uselibpgcommon = ();
@@ -52,6 +53,7 @@ my @contrib_excludes = (
'unsafe_tests');
# Set of variables for frontend modules
+my $frontend_defines = { 'pgbench' => 'FD_SETSIZE=1024' };
my @frontend_uselibpq =
('pg_amcheck', 'pg_ctl', 'pg_upgrade', 'pgbench', 'psql', 'initdb');
my @frontend_uselibpgport = (
@@ -175,6 +177,7 @@ sub mkvcbuild
$libpgfeutils = $solution->AddProject('libpgfeutils', 'lib', 'misc');
$libpgfeutils->AddDefine('FRONTEND');
+ $libpgfeutils->AddDefine('FD_SETSIZE=1024');
$libpgfeutils->AddIncludeDir('src/interfaces/libpq');
$libpgfeutils->AddFiles('src/fe_utils', @pgfeutilsfiles);
@@ -1120,7 +1123,8 @@ sub AdjustContribProj
{
my $proj = shift;
AdjustModule(
- $proj, \@contrib_uselibpq,
+ $proj, $contrib_defines,
+ \@contrib_uselibpq,
\@contrib_uselibpgport, \@contrib_uselibpgcommon,
$contrib_extralibs, $contrib_extrasource,
$contrib_extraincludes);
@@ -1131,7 +1135,8 @@ sub AdjustFrontendProj
{
my $proj = shift;
AdjustModule(
- $proj, \@frontend_uselibpq,
+ $proj, $frontend_defines,
+ \@frontend_uselibpq,
\@frontend_uselibpgport, \@frontend_uselibpgcommon,
$frontend_extralibs, $frontend_extrasource,
$frontend_extraincludes);
@@ -1141,6 +1146,7 @@ sub AdjustFrontendProj
sub AdjustModule
{
my $proj = shift;
+ my $module_defines = shift;
my $module_uselibpq = shift;
my $module_uselibpgport = shift;
my $module_uselibpgcommon = shift;
@@ -1149,6 +1155,13 @@ sub AdjustModule
my $module_extraincludes = shift;
my $n = $proj->{name};
+ if ($module_defines->{$n})
+ {
+ foreach my $d ($module_defines->{$n})
+ {
+ $proj->AddDefine($d);
+ }
+ }
if (grep { /^$n$/ } @{$module_uselibpq})
{
$proj->AddIncludeDir('src\interfaces\libpq');
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0012-meson-Add-support-for-building-with-precompiled-.patch (14.4K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/13-v16-0012-meson-Add-support-for-building-with-precompiled-.patch)
download | inline diff:
From e2c068a251ddd37850bfa2ffc3133abfcd08235c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 23 Sep 2022 12:19:17 -0700
Subject: [PATCH v16 12/16] meson: Add support for building with precompiled
headers
This substantially speeds up building for windows. A cross build with mingw
goes from
real 0m29.884s
user 15m41.900s
sys 1m58.257s
to
real 0m13.196s
user 6m52.330s
sys 1m15.140s
The wins on windows are similar-ish (but I don't have a system at hand just
now for actual numbers).
---
src/include/meson.build | 1 +
src/include/pch/c_pch.h | 1 +
src/include/pch/meson.build | 4 ++++
src/include/pch/postgres_fe_pch.h | 1 +
src/include/pch/postgres_pch.h | 1 +
src/common/meson.build | 2 ++
src/port/meson.build | 2 ++
src/backend/meson.build | 5 +++++
src/backend/snowball/meson.build | 1 +
src/fe_utils/meson.build | 1 +
src/bin/pg_dump/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 1 +
src/bin/psql/meson.build | 1 +
src/interfaces/libpq/meson.build | 1 +
src/pl/plperl/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpython/meson.build | 1 +
src/pl/tcl/meson.build | 1 +
contrib/bloom/meson.build | 1 +
contrib/btree_gist/meson.build | 1 +
contrib/hstore/meson.build | 1 +
contrib/pg_trgm/meson.build | 1 +
contrib/pgcrypto/meson.build | 1 +
contrib/pgstattuple/meson.build | 1 +
contrib/sepgsql/meson.build | 1 +
contrib/xml2/meson.build | 1 +
.cirrus.yml | 4 ++--
meson.build | 1 +
28 files changed, 38 insertions(+), 2 deletions(-)
create mode 100644 src/include/pch/c_pch.h
create mode 100644 src/include/pch/meson.build
create mode 100644 src/include/pch/postgres_fe_pch.h
create mode 100644 src/include/pch/postgres_pch.h
diff --git a/src/include/meson.build b/src/include/meson.build
index e5390df0584..28ed9011c70 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -110,6 +110,7 @@ install_headers(
subdir('catalog')
subdir('nodes')
+subdir('pch')
subdir('storage')
subdir('utils')
diff --git a/src/include/pch/c_pch.h b/src/include/pch/c_pch.h
new file mode 100644
index 00000000000..f40c757ca62
--- /dev/null
+++ b/src/include/pch/c_pch.h
@@ -0,0 +1 @@
+#include "c.h"
diff --git a/src/include/pch/meson.build b/src/include/pch/meson.build
new file mode 100644
index 00000000000..2bcec49c3a2
--- /dev/null
+++ b/src/include/pch/meson.build
@@ -0,0 +1,4 @@
+# See https://github.com/mesonbuild/meson/issues/10338
+pch_c_h = meson.source_root() / meson.current_source_dir() / 'c_pch.h'
+pch_postgres_h = meson.source_root() / meson.current_source_dir() / 'postgres_pch.h'
+pch_postgres_fe_h = meson.source_root() / meson.current_source_dir() / 'postgres_fe_pch.h'
diff --git a/src/include/pch/postgres_fe_pch.h b/src/include/pch/postgres_fe_pch.h
new file mode 100644
index 00000000000..f3ea20912d3
--- /dev/null
+++ b/src/include/pch/postgres_fe_pch.h
@@ -0,0 +1 @@
+#include "postgres_fe.h"
diff --git a/src/include/pch/postgres_pch.h b/src/include/pch/postgres_pch.h
new file mode 100644
index 00000000000..71b2f35f76b
--- /dev/null
+++ b/src/include/pch/postgres_pch.h
@@ -0,0 +1 @@
+#include "postgres.h"
diff --git a/src/common/meson.build b/src/common/meson.build
index 23842e1ffef..1c9b8a3a018 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -147,6 +147,7 @@ foreach name, opts : pgcommon_variants
endif
c_args = opts.get('c_args', []) + common_cflags[cflagname]
cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'sources': sources,
@@ -159,6 +160,7 @@ foreach name, opts : pgcommon_variants
lib = static_library('libpgcommon@0@'.format(name),
link_with: cflag_libs,
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
diff --git a/src/port/meson.build b/src/port/meson.build
index ced2e014db8..c2222696f1b 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -161,6 +161,7 @@ foreach name, opts : pgport_variants
c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
sources,
+ c_pch: pch_c_h,
kwargs: opts + {
'c_args': c_args,
'build_by_default': false,
@@ -172,6 +173,7 @@ foreach name, opts : pgport_variants
lib = static_library('libpgport@0@'.format(name),
pgport_sources,
link_with: cflag_libs,
+ c_pch: pch_c_h,
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
}
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 1cb4cd3431f..a535543ee9e 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -62,6 +62,7 @@ postgres_lib = static_library('postgres_lib',
backend_sources + timezone_sources + generated_backend_sources,
link_whole: backend_link_with,
dependencies: backend_build_deps,
+ c_pch: pch_postgres_h,
kwargs: internal_lib_args,
)
@@ -81,6 +82,10 @@ if cc.get_id() == 'msvc'
backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
backend_link_depends += postgres_def
+ # Due to the way msvc and meson's precompiled headers implementation
+ # interact, we need to have symbols from the full library available. Could
+ # be restricted to b_pch=true.
+ backend_link_with += postgres_lib
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 974401d187e..72959fa29d6 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -66,6 +66,7 @@ endif
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
+ c_pch: pch_postgres_h,
kwargs: pg_mod_args + {
'include_directories': [stemmer_inc],
}
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index 3e226c260ac..fe0b801387c 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -23,6 +23,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
+ c_pch: pch_postgres_fe_h,
include_directories: [postgres_inc, libpq_inc],
c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
dependencies: frontend_common_code,
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 3527a25c288..e66f632b54e 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -13,6 +13,7 @@ pg_dump_common_sources = files(
pg_dump_common = static_library('libpgdump_common',
pg_dump_common_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq, zlib],
kwargs: internal_lib_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index a7b927a45c7..212bc9ce6ef 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -24,6 +24,7 @@ endif
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 1264fc19fbd..a4c46bf5385 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -44,6 +44,7 @@ endif
psql = executable('psql',
psql_sources,
+ c_pch: pch_postgres_fe_h,
include_directories: include_directories('.'),
dependencies: [frontend_code, libpq, readline],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 2c9edeaa088..72102521edc 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -49,6 +49,7 @@ libpq_st = static_library('libpq',
pic: true,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
+ c_pch: pch_postgres_fe_h,
dependencies: libpq_deps,
kwargs: default_lib_args,
)
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 535660085dd..cd3894e6a73 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -45,6 +45,7 @@ endif
plperl = shared_module('plperl',
plperl_sources,
+ c_pch: pch_postgres_h,
include_directories: [plperl_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [perl_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index c46c0a1da2a..27b2f5ef529 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -48,6 +48,7 @@ endif
plpgsql = shared_module('plpgsql',
plpgsql_sources,
+ c_pch: pch_postgres_h,
include_directories: include_directories('.'),
kwargs: pg_mod_args,
)
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 40888386b5f..7bd683580e8 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -36,6 +36,7 @@ endif
plpython = shared_module('plpython3',
plpython_sources,
+ c_pch: pch_postgres_h,
include_directories: [plpython_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [python3_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index f09bb14c950..7a708776c99 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -22,6 +22,7 @@ endif
pltcl = shared_module('pltcl',
pltcl_sources,
+ c_pch: pch_postgres_h,
include_directories: [include_directories('.'), postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [tcl_dep, pg_mod_args['dependencies']],
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 16f3b83e4d2..163a93c98fb 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -15,6 +15,7 @@ endif
bloom = shared_module('bloom',
bloom_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += bloom
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index e98c91dacc8..bfb7865d213 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -33,6 +33,7 @@ endif
btree_gist = shared_module('btree_gist',
btree_gist_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gist
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 2bb26bb772b..a2a4ec36cb0 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -18,6 +18,7 @@ endif
hstore = shared_module('hstore',
hstore_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index c8c7c07b308..839d6c4a7f6 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -13,6 +13,7 @@ endif
pg_trgm = shared_module('pg_trgm',
pg_trgm_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index 7fc7bbc7ca1..cc782578b49 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -78,6 +78,7 @@ endif
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
},
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 05e4cd46a5c..42d0b0e6ce9 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -12,6 +12,7 @@ endif
pgstattuple = shared_module('pgstattuple',
pgstattuple_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 8bef239e3c2..1ac0fa388ab 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -22,6 +22,7 @@ endif
sepgsql = shared_module('sepgsql',
sepgsql_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [selinux, contrib_mod_args['dependencies']],
}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 89b0d677516..92ab3368428 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -15,6 +15,7 @@ endif
xml2 = shared_module('pgxml',
xml2_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/.cirrus.yml b/.cirrus.yml
index efb2d2c4832..aea25fd7525 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -602,7 +602,7 @@ task:
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
- meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
@@ -630,7 +630,7 @@ task:
configure_script: |
vcvarsall x64
- meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --buildtype debug --backend vs -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
diff --git a/meson.build b/meson.build
index 2b0cbb9a5a7..c50a414628d 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,7 @@ project('postgresql',
meson_version: '>=0.54',
default_options: [
'warning_level=1', #-Wall equivalent
+ 'b_pch=false',
'buildtype=release',
]
)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0013-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch (7.8K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/14-v16-0013-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch)
download | inline diff:
From ba346385c066b62fc952a8a8c2c760a19df8bb8a Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 08:49:45 -0700
Subject: [PATCH v16 13/16] meson: Add xmllint/xsltproc wrapper script to
handle dependencies automatically
---
doc/src/sgml/meson.build | 38 ++++++++++++++------
doc/src/sgml/xmltools_dep_wrapper | 60 +++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 10 deletions(-)
create mode 100644 doc/src/sgml/xmltools_dep_wrapper
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index ba2a261e7a4..e6781d0deae 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -2,7 +2,7 @@ docs = []
alldocs = []
doc_generated = []
-xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
+xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false)
version_sgml = configure_file(
@@ -60,14 +60,23 @@ doc_generated += custom_target('keywords-table.sgml',
)
# For everything else we need at least xmllint
-if not xmllint.found()
+if not xmllint_bin.found()
subdir_done()
endif
pandoc = find_program('pandoc', native: true, required: false)
-xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
+xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false)
fop = find_program('fop', native: true, required: false)
+xmltools_wrapper = [
+ python, files('xmltools_dep_wrapper'),
+ '--targetname', '@OUTPUT@', '--depfile', '@DEPFILE@'
+]
+
+xmllint = xmltools_wrapper + [
+ '--tool', xmllint_bin, '--',
+]
+
# Run validation only once, common to all subsequent targets. While
# we're at it, also resolve all entities (that is, copy all included
# files into one big file). This helps tools that don't understand
@@ -75,6 +84,7 @@ fop = find_program('fop', native: true, required: false)
postgres_full_xml = custom_target('postgres-full.xml',
input: 'postgres.sgml',
output: 'postgres-full.xml',
+ depfile: 'postgres-full.xml.d',
command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
depends: doc_generated,
build_by_default: false,
@@ -86,18 +96,20 @@ alldocs += postgres_full_xml
#
# Full documentation as html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
xsltproc_flags = [
'--stringparam', 'pg.version', pg_version,
'--param', 'website.stylesheet', '1'
]
+ xsltproc = xmltools_wrapper + [
+ '--tool', xsltproc_bin, '--',
+ ]
- # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
- # depfile
html = custom_target('html',
input: ['stylesheet.xsl', postgres_full_xml],
output: 'html',
+ depfile: 'html.d',
depends: doc_generated,
command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -110,6 +122,7 @@ if xsltproc.found()
html_help = custom_target('html_help',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
+ depfile: 'htmlhelp.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -121,6 +134,7 @@ if xsltproc.found()
postgres_html = custom_target('postgres.html',
input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
output: 'postgres.html',
+ depfile: 'postgres.html.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -144,10 +158,11 @@ endif
#
# INSTALL in html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
install_xml = custom_target('INSTALL.xml',
input: ['standalone-profile.xsl', 'standalone-install.xml'],
output: 'INSTALL.xml',
+ depfile: 'INSTALL.xml.d',
depends: doc_generated + [postgres_full_xml],
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
@@ -155,6 +170,7 @@ if xsltproc.found()
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
+ depfile: 'INSTALL.html.d',
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
@@ -177,11 +193,12 @@ endif
#
# Man pages
#
-if xsltproc.found()
+if xsltproc_bin.found()
# FIXME: implement / consider sqlmansectnum logic
man = custom_target('man',
input: ['stylesheet-man.xsl', postgres_full_xml],
output: ['man1', 'man3', 'man7'],
+ depfile: 'man.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -195,7 +212,7 @@ endif
#
# Full documentation as PDF
#
-if fop.found() and xsltproc.found()
+if fop.found() and xsltproc_bin.found()
xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
@@ -206,6 +223,7 @@ if fop.found() and xsltproc.found()
input: ['stylesheet-fo.xsl', postgres_full_xml],
output: [postgres_x_fo_f],
depends: doc_generated,
+ depfile: postgres_x_fo_f + '.d',
command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
'--stringparam', 'paper.type', detail,
'-o', '@OUTPUT@', '@INPUT@'],
@@ -230,7 +248,7 @@ endif
# This was previously implemented using dbtoepub - but that doesn't seem to
# support running in build != source directory (i.e. VPATH builds already
# weren't supported).
-if pandoc.found() and xsltproc.found()
+if pandoc.found() and xsltproc_bin.found()
postgres_epub = custom_target('postgres.epub',
input: postgres_full_xml,
output: 'postgres.epub',
diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper
new file mode 100644
index 00000000000..52b94e3fcaf
--- /dev/null
+++ b/doc/src/sgml/xmltools_dep_wrapper
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(
+ description='generate dependency file for docs')
+
+parser.add_argument('--targetname', type=str, required=False, nargs='+')
+parser.add_argument('--depfile', type=str, required=False)
+parser.add_argument('--tool', type=str, required=True)
+
+parser.add_argument('flags', nargs='*')
+
+args = parser.parse_args()
+
+if args.depfile:
+ depfile_result_list = []
+
+ command = [args.tool, '--load-trace'] + args.flags
+ # --load-trace flag displays all the documents
+ # loaded during the processing to stderr
+ res = subprocess.run(command, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ # if exit code is different than 0, exit
+ if res.returncode:
+ exit(res.returncode)
+
+ # get line start from targetname
+ line_start = ''
+ for name in args.targetname:
+ line_start = line_start + name + ' '
+ line_start = line_start.strip() + ': '
+
+ # collect only file paths
+ line_re = re.compile('^Loaded URL="([^"]+)"')
+ with open(args.depfile, 'w') as f:
+ for line in res.stderr.split('\n'):
+ if line == '':
+ continue
+ m = re.match(line_re, line)
+
+ # continue to show errors
+ if m is None:
+ print(line, file=sys.stderr)
+ continue
+
+ fname = m.group(1)
+ if fname.startswith('http:'):
+ continue
+ if fname.startswith('file://'):
+ fname = fname.split('file://')[1]
+ f.write(line_start + fname + '\n')
+
+else:
+ command = [args.tool] + args.flags
+ res = subprocess.run(command)
+ exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0014-meson-wip-headerchecks-cpluspluschecks.patch (2.9K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/15-v16-0014-meson-wip-headerchecks-cpluspluschecks.patch)
download | inline diff:
From d6770d00c7d07717115b37d9708b1068bb6c0014 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 24 Sep 2022 11:02:21 -0700
Subject: [PATCH v16 14/16] meson: wip: headerchecks cpluspluschecks
---
src/include/meson.build | 4 ++--
src/meson.build | 7 +++++++
src/tools/pginclude/cpluspluscheck | 4 ++--
src/tools/pginclude/headerscheck | 4 ++--
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/include/meson.build b/src/include/meson.build
index 28ed9011c70..41bae9b0a53 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -42,8 +42,8 @@ config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
var_cc = ' '.join(cc.cmd_array())
var_cpp = ' '.join(cc.cmd_array() + ['-E'])
-var_cflags = ' '.join(cflags + cflags_warn)
-var_cxxflags = ' '.join(cxxflags + cxxflags_warn)
+var_cflags = ' '.join(cflags + cflags_warn + ['-Wall'])
+var_cxxflags = ' '.join(cxxflags + cxxflags_warn + ['-Wall'])
var_cppflags = ' '.join(cppflags)
var_cflags_sl = '-fPIC' #FIXME
var_ldflags = ' '.join(ldflags)
diff --git a/src/meson.build b/src/meson.build
index ca99db42baa..1891e11cb26 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -269,3 +269,10 @@ install_data(
install_data(
'makefiles/pgxs.mk',
install_dir: dir_pgxs / 'src' / 'makefiles')
+
+
+run_target('headerscheck',
+ command: [files('tools/pginclude/headerscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@'])
+
+run_target('cpluspluscheck',
+ command: [files('tools/pginclude/cpluspluscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@'])
diff --git a/src/tools/pginclude/cpluspluscheck b/src/tools/pginclude/cpluspluscheck
index b393f2a2eaa..aeaaaa67479 100755
--- a/src/tools/pginclude/cpluspluscheck
+++ b/src/tools/pginclude/cpluspluscheck
@@ -166,9 +166,9 @@ do
# Some subdirectories need extra -I switches.
case "$f" in
src/pl/plperl/*)
- EXTRAINCLUDES="$perl_includespec" ;;
+ EXTRAINCLUDES="$perl_includespec"; continue; ;;
src/pl/plpython/*)
- EXTRAINCLUDES="$python_includespec" ;;
+ EXTRAINCLUDES="$python_includespec"; continue; ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 2a39856f88c..cc195ccc88f 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -149,9 +149,9 @@ do
# Some subdirectories need extra -I switches.
case "$f" in
src/pl/plperl/*)
- EXTRAINCLUDES="$perl_includespec" ;;
+ EXTRAINCLUDES="$perl_includespec"; continue; ;;
src/pl/plpython/*)
- EXTRAINCLUDES="$python_includespec" ;;
+ EXTRAINCLUDES="$python_includespec"; continue; ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0015-tests-Rename-conflicting-role-names.patch (13.3K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/16-v16-0015-tests-Rename-conflicting-role-names.patch)
download | inline diff:
From 6ea1a4608aeb1b34b62289a6bc697c57e35e25f8 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 16:49:51 -0700
Subject: [PATCH v16 15/16] tests: Rename conflicting role names
These cause problems when running installcheck concurrently.
---
src/pl/plperl/expected/plperl_setup.out | 30 +++++++++----------
src/pl/plperl/sql/plperl_setup.sql | 30 +++++++++----------
contrib/adminpack/expected/adminpack.out | 20 ++++++-------
contrib/adminpack/sql/adminpack.sql | 20 ++++++-------
.../passwordcheck/expected/passwordcheck.out | 16 +++++-----
contrib/passwordcheck/sql/passwordcheck.sql | 16 +++++-----
6 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/src/pl/plperl/expected/plperl_setup.out b/src/pl/plperl/expected/plperl_setup.out
index 5234febefd6..5537a95ccc2 100644
--- a/src/pl/plperl/expected/plperl_setup.out
+++ b/src/pl/plperl/expected/plperl_setup.out
@@ -4,9 +4,9 @@
-- Before going ahead with the to-be-tested installations, verify that
-- a non-superuser is allowed to install plperl (but not plperlu) when
-- suitable permissions have been granted.
-CREATE USER regress_user1;
-CREATE USER regress_user2;
-SET ROLE regress_user1;
+CREATE USER regress_plperl_user1;
+CREATE USER regress_plperl_user2;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl; -- fail
ERROR: permission denied to create extension "plperl"
HINT: Must have CREATE privilege on current database to create this extension.
@@ -16,18 +16,18 @@ HINT: Must be superuser to create this extension.
RESET ROLE;
DO $$
begin
- execute format('grant create on database %I to regress_user1',
+ execute format('grant create on database %I to regress_plperl_user1',
current_database());
end;
$$;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl;
CREATE EXTENSION plperlu; -- fail
ERROR: permission denied to create extension "plperlu"
HINT: Must be superuser to create this extension.
CREATE SCHEMA plperl_setup_scratch;
SET search_path = plperl_setup_scratch;
-GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_user2;
+GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
CREATE FUNCTION foo1() returns int language plperl as '1;';
SELECT foo1();
foo1
@@ -38,15 +38,15 @@ SELECT foo1();
-- Must reconnect to avoid failure with non-MULTIPLICITY Perl interpreters
\c -
SET search_path = plperl_setup_scratch;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to change privileges on the language
revoke all on language plperl from public;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;'; -- fail
ERROR: permission denied for language plperl
-SET ROLE regress_user1;
-grant usage on language plperl to regress_user2;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user1;
+grant usage on language plperl to regress_plperl_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;';
SELECT foo2();
foo2
@@ -54,7 +54,7 @@ SELECT foo2();
2
(1 row)
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to drop the extension, but not the language per se
DROP LANGUAGE plperl CASCADE;
ERROR: cannot drop language plperl because extension plperl requires it
@@ -65,9 +65,9 @@ DETAIL: drop cascades to function foo1()
drop cascades to function foo2()
-- Clean up
RESET ROLE;
-DROP OWNED BY regress_user1;
-DROP USER regress_user1;
-DROP USER regress_user2;
+DROP OWNED BY regress_plperl_user1;
+DROP USER regress_plperl_user1;
+DROP USER regress_plperl_user2;
-- Now install the versions that will be used by subsequent test scripts.
CREATE EXTENSION plperl;
CREATE EXTENSION plperlu;
diff --git a/src/pl/plperl/sql/plperl_setup.sql b/src/pl/plperl/sql/plperl_setup.sql
index a89cf56617e..0eac9156294 100644
--- a/src/pl/plperl/sql/plperl_setup.sql
+++ b/src/pl/plperl/sql/plperl_setup.sql
@@ -6,10 +6,10 @@
-- a non-superuser is allowed to install plperl (but not plperlu) when
-- suitable permissions have been granted.
-CREATE USER regress_user1;
-CREATE USER regress_user2;
+CREATE USER regress_plperl_user1;
+CREATE USER regress_plperl_user2;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl; -- fail
CREATE EXTENSION plperlu; -- fail
@@ -18,18 +18,18 @@ RESET ROLE;
DO $$
begin
- execute format('grant create on database %I to regress_user1',
+ execute format('grant create on database %I to regress_plperl_user1',
current_database());
end;
$$;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl;
CREATE EXTENSION plperlu; -- fail
CREATE SCHEMA plperl_setup_scratch;
SET search_path = plperl_setup_scratch;
-GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_user2;
+GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
CREATE FUNCTION foo1() returns int language plperl as '1;';
SELECT foo1();
@@ -38,25 +38,25 @@ SELECT foo1();
\c -
SET search_path = plperl_setup_scratch;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to change privileges on the language
revoke all on language plperl from public;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;'; -- fail
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-grant usage on language plperl to regress_user2;
+grant usage on language plperl to regress_plperl_user2;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;';
SELECT foo2();
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to drop the extension, but not the language per se
DROP LANGUAGE plperl CASCADE;
@@ -64,9 +64,9 @@ DROP EXTENSION plperl CASCADE;
-- Clean up
RESET ROLE;
-DROP OWNED BY regress_user1;
-DROP USER regress_user1;
-DROP USER regress_user2;
+DROP OWNED BY regress_plperl_user1;
+DROP USER regress_plperl_user1;
+DROP USER regress_plperl_user2;
-- Now install the versions that will be used by subsequent test scripts.
CREATE EXTENSION plperl;
diff --git a/contrib/adminpack/expected/adminpack.out b/contrib/adminpack/expected/adminpack.out
index 76aafe6316a..6bcf2217f25 100644
--- a/contrib/adminpack/expected/adminpack.out
+++ b/contrib/adminpack/expected/adminpack.out
@@ -36,10 +36,10 @@ SELECT pg_read_file('test_file1');
-- disallowed file paths for non-superusers and users who are
-- not members of pg_write_server_files
-CREATE ROLE regress_user1;
-GRANT pg_read_all_settings TO regress_user1;
-GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
-SET ROLE regress_user1;
+CREATE ROLE regress_adminpack_user1;
+GRANT pg_read_all_settings TO regress_adminpack_user1;
+GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('../test_file0', 'test0', false);
ERROR: path must be in or below the current directory
SELECT pg_file_write('/tmp/test_file0', 'test0', false);
@@ -53,9 +53,9 @@ SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4'
SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
ERROR: absolute path not allowed
RESET ROLE;
-REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_user1;
-REVOKE pg_read_all_settings FROM regress_user1;
-DROP ROLE regress_user1;
+REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
+REVOKE pg_read_all_settings FROM regress_adminpack_user1;
+DROP ROLE regress_adminpack_user1;
-- sync
SELECT pg_file_sync('test_file1'); -- sync file
pg_file_sync
@@ -153,8 +153,8 @@ SELECT pg_file_unlink('test_file4');
(1 row)
-- superuser checks
-CREATE USER regress_user1;
-SET ROLE regress_user1;
+CREATE USER regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('test_file0', 'test0', false);
ERROR: permission denied for function pg_file_write
SELECT pg_file_sync('test_file0');
@@ -167,6 +167,6 @@ ERROR: permission denied for function pg_file_unlink
SELECT pg_logdir_ls();
ERROR: permission denied for function pg_logdir_ls
RESET ROLE;
-DROP USER regress_user1;
+DROP USER regress_adminpack_user1;
-- no further tests for pg_logdir_ls() because it depends on the
-- server's logging setup
diff --git a/contrib/adminpack/sql/adminpack.sql b/contrib/adminpack/sql/adminpack.sql
index 918d0bdc65e..5776c9af0d1 100644
--- a/contrib/adminpack/sql/adminpack.sql
+++ b/contrib/adminpack/sql/adminpack.sql
@@ -14,20 +14,20 @@ SELECT pg_read_file('test_file1');
-- disallowed file paths for non-superusers and users who are
-- not members of pg_write_server_files
-CREATE ROLE regress_user1;
+CREATE ROLE regress_adminpack_user1;
-GRANT pg_read_all_settings TO regress_user1;
-GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
+GRANT pg_read_all_settings TO regress_adminpack_user1;
+GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
-SET ROLE regress_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('../test_file0', 'test0', false);
SELECT pg_file_write('/tmp/test_file0', 'test0', false);
SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4', false);
SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
RESET ROLE;
-REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_user1;
-REVOKE pg_read_all_settings FROM regress_user1;
-DROP ROLE regress_user1;
+REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
+REVOKE pg_read_all_settings FROM regress_adminpack_user1;
+DROP ROLE regress_adminpack_user1;
-- sync
SELECT pg_file_sync('test_file1'); -- sync file
@@ -59,8 +59,8 @@ SELECT pg_file_unlink('test_file4');
-- superuser checks
-CREATE USER regress_user1;
-SET ROLE regress_user1;
+CREATE USER regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('test_file0', 'test0', false);
SELECT pg_file_sync('test_file0');
@@ -69,7 +69,7 @@ SELECT pg_file_unlink('test_file0');
SELECT pg_logdir_ls();
RESET ROLE;
-DROP USER regress_user1;
+DROP USER regress_adminpack_user1;
-- no further tests for pg_logdir_ls() because it depends on the
diff --git a/contrib/passwordcheck/expected/passwordcheck.out b/contrib/passwordcheck/expected/passwordcheck.out
index e04cda6bd95..2f917169eb6 100644
--- a/contrib/passwordcheck/expected/passwordcheck.out
+++ b/contrib/passwordcheck/expected/passwordcheck.out
@@ -1,19 +1,19 @@
LOAD 'passwordcheck';
-CREATE USER regress_user1;
+CREATE USER regress_passwordcheck_user1;
-- ok
-ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
-- error: too short
-ALTER USER regress_user1 PASSWORD 'tooshrt';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
ERROR: password is too short
-- error: contains user name
-ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
ERROR: password must not contain user name
-- error: contains only letters
-ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
ERROR: password must contain both letters and nonletters
-- encrypted ok (password is "secret")
-ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
-- error: password is user name
-ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
ERROR: password must not equal user name
-DROP USER regress_user1;
+DROP USER regress_passwordcheck_user1;
diff --git a/contrib/passwordcheck/sql/passwordcheck.sql b/contrib/passwordcheck/sql/passwordcheck.sql
index d98796ac494..df0f9ac0d39 100644
--- a/contrib/passwordcheck/sql/passwordcheck.sql
+++ b/contrib/passwordcheck/sql/passwordcheck.sql
@@ -1,23 +1,23 @@
LOAD 'passwordcheck';
-CREATE USER regress_user1;
+CREATE USER regress_passwordcheck_user1;
-- ok
-ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
-- error: too short
-ALTER USER regress_user1 PASSWORD 'tooshrt';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
-- error: contains user name
-ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
-- error: contains only letters
-ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
-- encrypted ok (password is "secret")
-ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
-- error: password is user name
-ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
-DROP USER regress_user1;
+DROP USER regress_passwordcheck_user1;
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v16-0016-meson-Add-installcheck-equivalent.patch (11.8K, ../../20220926003812.2ohyalswtp2wdmem@awork3.anarazel.de/17-v16-0016-meson-Add-installcheck-equivalent.patch)
download | inline diff:
From f92a4bf5b7697f4496971b6ce975b4482bc6ef01 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 16:57:01 -0700
Subject: [PATCH v16 16/16] meson: Add installcheck equivalent
run all tests that support running against existing server:
$ meson test --setup running
run just the main pg_regress tests against existing server:
$ meson test --setup running main/regress-running
---
contrib/basic_archive/meson.build | 1 +
contrib/pg_freespacemap/meson.build | 3 ++
contrib/pg_stat_statements/meson.build | 4 ++
contrib/pg_walinspect/meson.build | 3 ++
contrib/test_decoding/meson.build | 5 ++
src/interfaces/ecpg/test/meson.build | 1 +
src/test/isolation/meson.build | 3 ++
src/test/modules/commit_ts/meson.build | 3 ++
src/test/modules/snapshot_too_old/meson.build | 3 ++
src/test/modules/test_oat_hooks/meson.build | 1 +
src/test/modules/test_pg_dump/meson.build | 2 +
src/test/modules/worker_spi/meson.build | 4 +-
src/test/regress/meson.build | 3 ++
.cirrus.yml | 15 ++++++
meson.build | 48 +++++++++++++++++--
15 files changed, 93 insertions(+), 6 deletions(-)
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index c30dcfa5d41..d4ecaec47b8 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -25,5 +25,6 @@ tests += {
'regress_args': [
'--temp-config', files('basic_archive.conf'),
],
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index 904b37b6e9b..f802e297b67 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -33,5 +33,8 @@ tests += {
'regress_args': [
'--temp-config', files('pg_freespacemap.conf')
],
+ # Disabled because these tests require "autovacuum=off", which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index 854df138e76..bd0e42331eb 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -41,5 +41,9 @@ tests += {
'pg_stat_statements',
],
'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
+ # Disabled because these tests require
+ # "shared_preload_libraries=pg_stat_statements", which typical
+ # runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index 4314a3182a2..351f184de83 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -28,6 +28,9 @@ tests += {
'sql': [
'pg_walinspect',
],
+ # Disabled because these tests require "wal_level=replica", which
+ # some runningcheck users do not have (e.g. buildfarm clients).
'regress_args': ['--temp-config', files('walinspect.conf')],
+ 'runningcheck': false,
},
}
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index 6376103c689..a1aaae2dc3f 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -43,6 +43,9 @@ tests += {
'regress_args': [
'--temp-config', files('logical.conf'),
],
+ # Disabled because these tests require "wal_level=logical", which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
'isolation': {
'specs': [
@@ -60,6 +63,8 @@ tests += {
'regress_args': [
'--temp-config', files('logical.conf'),
],
+ # see above
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index f67f2dffb71..98343d41760 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -85,6 +85,7 @@ tests += {
'test_kwargs': {
'depends': ecpg_test_dependencies,
},
+ 'dbname': 'ecpg1_regression,ecpg2_regression',
'regress_args': ecpg_regress_args,
},
}
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index ba27b8c1d44..8737392f23b 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -67,5 +67,8 @@ tests += {
'priority': 40,
'timeout': 1000,
},
+ # checks pg_locks etc
+ 'runningcheck-parallel': false,
+ 'dbname': 'isolation',
},
}
diff --git a/src/test/modules/commit_ts/meson.build b/src/test/modules/commit_ts/meson.build
index 60cb12164d2..fa86e70e880 100644
--- a/src/test/modules/commit_ts/meson.build
+++ b/src/test/modules/commit_ts/meson.build
@@ -6,6 +6,9 @@ tests += {
'sql': [
'commit_timestamp',
],
+ # Disabled because these tests require "track_commit_timestamp = on",
+ # which typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/test/modules/snapshot_too_old/meson.build b/src/test/modules/snapshot_too_old/meson.build
index efd3f1f113b..5094b52949b 100644
--- a/src/test/modules/snapshot_too_old/meson.build
+++ b/src/test/modules/snapshot_too_old/meson.build
@@ -10,5 +10,8 @@ tests += {
'sto_using_hash_index',
],
'regress_args': ['--temp-config', files('sto.conf')],
+ # Disabled because these tests require "old_snapshot_threshold" >= 0, which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 8802bbbac55..e9d09d92c30 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -25,5 +25,6 @@ tests += {
'test_oat_hooks',
],
'regress_args': ['--no-locale', '--encoding=UTF8'],
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/test_pg_dump/meson.build b/src/test/modules/test_pg_dump/meson.build
index 41021829f3a..73f1fcf9428 100644
--- a/src/test/modules/test_pg_dump/meson.build
+++ b/src/test/modules/test_pg_dump/meson.build
@@ -13,6 +13,8 @@ tests += {
'sql': [
'test_pg_dump',
],
+ # doesn't delete its user
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index a4a158c75b9..660d721eea9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -30,6 +30,8 @@ tests += {
'sql': [
'worker_spi',
],
- 'regress_args': ['--temp-config', files('dynamic.conf'), '--dbname=contrib_regression'],
+ 'dbname': 'contrib_regression',
+ 'regress_args': ['--temp-config', files('dynamic.conf')],
+ 'runningcheck': false,
},
}
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index 963c0f64ed5..a781fa2af1d 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -64,5 +64,8 @@ tests += {
'priority': 50,
'timeout': 1000,
},
+ 'dbname': 'regression',
+ # checks pg_locks etc
+ 'runningcheck-parallel': false,
},
}
diff --git a/.cirrus.yml b/.cirrus.yml
index aea25fd7525..7a39e753a2e 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -121,6 +121,21 @@ task:
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
EOF
+ # test runningcheck, freebsd chosen because it's currently fast enough
+ test_running_script: |
+ su postgres <<-EOF
+ set -e
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --quiet --suite setup
+ export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/lib/:$LD_LIBRARY_PATH"
+ mkdir build/testrun
+ build/tmp_install/usr/local/bin/initdb -N build/runningcheck --no-instructions -A trust
+ echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf
+ build/tmp_install/usr/local/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
+ build/tmp_install/usr/local/bin/pg_ctl -D build/runningcheck stop
+ EOF
+
on_failure:
<<: *on_failure_meson
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
diff --git a/meson.build b/meson.build
index c50a414628d..89f3ecbf662 100644
--- a/meson.build
+++ b/meson.build
@@ -2889,6 +2889,21 @@ endif
# Test Generation
###############################################################
+# when using a meson version understanding exclude_suites, define a 'default'
+# test setup that excludes tests running against a pre-existing install and a
+# 'running' setup that conflicts with creation of the temporary installation
+# and tap tests (which don't support running against a running server).
+if meson.version().version_compare('>=0.57')
+ add_test_setup('default',
+ is_default: true,
+ exclude_suites: ['running'])
+ add_test_setup('running',
+ exclude_suites: ['temp-install', 'setup', 'tap'])
+ runningcheck = true
+else
+ runningcheck = false
+endif
+
testwrap = files('src/tools/testwrap')
foreach test_dir : tests
@@ -2917,18 +2932,27 @@ foreach test_dir : tests
test_output = test_result_dir / test_dir['name'] / kind
+ # unless specified by the test, choose a non-conflicting database name,
+ # to avoid conflicts when running against existing server.
+ dbname = t.get('dbname',
+ 'regression_@0@_@1@'.format(test_dir['name'], kind))
+
test_command = [
runner.full_path(),
'--inputdir', t.get('inputdir', test_dir['sd']),
'--expecteddir', t.get('expecteddir', test_dir['sd']),
'--outputdir', test_output,
- '--temp-instance', test_output / 'tmp_check',
'--bindir', '',
'--dlpath', test_dir['bd'],
'--max-concurrent-tests=20',
- '--port', testport.to_string(),
+ '--dbname', dbname,
] + t.get('regress_args', [])
+ test_command_tmp_install = test_command + [
+ '--temp-instance', test_output / 'tmp_check',
+ '--port', testport.to_string(),
+ ]
+
if t.has_key('schedule')
test_command += ['--schedule', t['schedule'],]
endif
@@ -2943,7 +2967,6 @@ foreach test_dir : tests
env.prepend('PATH', temp_install_bindir, test_dir['bd'])
test_kwargs = {
- 'suite': [test_dir['name']],
'priority': 10,
'timeout': 1000,
'depends': test_deps + t.get('deps', []),
@@ -2954,11 +2977,26 @@ foreach test_dir : tests
python,
args: testwrap_base + [
'--testname', kind,
- '--', test_command,
+ '--', test_command_tmp_install,
],
+ suite: [test_dir['name'], 'temp-install'],
kwargs: test_kwargs,
)
+ # some tests can't support running against running DB
+ if runningcheck and t.get('runningcheck', true)
+ test(test_dir['name'] / kind + '-running',
+ python,
+ args: testwrap_base + [
+ '--testname', kind,
+ '--', test_command,
+ ],
+ is_parallel: t.get('runningcheck-parallel', true),
+ suite: [test_dir['name'], 'running'],
+ kwargs: test_kwargs,
+ )
+ endif
+
testport += 1
elif kind == 'tap'
if not tap_tests_enabled
@@ -2982,7 +3020,7 @@ foreach test_dir : tests
test_kwargs = {
'protocol': 'tap',
- 'suite': [test_dir['name']],
+ 'suite': [test_dir['name'], 'tap'],
'timeout': 1000,
'depends': test_deps + t.get('deps', []),
'env': env,
--
2.37.3.542.gdd3f6c4cae
^ permalink raw reply [nested|flat] 81+ messages in thread
* RE: [RFC] building postgres with meson - v13
@ 2022-09-26 06:24 wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
parent: Andres Freund <andres@anarazel.de>
2 siblings, 1 reply; 81+ messages in thread
From: wangw.fnst@fujitsu.com @ 2022-09-26 06:24 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
I tried to use meson and ninja and they are really efficient.
But when I tried to specify "c_args", it did not take effect.
Attached my steps:
[In the HEAD (7d708093b7)]
$ meson setup build --prefix /home/wangw/install/parallel_apply/ -Dcassert=true -Dtap_tests=enabled -Dicu=enabled -Dc_args='-fno-omit-frame-pointer'
Log:
......
Compiler Flags
CPP FLAGS : -D_GNU_SOURCE
C FLAGS, functional: -fno-strict-aliasing -fwrapv -fexcess-precision=standard
C FLAGS, warnings : -Wmissing-prototypes -Wpointer-arith -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -Wdeclaration-after-statement -Wno-format-truncation -Wno-stringop-truncation
......
After I made the below modifications, the specified "c_args" took effect.
```
@@ -2439,6 +2439,10 @@ endif
# Set up compiler / linker arguments to be used everywhere, individual targets
# can add further args directly, or indirectly via dependencies
+
+tmp_c_args = get_option('c_args')
+cflags += tmp_c_args
+
add_project_arguments(cflags, language: ['c'])
add_project_arguments(cppflags, language: ['c'])
add_project_arguments(cflags_warn, language: ['c'])
```
I might missed something. Just to confirm is there another way to add CFLAG ?
Regards,
Wang wei
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 06:46 Andres Freund <andres@anarazel.de>
parent: wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-26 06:46 UTC (permalink / raw)
To: wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; +Cc: Peter Geoghegan <pg@bowt.ie>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 06:24:42 +0000, wangw.fnst@fujitsu.com wrote:
> I tried to use meson and ninja and they are really efficient.
> But when I tried to specify "c_args", it did not take effect.
They should take effect, but won't be shown in the summary section
currently. That currently only shows the flags chosen by the configure step,
rather than user specified ones.
> After I made the below modifications, the specified "c_args" took effect.
> ```
> @@ -2439,6 +2439,10 @@ endif
>
> # Set up compiler / linker arguments to be used everywhere, individual targets
> # can add further args directly, or indirectly via dependencies
> +
> +tmp_c_args = get_option('c_args')
> +cflags += tmp_c_args
> +
> add_project_arguments(cflags, language: ['c'])
> add_project_arguments(cppflags, language: ['c'])
> add_project_arguments(cflags_warn, language: ['c'])
> ```
That'll likely end up with the same cflags added multiple times. You should
see them when building with ninja -v.
How about adding c_args to the summary, in a separate line? I think that'd
clarify what's happening?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* RE: [RFC] building postgres with meson - v13
@ 2022-09-26 07:25 wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 81+ messages in thread
From: wangw.fnst@fujitsu.com @ 2022-09-26 07:25 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Geoghegan <pg@bowt.ie>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Mon, Sep 26, 2022 at 14:47 PM Andres Freund <andres@anarazel.de> wrote:
> Hi,
>
> On 2022-09-26 06:24:42 +0000, wangw.fnst@fujitsu.com wrote:
> > I tried to use meson and ninja and they are really efficient.
> > But when I tried to specify "c_args", it did not take effect.
>
> They should take effect, but won't be shown in the summary section
> currently. That currently only shows the flags chosen by the configure step,
> rather than user specified ones.
>
>
> > After I made the below modifications, the specified "c_args" took effect.
> > ```
> > @@ -2439,6 +2439,10 @@ endif
> >
> > # Set up compiler / linker arguments to be used everywhere, individual
> targets
> > # can add further args directly, or indirectly via dependencies
> > +
> > +tmp_c_args = get_option('c_args')
> > +cflags += tmp_c_args
> > +
> > add_project_arguments(cflags, language: ['c'])
> > add_project_arguments(cppflags, language: ['c'])
> > add_project_arguments(cflags_warn, language: ['c'])
> > ```
>
> That'll likely end up with the same cflags added multiple times. You should
> see them when building with ninja -v.
Thanks for sharing the information.
I saw the user specified CFLAG when building with `ninja -v`.
But, after installing PG with command `ninja -v install`, pg_config does not
show the user specified CFLAG. Should we print this information there?
> How about adding c_args to the summary, in a separate line? I think that'd
> clarify what's happening?
Yes, I think it might be better.
Regards,
Wang wei
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 08:18 John Naylor <john.naylor@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 1 reply; 81+ messages in thread
From: John Naylor @ 2022-09-26 08:18 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Wed, Sep 21, 2022 at 7:11 AM Andres Freund <andres@anarazel.de> wrote:
>
> I added installation instructions for meson for a bunch of platforms, but
A couple more things for the wiki:
1) /opt/homebrew/ seems to be an "Apple silicon" path? Either way it
doesn't exist on this machine. I was able to get a working build with
/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig
(My homebrew install doesn't seem to have anything relevant for
extra_include_dirs or extra_lib_dirs.)
2) Also, "ninja -v install" has the same line count as "ninja install" --
are there versions that do something different?
--
John Naylor
EDB: http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 08:41 Alvaro Herrera <alvherre@alvh.no-ip.org>
parent: Andres Freund <andres@anarazel.de>
2 siblings, 1 reply; 81+ messages in thread
From: Alvaro Herrera @ 2022-09-26 08:41 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Geoghegan <pg@bowt.ie>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 2022-Sep-25, Andres Freund wrote:
> From 3eb0ca196084da314d94d1e51c7b775012a4773c Mon Sep 17 00:00:00 2001
> From: Andres Freund <andres@anarazel.de>
> Date: Wed, 21 Sep 2022 11:03:07 -0700
> Subject: [PATCH v16 04/16] meson: Add windows resource files
> diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
> index de2e624ab58..5fb63768358 100644
> --- a/src/backend/jit/llvm/meson.build
> +++ b/src/backend/jit/llvm/meson.build
> @@ -20,6 +20,12 @@ llvmjit_sources += files(
> 'llvmjit_expr.c',
> )
>
> +if host_system == 'windows'
> + llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
> + '--NAME', 'llvmjit',
> + '--FILEDESC', 'llvmjit - JIT using LLVM',])
> +endif
This is tediously imperative. Isn't there a more declarative way to
have it?
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Pensar que el espectro que vemos es ilusorio no lo despoja de espanto,
sólo le suma el nuevo terror de la locura" (Perelandra, C.S. Lewis)
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 13:01 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 2 replies; 81+ messages in thread
From: Peter Eisentraut @ 2022-09-26 13:01 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 24.09.22 20:09, Andres Freund wrote:
> On 2022-09-24 13:52:29 -0400, Tom Lane wrote:
>> ... btw, shouldn't the CF entry [1] get closed now?
>
> Unfortunately not - there's quite a few followup patches that haven't been
> [fully] reviewed and thus not applied yet.
Here is some review of the remaining ones (might not match exactly what
you attached, I was working off your branch):
9f789350a7a7 meson: ci: wip: move compilerwarnings task to meson
This sounds reasonable to me in principle, but I haven't followed the
cirrus stuff too closely, and it doesn't say why it's "wip". Perhaps
others could take a closer look.
ccf20a68f874 meson: ci: Add additional CI coverage
IIUC, this is just for testing your branch, not meant for master?
02d84c21b227 meson: prereq: win: remove date from version number in
win32ver.rc
do it
5c42b3e7812e meson: WIP: Add some of the windows resource files
What is the thinking on this now? What does this change over the
current state?
9bc60bccfd10 meson: Add support for relative rpaths, fixing tests on
MacOS w/ SIP
I suggest a separate thread and/or CF entry for this. There have been
various attempts to deal with SIP before, with varying results. This
is not part of the meson transition as such.
9f5be26c1215 meson: Add docs for building with meson
I do like the overall layout of this.
The "Supported Platforms" section should be moved back to near the end
of the chapter. I don't see a reason to move it forward, at least
none that is related to the meson issue.
The changes to the "Getting the Source" section are also not
appropriate for this patch.
In the section "Building and Installation with meson":
- Remove the "git clone" stuff.
- The "Running tests" section should be moved to Chapter 33. Regression
Tests.
Some copy-editing will probably be suitable, but I haven't focused on
that yet.
9c00d355d0e9 meson: Add PGXS compatibility
This looks like a reasonable direction to me. How complete is it? It
says it works for some extensions but not others. How do we define
the target line here?
3fd5e13dcad3 meson: Add postgresql-extension.pc for building extension
libraries
Separate thread for this as well. This is good and important, but we
must also add it to the make build.
4b5bfa1c19aa meson: Add LLVM bitcode emission
still in progress
eb40f6e53104 meson: Add support for building with precompiled headers
Any reason not to enable this by default? The benefits on non-Windows
appear to be less dramatic, but they are not zero. Might be better to
enable it consistently so that for example any breakage is easier
caught.
377bfdea6042 meson: Add xmllint/xsltproc wrapper script to handle
dependencies automatically
Is this part of the initial transition, required for correctness, or
is it an optional optimization? Could use more explanation. Maybe
move to separate thread also?
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 15:41 Andres Freund <andres@anarazel.de>
parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-26 15:41 UTC (permalink / raw)
To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Peter Geoghegan <pg@bowt.ie>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 10:41:01 +0200, Alvaro Herrera wrote:
> On 2022-Sep-25, Andres Freund wrote:
>
> > From 3eb0ca196084da314d94d1e51c7b775012a4773c Mon Sep 17 00:00:00 2001
> > From: Andres Freund <andres@anarazel.de>
> > Date: Wed, 21 Sep 2022 11:03:07 -0700
> > Subject: [PATCH v16 04/16] meson: Add windows resource files
>
> > diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
> > index de2e624ab58..5fb63768358 100644
> > --- a/src/backend/jit/llvm/meson.build
> > +++ b/src/backend/jit/llvm/meson.build
> > @@ -20,6 +20,12 @@ llvmjit_sources += files(
> > 'llvmjit_expr.c',
> > )
> >
> > +if host_system == 'windows'
> > + llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
> > + '--NAME', 'llvmjit',
> > + '--FILEDESC', 'llvmjit - JIT using LLVM',])
> > +endif
>
> This is tediously imperative. Isn't there a more declarative way to
> have it?
I tried to come up with something better, without success. I think it's
acceptable, even if not great.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 16:35 Andres Freund <andres@anarazel.de>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
1 sibling, 2 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-26 16:35 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 15:01:56 +0200, Peter Eisentraut wrote:
> Here is some review of the remaining ones (might not match exactly what you
> attached, I was working off your branch):
Thanks, and makes sense.
> 9f789350a7a7 meson: ci: wip: move compilerwarnings task to meson
>
> This sounds reasonable to me in principle, but I haven't followed the
> cirrus stuff too closely, and it doesn't say why it's "wip". Perhaps
> others could take a closer look.
It's mostly WIP because it doesn't yet convert all the checks, specifically
headerscheck/cpluspluscheck isn't converted yet.
> ccf20a68f874 meson: ci: Add additional CI coverage
>
> IIUC, this is just for testing your branch, not meant for master?
Yes. I think we might want to add openbsd / netbsd at some point, but that'll
be a separate thread. Until then it just catches a bunch of mistakes more
easily.
> 02d84c21b227 meson: prereq: win: remove date from version number in
> win32ver.rc
>
> do it
The newest version has evolved a bit, changing Project.pm as well.
> 5c42b3e7812e meson: WIP: Add some of the windows resource files
>
> What is the thinking on this now? What does this change over the
> current state?
The newest commit has a lot more rc files added and has this summary:
meson: Add windows resource files
The generated resource files aren't exactly the same ones as the old
buildsystems generate. Previously "InternalName" and "OriginalFileName" were
mostly wrong / not set (despite being required), but that was hard to fix in
at least the make build. Additionally, the meson build falls back to a
"auto-generated" description when not set, and doesn't set it in a few cases -
unlikely that anybody looks at these descriptions in detail.
The only thing missing rc files is the various ecpg libraries. The issue is
that we shouldn't add resource file to static libraries, so we need to split
the definitions. I'll go and do that next.
> 9bc60bccfd10 meson: Add support for relative rpaths, fixing tests on MacOS
> w/ SIP
>
> I suggest a separate thread and/or CF entry for this. There have been
> various attempts to deal with SIP before, with varying results. This
> is not part of the meson transition as such.
I think I might need to split this one more time. We don't add all the rpaths
we add with autoconf before this commit, even not on macOS, which is not
great... Nor do we have a --disable-rpath equivalent yet - I suspect we'll
need that.
https://postgr.es/m/20220922223729.GA721620%40nathanxps13
> 9f5be26c1215 meson: Add docs for building with meson
>
> I do like the overall layout of this.
>
> The "Supported Platforms" section should be moved back to near the end
> of the chapter. I don't see a reason to move it forward, at least
> none that is related to the meson issue.
>
> The changes to the "Getting the Source" section are also not
> appropriate for this patch.
We don't really support building from a tarball with meson yet (you'd need to
confiure, maintainer-clean, configure meson), so it does make some sense...
> 9c00d355d0e9 meson: Add PGXS compatibility
>
> This looks like a reasonable direction to me. How complete is it? It
> says it works for some extensions but not others. How do we define
> the target line here?
Yea, those are good questions.
> How complete is it?
It's a bit hard to know. I think the most important stuff is there. But
there's no clear "API" around pgxs. E.g. we don't (yet?) have an exactly
equivalent definition of 'host', because that's very config.guess specific.
There's lots of shortcuts - e.g. with meson we don't need an equivalent to
PGAC_CHECK_STRIP, so we need to make up something for Makefile.global.
Noah suggested using $(error something), but that only works if $variable is
only used in recursively expanded variables - the errors end up confusing.
> It says it works for some extensions but not others.
I think that's slightly outdated - IIRC it was about pgbouncer, but after a
fix the remaining failure is shared between autoconf and meson builds.
> 3fd5e13dcad3 meson: Add postgresql-extension.pc for building extension
> libraries
>
> Separate thread for this as well. This is good and important, but we
> must also add it to the make build.
Makes sense.
> eb40f6e53104 meson: Add support for building with precompiled headers
>
> Any reason not to enable this by default? The benefits on non-Windows
> appear to be less dramatic, but they are not zero. Might be better to
> enable it consistently so that for example any breakage is easier
> caught.
There's no real reason not to - the wins are small on linux, so introducing
PCH didn't seem necessary. I'm also not sure how well pch works across random
compiler versions - it's so crucial on windows that it seems like a more well
worn path there.
linux, gcc 12:
b_pch=false:
real 0m16.233s
user 6m40.375s
sys 0m48.953s
b_pch=true:
real 0m15.983s
user 6m20.357s
sys 0m49.967s
freebsd VM, clang:
b_pch=false:
real 0m23.035s
user 3m11.241s
sys 0m31.171s
b_pch=true:
real 0m21.643s
user 2m57.143s
sys 0m30.246s
Somewhat confirming my suspicions from above, gcc11 ICEs on freebsd with PCH,
and gcc12 fails with an unhelpful:
<command-line>: sorry, unimplemented: PCH allocation failure
> 377bfdea6042 meson: Add xmllint/xsltproc wrapper script to handle
> dependencies automatically
>
> Is this part of the initial transition, required for correctness, or
> is it an optional optimization? Could use more explanation. Maybe
> move to separate thread also?
It's required for correctness - in master we don't rebuild the docs when a
file changes. meson and ninja don't support wildcards (for good reasons - it
makes scanning for changes much more expensive). By using "compiler" generated
dependencies this is solved in a reliably and notationally cheap way. So I
don't think it makes sense to split this one off into a separate thread?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 19:06 Andres Freund <andres@anarazel.de>
parent: John Naylor <john.naylor@enterprisedb.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-26 19:06 UTC (permalink / raw)
To: John Naylor <john.naylor@enterprisedb.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 15:18:29 +0700, John Naylor wrote:
> On Wed, Sep 21, 2022 at 7:11 AM Andres Freund <andres@anarazel.de> wrote:
> >
> > I added installation instructions for meson for a bunch of platforms, but
>
> A couple more things for the wiki:
>
> 1) /opt/homebrew/ seems to be an "Apple silicon" path?
Yea, it's /usr/local on x86-64, based on what was required to make macos CI
work. I updated the wiki page, half-blindly - it'd be nice if you could
confirm that that works?
I needed something like the below to get (nearly?) all dependencies working:
brewpath="/usr/local"
PKG_CONFIG_PATH="${brewpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
for pkg in icu4c krb5 openldap openssl zstd ; do
pkgpath="${brewpath}/opt/${pkg}"
PKG_CONFIG_PATH="${pkgpath}/lib/pkgconfig:${PKG_CONFIG_PATH}"
PATH="${pkgpath}/bin:${pkgpath}/sbin:$PATH"
done
export PKG_CONFIG_PATH PATH
meson setup \
--buildtype=debug \
-Dextra_include_dirs=${brewpath}/include \
-Dextra_lib_dirs=${brewpath}/lib \
-Dcassert=true \
-Dssl=openssl -Duuid=e2fs -Ddtrace=auto \
-DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
build
the per-package stuff is needed because some libraries aren't installed into
/usr/local (or /opt/homebrew), but only in a subdirectory within that.
> Either way it doesn't exist on this machine. I was able to get a working
> build with
>
> /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig
Hm - what did you need this path for - I don't think that should be needed.
> (My homebrew install doesn't seem to have anything relevant for
> extra_include_dirs or extra_lib_dirs.)
I think libintl.h / libintl.dylib are only in there. With meson that's the
only need for extra_include_dirs / extra_lib_dirs I found on arm apple.
> 2) Also, "ninja -v install" has the same line count as "ninja install" --
> are there versions that do something different?
Yea, that looks like a copy-and-pasto (not even from me :)). Think I fixed it.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 19:44 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-26 19:44 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 09:35:16 -0700, Andres Freund wrote:
> > 9c00d355d0e9 meson: Add PGXS compatibility
> >
> > This looks like a reasonable direction to me. How complete is it? It
> > says it works for some extensions but not others. How do we define
> > the target line here?
>
> Yea, those are good questions.
>
>
> > How complete is it?
>
> It's a bit hard to know. I think the most important stuff is there. But
> there's no clear "API" around pgxs. E.g. we don't (yet?) have an exactly
> equivalent definition of 'host', because that's very config.guess specific.
>
> There's lots of shortcuts - e.g. with meson we don't need an equivalent to
> PGAC_CHECK_STRIP, so we need to make up something for Makefile.global.
>
> Noah suggested using $(error something), but that only works if $variable is
> only used in recursively expanded variables - the errors end up confusing.
Looking through a few of the not-nicely-replaced things, I think we can
simplify at least some away:
- RANLIB: most platforms use AROPT = crs, making ranlib unnecessary. {free,
net, open}bsd don't currently, but all support it from what I know
- with_gnu_ld: this is only used on solaris, to set export_dynamic = -Wl,-E
when using a gnu ld. How about moving this to configure instead, and just
checking if -Wl,-E links?
- FLEXFLAGS: As a configure input this is afaict unused and undocumented - and
it's not clear why it'd be useful? Not that an empty replacement is a
meaningful effort
I'm not sure what to do about:
- autodepend - I'm inclined to set it to true when using a gcc like
compiler. I think extension authors won't be happy if suddenly their
extensions don't rebuild reliably anymore. An --enable-depend like
setting doesn't make sense for meson, so we don't have anything to source it
from.
- {LDAP,UUID,ICU}_{LIBS,CFLAGS} - might some extension need them?
For some others I think it's ok to not have replacement. Would be good for
somebody to check my thinking though:
- LIBOBJS, PG_CRC32C_OBJS, TAS: Not needed because we don't build
the server / PLs with the generated makefile
- ZIC: only needed to build tzdata as part of server build
- MSGFMT et al: translation doesn't appear to be supported by pgxs, correct?
- XMLLINT et al: docs don't seem to be supported by pgxs
- GENHTML et al: supporting coverage for pgxs-in-meson build doesn't seem worth it
- WINDRES: I don't think extensions are bothering to generate rc files on windows
I'll include an updated pgxs-compat patch in the next post of the series (in a
few hours).
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 19:47 Peter Geoghegan <pg@bowt.ie>
parent: Andres Freund <andres@anarazel.de>
2 siblings, 1 reply; 81+ messages in thread
From: Peter Geoghegan @ 2022-09-26 19:47 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Sun, Sep 25, 2022 at 5:38 PM Andres Freund <andres@anarazel.de> wrote:
> # run just the main pg_regress tests against existing server
> meson test --setup running main/regress-running
> Peter, would this address your use case?
I tried out your v16 patchset, which seems to mostly work as I'd hoped
it would. Some feedback:
* I gather that "running" as it appears in commands like "meson test
--setup running" refers to a particular setup named "running", that
you invented as part of creating a meson-ish substitute for
installcheck. Can "running" be renamed to something that makes it
obvious that it's a Postgres thing, and not a generic meson thing?
Maybe some kind of consistent naming convention would work best here.
This setup could be "pg_against_running_server", or something along
those lines.
* It would be nice if failed tests told me exactly which "diffs" file
I needed to look at, without my having to look for the message through
the meson log (or running with -v). Is this possible?
To be fair I should probably just be running -v when I run tests
against an existing running server, anyway -- so maybe I'm asking for
the wrong thing. It would at least be slightly better if I always got
to see a path to a .diffs file for failed tests, even without -v. But
it's just a "nice to have" thing -- it's not worth going out of your
way to make it work like that
* Just FYI, there are considerations about the libpq that we link to
here (actually this isn't particularly related to the new installcheck
work, but thought I'd mention it in passing).
I'm using Debian Unstable here. Like Nathan, I found that I needed a
custom -Dextra_lib_dirs just so that binaries would link against the
installation's own libpq, rather than the system libpq. This is
important-ish because linking to the wrong libpq means that I get an
error about not being able to connect via trust authentication to a
unix socket from the directory /var/run/postgresql -- confusion over
where to look for sockets visibly breaks many things.
The workaround that I have is fine, but this still seems like
something that should "just work". I believe that there is a pending
patch for this already, so enough said here.
> I think it'd make sense to add a few toplevel targets to run tests in certain
> ways, but I've not done that here.
I usually run "installcheck-world" (not just installcheck) when I want
to do a generic smoke test with Vaglrind. Sometimes that will fail
relatively early for very silly reasons, for example because I don't
have exactly the expected plan in some harmless way (I try to account
for this by running Valgrind in a shellscript that tries to match
"make check", but that doesn't always work). It is nice that I won't
have to worry about such minor issues derailing everything for a long
running and unsupervised Valgrind test. (Maybe I could have worked
around this before now, but I guess I never tried.)
More generally, I think that we should be encouraging users to think
of the tests as something that you can run in any order. People should
be encouraged to think in terms of the meson abstractions, such as
test setups.
I found that "meson test --setup running --list" will show me what
tests I'll be running if I want to do "installcheck" style testing,
without having to run any tests at all -- another small but important
improvement. This seems worth drawing attention to on the meson Wiki
page as a non-obvious improvement over "installcheck". I might even
find it useful to hard-code some of these tests in a shellscript, that
runs only a subset of "--setup running" tests that happen to be
interesting for Valgrind testing right now.
BTW the meson wiki page iencourages users to think of "meson setup"
and "meson configure" as equivalent to autoconf configure. I get why
you explained it like that, but that confused me at first. What I
since figured out (which will be absurdly obvious to you) is that you
really need to decouple the generic from the specific -- very much
unlike autoconf. I found it useful to separate stuff that I know will
never change for a given build directory (such as the prefix install
path) from other things that are variable configuration settings
(things like the optimization level used by GCC). I now have a
scripted way of running "meson setup" for the former stuff (which is
generic), and a scripted way of running "meson configure" for the
latter set of stuff (with variations for "standard" release and debug
builds, building Valgrind, etc).
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 20:27 Andres Freund <andres@anarazel.de>
parent: Peter Geoghegan <pg@bowt.ie>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-26 20:27 UTC (permalink / raw)
To: Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 12:47:14 -0700, Peter Geoghegan wrote:
> On Sun, Sep 25, 2022 at 5:38 PM Andres Freund <andres@anarazel.de> wrote:
> > # run just the main pg_regress tests against existing server
> > meson test --setup running main/regress-running
>
> > Peter, would this address your use case?
>
> I tried out your v16 patchset, which seems to mostly work as I'd hoped
> it would.
Thanks & cool.
> Some feedback:
> * I gather that "running" as it appears in commands like "meson test
> --setup running" refers to a particular setup named "running", that
> you invented as part of creating a meson-ish substitute for
> installcheck. Can "running" be renamed to something that makes it
> obvious that it's a Postgres thing, and not a generic meson thing?
Yes. The only caveat is that it makes lines longer, because it's included in
the printed test line (there's no real requirement to have the test suite and
the setup named the same,b ut it seems confusing not to)
> Maybe some kind of consistent naming convention would work best here.
> This setup could be "pg_against_running_server", or something along
> those lines.
> * It would be nice if failed tests told me exactly which "diffs" file
> I needed to look at, without my having to look for the message through
> the meson log (or running with -v). Is this possible?
You can use --print-errorlogs to print the log output iff a test fails. It's a
bit painful that some tests have very verbose output :(. I don't really see a
way that meson can help us here, this is pretty much on "our" end.
> BTW the meson wiki page iencourages users to think of "meson setup"
> and "meson configure" as equivalent to autoconf configure. I get why
> you explained it like that, but that confused me at first. What I
> since figured out (which will be absurdly obvious to you) is that you
> really need to decouple the generic from the specific -- very much
> unlike autoconf. I found it useful to separate stuff that I know will
> never change for a given build directory (such as the prefix install
> path) from other things that are variable configuration settings
> (things like the optimization level used by GCC). I now have a
> scripted way of running "meson setup" for the former stuff (which is
> generic), and a scripted way of running "meson configure" for the
> latter set of stuff (with variations for "standard" release and debug
> builds, building Valgrind, etc).
Hm. I'm not entirely sure what you mean here. The only thing that you can't
change in a existing build-dir with meson configure is the compiler.
I personally have different types of build dirs set up in parallel
(e.g. assert, optimize, assert-32, assert-w64). I'll occasionally
enable/disable
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-26 21:15 Peter Geoghegan <pg@bowt.ie>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Peter Geoghegan @ 2022-09-26 21:15 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Mon, Sep 26, 2022 at 1:27 PM Andres Freund <andres@anarazel.de> wrote:
> > Some feedback:
> > * I gather that "running" as it appears in commands like "meson test
> > --setup running" refers to a particular setup named "running", that
> > you invented as part of creating a meson-ish substitute for
> > installcheck. Can "running" be renamed to something that makes it
> > obvious that it's a Postgres thing, and not a generic meson thing?
>
> Yes. The only caveat is that it makes lines longer, because it's included in
> the printed test line (there's no real requirement to have the test suite and
> the setup named the same,b ut it seems confusing not to)
Probably doesn't have to be too long. And I'm not sure of the details.
Just a small thing from my point of view.
> > * It would be nice if failed tests told me exactly which "diffs" file
> > I needed to look at, without my having to look for the message through
> > the meson log (or running with -v). Is this possible?
>
> You can use --print-errorlogs to print the log output iff a test fails. It's a
> bit painful that some tests have very verbose output :(. I don't really see a
> way that meson can help us here, this is pretty much on "our" end.
Makes sense. Thanks.
> Hm. I'm not entirely sure what you mean here. The only thing that you can't
> change in a existing build-dir with meson configure is the compiler.
I do understand that it doesn't particularly matter to meson itself.
The point I was making was one about how I personally find it
convenient to set those things that I know will never change in
practice (because they're fundamentally things that I know that I
won't ever need to change) during "meson setup", while doing
everything else using "meson configure". I like to automate everything
using shell scripts. I will very occasionally have to run "meson
setup" via a zsh function anyway, so why not couple that process with
the process of setting "immutable for this build directory" settings?
With autoconf, I will run one of various zsh functions that run
configure in some specific way -- there are various "build types",
such as debug, release, and Valgrind. But with meson it makes sense to
split it in two -- have a generic zsh function for generic once-off
build directory setup (including even the mkdir), that also sets
generic, "immutable" settings, and a specialized zsh function that
changes things in a way that is particular to that kind of build (like
whether asserts are enabled, optimization level, and so on).
> I personally have different types of build dirs set up in parallel
> (e.g. assert, optimize, assert-32, assert-w64). I'll occasionally
> enable/disable
I know that other experienced hackers do it that way. I have found
that ccache works well enough that I don't feel the need for multiple
build directories per branch.
Perhaps I've assumed more than I should about my approach being
broadly representative. It might ultimately be easier to just have
multiple build directories per branch/source directory -- one per
"build type" per branch. That has the advantage of not requiring each
"build type" zsh function to remember to reset anything that might
have been set by one of its sibling zsh functions for some other build
type (there is no need to "reset the setting to its default"). That
approach is more like scripting autoconf/configure would be, in that
you basically never change any settings for a given build directory in
practice (you maybe invent a new kind of build type instead, or you
update the definition of an existing standard build type based on a
new requirement for that build type).
It's really handy that meson lets you quickly change one setting
against an existing build directory. I'm slightly worried that that
will allow me to shoot myself in the foot, though. Perhaps I'll change
some exotic setting in an ad-hoc way, and then forget to unset it
afterwards, leading to (say) a mysterious performance degradation for
what is supposed to be one of my known standard build types. There is
no risk of that with my autoconf/configure workflow, because I'll
rerun the relevant configure zsh function before long anyway, making
it impossible for me to accidentally keep something that I never meant
to keep.
I like being able to throw everything away and quickly rebuild "from
scratch" (in reality rebuild using ccache and a cache for configure)
due to superstition/defensive paranoia/learned helplessness. This has
always worked well enough because ccache works fairly well. I'm not
sure how useful that kind of mindset will be with meson just yet, and
if I'm just thinking about it in the wrong way, so forgive me for
rambling like this.
--
Peter Geoghegan
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-27 01:19 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 5 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-27 01:19 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
> I'll include an updated pgxs-compat patch in the next post of the series (in a
> few hours).
Attaches is version 17. Other changes:
- Added a new patch to fix the display of user provided CFLAGS in the meson
summary and to add them to pg_config output, addressing the report by Wang Wei
at [1]. Planning to apply this soon. We can fine tune this later, the
current situation is confusing.
- Added a new patch to set rpath to $libdir. I'd hoped we'd quickly go for
relative rpaths (so the install is relocatable, making it trivial to use
tmp_install), but I now think that might take a bit longer. I'm planning to
push this soon, as multiple people have been hit by this.
- Added a patch to separately define static / shared libraries for the ecpg
runtime libraries. This is a prerequisite patch for adding windows resource
files, since the resource files should only be defined for shared libraries.
- The patch adding windows resource files is, I think, now complete, including
adding resource files to the ecpg libs.
- A few more improvements for the PGXS compatibility. The pieces depending on
the changes discussed below are left in a separate patch for now, as I'm not
sure they'll survive as-is... There's a few more things needed, but I think
it's getting closer.
- Made some of the ecpg libraries use precompiled headers as well (gaining
maybe 500ms in a debug build)
One interesting question for this patch is where to add a note about when it
is sensible for a target to use a precompiled header, and when not. At the
moment meson generates a separate precompiled header "object" for each
target (as the flags can differ), so for a full build precompiled headers
can only be a win when a target has > 1 source file.
- Tweaked the patch adding tests against running instances a bit, mainly by
using a different suite name for the 'running' tests (otherwise meson test
--suite something does bad things) and removing the 'tmp-install', 'running'
suites. Haven't yet renamed 'running', as had been suggested by Peter
Geoghegan, his suggestion seemed a bit long.
- Reordered the series so that the patches that might take a while (including
being moved into a separate CF entry & thread) are last. I left the CI
patches at the start, because they make it easier to test parts of the
patchseries (e.g. [2] just checks up to 0004)
On 2022-09-26 12:44:35 -0700, Andres Freund wrote:
> Looking through a few of the not-nicely-replaced things, I think we can
> simplify at least some away:
>
> - RANLIB: most platforms use AROPT = crs, making ranlib unnecessary. {free,
> net, open}bsd don't currently, but all support it from what I know
Done in the attached 0009.
> - with_gnu_ld: this is only used on solaris, to set export_dynamic = -Wl,-E
> when using a gnu ld. How about moving this to configure instead, and just
> checking if -Wl,-E links?
Done in 0011. Together with 0010, which gets rid of the need for $(LD) on aix
by using $(CC) -r instead, this allows us to get rid of libtool.m4
Right now 0011 adds a PGAC_PROG_CC_LD_EXPORT_DYNAMIC() which tests for
-Wl,-E. It's used on solaris only. Based on its return value
SOLARIS_EXPORT_DYNAMIC is set in Makefile.global.
I'm not convinced by the precise structure I came up with in 0011, I'd welcome
feedback. But the idea as a whole seems promising to me.
0008 unifies CFLAGS_SSE42 and CFLAGS_ARMV8_CRC32C. We really don't need two
different variables for this - on the makefile level we really don't need to
care.
I'm wondering about moving the bulk of the pgxs compatibility stuff from
src/meson.build to src/makefiles/meson.build. Will look a bit uglier ('../'
references), but src/meson.build feels a bit too prominent somehow.
Greetings,
Andres Freund
[1] https://postgr.es/m/OS3PR01MB62751847BC9CD2DB7B29AC129E529%40OS3PR01MB6275.jpnprd01.prod.outlook.com
[2] https://cirrus-ci.com/build/6353192312111104
Attachments:
[text/x-diff] v17-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch (5.5K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/2-v17-0001-meson-ci-wip-move-compilerwarnings-task-to-meson.patch)
download | inline diff:
From 680ff3f7b4da1dbf21d0c7cd87af9bb5ee8b230c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 20:36:36 -0700
Subject: [PATCH v17 01/23] meson: ci: wip: move compilerwarnings task to meson
---
.cirrus.yml | 92 +++++++++++++-------------
src/tools/ci/linux-mingw-w64-64bit.txt | 13 ++++
2 files changed, 59 insertions(+), 46 deletions(-)
create mode 100644 src/tools/ci/linux-mingw-w64-64bit.txt
diff --git a/.cirrus.yml b/.cirrus.yml
index 7b5cb021027..eb33fdc4855 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -465,6 +465,10 @@ task:
ccache_cache:
folder: $CCACHE_DIR
+ ccache_stats_start_script:
+ ccache -s
+ ccache -z
+
setup_additional_packages_script: |
#apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y install ...
@@ -473,8 +477,6 @@ task:
# Test that code can be built with gcc/clang without warnings
###
- setup_script: echo "COPT=-Werror" > src/Makefile.custom
-
# Trace probes have a history of getting accidentally broken. Use the
# different compilers to build with different combinations of dtrace on/off
# and cassert on/off.
@@ -482,57 +484,58 @@ task:
# gcc, cassert off, dtrace on
always:
gcc_warning_script: |
- time ./configure \
- --cache gcc.cache \
- --enable-dtrace \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ mkdir build && cd build
+ CC="ccache gcc" CXX="ccache g++" \
+ meson setup \
+ -Dwerror=true \
+ -Dcassert=false \
+ -Ddtrace=enabled \
+ ${LINUX_MESON_FEATURES} \
+ ..
+ time ninja -j${BUILD_JOBS}
# gcc, cassert on, dtrace off
always:
gcc_a_warning_script: |
- time ./configure \
- --cache gcc.cache \
- --enable-cassert \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ cd build
+ meson configure \
+ -Dcassert=true \
+ -Ddtrace=disabled
+ time ninja -j${BUILD_JOBS}
# clang, cassert off, dtrace off
always:
clang_warning_script: |
- time ./configure \
- --cache clang.cache \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ rm -rf build
+ mkdir build && cd build
+ CC="ccache clang" CXX="ccache clang++" \
+ meson setup \
+ -Dwerror=true \
+ -Dcassert=false \
+ -Ddtrace=disabled \
+ ${LINUX_MESON_FEATURES} \
+ ..
+ time ninja -j${BUILD_JOBS}
# clang, cassert on, dtrace on
always:
clang_a_warning_script: |
- time ./configure \
- --cache clang.cache \
- --enable-cassert \
- --enable-dtrace \
- ${LINUX_CONFIGURE_FEATURES} \
- CC="ccache clang" CXX="ccache clang++" CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ cd build
+ meson configure \
+ -Dcassert=true \
+ -Ddtrace=enabled
+ time ninja -j${BUILD_JOBS}
# cross-compile to windows
always:
mingw_cross_warning_script: |
- time ./configure \
- --host=x86_64-w64-mingw32 \
- --enable-cassert \
- CC="ccache x86_64-w64-mingw32-gcc" \
- CXX="ccache x86_64-w64-mingw32-g++"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} world-bin
+ mkdir build-w64 && cd build-w64
+ meson setup \
+ --cross-file=../src/tools/ci/linux-mingw-w64-64bit.txt \
+ -Dwerror=true \
+ -Dcassert=true \
+ ..
+ time ninja -j${BUILD_JOBS}
###
# Verify docs can be built
@@ -540,13 +543,8 @@ task:
# XXX: Only do this if there have been changes in doc/ since last build
always:
docs_build_script: |
- time ./configure \
- --cache gcc.cache \
- CC="ccache gcc" \
- CXX="ccache g++" \
- CLANG="ccache clang"
- make -s -j${BUILD_JOBS} clean
- time make -s -j${BUILD_JOBS} -C doc
+ cd build
+ time ninja docs
###
# Verify headerscheck / cpluspluscheck succeed
@@ -563,11 +561,13 @@ task:
${LINUX_CONFIGURE_FEATURES} \
--without-icu \
--quiet \
- CC="gcc" CXX"=g++" CLANG="clang"
- make -s -j${BUILD_JOBS} clean
+ CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
+ make -s -j${BUILD_JOBS} world-bin
time make -s headerscheck EXTRAFLAGS='-fmax-errors=10'
headers_cpluspluscheck_script: |
time make -s cpluspluscheck EXTRAFLAGS='-fmax-errors=10'
always:
+ ccache_stats_end_script:
+ ccache -s
upload_caches: ccache
diff --git a/src/tools/ci/linux-mingw-w64-64bit.txt b/src/tools/ci/linux-mingw-w64-64bit.txt
new file mode 100644
index 00000000000..9d43b6dcfbc
--- /dev/null
+++ b/src/tools/ci/linux-mingw-w64-64bit.txt
@@ -0,0 +1,13 @@
+[binaries]
+c = ['ccache', '/usr/bin/x86_64-w64-mingw32-gcc']
+cpp = ['ccache', '/usr/bin/x86_64-w64-mingw32-g++']
+ar = '/usr/bin/x86_64-w64-mingw32-ar'
+strip = '/usr/bin/x86_64-w64-mingw32-strip'
+pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
+windres = '/usr/bin/x86_64-w64-mingw32-windres'
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch (17.1K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/3-v17-0002-meson-ci-dontmerge-Add-additional-CI-coverage.patch)
download | inline diff:
From a0aadba866912e1328e114447dcde91052a816f2 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 22:08:00 -0700
Subject: [PATCH v17 02/23] meson: ci: dontmerge: Add additional CI coverage
This is part of the series to be able to test meson on more platforms than
normally part of CI.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Justin Pryzby <pryzby@telsasoft.com>
---
.cirrus.yml | 322 +++++++++++++++++-
src/tools/ci/docker/linux_centos7 | 57 ++++
src/tools/ci/docker/linux_centos8 | 54 +++
src/tools/ci/docker/linux_fedora_rawhide | 49 +++
src/tools/ci/docker/linux_opensuse_tumbleweed | 56 +++
5 files changed, 522 insertions(+), 16 deletions(-)
create mode 100644 src/tools/ci/docker/linux_centos7
create mode 100644 src/tools/ci/docker/linux_centos8
create mode 100644 src/tools/ci/docker/linux_fedora_rawhide
create mode 100644 src/tools/ci/docker/linux_opensuse_tumbleweed
diff --git a/.cirrus.yml b/.cirrus.yml
index eb33fdc4855..efb2d2c4832 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -126,6 +126,90 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
+task:
+ env:
+ CPUS: 2
+ BUILD_JOBS: 3
+ TEST_JOBS: 3
+
+ CIRRUS_WORKING_DIR: /home/postgres/postgres
+ CCACHE_DIR: /tmp/ccache_dir
+
+ PATH: /usr/sbin:$PATH
+
+ # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+ # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+ # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+ LANG: "C"
+ LC_ALL: "C"
+
+ matrix:
+ - name: NetBSD - 9 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+ env:
+ IMAGE_NAME: pg-ci-netbsd-9-postgres
+ PLATFORM: netbsd
+ INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include
+
+ - name: OpenBSD - 7 - Meson
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+ env:
+ IMAGE_NAME: pg-ci-openbsd-7-postgres
+ PLATFORM: openbsd
+ INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
+ UUID: -Duuid=e2fs
+
+ compute_engine_instance:
+ image_project: $IMAGE_PROJECT
+ image: family/${IMAGE_NAME}
+ platform: ${PLATFORM}
+ cpu: $CPUS
+ memory: 4G
+ disk: 25
+
+ sysinfo_script: |
+ locale
+ id
+ uname -a
+ ulimit -a -H && ulimit -a -S
+ export
+
+ ccache_cache:
+ folder: $CCACHE_DIR
+
+ create_user_script: |
+ useradd postgres
+ chown -R postgres:users /home/postgres
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:users ${CCACHE_DIR}
+
+ # -Duuid=bsd is not set since 'bsd' uuid option
+ # is not working on netBSD & openBSD. See
+ # https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
+ # And other uuid options are not available on netBSD
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl ${UUID} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ ${INCLUDE_DIRS} \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
# configure feature flags, shared between the task running the linux tests and
# the CompilerWarnings task
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
@@ -152,6 +236,22 @@ LINUX_MESON_FEATURES: &LINUX_MESON_FEATURES >-
-Duuid=e2fs
+# configure preparation scripts, shared between tasks running the linux tests
+linux_preparation_scripts_template: &linux_preparation_scripts_template
+ sysinfo_script: |
+ id
+ uname -a
+ cat /proc/cmdline
+ ulimit -a -H && ulimit -a -S
+ export
+ create_user_script: |
+ useradd -m -U postgres
+ chown -R postgres:postgres .
+ mkdir -p ${CCACHE_DIR}
+ chown -R postgres:postgres ${CCACHE_DIR}
+ su postgres -c "ulimit -l -H && ulimit -l -S"
+
+
task:
env:
CPUS: 4
@@ -181,19 +281,9 @@ task:
ccache_cache:
folder: ${CCACHE_DIR}
- sysinfo_script: |
- id
- uname -a
- cat /proc/cmdline
- ulimit -a -H && ulimit -a -S
- export
- create_user_script: |
- useradd -m postgres
- chown -R postgres:postgres .
- mkdir -p ${CCACHE_DIR}
- chown -R postgres:postgres ${CCACHE_DIR}
+ set_limits_script: |
echo '* - memlock 134217728' > /etc/security/limits.d/postgres.conf
- su postgres -c "ulimit -l -H && ulimit -l -S"
+ <<: *linux_preparation_scripts_template
setup_core_files_script: |
mkdir -m 770 /tmp/cores
chown root:postgres /tmp/cores
@@ -227,7 +317,13 @@ task:
on_failure:
<<: *on_failure_ac
- - name: Linux - Debian Bullseye - Meson
+ - matrix:
+ - name: Linux - Debian Bullseye - Meson
+ - name: Linux - Debian Sid - Meson
+ trigger_type: manual
+
+ compute_engine_instance:
+ image: family/pg-ci-sid
configure_script: |
su postgres <<-EOF
@@ -255,6 +351,81 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh linux /tmp/cores
+task:
+ env:
+ CPUS: 4
+ BUILD_JOBS: 4
+ TEST_JOBS: 8 # experimentally derived to be a decent choice
+
+ CCACHE_DIR: /tmp/ccache_dir
+ DEBUGINFOD_URLS: ${DEBUGINFO}
+
+ TCL_DIR: /usr/lib64/
+ UUID: e2fs
+
+ CFLAGS: "-Og -ggdb"
+ CXXFLAGS: "-Og -ggdb"
+
+ LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
+
+ only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
+
+ container:
+ dockerfile: ${DOCKERFILE_PATH}
+ cpu: $CPUS
+ memory: 4G
+
+ ccache_cache:
+ folder: ${CCACHE_DIR}
+
+ <<: *linux_preparation_scripts_template
+
+ matrix:
+ - name: Linux - OpenSuse Tumbleweed (LLVM) - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_opensuse_tumbleweed
+ DEBUGINFO: "https://debuginfod.opensuse.org/"
+ LLVM: -Dllvm=enabled
+
+ - trigger_type: manual
+ matrix:
+ - name: Linux - Fedora Rawhide - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_fedora_rawhide
+ DEBUGINFO: "https://debuginfod.fedoraproject.org/"
+
+ - name: Linux - Centos 8 - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ - name: Linux - Centos 7 - Meson
+ env:
+ DOCKERFILE_PATH: src/tools/ci/docker/linux_centos7
+ DEBUGINFO: "http://debuginfo.centos.org/"
+
+ configure_script: |
+ su postgres <<-EOF
+ meson setup \
+ --buildtype debug \
+ -Dcassert=true -Dssl=openssl -Duuid=e2fs ${LLVM} \
+ -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+ build
+ EOF
+
+ build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+ upload_caches: ccache
+
+ test_world_script: |
+ su postgres <<-EOF
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+ EOF
+
+ on_failure:
+ <<: *on_failure_meson
+
+
task:
name: macOS - Monterey - Meson
@@ -355,9 +526,7 @@ task:
cores_script: src/tools/ci/cores_backtrace.sh macos "${HOME}/cores"
-task:
- name: Windows - Server 2019, VS 2019 - Meson & ninja
-
+windows_template: &windows_template
env:
# Half the allowed per-user CPU cores
CPUS: 4
@@ -373,6 +542,20 @@ task:
# Avoids port conflicts between concurrent tap test runs
PG_TEST_USE_UNIX_SOCKETS: 1
PG_REGRESS_SOCK_DIR: "c:/cirrus/"
+ # -m enables parallelism
+ # verbosity:minimal + Summary reduce verbosity, while keeping a summary of
+ # errors/warnings
+ # ForceNoAlign prevents msbuild from introducing line-breaks for long lines
+ # disable file tracker, we're never going to rebuild, and it slows down the
+ # build
+ MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo
+
+ # If tests hang forever, cirrus eventually times out. In that case log
+ # output etc is not uploaded, making the problem hard to debug. Of course
+ # tests internally should have shorter timeouts, but that's proven to not
+ # be sufficient. 15min currently is fast enough to finish individual test
+ # "suites".
+ T_C: "\"C:/Program Files/Git/usr/bin/timeout.exe\" -v -k60s 15m"
# startcreate_script starts a postgres instance that we don't want to get
# killed at the end of that script (it's stopped in stop_script). Can't
@@ -406,6 +589,16 @@ task:
setup_additional_packages_script: |
REM choco install -y --no-progress ...
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & ninja
+
+ meson_install_wraps_script: |
+ mkdir subprojects
+ meson wrap install lz4
+ meson wrap install zlib
+
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
@@ -426,6 +619,103 @@ task:
type: text/plain
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Meson & msbuild
+
+ meson_install_wraps_script: |
+ mkdir subprojects
+ meson wrap install lz4
+ meson wrap install zlib
+
+ configure_script: |
+ vcvarsall x64
+ meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+
+ build_script: |
+ vcvarsall x64
+ msbuild %MSBFLAGS% build\postgresql.sln
+
+ check_world_script: |
+ vcvarsall x64
+ meson test %MTEST_ARGS% --num-processes %TEST_JOBS%
+
+ on_failure:
+ <<: *on_failure_meson
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+ type: text/plain
+
+
+task:
+ <<: *windows_template
+ name: Windows - Server 2019, VS 2019 - Homegrown
+
+ env:
+ # Our windows infrastructure doesn't have test concurrency above the level
+ # of a single vcregress test target. Due to that, it's useful to run prove
+ # with multiple jobs. For the other tasks it isn't, because two sources
+ # (make and prove) of concurrency can overload machines.
+ #
+ # The concrete choice of 10 is based on a small bit of experimentation and
+ # likely can be improved upon further.
+ PROVE_FLAGS: -j10 --timer
+
+ configure_script:
+ # copy errors out when using forward slashes
+ - copy src\tools\ci\windows_build_config.pl src\tools\msvc\config.pl
+ - vcvarsall x64
+ - perl src/tools/msvc/mkvcbuild.pl
+ build_script:
+ - vcvarsall x64
+ - msbuild %MSBFLAGS% pgsql.sln
+ tempinstall_script:
+ # Installation on windows currently only completely works from src/tools/msvc
+ - cd src/tools/msvc && perl install.pl %CIRRUS_WORKING_DIR%/tmp_install
+
+ test_regress_parallel_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl check parallel
+ startcreate_script: |
+ rem paths to binaries need backslashes
+ tmp_install\bin\pg_ctl.exe initdb -D tmp_check/db -l tmp_check/initdb.log --options=--no-sync
+ echo include '%TEMP_CONFIG%' >> tmp_check/db/postgresql.conf
+ tmp_install\bin\pg_ctl.exe start -D tmp_check/db -l tmp_check/postmaster.log
+
+ test_pl_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl plcheck
+ test_isolation_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl isolationcheck
+ test_modules_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl modulescheck
+ test_contrib_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl contribcheck
+ stop_script: |
+ tmp_install\bin\pg_ctl.exe stop -D tmp_check/db -l tmp_check/postmaster.log
+ test_ssl_script: |
+ set with_ssl=openssl
+ %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/ssl/
+ test_subscription_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/subscription/
+ test_authentication_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl taptest ./src/test/authentication/
+ test_recovery_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl recoverycheck
+ test_bin_script: |
+ %T_C% perl src/tools/msvc/vcregress.pl bincheck
+ test_ecpg_script: |
+ rem tries to build additional stuff
+ vcvarsall x64
+ rem References ecpg_regression.proj in the current dir
+ cd src/tools/msvc
+ %T_C% perl vcregress.pl ecpgcheck
+
+ on_failure:
+ <<: *on_failure_ac
+ crashlog_artifacts:
+ path: "crashlog-*.txt"
+ type: text/plain
+
+
task:
name: CompilerWarnings
diff --git a/src/tools/ci/docker/linux_centos7 b/src/tools/ci/docker/linux_centos7
new file mode 100644
index 00000000000..3742890d961
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos7
@@ -0,0 +1,57 @@
+FROM centos:centos7
+# Enable powertools, EPEL and devtoolset repository
+RUN \
+ yum -y install dnf-plugins-core \
+ epel-release \
+ centos-release-scl-rh && \
+ \
+ yum -y update && \
+ yum -y install \
+ \
+ git \
+ perl \
+ perl-ExtUtils-Embed \
+ perl-IPC-Run \
+ perl-Test-Harness \
+ perl-Test-Simple \
+ \
+ bison \
+ ccache \
+ clang \
+ devtoolset-7-make \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ && \
+ pip3 install meson && \
+ pip3 install ninja && \
+ yum clean all
+
+# Make version is 3.82 but required is > 4, adding devtoolset-7-make to the PATH
+ENV PATH="/opt/rh/devtoolset-7/root/usr/bin/:${PATH}"
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_centos8 b/src/tools/ci/docker/linux_centos8
new file mode 100644
index 00000000000..58f95847ef1
--- /dev/null
+++ b/src/tools/ci/docker/linux_centos8
@@ -0,0 +1,54 @@
+FROM quay.io/centos/centos:stream8
+# Enable powertools and EPEL repository
+RUN \
+ dnf -y install dnf-plugins-core && \
+ dnf config-manager --set-enabled powertools && \
+ dnf -y install epel-release && \
+ dnf -y update && \
+ dnf -y install \
+ \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ diffutils \
+ flex \
+ gcc \
+ gettext \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ glibc-langpack-en \
+ \
+ && \
+ pip3 install ninja && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_fedora_rawhide b/src/tools/ci/docker/linux_fedora_rawhide
new file mode 100644
index 00000000000..c95027cd6a7
--- /dev/null
+++ b/src/tools/ci/docker/linux_fedora_rawhide
@@ -0,0 +1,49 @@
+FROM fedora:rawhide
+RUN \
+ dnf -y update && \
+ dnf -y install \
+ git \
+ meson \
+ perl \
+ perl-IPC-Run \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gettext \
+ ninja-build \
+ \
+ krb5-devel \
+ libicu-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ lz4-devel \
+ openldap-devel \
+ openssl-devel \
+ pam-devel \
+ python3-devel \
+ readline-devel \
+ systemd-devel \
+ tcl-devel \
+ \
+ krb5-server \
+ krb5-server-ldap \
+ krb5-workstation \
+ lz4 \
+ openldap-clients \
+ openldap-servers \
+ openssl \
+ zstd \
+ \
+ langpacks-en \
+ glibc-langpack-en \
+ \
+ && \
+ yum clean all
+
+ENV LANG=en_US.UTF-8
diff --git a/src/tools/ci/docker/linux_opensuse_tumbleweed b/src/tools/ci/docker/linux_opensuse_tumbleweed
new file mode 100644
index 00000000000..07364ee85ff
--- /dev/null
+++ b/src/tools/ci/docker/linux_opensuse_tumbleweed
@@ -0,0 +1,56 @@
+FROM opensuse/tumbleweed
+RUN \
+ zypper -n clean -a && \
+ zypper -n ref && \
+ zypper -n dup && \
+ zypper -n update && \
+ zypper -n install \
+ diffutils \
+ git \
+ icu \
+ make \
+ meson \
+ perl-IPC-Run \
+ shadow \
+ systemd-devel \
+ util-linux \
+ \
+ bison \
+ ccache \
+ clang \
+ flex \
+ gcc \
+ gcc-c++ \
+ gettext-runtime \
+ ninja \
+ \
+ krb5-devel \
+ libicu-devel \
+ libldapcpp-devel \
+ liblz4-devel \
+ libopenssl-devel \
+ libselinux-devel \
+ libuuid-devel \
+ libxml2-devel \
+ libxslt-devel \
+ libzstd-devel \
+ llvm-devel \
+ pam-devel \
+ python38-devel \
+ readline-devel \
+ tcl-devel \
+ \
+ openldap2 \
+ openldap2-client \
+ \
+ krb5-client \
+ krb5-plugin-kdb-ldap \
+ krb5-server \
+ lz4 \
+ zstd \
+ \
+ && \
+ zypper -n clean -a
+
+# Fixing ICU errors caused by locale being set to 'POSIX'
+ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0003-meson-Include-CFLAGS-c_args-in-summary-and-pg_co.patch (2.4K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/4-v17-0003-meson-Include-CFLAGS-c_args-in-summary-and-pg_co.patch)
download | inline diff:
From 69cd023e061187de774df5cd4b8eed1e59d6de49 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 11:31:32 -0700
Subject: [PATCH v17 03/23] meson: Include CFLAGS/c_args in summary and
pg_config output
Previously arguments passed in via CFLAGS/-Dc_args were neither displayed in
meson's summary, nor in pg_config's output.
Reported-by: "wangw.fnst@fujitsu.com" <wangw.fnst@fujitsu.com>
Discussion: https://postgr.es/m/OS3PR01MB62751847BC9CD2DB7B29AC129E529@OS3PR01MB6275.jpnprd01.prod.outlook.com
---
src/include/meson.build | 10 +++++++---
meson.build | 4 ++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/include/meson.build b/src/include/meson.build
index e5390df0584..f2f7d03ff27 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -42,11 +42,15 @@ config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
var_cc = ' '.join(cc.cmd_array())
var_cpp = ' '.join(cc.cmd_array() + ['-E'])
-var_cflags = ' '.join(cflags + cflags_warn)
-var_cxxflags = ' '.join(cxxflags + cxxflags_warn)
+var_cflags = ' '.join(cflags + cflags_warn + get_option('c_args'))
+if llvm.found()
+ var_cxxflags = ' '.join(cxxflags + cxxflags_warn + get_option('cpp_args'))
+else
+ var_cxxflags = ''
+endif
var_cppflags = ' '.join(cppflags)
var_cflags_sl = '-fPIC' #FIXME
-var_ldflags = ' '.join(ldflags)
+var_ldflags = ' '.join(ldflags + get_option('c_link_args'))
var_ldflags_sl = ''.join(ldflags_sl)
var_ldflags_ex = '' # FIXME
# FIXME - some extensions might directly use symbols from one of libs. If
diff --git a/meson.build b/meson.build
index 6ffae59ba03..474a42a2559 100644
--- a/meson.build
+++ b/meson.build
@@ -2966,6 +2966,9 @@ if meson.version().version_compare('>=0.57')
'CPP FLAGS': ' '.join(cppflags),
'C FLAGS, functional': ' '.join(cflags),
'C FLAGS, warnings': ' '.join(cflags_warn),
+ 'C FLAGS, modules': ' '.join(cflags_mod),
+ 'C FLAGS, user specified': ' '.join(get_option('c_args')),
+ 'LD FLAGS': ' '.join(ldflags + get_option('c_link_args')),
},
section: 'Compiler Flags',
)
@@ -2982,6 +2985,7 @@ if meson.version().version_compare('>=0.57')
{
'C++ FLAGS, functional': ' '.join(cxxflags),
'C++ FLAGS, warnings': ' '.join(cxxflags_warn),
+ 'C++ FLAGS, user specified': ' '.join(get_option('cpp_args')),
},
section: 'Compiler Flags',
)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0004-meson-Set-up-absolute-rpaths-to-libdir.patch (1.7K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/5-v17-0004-meson-Set-up-absolute-rpaths-to-libdir.patch)
download | inline diff:
From 910047de00884a566b9a674b886bc383eb02b91e Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 17:08:45 -0700
Subject: [PATCH v17 04/23] meson: Set up absolute rpaths to libdir
While I (Andres) had planned to use relative rpaths, it looks like agreeing on
the precise path might take a bit. So set up absolute rpaths for now.
---
meson.build | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 474a42a2559..38b2c3aae2e 100644
--- a/meson.build
+++ b/meson.build
@@ -2471,9 +2471,22 @@ bin_install_rpaths = []
lib_install_rpaths = []
mod_install_rpaths = []
-# Add extra_lib_dirs to rpath. Not needed on darwin, as the install_name of
-# libraries in extra_lib_dirs will be used anyway.
+
+# Don't add rpaths on darwin for now - as long as only absolute references to
+# libraries are needed, absolute LC_ID_DYLIB ensures libraries can be found in
+# their final destination.
if host_system != 'darwin'
+ # Add absolute path to libdir to rpath. This ensures installed binaries /
+ # libraries find our libraries (mainly libpq).
+ bin_install_rpaths += dir_prefix / dir_lib
+ lib_install_rpaths += dir_prefix / dir_lib
+ mod_install_rpaths += dir_prefix / dir_lib
+
+ # Add extra_lib_dirs to rpath. This ensures we find libraries we depend on.
+ #
+ # Not needed on darwin even if we use relative rpaths for our own libraries,
+ # as the install_name of libraries in extra_lib_dirs will point to their
+ # location anyway.
bin_install_rpaths += postgres_lib_d
lib_install_rpaths += postgres_lib_d
mod_install_rpaths += postgres_lib_d
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0005-meson-ecpg-Split-definition-of-static-and-shared.patch (7.7K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/6-v17-0005-meson-ecpg-Split-definition-of-static-and-shared.patch)
download | inline diff:
From c55cd308dc9896e1487844e4c2edf27b68a08dc6 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 10:30:39 -0700
Subject: [PATCH v17 05/23] meson: ecpg: Split definition of static and shared
libraries
Required for correct resource file generation, as the resource files should
only be added to the shared library.
This also fixes the copy-pasto of naming the target for the export files for
the ecpg libraries libpq.exports.
Only really makes sense with the subsequent commit, but is sufficiently
complicated to be worth keeping separate for easier review.
---
src/interfaces/libpq/meson.build | 4 +--
src/interfaces/ecpg/compatlib/meson.build | 37 +++++++++++++++++-----
src/interfaces/ecpg/ecpglib/meson.build | 32 +++++++++++++++----
src/interfaces/ecpg/pgtypeslib/meson.build | 28 ++++++++++++----
src/interfaces/ecpg/test/meson.build | 2 +-
5 files changed, 79 insertions(+), 24 deletions(-)
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index bc047e00d62..c203372a35b 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -49,8 +49,8 @@ libpq_st = static_library('libpq',
kwargs: default_lib_args,
)
-# not using both_libraries here, causes problems with precompiled headers and
-# resource files with msbuild
+# not using both_libraries() here as the resource file should only be in the
+# shared library
libpq_so = shared_library('libpq',
dependencies: libpq_deps,
include_directories: [libpq_inc, postgres_inc],
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 5887cb92b52..7aeb627ee86 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -1,11 +1,31 @@
-export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
-
-ecpg_compat = both_libraries('libecpg_compat',
+ecpg_compat_sources = files(
'informix.c',
- include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
- c_args: ['-DSO_MAJOR_VERSION=3'],
+)
+ecpg_compat_so_sources = [] # only for shared lib, in addition to above
+
+ecpg_compat_inc = ['.', ecpg_inc, postgres_inc, libpq_inc]
+ecpg_compat_c_args = ['-DSO_MAJOR_VERSION=3']
+export_file = custom_target('libecpg_compat.exports', kwargs: gen_export_kwargs)
+
+# not using both_libraries(), as the resource file should only be in the
+# shared library
+ecpg_compat_st = static_library('libecpg_compat',
+ ecpg_compat_sources,
+ include_directories: ecpg_compat_inc,
+ c_args: ecpg_compat_c_args,
+ pic: true,
dependencies: [frontend_code, thread_dep],
- link_with: [ecpglib, ecpg_pgtypes],
+ kwargs: default_lib_args,
+)
+ecpg_targets += ecpg_compat_st
+
+ecpg_compat_so = shared_library('libecpg_compat',
+ ecpg_compat_so_sources,
+ include_directories: ecpg_compat_inc,
+ c_args: ecpg_compat_c_args,
+ dependencies: [frontend_code, thread_dep],
+ link_whole: ecpg_compat_st,
+ link_with: [ecpglib_so, ecpg_pgtypes_so],
soversion: host_system != 'windows' ? '3' : '',
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
version: '3.' + pg_version_major.to_string(),
@@ -13,10 +33,11 @@ ecpg_compat = both_libraries('libecpg_compat',
link_depends: export_file,
kwargs: default_lib_args,
)
-ecpg_targets += [ecpg_compat.get_shared_lib(), ecpg_compat.get_static_lib()]
+ecpg_targets += ecpg_compat_so
pkgconfig.generate(
- ecpg_compat.get_shared_lib(),
+ ecpg_compat_so,
+ requires_private: 'libpgtypes',
description: 'PostgreSQL libecpg_compat library',
url: pg_url,
)
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 2da029ec8ea..eb8dd616571 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -10,15 +10,32 @@ ecpglib_sources = files(
'sqlda.c',
'typename.c',
)
+ecpglib_so_sources = [] # only for shared lib, in addition to above
-export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+ecpglib_inc = ['.', ecpg_inc, postgres_inc]
+ecpglib_c_args = ['-DSO_MAJOR_VERSION=6']
+export_file = custom_target('libecpg.exports', kwargs: gen_export_kwargs)
-ecpglib = both_libraries('libecpg',
+# not using both_libraries(), as the resource file should only be in the
+# shared library
+ecpglib_st = static_library('libecpg',
ecpglib_sources,
- include_directories: ['.', ecpg_inc, postgres_inc],
- c_args: ['-DSO_MAJOR_VERSION=6'],
+ include_directories: ecpglib_inc,
+ c_args: ecpglib_c_args,
+ pic: true,
dependencies: [frontend_code, libpq, thread_dep],
- link_with: [ecpg_pgtypes],
+ link_with: [ecpg_pgtypes_so],
+ kwargs: default_lib_args,
+)
+ecpg_targets += ecpglib_st
+
+ecpglib_so = shared_library('libecpg',
+ ecpglib_so_sources,
+ include_directories: ecpglib_inc,
+ c_args: ecpglib_c_args,
+ dependencies: [frontend_code, libpq, thread_dep],
+ link_whole: ecpglib_st,
+ link_with: [ecpg_pgtypes_so],
soversion: host_system != 'windows' ? '6' : '',
darwin_versions: ['6', '6.' + pg_version_major.to_string()],
version: '6.' + pg_version_major.to_string(),
@@ -26,10 +43,11 @@ ecpglib = both_libraries('libecpg',
link_depends: export_file,
kwargs: default_lib_args,
)
-ecpg_targets += [ecpglib.get_shared_lib(), ecpglib.get_static_lib()]
+ecpg_targets += ecpglib_so
pkgconfig.generate(
- ecpglib.get_shared_lib(),
+ ecpglib_so,
+ requires_private: 'libpgtypes',
description: 'PostgreSQL libecpg library',
url: pg_url,
)
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 96489d9f1d7..5254843f84d 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -6,13 +6,29 @@ ecpg_pgtypes_sources = files(
'numeric.c',
'timestamp.c',
)
+ecpg_pgtypes_so_sources = []
-export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+export_file = custom_target('libpgtypes.exports', kwargs: gen_export_kwargs)
+ecpg_pgtypes_inc = ['.', ecpg_inc, postgres_inc]
+ecpg_pgtypes_c_args = ['-DSO_MAJOR_VERSION=3']
-ecpg_pgtypes = both_libraries('libpgtypes',
+# not using both_libraries(), as the resource file should only be in the
+# shared library
+ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
- include_directories: ['.', ecpg_inc, postgres_inc],
- c_args: ['-DSO_MAJOR_VERSION=3'],
+ include_directories: ecpg_pgtypes_inc,
+ c_args: ecpg_pgtypes_c_args,
+ pic: true,
+ dependencies: [frontend_code],
+ kwargs: default_lib_args,
+)
+ecpg_targets += ecpg_pgtypes_st
+
+ecpg_pgtypes_so = shared_library('libpgtypes',
+ ecpg_pgtypes_so_sources,
+ include_directories: ecpg_pgtypes_inc,
+ c_args: ecpg_pgtypes_c_args,
+ link_whole: ecpg_pgtypes_st,
dependencies: [frontend_code],
version: '3.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '3' : '',
@@ -21,10 +37,10 @@ ecpg_pgtypes = both_libraries('libpgtypes',
link_depends: export_file,
kwargs: default_lib_args,
)
-ecpg_targets += [ecpg_pgtypes.get_shared_lib(), ecpg_pgtypes.get_static_lib()]
+ecpg_targets += ecpg_pgtypes_so
pkgconfig.generate(
- ecpg_pgtypes.get_shared_lib(),
+ ecpg_pgtypes_so,
description: 'PostgreSQL libpgtypes library',
url: pg_url,
)
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index f0ace641f0c..8904aa7fd90 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -22,7 +22,7 @@ testprep_targets += pg_regress_ecpg
ecpg_test_exec_kw = {
'dependencies': [frontend_code, libpq],
'include_directories': [ecpg_inc],
- 'link_with': [ecpglib, ecpg_compat, ecpg_pgtypes],
+ 'link_with': [ecpglib_so, ecpg_compat_so, ecpg_pgtypes_so],
'build_by_default': false,
'install': false,
}
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0006-meson-Add-windows-resource-files.patch (91.0K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/7-v17-0006-meson-Add-windows-resource-files.patch)
download | inline diff:
From b57f1fbd66a95b4b888fc060ffeeba85493696f9 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 10:32:45 -0700
Subject: [PATCH v17 06/23] meson: Add windows resource files
The generated resource files aren't exactly the same ones as the old
buildsystems generate. Previously "InternalName" and "OriginalFileName" were
mostly wrong / not set (despite being required), but that was hard to fix in
at least the make build. Additionally, the meson build falls back to a
"auto-generated" description when not set, and doesn't set it in a few cases -
unlikely that anybody looks at these descriptions in detail.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
---
src/backend/jit/llvm/meson.build | 6 ++
.../replication/libpqwalreceiver/meson.build | 6 ++
src/backend/replication/pgoutput/meson.build | 6 ++
src/backend/snowball/meson.build | 6 ++
.../utils/mb/conversion_procs/meson.build | 9 +-
src/bin/initdb/meson.build | 6 ++
src/bin/pg_amcheck/meson.build | 8 +-
src/bin/pg_archivecleanup/meson.build | 12 ++-
src/bin/pg_basebackup/meson.build | 38 ++++++-
src/bin/pg_checksums/meson.build | 12 ++-
src/bin/pg_config/meson.build | 12 ++-
src/bin/pg_controldata/meson.build | 12 ++-
src/bin/pg_ctl/meson.build | 12 ++-
src/bin/pg_dump/meson.build | 18 ++++
src/bin/pg_resetwal/meson.build | 12 ++-
src/bin/pg_rewind/meson.build | 6 ++
src/bin/pg_test_fsync/meson.build | 10 +-
src/bin/pg_test_timing/meson.build | 12 ++-
src/bin/pg_upgrade/meson.build | 6 ++
src/bin/pg_verifybackup/meson.build | 6 ++
src/bin/pg_waldump/meson.build | 6 ++
src/bin/pgbench/meson.build | 6 ++
src/bin/pgevent/meson.build | 6 ++
src/bin/psql/meson.build | 6 ++
src/bin/scripts/meson.build | 10 +-
src/interfaces/libpq/meson.build | 5 +
src/interfaces/libpq/test/meson.build | 25 ++++-
src/pl/plperl/meson.build | 7 ++
src/pl/plpgsql/src/meson.build | 6 ++
src/pl/plpython/meson.build | 6 ++
src/pl/tcl/meson.build | 6 ++
contrib/adminpack/meson.build | 12 ++-
contrib/amcheck/meson.build | 17 +++-
contrib/auth_delay/meson.build | 12 ++-
contrib/auto_explain/meson.build | 12 ++-
contrib/basebackup_to_shell/meson.build | 6 ++
contrib/basic_archive/meson.build | 6 ++
contrib/bloom/meson.build | 6 ++
contrib/bool_plperl/meson.build | 6 ++
contrib/btree_gin/meson.build | 12 ++-
contrib/btree_gist/meson.build | 6 ++
contrib/citext/meson.build | 6 ++
contrib/cube/meson.build | 6 ++
contrib/dblink/meson.build | 6 ++
contrib/dict_int/meson.build | 12 ++-
contrib/dict_xsyn/meson.build | 12 ++-
contrib/earthdistance/meson.build | 12 ++-
contrib/file_fdw/meson.build | 12 ++-
contrib/fuzzystrmatch/meson.build | 16 ++-
contrib/hstore/meson.build | 24 +++--
contrib/hstore_plperl/meson.build | 6 ++
contrib/hstore_plpython/meson.build | 6 ++
contrib/intarray/meson.build | 6 ++
contrib/isn/meson.build | 6 ++
contrib/jsonb_plperl/meson.build | 6 ++
contrib/jsonb_plpython/meson.build | 6 ++
contrib/lo/meson.build | 6 ++
contrib/ltree/meson.build | 6 ++
contrib/ltree_plpython/meson.build | 6 ++
contrib/oid2name/meson.build | 12 ++-
contrib/old_snapshot/meson.build | 6 ++
contrib/pageinspect/meson.build | 6 ++
contrib/passwordcheck/meson.build | 6 ++
contrib/pg_buffercache/meson.build | 14 ++-
contrib/pg_freespacemap/meson.build | 14 ++-
contrib/pg_prewarm/meson.build | 16 ++-
contrib/pg_stat_statements/meson.build | 12 ++-
contrib/pg_surgery/meson.build | 14 ++-
contrib/pg_trgm/meson.build | 20 ++--
contrib/pg_visibility/meson.build | 14 ++-
contrib/pg_walinspect/meson.build | 6 ++
contrib/pgcrypto/meson.build | 6 ++
contrib/pgrowlocks/meson.build | 14 ++-
contrib/pgstattuple/meson.build | 18 +++-
contrib/postgres_fdw/meson.build | 6 ++
contrib/seg/meson.build | 6 ++
contrib/sepgsql/meson.build | 6 ++
contrib/spi/meson.build | 48 ++++++++-
contrib/sslinfo/meson.build | 14 ++-
contrib/tablefunc/meson.build | 14 ++-
contrib/tcn/meson.build | 14 ++-
contrib/test_decoding/meson.build | 6 ++
contrib/tsm_system_rows/meson.build | 14 ++-
contrib/tsm_system_time/meson.build | 14 ++-
contrib/unaccent/meson.build | 14 ++-
contrib/uuid-ossp/meson.build | 14 ++-
contrib/vacuumlo/meson.build | 12 ++-
contrib/xml2/meson.build | 16 ++-
src/interfaces/ecpg/compatlib/meson.build | 6 ++
src/interfaces/ecpg/ecpglib/meson.build | 6 ++
src/interfaces/ecpg/pgtypeslib/meson.build | 6 ++
src/interfaces/ecpg/preproc/meson.build | 6 ++
src/interfaces/ecpg/test/meson.build | 5 +
src/test/isolation/meson.build | 13 +++
src/test/modules/delay_execution/meson.build | 13 ++-
src/test/modules/dummy_index_am/meson.build | 13 ++-
src/test/modules/dummy_seclabel/meson.build | 13 ++-
src/test/modules/libpq_pipeline/meson.build | 14 ++-
src/test/modules/plsample/meson.build | 13 ++-
src/test/modules/spgist_name_ops/meson.build | 13 ++-
.../ssl_passphrase_callback/meson.build | 13 ++-
src/test/modules/test_bloomfilter/meson.build | 13 ++-
src/test/modules/test_ddl_deparse/meson.build | 13 ++-
.../modules/test_ginpostinglist/meson.build | 13 ++-
src/test/modules/test_integerset/meson.build | 13 ++-
src/test/modules/test_lfind/meson.build | 13 ++-
src/test/modules/test_oat_hooks/meson.build | 13 ++-
src/test/modules/test_parser/meson.build | 13 ++-
src/test/modules/test_predtest/meson.build | 13 ++-
src/test/modules/test_rbtree/meson.build | 13 ++-
src/test/modules/test_regex/meson.build | 13 ++-
src/test/modules/test_rls_hooks/meson.build | 13 ++-
src/test/modules/test_shm_mq/meson.build | 19 +++-
src/test/modules/worker_spi/meson.build | 15 ++-
src/test/regress/meson.build | 6 ++
meson.build | 59 +++++++++++
src/timezone/meson.build | 6 ++
src/tools/rcgen | 99 +++++++++++++++++++
118 files changed, 1286 insertions(+), 130 deletions(-)
create mode 100755 src/tools/rcgen
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index de2e624ab58..5fb63768358 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -20,6 +20,12 @@ llvmjit_sources += files(
'llvmjit_expr.c',
)
+if host_system == 'windows'
+ llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'llvmjit',
+ '--FILEDESC', 'llvmjit - JIT using LLVM',])
+endif
+
llvmjit = shared_module('llvmjit',
llvmjit_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
index 3fc786c80a0..4c653a05d36 100644
--- a/src/backend/replication/libpqwalreceiver/meson.build
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -2,6 +2,12 @@ libpqwalreceiver_sources = files(
'libpqwalreceiver.c',
)
+if host_system == 'windows'
+ libpqwalreceiver_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pqwalreceiver',
+ '--FILEDESC', 'libpqwalreceiver - receive WAL during streaming replication',])
+endif
+
libpqwalreceiver = shared_module('pqwalreceiver',
libpqwalreceiver_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
index ab956361a62..5df27d7b764 100644
--- a/src/backend/replication/pgoutput/meson.build
+++ b/src/backend/replication/pgoutput/meson.build
@@ -2,6 +2,12 @@ pgoutput_sources = files(
'pgoutput.c',
)
+if host_system == 'windows'
+ pgoutput_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgoutput',
+ '--FILEDESC', 'pgoutput - standard logical replication output plugin',])
+endif
+
pgoutput = shared_module('pgoutput',
pgoutput_sources,
kwargs: pg_mod_args,
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 8c6f685cb32..974401d187e 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -58,6 +58,12 @@ dict_snowball_sources += files(
# see comment in src/include/snowball/header.h
stemmer_inc = include_directories('../../include/snowball')
+if host_system == 'windows'
+ dict_snowball_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_snowball',
+ '--FILEDESC', 'snowball - natural language stemmers',])
+endif
+
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
index 1bc971d1945..1c18f2ac85a 100644
--- a/src/backend/utils/mb/conversion_procs/meson.build
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -29,8 +29,15 @@ encodings = {
}
foreach encoding, sources : encodings
+ source_files = files(sources)
+
+ if host_system == 'windows'
+ source_files += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', encoding])
+ endif
+
backend_targets += shared_module(encoding,
- sources,
+ source_files,
kwargs: pg_mod_args,
)
endforeach
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
index 9f213274d2f..6ced9a31b80 100644
--- a/src/bin/initdb/meson.build
+++ b/src/bin/initdb/meson.build
@@ -7,6 +7,12 @@ initdb_sources += timezone_localtime_source
#fixme: reimplement libpq_pgport logic
+if host_system == 'windows'
+ initdb_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'initdb',
+ '--FILEDESC', 'initdb - initialize a new database cluster',])
+endif
+
initdb = executable('initdb',
initdb_sources,
include_directories: [timezone_inc],
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
index 8e197eba5f3..25f5e7a0948 100644
--- a/src/bin/pg_amcheck/meson.build
+++ b/src/bin/pg_amcheck/meson.build
@@ -1,7 +1,13 @@
pg_amcheck_sources = files(
- 'pg_amcheck.c'
+ 'pg_amcheck.c',
)
+if host_system == 'windows'
+ pg_amcheck_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_amcheck',
+ '--FILEDESC', 'pg_amcheck - detect corruption within database relations',])
+endif
+
pg_amcheck = executable('pg_amcheck',
pg_amcheck_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
index 87a0d980c4f..aaa2e76977f 100644
--- a/src/bin/pg_archivecleanup/meson.build
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -1,5 +1,15 @@
+pg_archivecleanup_sources = files(
+ 'pg_archivecleanup.c',
+)
+
+if host_system == 'windows'
+ pg_archivecleanup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_archivecleanup',
+ '--FILEDESC', 'pg_archivecleanup - cleans archive when used with streaming replication',])
+endif
+
pg_archivecleanup = executable('pg_archivecleanup',
- ['pg_archivecleanup.c'],
+ pg_archivecleanup_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
index d26fed9cd8a..2c934e0c26e 100644
--- a/src/bin/pg_basebackup/meson.build
+++ b/src/bin/pg_basebackup/meson.build
@@ -17,24 +17,56 @@ pg_basebackup_common = static_library('libpg_basebackup_common',
kwargs: internal_lib_args,
)
-pg_basebackup = executable('pg_basebackup',
+pg_basebackup_sources = files(
'pg_basebackup.c',
+)
+
+if host_system == 'windows'
+ pg_basebackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_basebackup',
+ '--FILEDESC', 'pg_basebackup - streaming WAL and backup receivers',])
+endif
+
+pg_basebackup = executable('pg_basebackup',
+ pg_basebackup_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_basebackup
-pg_receivewal = executable('pg_receivewal',
+
+pg_receivewal_sources = files(
'pg_receivewal.c',
+)
+
+if host_system == 'windows'
+ pg_receivewal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_receivewal',
+ '--FILEDESC', 'pg_receivewal - streaming WAL and backup receivers',])
+endif
+
+pg_receivewal = executable('pg_receivewal',
+ pg_receivewal_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_receivewal
-pg_recvlogical = executable('pg_recvlogical',
+
+pg_recvlogical_sources = files(
'pg_recvlogical.c',
+)
+
+if host_system == 'windows'
+ pg_recvlogical_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_recvlogical',
+ '--FILEDESC', 'pg_recvlogical - streaming WAL and backup receivers',])
+endif
+
+pg_recvlogical = executable('pg_recvlogical',
+ pg_recvlogical_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
index ee1f367bac3..d07ebc999b3 100644
--- a/src/bin/pg_checksums/meson.build
+++ b/src/bin/pg_checksums/meson.build
@@ -1,5 +1,15 @@
+pg_checksums_sources = files(
+ 'pg_checksums.c',
+)
+
+if host_system == 'windows'
+ pg_checksums_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_checksums',
+ '--FILEDESC', 'pg_checksums - verify data checksums in an offline cluster',])
+endif
+
pg_checksums = executable('pg_checksums',
- ['pg_checksums.c'],
+ pg_checksums_sources,
include_directories: [timezone_inc],
dependencies: [frontend_code],
kwargs: default_bin_args,
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
index 0ecbf2f9d28..4be2fdc84ae 100644
--- a/src/bin/pg_config/meson.build
+++ b/src/bin/pg_config/meson.build
@@ -1,5 +1,15 @@
+pg_config_sources = files(
+ 'pg_config.c',
+)
+
+if host_system == 'windows'
+ pg_config_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_config',
+ '--FILEDESC', 'pg_config - report configuration information',])
+endif
+
pg_config = executable('pg_config',
- ['pg_config.c'],
+ pg_config_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
index 557e672beb7..7fc239dbe65 100644
--- a/src/bin/pg_controldata/meson.build
+++ b/src/bin/pg_controldata/meson.build
@@ -1,5 +1,15 @@
+pg_controldata_sources = files(
+ 'pg_controldata.c',
+)
+
+if host_system == 'windows'
+ pg_controldata_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_controldata',
+ '--FILEDESC', 'pg_controldata - reads the data from pg_control',])
+endif
+
pg_controldata = executable('pg_controldata',
- ['pg_controldata.c'],
+ pg_controldata_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
index 6812e73e329..96f962fa762 100644
--- a/src/bin/pg_ctl/meson.build
+++ b/src/bin/pg_ctl/meson.build
@@ -1,5 +1,15 @@
+pg_ctl_sources = files(
+ 'pg_ctl.c',
+)
+
+if host_system == 'windows'
+ pg_ctl_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_ctl',
+ '--FILEDESC', 'pg_ctl - starts/stops/restarts the PostgreSQL server',])
+endif
+
pg_ctl = executable('pg_ctl',
- ['pg_ctl.c'],
+ pg_ctl_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 785ec094dbd..3527a25c288 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -24,6 +24,12 @@ pg_dump_sources = files(
'pg_dump_sort.c',
)
+if host_system == 'windows'
+ pg_dump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dump',
+ '--FILEDESC', 'pg_dump - backup one PostgreSQL database',])
+endif
+
pg_dump = executable('pg_dump',
pg_dump_sources,
link_with: [pg_dump_common],
@@ -37,6 +43,12 @@ pg_dumpall_sources = files(
'pg_dumpall.c',
)
+if host_system == 'windows'
+ pg_dumpall_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dumpall',
+ '--FILEDESC', 'pg_dumpall - backup PostgreSQL databases'])
+endif
+
pg_dumpall = executable('pg_dumpall',
pg_dumpall_sources,
link_with: [pg_dump_common],
@@ -50,6 +62,12 @@ pg_restore_sources = files(
'pg_restore.c',
)
+if host_system == 'windows'
+ pg_restore_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_restore',
+ '--FILEDESC', 'pg_restore - restore PostgreSQL databases'])
+endif
+
pg_restore = executable('pg_restore',
pg_restore_sources,
link_with: [pg_dump_common],
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
index 7c5de134ac0..d503db97b71 100644
--- a/src/bin/pg_resetwal/meson.build
+++ b/src/bin/pg_resetwal/meson.build
@@ -1,5 +1,15 @@
+pg_resetwal_sources = files(
+ 'pg_resetwal.c',
+)
+
+if host_system == 'windows'
+ pg_resetwal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_resetwal',
+ '--FILEDESC', 'pg_resetwal - reset PostgreSQL WAL log'])
+endif
+
pg_resetwal = executable('pg_resetwal',
- files('pg_resetwal.c'),
+ pg_resetwal_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
index d8ec9e482d5..6cd970909a2 100644
--- a/src/bin/pg_rewind/meson.build
+++ b/src/bin/pg_rewind/meson.build
@@ -11,6 +11,12 @@ pg_rewind_sources = files(
pg_rewind_sources += xlogreader_sources
+if host_system == 'windows'
+ pg_rewind_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_rewind',
+ '--FILEDESC', 'pg_rewind - synchronize a data directory with another one forked from'])
+endif
+
pg_rewind = executable('pg_rewind',
pg_rewind_sources,
dependencies: [frontend_code, libpq, lz4, zstd],
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
index 2c01831e11f..31d288ba6da 100644
--- a/src/bin/pg_test_fsync/meson.build
+++ b/src/bin/pg_test_fsync/meson.build
@@ -1,4 +1,12 @@
-test_fsync_sources = files('pg_test_fsync.c')
+test_fsync_sources = files(
+ 'pg_test_fsync.c',
+)
+
+if host_system == 'windows'
+ test_fsync_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_fsync',
+ '--FILEDESC', 'pg_test_fsync - test various disk sync methods'])
+endif
pg_test_fsync = executable('pg_test_fsync',
test_fsync_sources,
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
index 0a3068f1657..0aed03ea32f 100644
--- a/src/bin/pg_test_timing/meson.build
+++ b/src/bin/pg_test_timing/meson.build
@@ -1,5 +1,15 @@
+pg_test_timing_sources = files(
+ 'pg_test_timing.c'
+)
+
+if host_system == 'windows'
+ pg_test_timing_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_timing',
+ '--FILEDESC', 'pg_test_timing - test timing overhead'])
+endif
+
pg_test_timing = executable('pg_test_timing',
- ['pg_test_timing.c'],
+ pg_test_timing_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index 02f030e0ccf..a7b927a45c7 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -16,6 +16,12 @@ pg_upgrade_sources = files(
'version.c',
)
+if host_system == 'windows'
+ pg_upgrade_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_upgrade',
+ '--FILEDESC', 'pg_upgrade - an in-place binary upgrade utility'])
+endif
+
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
index 4c3b2bb5f97..b934a408443 100644
--- a/src/bin/pg_verifybackup/meson.build
+++ b/src/bin/pg_verifybackup/meson.build
@@ -3,6 +3,12 @@ pg_verifybackup_sources = files(
'pg_verifybackup.c'
)
+if host_system == 'windows'
+ pg_verifybackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_verifybackup',
+ '--FILEDESC', 'pg_verifybackup - verify a backup against using a backup manifest'])
+endif
+
pg_verifybackup = executable('pg_verifybackup',
pg_verifybackup_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index 95872652ffd..9605976870d 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -8,6 +8,12 @@ pg_waldump_sources += rmgr_desc_sources
pg_waldump_sources += xlogreader_sources
pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+if host_system == 'windows'
+ pg_waldump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_waldump',
+ '--FILEDESC', 'pg_waldump - decode and display WA'])
+endif
+
pg_waldump = executable('pg_waldump',
pg_waldump_sources,
dependencies: [frontend_code, lz4, zstd],
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index 6564e54029c..a32eb51fe07 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -17,6 +17,12 @@ exprparse = custom_target('exprparse',
generated_sources += exprparse.to_list()
pgbench_sources += exprparse
+if host_system == 'windows'
+ pgbench_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgbench',
+ '--FILEDESC', 'pgbench - a simple program for running benchmark tests'])
+endif
+
pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
index 7a468879fd2..2e9aea4b0e1 100644
--- a/src/bin/pgevent/meson.build
+++ b/src/bin/pgevent/meson.build
@@ -6,6 +6,12 @@ pgevent_sources = files(
'pgevent.c',
)
+pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgevent',
+ '--FILEDESC', 'Eventlog message formatter',])
+
+pgevent_sources += windows.compile_resources('pgmsgevent.rc')
+
# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
pgevent_link_args = []
if cc.get_id() == 'msvc'
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 410788e4767..1264fc19fbd 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -36,6 +36,12 @@ sql_help = custom_target('psql_help',
generated_sources += sql_help.to_list()
psql_sources += sql_help
+if host_system == 'windows'
+ psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'psql',
+ '--FILEDESC', 'psql - the PostgreSQL interactive terminal',])
+endif
+
psql = executable('psql',
psql_sources,
include_directories: include_directories('.'),
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
index eaf250c7f73..837562c24e5 100644
--- a/src/bin/scripts/meson.build
+++ b/src/bin/scripts/meson.build
@@ -16,8 +16,16 @@ binaries = [
]
foreach binary : binaries
+ binary_sources = files('@0@.c'.format(binary))
+
+ if host_system == 'windows'
+ binary_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', binary,
+ '--FILEDESC', '@0@ - PostgreSQL utility'.format(binary),])
+ endif
+
binary = executable(binary,
- files(binary + '.c'),
+ binary_sources,
link_with: [scripts_common],
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index c203372a35b..63ab2fbacc2 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -16,9 +16,13 @@ libpq_sources = files(
'libpq-events.c',
'pqexpbuffer.c',
)
+libpq_so_sources = [] # only for shared lib, in addition to above
if host_system == 'windows'
libpq_sources += files('pthread-win32.c', 'win32.c')
+ libpq_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq',
+ '--FILEDESC', 'PostgreSQL Access Library',])
endif
if ssl.found()
@@ -52,6 +56,7 @@ libpq_st = static_library('libpq',
# not using both_libraries() here as the resource file should only be in the
# shared library
libpq_so = shared_library('libpq',
+ libpq_so_sources,
dependencies: libpq_deps,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
index 16f94c1ed8b..017f729d435 100644
--- a/src/interfaces/libpq/test/meson.build
+++ b/src/interfaces/libpq/test/meson.build
@@ -1,13 +1,34 @@
+libpq_uri_regress_sources = files(
+ 'libpq_uri_regress.c',
+)
+
+if host_system == 'windows'
+ libpq_uri_regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_uri_regress',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_uri_regress',
- files('libpq_uri_regress.c'),
+ libpq_uri_regress_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
}
)
+
+libpq_testclient_sources = files(
+ 'libpq_testclient.c',
+)
+
+if host_system == 'windows'
+ libpq_testclient_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_testclient',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_testclient',
- files('libpq_testclient.c'),
+ libpq_testclient_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 73b733dd50b..535660085dd 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -36,6 +36,13 @@ foreach n : ['SPI', 'Util']
endforeach
plperl_inc = include_directories('.')
+
+if host_system == 'windows'
+ plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plperl',
+ '--FILEDESC', 'PL/Perl - procedural language',])
+endif
+
plperl = shared_module('plperl',
plperl_sources,
include_directories: [plperl_inc, postgres_inc],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index dd499fdd151..c46c0a1da2a 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -40,6 +40,12 @@ pl_unreserved = custom_target('pl_unreserved_kwlist',
generated_sources += pl_unreserved
plpgsql_sources += pl_unreserved
+if host_system == 'windows'
+ plpgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpgsql',
+ '--FILEDESC', 'PL/pgSQL - procedural language',])
+endif
+
plpgsql = shared_module('plpgsql',
plpgsql_sources,
include_directories: include_directories('.'),
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 366b3b171ac..40888386b5f 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -28,6 +28,12 @@ plpython_sources += custom_target('spiexceptions.h',
# FIXME: need to duplicate import library ugliness?
plpython_inc = include_directories('.')
+if host_system == 'windows'
+ plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpython3',
+ '--FILEDESC', 'PL/Python - procedural language',])
+endif
+
plpython = shared_module('plpython3',
plpython_sources,
include_directories: [plpython_inc, postgres_inc],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index 9b6addd7fd5..f09bb14c950 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -14,6 +14,12 @@ pltcl_sources += custom_target('pltclerrcodes.h',
command: [perl, gen_pltclerrcodes, '@INPUT@']
)
+if host_system == 'windows'
+ pltcl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pltcl',
+ '--FILEDESC', 'PL/Tcl - procedural language',])
+endif
+
pltcl = shared_module('pltcl',
pltcl_sources,
include_directories: [include_directories('.'), postgres_inc],
diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build
index fc2368d02cf..7efec0efbc0 100644
--- a/contrib/adminpack/meson.build
+++ b/contrib/adminpack/meson.build
@@ -1,5 +1,15 @@
+adminpack_sources = files(
+ 'adminpack.c',
+)
+
+if host_system == 'windows'
+ adminpack_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'adminpack',
+ '--FILEDESC', 'adminpack - support functions for pgAdmin',])
+endif
+
adminpack = shared_module('adminpack',
- ['adminpack.c'],
+ adminpack_sources,
kwargs: contrib_mod_args,
)
contrib_targets += adminpack
diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build
index 1db3d20349e..fa807b72d98 100644
--- a/contrib/amcheck/meson.build
+++ b/contrib/amcheck/meson.build
@@ -1,7 +1,16 @@
-amcheck = shared_module('amcheck', [
- 'verify_heapam.c',
- 'verify_nbtree.c',
- ],
+amcheck_sources = files(
+ 'verify_heapam.c',
+ 'verify_nbtree.c',
+)
+
+if host_system == 'windows'
+ amcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'amcheck',
+ '--FILEDESC', 'amcheck - function for verifying relation integrity',])
+endif
+
+amcheck = shared_module('amcheck',
+ amcheck_sources,
kwargs: contrib_mod_args,
)
contrib_targets += amcheck
diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build
index d2e01968f54..c4ffb0663bc 100644
--- a/contrib/auth_delay/meson.build
+++ b/contrib/auth_delay/meson.build
@@ -1,5 +1,15 @@
+auth_delay_sources = files(
+ 'auth_delay.c',
+)
+
+if host_system == 'windows'
+ auth_delay_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auth_delay',
+ '--FILEDESC', 'auth_delay - delay authentication failure reports',])
+endif
+
autoinc = shared_module('auth_delay',
- ['auth_delay.c'],
+ auth_delay_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build
index 249a8376faa..76f86617850 100644
--- a/contrib/auto_explain/meson.build
+++ b/contrib/auto_explain/meson.build
@@ -1,5 +1,15 @@
+auto_explain_sources = files(
+ 'auto_explain.c',
+)
+
+if host_system == 'windows'
+ auto_explain_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auto_explain',
+ '--FILEDESC', 'auto_explain - logging facility for execution plans',])
+endif
+
auto_explain = shared_module('auto_explain',
- files('auto_explain.c'),
+ auto_explain_sources,
kwargs: contrib_mod_args,
)
contrib_targets += auto_explain
diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build
index 9f0517f1701..3a389de9175 100644
--- a/contrib/basebackup_to_shell/meson.build
+++ b/contrib/basebackup_to_shell/meson.build
@@ -2,6 +2,12 @@ basebackup_to_shell_sources = files(
'basebackup_to_shell.c',
)
+if host_system == 'windows'
+ basebackup_to_shell_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basebackup_to_shell',
+ '--FILEDESC', 'basebackup_to_shell - target basebackup to shell command',])
+endif
+
basebackup_to_shell = shared_module('basebackup_to_shell',
basebackup_to_shell_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index b67cbef60bd..c30dcfa5d41 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -2,6 +2,12 @@ basic_archive_sources = files(
'basic_archive.c',
)
+if host_system == 'windows'
+ basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basic_archive',
+ '--FILEDESC', 'basic_archive - basic archive module',])
+endif
+
basic_archive = shared_module('basic_archive',
basic_archive_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 1fe7632bdbe..16f3b83e4d2 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -7,6 +7,12 @@ bloom_sources = files(
'blvalidate.c',
)
+if host_system == 'windows'
+ bloom_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bloom',
+ '--FILEDESC', 'bloom access method - signature file based index',])
+endif
+
bloom = shared_module('bloom',
bloom_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build
index c20b667d75f..a68daab0dcd 100644
--- a/contrib/bool_plperl/meson.build
+++ b/contrib/bool_plperl/meson.build
@@ -6,6 +6,12 @@ bool_plperl_sources = files(
'bool_plperl.c',
)
+if host_system == 'windows'
+ bool_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bool_plperl',
+ '--FILEDESC', 'bool_plperl - bool transform for plperl',])
+endif
+
bool_plperl = shared_module('bool_plperl',
bool_plperl_sources,
include_directories: [plperl_inc, include_directories('.')],
diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build
index 15d6d31a6ee..fd4c76767a7 100644
--- a/contrib/btree_gin/meson.build
+++ b/contrib/btree_gin/meson.build
@@ -1,5 +1,15 @@
+btree_gin_sources = files(
+ 'btree_gin.c',
+)
+
+if host_system == 'windows'
+ btree_gin_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gin',
+ '--FILEDESC', 'btree_gin - B-tree equivalent GIN operator classes',])
+endif
+
btree_gin = shared_module('btree_gin',
- files('btree_gin.c'),
+ btree_gin_sources,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gin
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index c0a8d238540..e98c91dacc8 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -25,6 +25,12 @@ btree_gist_sources = files(
'btree_uuid.c',
)
+if host_system == 'windows'
+ btree_gist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gist',
+ '--FILEDESC', 'btree_gist - B-tree equivalent GiST operator classes',])
+endif
+
btree_gist = shared_module('btree_gist',
btree_gist_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build
index ca60eded80b..26a101a19bd 100644
--- a/contrib/citext/meson.build
+++ b/contrib/citext/meson.build
@@ -2,6 +2,12 @@ citext_sources = files(
'citext.c',
)
+if host_system == 'windows'
+ citext_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'citext',
+ '--FILEDESC', 'citext - case-insensitive character string data type',])
+endif
+
citext = shared_module('citext',
citext_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
index 72342b0c82c..041acf95a90 100644
--- a/contrib/cube/meson.build
+++ b/contrib/cube/meson.build
@@ -17,6 +17,12 @@ cube_parse = custom_target('cubeparse',
generated_sources += cube_parse.to_list()
cube_sources += cube_parse
+if host_system == 'windows'
+ cube_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'cube',
+ '--FILEDESC', 'cube - multidimensional cube data type',])
+endif
+
cube = shared_module('cube',
cube_sources,
include_directories: include_directories('.'),
diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
index d35f7b5d49e..66eeb03b736 100644
--- a/contrib/dblink/meson.build
+++ b/contrib/dblink/meson.build
@@ -2,6 +2,12 @@ dblink_sources = files(
'dblink.c',
)
+if host_system == 'windows'
+ dblink_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dblink',
+ '--FILEDESC', 'dblink - connect to other PostgreSQL databases',])
+endif
+
dblink = shared_module('dblink',
dblink_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build
index f00e8085619..6fff921adda 100644
--- a/contrib/dict_int/meson.build
+++ b/contrib/dict_int/meson.build
@@ -1,5 +1,15 @@
+dict_int_sources = files(
+ 'dict_int.c',
+)
+
+if host_system == 'windows'
+ dict_int_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_int',
+ '--FILEDESC', 'dict_int - add-on dictionary template for full-text search',])
+endif
+
dict_int = shared_module('dict_int',
- files('dict_int.c'),
+ dict_int_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_int
diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build
index be53f55bb79..fabd505a7df 100644
--- a/contrib/dict_xsyn/meson.build
+++ b/contrib/dict_xsyn/meson.build
@@ -1,5 +1,15 @@
+dict_xsyn_sources = files(
+ 'dict_xsyn.c',
+)
+
+if host_system == 'windows'
+ dict_xsyn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_xsyn',
+ '--FILEDESC', 'dict_xsyn - add-on dictionary template for full-text search',])
+endif
+
dict_xsyn = shared_module('dict_xsyn',
- files('dict_xsyn.c'),
+ dict_xsyn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_xsyn
diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build
index 807f5cb7de3..78dc29c3da3 100644
--- a/contrib/earthdistance/meson.build
+++ b/contrib/earthdistance/meson.build
@@ -1,5 +1,15 @@
+earthdistance_sources = files(
+ 'earthdistance.c',
+)
+
+if host_system == 'windows'
+ earthdistance_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'earthdistance',
+ '--FILEDESC', 'earthdistance - calculate distances on the surface of the Earth',])
+endif
+
earthdistance = shared_module('earthdistance',
- files('earthdistance.c'),
+ earthdistance_sources,
kwargs: contrib_mod_args,
)
contrib_targets += earthdistance
diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build
index f13efb6e38e..c4071faa669 100644
--- a/contrib/file_fdw/meson.build
+++ b/contrib/file_fdw/meson.build
@@ -1,5 +1,15 @@
+file_fdw_sources = files(
+ 'file_fdw.c',
+)
+
+if host_system == 'windows'
+ file_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'file_fdw',
+ '--FILEDESC', 'file_fdw - foreign data wrapper for files',])
+endif
+
file_fdw = shared_module('file_fdw',
- files('file_fdw.c'),
+ file_fdw_sources,
kwargs: contrib_mod_args,
)
contrib_targets += file_fdw
diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build
index ec278a6211e..e6d06149cec 100644
--- a/contrib/fuzzystrmatch/meson.build
+++ b/contrib/fuzzystrmatch/meson.build
@@ -1,8 +1,16 @@
+fuzzystrmatch_sources = files(
+ 'fuzzystrmatch.c',
+ 'dmetaphone.c',
+)
+
+if host_system == 'windows'
+ fuzzystrmatch_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'fuzzystrmatch',
+ '--FILEDESC', 'fuzzystrmatch - similarities and distance between strings',])
+endif
+
fuzzystrmatch = shared_module('fuzzystrmatch',
- files(
- 'fuzzystrmatch.c',
- 'dmetaphone.c'
- ),
+ fuzzystrmatch_sources,
kwargs: contrib_mod_args,
)
contrib_targets += fuzzystrmatch
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 07c59f40a97..2bb26bb772b 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -1,15 +1,23 @@
# .. so that includes of hstore/hstore.h work
hstore_inc = include_directories('.', '../')
+hstore_sources = files(
+ 'hstore_compat.c',
+ 'hstore_gin.c',
+ 'hstore_gist.c',
+ 'hstore_io.c',
+ 'hstore_op.c',
+ 'hstore_subs.c',
+)
+
+if host_system == 'windows'
+ hstore_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore',
+ '--FILEDESC', 'hstore - key/value pair data type',])
+endif
+
hstore = shared_module('hstore',
- files(
- 'hstore_compat.c',
- 'hstore_gin.c',
- 'hstore_gist.c',
- 'hstore_io.c',
- 'hstore_op.c',
- 'hstore_subs.c',
- ),
+ hstore_sources,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build
index bbafa0221bd..a238fee6a26 100644
--- a/contrib/hstore_plperl/meson.build
+++ b/contrib/hstore_plperl/meson.build
@@ -6,6 +6,12 @@ hstore_plperl_sources = files(
'hstore_plperl.c',
)
+if host_system == 'windows'
+ hstore_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plperl',
+ '--FILEDESC', 'hstore_plperl - hstore transform for plperl',])
+endif
+
hstore_plperl = shared_module('hstore_plperl',
hstore_plperl_sources,
include_directories: [plperl_inc, hstore_inc],
diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build
index 214b48519a9..6071aaeb4b3 100644
--- a/contrib/hstore_plpython/meson.build
+++ b/contrib/hstore_plpython/meson.build
@@ -6,6 +6,12 @@ hstore_plpython_sources = files(
'hstore_plpython.c',
)
+if host_system == 'windows'
+ hstore_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plpython3',
+ '--FILEDESC', 'hstore_plpython - hstore transform for plpython',])
+endif
+
hstore_plpython = shared_module('hstore_plpython3',
hstore_plpython_sources,
include_directories: [plpython_inc, hstore_inc, ],
diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build
index 1655bcbb3fd..b7cf1ce0cad 100644
--- a/contrib/intarray/meson.build
+++ b/contrib/intarray/meson.build
@@ -8,6 +8,12 @@ intarray_sources = files(
'_intbig_gist.c',
)
+if host_system == 'windows'
+ intarray_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', '_int',
+ '--FILEDESC', 'intarray - functions and operators for arrays of integers',])
+endif
+
intarray = shared_module('_int',
intarray_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
index cc30bbeb55c..db68a718313 100644
--- a/contrib/isn/meson.build
+++ b/contrib/isn/meson.build
@@ -2,6 +2,12 @@ isn_sources = files(
'isn.c',
)
+if host_system == 'windows'
+ isn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isn',
+ '--FILEDESC', 'isn - data types for international product numbering standards',])
+endif
+
isn = shared_module('isn',
isn_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build
index 5c915d8ed94..071a7a98d2c 100644
--- a/contrib/jsonb_plperl/meson.build
+++ b/contrib/jsonb_plperl/meson.build
@@ -6,6 +6,12 @@ jsonb_plperl_sources = files(
'jsonb_plperl.c',
)
+if host_system == 'windows'
+ jsonb_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plperl',
+ '--FILEDESC', 'jsonb_plperl - jsonb transform for plperl',])
+endif
+
jsonb_plperl = shared_module('jsonb_plperl',
jsonb_plperl_sources,
include_directories: [plperl_inc],
diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build
index de8e1105c6a..84dc1161e8b 100644
--- a/contrib/jsonb_plpython/meson.build
+++ b/contrib/jsonb_plpython/meson.build
@@ -6,6 +6,12 @@ jsonb_plpython_sources = files(
'jsonb_plpython.c',
)
+if host_system == 'windows'
+ jsonb_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plpython3',
+ '--FILEDESC', 'jsonb_plpython - jsonb transform for plpython',])
+endif
+
jsonb_plpython = shared_module('jsonb_plpython3',
jsonb_plpython_sources,
include_directories: [plpython_inc],
diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build
index 9082d5713c7..61ae131f1cc 100644
--- a/contrib/lo/meson.build
+++ b/contrib/lo/meson.build
@@ -2,6 +2,12 @@ lo_sources = files(
'lo.c',
)
+if host_system == 'windows'
+ lo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'lo',
+ '--FILEDESC', 'lo - management for large objects',])
+endif
+
lo = shared_module('lo',
lo_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
index 9463fc2c5e5..421292cea9d 100644
--- a/contrib/ltree/meson.build
+++ b/contrib/ltree/meson.build
@@ -13,6 +13,12 @@ ltree_sources = files(
# .. so that includes of ltree/ltree.h work
ltree_inc = include_directories('.', '../')
+if host_system == 'windows'
+ ltree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree',
+ '--FILEDESC', 'ltree - hierarchical label data type',])
+endif
+
ltree = shared_module('ltree',
ltree_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build
index 429d75006aa..acf5e4a6fc8 100644
--- a/contrib/ltree_plpython/meson.build
+++ b/contrib/ltree_plpython/meson.build
@@ -6,6 +6,12 @@ ltree_plpython_sources = files(
'ltree_plpython.c',
)
+if host_system == 'windows'
+ ltree_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree_plpython3',
+ '--FILEDESC', 'ltree_plpython - ltree transform for plpython',])
+endif
+
ltree_plpython = shared_module('ltree_plpython3',
ltree_plpython_sources,
include_directories: [plpython_inc, ltree_inc],
diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build
index 1dad5d8f6e7..1a248f19260 100644
--- a/contrib/oid2name/meson.build
+++ b/contrib/oid2name/meson.build
@@ -1,5 +1,15 @@
+oid2name_sources = files(
+ 'oid2name.c',
+)
+
+if host_system == 'windows'
+ oid2name_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'oid2name',
+ '--FILEDESC', 'oid2name - examine the file structure',])
+endif
+
oid2name = executable('oid2name',
- ['oid2name.c'],
+ oid2name_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build
index 8e7ee09a43a..77276c3715a 100644
--- a/contrib/old_snapshot/meson.build
+++ b/contrib/old_snapshot/meson.build
@@ -2,6 +2,12 @@ old_snapshot_sources = files(
'time_mapping.c',
)
+if host_system == 'windows'
+ old_snapshot_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'old_snapshot',
+ '--FILEDESC', 'old_snapshot - utilities in support of old_snapshot_threshold',])
+endif
+
old_snapshot = shared_module('old_snapshot',
old_snapshot_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
index 4af8153e4fd..3ec50b9445e 100644
--- a/contrib/pageinspect/meson.build
+++ b/contrib/pageinspect/meson.build
@@ -9,6 +9,12 @@ pageinspect_sources = files(
'rawpage.c',
)
+if host_system == 'windows'
+ pageinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pageinspect',
+ '--FILEDESC', 'pageinspect - functions to inspect contents of database pages',])
+endif
+
pageinspect = shared_module('pageinspect',
pageinspect_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build
index 7da47d02f1d..383d7df372a 100644
--- a/contrib/passwordcheck/meson.build
+++ b/contrib/passwordcheck/meson.build
@@ -9,6 +9,12 @@ passwordcheck_deps = []
# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
# passwordcheck_deps += [cc.find_library('crack')]
+if host_system == 'windows'
+ passwordcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'passwordcheck',
+ '--FILEDESC', 'passwordcheck - strengthen user password checks',])
+endif
+
passwordcheck = shared_module('passwordcheck',
passwordcheck_sources,
c_args: passwordcheck_c_args,
diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build
index 2c69eae3ea2..dd9948e5f0b 100644
--- a/contrib/pg_buffercache/meson.build
+++ b/contrib/pg_buffercache/meson.build
@@ -1,7 +1,15 @@
+pg_buffercache_sources = files(
+ 'pg_buffercache_pages.c',
+)
+
+if host_system == 'windows'
+ pg_buffercache_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_buffercache',
+ '--FILEDESC', 'pg_buffercache - monitoring of shared buffer cache in real-time',])
+endif
+
pg_buffercache = shared_module('pg_buffercache',
- files(
- 'pg_buffercache_pages.c',
- ),
+ pg_buffercache_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_buffercache
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index f795014d7ca..904b37b6e9b 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -1,7 +1,15 @@
+pg_freespacemap_sources = files(
+ 'pg_freespacemap.c',
+)
+
+if host_system == 'windows'
+ pg_freespacemap_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_freespacemap',
+ '--FILEDESC', 'pg_freespacemap - monitoring of free space map',])
+endif
+
pg_freespacemap = shared_module('pg_freespacemap',
- files(
- 'pg_freespacemap.c',
- ),
+ pg_freespacemap_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_freespacemap
diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build
index bdca9af4f27..b7140cee34b 100644
--- a/contrib/pg_prewarm/meson.build
+++ b/contrib/pg_prewarm/meson.build
@@ -1,8 +1,16 @@
+pg_prewarm_sources = files(
+ 'autoprewarm.c',
+ 'pg_prewarm.c',
+)
+
+if host_system == 'windows'
+ pg_prewarm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_prewarm',
+ '--FILEDESC', 'pg_prewarm - preload relation data into system buffer cache',])
+endif
+
pg_prewarm = shared_module('pg_prewarm',
- files(
- 'autoprewarm.c',
- 'pg_prewarm.c',
- ),
+ pg_prewarm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_prewarm
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index ac117d2fc1d..854df138e76 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -1,5 +1,15 @@
+pg_stat_statements_sources = files(
+ 'pg_stat_statements.c',
+)
+
+if host_system == 'windows'
+ pg_stat_statements_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_stat_statements',
+ '--FILEDESC', 'pg_stat_statements - execution statistics of SQL statements',])
+endif
+
pg_stat_statements = shared_module('pg_stat_statements',
- files('pg_stat_statements.c'),
+ pg_stat_statements_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build
index ac71caa5276..7b5c5999f4b 100644
--- a/contrib/pg_surgery/meson.build
+++ b/contrib/pg_surgery/meson.build
@@ -1,7 +1,15 @@
+pg_surgery_sources = files(
+ 'heap_surgery.c',
+)
+
+if host_system == 'windows'
+ pg_surgery_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_surgery',
+ '--FILEDESC', 'pg_surgery - perform surgery on a damaged relation',])
+endif
+
pg_surgery = shared_module('pg_surgery',
- files(
- 'heap_surgery.c',
- ),
+ pg_surgery_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_surgery
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index a90628d23c6..c8c7c07b308 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -1,10 +1,18 @@
+pg_trgm_sources = files(
+ 'trgm_gin.c',
+ 'trgm_gist.c',
+ 'trgm_op.c',
+ 'trgm_regexp.c',
+)
+
+if host_system == 'windows'
+ pg_trgm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_trgm',
+ '--FILEDESC', 'pg_trgm - trigram matching',])
+endif
+
pg_trgm = shared_module('pg_trgm',
- files(
- 'trgm_gin.c',
- 'trgm_gist.c',
- 'trgm_op.c',
- 'trgm_regexp.c',
- ),
+ pg_trgm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build
index 933dc99ac4d..263a0d08b82 100644
--- a/contrib/pg_visibility/meson.build
+++ b/contrib/pg_visibility/meson.build
@@ -1,7 +1,15 @@
+pg_visibility_sources = files(
+ 'pg_visibility.c',
+)
+
+if host_system == 'windows'
+ pg_visibility_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_visibility',
+ '--FILEDESC', 'pg_visibility - page visibility information',])
+endif
+
pg_visibility = shared_module('pg_visibility',
- files(
- 'pg_visibility.c',
- ),
+ pg_visibility_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_visibility
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index d6b27877dd0..4314a3182a2 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -1,5 +1,11 @@
pg_walinspect_sources = files('pg_walinspect.c')
+if host_system == 'windows'
+ pg_walinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_walinspect',
+ '--FILEDESC', 'pg_walinspect - functions to inspect contents of PostgreSQL Write-Ahead Log',])
+endif
+
pg_walinspect = shared_module('pg_walinspect',
pg_walinspect_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index fe0851bf8e8..7fc7bbc7ca1 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -69,6 +69,12 @@ else
pgcrypto_regress += 'pgp-zlib-DISABLED'
endif
+if host_system == 'windows'
+ pgcrypto_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgcrypto',
+ '--FILEDESC', 'pgcrypto - cryptographic functions',])
+endif
+
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build
index 1b41691a2a3..8092f0d4a64 100644
--- a/contrib/pgrowlocks/meson.build
+++ b/contrib/pgrowlocks/meson.build
@@ -1,7 +1,15 @@
+pgrowlocks_sources = files(
+ 'pgrowlocks.c',
+)
+
+if host_system == 'windows'
+ pgrowlocks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgrowlocks',
+ '--FILEDESC', 'pgrowlocks - display row locking information',])
+endif
+
pgrowlocks = shared_module('pgrowlocks',
- files(
- 'pgrowlocks.c',
- ),
+ pgrowlocks_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgrowlocks
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 8e828692d5c..05e4cd46a5c 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -1,9 +1,17 @@
+pgstattuple_sources = files(
+ 'pgstatapprox.c',
+ 'pgstatindex.c',
+ 'pgstattuple.c',
+)
+
+if host_system == 'windows'
+ pgstattuple_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgstattuple',
+ '--FILEDESC', 'pgstattuple - tuple-level statistics',])
+endif
+
pgstattuple = shared_module('pgstattuple',
- files(
- 'pgstatapprox.c',
- 'pgstatindex.c',
- 'pgstattuple.c',
- ),
+ pgstattuple_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
index 378885ec93b..d3746ff135c 100644
--- a/contrib/postgres_fdw/meson.build
+++ b/contrib/postgres_fdw/meson.build
@@ -6,6 +6,12 @@ postgres_fdw_sources = files(
'shippable.c',
)
+if host_system == 'windows'
+ postgres_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'postgres_fdw',
+ '--FILEDESC', 'postgres_fdw - foreign data wrapper for PostgreSQL',])
+endif
+
postgres_fdw = shared_module('postgres_fdw',
postgres_fdw_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
index e476eab2a77..c6fbb22999b 100644
--- a/contrib/seg/meson.build
+++ b/contrib/seg/meson.build
@@ -17,6 +17,12 @@ seg_parse = custom_target('segparse',
generated_sources += seg_parse.to_list()
seg_sources += seg_parse
+if host_system == 'windows'
+ seg_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'seg',
+ '--FILEDESC', 'seg - line segment data type',])
+endif
+
seg = shared_module('seg',
seg_sources,
include_directories: include_directories('.'),
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 60a95e17c2f..8bef239e3c2 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -14,6 +14,12 @@ sepgsql_sources = files(
'uavc.c',
)
+if host_system == 'windows'
+ sepgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sepgsql',
+ '--FILEDESC', 'sepgsql - SELinux integration',])
+endif
+
sepgsql = shared_module('sepgsql',
sepgsql_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
index 98008980ec2..e7d78189ef5 100644
--- a/contrib/spi/meson.build
+++ b/contrib/spi/meson.build
@@ -1,5 +1,15 @@
+autoinc_sources = files(
+ 'autoinc.c',
+)
+
+if host_system == 'windows'
+ autoinc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'autoinc',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
autoinc = shared_module('autoinc',
- ['autoinc.c'],
+ autoinc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
@@ -9,8 +19,18 @@ install_data('autoinc.control', 'autoinc--1.0.sql',
)
+insert_username_sources = files(
+ 'insert_username.c',
+)
+
+if host_system == 'windows'
+ insert_username_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'insert_username',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
insert_username = shared_module('insert_username',
- ['insert_username.c'],
+ insert_username_sources,
kwargs: contrib_mod_args,
)
contrib_targets += insert_username
@@ -22,8 +42,18 @@ install_data(
)
+moddatetime_sources = files(
+ 'moddatetime.c',
+)
+
+if host_system == 'windows'
+ moddatetime_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'moddatetime',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
moddatetime = shared_module('moddatetime',
- ['moddatetime.c'],
+ moddatetime_sources,
kwargs: contrib_mod_args,
)
contrib_targets += moddatetime
@@ -38,8 +68,18 @@ install_data(
# comment out if you want a quieter refint package for other uses
refint_cflags = ['-DREFINT_VERBOSE']
+refint_sources = files(
+ 'refint.c',
+)
+
+if host_system == 'windows'
+ refint_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'refint',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
refint = shared_module('refint',
- ['refint.c'],
+ refint_sources,
c_args: refint_cflags,
kwargs: contrib_mod_args,
)
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
index 53f752a08ac..136983e783d 100644
--- a/contrib/sslinfo/meson.build
+++ b/contrib/sslinfo/meson.build
@@ -2,10 +2,18 @@ if not ssl.found()
subdir_done()
endif
+sslinfo_sources = files(
+ 'sslinfo.c',
+)
+
+if host_system == 'windows'
+ sslinfo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sslinfo',
+ '--FILEDESC', 'sslinfo - information about client SSL certificate',])
+endif
+
sslinfo = shared_module('sslinfo',
- files(
- 'sslinfo.c',
- ),
+ sslinfo_sources,
kwargs: contrib_mod_args + {
'dependencies': [ssl, contrib_mod_args['dependencies']],
}
diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build
index f4230096c0c..d2ddc8d3b39 100644
--- a/contrib/tablefunc/meson.build
+++ b/contrib/tablefunc/meson.build
@@ -1,7 +1,15 @@
+tablefunc_sources = files(
+ 'tablefunc.c',
+)
+
+if host_system == 'windows'
+ tablefunc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tablefunc',
+ '--FILEDESC', 'tablefunc - various functions that return tables',])
+endif
+
tablefunc = shared_module('tablefunc',
- files(
- 'tablefunc.c',
- ),
+ tablefunc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tablefunc
diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build
index c3a025247d4..71261c3b0a2 100644
--- a/contrib/tcn/meson.build
+++ b/contrib/tcn/meson.build
@@ -1,7 +1,15 @@
+tcn_sources = files(
+ 'tcn.c',
+)
+
+if host_system == 'windows'
+ tcn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tcn',
+ '--FILEDESC', 'tcn - trigger function notifying listeners',])
+endif
+
tcn = shared_module('tcn',
- files(
- 'tcn.c',
- ),
+ tcn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tcn
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index dd7cb0101ad..6376103c689 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -2,6 +2,12 @@ test_decoding_sources = files(
'test_decoding.c',
)
+if host_system == 'windows'
+ test_decoding_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_decoding',
+ '--FILEDESC', 'test_decoding - example of a logical decoding output plugin',])
+endif
+
test_decoding = shared_module('test_decoding',
test_decoding_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build
index b9cd42115a8..380abb49883 100644
--- a/contrib/tsm_system_rows/meson.build
+++ b/contrib/tsm_system_rows/meson.build
@@ -1,7 +1,15 @@
+tsm_system_rows_sources = files(
+ 'tsm_system_rows.c',
+)
+
+if host_system == 'windows'
+ tsm_system_rows_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_rows',
+ '--FILEDESC', 'tsm_system_rows - TABLESAMPLE method which accepts number of rows as a limit',])
+endif
+
tsm_system_rows = shared_module('tsm_system_rows',
- files(
- 'tsm_system_rows.c',
- ),
+ tsm_system_rows_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_rows
diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build
index 18015912ffb..e57a2702c60 100644
--- a/contrib/tsm_system_time/meson.build
+++ b/contrib/tsm_system_time/meson.build
@@ -1,7 +1,15 @@
+tsm_system_time_sources = files(
+ 'tsm_system_time.c',
+)
+
+if host_system == 'windows'
+ tsm_system_time_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_time',
+ '--FILEDESC', 'tsm_system_time - TABLESAMPLE method which accepts time in milliseconds as a limit',])
+endif
+
tsm_system_time = shared_module('tsm_system_time',
- files(
- 'tsm_system_time.c',
- ),
+ tsm_system_time_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_time
diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build
index 872b76e3223..438035132f8 100644
--- a/contrib/unaccent/meson.build
+++ b/contrib/unaccent/meson.build
@@ -1,7 +1,15 @@
+unaccent_sources = files(
+ 'unaccent.c',
+)
+
+if host_system == 'windows'
+ unaccent_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'unaccent',
+ '--FILEDESC', 'unaccent - text search dictionary that removes accents',])
+endif
+
unaccent = shared_module('unaccent',
- files(
- 'unaccent.c',
- ),
+ unaccent_sources,
kwargs: contrib_mod_args,
)
contrib_targets += unaccent
diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build
index da6d1d75c12..28730f398f0 100644
--- a/contrib/uuid-ossp/meson.build
+++ b/contrib/uuid-ossp/meson.build
@@ -2,10 +2,18 @@ if not uuid.found()
subdir_done()
endif
+uuid_ossp_sources = files(
+ 'uuid-ossp.c',
+)
+
+if host_system == 'windows'
+ uuid_ossp_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'uuid-ossp',
+ '--FILEDESC', 'uuid-ossp - UUID generation',])
+endif
+
uuid_ossp = shared_module('uuid-ossp',
- files(
- 'uuid-ossp.c',
- ),
+ uuid_ossp_sources,
kwargs: contrib_mod_args + {
'dependencies': [uuid, contrib_mod_args['dependencies']],
},
diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build
index 7a632b87d1b..846de47dbd1 100644
--- a/contrib/vacuumlo/meson.build
+++ b/contrib/vacuumlo/meson.build
@@ -1,5 +1,15 @@
+vacuumlo_sources = files(
+ 'vacuumlo.c',
+)
+
+if host_system == 'windows'
+ vacuumlo_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'vacuumlo',
+ '--FILEDESC', 'vacuumlo - removes orphaned large objects',])
+endif
+
vacuumlo = executable('vacuumlo',
- ['vacuumlo.c'],
+ vacuumlo_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 9c0b56f01f6..89b0d677516 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -2,11 +2,19 @@ if not libxml.found()
subdir_done()
endif
+xml2_sources = files(
+ 'xpath.c',
+ 'xslt_proc.c',
+)
+
+if host_system == 'windows'
+ xml2_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgxml',
+ '--FILEDESC', 'xml2 - XPath querying and XSLT',])
+endif
+
xml2 = shared_module('pgxml',
- files(
- 'xpath.c',
- 'xslt_proc.c',
- ),
+ xml2_sources,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 7aeb627ee86..aa9ab497832 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -7,6 +7,12 @@ ecpg_compat_inc = ['.', ecpg_inc, postgres_inc, libpq_inc]
ecpg_compat_c_args = ['-DSO_MAJOR_VERSION=3']
export_file = custom_target('libecpg_compat.exports', kwargs: gen_export_kwargs)
+if host_system == 'windows'
+ ecpg_compat_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libecpg_compat',
+ '--FILEDESC', 'ECPG compat - compatibility library for ECPG',])
+endif
+
# not using both_libraries(), as the resource file should only be in the
# shared library
ecpg_compat_st = static_library('libecpg_compat',
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index eb8dd616571..fd40ee86610 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -16,6 +16,12 @@ ecpglib_inc = ['.', ecpg_inc, postgres_inc]
ecpglib_c_args = ['-DSO_MAJOR_VERSION=6']
export_file = custom_target('libecpg.exports', kwargs: gen_export_kwargs)
+if host_system == 'windows'
+ ecpglib_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libecpg',
+ '--FILEDESC', 'ECPG - embedded SQL in C',])
+endif
+
# not using both_libraries(), as the resource file should only be in the
# shared library
ecpglib_st = static_library('libecpg',
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 5254843f84d..53cdad36422 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -12,6 +12,12 @@ export_file = custom_target('libpgtypes.exports', kwargs: gen_export_kwargs)
ecpg_pgtypes_inc = ['.', ecpg_inc, postgres_inc]
ecpg_pgtypes_c_args = ['-DSO_MAJOR_VERSION=3']
+if host_system == 'windows'
+ ecpg_pgtypes_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgtypes',
+ '--FILEDESC', 'pgtypes - library for data type mapping',])
+endif
+
# not using both_libraries(), as the resource file should only be in the
# shared library
ecpg_pgtypes_st = static_library('libpgtypes',
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 1be49c8c27f..74876f039c9 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -93,6 +93,12 @@ ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
generated_sources += ecpg_kwlist
ecpg_sources += ecpg_kwlist
+if host_system == 'windows'
+ ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ecpg',
+ '--FILEDESC', 'ecpg - embedded SQL precompiler for C',])
+endif
+
ecpg_exe = executable('ecpg',
ecpg_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index 8904aa7fd90..94b26d10314 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -7,6 +7,11 @@ pg_regress_ecpg_sources = pg_regress_c + files(
'pg_regress_ecpg.c',
)
+if host_system == 'windows'
+ pg_regress_ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress_ecpg',])
+endif
+
pg_regress_ecpg = executable('pg_regress_ecpg',
pg_regress_ecpg_sources,
c_args: pg_regress_cflags,
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index c7656fd4609..ba27b8c1d44 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -23,6 +23,12 @@ spec_parser = custom_target('specparse',
isolationtester_sources += spec_parser
generated_sources += spec_parser.to_list()
+if host_system == 'windows'
+ isolation_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_isolation_regress',
+ '--FILEDESC', 'pg_isolation_regress - multi-client test driver',])
+endif
+
pg_isolation_regress = executable('pg_isolation_regress',
isolation_sources,
c_args: pg_regress_cflags,
@@ -34,6 +40,13 @@ pg_isolation_regress = executable('pg_isolation_regress',
)
bin_targets += pg_isolation_regress
+
+if host_system == 'windows'
+ isolationtester_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isolationtester',
+ '--FILEDESC', 'isolationtester - multi-client test driver',])
+endif
+
isolationtester = executable('isolationtester',
isolationtester_sources,
include_directories: include_directories('.'),
diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build
index cf4bdaba637..a0c3ab6afe7 100644
--- a/src/test/modules/delay_execution/meson.build
+++ b/src/test/modules/delay_execution/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+delay_execution_sources = files(
+ 'delay_execution.c',
+)
+
+if host_system == 'windows'
+ delay_execution_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'delay_execution',
+ '--FILEDESC', 'delay_execution - allow delay between parsing and execution',])
+endif
+
delay_execution = shared_module('delay_execution',
- ['delay_execution.c'],
+ delay_execution_sources,
kwargs: pg_mod_args,
)
testprep_targets += delay_execution
diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build
index 56ff5f48001..4ce82491135 100644
--- a/src/test/modules/dummy_index_am/meson.build
+++ b/src/test/modules/dummy_index_am/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_index_am_sources = files(
+ 'dummy_index_am.c',
+)
+
+if host_system == 'windows'
+ dummy_index_am_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_index_am',
+ '--FILEDESC', 'dummy_index_am - index access method template',])
+endif
+
dummy_index_am = shared_module('dummy_index_am',
- ['dummy_index_am.c'],
+ dummy_index_am_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_index_am
diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build
index 21b7cf8f353..81b626e496c 100644
--- a/src/test/modules/dummy_seclabel/meson.build
+++ b/src/test/modules/dummy_seclabel/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_seclabel_sources = files(
+ 'dummy_seclabel.c',
+)
+
+if host_system == 'windows'
+ dummy_seclabel_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_seclabel',
+ '--FILEDESC', 'dummy_seclabel - regression testing of the SECURITY LABEL statement',])
+endif
+
dummy_seclabel = shared_module('dummy_seclabel',
- ['dummy_seclabel.c'],
+ dummy_seclabel_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_seclabel
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
index 8384b6e3b2a..de0e2d15626 100644
--- a/src/test/modules/libpq_pipeline/meson.build
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -1,7 +1,15 @@
+libpq_pipeline_sources = files(
+ 'libpq_pipeline.c',
+)
+
+if host_system == 'windows'
+ libpq_pipeline_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_pipeline',
+ '--FILEDESC', 'libpq_pipeline - test program for pipeline execution',])
+endif
+
libpq_pipeline = executable('libpq_pipeline',
- files(
- 'libpq_pipeline.c',
- ),
+ libpq_pipeline_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build
index 45de3f1990d..e1ea2c7a16f 100644
--- a/src/test/modules/plsample/meson.build
+++ b/src/test/modules/plsample/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+plsample_sources = files(
+ 'plsample.c',
+)
+
+if host_system == 'windows'
+ plsample_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plsample',
+ '--FILEDESC', 'PL/Sample - template for procedural language',])
+endif
+
plsample = shared_module('plsample',
- ['plsample.c'],
+ plsample_sources,
kwargs: pg_mod_args,
)
testprep_targets += plsample
diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build
index 857fc7e140e..445296fee0b 100644
--- a/src/test/modules/spgist_name_ops/meson.build
+++ b/src/test/modules/spgist_name_ops/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+spgist_name_ops_sources = files(
+ 'spgist_name_ops.c',
+)
+
+if host_system == 'windows'
+ spgist_name_ops_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'spgist_name_ops',
+ '--FILEDESC', 'spgist_name_ops - test opclass for SP-GiST',])
+endif
+
spgist_name_ops = shared_module('spgist_name_ops',
- ['spgist_name_ops.c'],
+ spgist_name_ops_sources,
kwargs: pg_mod_args,
)
testprep_targets += spgist_name_ops
diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build
index a57bd0693a3..a9eb4c564da 100644
--- a/src/test/modules/ssl_passphrase_callback/meson.build
+++ b/src/test/modules/ssl_passphrase_callback/meson.build
@@ -3,8 +3,19 @@ if not ssl.found()
endif
# FIXME: prevent install during main install, but not during test :/
+
+ssl_passphrase_callback_sources = files(
+ 'ssl_passphrase_func.c',
+)
+
+if host_system == 'windows'
+ ssl_passphrase_callback_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ssl_passphrase_func',
+ '--FILEDESC', 'callback function to provide a passphrase',])
+endif
+
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
- ['ssl_passphrase_func.c'],
+ ssl_passphrase_callback_sources,
kwargs: pg_mod_args + {
'dependencies': [ssl, pg_mod_args['dependencies']],
},
diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build
index 945eb5a70c4..3cf6b05754f 100644
--- a/src/test/modules/test_bloomfilter/meson.build
+++ b/src/test/modules/test_bloomfilter/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_bloomfilter_sources = files(
+ 'test_bloomfilter.c',
+)
+
+if host_system == 'windows'
+ test_bloomfilter_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_bloomfilter',
+ '--FILEDESC', 'test_bloomfilter - test code for Bloom filter library',])
+endif
+
test_bloomfilter = shared_module('test_bloomfilter',
- ['test_bloomfilter.c'],
+ test_bloomfilter_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_bloomfilter
diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build
index 81ad5adc526..54d44f9b2b4 100644
--- a/src/test/modules/test_ddl_deparse/meson.build
+++ b/src/test/modules/test_ddl_deparse/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ddl_deparse_sources = files(
+ 'test_ddl_deparse.c',
+)
+
+if host_system == 'windows'
+ test_ddl_deparse_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ddl_deparse',
+ '--FILEDESC', 'test_ddl_deparse - regression testing for DDL deparsing',])
+endif
+
test_ddl_deparse = shared_module('test_ddl_deparse',
- ['test_ddl_deparse.c'],
+ test_ddl_deparse_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ddl_deparse
diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build
index abf0a3b0430..b3b49c56122 100644
--- a/src/test/modules/test_ginpostinglist/meson.build
+++ b/src/test/modules/test_ginpostinglist/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ginpostinglist_sources = files(
+ 'test_ginpostinglist.c',
+)
+
+if host_system == 'windows'
+ test_ginpostinglist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ginpostinglist',
+ '--FILEDESC', 'test_ginpostinglist - test code for src/backend/access/gin//ginpostinglist.c',])
+endif
+
test_ginpostinglist = shared_module('test_ginpostinglist',
- ['test_ginpostinglist.c'],
+ test_ginpostinglist_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ginpostinglist
diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build
index c32c469c69a..4bd75af4b5e 100644
--- a/src/test/modules/test_integerset/meson.build
+++ b/src/test/modules/test_integerset/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_integerset_sources = files(
+ 'test_integerset.c',
+)
+
+if host_system == 'windows'
+ test_integerset_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_integerset',
+ '--FILEDESC', 'test_integerset - test code for src/backend/lib/integerset.c',])
+endif
+
test_integerset = shared_module('test_integerset',
- ['test_integerset.c'],
+ test_integerset_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_integerset
diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build
index a388de1156a..c5405b8f878 100644
--- a/src/test/modules/test_lfind/meson.build
+++ b/src/test/modules/test_lfind/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_lfind_sources = files(
+ 'test_lfind.c',
+)
+
+if host_system == 'windows'
+ test_lfind_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_lfind',
+ '--FILEDESC', 'test_lfind - test code for optimized linear search functions',])
+endif
+
test_lfind = shared_module('test_lfind',
- ['test_lfind.c'],
+ test_lfind_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_lfind
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 5faf0459777..8802bbbac55 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_oat_hooks_sources = files(
+ 'test_oat_hooks.c',
+)
+
+if host_system == 'windows'
+ test_oat_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_oat_hooks',
+ '--FILEDESC', 'test_oat_hooks - example use of object access hooks',])
+endif
+
test_oat_hooks = shared_module('test_oat_hooks',
- ['test_oat_hooks.c'],
+ test_oat_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_oat_hooks
diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build
index b59960f615e..1c17113347f 100644
--- a/src/test/modules/test_parser/meson.build
+++ b/src/test/modules/test_parser/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_parser_sources = files(
+ 'test_parser.c',
+)
+
+if host_system == 'windows'
+ test_parser_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_parser',
+ '--FILEDESC', 'test_parser - example of a custom parser for full-text search',])
+endif
+
test_parser = shared_module('test_parser',
- ['test_parser.c'],
+ test_parser_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_parser
diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build
index 1cfa84b3609..9a5be43c9c0 100644
--- a/src/test/modules/test_predtest/meson.build
+++ b/src/test/modules/test_predtest/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_predtest_sources = files(
+ 'test_predtest.c',
+)
+
+if host_system == 'windows'
+ test_predtest_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_predtest',
+ '--FILEDESC', 'test_predtest - test code for optimizer/util/predtest.c',])
+endif
+
test_predtest = shared_module('test_predtest',
- ['test_predtest.c'],
+ test_predtest_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_predtest
diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build
index 34cbc3e1624..f067e08d321 100644
--- a/src/test/modules/test_rbtree/meson.build
+++ b/src/test/modules/test_rbtree/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rbtree_sources = files(
+ 'test_rbtree.c',
+)
+
+if host_system == 'windows'
+ test_rbtree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rbtree',
+ '--FILEDESC', 'test_rbtree - test code for red-black tree library',])
+endif
+
test_rbtree = shared_module('test_rbtree',
- ['test_rbtree.c'],
+ test_rbtree_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rbtree
diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build
index 867a64e57c3..cfb938d9f1e 100644
--- a/src/test/modules/test_regex/meson.build
+++ b/src/test/modules/test_regex/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_regex_sources = files(
+ 'test_regex.c',
+)
+
+if host_system == 'windows'
+ test_regex_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_regex',
+ '--FILEDESC', 'test_regex - test code for backend/regex/',])
+endif
+
test_regex = shared_module('test_regex',
- ['test_regex.c'],
+ test_regex_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_regex
diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build
index 80d8adda332..3fb273b2934 100644
--- a/src/test/modules/test_rls_hooks/meson.build
+++ b/src/test/modules/test_rls_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rls_hooks_sources = files(
+ 'test_rls_hooks.c',
+)
+
+if host_system == 'windows'
+ test_rls_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rls_hooks',
+ '--FILEDESC', 'test_rls_hooks - example use of RLS hooks',])
+endif
+
test_rls_hooks = shared_module('test_rls_hooks',
- ['test_rls_hooks.c'],
+ test_rls_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rls_hooks
diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build
index b663543d616..16c8fdb57f4 100644
--- a/src/test/modules/test_shm_mq/meson.build
+++ b/src/test/modules/test_shm_mq/meson.build
@@ -1,10 +1,19 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_shm_mq_sources = files(
+ 'setup.c',
+ 'test.c',
+ 'worker.c',
+)
+
+if host_system == 'windows'
+ test_shm_mq_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_shm_mq',
+ '--FILEDESC', 'test_shm_mq - example use of shared memory message queue',])
+endif
+
test_shm_mq = shared_module('test_shm_mq',
- files(
- 'setup.c',
- 'test.c',
- 'worker.c',
- ),
+ test_shm_mq_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_shm_mq
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index 32acad883b2..a4a158c75b9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -1,8 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_worker_spi_sources = files(
+ 'worker_spi.c',
+)
+
+if host_system == 'windows'
+ test_worker_spi_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'worker_spi',
+ '--FILEDESC', 'worker_spi - background worker example',])
+endif
+
test_worker_spi = shared_module('worker_spi',
- files(
- 'worker_spi.c',
- ),
+ test_worker_spi_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_worker_spi
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index fd8ee995b79..963c0f64ed5 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -8,6 +8,12 @@ regress_sources = pg_regress_c + files(
pg_regress_cflags = ['-DHOST_TUPLE="frak"', '-DSHELLPROG="/bin/sh"']
+if host_system == 'windows'
+ regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress',
+ '--FILEDESC', 'pg_regress - test driver',])
+endif
+
pg_regress = executable('pg_regress',
regress_sources,
c_args: pg_regress_cflags,
diff --git a/meson.build b/meson.build
index 38b2c3aae2e..774a8c2e05f 100644
--- a/meson.build
+++ b/meson.build
@@ -2536,6 +2536,65 @@ gen_export_kwargs = {
+###
+### windows resources related stuff
+###
+
+if host_system == 'windows'
+ pg_ico = meson.source_root() / 'src' / 'port' / 'win32.ico'
+ win32ver_rc = files('src/port/win32ver.rc')
+ rcgen = find_program('src/tools/rcgen', native: true)
+
+ rcgen_base_args = [
+ '--srcdir', '@SOURCE_DIR@',
+ '--builddir', meson.build_root(),
+ '--rcout', '@OUTPUT0@',
+ '--out', '@OUTPUT1@',
+ '--input', '@INPUT@',
+ '@EXTRA_ARGS@',
+ ]
+
+ if cc.get_argument_syntax() == 'msvc'
+ rc = find_program('rc', required: true)
+ rcgen_base_args += ['--rc', rc.path()]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.res']
+ else
+ windres = find_program('windres', required: true)
+ rcgen_base_args += ['--windres', windres.path()]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.obj']
+ endif
+
+ # msbuild backend doesn't support this atm
+ if meson.backend() == 'ninja'
+ rcgen_base_args += ['--depfile', '@DEPFILE@']
+ endif
+
+ rcgen_bin_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_APP',
+ '--FILEENDING', 'exe',
+ '--ICO', pg_ico
+ ]
+
+ rcgen_lib_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_DLL',
+ '--FILEENDING', 'dll',
+ ]
+
+ rc_bin_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_bin_args,
+ output: rcgen_outputs,
+ )
+
+ rc_lib_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_lib_args,
+ output: rcgen_outputs,
+ )
+endif
+
+
+
# headers that the whole build tree depends on
generated_headers = []
# headers that the backend build depends on
diff --git a/src/timezone/meson.build b/src/timezone/meson.build
index 16f082ecfa8..9e0934c000b 100644
--- a/src/timezone/meson.build
+++ b/src/timezone/meson.build
@@ -28,6 +28,12 @@ if get_option('system_tzdata') == ''
if meson.is_cross_build()
zic = find_program(get_option('ZIC'), native: true, required: true)
else
+ if host_system == 'windows'
+ zic_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'zic',
+ '--FILEDESC', 'zic - time zone compiler',])
+ endif
+
zic = executable('zic', zic_sources,
dependencies: [frontend_code],
kwargs: default_bin_args + {'install': false}
diff --git a/src/tools/rcgen b/src/tools/rcgen
new file mode 100755
index 00000000000..5b62bfe5410
--- /dev/null
+++ b/src/tools/rcgen
@@ -0,0 +1,99 @@
+#!/usr/bin/env python3
+
+import argparse
+import os
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(description='generate PostgreSQL rc file')
+
+parser.add_argument('--srcdir', type=os.path.abspath,
+ required=True)
+parser.add_argument('--builddir', type=os.path.abspath,
+ required=True)
+
+binaries = parser.add_argument_group('binaries')
+binaries.add_argument('--windres', type=os.path.abspath)
+binaries.add_argument('--rc', type=os.path.abspath)
+
+inout = parser.add_argument_group('inout')
+inout.add_argument('--depfile', type=argparse.FileType('w'))
+inout.add_argument('--input', type=argparse.FileType('r'),
+ required=True)
+inout.add_argument('--rcout', type=argparse.FileType('w'),
+ required=True)
+inout.add_argument('--out', type=str,
+ required=True)
+
+replacements = parser.add_argument_group('replacements')
+replacements.add_argument('--FILEDESC', type=str)
+replacements.add_argument('--NAME', type=str, required=True)
+replacements.add_argument('--VFT_TYPE', type=str, required=True)
+replacements.add_argument('--FILEENDING', type=str, required=True)
+replacements.add_argument('--ICO', type=str)
+
+args = parser.parse_args()
+
+# determine replacement strings
+
+internal_name = '"{0}"'.format(args.NAME)
+original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING)
+
+# if no description is passed in, generate one based on the name
+if args.FILEDESC:
+ filedesc = args.FILEDESC
+elif args.NAME:
+ if args.VFT_TYPE == 'VFT_DLL':
+ filedesc = 'PostgreSQL {0} library'.format(args.NAME)
+ else:
+ filedesc = 'PostgreSQL {0} binary'.format(args.NAME)
+filedesc = '"{0}"'.format(filedesc)
+
+
+if args.ICO:
+ ico = 'IDI_ICON ICON "{0}"'.format(args.ICO)
+ if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO))
+else:
+ ico = ''
+
+
+data = args.input.read()
+
+data = data.replace('VFT_APP', args.VFT_TYPE)
+data = data.replace('_INTERNAL_NAME_', internal_name)
+data = data.replace('_ORIGINAL_NAME_', original_name)
+data = data.replace('FILEDESC', filedesc)
+data = data.replace("_ICO_", ico)
+
+args.rcout.write(data)
+args.rcout.close()
+
+if args.windres:
+ cmd = [
+ args.windres,
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '-o', args.out, '-i', args.rcout.name,
+ ]
+elif args.rc:
+ cmd = [
+ args.rc, '/nologo',
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '/fo', args.out, args.rcout.name,
+ ]
+else:
+ sys.exit('either --windres or --rc needs to be specified')
+
+sp = subprocess.run(cmd)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# It'd be nicer if we could generate correct dependencies here, but 'rc'
+# doesn't support doing so. It's unlikely we'll ever need more, so...
+if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(
+ args.rcout.name, args.input.name))
+ args.depfile.write("{0} : {1}/{2}\n".format(
+ args.out, args.builddir, 'src/include/pg_config.h'))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0007-meson-Add-docs-for-building-with-meson.patch (77.6K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/8-v17-0007-meson-Add-docs-for-building-with-meson.patch)
download | inline diff:
From 3d84a0d177f33c66d409a09faf6c0e4c55e6a98a Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:55:20 -0700
Subject: [PATCH v17 07/23] meson: Add docs for building with meson
Author: Samay Sharma <smilingsamay@gmail.com>
---
doc/src/sgml/installation.sgml | 1841 ++++++++++++++++++++++++++++++--
doc/src/sgml/monitoring.sgml | 2 +-
doc/src/sgml/runtime.sgml | 2 +-
doc/src/sgml/sourcerepo.sgml | 5 +-
4 files changed, 1743 insertions(+), 107 deletions(-)
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 319c7e69660..3d4018badd3 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -31,7 +31,144 @@ documentation. See standalone-profile.xsl for details.
C++</productname>, see <xref linkend="install-windows"/> instead.
</para>
- <sect1 id="install-short">
+ <sect1 id="supported-platforms">
+ <title>Supported Platforms</title>
+
+ <para>
+ A platform (that is, a CPU architecture and operating system combination)
+ is considered supported by the <productname>PostgreSQL</productname> development
+ community if the code contains provisions to work on that platform and
+ it has recently been verified to build and pass its regression tests
+ on that platform. Currently, most testing of platform compatibility
+ is done automatically by test machines in the
+ <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
+ If you are interested in using <productname>PostgreSQL</productname> on a platform
+ that is not represented in the build farm, but on which the code works
+ or can be made to work, you are strongly encouraged to set up a build
+ farm member machine so that continued compatibility can be assured.
+ </para>
+
+ <para>
+ In general, <productname>PostgreSQL</productname> can be expected to work on
+ these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
+ and PA-RISC, including
+ big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
+ It is often
+ possible to build on an unsupported CPU type by configuring with
+ <option>--disable-spinlocks</option>, but performance will be poor.
+ </para>
+
+ <para>
+ <productname>PostgreSQL</productname> can be expected to work on current
+ versions of these operating systems: Linux, Windows,
+ FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
+ Other Unix-like systems may also work but are not currently
+ being tested. In most cases, all CPU architectures supported by
+ a given operating system will work. Look in
+ <xref linkend="installation-platform-notes"/> below to see if
+ there is information
+ specific to your operating system, particularly if using an older system.
+ </para>
+
+ <para>
+ If you have installation problems on a platform that is known
+ to be supported according to recent build farm results, please report
+ it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
+ in porting <productname>PostgreSQL</productname> to a new platform,
+ <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
+ to discuss that.
+ </para>
+
+ <para>
+ Historical versions of <productname>PostgreSQL</productname> or POSTGRES
+ also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
+ M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
+ BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
+ Tru64 UNIX, and ULTRIX.
+ </para>
+ </sect1>
+
+ <sect1 id="get-source">
+ <title>Getting the Source</title>
+
+ <para>
+ You can download the source code in two ways - via git or the source code
+ tarballs.
+ </para>
+
+ <sect2 id="get-source-git">
+ <title>Getting the Source via <productname>Git</productname></title>
+ <para>
+ With <productname>Git</productname>, you can make a copy of the entire code repository
+ on your local machine, so you will have access to all history and branches
+ offline. This is the fastest and most flexible way to develop or test
+ patches.
+ </para>
+
+ <procedure>
+ <step>
+ <para>
+ To begin using the Git repository, make a clone of the official mirror:
+
+<programlisting>
+git clone https://git.postgresql.org/git/postgresql.git
+</programlisting>
+
+ This will copy the full repository to your local machine, so it may take
+ a while to complete, especially if you have a slow Internet connection.
+ The files will be placed in a new subdirectory <filename>postgresql</filename> of
+ your current directory.
+ </para>
+
+ </step>
+
+ <step>
+ <para>
+ Whenever you want to get the latest updates in the system, <command>cd</command>
+ into the repository, and run:
+
+<programlisting>
+git pull
+</programlisting>
+ </para>
+ </step>
+ </procedure>
+
+ <para>
+ <productname>Git</productname> can do a lot more things than just fetch the source.
+ Our wiki, <ulink
+ url="https://wiki.postgresql.org/wiki/Working_with_Git"></ulink>,
+ has some discussion on working with Git. For more information, consult the
+ <productname>Git</productname> man pages, or see the website at
+ <ulink url="https://git-scm.com"></ulink>.
+ </para>
+ </sect2>
+ <sect2 id="get-source-tarball">
+ <title>Getting the Source via Tarballs</title>
+
+ <para>
+ The <productname>PostgreSQL</productname> source code for released versions
+ can also be obtained from the download section of our website:
+ <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
+ Download the
+ <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
+ or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
+ file you're interested in, then unpack it:
+<screen>
+<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
+</screen>
+ This will create a directory
+ <filename>postgresql-<replaceable>version</replaceable></filename> under
+ the current directory with the <productname>PostgreSQL</productname> sources.
+ Change into that directory for the rest of the installation procedure.
+ </para>
+ </sect2>
+ </sect1>
+
+<sect1 id="install-make">
+ <title>Building and Installation with autoconf and make</title>
+
+ <sect2 id="install-short-make">
<title>Short Version</title>
<para>
@@ -50,12 +187,12 @@ su - postgres
/usr/local/pgsql/bin/psql test
</synopsis>
The long version is the rest of this
- <phrase>chapter</phrase>.
+ <phrase>section</phrase>.
</para>
- </sect1>
+ </sect2>
- <sect1 id="install-requirements">
+ <sect2 id="install-requirements-make">
<title>Requirements</title>
<para>
@@ -343,45 +480,9 @@ su - postgres
url="ftp://ftp.gnu.org/gnu/"></ulink>.
</para>
- <para>
- Also check that you have sufficient disk space. You will need about
- 350 MB for the source tree during compilation and about 60 MB for
- the installation directory. An empty database cluster takes about
- 40 MB; databases take about five times the amount of space that a
- flat text file with the same data would take. If you are going to
- run the regression tests you will temporarily need up to an extra
- 300 MB. Use the <command>df</command> command to check free disk
- space.
- </para>
- </sect1>
+ </sect2>
- <sect1 id="install-getsource">
- <title>Getting the Source</title>
-
- <para>
- The <productname>PostgreSQL</productname> source code for released versions
- can be obtained from the download section of our website:
- <ulink url="https://www.postgresql.org/ftp/source/"></ulink>.
- Download the
- <filename>postgresql-<replaceable>version</replaceable>.tar.gz</filename>
- or <filename>postgresql-<replaceable>version</replaceable>.tar.bz2</filename>
- file you're interested in, then unpack it:
-<screen>
-<userinput>tar xf postgresql-<replaceable>version</replaceable>.tar.bz2</userinput>
-</screen>
- This will create a directory
- <filename>postgresql-<replaceable>version</replaceable></filename> under
- the current directory with the <productname>PostgreSQL</productname> sources.
- Change into that directory for the rest of the installation procedure.
- </para>
-
- <para>
- Alternatively, you can use the Git version control system; see
- <xref linkend="git"/> for more information.
- </para>
- </sect1>
-
- <sect1 id="install-procedure">
+ <sect2 id="install-procedure-make">
<title>Installation Procedure</title>
<procedure>
@@ -630,6 +731,7 @@ build-postgresql:
rebuilding. Without this, your changes in configuration choices
might not propagate everywhere they need to.
</para>
+ </sect2>
<sect2 id="configure-options">
<title><filename>configure</filename> Options</title>
@@ -844,7 +946,7 @@ build-postgresql:
various <productname>PostgreSQL</productname> features that are not
built by default. Most of these are non-default only because they
require additional software, as described in
- <xref linkend="install-requirements"/>.
+ <xref linkend="install-requirements-make"/>.
</para>
<variablelist>
@@ -1672,9 +1774,7 @@ build-postgresql:
</sect3>
- </sect2>
-
- <sect2 id="configure-envvars">
+ <sect3 id="configure-envvars">
<title><filename>configure</filename> Environment Variables</title>
<indexterm zone="configure-envvars">
@@ -1955,9 +2055,1600 @@ build-postgresql:
adjustments, while <envar>COPT</envar> might be kept set all the time.
</para>
</note>
+ </sect3>
</sect2>
</sect1>
+ <sect1 id="install-meson">
+ <title>Building and Installation with meson</title>
+
+ <sect2 id="install-short-meson">
+ <title>Short Version</title>
+
+ <para>
+<synopsis>
+
+# create working directory
+mkdir postgres
+cd postgres
+
+# fetch source code
+# git clone https://git.postgresql.org/git/postgresql.git src
+
+# current instructions for testing (to be removed when merging)
+git clone -b meson https://github.com/anarazel/postgres.git src
+
+# setup and enter build directory (done only first time)
+meson setup build src --prefix=$PWD/install
+cd build
+
+# Compile source
+ninja
+
+# Install to the prefix directory specified above
+ninja install
+
+# Run all tests (optional, takes time)
+meson test
+
+# Initialize a new database
+../install/bin/initdb -D ../data
+
+# Start database
+../install/bin/pg_ctl -D ../data/ -l logfile start
+
+# Connect to the database
+../install/bin/psql -d postgres
+
+</synopsis>
+ The long version is the rest of this
+ <phrase>section</phrase>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-requirements-meson">
+ <title>Requirements</title>
+
+ <para>
+ In general, a modern Unix-compatible platform or Windows should be able
+ to build <productname>PostgreSQL</productname> with meson and run it.
+ The platforms which have received specific testing at the time of release are:
+
+ <itemizedlist spacing="compact">
+ <listitem><simpara>Linux</simpara></listitem>
+ <listitem><simpara>Windows</simpara></listitem>
+ <listitem><simpara>OpenBSD</simpara></listitem>
+ <listitem><simpara>NetBSD</simpara></listitem>
+ <listitem><simpara>FreeBSD</simpara></listitem>
+ <listitem><simpara>macOS</simpara></listitem>
+ </itemizedlist>
+ </para>
+
+ <sect3 id="required-packages">
+ <title>Required packages</title>
+
+ <para>
+ The following software packages are required for building
+ <productname>PostgreSQL</productname>:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can download the source code in two ways - via git or by downloading
+ the source code tarballs. For the former, you will need an installed version of
+ <productname>Git</productname>, which you can get from
+ <ulink url="https://git-scm.com"></ulink>. Many systems already
+ have a recent version of <productname>Git</productname>
+ installed by default, or available in their package distribution system.
+ If you download the source code tarballs, you will need
+ <application>tar</application> in addition to
+ <application>gzip</application> or <application>bzip2</application>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>meson</primary>
+ </indexterm>
+ You need to install <application>
+ <ulink url="https://mesonbuild.com/">meson</ulink></application> version
+ 0.54 or later to be able to build <productname>PostgreSQL</productname>
+ with it. If your operating system provides a package manager, you can install
+ <application>meson</application> with that. If not, you
+ can download a <ulink url="https://github.com/mesonbuild/meson">meson release</ulink>
+ from github and run <literal>./meson.py</literal> from the git repository
+ itself. Lastly, Meson is also available in the python package index and can
+ be installed with <literal>pip</literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ You need an <acronym>ISO</acronym>/<acronym>ANSI</acronym> C compiler (at least
+ C99-compliant). Recent
+ versions of <productname>GCC</productname> are recommended, but
+ <productname>PostgreSQL</productname> is known to build using a wide variety
+ of compilers from different vendors.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>flex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>lex</primary>
+ </indexterm>
+ <indexterm>
+ <primary>bison</primary>
+ </indexterm>
+ <indexterm>
+ <primary>yacc</primary>
+ </indexterm>
+
+ <application>Flex</application> and <application>Bison</application>
+ are needed to build <productname>PostgreSQL</productname> using
+ <application>meson</application>. Be sure to get
+ <application>Flex</application> 2.5.31 or later and
+ <application>Bison</application> 1.875 or later from your package manager.
+ Other <application>lex</application> and <application>yacc</application>
+ programs cannot be used.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>perl</primary>
+ </indexterm>
+ <application>Perl</application> 5.8.3 or later is needed to build PostgreSQL
+ using <application>meson</application> and to run some test suites.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="recommended-packages">
+ <title>Recommended packages</title>
+
+ <para>
+ The following packages are not required to build
+ <application>PostgreSQL</application> but are strongly recommended:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>readline</primary>
+ </indexterm>
+ <indexterm>
+ <primary>libedit</primary>
+ </indexterm>
+
+ The <acronym>GNU</acronym> <productname>Readline</productname> library
+ allows <application>psql</application> (the PostgreSQL command line
+ SQL interpreter) to remember each command you type, and allows you to
+ use arrow keys to recall and edit previous commands. This is very
+ helpful and is strongly recommended. As an alternative, you can often
+ use the BSD-licensed <filename>libedit</filename> library, originally
+ developed on <productname>NetBSD</productname>. The
+ <filename>libedit</filename> library is GNU
+ <productname>Readline</productname>-compatible and is used if
+ <filename>libreadline</filename> is not found, or if
+ <option>libedit_preferred</option> is enabled as an
+ option to <filename>meson configure</filename>. If you are using a
+ package-based Linux distribution, be aware that you need both the
+ <literal>readline</literal> and <literal>readline-devel</literal> packages, if
+ those are separate in your distribution.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+
+ The <productname>zlib</productname> compression library is
+ used to provide support for compressed archives in
+ <application>pg_dump</application> and
+ <application>pg_restore</application> and is recommended.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Various tests, particularly the client program tests under
+ <filename>src/bin</filename>, use the Perl TAP tools. Running
+ these tests is recommended for development. These TAP tests
+ require the Perl module <literal>IPC::Run</literal> which is
+ available from CPAN or an operating system package.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ <sect3 id="optional-packages">
+ <title>Optional packages</title>
+
+ <para>
+ The following packages are optional. They are not required in the
+ default configuration, but they are needed when certain build
+ options are enabled, as explained below:
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ You need <productname>OpenSSL</productname>, if you want to support
+ encrypted client connections. <productname>OpenSSL</productname> is
+ also required for random number generation on platforms that do not
+ have <filename>/dev/urandom</filename> (except Windows). The minimum
+ required version is 1.0.1.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>LZ4</productname>, if you want to support
+ compression of data with that method; see
+ <xref linkend="guc-default-toast-compression"/> and
+ <xref linkend="guc-wal-compression"/>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <productname>Zstandard</productname>, if you want to support
+ compression of data or backups with that method; see
+ <xref linkend="guc-wal-compression"/>.
+ The minimum required version is 1.4.0.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You need <application>Kerberos</application>, <productname>OpenLDAP</productname>,
+ and/or <application>PAM</application>, if you want to support authentication
+ using those services.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the server programming language
+ <application>PL/Perl</application> you need a full
+ <productname>Perl</productname> installation, including the
+ <filename>libperl</filename> library and the header files.
+ The minimum required version is <productname>Perl</productname> 5.8.3.
+ Since <application>PL/Perl</application> will be a shared
+ library, the <indexterm><primary>libperl</primary></indexterm>
+ <filename>libperl</filename> library must be a shared library
+ also on most platforms. This appears to be the default in
+ recent <productname>Perl</productname> versions, but it was not
+ in earlier versions, and in any case it is the choice of whomever
+ installed Perl at your site. <filename>configure</filename> will fail
+ if building <application>PL/Perl</application> is selected but it cannot
+ find a shared <filename>libperl</filename>. In that case, you will have
+ to rebuild and install <productname>Perl</productname> manually to be
+ able to build <application>PL/Perl</application>. During the
+ configuration process for <productname>Perl</productname>, request a
+ shared library.
+ </para>
+
+ <para>
+ If you intend to make more than incidental use of
+ <application>PL/Perl</application>, you should ensure that the
+ <productname>Perl</productname> installation was built with the
+ <literal>usemultiplicity</literal> option enabled (<literal>perl -V</literal>
+ will show whether this is the case).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Python</application> server programming
+ language, you need a <productname>Python</productname>
+ installation with the header files and
+ the <application>sysconfig</application> module. The minimum
+ required version is <productname>Python</productname> 3.2.
+ </para>
+
+ <para>
+ Since <application>PL/Python</application> will be a shared
+ library, the <indexterm><primary>libpython</primary></indexterm>
+ <filename>libpython</filename> library must be a shared library
+ also on most platforms. This is not the case in a default
+ <productname>Python</productname> installation built from source, but a
+ shared library is available in many operating system
+ distributions. <filename>configure</filename> will fail if
+ building <application>PL/Python</application> is selected but it cannot
+ find a shared <filename>libpython</filename>. That might mean that you
+ either have to install additional packages or rebuild (part of) your
+ <productname>Python</productname> installation to provide this shared
+ library. When building from source, run <productname>Python</productname>'s
+ configure with the <literal>--enable-shared</literal> flag.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <application>PL/Tcl</application>
+ procedural language, you of course need a <productname>Tcl</productname>
+ installation. The minimum required version is
+ <productname>Tcl</productname> 8.4.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To enable Native Language Support (<acronym>NLS</acronym>), that
+ is, the ability to display a program's messages in a language
+ other than English, you need an implementation of the
+ <application>Gettext</application> <acronym>API</acronym>. Some operating
+ systems have this built-in (e.g., <systemitem
+ class="osname">Linux</systemitem>, <systemitem class="osname">NetBSD</systemitem>,
+ <systemitem class="osname">Solaris</systemitem>), for other systems you
+ can download an add-on package from <ulink
+ url="https://www.gnu.org/software/gettext/"></ulink>.
+ If you are using the <application>Gettext</application> implementation in
+ the <acronym>GNU</acronym> C library then you will additionally
+ need the <productname>GNU Gettext</productname> package for some
+ utility programs. For any of the other implementations you will
+ not need it.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To build the <productname>PostgreSQL</productname> documentation,
+ there is a separate set of requirements; see
+ <xref linkend="docguide-toolsets"/>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="configure-meson">
+ <title>Configuring the build</title>
+
+ <para>
+ The first step of the installation procedure is to configure the
+ source tree for your system and choose the options you would like. To
+ create and configure the build directory, you can start with the
+ <literal>meson setup</literal> command.
+ </para>
+
+<screen>
+<userinput>meson setup build</userinput>
+</screen>
+
+ <para>
+ The setup command takes a <literal>builddir</literal> and a <literal>srcdir</literal>
+ argument. If no <literal>srcdir</literal> is given Meson will deduce the
+ <literal>srcdir</literal> based on the current directory and the location
+ of <literal>meson.build</literal>. The <literal>builddir</literal> is mandatory.
+ </para>
+
+ <para>
+ Meson then loads the build configuration file and sets up the build directory.
+ Additionally, the invocation can pass options to Meson. The list of commonly
+ used options is in subsequent sections. A few examples of specifying different
+ build options are:
+
+<screen>
+#Setup build directory with a different installation prefix
+meson setup build --prefix=/home/user/pg-install
+
+#Setup build directory to generate a debug build
+meson setup build --buildtype=debug
+
+#Setup build directory with ssl (Use -D for project specific options)
+meson setup build -Dssl=openssl
+</screen>
+
+ Setting up the build directory is a one-time step. To reconfigure before a
+ new build, you can simply use the <literal>meson configure</literal> command
+ </para>
+
+<para>
+<screen>
+meson configure -Dcassert=true
+</screen>
+</para>
+
+<para>
+ <command>meson configure</command>'s commonly used command line options
+ are explained below. This list is not exhaustive (use
+ <literal>meson configure --help</literal> to get one that is).
+ The options not covered here are meant for advanced use-cases, and are
+ documented in the standard meson
+ <ulink url="https://mesonbuild.com/Commands.html#configure">documentation</ulink>.
+ These arguments can be used with <command>meson setup</command> as well.
+</para>
+
+ <sect3 id="configure-install-locations">
+ <title>Installation Locations</title>
+
+ <para>
+ These options control where <literal>ninja install (or meson install)</literal> will put
+ the files. The <option>--prefix</option> option is sufficient for
+ most cases. If you have special needs, you can customize the
+ installation subdirectories with the other options described in this
+ section. Beware however that changing the relative locations of the
+ different subdirectories may render the installation non-relocatable,
+ meaning you won't be able to move it after installation.
+ (The <literal>man</literal> and <literal>doc</literal> locations are
+ not affected by this restriction.)
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--prefix=<replaceable>PREFIX</replaceable></option></term>
+ <listitem>
+ <para>
+ Install all files under the directory <replaceable>PREFIX</replaceable>
+ instead of <filename>/usr/local/pgsql</filename>. The actual
+ files will be installed into various subdirectories; no files
+ will ever be installed directly into the
+ <replaceable>PREFIX</replaceable> directory.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--bindir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the directory for executable programs. The default
+ is <filename><replaceable>PREFIX</replaceable>/bin</filename>, which
+ normally means <filename>/usr/local/pgsql/bin</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--sysconfdir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for various configuration files,
+ <filename><replaceable>PREFIX</replaceable>/etc</filename> by default.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <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>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--includedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing C and C++ header files. The
+ default is <filename><replaceable>PREFIX</replaceable>/include</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--datadir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for read-only data files used by the
+ installed programs. The default is
+ <filename><replaceable>PREFIX</replaceable>/share</filename>. Note that this has
+ nothing to do with where your database files will be placed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--localedir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ Sets the directory for installing locale data, in particular
+ message translation catalog files. The default is
+ <filename><replaceable>DATADIR</replaceable>/locale</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--mandir=<replaceable>DIRECTORY</replaceable></option></term>
+ <listitem>
+ <para>
+ The man pages that come with <productname>PostgreSQL</productname> will be installed under
+ this directory, in their respective
+ <filename>man<replaceable>x</replaceable></filename> subdirectories.
+ The default is <filename><replaceable>DATADIR</replaceable>/man</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ <note>
+ <para>
+ Care has been taken to make it possible to install
+ <productname>PostgreSQL</productname> into shared installation locations
+ (such as <filename>/usr/local/include</filename>) without
+ interfering with the namespace of the rest of the system. First,
+ the string <quote><literal>/postgresql</literal></quote> is
+ automatically appended to <varname>datadir</varname>,
+ <varname>sysconfdir</varname>, and <varname>docdir</varname>,
+ unless the fully expanded directory name already contains the
+ string <quote><literal>postgres</literal></quote> or
+ <quote><literal>pgsql</literal></quote>. For example, if you choose
+ <filename>/usr/local</filename> as prefix, the documentation will
+ be installed in <filename>/usr/local/doc/postgresql</filename>,
+ but if the prefix is <filename>/opt/postgres</filename>, then it
+ will be in <filename>/opt/postgres/doc</filename>. The public C
+ header files of the client interfaces are installed into
+ <varname>includedir</varname> and are namespace-clean. The
+ internal header files and the server header files are installed
+ into private directories under <varname>includedir</varname>. See
+ the documentation of each interface for information about how to
+ access its header files. Finally, a private subdirectory will
+ also be created, if appropriate, under <varname>libdir</varname>
+ for dynamically loadable modules.
+ </para>
+ </note>
+ </sect3>
+
+ <sect3 id="configure-pg-features">
+ <title><productname>PostgreSQL</productname> Features</title>
+
+ <para>
+ The options described in this section enable building of
+ various <productname>PostgreSQL</productname> features that are not
+ built by default. Most of these are non-default only because they
+ require additional software, as described in
+ <xref linkend="install-requirements-meson"/>. To specify PostgreSQL
+ specific options, the name of the option should be prefixed by -D.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dnls=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Enables or disables Native Language Support (<acronym>NLS</acronym>),
+ that is, the ability to display a program's messages in a
+ language other than English. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To use this option, you will need an implementation of the
+ <application>Gettext</application> API.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplperl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Perl</application> server-side language. It
+ defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dplpython=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Python</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpltcl=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <application>PL/Tcl</application> server-side language.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtcl_version=<replaceable>TCL_VERSION</replaceable></option></term>
+ <listitem>
+ <para>
+ Specifies the TCL version to use when building PL/Tcl.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dicu=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for
+ the <productname>ICU</productname><indexterm><primary>ICU</primary></indexterm>
+ library, enabling use of ICU collation
+ features<phrase condition="standalone-ignore"> (see
+ <xref linkend="collation"/>)</phrase>.
+ This requires the <productname>ICU4C</productname> package
+ to be installed. The minimum required version
+ of <productname>ICU4C</productname> is currently 4.2.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+
+ <para>
+ By default,
+ <productname>pkg-config</productname><indexterm><primary>pkg-config</primary></indexterm>
+ will be used to find the required compilation options. This is
+ supported for <productname>ICU4C</productname> version 4.6 and later.
+ <!-- Add description for older ICU4C versions and when pkg-config isn't available-->
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="configure-with-llvm-meson">
+ <term><option>-Dllvm=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for <productname>LLVM</productname> based
+ <acronym>JIT</acronym> compilation<phrase
+ condition="standalone-ignore"> (see <xref
+ linkend="jit"/>)</phrase>. This
+ requires the <productname>LLVM</productname> library to be installed.
+ The minimum required version of <productname>LLVM</productname> is
+ currently 3.9. It is set to disabled by default.
+ </para>
+ <para>
+ <command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm>
+ will be used to find the required compilation options.
+ <command>llvm-config</command>, and then
+ <command>llvm-config-$major-$minor</command> for all supported
+ versions, will be searched for in your <envar>PATH</envar>.
+ <!--Add substitute for LLVM_CONFIG when llvm-config is not in PATH-->
+ </para>
+
+ <para>
+ <productname>LLVM</productname> support requires a compatible
+ <command>clang</command> compiler (specified, if necessary, using the
+ <envar>CLANG</envar> environment variable), and a working C++
+ compiler (specified, if necessary, using the <envar>CXX</envar>
+ environment variable).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlz4=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>LZ4</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzstd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <productname>Zstandard</productname> compression support.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dssl=<replaceable>LIBRARY</replaceable></option>
+ <indexterm>
+ <primary>OpenSSL</primary>
+ <seealso>SSL</seealso>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Build with support for <acronym>SSL</acronym> (encrypted)
+ connections. The only <replaceable>LIBRARY</replaceable>
+ supported is <option>openssl</option>. This requires the
+ <productname>OpenSSL</productname> package to be installed.
+ <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenSSL</productname> installation is sufficient
+ before proceeding. The default for this option is none.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dgssapi=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for GSSAPI authentication. On many systems, the
+ GSSAPI system (usually a part of the Kerberos installation) is not
+ installed in a location
+ that is searched by default (e.g., <filename>/usr/include</filename>,
+ <filename>/usr/lib</filename>), so you must use the options
+ <option>-Dextra_include_dirs</option> and <option>-Dextra_lib_dirs</option> in
+ addition to this option. <filename>meson configure</filename> will check
+ for the required header files and libraries to make sure that
+ your GSSAPI installation is sufficient before proceeding.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dldap=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>LDAP</acronym><indexterm><primary>LDAP</primary></indexterm>
+ support for authentication and connection parameter lookup (see
+ <phrase id="install-ldap-links-meson"><xref linkend="libpq-ldap"/> and
+ <xref linkend="auth-ldap"/></phrase> for more information). On Unix,
+ this requires the <productname>OpenLDAP</productname> package to be
+ installed. On Windows, the default <productname>WinLDAP</productname>
+ library is used. <filename>configure</filename> will check for the required
+ header files and libraries to make sure that your
+ <productname>OpenLDAP</productname> installation is sufficient before
+ proceeding. It defaults to auto, meaning that it will be enabled automatically
+ if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dpam=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with <acronym>PAM</acronym><indexterm><primary>PAM</primary></indexterm>
+ (Pluggable Authentication Modules) support. It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbsd_auth=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with BSD Authentication support. (The BSD Authentication framework is
+ currently only available on OpenBSD.) It defaults to auto, meaning that it
+ will be enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystemd=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support
+ for <application>systemd</application><indexterm><primary>systemd</primary></indexterm>
+ service notifications. This improves integration if the server
+ is started under <application>systemd</application> but has no impact
+ otherwise<phrase condition="standalone-ignore">; see <xref linkend="server-start"/> for more
+ information</phrase>. <application>libsystemd</application> and the
+ associated header files need to be installed to use this option.
+ It defaults to auto, meaning that it will be enabled automatically if the
+ required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dbonjour=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with support for Bonjour automatic service discovery.
+ This requires Bonjour support in your operating system.
+ Recommended on macOS. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Duuid=<replaceable>LIBRARY</replaceable></option></term>
+ <listitem>
+ <para>
+ Build the <xref linkend="uuid-ossp"/> module
+ (which provides functions to generate UUIDs), using the specified
+ UUID library.<indexterm><primary>UUID</primary></indexterm>
+ <replaceable>LIBRARY</replaceable> must be one of:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <option>none</option> to not build the ussp module. This is the default.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>bsd</option> to use the UUID functions found in FreeBSD, NetBSD,
+ and some other BSD-derived systems
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>e2fs</option> to use the UUID library created by
+ the <literal>e2fsprogs</literal> project; this library is present in most
+ Linux systems and in macOS, and can be obtained for other
+ platforms as well
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <option>ossp</option> to use the <ulink
+ url="http://www.ossp.org/pkg/lib/uuid/">OSSP UUID library</ulink>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxml=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxml2, enabling SQL/XML support. Libxml2 version 2.6.23 or
+ later is required for this feature. It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+
+ <para>
+ To detect the required compiler and linker options, PostgreSQL will
+ query <command>pkg-config</command>, if that is installed and knows
+ about libxml2. Otherwise the program <command>xml2-config</command>,
+ which is installed by libxml2, will be used if it is found. Use
+ of <command>pkg-config</command> is preferred, because it can deal
+ with multi-architecture installations better.
+ </para>
+
+ <para>
+ To use a libxml2 installation that is in an unusual location, you
+ can set <command>pkg-config</command>-related environment
+ variables (see its documentation).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibxslt=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Build with libxslt, enabling the
+ <xref linkend="xml2"/>
+ module to perform XSL transformations of XML.
+ <option>-Dlibxml</option> must be specified as well.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dreadline=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Allows use of the <application>Readline</application> library
+ (and <application>libedit</application> as well). This option enables
+ command-line editing and history in
+ <application>psql</application> and is strongly recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dlibedit_preferred=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this to true favors the use of the BSD-licensed <application>libedit</application> library
+ rather than GPL-licensed <application>Readline</application>. This option
+ is significant only if you have both libraries installed; the
+ default is false that is to use <application>Readline</application>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dzlib=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>zlib</primary>
+ </indexterm>
+ Enabls use of the <application>Zlib</application> library.
+ This enables
+ support for compressed archives in <application>pg_dump</application>
+ and <application>pg_restore</application> and is recommended.
+ It defaults to auto, meaning that it will be
+ enabled automatically if the required packages are found.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dspinlocks=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true by default and
+ setting it to false will allow the build to succeed even if <productname>PostgreSQL</productname>
+ has no CPU spinlock support for the platform. The lack of
+ spinlock support will result in very poor performance; therefore,
+ this option should only be changed if the build aborts and
+ informs you that the platform lacks spinlock support. If setting this
+ option to false is required to build <productname>PostgreSQL</productname> on
+ your platform, please report the problem to the
+ <productname>PostgreSQL</productname> developers.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Datomics=<replaceable>true/false</replaceable></option></term>
+ <listitem>
+ <para>
+ This option is set to true and setting it to false will
+ disable use of CPU atomic operations. The option does nothing on
+ platforms that lack such operations. On platforms that do have
+ them, disabling atomics will result in poor performance. Changing
+ this option is only useful for debugging or making performance comparisons.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-build-process">
+ <title>Build Process Details</title>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>--auto_features=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ Setting this option allows you to override value of all 'auto' features.
+ This can be useful when you want to disable or enable all the "optional"
+ features at once without having to set each of them manually. The default
+ value for this parameter is auto.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--backend=<replaceable>BACKEND</replaceable></option></term>
+ <listitem>
+ <para>
+ The default backend meson uses is ninja and that should suffice for most use cases.
+ However, if you'd like to fully integrate with visual studio, you can set the
+ BACKEND to <command>vs</command>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C compiler.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dc_link_args=<replaceable>OPTIONS</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to pass extra options to the C linker.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_include_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories that will be added to the list the compiler
+ searches for header files. If you have optional packages
+ (such as GNU <application>Readline</application>) installed in a non-standard
+ location,
+ you have to use this option and probably also the corresponding
+ <option>-Dextra_lib_dirs</option> option.
+ </para>
+ <para>
+ Example: <literal>-Dextra_include_dirs=/opt/gnu/include:/usr/sup/include</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_lib_dirs=<replaceable>DIRECTORIES</replaceable></option></term>
+ <listitem>
+ <para>
+ <replaceable>DIRECTORIES</replaceable> is a colon-separated list of
+ directories to search for libraries. You will probably have
+ to use this option (and the corresponding
+ <option>-Dextra_include_dirs</option> option) if you have packages
+ installed in non-standard locations.
+ </para>
+ <para>
+ Example: <literal>-Dextra_lib_dirs=/opt/gnu/lib:/usr/sup/lib</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dsystem_tzdata=<replaceable>DIRECTORY</replaceable></option>
+ <indexterm>
+ <primary>time zone data</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ <productname>PostgreSQL</productname> includes its own time zone database,
+ which it requires for date and time operations. This time zone
+ database is in fact compatible with the IANA time zone
+ database provided by many operating systems such as FreeBSD,
+ Linux, and Solaris, so it would be redundant to install it again.
+ When this option is used, the system-supplied time zone database
+ in <replaceable>DIRECTORY</replaceable> is used instead of the one
+ included in the PostgreSQL source distribution.
+ <replaceable>DIRECTORY</replaceable> must be specified as an
+ absolute path. <filename>/usr/share/zoneinfo</filename> is a
+ likely directory on some operating systems. Note that the
+ installation routine will not detect mismatching or erroneous time
+ zone data. If you use this option, you are advised to run the
+ regression tests to verify that the time zone data you have
+ pointed to works correctly with <productname>PostgreSQL</productname>.
+ </para>
+
+ <indexterm><primary>cross compilation</primary></indexterm>
+
+ <para>
+ This option is mainly aimed at binary package distributors
+ who know their target operating system well. The main
+ advantage of using this option is that the PostgreSQL package
+ won't need to be upgraded whenever any of the many local
+ daylight-saving time rules change. Another advantage is that
+ PostgreSQL can be cross-compiled more straightforwardly if the
+ time zone database files do not need to be built during the
+ installation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dextra_version=<replaceable>STRING</replaceable></option></term>
+ <listitem>
+ <para>
+ Append <replaceable>STRING</replaceable> to the PostgreSQL version number. You
+ can use this, for example, to mark binaries built from unreleased Git
+ snapshots or containing custom patches with an extra version string,
+ such as a <command>git describe</command> identifier or a
+ distribution package release number.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-D<replaceable>BINARY_NAME</replaceable>=<replaceable>PATH</replaceable></option></term>
+ <listitem>
+ <para>
+ If you have the binaries for certain by programs required to build
+ Postgres (with or without optional flags) stored at non-standard
+ paths, you could specify them manually to meson configure. The complete
+ list of programs for whom this is supported can be found by running
+ <literal>meson configure</literal>. An example is included below.
+<programlisting>meson configure -DBISON=PATH_TO_BISON</programlisting>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-layout">
+ <title>Data layout</title>
+
+ <para>
+ These options affect how PostgreSQL lays out data on disk.
+ Note that changing these breaks on-disk database compatibility,
+ meaning you cannot use <command>pg_upgrade</command> to upgrade to
+ a build with a different value of these options.
+ </para>
+
+ <variablelist>
+
+ <varlistentry>
+ <term><option>-Dsegsize=<replaceable>SEGSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>segment size</firstterm>, in gigabytes. Large tables are
+ divided into multiple operating-system files, each of size equal
+ to the segment size. This avoids problems with file size limits
+ that exist on many platforms. The default segment size, 1 gigabyte,
+ is safe on all supported platforms. If your operating system has
+ <quote>largefile</quote> support (which most do, nowadays), you can use
+ a larger segment size. This can be helpful to reduce the number of
+ file descriptors consumed when working with very large tables.
+ But be careful not to select a value larger than is supported
+ by your platform and the file systems you intend to use. Other
+ tools you might wish to use, such as <application>tar</application>, could
+ also set limits on the usable file size.
+ It is recommended, though not absolutely required, that this value
+ be a power of 2.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dblocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within tables. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 32 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dwal_blocksize=<replaceable>BLOCKSIZE</replaceable></option></term>
+ <listitem>
+ <para>
+ Set the <firstterm>WAL block size</firstterm>, in kilobytes. This is the unit
+ of storage and I/O within the WAL log. The default, 8 kilobytes,
+ is suitable for most situations; but other values may be useful
+ in special cases.
+ The value must be a power of 2 between 1 and 64 (kilobytes).
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-devel">
+ <title>Developer Options</title>
+
+ <para>
+ Most of the options in this section are only of interest for
+ developing or debugging <productname>PostgreSQL</productname>.
+ They are not recommended for production builds, except
+ for <option>--debug</option>, which can be useful to enable
+ detailed bug reports in the unlucky event that you encounter a bug.
+ On platforms supporting DTrace, <option>-Ddtrace</option>
+ may also be reasonable to use in production.
+ </para>
+
+ <para>
+ When building an installation that will be used to develop code inside
+ the server, it is recommended to use at least the <option>--buildtype=debug</option>
+ and <option>-Dcassert</option> options.
+ </para>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--buildtype=<replaceable>BUILDTYPE</replaceable></option></term>
+ <listitem>
+ <para>
+ This option can be used to specify the buildtype to use; defaults
+ to release. If you'd like finer control on the debug symbols
+ and optimization levels than what this option provides, you can
+ refer to the --debug and --optimization flags.
+
+ The following build types are generally used:
+ <variablelist>
+ <varlistentry>
+ <term><literal>plain</literal></term>
+ <listitem>
+ <para>
+ No extra build flags are used, even for compiler warnings,
+ useful for distro packagers and other cases where you need to
+ specify all arguments by yourself.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debug</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated but the result is not optimized.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>debugoptimized</literal></term>
+ <listitem>
+ <para>
+ Debug info is generated and the code is optimized (on most compilers
+ this means <literal>-g -O2</literal>)
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>release</literal></term>
+ <listitem>
+ <para>
+ This enables full optimization and no debug info is generated. This is
+ the default.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--debug</option></term>
+ <listitem>
+ <para>
+ Compiles all programs and libraries with debugging symbols.
+ This means that you can run the programs in a debugger
+ to analyze problems. This enlarges the size of the installed
+ executables considerably, and on non-GCC compilers it usually
+ also disables compiler optimization, causing slowdowns. However,
+ having the symbols available is extremely helpful for dealing
+ with any problems that might arise. Currently, this option is
+ recommended for production installations only if you use GCC.
+ But you should always have it on if you are doing development work
+ or running a beta version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--optimization</option>=<replaceable>LEVEL</replaceable></term>
+ <listitem>
+ <para>
+ Specify the optimization level. LEVEL can be set to any of {0,g,1,2,3,s}.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--werror</option></term>
+ <listitem>
+ <para>
+ Setting this option asks the compiler to treat warnings as errors. This can
+ be useful for code development purposes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dcassert</option></term>
+ <listitem>
+ <para>
+ Enables <firstterm>assertion</firstterm> checks in the server, which test for
+ many <quote>cannot happen</quote> conditions. This is invaluable for
+ code development purposes, but the tests can slow down the
+ server significantly.
+ Also, having the tests turned on won't necessarily enhance the
+ stability of your server! The assertion checks are not categorized
+ for severity, and so what might be a relatively harmless bug will
+ still lead to server restarts if it triggers an assertion
+ failure. This option is not recommended for production use, but
+ you should have it on for development work or when running a beta
+ version.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dtap-tests</option></term>
+ <listitem>
+ <para>
+ Enable tests using the Perl TAP tools. This requires a Perl
+ installation and the Perl module <literal>IPC::Run</literal>.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-tap"/> for more information.</phrase>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-DPG_TEST_EXTRA=<replaceable>TEST_SUITES</replaceable></option></term>
+ <listitem>
+ <para>
+ Enable test suites which require special software to run. This option
+ accepts arguments via a whitespace-separated list. The following values
+ are currently supported:
+ <variablelist>
+ <varlistentry>
+ <term><literal>kerberos</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/kerberos</filename>. This
+ requires an MIT Kerberos installation and opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ldap</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ldap</filename>. This
+ requires an <productname>OpenLDAP</productname> installation and opens
+ TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>ssl</literal></term>
+ <listitem>
+ <para>
+ Runs the test suite under <filename>src/test/ssl</filename>. This opens TCP/IP listen sockets.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><literal>wal_consistency_checking</literal></term>
+ <listitem>
+ <para>
+ Uses <literal>wal_consistency_checking=all</literal> while running
+ certain tests under <filename>src/test/recovery</filename>. Not
+ enabled by default because it is resource intensive.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ Tests for features that are not supported by the current build
+ configuration are not run even if they are mentioned in
+ <varname>PG_TEST_EXTRA</varname>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--errorlogs</option></term>
+ <listitem>
+ <para>
+ This option can be used to print the logs from the failing tests
+ making debugging easier.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Db_coverage</option></term>
+ <listitem>
+ <para>
+ If using GCC, all programs and libraries are compiled with
+ code coverage testing instrumentation. When run, they
+ generate files in the build directory with code coverage
+ metrics.
+ <phrase condition="standalone-ignore">See <xref linkend="regress-coverage"/>
+ for more information.</phrase> This option is for use only with GCC
+ and when doing development work.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Ddtrace=<replaceable>auto/enabled/disabled</replaceable></option></term>
+ <listitem>
+ <para>
+ <indexterm>
+ <primary>DTrace</primary>
+ </indexterm>
+ Enabling this compiles <productname>PostgreSQL</productname> with support for the
+ dynamic tracing tool DTrace.
+ <phrase condition="standalone-ignore">See <xref linkend="dynamic-trace"/>
+ for more information.</phrase>
+ </para>
+
+ <para>
+ To point to the <command>dtrace</command> program, the
+ environment variable <envar>DTRACE</envar> can be set. This
+ will often be necessary because <command>dtrace</command> is
+ typically installed under <filename>/usr/sbin</filename>,
+ which might not be in your <envar>PATH</envar>.
+ </para>
+
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ <sect3 id="configure-misc">
+ <title>Miscellaneous</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>-Dpgport=<replaceable>NUMBER</replaceable></option></term>
+ <listitem>
+ <para>
+ Set <replaceable>NUMBER</replaceable> as the 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
+ <productname>PostgreSQL</productname> servers on the same machine.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>-Dkrb_srvnam=<replaceable>NAME</replaceable></option></term>
+ <listitem>
+ <para>
+ The default name of the Kerberos service principal used
+ by GSSAPI.
+ <literal>postgres</literal> is the default. There's usually no
+ reason to change this unless you are building for a Windows
+ environment, in which case it must be set to upper case
+ <literal>POSTGRES</literal>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </sect3>
+
+ </sect2>
+
+ <sect2 id="build-meson">
+ <title>Building the source</title>
+ <para>
+ By default, <productname>Meson</productname> uses the
+ <ulink url="https://ninja-build.org/"> Ninja build system</ulink>.
+ To build <productname>PostgreSQL</productname> from source using meson, you can
+ simply use the <literal>ninja</literal> command in the build directory.
+<screen>
+ninja
+</screen>
+ Ninja will automatically detect the number of CPUs in your computer and
+ parallelize itself accordingly. You can override the amount of parallel
+ processes used with the command line argument <literal>-j</literal>.
+ </para>
+
+ <para>
+ It should be noted that after the initial configure step
+ <command>ninja</command> is the only command you ever need to type to
+ compile. No matter how you alter your source tree (short of moving it to
+ a completely new location), Meson will detect the changes and regenerate
+ itself accordingly. This is especially handy if you have multiple build
+ directories. Often one of them is used for development (the "debug" build)
+ and others only every now and then (such as a "static analysis" build).
+ Any configuration can be built just by cd'ing to the corresponding directory
+ and running Ninja.
+ </para>
+
+ <para>
+ If you'd like to build with a backend other that ninja, you can use configure
+ with the <option>--backend</option> option to select the one you want to use and then
+ build using <literal>meson compile</literal>. To learn more about these
+ backends and other arguments you can provide to ninja, you can refer to the
+ meson <ulink url="https://mesonbuild.com/Running-Meson.html#building-from-the-source">
+ documentation</ulink>.
+ </para>
+ </sect2>
+
+ <sect2 id="install-files-meson">
+ <title>Installing the files</title>
+ <para>
+ Once Postgres is built, you can install it by simply running the
+ <literal>ninja install</literal> command.
+
+<screen>
+ninja install
+</screen>
+ </para>
+
+ <para>
+ This will install files into the directories that were specified
+ in <xref linkend="configure-meson"/>. Make sure that you have appropriate
+ permissions to write into that area. You might need to do this
+ step as root. Alternatively, you can create the target directories
+ in advance and arrange for appropriate permissions to be granted.
+ The standard installation provides all the header files needed for client
+ application development as well as for server-side program
+ development, such as custom functions or data types written in C.
+ </para>
+
+ <para>
+ <literal>ninja install</literal> should work for most cases
+ but if you'd like to use more options, you could also use
+ <literal>meson install</literal> instead. You can learn more about
+ <ulink url="https://mesonbuild.com/Commands.html#install">meson install</ulink>
+ and it's options in the meson documentation.
+ </para>
+
+ <para>
+ Depending on your platform and setup, you might have to perform a
+ few steps after installation. Those are outlined in
+ <xref linkend="install-post"/>.
+ </para>
+
+ <formalpara>
+ <title>Uninstallation:</title>
+ <para>
+ To undo the installation, you can use the <command>ninja
+ uninstall</command> command.
+ </para>
+ </formalpara>
+
+ <formalpara>
+ <title>Cleaning:</title>
+ <para>
+ After the installation you can free disk space by removing the built
+ files from the source tree with the <command>ninja clean</command>
+ command.
+ </para>
+ </formalpara>
+
+ </sect2>
+
+ <sect2 id="running-tests">
+ <title>Running tests</title>
+ <para>
+ If you want to test the newly built server, you can run the regression
+ tests. The regression tests are a collection of test suites to verify
+ that <productname>PostgreSQL</productname> runs on your machine in
+ the way the developers expected it to. To run them, simply type:
+<screen>
+<userinput>meson test</userinput>
+</screen>
+ You can repeat this at any later time by issuing the same command.
+ </para>
+
+ <para>Meson also allows you to list tests and run specific tests or suites.
+<screen>
+# List all tests
+<userinput>meson test --list</userinput>
+
+# Run a specific test
+<userinput>meson test recovery/001_stream_rep</userinput>
+
+# Run the main pg_regress and isolation tests
+<userinput>meson test --suite main</userinput>
+</screen>
+ </para>
+
+ <para>
+ To learn more about running the tests and how to interpret the results
+ you can refer to the documentation for interpreting test results.
+ <literal>meson test</literal> also provides a number of additional
+ options you can use which can be found in the
+ <ulink url="https://mesonbuild.com/Unit-tests.html#testing-tool">meson test documentation</ulink>.
+ </para>
+
+ </sect2>
+
+ </sect1>
+
<sect1 id="install-post">
<title>Post-Installation Setup</title>
@@ -2106,62 +3797,6 @@ export MANPATH
</sect2>
</sect1>
- <sect1 id="supported-platforms">
- <title>Supported Platforms</title>
-
- <para>
- A platform (that is, a CPU architecture and operating system combination)
- is considered supported by the <productname>PostgreSQL</productname> development
- community if the code contains provisions to work on that platform and
- it has recently been verified to build and pass its regression tests
- on that platform. Currently, most testing of platform compatibility
- is done automatically by test machines in the
- <ulink url="https://buildfarm.postgresql.org/">PostgreSQL Build Farm</ulink>.
- If you are interested in using <productname>PostgreSQL</productname> on a platform
- that is not represented in the build farm, but on which the code works
- or can be made to work, you are strongly encouraged to set up a build
- farm member machine so that continued compatibility can be assured.
- </para>
-
- <para>
- In general, <productname>PostgreSQL</productname> can be expected to work on
- these CPU architectures: x86, PowerPC, S/390, SPARC, ARM, MIPS, RISC-V,
- and PA-RISC, including
- big-endian, little-endian, 32-bit, and 64-bit variants where applicable.
- It is often
- possible to build on an unsupported CPU type by configuring with
- <option>--disable-spinlocks</option>, but performance will be poor.
- </para>
-
- <para>
- <productname>PostgreSQL</productname> can be expected to work on current
- versions of these operating systems: Linux, Windows,
- FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, macOS, AIX, Solaris, and illumos.
- Other Unix-like systems may also work but are not currently
- being tested. In most cases, all CPU architectures supported by
- a given operating system will work. Look in
- <xref linkend="installation-platform-notes"/> below to see if
- there is information
- specific to your operating system, particularly if using an older system.
- </para>
-
- <para>
- If you have installation problems on a platform that is known
- to be supported according to recent build farm results, please report
- it to <email>pgsql-bugs@lists.postgresql.org</email>. If you are interested
- in porting <productname>PostgreSQL</productname> to a new platform,
- <email>pgsql-hackers@lists.postgresql.org</email> is the appropriate place
- to discuss that.
- </para>
-
- <para>
- Historical versions of <productname>PostgreSQL</productname> or POSTGRES
- also ran on CPU architectures including Alpha, Itanium, M32R, M68K,
- M88K, NS32K, SuperH, and VAX, and operating systems including 4.3BSD, BEOS,
- BSD/OS, DG/UX, Dynix, HP-UX, IRIX, NeXTSTEP, QNX, SCO, SINIX, Sprite, SunOS,
- Tru64 UNIX, and ULTRIX.
- </para>
- </sect1>
<sect1 id="installation-platform-notes">
<title>Platform-Specific Notes</title>
@@ -2170,7 +3805,7 @@ export MANPATH
This section documents additional platform-specific issues
regarding the installation and setup of PostgreSQL. Be sure to
read the installation instructions, and in
- particular <xref linkend="install-requirements"/> as well. Also,
+ particular <xref linkend="install-requirements-make"/> as well. Also,
check <xref linkend="regress"/> regarding the
interpretation of regression test results.
</para>
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 1d9509a2f66..214e1b1d551 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -7072,7 +7072,7 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
explicitly tell the configure script to make the probes available
in <productname>PostgreSQL</productname>. To include DTrace support
specify <option>--enable-dtrace</option> to configure. See <xref
- linkend="install-procedure"/> for further information.
+ linkend="configure-options-devel"/> for further information.
</para>
</sect2>
diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml
index f268265a838..7a1d220175b 100644
--- a/doc/src/sgml/runtime.sgml
+++ b/doc/src/sgml/runtime.sgml
@@ -1855,7 +1855,7 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
<step>
<para>
Install the new version of <productname>PostgreSQL</productname> as
- outlined in <xref linkend="install-procedure"/>.
+ outlined in <xref linkend="installation"/>.
</para>
</step>
diff --git a/doc/src/sgml/sourcerepo.sgml b/doc/src/sgml/sourcerepo.sgml
index 0ed7f8a3fea..f16be29a61a 100644
--- a/doc/src/sgml/sourcerepo.sgml
+++ b/doc/src/sgml/sourcerepo.sgml
@@ -20,9 +20,10 @@
Note that building <productname>PostgreSQL</productname> from the source
repository requires reasonably up-to-date versions of <application>bison</application>,
<application>flex</application>, and <application>Perl</application>. These tools are not needed
- to build from a distribution tarball, because the files that these tools
+ to build from a distribution tarball if building via make, because the files that these tools
are used to build are included in the tarball. Other tool requirements
- are the same as shown in <xref linkend="install-requirements"/>.
+ are the same as shown in <xref linkend="install-requirements-make"/> and
+ <xref linkend="install-requirements-meson"/>.
</para>
<sect1 id="git">
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0008-autoconf-Unify-CFLAGS_SSE42-and-CFLAGS_ARMV8_CRC.patch (9.2K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/9-v17-0008-autoconf-Unify-CFLAGS_SSE42-and-CFLAGS_ARMV8_CRC.patch)
download | inline diff:
From a3876636373c64e4192e2fa571523da6431004c4 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 14:05:10 -0700
Subject: [PATCH v17 08/23] autoconf: Unify CFLAGS_SSE42 and
CFLAGS_ARMV8_CRC32C
There's no need for two different set of flags, as we'll only ever run on a
one architecture at a time... Simplifies meson PGXS compatibility.
---
src/port/Makefile | 16 ++++++++--------
config/c-compiler.m4 | 8 ++++----
configure | 19 +++++++++----------
configure.ac | 10 +++++-----
src/Makefile.global.in | 3 +--
5 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/src/port/Makefile b/src/port/Makefile
index b3754d8940a..711f59e32bd 100644
--- a/src/port/Makefile
+++ b/src/port/Makefile
@@ -88,15 +88,15 @@ libpgport.a: $(OBJS)
thread.o: CFLAGS+=$(PTHREAD_CFLAGS)
thread_shlib.o: CFLAGS+=$(PTHREAD_CFLAGS)
-# all versions of pg_crc32c_sse42.o need CFLAGS_SSE42
-pg_crc32c_sse42.o: CFLAGS+=$(CFLAGS_SSE42)
-pg_crc32c_sse42_shlib.o: CFLAGS+=$(CFLAGS_SSE42)
-pg_crc32c_sse42_srv.o: CFLAGS+=$(CFLAGS_SSE42)
+# all versions of pg_crc32c_sse42.o need CFLAGS_CRC
+pg_crc32c_sse42.o: CFLAGS+=$(CFLAGS_CRC)
+pg_crc32c_sse42_shlib.o: CFLAGS+=$(CFLAGS_CRC)
+pg_crc32c_sse42_srv.o: CFLAGS+=$(CFLAGS_CRC)
-# all versions of pg_crc32c_armv8.o need CFLAGS_ARMV8_CRC32C
-pg_crc32c_armv8.o: CFLAGS+=$(CFLAGS_ARMV8_CRC32C)
-pg_crc32c_armv8_shlib.o: CFLAGS+=$(CFLAGS_ARMV8_CRC32C)
-pg_crc32c_armv8_srv.o: CFLAGS+=$(CFLAGS_ARMV8_CRC32C)
+# all versions of pg_crc32c_armv8.o need CFLAGS_CRC
+pg_crc32c_armv8.o: CFLAGS+=$(CFLAGS_CRC)
+pg_crc32c_armv8_shlib.o: CFLAGS+=$(CFLAGS_CRC)
+pg_crc32c_armv8_srv.o: CFLAGS+=$(CFLAGS_CRC)
#
# Shared library versions of object files
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 000b075312e..eb8cc8ce170 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -597,7 +597,7 @@ fi])# PGAC_HAVE_GCC__ATOMIC_INT64_CAS
# the other ones are, on x86-64 platforms)
#
# An optional compiler flag can be passed as argument (e.g. -msse4.2). If the
-# intrinsics are supported, sets pgac_sse42_crc32_intrinsics, and CFLAGS_SSE42.
+# intrinsics are supported, sets pgac_sse42_crc32_intrinsics, and CFLAGS_CRC.
AC_DEFUN([PGAC_SSE42_CRC32_INTRINSICS],
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_sse42_crc32_intrinsics_$1])])dnl
AC_CACHE_CHECK([for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=$1], [Ac_cachevar],
@@ -613,7 +613,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <nmmintrin.h>],
[Ac_cachevar=no])
CFLAGS="$pgac_save_CFLAGS"])
if test x"$Ac_cachevar" = x"yes"; then
- CFLAGS_SSE42="$1"
+ CFLAGS_CRC="$1"
pgac_sse42_crc32_intrinsics=yes
fi
undefine([Ac_cachevar])dnl
@@ -629,7 +629,7 @@ undefine([Ac_cachevar])dnl
#
# An optional compiler flag can be passed as argument (e.g.
# -march=armv8-a+crc). If the intrinsics are supported, sets
-# pgac_armv8_crc32c_intrinsics, and CFLAGS_ARMV8_CRC32C.
+# pgac_armv8_crc32c_intrinsics, and CFLAGS_CRC.
AC_DEFUN([PGAC_ARMV8_CRC32C_INTRINSICS],
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_armv8_crc32c_intrinsics_$1])])dnl
AC_CACHE_CHECK([for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=$1], [Ac_cachevar],
@@ -647,7 +647,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <arm_acle.h>],
[Ac_cachevar=no])
CFLAGS="$pgac_save_CFLAGS"])
if test x"$Ac_cachevar" = x"yes"; then
- CFLAGS_ARMV8_CRC32C="$1"
+ CFLAGS_CRC="$1"
pgac_armv8_crc32c_intrinsics=yes
fi
undefine([Ac_cachevar])dnl
diff --git a/configure b/configure
index 1caca21b625..80b28cb9310 100755
--- a/configure
+++ b/configure
@@ -645,8 +645,7 @@ MSGMERGE
MSGFMT_FLAGS
MSGFMT
PG_CRC32C_OBJS
-CFLAGS_ARMV8_CRC32C
-CFLAGS_SSE42
+CFLAGS_CRC
LIBOBJS
ZSTD
LZ4
@@ -17815,7 +17814,7 @@ fi
#
# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
# with the default compiler flags. If not, check if adding the -msse4.2
-# flag helps. CFLAGS_SSE42 is set to -msse4.2 if that's required.
+# flag helps. CFLAGS_CRC is set to -msse4.2 if that's required.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=" >&5
$as_echo_n "checking for _mm_crc32_u8 and _mm_crc32_u32 with CFLAGS=... " >&6; }
if ${pgac_cv_sse42_crc32_intrinsics_+:} false; then :
@@ -17850,7 +17849,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_sse42_crc32_intrinsics_" >&5
$as_echo "$pgac_cv_sse42_crc32_intrinsics_" >&6; }
if test x"$pgac_cv_sse42_crc32_intrinsics_" = x"yes"; then
- CFLAGS_SSE42=""
+ CFLAGS_CRC=""
pgac_sse42_crc32_intrinsics=yes
fi
@@ -17889,13 +17888,12 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_sse42_crc32_intrinsics__msse4_2" >&5
$as_echo "$pgac_cv_sse42_crc32_intrinsics__msse4_2" >&6; }
if test x"$pgac_cv_sse42_crc32_intrinsics__msse4_2" = x"yes"; then
- CFLAGS_SSE42="-msse4.2"
+ CFLAGS_CRC="-msse4.2"
pgac_sse42_crc32_intrinsics=yes
fi
fi
-
# Are we targeting a processor that supports SSE 4.2? gcc, clang and icc all
# define __SSE4_2__ in that case.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -17922,7 +17920,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
#
# First check if __crc32c* intrinsics can be used with the default compiler
# flags. If not, check if adding -march=armv8-a+crc flag helps.
-# CFLAGS_ARMV8_CRC32C is set if the extra flag is required.
+# CFLAGS_CRC is set if the extra flag is required.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=" >&5
$as_echo_n "checking for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=... " >&6; }
if ${pgac_cv_armv8_crc32c_intrinsics_+:} false; then :
@@ -17959,7 +17957,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_armv8_crc32c_intrinsics_" >&5
$as_echo "$pgac_cv_armv8_crc32c_intrinsics_" >&6; }
if test x"$pgac_cv_armv8_crc32c_intrinsics_" = x"yes"; then
- CFLAGS_ARMV8_CRC32C=""
+ CFLAGS_CRC=""
pgac_armv8_crc32c_intrinsics=yes
fi
@@ -18000,13 +17998,14 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" >&5
$as_echo "$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" >&6; }
if test x"$pgac_cv_armv8_crc32c_intrinsics__march_armv8_apcrc" = x"yes"; then
- CFLAGS_ARMV8_CRC32C="-march=armv8-a+crc"
+ CFLAGS_CRC="-march=armv8-a+crc"
pgac_armv8_crc32c_intrinsics=yes
fi
fi
+
# Select CRC-32C implementation.
#
# If we are targeting a processor that has Intel SSE 4.2 instructions, we can
@@ -18034,7 +18033,7 @@ if test x"$USE_SLICING_BY_8_CRC32C" = x"" && test x"$USE_SSE42_CRC32C" = x"" &&
USE_SSE42_CRC32C_WITH_RUNTIME_CHECK=1
else
# Use ARM CRC Extension if available.
- if test x"$pgac_armv8_crc32c_intrinsics" = x"yes" && test x"$CFLAGS_ARMV8_CRC32C" = x""; then
+ if test x"$pgac_armv8_crc32c_intrinsics" = x"yes" && test x"$CFLAGS_CRC" = x""; then
USE_ARMV8_CRC32C=1
else
# ARM CRC Extension, with runtime check?
diff --git a/configure.ac b/configure.ac
index 10fa55dd154..f837a602d01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2086,12 +2086,11 @@ fi
#
# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
# with the default compiler flags. If not, check if adding the -msse4.2
-# flag helps. CFLAGS_SSE42 is set to -msse4.2 if that's required.
+# flag helps. CFLAGS_CRC is set to -msse4.2 if that's required.
PGAC_SSE42_CRC32_INTRINSICS([])
if test x"$pgac_sse42_crc32_intrinsics" != x"yes"; then
PGAC_SSE42_CRC32_INTRINSICS([-msse4.2])
fi
-AC_SUBST(CFLAGS_SSE42)
# Are we targeting a processor that supports SSE 4.2? gcc, clang and icc all
# define __SSE4_2__ in that case.
@@ -2105,12 +2104,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
#
# First check if __crc32c* intrinsics can be used with the default compiler
# flags. If not, check if adding -march=armv8-a+crc flag helps.
-# CFLAGS_ARMV8_CRC32C is set if the extra flag is required.
+# CFLAGS_CRC is set if the extra flag is required.
PGAC_ARMV8_CRC32C_INTRINSICS([])
if test x"$pgac_armv8_crc32c_intrinsics" != x"yes"; then
PGAC_ARMV8_CRC32C_INTRINSICS([-march=armv8-a+crc])
fi
-AC_SUBST(CFLAGS_ARMV8_CRC32C)
+
+AC_SUBST(CFLAGS_CRC)
# Select CRC-32C implementation.
#
@@ -2139,7 +2139,7 @@ if test x"$USE_SLICING_BY_8_CRC32C" = x"" && test x"$USE_SSE42_CRC32C" = x"" &&
USE_SSE42_CRC32C_WITH_RUNTIME_CHECK=1
else
# Use ARM CRC Extension if available.
- if test x"$pgac_armv8_crc32c_intrinsics" = x"yes" && test x"$CFLAGS_ARMV8_CRC32C" = x""; then
+ if test x"$pgac_armv8_crc32c_intrinsics" = x"yes" && test x"$CFLAGS_CRC" = x""; then
USE_ARMV8_CRC32C=1
else
# ARM CRC Extension, with runtime check?
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index d8ea2da583c..c87b6d97ca9 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -262,8 +262,7 @@ CFLAGS_SL_MODULE = @CFLAGS_SL_MODULE@
CXXFLAGS_SL_MODULE = @CXXFLAGS_SL_MODULE@
CFLAGS_UNROLL_LOOPS = @CFLAGS_UNROLL_LOOPS@
CFLAGS_VECTORIZE = @CFLAGS_VECTORIZE@
-CFLAGS_SSE42 = @CFLAGS_SSE42@
-CFLAGS_ARMV8_CRC32C = @CFLAGS_ARMV8_CRC32C@
+CFLAGS_CRC = @CFLAGS_CRC@
PERMIT_DECLARATION_AFTER_STATEMENT = @PERMIT_DECLARATION_AFTER_STATEMENT@
CXXFLAGS = @CXXFLAGS@
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0009-autoconf-Rely-on-ar-supporting-index-creation.patch (9.3K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/10-v17-0009-autoconf-Rely-on-ar-supporting-index-creation.patch)
download | inline diff:
From 87f4e70d0e4c843d444c2353ed610e298e79f718 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 14:16:20 -0700
Subject: [PATCH v17 09/23] autoconf: Rely on ar supporting index creation
This way we don't need RANLIB anymore, making it a bit simpler to for the
meson build to generate Makefile.global for PGXS compatibility.
FreeBSD, NetBSD, OpenBSD, the only platforms were we didn't use AROPT=crs, all
have supported the 's' option for a long time.
On macOS we ran ranlib after installing a static library. This was added a
long time ago, in 58ad65ec2def. I cannot reproduce an issue in more recent
macOS versions.
---
src/makefiles/Makefile.aix | 3 --
src/makefiles/Makefile.cygwin | 2 -
src/makefiles/Makefile.darwin | 2 -
src/makefiles/Makefile.freebsd | 2 -
src/makefiles/Makefile.linux | 2 -
src/makefiles/Makefile.netbsd | 2 -
src/makefiles/Makefile.openbsd | 2 -
src/makefiles/Makefile.solaris | 2 -
src/makefiles/Makefile.win32 | 2 -
configure | 93 ----------------------------------
configure.ac | 1 -
src/Makefile.global.in | 2 +-
src/Makefile.shlib | 11 ----
13 files changed, 1 insertion(+), 125 deletions(-)
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index 56d7f22aff6..dd16a7a0378 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -2,9 +2,6 @@
# symbol names to tell them what to export/import.
MAKE_EXPORTS= true
-RANLIB= touch
-AROPT = crs
-
# -blibpath must contain ALL directories where we should look for libraries
libpath := $(shell echo $(subst -L,:,$(filter -L/%,$(LDFLAGS))) | sed -e's/ //g'):/usr/lib:/lib
diff --git a/src/makefiles/Makefile.cygwin b/src/makefiles/Makefile.cygwin
index 6afa9a06a1b..77593972638 100644
--- a/src/makefiles/Makefile.cygwin
+++ b/src/makefiles/Makefile.cygwin
@@ -10,8 +10,6 @@ endif
# (see http://sources.redhat.com/cygwin/faq/faq.html#SEC110)
LIBS:=$(filter-out -lm -lc, $(LIBS))
-AROPT = crs
-
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
ifneq (,$(findstring backend,$(subdir)))
diff --git a/src/makefiles/Makefile.darwin b/src/makefiles/Makefile.darwin
index 45f253a5b43..7095f66e25c 100644
--- a/src/makefiles/Makefile.darwin
+++ b/src/makefiles/Makefile.darwin
@@ -1,5 +1,3 @@
-AROPT = crs
-
# env var name to use in place of LD_LIBRARY_PATH
ld_library_path_var = DYLD_LIBRARY_PATH
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
index 0e77616b0f9..db74a21568c 100644
--- a/src/makefiles/Makefile.freebsd
+++ b/src/makefiles/Makefile.freebsd
@@ -1,5 +1,3 @@
-AROPT = cr
-
export_dynamic = -Wl,-export-dynamic
rpath = -Wl,-R'$(rpathdir)'
diff --git a/src/makefiles/Makefile.linux b/src/makefiles/Makefile.linux
index 1ffec9d1698..5a9451371ab 100644
--- a/src/makefiles/Makefile.linux
+++ b/src/makefiles/Makefile.linux
@@ -1,5 +1,3 @@
-AROPT = crs
-
export_dynamic = -Wl,-E
# Use --enable-new-dtags to generate DT_RUNPATH instead of DT_RPATH.
# This allows LD_LIBRARY_PATH to still work when needed.
diff --git a/src/makefiles/Makefile.netbsd b/src/makefiles/Makefile.netbsd
index 421b735e407..4f8e9ec2521 100644
--- a/src/makefiles/Makefile.netbsd
+++ b/src/makefiles/Makefile.netbsd
@@ -1,5 +1,3 @@
-AROPT = cr
-
export_dynamic = -Wl,-E
rpath = -Wl,-R'$(rpathdir)'
diff --git a/src/makefiles/Makefile.openbsd b/src/makefiles/Makefile.openbsd
index 421b735e407..4f8e9ec2521 100644
--- a/src/makefiles/Makefile.openbsd
+++ b/src/makefiles/Makefile.openbsd
@@ -1,5 +1,3 @@
-AROPT = cr
-
export_dynamic = -Wl,-E
rpath = -Wl,-R'$(rpathdir)'
diff --git a/src/makefiles/Makefile.solaris b/src/makefiles/Makefile.solaris
index acdf44cc0f2..3de73ebc010 100644
--- a/src/makefiles/Makefile.solaris
+++ b/src/makefiles/Makefile.solaris
@@ -1,6 +1,4 @@
# src/makefiles/Makefile.solaris
-
-AROPT = crs
rpath = -Wl,-rpath,'$(rpathdir)'
ifeq ($(with_gnu_ld), yes)
diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
index d268b3ebafd..dc1aafa115a 100644
--- a/src/makefiles/Makefile.win32
+++ b/src/makefiles/Makefile.win32
@@ -10,8 +10,6 @@ endif
override CPPFLAGS += -DWIN32_STACK_RLIMIT=$(WIN32_STACK_RLIMIT)
-AROPT = crs
-
ifneq (,$(findstring backend,$(subdir)))
ifeq (,$(findstring conversion_procs,$(subdir)))
ifeq (,$(findstring libpqwalreceiver,$(subdir)))
diff --git a/configure b/configure
index 80b28cb9310..d338ae2cc8b 100755
--- a/configure
+++ b/configure
@@ -691,7 +691,6 @@ AR
STRIP_SHARED_LIB
STRIP_STATIC_LIB
STRIP
-RANLIB
with_gnu_ld
LD
LDFLAGS_SL
@@ -9465,98 +9464,6 @@ with_gnu_ld=$ac_cv_prog_gnu_ld
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
diff --git a/configure.ac b/configure.ac
index f837a602d01..66c60974ef9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1129,7 +1129,6 @@ AC_ARG_VAR(LDFLAGS_SL, [extra linker flags for linking shared libraries only])
PGAC_PROG_LD
AC_SUBST(LD)
AC_SUBST(with_gnu_ld)
-AC_PROG_RANLIB
PGAC_CHECK_STRIP
AC_CHECK_TOOL(AR, ar, ar)
if test "$PORTNAME" = "win32"; then
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index c87b6d97ca9..a5e2f36d217 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -283,6 +283,7 @@ ZIC = @ZIC@
# Linking
AR = @AR@
+AROPT = crs
LIBS = @LIBS@
LDAP_LIBS_FE = @LDAP_LIBS_FE@
LDAP_LIBS_BE = @LDAP_LIBS_BE@
@@ -317,7 +318,6 @@ LDFLAGS_EX = @LDFLAGS_EX@
LDFLAGS_SL += @LDFLAGS_SL@
LDREL = -r
LDOUT = -o
-RANLIB = @RANLIB@
WINDRES = @WINDRES@
X = @EXEEXT@
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index db466b3b845..fd0909b95df 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -251,17 +251,10 @@ all-static-lib: $(stlib)
all-shared-lib: $(shlib)
-# In this rule, "touch $@" works around a problem on some platforms wherein
-# ranlib updates the library file's mod time with a value calculated to
-# seconds precision. If the filesystem has sub-second timestamps, this can
-# cause the library file to appear older than its input files, triggering
-# parallel-make problems.
ifndef haslibarule
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
rm -f $@
$(LINK.static) $@ $^
- $(RANLIB) $@
- touch $@
endif #haslibarule
# AIX wraps shared libraries inside a static library, can be used both
@@ -394,10 +387,6 @@ install-lib-pc: lib$(NAME).pc installdirs-lib
install-lib-static: $(stlib) installdirs-lib
$(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/$(stlib)'
-ifeq ($(PORTNAME), darwin)
- cd '$(DESTDIR)$(libdir)' && \
- $(RANLIB) $(stlib)
-endif
install-lib-shared: $(shlib) installdirs-lib
ifdef soname
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0010-aix-Build-SUBSYS.o-using-CC-r-instead-of-LD-r.patch (2.9K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/11-v17-0010-aix-Build-SUBSYS.o-using-CC-r-instead-of-LD-r.patch)
download | inline diff:
From 13be39982f12f79fb7ec54d2202885d268fdf090 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 14:42:01 -0700
Subject: [PATCH v17 10/23] aix: Build SUBSYS.o using $(CC) -r instead of $(LD)
-r
This is the only direct use of $(LD), and xlc -r and gcc -r end up with the
same set of symbols and similar performance (noise is high, so hard to say if
equivalent).
Now that $(LD) isn't needed anymore, remove it from src/Makefile.global
While at it, add a comment why -r is used.
Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
---
src/backend/Makefile | 4 +++-
configure | 2 --
configure.ac | 1 -
src/Makefile.global.in | 3 ---
4 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 181c217fae4..5b704bb3600 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -100,8 +100,10 @@ ifeq ($(PORTNAME), aix)
postgres: $(POSTGRES_IMP)
$(CC) $(CFLAGS) $(call expand_subsys,$(OBJS)) $(LDFLAGS) $(LDFLAGS_EX) -Wl,-bE:$(top_builddir)/src/backend/$(POSTGRES_IMP) $(LIBS) -Wl,-brtllib -o $@
+# linking to a single .o with -r is a lot faster than building a .a or passing
+# all objects to MKLDEXPORT
$(POSTGRES_IMP): $(OBJS)
- $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(call expand_subsys,$^)
+ $(CC) -r -o SUBSYS.o $(call expand_subsys,$^)
$(MKLDEXPORT) SUBSYS.o . > $@
@rm -f SUBSYS.o
diff --git a/configure b/configure
index d338ae2cc8b..7eafefb062a 100755
--- a/configure
+++ b/configure
@@ -692,7 +692,6 @@ STRIP_SHARED_LIB
STRIP_STATIC_LIB
STRIP
with_gnu_ld
-LD
LDFLAGS_SL
LDFLAGS_EX
ZSTD_LIBS
@@ -9464,7 +9463,6 @@ with_gnu_ld=$ac_cv_prog_gnu_ld
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
diff --git a/configure.ac b/configure.ac
index 66c60974ef9..398eb422595 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1127,7 +1127,6 @@ AC_ARG_VAR(LDFLAGS_EX, [extra linker flags for linking executables only])
AC_ARG_VAR(LDFLAGS_SL, [extra linker flags for linking shared libraries only])
PGAC_PROG_LD
-AC_SUBST(LD)
AC_SUBST(with_gnu_ld)
PGAC_CHECK_STRIP
AC_CHECK_TOOL(AR, ar, ar)
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index a5e2f36d217..8107643578b 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -289,7 +289,6 @@ LDAP_LIBS_FE = @LDAP_LIBS_FE@
LDAP_LIBS_BE = @LDAP_LIBS_BE@
UUID_LIBS = @UUID_LIBS@
LLVM_LIBS=@LLVM_LIBS@
-LD = @LD@
with_gnu_ld = @with_gnu_ld@
# It's critical that within LDFLAGS, all -L switches pointing to build-tree
@@ -316,8 +315,6 @@ LDFLAGS = $(LDFLAGS_INTERNAL) @LDFLAGS@
LDFLAGS_EX = @LDFLAGS_EX@
# LDFLAGS_SL might have already been assigned by calling makefile
LDFLAGS_SL += @LDFLAGS_SL@
-LDREL = -r
-LDOUT = -o
WINDRES = @WINDRES@
X = @EXEEXT@
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0011-solaris-Check-for-Wl-E-directly-instead-of-check.patch (13.8K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/12-v17-0011-solaris-Check-for-Wl-E-directly-instead-of-check.patch)
download | inline diff:
From 1ad3acc1a0eeea1b5872b2fbf0aefcef58e5610c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 15:39:40 -0700
Subject: [PATCH v17 11/23] solaris: Check for -Wl,-E directly instead of
checking for gnu LD
This allows us to get rid of the harder to support with_gnu_ld detection,
simplifying meson PGXS compatibility. It's also nice to delete libtool.m4.
Author:
Reviewed-by:
Discussion: https://postgr.es/m/
Backpatch:
---
config/c-compiler.m4 | 16 ++++
config/libtool.m4 | 119 ----------------------------
src/makefiles/Makefile.solaris | 2 +-
aclocal.m4 | 1 -
configure | 140 +++++++++------------------------
configure.ac | 10 ++-
src/Makefile.global.in | 2 +-
7 files changed, 64 insertions(+), 226 deletions(-)
delete mode 100644 config/libtool.m4
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index eb8cc8ce170..d798c385c44 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -491,6 +491,22 @@ fi
undefine([Ac_cachevar])dnl
])# PGAC_PROG_CC_LDFLAGS_OPT
+
+# PGAC_PROG_CC_LD_EXPORT_DYNAMIC
+# ------------------------
+# Checks if the compiler / linker supports -Wl,-E and set
+# pgac_cv_prog_cc_ld_export_dynamic if so.
+AC_DEFUN([PGAC_PROG_CC_LD_EXPORT_DYNAMIC],
+[AC_CACHE_CHECK([whether $CC supports -Wl,-E], [pgac_cv_prog_cc_ld_export_dynamic],
+[pgac_save_LDFLAGS=$LDFLAGS
+LDFLAGS="$pgac_save_LDFLAGS -Wl,-E"
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
+ [pgac_cv_prog_cc_ld_export_dynamic=yes],
+ [pgac_cv_prog_cc_ld_export_dynamic=no])
+LDFLAGS="$pgac_save_LDFLAGS"])
+])# PGAC_PROG_CC_LD_EXPORT_DYNAMIC
+
+
# PGAC_HAVE_GCC__SYNC_CHAR_TAS
# ----------------------------
# Check if the C compiler understands __sync_lock_test_and_set(char),
diff --git a/config/libtool.m4 b/config/libtool.m4
deleted file mode 100644
index f6e426dbdf1..00000000000
--- a/config/libtool.m4
+++ /dev/null
@@ -1,119 +0,0 @@
-## libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
-## Copyright (C) 1996-1999,2000 Free Software Foundation, Inc.
-## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-##
-## As a special exception to the GNU General Public License, if you
-## distribute this file as part of a program that contains a
-## configuration script generated by Autoconf, you may include it under
-## the same distribution terms that you use for the rest of that program.
-
-# No, PostgreSQL doesn't use libtool (yet), we just borrow stuff from it.
-# This file was taken on 2000-10-20 from the multi-language branch (since
-# that is the branch that PostgreSQL would most likely adopt anyway).
-# --petere
-
-# ... bunch of stuff removed here ...
-
-# PGAC_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN([PGAC_PROG_LD],
-[AC_ARG_WITH(gnu-ld,
-[ --with-gnu-ld assume the C compiler uses GNU ld [[default=no]]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-dnl ###not for PostgreSQL### AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by GCC])
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case "$ac_prog" in
- # Accept absolute paths.
-changequote(,)dnl
- [\\/]* | [A-Za-z]:[\\/]*)
- re_direlt='/[^/][^/]*/\.\./'
-changequote([,])dnl
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(ac_cv_path_LD,
-[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- ac_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-else
- ac_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$ac_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
-else
- AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-PGAC_PROG_LD_GNU
-])
-
-AC_DEFUN([PGAC_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- ac_cv_prog_gnu_ld=yes
-else
- ac_cv_prog_gnu_ld=no
-fi])
-with_gnu_ld=$ac_cv_prog_gnu_ld
-])
-
-# ... more stuff removed ...
diff --git a/src/makefiles/Makefile.solaris b/src/makefiles/Makefile.solaris
index 3de73ebc010..ba8e57988a9 100644
--- a/src/makefiles/Makefile.solaris
+++ b/src/makefiles/Makefile.solaris
@@ -1,7 +1,7 @@
# src/makefiles/Makefile.solaris
rpath = -Wl,-rpath,'$(rpathdir)'
-ifeq ($(with_gnu_ld), yes)
+ifeq ($(SOLARIS_EXPORT_DYNAMIC), yes)
export_dynamic = -Wl,-E
endif
diff --git a/aclocal.m4 b/aclocal.m4
index 1c19c60c596..d05f8f9e3a8 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4,7 +4,6 @@ m4_include([config/c-compiler.m4])
m4_include([config/c-library.m4])
m4_include([config/check_decls.m4])
m4_include([config/general.m4])
-m4_include([config/libtool.m4])
m4_include([config/llvm.m4])
m4_include([config/perl.m4])
m4_include([config/pkg.m4])
diff --git a/configure b/configure
index 7eafefb062a..c8bf357e6f3 100755
--- a/configure
+++ b/configure
@@ -629,6 +629,7 @@ ac_subst_vars='LTLIBOBJS
vpath_build
PG_SYSROOT
PG_VERSION_NUM
+SOLARIS_EXPORT_DYNAMIC
PROVE
DBTOEPUB
FOP
@@ -691,7 +692,6 @@ AR
STRIP_SHARED_LIB
STRIP_STATIC_LIB
STRIP
-with_gnu_ld
LDFLAGS_SL
LDFLAGS_EX
ZSTD_LIBS
@@ -870,7 +870,6 @@ with_system_tzdata
with_zlib
with_lz4
with_zstd
-with_gnu_ld
with_ssl
with_openssl
enable_largefile
@@ -1581,7 +1580,6 @@ Optional Packages:
--without-zlib do not use Zlib
--with-lz4 build with LZ4 support
--with-zstd build with ZSTD support
- --with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-ssl=LIB use LIB for SSL/TLS support (openssl)
--with-openssl obsolete spelling of --with-ssl=openssl
@@ -9364,105 +9362,6 @@ LDFLAGS="$LDFLAGS $LIBDIRS"
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then :
- withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
-else
- with_gnu_ld=no
-fi
-
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC" >&5
-$as_echo_n "checking for ld used by GCC... " >&6; }
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case "$ac_prog" in
- # Accept absolute paths.
- [\\/]* | [A-Za-z]:[\\/]*)
- re_direlt='/[^/][^/]*/\.\./'
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
-fi
-if ${ac_cv_path_LD+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- ac_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-else
- ac_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$ac_cv_path_LD"
-if test -n "$LD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${ac_cv_prog_gnu_ld+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- # I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
- ac_cv_prog_gnu_ld=yes
-else
- ac_cv_prog_gnu_ld=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gnu_ld" >&5
-$as_echo "$ac_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$ac_cv_prog_gnu_ld
-
-
-
-
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
@@ -19096,6 +18995,43 @@ fi
fi
+# Check if linker on solaris supports -Wl,-E (gnu linker does, solaris linker
+# doesn't).
+if test "$PORTNAME" = "solaris"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wl,-E" >&5
+$as_echo_n "checking whether $CC supports -Wl,-E... " >&6; }
+if ${pgac_cv_prog_cc_ld_export_dynamic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_LDFLAGS=$LDFLAGS
+LDFLAGS="$pgac_save_LDFLAGS -Wl,-E"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ pgac_cv_prog_cc_ld_export_dynamic=yes
+else
+ pgac_cv_prog_cc_ld_export_dynamic=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LDFLAGS="$pgac_save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_ld_export_dynamic" >&5
+$as_echo "$pgac_cv_prog_cc_ld_export_dynamic" >&6; }
+
+ SOLARIS_EXPORT_DYNAMIC=$pgac_cv_prog_cc_ld_export_dynamic
+
+fi
+
# Create compiler version string
if test x"$GCC" = x"yes" ; then
cc_string=`${CC} --version | sed q`
diff --git a/configure.ac b/configure.ac
index 398eb422595..d87c9af77f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1126,8 +1126,6 @@ LDFLAGS="$LDFLAGS $LIBDIRS"
AC_ARG_VAR(LDFLAGS_EX, [extra linker flags for linking executables only])
AC_ARG_VAR(LDFLAGS_SL, [extra linker flags for linking shared libraries only])
-PGAC_PROG_LD
-AC_SUBST(with_gnu_ld)
PGAC_CHECK_STRIP
AC_CHECK_TOOL(AR, ar, ar)
if test "$PORTNAME" = "win32"; then
@@ -2366,6 +2364,14 @@ else
PGAC_PROG_CC_LDFLAGS_OPT([-Wl,--as-needed], $link_test_func)
fi
+# Check if linker on solaris supports -Wl,-E (gnu linker does, solaris linker
+# doesn't).
+if test "$PORTNAME" = "solaris"; then
+ PGAC_PROG_CC_LD_EXPORT_DYNAMIC()
+ SOLARIS_EXPORT_DYNAMIC=$pgac_cv_prog_cc_ld_export_dynamic
+ AC_SUBST(SOLARIS_EXPORT_DYNAMIC)
+fi
+
# Create compiler version string
if test x"$GCC" = x"yes" ; then
cc_string=`${CC} --version | sed q`
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 8107643578b..31294005235 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -289,7 +289,7 @@ LDAP_LIBS_FE = @LDAP_LIBS_FE@
LDAP_LIBS_BE = @LDAP_LIBS_BE@
UUID_LIBS = @UUID_LIBS@
LLVM_LIBS=@LLVM_LIBS@
-with_gnu_ld = @with_gnu_ld@
+SOLARIS_EXPORT_DYNAMIC=@SOLARIS_EXPORT_DYNAMIC@
# It's critical that within LDFLAGS, all -L switches pointing to build-tree
# directories come before any -L switches pointing to external directories.
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0012-meson-Add-PGXS-compatibility.patch (7.5K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/13-v17-0012-meson-Add-PGXS-compatibility.patch)
download | inline diff:
From 87a596a60a5300dbd7fd9feacb4b69f1aae3c693 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 20:27:17 -0700
Subject: [PATCH v17 12/23] meson: Add PGXS compatibility
This works for some extensions on some operating systems, but could use plenty
of cleanups.
---
src/meson.build | 269 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 269 insertions(+)
diff --git a/src/meson.build b/src/meson.build
index b515af15bfa..ef022c59615 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -10,3 +10,272 @@ subdir('bin')
subdir('pl')
subdir('interfaces')
+
+
+### Generate a Makefile.global that's complete enough for PGXS to work.
+#
+# This is somewhat ugly, but allows extensions to use a single buildsystem
+# across all the supported postgres versions. Once all supported PG versions
+# support meson, we can remove all of this.
+#
+# XXX: Should we make this optional?
+
+pgxs_kv = {
+ 'PACKAGE_URL': pg_url,
+ 'PACKAGE_VERSION': pg_version,
+ 'PG_MAJORVERSION': pg_version_major,
+ 'PG_VERSION_NUM': pg_version_num,
+ 'configure_input': 'meson',
+
+ 'vpath_build': 'yes',
+ 'autodepend': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
+
+ 'host_cpu': host_cpu,
+ 'host': '@0@-@1@'.format(host_cpu, host_system),
+ 'host_os': host_system,
+ 'build_os': build_machine.system(),
+ 'PORTNAME': portname,
+ 'PG_SYSROOT': pg_sysroot,
+
+ 'abs_top_builddir': meson.build_root(),
+ 'abs_top_srcdir': meson.source_root(),
+
+ 'enable_thread_safety': 'yes',
+ 'enable_rpath': 'yes',
+ 'enable_nls': libintl.found() ? 'yes' : 'no',
+ 'enable_tap_tests': tap_tests_enabled ? 'yes' : 'no',
+ 'enable_debug': get_option('debug') ? 'yes' : 'no',
+ 'enable_coverage': get_option('b_coverage') ? 'yes' : 'no',
+ 'enable_dtrace': dtrace.found() ? 'yes' : 'no',
+
+ 'DLSUFFIX': dlsuffix,
+ 'EXEEXT': exesuffix,
+
+ 'SUN_STUDIO_CC': 'no', # not supported so far
+
+ # want the chosen option, rather than the library
+ 'with_ssl' : get_option('ssl'),
+ 'with_uuid': uuidopt,
+
+ 'default_port': get_option('pgport'),
+ 'with_system_tzdata': get_option('system_tzdata'),
+
+ 'with_krb_srvnam': get_option('krb_srvnam'),
+ 'krb_srvtab': krb_srvtab,
+
+ # FIXME: implement programs.m4 logic in PGAC_CHECK_STRIP
+ 'STRIP': 'strip',
+ 'STRIP_STATIC_LIB': 'strip -x',
+ 'STRIP_SHARED_LIB': 'strip --strip-unneeded',
+
+ # Just always use the install_sh fallback that autoconf uses. Unlikely to
+ # matter performance-wise for extensions. If it turns out to do, we can
+ # improve that later.
+ 'MKDIR_P': ' '.join([install_sh.path(), '-d']),
+
+ 'CC': var_cc,
+ 'CPP': var_cpp,
+ 'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
+ 'with_gnu_ld': (cc.get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.lld', 'ld.mold'] ? 'yes' : 'no'),
+
+ 'CFLAGS': var_cflags,
+ 'CPPFLAGS': var_cppflags,
+ 'CXXFLAGS': var_cxxflags,
+ 'CFLAGS_SL': var_cflags_sl,
+ 'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
+ 'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
+ 'CFLAGS_SSE42': ' '.join(cflags_crc),
+ 'CFLAGS_ARMV8_CRC32C': ' '.join(cflags_crc),
+
+ 'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
+ 'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
+
+ 'LDFLAGS': var_ldflags,
+ 'LDFLAGS_EX': var_ldflags_ex,
+ 'LDFLAGS_SL': var_ldflags_sl,
+
+ # FIXME:
+ 'BITCODE_CFLAGS': '',
+ 'BITCODE_CXXFLAGS': '',
+
+ 'BISONFLAGS': ' '.join(bison_flags),
+ 'FLEXFLAGS': ' '.join(flex_flags),
+
+ 'LIBS': var_libs,
+}
+
+if llvm.found()
+ pgxs_kv += {
+ 'CLANG': clang.path(),
+ 'CXX': ' '.join(cpp.cmd_array()),
+ 'LLVM_BINPATH': llvm_binpath,
+ }
+else
+ pgxs_kv += {
+ 'CLANG': '',
+ 'CXX': '',
+ 'LLVM_BINPATH': '',
+ }
+endif
+
+# FIXME: figure out which platforms we still need the linker "directly" -
+# can't be many?
+
+ld_program = find_program(cc.get_linker_id(), native: true, required: false)
+
+pgxs_bins = {
+ 'BISON': bison,
+ 'FLEX': flex,
+ 'GZIP': gzip,
+ 'LZ4': program_lz4,
+ 'PERL': perl,
+ 'PROVE': prove,
+ 'PYTHON': python,
+ 'TAR': tar,
+ 'ZSTD': program_zstd,
+ 'DTRACE': dtrace,
+ 'LD': ld_program,
+ 'install_bin': install_sh,
+}
+
+pgxs_empty = [
+ 'PERMIT_DECLARATION_AFTER_STATEMENT',
+ 'ICU_CFLAGS', # needs to be added, included by public server headers
+
+ # probably need most of these?
+ 'RANLIB',
+ 'LN_S',
+ 'AR',
+ 'AWK',
+
+ # hard to see why we'd need either?
+ 'ZIC',
+ 'TCLSH',
+
+ # docs don't seem to be supported by pgxs
+ 'XMLLINT',
+ 'XSLTPROC',
+ 'DBTOEPUB',
+ 'FOP',
+
+ # supporting coverage for pgxs-in-meson build doesn't seem worth it
+ 'GENHTML',
+ 'LCOV',
+ 'GCOV',
+ 'MSGFMT_FLAGS',
+
+ # translation doesn't appear to be supported by pgxs
+ 'MSGFMT',
+ 'XGETTEXT',
+ 'MSGMERGE',
+ 'WANTED_LANGUAGES',
+
+ # Not needed because we don't build the server / PLs with the generated makefile
+ 'LIBOBJS', 'PG_CRC32C_OBJS', 'TAS',
+ 'DTRACEFLAGS', # only server has dtrace probes
+
+ 'perl_archlibexp', 'perl_embed_ccflags', 'perl_embed_ldflags', 'perl_includespec', 'perl_privlibexp',
+ 'python_additional_libs', 'python_includespec', 'python_libdir', 'python_libspec', 'python_majorversion', 'python_version',
+
+ # possible that some of these are referenced explicitly in pgxs makefiles?
+ # For now not worth it.
+ 'TCL_INCLUDE_SPEC', 'TCL_LIBS', 'TCL_LIB_SPEC', 'TCL_SHARED_BUILD',
+
+ 'LLVM_CFLAGS', 'LLVM_CPPFLAGS', 'LLVM_CXXFLAGS', 'LLVM_LIBS',
+
+ 'LDAP_LIBS_BE', 'LDAP_LIBS_FE',
+
+ 'UUID_LIBS',
+
+ 'PTHREAD_CFLAGS', 'PTHREAD_LIBS',
+
+ 'ICU_LIBS',
+]
+
+if host_system == 'windows' and cc.get_argument_syntax() != 'msvc'
+ pgxs_bins += {'WINDRES': windres}
+else
+ pgxs_empty += 'WINDRES'
+endif
+
+pgxs_dirs = {
+ 'prefix': get_option('prefix'),
+
+ 'bindir': '${exec_prefix}' / get_option('bindir'),
+ 'datarootdir': '${prefix}' / get_option('datadir'),
+ 'datadir': '${datarootdir}',
+ 'docdir': '${prefix}' / dir_doc,
+ 'exec_prefix': '${prefix}',
+ 'htmldir': '${prefix}' / dir_doc_html, #?
+ 'includedir': '${prefix}' / get_option('includedir'),
+ 'libdir': '${exec_prefix}' / get_option('libdir'),
+ 'localedir': '${prefix}' / get_option('localedir'),
+ 'mandir': '${prefix}' / get_option('mandir'),
+ 'sysconfdir': '${prefix}' / get_option('sysconfdir'),
+}
+
+pgxs_deps = {
+ 'bonjour': bonjour,
+ 'bsd_auth': bsd_auth,
+ 'gssapi': gssapi,
+ 'icu': icu,
+ 'ldap': ldap,
+ 'libxml': libxml,
+ 'libxslt': libxslt,
+ 'llvm': llvm,
+ 'lz4': lz4,
+ 'nls': libintl,
+ 'pam': pam,
+ 'perl': perl_dep,
+ 'python': python3_dep,
+ 'readline': readline,
+ 'selinux': selinux,
+ 'systemd': systemd,
+ 'tcl': tcl_dep,
+ 'zlib': zlib,
+ 'zstd': zstd,
+}
+
+
+pgxs_cdata = configuration_data(pgxs_kv)
+
+foreach b, p : pgxs_bins
+ pgxs_cdata.set(b, p.found() ? p.path() : '')
+endforeach
+
+foreach pe : pgxs_empty
+ pgxs_cdata.set(pe, '')
+endforeach
+
+foreach d, p : pgxs_dirs
+ pgxs_cdata.set(d, p)
+endforeach
+
+foreach d, v : pgxs_deps
+ pgxs_cdata.set('with_@0@'.format(d), v.found() ? 'yes' : 'no')
+endforeach
+
+
+makefile_global = configure_file(
+ input: 'Makefile.global.in',
+ output: 'Makefile.global',
+ configuration: pgxs_cdata,
+ install: true,
+ install_dir: dir_pgxs / 'src',
+)
+configure_files += makefile_global
+
+makefile_port = configure_file(
+ input: 'makefiles' / 'Makefile.@0@'.format(portname),
+ output: 'Makefile.port',
+ copy: true,
+ install_dir: dir_pgxs / 'src')
+configure_files += makefile_port
+
+install_data(
+ 'Makefile.shlib', 'nls-global.mk',
+ install_dir: dir_pgxs / 'src')
+
+install_data(
+ 'makefiles/pgxs.mk',
+ install_dir: dir_pgxs / 'src' / 'makefiles')
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0013-fixup-meson-Add-PGXS-compatibility.patch (2.2K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/14-v17-0013-fixup-meson-Add-PGXS-compatibility.patch)
download | inline diff:
From 66bef54a05110ba0820dd1f81f558dd464c36503 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 15:48:19 -0700
Subject: [PATCH v17 13/23] fixup! meson: Add PGXS compatibility
---
meson.build | 5 +++++
src/meson.build | 13 +++----------
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/meson.build b/meson.build
index 774a8c2e05f..6f580222e90 100644
--- a/meson.build
+++ b/meson.build
@@ -1770,6 +1770,11 @@ if cc.get_id() == 'msvc'
ldflags_mod += '/NOIMPLIB'
endif
+if host_system == 'sunos'
+ solaris_export_dynamic = cc.has_link_argument('-Wl,-E')
+else
+ solaris_export_dynamic = false
+endif
###############################################################
diff --git a/src/meson.build b/src/meson.build
index ef022c59615..8aa91940cec 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -76,7 +76,8 @@ pgxs_kv = {
'CC': var_cc,
'CPP': var_cpp,
'GCC': cc.get_argument_syntax() == 'gcc' ? 'yes' : 'no',
- 'with_gnu_ld': (cc.get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.lld', 'ld.mold'] ? 'yes' : 'no'),
+
+ 'SOLARIS_EXPORT_DYNAMIC': solaris_export_dynamic ? 'yes' : 'no',
'CFLAGS': var_cflags,
'CPPFLAGS': var_cppflags,
@@ -84,8 +85,7 @@ pgxs_kv = {
'CFLAGS_SL': var_cflags_sl,
'CFLAGS_SL_MODULE': ' '.join(cflags_mod),
'CXXFLAGS_SL_MODULE': ' '.join(cxxflags_mod),
- 'CFLAGS_SSE42': ' '.join(cflags_crc),
- 'CFLAGS_ARMV8_CRC32C': ' '.join(cflags_crc),
+ 'CFLAGS_CRC': ' '.join(cflags_crc),
'CFLAGS_UNROLL_LOOPS': ' '.join(unroll_loops_cflags),
'CFLAGS_VECTORIZE': ' '.join(vectorize_cflags),
@@ -118,11 +118,6 @@ else
}
endif
-# FIXME: figure out which platforms we still need the linker "directly" -
-# can't be many?
-
-ld_program = find_program(cc.get_linker_id(), native: true, required: false)
-
pgxs_bins = {
'BISON': bison,
'FLEX': flex,
@@ -134,7 +129,6 @@ pgxs_bins = {
'TAR': tar,
'ZSTD': program_zstd,
'DTRACE': dtrace,
- 'LD': ld_program,
'install_bin': install_sh,
}
@@ -143,7 +137,6 @@ pgxs_empty = [
'ICU_CFLAGS', # needs to be added, included by public server headers
# probably need most of these?
- 'RANLIB',
'LN_S',
'AR',
'AWK',
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0014-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch (7.8K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/15-v17-0014-meson-Add-xmllint-xsltproc-wrapper-script-to-han.patch)
download | inline diff:
From 7a61d5dc4796cf7472e6b59d90bab6f48514aa7c Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 21 Sep 2022 08:49:45 -0700
Subject: [PATCH v17 14/23] meson: Add xmllint/xsltproc wrapper script to
handle dependencies automatically
---
doc/src/sgml/meson.build | 38 ++++++++++++++------
doc/src/sgml/xmltools_dep_wrapper | 60 +++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 10 deletions(-)
create mode 100644 doc/src/sgml/xmltools_dep_wrapper
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index ba2a261e7a4..e6781d0deae 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -2,7 +2,7 @@ docs = []
alldocs = []
doc_generated = []
-xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
+xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false)
version_sgml = configure_file(
@@ -60,14 +60,23 @@ doc_generated += custom_target('keywords-table.sgml',
)
# For everything else we need at least xmllint
-if not xmllint.found()
+if not xmllint_bin.found()
subdir_done()
endif
pandoc = find_program('pandoc', native: true, required: false)
-xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
+xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false)
fop = find_program('fop', native: true, required: false)
+xmltools_wrapper = [
+ python, files('xmltools_dep_wrapper'),
+ '--targetname', '@OUTPUT@', '--depfile', '@DEPFILE@'
+]
+
+xmllint = xmltools_wrapper + [
+ '--tool', xmllint_bin, '--',
+]
+
# Run validation only once, common to all subsequent targets. While
# we're at it, also resolve all entities (that is, copy all included
# files into one big file). This helps tools that don't understand
@@ -75,6 +84,7 @@ fop = find_program('fop', native: true, required: false)
postgres_full_xml = custom_target('postgres-full.xml',
input: 'postgres.sgml',
output: 'postgres-full.xml',
+ depfile: 'postgres-full.xml.d',
command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
depends: doc_generated,
build_by_default: false,
@@ -86,18 +96,20 @@ alldocs += postgres_full_xml
#
# Full documentation as html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
xsltproc_flags = [
'--stringparam', 'pg.version', pg_version,
'--param', 'website.stylesheet', '1'
]
+ xsltproc = xmltools_wrapper + [
+ '--tool', xsltproc_bin, '--',
+ ]
- # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
- # depfile
html = custom_target('html',
input: ['stylesheet.xsl', postgres_full_xml],
output: 'html',
+ depfile: 'html.d',
depends: doc_generated,
command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -110,6 +122,7 @@ if xsltproc.found()
html_help = custom_target('html_help',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
+ depfile: 'htmlhelp.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -121,6 +134,7 @@ if xsltproc.found()
postgres_html = custom_target('postgres.html',
input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
output: 'postgres.html',
+ depfile: 'postgres.html.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -144,10 +158,11 @@ endif
#
# INSTALL in html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
install_xml = custom_target('INSTALL.xml',
input: ['standalone-profile.xsl', 'standalone-install.xml'],
output: 'INSTALL.xml',
+ depfile: 'INSTALL.xml.d',
depends: doc_generated + [postgres_full_xml],
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
@@ -155,6 +170,7 @@ if xsltproc.found()
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
+ depfile: 'INSTALL.html.d',
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
@@ -177,11 +193,12 @@ endif
#
# Man pages
#
-if xsltproc.found()
+if xsltproc_bin.found()
# FIXME: implement / consider sqlmansectnum logic
man = custom_target('man',
input: ['stylesheet-man.xsl', postgres_full_xml],
output: ['man1', 'man3', 'man7'],
+ depfile: 'man.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -195,7 +212,7 @@ endif
#
# Full documentation as PDF
#
-if fop.found() and xsltproc.found()
+if fop.found() and xsltproc_bin.found()
xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
@@ -206,6 +223,7 @@ if fop.found() and xsltproc.found()
input: ['stylesheet-fo.xsl', postgres_full_xml],
output: [postgres_x_fo_f],
depends: doc_generated,
+ depfile: postgres_x_fo_f + '.d',
command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
'--stringparam', 'paper.type', detail,
'-o', '@OUTPUT@', '@INPUT@'],
@@ -230,7 +248,7 @@ endif
# This was previously implemented using dbtoepub - but that doesn't seem to
# support running in build != source directory (i.e. VPATH builds already
# weren't supported).
-if pandoc.found() and xsltproc.found()
+if pandoc.found() and xsltproc_bin.found()
postgres_epub = custom_target('postgres.epub',
input: postgres_full_xml,
output: 'postgres.epub',
diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper
new file mode 100644
index 00000000000..52b94e3fcaf
--- /dev/null
+++ b/doc/src/sgml/xmltools_dep_wrapper
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+
+import argparse
+import re
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(
+ description='generate dependency file for docs')
+
+parser.add_argument('--targetname', type=str, required=False, nargs='+')
+parser.add_argument('--depfile', type=str, required=False)
+parser.add_argument('--tool', type=str, required=True)
+
+parser.add_argument('flags', nargs='*')
+
+args = parser.parse_args()
+
+if args.depfile:
+ depfile_result_list = []
+
+ command = [args.tool, '--load-trace'] + args.flags
+ # --load-trace flag displays all the documents
+ # loaded during the processing to stderr
+ res = subprocess.run(command, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ # if exit code is different than 0, exit
+ if res.returncode:
+ exit(res.returncode)
+
+ # get line start from targetname
+ line_start = ''
+ for name in args.targetname:
+ line_start = line_start + name + ' '
+ line_start = line_start.strip() + ': '
+
+ # collect only file paths
+ line_re = re.compile('^Loaded URL="([^"]+)"')
+ with open(args.depfile, 'w') as f:
+ for line in res.stderr.split('\n'):
+ if line == '':
+ continue
+ m = re.match(line_re, line)
+
+ # continue to show errors
+ if m is None:
+ print(line, file=sys.stderr)
+ continue
+
+ fname = m.group(1)
+ if fname.startswith('http:'):
+ continue
+ if fname.startswith('file://'):
+ fname = fname.split('file://')[1]
+ f.write(line_start + fname + '\n')
+
+else:
+ command = [args.tool] + args.flags
+ res = subprocess.run(command)
+ exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0015-windows-Set-UMDF_USING_NTSTATUS-globally-include.patch (3.7K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/16-v17-0015-windows-Set-UMDF_USING_NTSTATUS-globally-include.patch)
download | inline diff:
From e405598656f0b96302db1073642671557d4be64d Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 11:06:20 -0700
Subject: [PATCH v17 15/23] windows: Set UMDF_USING_NTSTATUS globally, include
ntstatus.h
We'd like to use precompiled headers on windows to reduce compile times. Right
now we rely on defining WIN32_NO_STATUS before including postgres.h in a few
select places - which doesn't work with precompiled headers. Instead define
it globally.
When UMDF_USING_NTSTATUS is defined we need to explicitly include ntstatus.h,
winternl.h to get a comparable set of symbols. Right now these includes would
be required in a number of non-platform-specific .c files - to avoid that,
include them in win32_port.h. Based on my measurements that doesn't increase
compile times measurably.
---
src/include/port/win32_port.h | 9 +++++++++
src/include/port/win32ntdll.h | 6 ------
src/port/open.c | 2 --
src/port/win32fdatasync.c | 2 --
src/port/win32ntdll.c | 2 --
src/port/win32stat.c | 2 --
6 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/include/port/win32_port.h b/src/include/port/win32_port.h
index 707f8760cab..67382245504 100644
--- a/src/include/port/win32_port.h
+++ b/src/include/port/win32_port.h
@@ -48,12 +48,21 @@
* significantly. WIN32_LEAN_AND_MEAN reduces that a bit. It'd be better to
* remove the include of windows.h (as well as indirect inclusions of it) from
* such a central place, but until then...
+ *
+ * To be able to include ntstatus.h tell windows.h to not declare NTSTATUS by
+ * temporarily defining UMDF_USING_NTSTATUS, otherwise we'll get warning about
+ * macro redefinitions, as windows.h also defines NTSTATUS (yuck). That in
+ * turn requires including ntstatus.h, winternl.h to get common symbols.
*/
#define WIN32_LEAN_AND_MEAN
+#define UMDF_USING_NTSTATUS
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windows.h>
+#include <ntstatus.h>
+#include <winternl.h>
+
#undef small
#include <process.h>
#include <signal.h>
diff --git a/src/include/port/win32ntdll.h b/src/include/port/win32ntdll.h
index 34cebddd542..6d13a18b395 100644
--- a/src/include/port/win32ntdll.h
+++ b/src/include/port/win32ntdll.h
@@ -14,12 +14,6 @@
#ifndef WIN32NTDLL_H
#define WIN32NTDLL_H
-/*
- * Because this includes NT headers that normally conflict with Win32 headers,
- * any translation unit that includes it should #define UMDF_USING_NTSTATUS
- * before including <windows.h>.
- */
-
#include <ntstatus.h>
#include <winternl.h>
diff --git a/src/port/open.c b/src/port/open.c
index 8c09c7c1f77..fd4faf604ea 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -13,8 +13,6 @@
#ifdef WIN32
-#define UMDF_USING_NTSTATUS
-
#ifndef FRONTEND
#include "postgres.h"
#else
diff --git a/src/port/win32fdatasync.c b/src/port/win32fdatasync.c
index 31d631c6962..a5431615ab2 100644
--- a/src/port/win32fdatasync.c
+++ b/src/port/win32fdatasync.c
@@ -11,8 +11,6 @@
*-------------------------------------------------------------------------
*/
-#define UMDF_USING_NTSTATUS
-
#ifdef FRONTEND
#include "postgres_fe.h"
#else
diff --git a/src/port/win32ntdll.c b/src/port/win32ntdll.c
index eb614077543..db3e5fa251f 100644
--- a/src/port/win32ntdll.c
+++ b/src/port/win32ntdll.c
@@ -13,8 +13,6 @@
*-------------------------------------------------------------------------
*/
-#define UMDF_USING_NTSTATUS
-
#include "c.h"
#include "port/win32ntdll.h"
diff --git a/src/port/win32stat.c b/src/port/win32stat.c
index 26443293d78..5f3d0d22ff4 100644
--- a/src/port/win32stat.c
+++ b/src/port/win32stat.c
@@ -15,8 +15,6 @@
#ifdef WIN32
-#define UMDF_USING_NTSTATUS
-
#include "c.h"
#include "port/win32ntdll.h"
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0016-windows-adjust-FD_SETSIZE-via-commandline-define.patch (5.5K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/17-v17-0016-windows-adjust-FD_SETSIZE-via-commandline-define.patch)
download | inline diff:
From 6025cb80d65fd7a8414241931df9f003a292052f Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 12:07:29 -0700
Subject: [PATCH v17 16/23] windows: adjust FD_SETSIZE via commandline define
This is a prerequisite to using precompiled headers.
---
src/fe_utils/Makefile | 4 ++++
src/fe_utils/meson.build | 1 +
src/fe_utils/parallel_slot.c | 4 ++--
src/bin/pgbench/Makefile | 2 ++
src/bin/pgbench/meson.build | 2 ++
src/bin/pgbench/pgbench.c | 4 ++--
src/tools/msvc/Mkvcbuild.pm | 17 +++++++++++++++--
7 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/fe_utils/Makefile b/src/fe_utils/Makefile
index 44bc7a1215d..40d4b1d8698 100644
--- a/src/fe_utils/Makefile
+++ b/src/fe_utils/Makefile
@@ -34,6 +34,10 @@ OBJS = \
simple_list.o \
string_utils.o
+ifeq ($(PORTNAME), win32)
+override CFLAGS += -DFD_SETSIZE=1024
+endif
+
all: libpgfeutils.a
libpgfeutils.a: $(OBJS)
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index b6bf8e1ca21..3e226c260ac 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -24,6 +24,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
include_directories: [postgres_inc, libpq_inc],
+ c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
dependencies: frontend_common_code,
kwargs: default_lib_args,
)
diff --git a/src/fe_utils/parallel_slot.c b/src/fe_utils/parallel_slot.c
index 2be2903c9c6..767256757f2 100644
--- a/src/fe_utils/parallel_slot.c
+++ b/src/fe_utils/parallel_slot.c
@@ -12,8 +12,8 @@
*-------------------------------------------------------------------------
*/
-#ifdef WIN32
-#define FD_SETSIZE 1024 /* must set before winsock2.h is included */
+#if defined(WIN32) && FD_SETSIZE < 1024
+#error FD_SETSIZE needs to have been increased
#endif
#include "postgres_fe.h"
diff --git a/src/bin/pgbench/Makefile b/src/bin/pgbench/Makefile
index 6647c9fe97d..68e9f03e79f 100644
--- a/src/bin/pgbench/Makefile
+++ b/src/bin/pgbench/Makefile
@@ -18,6 +18,8 @@ LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
ifneq ($(PORTNAME), win32)
override CFLAGS += $(PTHREAD_CFLAGS)
+else
+override CFLAGS += -DFD_SETSIZE=1024
endif
LIBS += $(PTHREAD_LIBS)
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index a32eb51fe07..1a3ec5d1295 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -27,6 +27,8 @@ pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
include_directories: include_directories('.'),
+ c_pch: pch_postgres_fe_h,
+ c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
kwargs: default_bin_args,
)
bin_targets += pgbench
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index aa1a3541fe6..7da7c36fbe6 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -27,8 +27,8 @@
*
*/
-#ifdef WIN32
-#define FD_SETSIZE 1024 /* must set before winsock2.h is included */
+#if defined(WIN32) && FD_SETSIZE < 1024
+#error FD_SETSIZE needs to have been increased
#endif
#include "postgres_fe.h"
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index ddb4f25eb12..4d1e4f4e4d4 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -35,6 +35,7 @@ my $libpq;
my @unlink_on_exit;
# Set of variables for modules in contrib/ and src/test/modules/
+my $contrib_defines = {};
my @contrib_uselibpq = ();
my @contrib_uselibpgport = ();
my @contrib_uselibpgcommon = ();
@@ -52,6 +53,7 @@ my @contrib_excludes = (
'unsafe_tests');
# Set of variables for frontend modules
+my $frontend_defines = { 'pgbench' => 'FD_SETSIZE=1024' };
my @frontend_uselibpq =
('pg_amcheck', 'pg_ctl', 'pg_upgrade', 'pgbench', 'psql', 'initdb');
my @frontend_uselibpgport = (
@@ -175,6 +177,7 @@ sub mkvcbuild
$libpgfeutils = $solution->AddProject('libpgfeutils', 'lib', 'misc');
$libpgfeutils->AddDefine('FRONTEND');
+ $libpgfeutils->AddDefine('FD_SETSIZE=1024');
$libpgfeutils->AddIncludeDir('src/interfaces/libpq');
$libpgfeutils->AddFiles('src/fe_utils', @pgfeutilsfiles);
@@ -1120,7 +1123,8 @@ sub AdjustContribProj
{
my $proj = shift;
AdjustModule(
- $proj, \@contrib_uselibpq,
+ $proj, $contrib_defines,
+ \@contrib_uselibpq,
\@contrib_uselibpgport, \@contrib_uselibpgcommon,
$contrib_extralibs, $contrib_extrasource,
$contrib_extraincludes);
@@ -1131,7 +1135,8 @@ sub AdjustFrontendProj
{
my $proj = shift;
AdjustModule(
- $proj, \@frontend_uselibpq,
+ $proj, $frontend_defines,
+ \@frontend_uselibpq,
\@frontend_uselibpgport, \@frontend_uselibpgcommon,
$frontend_extralibs, $frontend_extrasource,
$frontend_extraincludes);
@@ -1141,6 +1146,7 @@ sub AdjustFrontendProj
sub AdjustModule
{
my $proj = shift;
+ my $module_defines = shift;
my $module_uselibpq = shift;
my $module_uselibpgport = shift;
my $module_uselibpgcommon = shift;
@@ -1149,6 +1155,13 @@ sub AdjustModule
my $module_extraincludes = shift;
my $n = $proj->{name};
+ if ($module_defines->{$n})
+ {
+ foreach my $d ($module_defines->{$n})
+ {
+ $proj->AddDefine($d);
+ }
+ }
if (grep { /^$n$/ } @{$module_uselibpq})
{
$proj->AddIncludeDir('src\interfaces\libpq');
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0017-meson-Add-support-for-building-with-precompiled-.patch (16.5K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/18-v17-0017-meson-Add-support-for-building-with-precompiled-.patch)
download | inline diff:
From 82b37bddab83cafa4002c09415b946572ee216bf Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 23 Sep 2022 12:19:17 -0700
Subject: [PATCH v17 17/23] meson: Add support for building with precompiled
headers
This substantially speeds up building for windows. A cross build from linux
targetting mingw goes from
real 0m30.772s
user 16m5.322s
sys 2m9.559s
to
real 0m13.747s
user 6m48.021s
sys 1m25.632s
The wins on windows are similar-ish (but I don't have a system at hand just
now for actual numbers). Targetting other operating systems the wins are far
smaller (tested linux, macOS, FreeBSD).
For now precompiled headers are disabled by default, it's not clear how well
they work on all platforms. E.g. on FreeBSD gcc doesn't seem to have working
support, but clang does.
---
src/include/meson.build | 1 +
src/include/pch/c_pch.h | 1 +
src/include/pch/meson.build | 4 ++++
src/include/pch/postgres_fe_pch.h | 1 +
src/include/pch/postgres_pch.h | 1 +
src/common/meson.build | 2 ++
src/port/meson.build | 2 ++
src/backend/meson.build | 5 +++++
src/backend/snowball/meson.build | 1 +
src/fe_utils/meson.build | 1 +
src/bin/pg_dump/meson.build | 1 +
src/bin/pg_upgrade/meson.build | 1 +
src/bin/psql/meson.build | 1 +
src/interfaces/libpq/meson.build | 1 +
src/pl/plperl/meson.build | 1 +
src/pl/plpgsql/src/meson.build | 1 +
src/pl/plpython/meson.build | 1 +
src/pl/tcl/meson.build | 1 +
contrib/bloom/meson.build | 1 +
contrib/btree_gist/meson.build | 1 +
contrib/hstore/meson.build | 1 +
contrib/pg_trgm/meson.build | 1 +
contrib/pgcrypto/meson.build | 1 +
contrib/pgstattuple/meson.build | 1 +
contrib/sepgsql/meson.build | 1 +
contrib/xml2/meson.build | 1 +
src/interfaces/ecpg/ecpglib/meson.build | 1 +
src/interfaces/ecpg/pgtypeslib/meson.build | 1 +
src/interfaces/ecpg/preproc/meson.build | 1 +
.cirrus.yml | 4 ++--
meson.build | 1 +
31 files changed, 41 insertions(+), 2 deletions(-)
create mode 100644 src/include/pch/c_pch.h
create mode 100644 src/include/pch/meson.build
create mode 100644 src/include/pch/postgres_fe_pch.h
create mode 100644 src/include/pch/postgres_pch.h
diff --git a/src/include/meson.build b/src/include/meson.build
index f2f7d03ff27..35c06c4856a 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -114,6 +114,7 @@ install_headers(
subdir('catalog')
subdir('nodes')
+subdir('pch')
subdir('storage')
subdir('utils')
diff --git a/src/include/pch/c_pch.h b/src/include/pch/c_pch.h
new file mode 100644
index 00000000000..f40c757ca62
--- /dev/null
+++ b/src/include/pch/c_pch.h
@@ -0,0 +1 @@
+#include "c.h"
diff --git a/src/include/pch/meson.build b/src/include/pch/meson.build
new file mode 100644
index 00000000000..2bcec49c3a2
--- /dev/null
+++ b/src/include/pch/meson.build
@@ -0,0 +1,4 @@
+# See https://github.com/mesonbuild/meson/issues/10338
+pch_c_h = meson.source_root() / meson.current_source_dir() / 'c_pch.h'
+pch_postgres_h = meson.source_root() / meson.current_source_dir() / 'postgres_pch.h'
+pch_postgres_fe_h = meson.source_root() / meson.current_source_dir() / 'postgres_fe_pch.h'
diff --git a/src/include/pch/postgres_fe_pch.h b/src/include/pch/postgres_fe_pch.h
new file mode 100644
index 00000000000..f3ea20912d3
--- /dev/null
+++ b/src/include/pch/postgres_fe_pch.h
@@ -0,0 +1 @@
+#include "postgres_fe.h"
diff --git a/src/include/pch/postgres_pch.h b/src/include/pch/postgres_pch.h
new file mode 100644
index 00000000000..71b2f35f76b
--- /dev/null
+++ b/src/include/pch/postgres_pch.h
@@ -0,0 +1 @@
+#include "postgres.h"
diff --git a/src/common/meson.build b/src/common/meson.build
index 23842e1ffef..1c9b8a3a018 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -147,6 +147,7 @@ foreach name, opts : pgcommon_variants
endif
c_args = opts.get('c_args', []) + common_cflags[cflagname]
cflag_libs += static_library('libpgcommon@0@_@1@'.format(name, cflagname),
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'sources': sources,
@@ -159,6 +160,7 @@ foreach name, opts : pgcommon_variants
lib = static_library('libpgcommon@0@'.format(name),
link_with: cflag_libs,
+ c_pch: pch_c_h,
include_directories: include_directories('.'),
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
diff --git a/src/port/meson.build b/src/port/meson.build
index ced2e014db8..c2222696f1b 100644
--- a/src/port/meson.build
+++ b/src/port/meson.build
@@ -161,6 +161,7 @@ foreach name, opts : pgport_variants
c_args = opts.get('c_args', []) + pgport_cflags[cflagname]
cflag_libs += static_library('libpgport@0@_@1@'.format(name, cflagname),
sources,
+ c_pch: pch_c_h,
kwargs: opts + {
'c_args': c_args,
'build_by_default': false,
@@ -172,6 +173,7 @@ foreach name, opts : pgport_variants
lib = static_library('libpgport@0@'.format(name),
pgport_sources,
link_with: cflag_libs,
+ c_pch: pch_c_h,
kwargs: opts + {
'dependencies': opts['dependencies'] + [ssl],
}
diff --git a/src/backend/meson.build b/src/backend/meson.build
index fefa40ddb64..676cb714d79 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -62,6 +62,7 @@ postgres_lib = static_library('postgres_lib',
backend_sources + timezone_sources + generated_backend_sources,
link_whole: backend_link_with,
dependencies: backend_build_deps,
+ c_pch: pch_postgres_h,
kwargs: internal_lib_args,
)
@@ -81,6 +82,10 @@ if cc.get_id() == 'msvc'
backend_link_args += '/DEF:@0@'.format(postgres_def.full_path())
backend_link_depends += postgres_def
+ # Due to the way msvc and meson's precompiled headers implementation
+ # interact, we need to have symbols from the full library available. Could
+ # be restricted to b_pch=true.
+ backend_link_with += postgres_lib
elif host_system == 'aix'
# The '.' argument leads mkldexport.sh to emit "#! .", which refers to the
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 974401d187e..72959fa29d6 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -66,6 +66,7 @@ endif
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
+ c_pch: pch_postgres_h,
kwargs: pg_mod_args + {
'include_directories': [stemmer_inc],
}
diff --git a/src/fe_utils/meson.build b/src/fe_utils/meson.build
index 3e226c260ac..fe0b801387c 100644
--- a/src/fe_utils/meson.build
+++ b/src/fe_utils/meson.build
@@ -23,6 +23,7 @@ fe_utils_sources += psqlscan
fe_utils = static_library('libpgfeutils',
fe_utils_sources + generated_headers,
+ c_pch: pch_postgres_fe_h,
include_directories: [postgres_inc, libpq_inc],
c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
dependencies: frontend_common_code,
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 3527a25c288..e66f632b54e 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -13,6 +13,7 @@ pg_dump_common_sources = files(
pg_dump_common = static_library('libpgdump_common',
pg_dump_common_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq, zlib],
kwargs: internal_lib_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index a7b927a45c7..212bc9ce6ef 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -24,6 +24,7 @@ endif
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 1264fc19fbd..a4c46bf5385 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -44,6 +44,7 @@ endif
psql = executable('psql',
psql_sources,
+ c_pch: pch_postgres_fe_h,
include_directories: include_directories('.'),
dependencies: [frontend_code, libpq, readline],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 63ab2fbacc2..c7a767b1454 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -49,6 +49,7 @@ libpq_st = static_library('libpq',
pic: true,
include_directories: [libpq_inc, postgres_inc],
c_args: ['-DSO_MAJOR_VERSION=5'],
+ c_pch: pch_postgres_fe_h,
dependencies: libpq_deps,
kwargs: default_lib_args,
)
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 535660085dd..cd3894e6a73 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -45,6 +45,7 @@ endif
plperl = shared_module('plperl',
plperl_sources,
+ c_pch: pch_postgres_h,
include_directories: [plperl_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [perl_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index c46c0a1da2a..27b2f5ef529 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -48,6 +48,7 @@ endif
plpgsql = shared_module('plpgsql',
plpgsql_sources,
+ c_pch: pch_postgres_h,
include_directories: include_directories('.'),
kwargs: pg_mod_args,
)
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 40888386b5f..7bd683580e8 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -36,6 +36,7 @@ endif
plpython = shared_module('plpython3',
plpython_sources,
+ c_pch: pch_postgres_h,
include_directories: [plpython_inc, postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [python3_dep, pg_mod_args['dependencies']],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index f09bb14c950..7a708776c99 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -22,6 +22,7 @@ endif
pltcl = shared_module('pltcl',
pltcl_sources,
+ c_pch: pch_postgres_h,
include_directories: [include_directories('.'), postgres_inc],
kwargs: pg_mod_args + {
'dependencies': [tcl_dep, pg_mod_args['dependencies']],
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 16f3b83e4d2..163a93c98fb 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -15,6 +15,7 @@ endif
bloom = shared_module('bloom',
bloom_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += bloom
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index e98c91dacc8..bfb7865d213 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -33,6 +33,7 @@ endif
btree_gist = shared_module('btree_gist',
btree_gist_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gist
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 2bb26bb772b..a2a4ec36cb0 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -18,6 +18,7 @@ endif
hstore = shared_module('hstore',
hstore_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index c8c7c07b308..839d6c4a7f6 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -13,6 +13,7 @@ endif
pg_trgm = shared_module('pg_trgm',
pg_trgm_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index 7fc7bbc7ca1..cc782578b49 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -78,6 +78,7 @@ endif
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [pgcrypto_deps, contrib_mod_args['dependencies']]
},
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 05e4cd46a5c..42d0b0e6ce9 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -12,6 +12,7 @@ endif
pgstattuple = shared_module('pgstattuple',
pgstattuple_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 8bef239e3c2..1ac0fa388ab 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -22,6 +22,7 @@ endif
sepgsql = shared_module('sepgsql',
sepgsql_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [selinux, contrib_mod_args['dependencies']],
}
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 89b0d677516..92ab3368428 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -15,6 +15,7 @@ endif
xml2 = shared_module('pgxml',
xml2_sources,
+ c_pch: pch_postgres_h,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index fd40ee86610..4985432d569 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -29,6 +29,7 @@ ecpglib_st = static_library('libecpg',
include_directories: ecpglib_inc,
c_args: ecpglib_c_args,
pic: true,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code, libpq, thread_dep],
link_with: [ecpg_pgtypes_so],
kwargs: default_lib_args,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 53cdad36422..0a5377a576a 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -25,6 +25,7 @@ ecpg_pgtypes_st = static_library('libpgtypes',
include_directories: ecpg_pgtypes_inc,
c_args: ecpg_pgtypes_c_args,
pic: true,
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code],
kwargs: default_lib_args,
)
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 74876f039c9..3d42ee439ff 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -102,6 +102,7 @@ endif
ecpg_exe = executable('ecpg',
ecpg_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
+ c_pch: pch_postgres_fe_h,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/.cirrus.yml b/.cirrus.yml
index efb2d2c4832..aea25fd7525 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -602,7 +602,7 @@ task:
# Use /DEBUG:FASTLINK to avoid high memory usage during linking
configure_script: |
vcvarsall x64
- meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --backend ninja --buildtype debug -Dc_link_args=/DEBUG:FASTLINK -Dcassert=true -Db_pch=true -Dssl=openssl -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
@@ -630,7 +630,7 @@ task:
configure_script: |
vcvarsall x64
- meson setup --buildtype debug --backend vs -Dcassert=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
+ meson setup --buildtype debug --backend vs -Dcassert=true -Db_pch=true -Dssl=openssl -Dlz4=enabled -Dzlib=enabled -Dextra_lib_dirs=c:\openssl\1.1\lib -Dextra_include_dirs=c:\openssl\1.1\include -DTAR=c:/windows/system32/tar.exe -DPG_TEST_EXTRA="%PG_TEST_EXTRA%" build
build_script: |
vcvarsall x64
diff --git a/meson.build b/meson.build
index 6f580222e90..5f09d2e079a 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,7 @@ project('postgresql',
meson_version: '>=0.54',
default_options: [
'warning_level=1', #-Wall equivalent
+ 'b_pch=false',
'buildtype=release',
]
)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0018-tests-Rename-conflicting-role-names.patch (13.3K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/19-v17-0018-tests-Rename-conflicting-role-names.patch)
download | inline diff:
From 698099f454ce05a0f25836a3fa4f45b68b546760 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 16:49:51 -0700
Subject: [PATCH v17 18/23] tests: Rename conflicting role names
These cause problems when running installcheck concurrently.
---
src/pl/plperl/expected/plperl_setup.out | 30 +++++++++----------
src/pl/plperl/sql/plperl_setup.sql | 30 +++++++++----------
contrib/adminpack/expected/adminpack.out | 20 ++++++-------
contrib/adminpack/sql/adminpack.sql | 20 ++++++-------
.../passwordcheck/expected/passwordcheck.out | 16 +++++-----
contrib/passwordcheck/sql/passwordcheck.sql | 16 +++++-----
6 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/src/pl/plperl/expected/plperl_setup.out b/src/pl/plperl/expected/plperl_setup.out
index 5234febefd6..5537a95ccc2 100644
--- a/src/pl/plperl/expected/plperl_setup.out
+++ b/src/pl/plperl/expected/plperl_setup.out
@@ -4,9 +4,9 @@
-- Before going ahead with the to-be-tested installations, verify that
-- a non-superuser is allowed to install plperl (but not plperlu) when
-- suitable permissions have been granted.
-CREATE USER regress_user1;
-CREATE USER regress_user2;
-SET ROLE regress_user1;
+CREATE USER regress_plperl_user1;
+CREATE USER regress_plperl_user2;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl; -- fail
ERROR: permission denied to create extension "plperl"
HINT: Must have CREATE privilege on current database to create this extension.
@@ -16,18 +16,18 @@ HINT: Must be superuser to create this extension.
RESET ROLE;
DO $$
begin
- execute format('grant create on database %I to regress_user1',
+ execute format('grant create on database %I to regress_plperl_user1',
current_database());
end;
$$;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl;
CREATE EXTENSION plperlu; -- fail
ERROR: permission denied to create extension "plperlu"
HINT: Must be superuser to create this extension.
CREATE SCHEMA plperl_setup_scratch;
SET search_path = plperl_setup_scratch;
-GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_user2;
+GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
CREATE FUNCTION foo1() returns int language plperl as '1;';
SELECT foo1();
foo1
@@ -38,15 +38,15 @@ SELECT foo1();
-- Must reconnect to avoid failure with non-MULTIPLICITY Perl interpreters
\c -
SET search_path = plperl_setup_scratch;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to change privileges on the language
revoke all on language plperl from public;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;'; -- fail
ERROR: permission denied for language plperl
-SET ROLE regress_user1;
-grant usage on language plperl to regress_user2;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user1;
+grant usage on language plperl to regress_plperl_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;';
SELECT foo2();
foo2
@@ -54,7 +54,7 @@ SELECT foo2();
2
(1 row)
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to drop the extension, but not the language per se
DROP LANGUAGE plperl CASCADE;
ERROR: cannot drop language plperl because extension plperl requires it
@@ -65,9 +65,9 @@ DETAIL: drop cascades to function foo1()
drop cascades to function foo2()
-- Clean up
RESET ROLE;
-DROP OWNED BY regress_user1;
-DROP USER regress_user1;
-DROP USER regress_user2;
+DROP OWNED BY regress_plperl_user1;
+DROP USER regress_plperl_user1;
+DROP USER regress_plperl_user2;
-- Now install the versions that will be used by subsequent test scripts.
CREATE EXTENSION plperl;
CREATE EXTENSION plperlu;
diff --git a/src/pl/plperl/sql/plperl_setup.sql b/src/pl/plperl/sql/plperl_setup.sql
index a89cf56617e..0eac9156294 100644
--- a/src/pl/plperl/sql/plperl_setup.sql
+++ b/src/pl/plperl/sql/plperl_setup.sql
@@ -6,10 +6,10 @@
-- a non-superuser is allowed to install plperl (but not plperlu) when
-- suitable permissions have been granted.
-CREATE USER regress_user1;
-CREATE USER regress_user2;
+CREATE USER regress_plperl_user1;
+CREATE USER regress_plperl_user2;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl; -- fail
CREATE EXTENSION plperlu; -- fail
@@ -18,18 +18,18 @@ RESET ROLE;
DO $$
begin
- execute format('grant create on database %I to regress_user1',
+ execute format('grant create on database %I to regress_plperl_user1',
current_database());
end;
$$;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
CREATE EXTENSION plperl;
CREATE EXTENSION plperlu; -- fail
CREATE SCHEMA plperl_setup_scratch;
SET search_path = plperl_setup_scratch;
-GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_user2;
+GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
CREATE FUNCTION foo1() returns int language plperl as '1;';
SELECT foo1();
@@ -38,25 +38,25 @@ SELECT foo1();
\c -
SET search_path = plperl_setup_scratch;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to change privileges on the language
revoke all on language plperl from public;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;'; -- fail
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-grant usage on language plperl to regress_user2;
+grant usage on language plperl to regress_plperl_user2;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
CREATE FUNCTION foo2() returns int language plperl as '2;';
SELECT foo2();
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
-- Should be able to drop the extension, but not the language per se
DROP LANGUAGE plperl CASCADE;
@@ -64,9 +64,9 @@ DROP EXTENSION plperl CASCADE;
-- Clean up
RESET ROLE;
-DROP OWNED BY regress_user1;
-DROP USER regress_user1;
-DROP USER regress_user2;
+DROP OWNED BY regress_plperl_user1;
+DROP USER regress_plperl_user1;
+DROP USER regress_plperl_user2;
-- Now install the versions that will be used by subsequent test scripts.
CREATE EXTENSION plperl;
diff --git a/contrib/adminpack/expected/adminpack.out b/contrib/adminpack/expected/adminpack.out
index 76aafe6316a..6bcf2217f25 100644
--- a/contrib/adminpack/expected/adminpack.out
+++ b/contrib/adminpack/expected/adminpack.out
@@ -36,10 +36,10 @@ SELECT pg_read_file('test_file1');
-- disallowed file paths for non-superusers and users who are
-- not members of pg_write_server_files
-CREATE ROLE regress_user1;
-GRANT pg_read_all_settings TO regress_user1;
-GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
-SET ROLE regress_user1;
+CREATE ROLE regress_adminpack_user1;
+GRANT pg_read_all_settings TO regress_adminpack_user1;
+GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('../test_file0', 'test0', false);
ERROR: path must be in or below the current directory
SELECT pg_file_write('/tmp/test_file0', 'test0', false);
@@ -53,9 +53,9 @@ SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4'
SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
ERROR: absolute path not allowed
RESET ROLE;
-REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_user1;
-REVOKE pg_read_all_settings FROM regress_user1;
-DROP ROLE regress_user1;
+REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
+REVOKE pg_read_all_settings FROM regress_adminpack_user1;
+DROP ROLE regress_adminpack_user1;
-- sync
SELECT pg_file_sync('test_file1'); -- sync file
pg_file_sync
@@ -153,8 +153,8 @@ SELECT pg_file_unlink('test_file4');
(1 row)
-- superuser checks
-CREATE USER regress_user1;
-SET ROLE regress_user1;
+CREATE USER regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('test_file0', 'test0', false);
ERROR: permission denied for function pg_file_write
SELECT pg_file_sync('test_file0');
@@ -167,6 +167,6 @@ ERROR: permission denied for function pg_file_unlink
SELECT pg_logdir_ls();
ERROR: permission denied for function pg_logdir_ls
RESET ROLE;
-DROP USER regress_user1;
+DROP USER regress_adminpack_user1;
-- no further tests for pg_logdir_ls() because it depends on the
-- server's logging setup
diff --git a/contrib/adminpack/sql/adminpack.sql b/contrib/adminpack/sql/adminpack.sql
index 918d0bdc65e..5776c9af0d1 100644
--- a/contrib/adminpack/sql/adminpack.sql
+++ b/contrib/adminpack/sql/adminpack.sql
@@ -14,20 +14,20 @@ SELECT pg_read_file('test_file1');
-- disallowed file paths for non-superusers and users who are
-- not members of pg_write_server_files
-CREATE ROLE regress_user1;
+CREATE ROLE regress_adminpack_user1;
-GRANT pg_read_all_settings TO regress_user1;
-GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
+GRANT pg_read_all_settings TO regress_adminpack_user1;
+GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
-SET ROLE regress_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('../test_file0', 'test0', false);
SELECT pg_file_write('/tmp/test_file0', 'test0', false);
SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4', false);
SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
RESET ROLE;
-REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_user1;
-REVOKE pg_read_all_settings FROM regress_user1;
-DROP ROLE regress_user1;
+REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
+REVOKE pg_read_all_settings FROM regress_adminpack_user1;
+DROP ROLE regress_adminpack_user1;
-- sync
SELECT pg_file_sync('test_file1'); -- sync file
@@ -59,8 +59,8 @@ SELECT pg_file_unlink('test_file4');
-- superuser checks
-CREATE USER regress_user1;
-SET ROLE regress_user1;
+CREATE USER regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
SELECT pg_file_write('test_file0', 'test0', false);
SELECT pg_file_sync('test_file0');
@@ -69,7 +69,7 @@ SELECT pg_file_unlink('test_file0');
SELECT pg_logdir_ls();
RESET ROLE;
-DROP USER regress_user1;
+DROP USER regress_adminpack_user1;
-- no further tests for pg_logdir_ls() because it depends on the
diff --git a/contrib/passwordcheck/expected/passwordcheck.out b/contrib/passwordcheck/expected/passwordcheck.out
index e04cda6bd95..2f917169eb6 100644
--- a/contrib/passwordcheck/expected/passwordcheck.out
+++ b/contrib/passwordcheck/expected/passwordcheck.out
@@ -1,19 +1,19 @@
LOAD 'passwordcheck';
-CREATE USER regress_user1;
+CREATE USER regress_passwordcheck_user1;
-- ok
-ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
-- error: too short
-ALTER USER regress_user1 PASSWORD 'tooshrt';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
ERROR: password is too short
-- error: contains user name
-ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
ERROR: password must not contain user name
-- error: contains only letters
-ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
ERROR: password must contain both letters and nonletters
-- encrypted ok (password is "secret")
-ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
-- error: password is user name
-ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
ERROR: password must not equal user name
-DROP USER regress_user1;
+DROP USER regress_passwordcheck_user1;
diff --git a/contrib/passwordcheck/sql/passwordcheck.sql b/contrib/passwordcheck/sql/passwordcheck.sql
index d98796ac494..df0f9ac0d39 100644
--- a/contrib/passwordcheck/sql/passwordcheck.sql
+++ b/contrib/passwordcheck/sql/passwordcheck.sql
@@ -1,23 +1,23 @@
LOAD 'passwordcheck';
-CREATE USER regress_user1;
+CREATE USER regress_passwordcheck_user1;
-- ok
-ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
-- error: too short
-ALTER USER regress_user1 PASSWORD 'tooshrt';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
-- error: contains user name
-ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
-- error: contains only letters
-ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
-- encrypted ok (password is "secret")
-ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
-- error: password is user name
-ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
-DROP USER regress_user1;
+DROP USER regress_passwordcheck_user1;
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0019-meson-Add-installcheck-equivalent.patch (12.3K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/20-v17-0019-meson-Add-installcheck-equivalent.patch)
download | inline diff:
From cb8bc48c3a3749bd49a55df50e9529c1c1eb111a Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 16:57:01 -0700
Subject: [PATCH v17 19/23] meson: Add installcheck equivalent
run all tests that support running against existing server:
$ meson test --setup running
run just the main pg_regress tests against existing server:
$ meson test --setup running main-running/regress
---
contrib/basic_archive/meson.build | 1 +
contrib/pg_freespacemap/meson.build | 3 +
contrib/pg_stat_statements/meson.build | 4 ++
contrib/pg_walinspect/meson.build | 3 +
contrib/test_decoding/meson.build | 5 ++
src/interfaces/ecpg/test/meson.build | 1 +
src/test/isolation/meson.build | 3 +
src/test/modules/commit_ts/meson.build | 3 +
src/test/modules/snapshot_too_old/meson.build | 3 +
src/test/modules/test_oat_hooks/meson.build | 1 +
src/test/modules/test_pg_dump/meson.build | 2 +
src/test/modules/worker_spi/meson.build | 4 +-
src/test/regress/meson.build | 3 +
.cirrus.yml | 15 +++++
meson.build | 57 +++++++++++++++++--
15 files changed, 102 insertions(+), 6 deletions(-)
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index c30dcfa5d41..d4ecaec47b8 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -25,5 +25,6 @@ tests += {
'regress_args': [
'--temp-config', files('basic_archive.conf'),
],
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index 904b37b6e9b..f802e297b67 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -33,5 +33,8 @@ tests += {
'regress_args': [
'--temp-config', files('pg_freespacemap.conf')
],
+ # Disabled because these tests require "autovacuum=off", which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index 854df138e76..bd0e42331eb 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -41,5 +41,9 @@ tests += {
'pg_stat_statements',
],
'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
+ # Disabled because these tests require
+ # "shared_preload_libraries=pg_stat_statements", which typical
+ # runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index 4314a3182a2..351f184de83 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -28,6 +28,9 @@ tests += {
'sql': [
'pg_walinspect',
],
+ # Disabled because these tests require "wal_level=replica", which
+ # some runningcheck users do not have (e.g. buildfarm clients).
'regress_args': ['--temp-config', files('walinspect.conf')],
+ 'runningcheck': false,
},
}
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index 6376103c689..a1aaae2dc3f 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -43,6 +43,9 @@ tests += {
'regress_args': [
'--temp-config', files('logical.conf'),
],
+ # Disabled because these tests require "wal_level=logical", which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
'isolation': {
'specs': [
@@ -60,6 +63,8 @@ tests += {
'regress_args': [
'--temp-config', files('logical.conf'),
],
+ # see above
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index 94b26d10314..d4f1f1c0fcf 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -84,6 +84,7 @@ tests += {
'test_kwargs': {
'depends': ecpg_test_dependencies,
},
+ 'dbname': 'ecpg1_regression,ecpg2_regression',
'regress_args': ecpg_regress_args,
},
}
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index ba27b8c1d44..8737392f23b 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -67,5 +67,8 @@ tests += {
'priority': 40,
'timeout': 1000,
},
+ # checks pg_locks etc
+ 'runningcheck-parallel': false,
+ 'dbname': 'isolation',
},
}
diff --git a/src/test/modules/commit_ts/meson.build b/src/test/modules/commit_ts/meson.build
index 60cb12164d2..fa86e70e880 100644
--- a/src/test/modules/commit_ts/meson.build
+++ b/src/test/modules/commit_ts/meson.build
@@ -6,6 +6,9 @@ tests += {
'sql': [
'commit_timestamp',
],
+ # Disabled because these tests require "track_commit_timestamp = on",
+ # which typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/test/modules/snapshot_too_old/meson.build b/src/test/modules/snapshot_too_old/meson.build
index efd3f1f113b..5094b52949b 100644
--- a/src/test/modules/snapshot_too_old/meson.build
+++ b/src/test/modules/snapshot_too_old/meson.build
@@ -10,5 +10,8 @@ tests += {
'sto_using_hash_index',
],
'regress_args': ['--temp-config', files('sto.conf')],
+ # Disabled because these tests require "old_snapshot_threshold" >= 0, which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 8802bbbac55..e9d09d92c30 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -25,5 +25,6 @@ tests += {
'test_oat_hooks',
],
'regress_args': ['--no-locale', '--encoding=UTF8'],
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/test_pg_dump/meson.build b/src/test/modules/test_pg_dump/meson.build
index 41021829f3a..73f1fcf9428 100644
--- a/src/test/modules/test_pg_dump/meson.build
+++ b/src/test/modules/test_pg_dump/meson.build
@@ -13,6 +13,8 @@ tests += {
'sql': [
'test_pg_dump',
],
+ # doesn't delete its user
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index a4a158c75b9..660d721eea9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -30,6 +30,8 @@ tests += {
'sql': [
'worker_spi',
],
- 'regress_args': ['--temp-config', files('dynamic.conf'), '--dbname=contrib_regression'],
+ 'dbname': 'contrib_regression',
+ 'regress_args': ['--temp-config', files('dynamic.conf')],
+ 'runningcheck': false,
},
}
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index 963c0f64ed5..a781fa2af1d 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -64,5 +64,8 @@ tests += {
'priority': 50,
'timeout': 1000,
},
+ 'dbname': 'regression',
+ # checks pg_locks etc
+ 'runningcheck-parallel': false,
},
}
diff --git a/.cirrus.yml b/.cirrus.yml
index aea25fd7525..16a1396d869 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -121,6 +121,21 @@ task:
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
EOF
+ # test runningcheck, freebsd chosen because it's currently fast enough
+ test_running_script: |
+ su postgres <<-EOF
+ set -e
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --quiet --suite setup
+ export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/lib/:$LD_LIBRARY_PATH"
+ mkdir -p build/testrun
+ build/tmp_install/usr/local/bin/initdb -N build/runningcheck --no-instructions -A trust
+ echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf
+ build/tmp_install/usr/local/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
+ build/tmp_install/usr/local/bin/pg_ctl -D build/runningcheck stop
+ EOF
+
on_failure:
<<: *on_failure_meson
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
diff --git a/meson.build b/meson.build
index 5f09d2e079a..5e7e95f352c 100644
--- a/meson.build
+++ b/meson.build
@@ -2866,6 +2866,18 @@ endif
# Test Generation
###############################################################
+# when using a meson version understanding exclude_suites, define a 'default'
+# test setup that excludes tests running against a pre-existing install and a
+# 'running' setup that conflicts with creation of the temporary installation
+# and tap tests (which don't support running against a running server).
+running_suites = []
+install_suites = []
+if meson.version().version_compare('>=0.57')
+ runningcheck = true
+else
+ runningcheck = false
+endif
+
testwrap = files('src/tools/testwrap')
foreach test_dir : tests
@@ -2894,18 +2906,27 @@ foreach test_dir : tests
test_output = test_result_dir / test_dir['name'] / kind
+ # unless specified by the test, choose a non-conflicting database name,
+ # to avoid conflicts when running against existing server.
+ dbname = t.get('dbname',
+ 'regression_@0@_@1@'.format(test_dir['name'], kind))
+
test_command = [
runner.full_path(),
'--inputdir', t.get('inputdir', test_dir['sd']),
'--expecteddir', t.get('expecteddir', test_dir['sd']),
'--outputdir', test_output,
- '--temp-instance', test_output / 'tmp_check',
'--bindir', '',
'--dlpath', test_dir['bd'],
'--max-concurrent-tests=20',
- '--port', testport.to_string(),
+ '--dbname', dbname,
] + t.get('regress_args', [])
+ test_command_tmp_install = test_command + [
+ '--temp-instance', test_output / 'tmp_check',
+ '--port', testport.to_string(),
+ ]
+
if t.has_key('schedule')
test_command += ['--schedule', t['schedule'],]
endif
@@ -2920,7 +2941,6 @@ foreach test_dir : tests
env.prepend('PATH', temp_install_bindir, test_dir['bd'])
test_kwargs = {
- 'suite': [test_dir['name']],
'priority': 10,
'timeout': 1000,
'depends': test_deps + t.get('deps', []),
@@ -2931,10 +2951,28 @@ foreach test_dir : tests
python,
args: testwrap_base + [
'--testname', kind,
- '--', test_command,
+ '--', test_command_tmp_install,
],
+ suite: test_dir['name'],
kwargs: test_kwargs,
)
+ install_suites += test_dir['name']
+
+ # some tests can't support running against running DB
+ if runningcheck and t.get('runningcheck', true)
+ suite = test_dir['name'] + '-running'
+ test(suite / kind,
+ python,
+ args: testwrap_base + [
+ '--testname', kind,
+ '--', test_command,
+ ],
+ is_parallel: t.get('runningcheck-parallel', true),
+ suite: suite,
+ kwargs: test_kwargs,
+ )
+ running_suites += suite
+ endif
testport += 1
elif kind == 'tap'
@@ -2957,9 +2995,10 @@ foreach test_dir : tests
env.set(name, value)
endforeach
+ suite = test_dir['name']
test_kwargs = {
'protocol': 'tap',
- 'suite': [test_dir['name']],
+ 'suite': suite,
'timeout': 1000,
'depends': test_deps + t.get('deps', []),
'env': env,
@@ -2985,6 +3024,7 @@ foreach test_dir : tests
],
)
endforeach
+ install_suites += suite
else
error('unknown kind @0@ of test in @1@'.format(kind, test_dir['sd']))
endif
@@ -2993,6 +3033,13 @@ foreach test_dir : tests
endforeach # directories with tests
+if runningcheck
+ add_test_setup('default',
+ is_default: true,
+ exclude_suites: running_suites)
+ add_test_setup('running',
+ exclude_suites: ['setup'] + install_suites)
+endif
###############################################################
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0020-meson-Add-postgresql-extension.pc-for-building-e.patch (3.7K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/21-v17-0020-meson-Add-postgresql-extension.pc-for-building-e.patch)
download | inline diff:
From 40facb419c2c3af1b9d1c14621a4cee032837ce3 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 27 Aug 2022 09:52:03 -0700
Subject: [PATCH v17 20/23] meson: Add postgresql-extension.pc for building
extension libraries
This should work with several other buildsystems.
TODO: Docs and example
---
src/backend/meson.build | 96 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 676cb714d79..156ac788508 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -185,6 +185,102 @@ pg_mod_args = default_mod_args + {
+###############################################################
+# Define a .pc file that can be used to build server extensions
+###############################################################
+
+pg_ext_vars = []
+pg_ext_vars_inst = []
+pg_ext_vars_uninst = []
+
+pg_ext_cflags = pg_mod_c_args
+pg_ext_libs = [backend_mod_code, thread_dep, ldflags, ldflags_mod]
+pg_ext_subdirs = ['']
+
+# Compute directories to add include directories to the .pc files for.
+# This is a bit more complicated due to port/win32 etc.
+i = 0
+foreach incdir : postgres_inc_d
+ if incdir.startswith('src/include')
+ subincdir = dir_include_pkg_rel / 'server' / incdir.split('src/include/').get(1, '')
+ else
+ subincdir = ''
+ endif
+ pg_ext_subdirs += subincdir
+
+ # Add directories in source / build dir containing headers to cflags for the
+ # -uninstalled.pc
+ pg_ext_vars_uninst += [
+ 'build_inc@0@=-I${prefix}/@1@'.format(i, incdir),
+ 'src_inc@0@=-I${srcdir}/@1@'.format(i, incdir),
+ ]
+ pg_ext_cflags += [
+ '${build_inc@0@}'.format(i),
+ '${src_inc@0@}'.format(i)
+ ]
+
+ i += 1
+endforeach
+
+
+# Extension modules should likely also use -fwrapv etc. But it it's a bit odd
+# to expose it to a .pc file?
+pg_ext_cflags += cflags
+
+# Directories for extensions to install into
+# XXX: more needed
+pg_ext_vars += 'pkglibdir=${prefix}/@0@'.format(dir_lib_pkg)
+pg_ext_vars += 'dir_mod=${pkglibdir}'
+pg_ext_vars += 'dir_data=${prefix}/@0@'.format(dir_data_extension)
+# referenced on some platforms, via mod_link_with_dir
+pg_ext_vars += 'bindir=${prefix}/@0@'.format(dir_bin)
+
+# XXX: Define variables making it easy to define tests, too
+
+# Some platforms need linker flags to link with binary, they are the same
+# between building with meson and .pc file, except that we have have to
+# reference a variable to make it work for both normal and -uninstalled .pc
+# files.
+if mod_link_args_fmt.length() != 0
+ assert(link_with_inst != '')
+ assert(link_with_uninst != '')
+
+ pg_ext_vars_inst += 'mod_link_with=@0@'.format(link_with_inst)
+ pg_ext_vars_uninst += 'mod_link_with=@0@'.format(link_with_uninst)
+
+ foreach el : mod_link_args_fmt
+ pg_ext_libs += el.format('${mod_link_with}')
+ endforeach
+endif
+
+# main .pc to build extensions
+pkgconfig.generate(
+ name: 'postgresql-extension',
+ description: 'PostgreSQL Extension Support',
+ url: pg_url,
+
+ subdirs: pg_ext_subdirs,
+ libraries: pg_ext_libs,
+ extra_cflags: pg_ext_cflags,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+# a .pc depending on the above, but with all our warnings enabled
+pkgconfig.generate(
+ name: 'postgresql-extension-warnings',
+ description: 'PostgreSQL Extension Support - Compiler Warnings',
+ requires: 'postgresql-extension',
+ url: pg_url,
+ extra_cflags: cflags_warn,
+
+ variables: pg_ext_vars + pg_ext_vars_inst,
+ uninstalled_variables: pg_ext_vars + pg_ext_vars_uninst,
+)
+
+
+
# Shared modules that, on some system, link against the server binary. Only
# enter these after we defined the server build.
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0021-meson-Add-LLVM-bitcode-emission.patch (5.2K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/22-v17-0021-meson-Add-LLVM-bitcode-emission.patch)
download | inline diff:
From f561374caeb318949bc065f6db8ecf3ec34d1bfc Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 24 Aug 2022 19:58:45 -0700
Subject: [PATCH v17 21/23] meson: Add LLVM bitcode emission
This needs a bit more love before being ready...
---
src/backend/jit/llvm/meson.build | 21 +++++++++++++++
src/backend/meson.build | 46 ++++++++++++++++++++++++++++++++
meson.build | 2 ++
src/tools/irlink | 43 +++++++++++++++++++++++++++++
4 files changed, 112 insertions(+)
create mode 100644 src/tools/irlink
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index 5fb63768358..5b339e33934 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -54,6 +54,19 @@ else
llvm_irgen_command = clang
endif
+llvm_irlink_kw = {
+ 'command': [
+ irlink,
+ '--name', 'postgres',
+ '--lto', llvm_lto,
+ '--outdir', '@OUTPUT0@',
+ '--privdir', '@PRIVATE_DIR@',
+ '@INPUT@',
+ ],
+ 'install': true,
+ 'install_dir': dir_lib_pkg,
+}
+
# XXX: Need to determine proper version of the function cflags for clang
bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
@@ -77,3 +90,11 @@ llvmjit_types = custom_target('llvmjit_types.bc',
depfile: '@BASENAME@.c.bc.d',
)
backend_targets += llvmjit_types
+
+# Figure out -I's needed to build all postgres code, including all its
+# dependencies
+pkg_config = find_program(['pkg-config', 'pkgconf'], required: true)
+r = run_command(pkg_config,
+ ['--cflags-only-I', meson.build_root() / 'meson-uninstalled/postgresql-extension-uninstalled.pc'],
+ check: true)
+bitcode_cflags += r.stdout().split()
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 156ac788508..a535543ee9e 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -289,3 +289,49 @@ subdir('replication/libpqwalreceiver')
subdir('replication/pgoutput')
subdir('snowball')
subdir('utils/mb/conversion_procs')
+
+
+
+###############################################################
+# emit LLVM bitcode of backend code for JIT inlining
+###############################################################
+
+if llvm.found()
+
+ # custom_target() insists on targeting files into the current
+ # directory. But we have files with the same name in different
+ # subdirectories. generators() don't have that problem, but their results
+ # are not installable. The irlink command copies the files for us.
+ #
+ # FIXME: this needs to be in a central place
+ #
+ # generators don't accept CustomTargetIndex as input or 'depends', nor do
+ # they like targets with more than one output. However, a custom target
+ # accepts them as input without a problem. So we have the below transitive
+ # target :(
+
+ transitive_depend_target = custom_target('stamp',
+ input: generated_headers + generated_backend_headers + generated_backend_sources,
+ output: 'stamp',
+ command: [touch, '@OUTPUT@'],
+ install: false)
+
+ llvm_gen = generator(llvm_irgen_command,
+ arguments: llvm_irgen_args + bitcode_cflags,
+ depends: transitive_depend_target,
+ depfile: '@BASENAME@.c.bc.d',
+ output: '@PLAINNAME@.bc',
+ )
+
+ bc_backend_sources = llvm_gen.process(backend_sources,
+ preserve_path_from: meson.current_source_dir())
+
+ postgres_llvm = custom_target('bitcode',
+ output: ['bitcode'],
+ input: bc_backend_sources,
+ kwargs: llvm_irlink_kw,
+ )
+
+ backend_targets += postgres_llvm
+
+endif
diff --git a/meson.build b/meson.build
index 5e7e95f352c..d24e04d1544 100644
--- a/meson.build
+++ b/meson.build
@@ -674,6 +674,8 @@ if not llvmopt.disabled()
ccache = find_program('ccache', native: true, required: false)
clang = find_program(llvm_binpath / 'clang', required: true)
+ llvm_lto = find_program(llvm_binpath / 'llvm-lto', required: true)
+ irlink = find_program('src/tools/irlink', native: true)
endif
else
llvm = not_found_dep
diff --git a/src/tools/irlink b/src/tools/irlink
new file mode 100644
index 00000000000..813bbf13398
--- /dev/null
+++ b/src/tools/irlink
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+import argparse
+
+parser = argparse.ArgumentParser(
+ description='generate PostgreSQL JIT IR module')
+
+parser.add_argument('--name', type=str, required=True)
+parser.add_argument('--lto', type=str, required=True)
+parser.add_argument('--privdir', type=str, required=True)
+parser.add_argument('--outdir', type=str, required=True)
+parser.add_argument('INPUT', type=str, nargs='+')
+
+args = parser.parse_args()
+
+outdir = os.path.realpath(args.outdir)
+privdir = os.path.realpath(args.privdir)
+
+index = '{0}/{1}.index.bc'.format(outdir, args.name)
+destdir = '{0}/{1}'.format(outdir, args.name)
+
+# Remove old contents if exist
+if os.path.exists(destdir):
+ shutil.rmtree(destdir)
+
+shutil.copytree(privdir, destdir)
+
+# Change working directory for irlink to link correctly
+os.chdir(args.outdir)
+
+file_names = []
+for input in args.INPUT:
+ file_names += [args.name + input.replace(args.privdir, '')]
+
+command = [args.lto, '-thinlto', '-thinlto-action=thinlink',
+ '-o', index] + file_names
+res = subprocess.run(command)
+
+exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0022-meson-Add-support-for-relative-rpaths-fixing-tes.patch (8.4K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/23-v17-0022-meson-Add-support-for-relative-rpaths-fixing-tes.patch)
download | inline diff:
From 19f248fae1e67354683ef31c1497bacc5c7df25f Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 17:24:47 -0700
Subject: [PATCH v17 22/23] meson: Add support for relative rpaths, fixing
tests on MacOS w/ SIP
---
meson.build | 68 ++++++++++----
.../relativize_shared_library_references | 88 +++++++++++++++++++
src/tools/relpath.py | 6 ++
3 files changed, 145 insertions(+), 17 deletions(-)
create mode 100755 src/tools/relativize_shared_library_references
create mode 100755 src/tools/relpath.py
diff --git a/meson.build b/meson.build
index d24e04d1544..3bbcd78d319 100644
--- a/meson.build
+++ b/meson.build
@@ -160,6 +160,7 @@ portname = host_system
exesuffix = '' # overridden below where necessary
dlsuffix = '.so' # overridden below where necessary
+rpath_origin = '$ORIGIN'
library_path_var = 'LD_LIBRARY_PATH'
# Format of file to control exports from libraries, and how to pass them to
@@ -210,6 +211,7 @@ elif host_system == 'cygwin'
elif host_system == 'darwin'
dlsuffix = '.dylib'
library_path_var = 'DYLD_LIBRARY_PATH'
+ rpath_origin = '@loader_path'
export_file_format = 'darwin'
export_fmt = '-exported_symbols_list=@0@'
@@ -242,8 +244,16 @@ elif host_system == 'netbsd'
# LDFLAGS.
ldflags += ['-Wl,-z,now', '-Wl,-z,relro']
+ # netbsd patched their meson in a broken way:
+ # https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=56959
+ # until there's a way out of that, disable rpath_origin
+ rpath_origin = ''
+
elif host_system == 'openbsd'
- # you're ok
+ # openbsd's $ORIGIN doesn't use an absolute path to the binary, but argv[0]
+ # (i.e. absolute when invoked with an absolute name, but e.g. not absolute
+ # when invoked via PATH search).
+ rpath_origin = ''
elif host_system == 'sunos'
portname = 'solaris'
@@ -255,6 +265,7 @@ elif host_system == 'windows'
exesuffix = '.exe'
dlsuffix = '.dll'
library_path_var = ''
+ rpath_origin = ''
export_file_format = 'win'
export_file_suffix = 'def'
@@ -2479,25 +2490,41 @@ bin_install_rpaths = []
lib_install_rpaths = []
mod_install_rpaths = []
-
-# Don't add rpaths on darwin for now - as long as only absolute references to
-# libraries are needed, absolute LC_ID_DYLIB ensures libraries can be found in
-# their final destination.
+# Add extra_lib_dirs to rpath. This ensures we find libraries we depend on.
+#
+# Not needed on darwin, even if we use relative rpaths for our own libraries,
+# as the install_name of libraries in extra_lib_dirs will point to their
+# location anyway.
if host_system != 'darwin'
+ bin_install_rpaths += postgres_lib_d
+ lib_install_rpaths += postgres_lib_d
+ mod_install_rpaths += postgres_lib_d
+endif
+
+# If the host can form relative rpaths, use that to make the installation
+# properly relocatable
+if rpath_origin != ''
+ # PG binaries might need to link to libpq, use relative path to reference
+ bin_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_bin, dir_lib, check: true).stdout().strip()
+ bin_install_rpaths += rpath_origin / bin_to_lib
+
+ # PG extensions might need to link to libpq, use relative path to reference
+ # (often just .)
+ mod_to_lib = run_command(python, files('src/tools/relpath.py'),
+ dir_lib_pkg, dir_lib, check: true).stdout().strip()
+ mod_install_rpaths += rpath_origin / mod_to_lib
+
+ test_use_library_path_var = false
+else
+
# Add absolute path to libdir to rpath. This ensures installed binaries /
# libraries find our libraries (mainly libpq).
bin_install_rpaths += dir_prefix / dir_lib
lib_install_rpaths += dir_prefix / dir_lib
mod_install_rpaths += dir_prefix / dir_lib
- # Add extra_lib_dirs to rpath. This ensures we find libraries we depend on.
- #
- # Not needed on darwin even if we use relative rpaths for our own libraries,
- # as the install_name of libraries in extra_lib_dirs will point to their
- # location anyway.
- bin_install_rpaths += postgres_lib_d
- lib_install_rpaths += postgres_lib_d
- mod_install_rpaths += postgres_lib_d
+ test_use_library_path_var = true
endif
@@ -2790,6 +2817,14 @@ above, or by running configure and then make maintainer-clean.
endif
+# To make MacOS installation work without a prior make install, even with SIP
+# enabled, make rpaths relative after installation. This also makes the
+# installation relocatable.
+if host_system == 'darwin'
+ meson.add_install_script('src/tools/relativize_shared_library_references')
+endif
+
+
###############################################################
# Test prep
@@ -2855,10 +2890,9 @@ test_env.set('REGRESS_SHLIB', regress_module.full_path())
# Export PG_TEST_EXTRA so it can be checked in individual tap tests.
test_env.set('PG_TEST_EXTRA', get_option('PG_TEST_EXTRA'))
-# Add the temporary installation to the library search path on platforms where
-# that works (everything but windows, basically). On windows everything
-# library-like gets installed into bindir, solving that issue.
-if library_path_var != ''
+# On platforms without $ORIGIN support we need to add the temporary
+# installation to the library search path.
+if test_use_library_path_var and library_path_var != ''
test_env.prepend(library_path_var, test_install_location / get_option('libdir'))
endif
diff --git a/src/tools/relativize_shared_library_references b/src/tools/relativize_shared_library_references
new file mode 100755
index 00000000000..280bd48fd32
--- /dev/null
+++ b/src/tools/relativize_shared_library_references
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+# -*-python-*-
+
+# This script updates a macos postgres installation to reference all internal
+# shared libraries using rpaths, leaving absolute install_names in the
+# libraries themselves intact.
+
+import os
+import sys
+import json
+import subprocess
+import shutil
+
+
+def installed_path(destdir, path):
+ if destdir is not None:
+ return f'{destdir}{path}'
+ else:
+ return path
+
+
+def collect_information():
+ shared_libraries = []
+ executables = []
+ shared_modules = []
+
+ meson_info_p = os.path.join(build_root, 'meson-info')
+ targets = json.load(
+ open(os.path.join(meson_info_p, 'intro-targets.json')))
+ installed = json.load(
+ open(os.path.join(meson_info_p, 'intro-installed.json')))
+
+ for target in targets:
+ if not target['installed']:
+ continue
+
+ filenames = target['filename']
+
+ if target['type'] == 'shared library':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+
+ shared_libraries.append(installed[filename])
+
+ if target['type'] == 'executable':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ executables.append(installed[filename])
+
+ if target['type'] == 'shared module':
+ assert(len(filenames) == 1)
+ filename = filenames[0]
+ shared_modules.append(installed[filename])
+
+ return shared_libraries, executables, shared_modules
+
+
+def patch_references(destdir, shared_libraries, executables, shared_modules):
+ install_name_tool = [shutil.which('install_name_tool')]
+
+ for lib in shared_libraries:
+ libname = os.path.basename(lib)
+ libpath = installed_path(destdir, lib)
+ newref = f'@rpath/{libname}'
+
+ for patch in shared_modules + executables:
+ patchpath = installed_path(destdir, patch)
+
+ # print(f'in {patchpath} replace reference to {libpath} with {newref}')
+ if not os.path.exists(patchpath):
+ print(f"path {patchpath} doesn't exist", file=sys.stderr)
+ sys.exit(1)
+
+ cmd = install_name_tool + ['-change', lib, newref, patchpath]
+ subprocess.check_call(cmd)
+
+
+if __name__ == '__main__':
+ build_root = os.environ['MESON_BUILD_ROOT']
+ destdir = os.environ.get('DESTDIR', None)
+
+ print(f'making references to shared libraries relative, destdir is {destdir}',
+ file=sys.stderr)
+
+ shared_libraries, executables, shared_modules = collect_information()
+ patch_references(destdir, shared_libraries, executables, shared_modules)
+
+ sys.exit(0)
diff --git a/src/tools/relpath.py b/src/tools/relpath.py
new file mode 100755
index 00000000000..87bcb496ab5
--- /dev/null
+++ b/src/tools/relpath.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+print(os.path.relpath(sys.argv[2], start=sys.argv[1]))
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v17-0023-meson-wip-headerchecks-cpluspluschecks.patch (2.9K, ../../20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de/24-v17-0023-meson-wip-headerchecks-cpluspluschecks.patch)
download | inline diff:
From ce64e8f3abbc2254acc53dcb6200c6a368197c51 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 26 Sep 2022 13:08:56 -0700
Subject: [PATCH v17 23/23] meson: wip: headerchecks cpluspluschecks
---
src/include/meson.build | 4 ++--
src/meson.build | 7 +++++++
src/tools/pginclude/cpluspluscheck | 4 ++--
src/tools/pginclude/headerscheck | 4 ++--
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/include/meson.build b/src/include/meson.build
index 35c06c4856a..f20614573ce 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -42,9 +42,9 @@ config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
var_cc = ' '.join(cc.cmd_array())
var_cpp = ' '.join(cc.cmd_array() + ['-E'])
-var_cflags = ' '.join(cflags + cflags_warn + get_option('c_args'))
+var_cflags = ' '.join(cflags + cflags_warn + get_option('c_args') + ['-Wall'])
if llvm.found()
- var_cxxflags = ' '.join(cxxflags + cxxflags_warn + get_option('cpp_args'))
+ var_cxxflags = ' '.join(cxxflags + cxxflags_warn + get_option('cpp_args') + ['-Wall'])
else
var_cxxflags = ''
endif
diff --git a/src/meson.build b/src/meson.build
index 8aa91940cec..788ea4d299e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -272,3 +272,10 @@ install_data(
install_data(
'makefiles/pgxs.mk',
install_dir: dir_pgxs / 'src' / 'makefiles')
+
+
+run_target('headerscheck',
+ command: [files('tools/pginclude/headerscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@'])
+
+run_target('cpluspluscheck',
+ command: [files('tools/pginclude/cpluspluscheck'), '@SOURCE_ROOT@', '@BUILD_ROOT@'])
diff --git a/src/tools/pginclude/cpluspluscheck b/src/tools/pginclude/cpluspluscheck
index b393f2a2eaa..aeaaaa67479 100755
--- a/src/tools/pginclude/cpluspluscheck
+++ b/src/tools/pginclude/cpluspluscheck
@@ -166,9 +166,9 @@ do
# Some subdirectories need extra -I switches.
case "$f" in
src/pl/plperl/*)
- EXTRAINCLUDES="$perl_includespec" ;;
+ EXTRAINCLUDES="$perl_includespec"; continue; ;;
src/pl/plpython/*)
- EXTRAINCLUDES="$python_includespec" ;;
+ EXTRAINCLUDES="$python_includespec"; continue; ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
diff --git a/src/tools/pginclude/headerscheck b/src/tools/pginclude/headerscheck
index 2a39856f88c..cc195ccc88f 100755
--- a/src/tools/pginclude/headerscheck
+++ b/src/tools/pginclude/headerscheck
@@ -149,9 +149,9 @@ do
# Some subdirectories need extra -I switches.
case "$f" in
src/pl/plperl/*)
- EXTRAINCLUDES="$perl_includespec" ;;
+ EXTRAINCLUDES="$perl_includespec"; continue; ;;
src/pl/plpython/*)
- EXTRAINCLUDES="$python_includespec" ;;
+ EXTRAINCLUDES="$python_includespec"; continue; ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
--
2.37.3.542.gdd3f6c4cae
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-27 04:29 Thomas Munro <thomas.munro@gmail.com>
parent: Andres Freund <andres@anarazel.de>
4 siblings, 1 reply; 81+ messages in thread
From: Thomas Munro @ 2022-09-27 04:29 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Tue, Sep 27, 2022 at 2:19 PM Andres Freund <andres@anarazel.de> wrote:
> Subject: [PATCH v17 15/23] windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h
No Windows expertise here, but this looks reasonable. I originally
tried to contain UMDF_USING_NTSTATUS to small translation units for
fear of unintended consequences, but PCH requires you not to mess with
macros that affect the compilation of a header as seen by different
translation units, which is an incompatible goal. If this is passing
on MSVC and MingGW then +1 from me.
You mentioned WIN32_NO_STATUS in the commit message -- a mistake?
Digging out my old emails/notes... that's another way to be allowed to
include both ntstatus.h and windows.h/etc in the same translation
unit, but not the one we're using. I assume it's worse because you
have to define it and then undefine it, which sounds more antithetical
to the PCH dream. Admittedly UMDF_USING_NTSTATUS -- from the
"User-Mode Driver Framework" -- is a weird thing to be getting tangled
up with because we aren't writing a driver here, but it seems to be a
well known and widely used alternative, and is nicer because you only
have to define it.
> Subject: [PATCH v17 16/23] windows: adjust FD_SETSIZE via commandline define
Right, we have to fix that across translation units for the same
reason. But why as -D and not in win32_port.h? I followed the
discussion from 9acda73118 to try to find the answer to that and saw
that Michael wanted to put it there, but wanted to minimise the blast
radius at the time:
https://www.postgresql.org/message-id/20190826054000.GE7005%40paquier.xyz
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-27 04:48 Andres Freund <andres@anarazel.de>
parent: Thomas Munro <thomas.munro@gmail.com>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-09-27 04:48 UTC (permalink / raw)
To: Thomas Munro <thomas.munro@gmail.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-27 17:29:27 +1300, Thomas Munro wrote:
> On Tue, Sep 27, 2022 at 2:19 PM Andres Freund <andres@anarazel.de> wrote:
> > Subject: [PATCH v17 15/23] windows: Set UMDF_USING_NTSTATUS globally, include ntstatus.h
>
> No Windows expertise here, but this looks reasonable. I originally
> tried to contain UMDF_USING_NTSTATUS to small translation units for
> fear of unintended consequences, but PCH requires you not to mess with
> macros that affect the compilation of a header as seen by different
> translation units, which is an incompatible goal. If this is passing
> on MSVC and MingGW then +1 from me.
Yes, passes both.
> You mentioned WIN32_NO_STATUS in the commit message -- a mistake?
Argh. An earlier iteration. Works on mingw, but making it work with msvc
required a lot more modifications IIRC.
> Digging out my old emails/notes... that's another way to be allowed to
> include both ntstatus.h and windows.h/etc in the same translation
> unit, but not the one we're using. I assume it's worse because you
> have to define it and then undefine it, which sounds more antithetical
> to the PCH dream. Admittedly UMDF_USING_NTSTATUS -- from the
> "User-Mode Driver Framework" -- is a weird thing to be getting tangled
> up with because we aren't writing a driver here, but it seems to be a
> well known and widely used alternative, and is nicer because you only
> have to define it.
It's definitely weird. But it appears to be widely used...
> > Subject: [PATCH v17 16/23] windows: adjust FD_SETSIZE via commandline define
>
> Right, we have to fix that across translation units for the same
> reason. But why as -D and not in win32_port.h? I followed the
> discussion from 9acda73118 to try to find the answer to that and saw
> that Michael wanted to put it there, but wanted to minimise the blast
> radius at the time:
>
> https://www.postgresql.org/message-id/20190826054000.GE7005%40paquier.xyz
I guess a similar consideration. I was a bit worried about the references to
FD_SETSIZE in src/backend/port/win32/socket.c. Multi kB on-stack arrays in
postmaster seem like they could cause issues.
ISTM we really ought to move away from stuff using FD_SETSIZE on windows...
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-27 07:41 John Naylor <john.naylor@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: John Naylor @ 2022-09-27 07:41 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Tue, Sep 27, 2022 at 2:06 AM Andres Freund <andres@anarazel.de> wrote:
>
> On 2022-09-26 15:18:29 +0700, John Naylor wrote:
> > Either way it doesn't exist on this machine. I was able to get a working
> > build with
> >
> > /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig
>
> Hm - what did you need this path for - I don't think that should be
needed.
I just cargo-culted the pattern from Arm (before I figured out it was Arm)
and used the "find" command to look for the directories by name. I tried
again without specifying any of the three directory flags, and I can run
the tests getting:
Ok: 233
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 2
Timeout: 0
...which is fine for me since I don't do much development on MacOS nowadays.
> > 1) /opt/homebrew/ seems to be an "Apple silicon" path?
>
> Yea, it's /usr/local on x86-64, based on what was required to make macos
CI
> work. I updated the wiki page, half-blindly - it'd be nice if you could
> confirm that that works?
Not sure if you intended for me to try the full script in your last
response or just what's in the wiki page, but for the latter (on commit
bed0927aeb0c6), it fails at
[1656/2199] Linking target src/bin/psql/psql
FAILED: src/bin/psql/psql
clang -o src/bin/psql/psql
src/bin/psql/psql.p/meson-generated_.._psqlscanslash.c.o
src/bin/psql/psql.p/meson-generated_.._sql_help.c.o
src/bin/psql/psql.p/command.c.o src/bin/psql/psql.p/common.c.o
src/bin/psql/psql.p/copy.c.o src/bin/psql/psql.p/crosstabview.c.o
src/bin/psql/psql.p/describe.c.o src/bin/psql/psql.p/help.c.o
src/bin/psql/psql.p/input.c.o src/bin/psql/psql.p/large_obj.c.o
src/bin/psql/psql.p/mainloop.c.o src/bin/psql/psql.p/prompt.c.o
src/bin/psql/psql.p/startup.c.o src/bin/psql/psql.p/stringutils.c.o
src/bin/psql/psql.p/tab-complete.c.o src/bin/psql/psql.p/variables.c.o
-L/usr/local/opt/readline/lib -L/usr/local/opt/gettext/lib
-L/usr/local/opt/zlib/lib -L/usr/local/opt/openssl/lib
-I/usr/local/opt/readline/include -I/usr/local/opt/gettext/include
-I/usr/local/opt/zlib/include -I/usr/local/opt/openssl/include
-Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names
-Wl,-undefined,error -isysroot
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk
-Wl,-rpath,@loader_path/../../interfaces/libpq -Wl,-rpath,/usr/local/lib
-Wl,-rpath,/usr/local/Cellar/zstd/1.5.2/lib src/fe_utils/libpgfeutils.a
src/common/libpgcommon.a src/common/libpgcommon_ryu.a
src/common/libpgcommon_config_info.a src/port/libpgport.a
src/port/libpgport_crc.a src/interfaces/libpq/libpq.5.dylib -lm
/usr/local/lib/libintl.dylib -ledit -lz
/usr/local/Cellar/zstd/1.5.2/lib/libzstd.dylib -lz -lz -lz
Undefined symbols for architecture x86_64:
"_rl_completion_suppress_quote", referenced from:
_psql_completion in tab-complete.c.o
_quote_file_name in tab-complete.c.o
_complete_from_files in tab-complete.c.o
"_rl_filename_dequoting_function", referenced from:
_initialize_readline in tab-complete.c.o
"_rl_filename_quote_characters", referenced from:
_initialize_readline in tab-complete.c.o
"_rl_filename_quoting_function", referenced from:
_initialize_readline in tab-complete.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
--
John Naylor
EDB: http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-27 13:16 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
1 sibling, 0 replies; 81+ messages in thread
From: Peter Eisentraut @ 2022-09-27 13:16 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 26.09.22 18:35, Andres Freund wrote:
>> 9f5be26c1215 meson: Add docs for building with meson
>>
>> I do like the overall layout of this.
>>
>> The "Supported Platforms" section should be moved back to near the end
>> of the chapter. I don't see a reason to move it forward, at least
>> none that is related to the meson issue.
>>
>> The changes to the "Getting the Source" section are also not
>> appropriate for this patch.
> We don't really support building from a tarball with meson yet (you'd need to
> confiure, maintainer-clean, configure meson), so it does make some sense...
Okay, interesting point. I suggest that we write it as if that were
fixed, and for the time being insert a <note> (or similar) explaining
the above restriction. Otherwise we'll have to rewrite it again later.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-30 04:53 John Naylor <john.naylor@enterprisedb.com>
parent: John Naylor <john.naylor@enterprisedb.com>
0 siblings, 0 replies; 81+ messages in thread
From: John Naylor @ 2022-09-30 04:53 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Tue, Sep 27, 2022 at 2:41 PM John Naylor <john.naylor@enterprisedb.com>
wrote:
>
> On Tue, Sep 27, 2022 at 2:06 AM Andres Freund <andres@anarazel.de> wrote:
> >
> > On 2022-09-26 15:18:29 +0700, John Naylor wrote:
> > Yea, it's /usr/local on x86-64, based on what was required to make
macos CI
> > work. I updated the wiki page, half-blindly - it'd be nice if you could
> > confirm that that works?
>
> Not sure if you intended for me to try the full script in your last
response or just what's in the wiki page, but for the latter (on commit
bed0927aeb0c6), it fails at
>
> [1656/2199] Linking target src/bin/psql/psql
> FAILED: src/bin/psql/psql
Per off-list discussion with Andres, the linking failure was caused by some
env variables set in my bash profile for the sake of Homebrew. After
removing those, the recipe in the wiki worked fine.
--
John Naylor
EDB: http://www.enterprisedb.com
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-30 21:51 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
4 siblings, 1 reply; 81+ messages in thread
From: Peter Eisentraut @ 2022-09-30 21:51 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 27.09.22 03:19, Andres Freund wrote:
> Attaches is version 17. Other changes:
[23 attachments]
How shall we proceed here? The more progress we make, the more patches
appear. ;-)
Maybe close this commitfest entry now, and start new threads for each
subsequent topic.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-09-30 22:35 Andres Freund <andres@anarazel.de>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-09-30 22:35 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-30 23:51:04 +0200, Peter Eisentraut wrote:
> On 27.09.22 03:19, Andres Freund wrote:
> > Attaches is version 17. Other changes:
> [23 attachments]
>
> How shall we proceed here? The more progress we make, the more patches
> appear. ;-)
> Maybe close this commitfest entry now, and start new threads for each
> subsequent topic.
I was thinking of starting at least the following threads / CF entries once a
few of the remaining things are resolved:
- PGXS compatibility, plus related autoconf simplification patches
- pkg-config files for building postgres extensions
- relative rpath support
I am a bit on the fence about whether it's worth doing so for:
- installcheck equivalent
- precompiled header support (would like it soon, because it reduces
compile-test times substantially)
and, for no really tangible reason, considered
- resource files generation
- docs
- docs dependency
to be part of this thread / CF entry.
Now that I think about it more, I am inclined to also push the docs changes to
a new thread, just for wider visibility.
I think it'd be ok to commit the docs dependency fix soon, without a separate
thread, as it really fixes a "build bug".
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-02 17:25 Justin Pryzby <pryzby@telsasoft.com>
parent: Andres Freund <andres@anarazel.de>
4 siblings, 1 reply; 81+ messages in thread
From: Justin Pryzby @ 2022-10-02 17:25 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Mon, Sep 26, 2022 at 06:19:51PM -0700, Andres Freund wrote:
> From 680ff3f7b4da1dbf21d0c7cd87af9bb5ee8b230c Mon Sep 17 00:00:00 2001
> From: Andres Freund <andres@anarazel.de>
> Date: Wed, 21 Sep 2022 20:36:36 -0700
> Subject: [PATCH v17 01/23] meson: ci: wip: move compilerwarnings task to meson
This patch isn't finished, but this part looks like a rebase conflict:
- make -s -j${BUILD_JOBS} clean
+ make -s -j${BUILD_JOBS} world-bin
Also, you wrote "rm -fr build" between building for gcc and clang, but
since they run in an "always" block, it'd be better to use separate
dirs, to allow seeing logs for the the all (failed) tasks, in case the
last one succeeds.
On Mon, Sep 26, 2022 at 06:19:51PM -0700, Andres Freund wrote:
> From 6025cb80d65fd7a8414241931df9f003a292052f Mon Sep 17 00:00:00 2001
> From: Andres Freund <andres@anarazel.de>
> Date: Sun, 25 Sep 2022 12:07:29 -0700
> Subject: [PATCH v17 16/23] windows: adjust FD_SETSIZE via commandline
> define
> +++ b/src/bin/pgbench/meson.build
> @@ -27,6 +27,8 @@ pgbench = executable('pgbench',
> pgbench_sources,
> dependencies: [frontend_code, libpq, thread_dep],
> include_directories: include_directories('.'),
> + c_pch: pch_postgres_fe_h,
> + c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
> kwargs: default_bin_args,
> )
This puts PCH into the preparatory commit.
Also, src/tools/msvc/Mkvcbuild.pm seems to use spaces rather than tabs.
--
Justin
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-02 18:05 Andres Freund <andres@anarazel.de>
parent: Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-10-02 18:05 UTC (permalink / raw)
To: Justin Pryzby <pryzby@telsasoft.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-10-02 12:25:20 -0500, Justin Pryzby wrote:
> On Mon, Sep 26, 2022 at 06:19:51PM -0700, Andres Freund wrote:
> > From 680ff3f7b4da1dbf21d0c7cd87af9bb5ee8b230c Mon Sep 17 00:00:00 2001
> > From: Andres Freund <andres@anarazel.de>
> > Date: Wed, 21 Sep 2022 20:36:36 -0700
> > Subject: [PATCH v17 01/23] meson: ci: wip: move compilerwarnings task to meson
>
> This patch isn't finished, but this part looks like a rebase conflict:
>
> - make -s -j${BUILD_JOBS} clean
> + make -s -j${BUILD_JOBS} world-bin
I don't think so - it's the first task building with autoconf / in-tree. I
however shouldn't added ccache to CC, that was an accident. I think I'll
convert it to a vpath build, seems cleaner.
> Also, you wrote "rm -fr build" between building for gcc and clang, but
> since they run in an "always" block, it'd be better to use separate
> dirs, to allow seeing logs for the the all (failed) tasks, in case the
> last one succeeds.
Hm, when are logs important for CompilerWarnings? I don't think we even
collect any? Using a different builddir for the "sibling" tests (i.e. the two
gcc and the two clang tests) would increase the times a bit because we'd
regenerate the bison files etc.
I guess it'll look a bit cleaner to use a build-gcc and a build-clang, just to
get rid of the irregularity of needing that rm -rf.
> On Mon, Sep 26, 2022 at 06:19:51PM -0700, Andres Freund wrote:
> > From 6025cb80d65fd7a8414241931df9f003a292052f Mon Sep 17 00:00:00 2001
> > From: Andres Freund <andres@anarazel.de>
> > Date: Sun, 25 Sep 2022 12:07:29 -0700
> > Subject: [PATCH v17 16/23] windows: adjust FD_SETSIZE via commandline
> > define
>
> > +++ b/src/bin/pgbench/meson.build
> > @@ -27,6 +27,8 @@ pgbench = executable('pgbench',
> > pgbench_sources,
> > dependencies: [frontend_code, libpq, thread_dep],
> > include_directories: include_directories('.'),
> > + c_pch: pch_postgres_fe_h,
> > + c_args: host_system == 'windows' ? ['-DFD_SETSIZE=1024'] : [],
> > kwargs: default_bin_args,
> > )
>
> This puts PCH into the preparatory commit.
> Also, src/tools/msvc/Mkvcbuild.pm seems to use spaces rather than tabs.
Oops, will fix.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-02 18:38 Justin Pryzby <pryzby@telsasoft.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Justin Pryzby @ 2022-10-02 18:38 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Sun, Oct 02, 2022 at 11:05:30AM -0700, Andres Freund wrote:
> > Also, you wrote "rm -fr build" between building for gcc and clang, but
> > since they run in an "always" block, it'd be better to use separate
> > dirs, to allow seeing logs for the the all (failed) tasks, in case the
> > last one succeeds.
>
> Hm, when are logs important for CompilerWarnings? I don't think we even
> collect any? Using a different builddir for the "sibling" tests (i.e. the two
> gcc and the two clang tests) would increase the times a bit because we'd
> regenerate the bison files etc.
>
> I guess it'll look a bit cleaner to use a build-gcc and a build-clang, just to
> get rid of the irregularity of needing that rm -rf.
The build logs are important when hacking on .cirrus.yml itself.
You're right that we don't normally save logs for CompilerWarnings; one or
another (unpublished) patch of mine adds that, and then also needed to change
to use separate dirs in order to debug building while experimenting with your
patch to use meson.
--
Justin
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-03 00:19 Justin Pryzby <pryzby@telsasoft.com>
parent: Justin Pryzby <pryzby@telsasoft.com>
0 siblings, 0 replies; 81+ messages in thread
From: Justin Pryzby @ 2022-10-03 00:19 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com, Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Sun, Oct 02, 2022 at 01:38:37PM -0500, Justin Pryzby wrote:
> On Sun, Oct 02, 2022 at 11:05:30AM -0700, Andres Freund wrote:
> > > Also, you wrote "rm -fr build" between building for gcc and clang, but
> > > since they run in an "always" block, it'd be better to use separate
> > > dirs, to allow seeing logs for the the all (failed) tasks, in case the
> > > last one succeeds.
> >
> > Hm, when are logs important for CompilerWarnings? I don't think we even
> > collect any? Using a different builddir for the "sibling" tests (i.e. the two
> > gcc and the two clang tests) would increase the times a bit because we'd
> > regenerate the bison files etc.
> >
> > I guess it'll look a bit cleaner to use a build-gcc and a build-clang, just to
> > get rid of the irregularity of needing that rm -rf.
>
> The build logs are important when hacking on .cirrus.yml itself.
>
> You're right that we don't normally save logs for CompilerWarnings; one or
> another (unpublished) patch of mine adds that, and then also needed to change
> to use separate dirs in order to debug building while experimenting with your
> patch to use meson.
FYI, this is what led me to make that suggestion.
https://cirrus-ci.com/task/5920691940753408
I had a patch laying around to change the "compiler warnings" task to
use debian "testing", which seems to have added some new flags in -Wall,
which caused me to add (for now) some compiler flags like -Wno-error=...
But when I added them to the task's CFLAGS, it broke "clang" (which
doesn't support the warnings) in an obscure way[0], and no logs
available to show why.
[0] Header "uuid/uuid.h" has symbol "uuid_generate" with dependency
uuid: NO
So, I think it's worth reporting meson's build logs, even though no
tests are run here.
--
Justin
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-03 07:39 samay sharma <smilingsamay@gmail.com>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
1 sibling, 1 reply; 81+ messages in thread
From: samay sharma @ 2022-10-03 07:39 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Andres Freund <andres@anarazel.de>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On Mon, Sep 26, 2022 at 6:02 AM Peter Eisentraut <
peter.eisentraut@enterprisedb.com> wrote:
> On 24.09.22 20:09, Andres Freund wrote:
> > On 2022-09-24 13:52:29 -0400, Tom Lane wrote:
> >> ... btw, shouldn't the CF entry [1] get closed now?
> >
> > Unfortunately not - there's quite a few followup patches that haven't
> been
> > [fully] reviewed and thus not applied yet.
>
> Here is some review of the remaining ones (might not match exactly what
> you attached, I was working off your branch):
>
>
> 9f789350a7a7 meson: ci: wip: move compilerwarnings task to meson
>
> This sounds reasonable to me in principle, but I haven't followed the
> cirrus stuff too closely, and it doesn't say why it's "wip". Perhaps
> others could take a closer look.
>
>
> ccf20a68f874 meson: ci: Add additional CI coverage
>
> IIUC, this is just for testing your branch, not meant for master?
>
>
> 02d84c21b227 meson: prereq: win: remove date from version number in
> win32ver.rc
>
> do it
>
>
> 5c42b3e7812e meson: WIP: Add some of the windows resource files
>
> What is the thinking on this now? What does this change over the
> current state?
>
>
> 9bc60bccfd10 meson: Add support for relative rpaths, fixing tests on
> MacOS w/ SIP
>
> I suggest a separate thread and/or CF entry for this. There have been
> various attempts to deal with SIP before, with varying results. This
> is not part of the meson transition as such.
>
>
> 9f5be26c1215 meson: Add docs for building with meson
>
> I do like the overall layout of this.
>
> The "Supported Platforms" section should be moved back to near the end
> of the chapter. I don't see a reason to move it forward, at least
> none that is related to the meson issue.
>
Agreed that it's unrelated to meson. However, I think it's better to move
it in the front as it's generally useful to know if your platform is
supported before you start performing the installation steps and get stuck
somewhere.
Do you think I should submit that as a separate commit in the same
patch-set or just move it out to a completely different patch submission?
>
> The changes to the "Getting the Source" section are also not
> appropriate for this patch.
>
>
Given that many developers are now using Git for downloading the source
code, I think it makes sense to be in the Getting the source section. Also,
meson today doesn't cleanly build via the tarballs. Hence, I added it to
the section (and patchset).
Do you think I should move this to a different patch?
> In the section "Building and Installation with meson":
>
> - Remove the "git clone" stuff.
> - The "Running tests" section should be moved to Chapter 33. Regression
> Tests.
>
The autoconf / make section also has a small section on how to run the
regression tests. The "Running tests" section is meant to the be equivalent
of that for meson (i.e. brief overview). I do intend to add a detailed
section to Chapter 33 with more info on how to interpret test results etc.
Do you think the current section is too verbose for where it is?
> Some copy-editing will probably be suitable, but I haven't focused on
> that yet.
>
>
> 9c00d355d0e9 meson: Add PGXS compatibility
>
> This looks like a reasonable direction to me. How complete is it? It
> says it works for some extensions but not others. How do we define
> the target line here?
>
>
> 3fd5e13dcad3 meson: Add postgresql-extension.pc for building extension
> libraries
>
> Separate thread for this as well. This is good and important, but we
> must also add it to the make build.
>
>
> 4b5bfa1c19aa meson: Add LLVM bitcode emission
>
> still in progress
>
>
> eb40f6e53104 meson: Add support for building with precompiled headers
>
> Any reason not to enable this by default? The benefits on non-Windows
> appear to be less dramatic, but they are not zero. Might be better to
> enable it consistently so that for example any breakage is easier
> caught.
>
>
> 377bfdea6042 meson: Add xmllint/xsltproc wrapper script to handle
> dependencies automatically
>
> Is this part of the initial transition, required for correctness, or
> is it an optional optimization? Could use more explanation. Maybe
> move to separate thread also?
>
>
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-04 03:25 Andres Freund <andres@anarazel.de>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-10-04 03:25 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-30 15:35:26 -0700, Andres Freund wrote:
> I was thinking of starting at least the following threads / CF entries once a
> few of the remaining things are resolved:
>
> - PGXS compatibility, plus related autoconf simplification patches
> - pkg-config files for building postgres extensions
> - relative rpath support
>
> I am a bit on the fence about whether it's worth doing so for:
>
> - installcheck equivalent
> - precompiled header support (would like it soon, because it reduces
> compile-test times substantially)
>
> and, for no really tangible reason, considered
> - resource files generation
> - docs
> - docs dependency
>
> to be part of this thread / CF entry.
>
> Now that I think about it more, I am inclined to also push the docs changes to
> a new thread, just for wider visibility.
>
> I think it'd be ok to commit the docs dependency fix soon, without a separate
> thread, as it really fixes a "build bug".
I've not yet posted these different threads, but I've split up the meson tree
into subtrees corresponding to pretty much the above.
The meson tree now mainly merges those subtrees together. It still directly
contains the xml-tools dependency wrapper (to be merged soon) and the CI
changes (either later or never).
I've attached a revised version of the xml-tools dependency wrapper (0001):
Cleanups, minor error handling improvements, and bit of comment polishing. I'd
welcome review. But as it fixes a build-dependency bug / FIXME, I'm planning
to push it relatively soon otherwise.
0002 fixes libpq's .pc file (static dependencies didn't show up anymore) and
AIX compilation. AIX doesn't yet support link_whole (support was merged into
meson yesterday though). On the way it also improves comments and a bit of
generic infrastructure. The price for now is that the static libpq is built
separately from the shared one, not reusing any objects. I felt that the
complexity of reusing the objects isn't worth it for now.
Peter, it'd be great if you could have a look at 0002.
0003 mirrors the setup of libpq to the various ecpg libraries. This is a
prerequisite to adding resource files.
0004 adds the resource files
I think after that we could close the CF entry (and create a bunch of followup
entries, as discussed above). Although it somehow seems frivolous to start a
separate thread for "installcheck equivalent" :)
Greetings,
Andres Freund
Attachments:
[text/x-diff] v18-0001-meson-docs-Add-xml-lint-proc-wrapper-to-collect-.patch (8.6K, ../../20221004032540.7b7tm67pmn2eq6ma@awork3.anarazel.de/2-v18-0001-meson-docs-Add-xml-lint-proc-wrapper-to-collect-.patch)
download | inline diff:
From b21850b49a9dd9f4a60eb9c243ba64be61e7e9c0 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Mon, 3 Oct 2022 18:26:24 -0700
Subject: [PATCH v18 01/22] meson: docs: Add xml{lint,proc} wrapper to collect
dependencies
meson/ninja do not support specifying dependencies via globs (as those make it
significantly more expensive to check the current build state). Instead
targets should emit dependency information when running that then can be
cheaply re-checked during future builds.
To handle xmllint and xsltproc invocations in the docs, add and use a wrapper
that uses --load-trace to collect dependency information.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/c5736f70-bb6d-8d25-e35c-e3d886e4e905@enterprisedb.com
---
doc/src/sgml/meson.build | 41 ++++++++++++++++-------
doc/src/sgml/xmltools_dep_wrapper | 54 +++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 11 deletions(-)
create mode 100644 doc/src/sgml/xmltools_dep_wrapper
diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build
index ba2a261e7a4..65fd6131344 100644
--- a/doc/src/sgml/meson.build
+++ b/doc/src/sgml/meson.build
@@ -2,7 +2,7 @@ docs = []
alldocs = []
doc_generated = []
-xmllint = find_program(get_option('XMLLINT'), native: true, required: false)
+xmllint_bin = find_program(get_option('XMLLINT'), native: true, required: false)
version_sgml = configure_file(
@@ -60,14 +60,23 @@ doc_generated += custom_target('keywords-table.sgml',
)
# For everything else we need at least xmllint
-if not xmllint.found()
+if not xmllint_bin.found()
subdir_done()
endif
pandoc = find_program('pandoc', native: true, required: false)
-xsltproc = find_program(get_option('XSLTPROC'), native: true, required: false)
+xsltproc_bin = find_program(get_option('XSLTPROC'), native: true, required: false)
fop = find_program('fop', native: true, required: false)
+xmltools_wrapper = [
+ python, files('xmltools_dep_wrapper'),
+ '--targetname', '@OUTPUT@', '--depfile', '@DEPFILE@'
+]
+
+xmllint = xmltools_wrapper + [
+ '--tool', xmllint_bin, '--',
+]
+
# Run validation only once, common to all subsequent targets. While
# we're at it, also resolve all entities (that is, copy all included
# files into one big file). This helps tools that don't understand
@@ -75,6 +84,7 @@ fop = find_program('fop', native: true, required: false)
postgres_full_xml = custom_target('postgres-full.xml',
input: 'postgres.sgml',
output: 'postgres-full.xml',
+ depfile: 'postgres-full.xml.d',
command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'],
depends: doc_generated,
build_by_default: false,
@@ -86,18 +96,20 @@ alldocs += postgres_full_xml
#
# Full documentation as html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
xsltproc_flags = [
'--stringparam', 'pg.version', pg_version,
'--param', 'website.stylesheet', '1'
]
+ xsltproc = xmltools_wrapper + [
+ '--tool', xsltproc_bin, '--',
+ ]
- # FIXME: Should use a wrapper around xsltproc --load-trace to compute a
- # depfile
html = custom_target('html',
input: ['stylesheet.xsl', postgres_full_xml],
output: 'html',
+ depfile: 'html.d',
depends: doc_generated,
command: [xsltproc, '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -110,6 +122,7 @@ if xsltproc.found()
html_help = custom_target('html_help',
input: ['stylesheet-hh.xsl', postgres_full_xml],
output: 'htmlhelp',
+ depfile: 'htmlhelp.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -121,6 +134,7 @@ if xsltproc.found()
postgres_html = custom_target('postgres.html',
input: ['stylesheet-html-nochunk.xsl', postgres_full_xml],
output: 'postgres.html',
+ depfile: 'postgres.html.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -144,10 +158,11 @@ endif
#
# INSTALL in html, text
#
-if xsltproc.found()
+if xsltproc_bin.found()
install_xml = custom_target('INSTALL.xml',
input: ['standalone-profile.xsl', 'standalone-install.xml'],
output: 'INSTALL.xml',
+ depfile: 'INSTALL.xml.d',
depends: doc_generated + [postgres_full_xml],
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '--xinclude', '@INPUT@'],
build_by_default: false,
@@ -155,6 +170,7 @@ if xsltproc.found()
install_html = custom_target('INSTALL.html',
input: ['stylesheet-text.xsl', install_xml],
output: 'INSTALL.html',
+ depfile: 'INSTALL.html.d',
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTPUT@', xsltproc_flags, '@INPUT@'],
build_by_default: false,
)
@@ -177,11 +193,12 @@ endif
#
# Man pages
#
-if xsltproc.found()
+if xsltproc_bin.found()
# FIXME: implement / consider sqlmansectnum logic
man = custom_target('man',
input: ['stylesheet-man.xsl', postgres_full_xml],
output: ['man1', 'man3', 'man7'],
+ depfile: 'man.d',
depends: doc_generated,
command: [xsltproc, '--path', '@OUTDIR@', '-o', '@OUTDIR@/', xsltproc_flags, '@INPUT@'],
build_by_default: false,
@@ -195,17 +212,19 @@ endif
#
# Full documentation as PDF
#
-if fop.found() and xsltproc.found()
+if fop.found() and xsltproc_bin.found()
xsltproc_fo_flags = xsltproc_flags + ['--stringparam', 'img.src.path', meson.current_source_dir() + '/']
foreach format, detail: {'A4': 'A4', 'US': 'USletter'}
postgres_x_fo_f = 'postgres-@0@.fo'.format(format)
+ postgres_x_fo_dep = 'postgres-@0@.fo.d'.format(format)
postgres_x_pdf_f = 'postgres-@0@.pdf'.format(format)
postgres_x_fo = custom_target(postgres_x_fo_f,
input: ['stylesheet-fo.xsl', postgres_full_xml],
- output: [postgres_x_fo_f],
+ output: postgres_x_fo_f,
depends: doc_generated,
+ depfile: postgres_x_fo_dep,
command: [xsltproc, '--path', '@OUTDIR@/', xsltproc_fo_flags,
'--stringparam', 'paper.type', detail,
'-o', '@OUTPUT@', '@INPUT@'],
@@ -230,7 +249,7 @@ endif
# This was previously implemented using dbtoepub - but that doesn't seem to
# support running in build != source directory (i.e. VPATH builds already
# weren't supported).
-if pandoc.found() and xsltproc.found()
+if pandoc.found() and xsltproc_bin.found()
postgres_epub = custom_target('postgres.epub',
input: postgres_full_xml,
output: 'postgres.epub',
diff --git a/doc/src/sgml/xmltools_dep_wrapper b/doc/src/sgml/xmltools_dep_wrapper
new file mode 100644
index 00000000000..dd96f784268
--- /dev/null
+++ b/doc/src/sgml/xmltools_dep_wrapper
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+
+# A small wrapper around xmllint and xsltproc that collects dependency
+# information (in gcc's format) using --load-trace.
+
+import argparse
+import re
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(
+ description='generate dependency file for docs')
+
+parser.add_argument('--targetname', type=str, required=False, nargs='+')
+parser.add_argument('--depfile', type=str, required=False)
+parser.add_argument('--tool', type=str, required=True)
+parser.add_argument('flags', nargs='*')
+
+args = parser.parse_args()
+
+if args.depfile:
+ command = [args.tool, '--load-trace'] + args.flags
+
+ # list of targets that depend on the loaded files we see via --load-trace
+ line_start = ' '.join(args.targetname) + ': '
+
+ # --load-trace flag displays all the documents loaded during the processing
+ # to stderr
+ res = subprocess.run(command, stderr=subprocess.PIPE,
+ universal_newlines=True)
+
+ line_re = re.compile('^Loaded URL="([^"]+)"')
+ with open(args.depfile, 'w') as f:
+ for line in res.stderr.splitlines():
+ m = re.match(line_re, line)
+
+ # continue to show errors
+ if m is None:
+ print(line, file=sys.stderr)
+ continue
+ # Absolute paths are printed as file://, relative paths as-is. We
+ # don't care about http://, as a) those will be printed even if
+ # resolved locally b) we couldn't have a dependency anyway.
+ fname = m.group(1)
+ if fname.startswith('http://'):
+ continue
+ if fname.startswith('file://'):
+ fname = fname.split('file://')[1]
+ f.write(line_start + fname + '\n')
+else:
+ command = [args.tool] + args.flags
+ res = subprocess.run(command)
+
+exit(res.returncode)
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v18-0002-meson-libpq-Revise-static-shared-library-setup.patch (4.4K, ../../20221004032540.7b7tm67pmn2eq6ma@awork3.anarazel.de/3-v18-0002-meson-libpq-Revise-static-shared-library-setup.patch)
download | inline diff:
From 984bf68207a97c7bc055f3e2bbd79fd39918bd1b Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Thu, 29 Sep 2022 21:37:48 -0700
Subject: [PATCH v18 02/22] meson: libpq: Revise static / shared library setup
Improvements:
- we don't need -DFRONTEND for libpq anymore since 1d77afefbd1
- the .pc file contents for a static libpq were wrong (referencing
{pgport, common}_shlib)
- incidentally fixes meson not supporting link_whole on AIX yet
- added explanatory comments
Previously I tried to avoid building libpq's sources twice, once for the
static and once for the shared library. We could still do so, but it's not
clear that it's worth the complication.
---
src/interfaces/libpq/meson.build | 28 ++++++++++++++++++----------
meson.build | 23 ++++++++++++++++++-----
2 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index bc047e00d62..34cb58c2617 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -39,26 +39,33 @@ export_file = custom_target('libpq.exports',
# port needs to be in include path due to pthread-win32.h
libpq_inc = include_directories('.', '../../port')
+libpq_c_args = ['-DSO_MAJOR_VERSION=5']
+# Not using both_libraries() here as
+# 1) resource files should only be in the shared library
+# 2) we want the .pc file to include a dependency to {pgport,common}_static for
+# libpq_st, and {pgport,common}_shlib for libpq_sh
+#
+# We could try to avoid building the source files twice, but it probably adds
+# more complexity than its worth (AIX doesn't support link_whole yet, reusing
+# object files requires also linking to the library on windows or breaks
+# precompiled headers).
libpq_st = static_library('libpq',
libpq_sources,
- pic: true,
- include_directories: [libpq_inc, postgres_inc],
- c_args: ['-DSO_MAJOR_VERSION=5'],
- dependencies: libpq_deps,
+ include_directories: [libpq_inc],
+ c_args: libpq_c_args,
+ dependencies: [frontend_stlib_code, libpq_deps],
kwargs: default_lib_args,
)
-# not using both_libraries here, causes problems with precompiled headers and
-# resource files with msbuild
libpq_so = shared_library('libpq',
- dependencies: libpq_deps,
+ libpq_sources,
include_directories: [libpq_inc, postgres_inc],
- c_args: ['-DSO_MAJOR_VERSION=5'],
- link_whole: libpq_st,
+ c_args: libpq_c_args,
version: '5.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '5' : '',
darwin_versions: ['5', '5.' + pg_version_major.to_string()],
+ dependencies: [frontend_shlib_code, libpq_deps],
link_depends: export_file,
link_args: export_fmt.format(export_file.full_path()),
kwargs: default_lib_args,
@@ -70,10 +77,11 @@ libpq = declare_dependency(
)
pkgconfig.generate(
- libpq_so,
name: 'libpq',
description: 'PostgreSQL libpq library',
url: pg_url,
+ libraries: libpq,
+ libraries_private: [frontend_stlib_code, libpq_deps],
)
install_headers(
diff --git a/meson.build b/meson.build
index 253994931e8..c709643fe5e 100644
--- a/meson.build
+++ b/meson.build
@@ -2619,17 +2619,29 @@ backend_common_code = declare_dependency(
subdir('src/common')
-frontend_shlib_code = declare_dependency(
- compile_args: ['-DFRONTEND'],
- include_directories: [postgres_inc],
+# all shared libraries should depend on shlib_code
+shlib_code = declare_dependency(
link_args: ldflags_sl,
- link_with: [pgport_shlib, common_shlib],
+)
+
+# all static libraries not part of the backend should depend on this
+frontend_stlib_code = declare_dependency(
+ include_directories: [postgres_inc],
+ link_with: [common_static, pgport_static],
sources: generated_headers,
dependencies: [os_deps, libintl],
)
+# all shared libraries not part of the backend should depend on this
+frontend_shlib_code = declare_dependency(
+ include_directories: [postgres_inc],
+ link_with: [common_shlib, pgport_shlib],
+ sources: generated_headers,
+ dependencies: [shlib_code, os_deps, libintl],
+)
+
+# Dependencies both for static and shared libpq
libpq_deps += [
- frontend_shlib_code,
thread_dep,
gssapi,
@@ -2642,6 +2654,7 @@ subdir('src/interfaces/libpq')
# fe_utils depends on libpq
subdir('src/fe_utils')
+# for frontend binaries
frontend_code = declare_dependency(
include_directories: [postgres_inc],
link_with: [fe_utils, common_static, pgport_static],
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v18-0003-meson-ecpg-Split-definition-of-static-and-shared.patch (7.6K, ../../20221004032540.7b7tm67pmn2eq6ma@awork3.anarazel.de/4-v18-0003-meson-ecpg-Split-definition-of-static-and-shared.patch)
download | inline diff:
From e5017149184a50c3131aeaec9c4b0cd2b7279c27 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Thu, 29 Sep 2022 21:39:14 -0700
Subject: [PATCH v18 03/22] meson: ecpg: Split definition of static and shared
libraries
Required for correct resource file generation, as the resource files should
only be added to the shared library.
This also fixes a bunch of issues in the .pc files.
Previously I tried to avoid building sources twice, once for the static and
once for the shared libraries. We could still do so, but it's not clear that
it's worth the complication.
Discussion: https://postgr.es/m/20220927011951.j3h4o7n6bhf7dwau@awork3.anarazel.de
---
src/interfaces/ecpg/compatlib/meson.build | 39 +++++++++++++++++-----
src/interfaces/ecpg/ecpglib/meson.build | 33 +++++++++++++-----
src/interfaces/ecpg/pgtypeslib/meson.build | 29 ++++++++++++----
src/interfaces/ecpg/test/meson.build | 2 +-
4 files changed, 78 insertions(+), 25 deletions(-)
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index 5887cb92b52..b803000c708 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -1,11 +1,29 @@
-export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
-
-ecpg_compat = both_libraries('libecpg_compat',
+ecpg_compat_sources = files(
'informix.c',
- include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
- c_args: ['-DSO_MAJOR_VERSION=3'],
- dependencies: [frontend_code, thread_dep],
- link_with: [ecpglib, ecpg_pgtypes],
+)
+ecpg_compat_so_sources = [] # for shared lib, in addition to the above
+
+ecpg_compat_inc = [include_directories('.'), ecpg_inc, libpq_inc]
+ecpg_compat_c_args = ['-DSO_MAJOR_VERSION=3']
+export_file = custom_target('libecpg_compat.exports', kwargs: gen_export_kwargs)
+
+# see src/interfaces/libpq/meson.build
+ecpg_compat_st = static_library('libecpg_compat',
+ ecpg_compat_sources,
+ include_directories: ecpg_compat_inc,
+ c_args: ecpg_compat_c_args,
+ dependencies: [frontend_stlib_code, thread_dep],
+ link_with: [ecpglib_st, ecpg_pgtypes_st],
+ kwargs: default_lib_args,
+)
+ecpg_targets += ecpg_compat_st
+
+ecpg_compat_so = shared_library('libecpg_compat',
+ ecpg_compat_sources + ecpg_compat_so_sources,
+ include_directories: ecpg_compat_inc,
+ c_args: ecpg_compat_c_args,
+ dependencies: [frontend_shlib_code, thread_dep],
+ link_with: [ecpglib_so, ecpg_pgtypes_so],
soversion: host_system != 'windows' ? '3' : '',
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
version: '3.' + pg_version_major.to_string(),
@@ -13,10 +31,13 @@ ecpg_compat = both_libraries('libecpg_compat',
link_depends: export_file,
kwargs: default_lib_args,
)
-ecpg_targets += [ecpg_compat.get_shared_lib(), ecpg_compat.get_static_lib()]
+ecpg_targets += ecpg_compat_so
pkgconfig.generate(
- ecpg_compat.get_shared_lib(),
+ name: 'libecpg_compat',
description: 'PostgreSQL libecpg_compat library',
url: pg_url,
+ libraries: ecpg_compat_so,
+ libraries_private: [frontend_stlib_code, thread_dep],
+ requires_private: ['libecpg', 'libpgtypes'],
)
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 2da029ec8ea..6fdf019149c 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -10,15 +10,29 @@ ecpglib_sources = files(
'sqlda.c',
'typename.c',
)
+ecpglib_so_sources = [] # for shared lib, in addition to the above
-export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+ecpglib_inc = [include_directories('.'), ecpg_inc]
+ecpglib_c_args = ['-DSO_MAJOR_VERSION=6']
+export_file = custom_target('libecpg.exports', kwargs: gen_export_kwargs)
-ecpglib = both_libraries('libecpg',
+# see src/interfaces/libpq/meson.build
+ecpglib_st = static_library('libecpg',
ecpglib_sources,
- include_directories: ['.', ecpg_inc, postgres_inc],
- c_args: ['-DSO_MAJOR_VERSION=6'],
- dependencies: [frontend_code, libpq, thread_dep],
- link_with: [ecpg_pgtypes],
+ include_directories: ecpglib_inc,
+ c_args: ecpglib_c_args,
+ dependencies: [frontend_stlib_code, thread_dep, libpq],
+ link_with: [ecpg_pgtypes_st],
+ kwargs: default_lib_args,
+)
+ecpg_targets += ecpglib_st
+
+ecpglib_so = shared_library('libecpg',
+ ecpglib_sources + ecpglib_so_sources,
+ include_directories: ecpglib_inc,
+ c_args: ecpglib_c_args,
+ dependencies: [frontend_shlib_code, libpq, thread_dep],
+ link_with: ecpg_pgtypes_so,
soversion: host_system != 'windows' ? '6' : '',
darwin_versions: ['6', '6.' + pg_version_major.to_string()],
version: '6.' + pg_version_major.to_string(),
@@ -26,12 +40,15 @@ ecpglib = both_libraries('libecpg',
link_depends: export_file,
kwargs: default_lib_args,
)
-ecpg_targets += [ecpglib.get_shared_lib(), ecpglib.get_static_lib()]
+ecpg_targets += ecpglib_so
pkgconfig.generate(
- ecpglib.get_shared_lib(),
+ name: 'libecpg',
description: 'PostgreSQL libecpg library',
url: pg_url,
+ libraries: ecpglib_so,
+ libraries_private: [frontend_shlib_code, thread_dep],
+ requires_private: ['libpgtypes', 'libpq'],
)
subdir('po', if_found: libintl)
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 96489d9f1d7..8e5d235810a 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -6,14 +6,27 @@ ecpg_pgtypes_sources = files(
'numeric.c',
'timestamp.c',
)
+ecpg_pgtypes_so_sources = [] # for shared lib, in addition to the above
-export_file = custom_target('libpq.exports', kwargs: gen_export_kwargs)
+export_file = custom_target('libpgtypes.exports', kwargs: gen_export_kwargs)
+ecpg_pgtypes_inc = [include_directories('.'), ecpg_inc]
+ecpg_pgtypes_c_args = ['-DSO_MAJOR_VERSION=3']
-ecpg_pgtypes = both_libraries('libpgtypes',
+# see src/interfaces/libpq/meson.build
+ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
- include_directories: ['.', ecpg_inc, postgres_inc],
- c_args: ['-DSO_MAJOR_VERSION=3'],
- dependencies: [frontend_code],
+ include_directories: ecpg_pgtypes_inc,
+ c_args: ecpg_pgtypes_c_args,
+ dependencies: frontend_stlib_code,
+ kwargs: default_lib_args,
+)
+ecpg_targets += ecpg_pgtypes_st
+
+ecpg_pgtypes_so = shared_library('libpgtypes',
+ ecpg_pgtypes_sources + ecpg_pgtypes_so_sources,
+ include_directories: ecpg_pgtypes_inc,
+ c_args: ecpg_pgtypes_c_args,
+ dependencies: frontend_shlib_code,
version: '3.' + pg_version_major.to_string(),
soversion: host_system != 'windows' ? '3' : '',
darwin_versions: ['3', '3.' + pg_version_major.to_string()],
@@ -21,10 +34,12 @@ ecpg_pgtypes = both_libraries('libpgtypes',
link_depends: export_file,
kwargs: default_lib_args,
)
-ecpg_targets += [ecpg_pgtypes.get_shared_lib(), ecpg_pgtypes.get_static_lib()]
+ecpg_targets += ecpg_pgtypes_so
pkgconfig.generate(
- ecpg_pgtypes.get_shared_lib(),
+ name: 'libpgtypes',
description: 'PostgreSQL libpgtypes library',
url: pg_url,
+ libraries: ecpg_pgtypes_so,
+ libraries_private: [frontend_stlib_code],
)
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index f0ace641f0c..8904aa7fd90 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -22,7 +22,7 @@ testprep_targets += pg_regress_ecpg
ecpg_test_exec_kw = {
'dependencies': [frontend_code, libpq],
'include_directories': [ecpg_inc],
- 'link_with': [ecpglib, ecpg_compat, ecpg_pgtypes],
+ 'link_with': [ecpglib_so, ecpg_compat_so, ecpg_pgtypes_so],
'build_by_default': false,
'install': false,
}
--
2.37.3.542.gdd3f6c4cae
[text/x-diff] v18-0004-meson-Add-windows-resource-files.patch (91.4K, ../../20221004032540.7b7tm67pmn2eq6ma@awork3.anarazel.de/5-v18-0004-meson-Add-windows-resource-files.patch)
download | inline diff:
From 151755ec9b348f8ccfa2e473d4ffdd81da4fc1f2 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sat, 1 Oct 2022 11:54:05 -0700
Subject: [PATCH v18 04/22] meson: Add windows resource files
The generated resource files aren't exactly the same ones as the old
buildsystems generate. Previously "InternalName" and "OriginalFileName" were
mostly wrong / not set (despite being required), but that was hard to fix in
at least the make build. Additionally, the meson build falls back to a
"auto-generated" description when not set, and doesn't set it in a few cases -
unlikely that anybody looks at these descriptions in detail.
Author: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
---
src/backend/jit/llvm/meson.build | 6 +
.../replication/libpqwalreceiver/meson.build | 6 +
src/backend/replication/pgoutput/meson.build | 6 +
src/backend/snowball/meson.build | 6 +
.../utils/mb/conversion_procs/meson.build | 9 +-
src/bin/initdb/meson.build | 6 +
src/bin/pg_amcheck/meson.build | 8 +-
src/bin/pg_archivecleanup/meson.build | 12 +-
src/bin/pg_basebackup/meson.build | 38 ++++++-
src/bin/pg_checksums/meson.build | 12 +-
src/bin/pg_config/meson.build | 12 +-
src/bin/pg_controldata/meson.build | 12 +-
src/bin/pg_ctl/meson.build | 12 +-
src/bin/pg_dump/meson.build | 18 +++
src/bin/pg_resetwal/meson.build | 12 +-
src/bin/pg_rewind/meson.build | 6 +
src/bin/pg_test_fsync/meson.build | 10 +-
src/bin/pg_test_timing/meson.build | 12 +-
src/bin/pg_upgrade/meson.build | 6 +
src/bin/pg_verifybackup/meson.build | 6 +
src/bin/pg_waldump/meson.build | 6 +
src/bin/pgbench/meson.build | 6 +
src/bin/pgevent/meson.build | 6 +
src/bin/psql/meson.build | 6 +
src/bin/scripts/meson.build | 10 +-
src/interfaces/libpq/meson.build | 6 +-
src/interfaces/libpq/test/meson.build | 25 ++++-
src/pl/plperl/meson.build | 7 ++
src/pl/plpgsql/src/meson.build | 6 +
src/pl/plpython/meson.build | 6 +
src/pl/tcl/meson.build | 6 +
contrib/adminpack/meson.build | 12 +-
contrib/amcheck/meson.build | 17 ++-
contrib/auth_delay/meson.build | 12 +-
contrib/auto_explain/meson.build | 12 +-
contrib/basebackup_to_shell/meson.build | 6 +
contrib/basic_archive/meson.build | 6 +
contrib/bloom/meson.build | 6 +
contrib/bool_plperl/meson.build | 6 +
contrib/btree_gin/meson.build | 12 +-
contrib/btree_gist/meson.build | 6 +
contrib/citext/meson.build | 6 +
contrib/cube/meson.build | 6 +
contrib/dblink/meson.build | 6 +
contrib/dict_int/meson.build | 12 +-
contrib/dict_xsyn/meson.build | 12 +-
contrib/earthdistance/meson.build | 12 +-
contrib/file_fdw/meson.build | 12 +-
contrib/fuzzystrmatch/meson.build | 16 ++-
contrib/hstore/meson.build | 24 ++--
contrib/hstore_plperl/meson.build | 6 +
contrib/hstore_plpython/meson.build | 6 +
contrib/intarray/meson.build | 6 +
contrib/isn/meson.build | 6 +
contrib/jsonb_plperl/meson.build | 6 +
contrib/jsonb_plpython/meson.build | 6 +
contrib/lo/meson.build | 6 +
contrib/ltree/meson.build | 6 +
contrib/ltree_plpython/meson.build | 6 +
contrib/oid2name/meson.build | 12 +-
contrib/old_snapshot/meson.build | 6 +
contrib/pageinspect/meson.build | 6 +
contrib/passwordcheck/meson.build | 6 +
contrib/pg_buffercache/meson.build | 14 ++-
contrib/pg_freespacemap/meson.build | 14 ++-
contrib/pg_prewarm/meson.build | 16 ++-
contrib/pg_stat_statements/meson.build | 12 +-
contrib/pg_surgery/meson.build | 14 ++-
contrib/pg_trgm/meson.build | 20 +++-
contrib/pg_visibility/meson.build | 14 ++-
contrib/pg_walinspect/meson.build | 6 +
contrib/pgcrypto/meson.build | 6 +
contrib/pgrowlocks/meson.build | 14 ++-
contrib/pgstattuple/meson.build | 18 ++-
contrib/postgres_fdw/meson.build | 6 +
contrib/seg/meson.build | 6 +
contrib/sepgsql/meson.build | 6 +
contrib/spi/meson.build | 48 +++++++-
contrib/sslinfo/meson.build | 14 ++-
contrib/tablefunc/meson.build | 14 ++-
contrib/tcn/meson.build | 14 ++-
contrib/test_decoding/meson.build | 6 +
contrib/tsm_system_rows/meson.build | 14 ++-
contrib/tsm_system_time/meson.build | 14 ++-
contrib/unaccent/meson.build | 14 ++-
contrib/uuid-ossp/meson.build | 14 ++-
contrib/vacuumlo/meson.build | 12 +-
contrib/xml2/meson.build | 16 ++-
src/interfaces/ecpg/compatlib/meson.build | 6 +
src/interfaces/ecpg/ecpglib/meson.build | 6 +
src/interfaces/ecpg/pgtypeslib/meson.build | 6 +
src/interfaces/ecpg/preproc/meson.build | 6 +
src/interfaces/ecpg/test/meson.build | 5 +
src/test/isolation/meson.build | 13 +++
src/test/modules/delay_execution/meson.build | 13 ++-
src/test/modules/dummy_index_am/meson.build | 13 ++-
src/test/modules/dummy_seclabel/meson.build | 13 ++-
src/test/modules/libpq_pipeline/meson.build | 14 ++-
src/test/modules/plsample/meson.build | 13 ++-
src/test/modules/spgist_name_ops/meson.build | 13 ++-
.../ssl_passphrase_callback/meson.build | 13 ++-
src/test/modules/test_bloomfilter/meson.build | 13 ++-
src/test/modules/test_ddl_deparse/meson.build | 13 ++-
.../modules/test_ginpostinglist/meson.build | 13 ++-
src/test/modules/test_integerset/meson.build | 13 ++-
src/test/modules/test_lfind/meson.build | 13 ++-
src/test/modules/test_oat_hooks/meson.build | 13 ++-
src/test/modules/test_parser/meson.build | 13 ++-
src/test/modules/test_predtest/meson.build | 13 ++-
src/test/modules/test_rbtree/meson.build | 13 ++-
src/test/modules/test_regex/meson.build | 13 ++-
src/test/modules/test_rls_hooks/meson.build | 13 ++-
src/test/modules/test_shm_mq/meson.build | 19 +++-
src/test/modules/worker_spi/meson.build | 15 ++-
src/test/regress/meson.build | 6 +
meson.build | 59 ++++++++++
src/timezone/meson.build | 6 +
src/tools/rcgen | 105 ++++++++++++++++++
118 files changed, 1292 insertions(+), 131 deletions(-)
create mode 100755 src/tools/rcgen
diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
index 6ae7aaad015..25c5618e8a3 100644
--- a/src/backend/jit/llvm/meson.build
+++ b/src/backend/jit/llvm/meson.build
@@ -20,6 +20,12 @@ llvmjit_sources += files(
'llvmjit_expr.c',
)
+if host_system == 'windows'
+ llvmjit_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'llvmjit',
+ '--FILEDESC', 'llvmjit - JIT using LLVM',])
+endif
+
llvmjit = shared_module('llvmjit',
llvmjit_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/libpqwalreceiver/meson.build b/src/backend/replication/libpqwalreceiver/meson.build
index 3fc786c80a0..4c653a05d36 100644
--- a/src/backend/replication/libpqwalreceiver/meson.build
+++ b/src/backend/replication/libpqwalreceiver/meson.build
@@ -2,6 +2,12 @@ libpqwalreceiver_sources = files(
'libpqwalreceiver.c',
)
+if host_system == 'windows'
+ libpqwalreceiver_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pqwalreceiver',
+ '--FILEDESC', 'libpqwalreceiver - receive WAL during streaming replication',])
+endif
+
libpqwalreceiver = shared_module('pqwalreceiver',
libpqwalreceiver_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/replication/pgoutput/meson.build b/src/backend/replication/pgoutput/meson.build
index ab956361a62..5df27d7b764 100644
--- a/src/backend/replication/pgoutput/meson.build
+++ b/src/backend/replication/pgoutput/meson.build
@@ -2,6 +2,12 @@ pgoutput_sources = files(
'pgoutput.c',
)
+if host_system == 'windows'
+ pgoutput_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgoutput',
+ '--FILEDESC', 'pgoutput - standard logical replication output plugin',])
+endif
+
pgoutput = shared_module('pgoutput',
pgoutput_sources,
kwargs: pg_mod_args,
diff --git a/src/backend/snowball/meson.build b/src/backend/snowball/meson.build
index 8c6f685cb32..974401d187e 100644
--- a/src/backend/snowball/meson.build
+++ b/src/backend/snowball/meson.build
@@ -58,6 +58,12 @@ dict_snowball_sources += files(
# see comment in src/include/snowball/header.h
stemmer_inc = include_directories('../../include/snowball')
+if host_system == 'windows'
+ dict_snowball_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_snowball',
+ '--FILEDESC', 'snowball - natural language stemmers',])
+endif
+
dict_snowball = shared_module('dict_snowball',
dict_snowball_sources,
kwargs: pg_mod_args + {
diff --git a/src/backend/utils/mb/conversion_procs/meson.build b/src/backend/utils/mb/conversion_procs/meson.build
index 1bc971d1945..1c18f2ac85a 100644
--- a/src/backend/utils/mb/conversion_procs/meson.build
+++ b/src/backend/utils/mb/conversion_procs/meson.build
@@ -29,8 +29,15 @@ encodings = {
}
foreach encoding, sources : encodings
+ source_files = files(sources)
+
+ if host_system == 'windows'
+ source_files += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', encoding])
+ endif
+
backend_targets += shared_module(encoding,
- sources,
+ source_files,
kwargs: pg_mod_args,
)
endforeach
diff --git a/src/bin/initdb/meson.build b/src/bin/initdb/meson.build
index 9f213274d2f..6ced9a31b80 100644
--- a/src/bin/initdb/meson.build
+++ b/src/bin/initdb/meson.build
@@ -7,6 +7,12 @@ initdb_sources += timezone_localtime_source
#fixme: reimplement libpq_pgport logic
+if host_system == 'windows'
+ initdb_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'initdb',
+ '--FILEDESC', 'initdb - initialize a new database cluster',])
+endif
+
initdb = executable('initdb',
initdb_sources,
include_directories: [timezone_inc],
diff --git a/src/bin/pg_amcheck/meson.build b/src/bin/pg_amcheck/meson.build
index 8e197eba5f3..25f5e7a0948 100644
--- a/src/bin/pg_amcheck/meson.build
+++ b/src/bin/pg_amcheck/meson.build
@@ -1,7 +1,13 @@
pg_amcheck_sources = files(
- 'pg_amcheck.c'
+ 'pg_amcheck.c',
)
+if host_system == 'windows'
+ pg_amcheck_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_amcheck',
+ '--FILEDESC', 'pg_amcheck - detect corruption within database relations',])
+endif
+
pg_amcheck = executable('pg_amcheck',
pg_amcheck_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_archivecleanup/meson.build b/src/bin/pg_archivecleanup/meson.build
index 87a0d980c4f..aaa2e76977f 100644
--- a/src/bin/pg_archivecleanup/meson.build
+++ b/src/bin/pg_archivecleanup/meson.build
@@ -1,5 +1,15 @@
+pg_archivecleanup_sources = files(
+ 'pg_archivecleanup.c',
+)
+
+if host_system == 'windows'
+ pg_archivecleanup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_archivecleanup',
+ '--FILEDESC', 'pg_archivecleanup - cleans archive when used with streaming replication',])
+endif
+
pg_archivecleanup = executable('pg_archivecleanup',
- ['pg_archivecleanup.c'],
+ pg_archivecleanup_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_basebackup/meson.build b/src/bin/pg_basebackup/meson.build
index d26fed9cd8a..2c934e0c26e 100644
--- a/src/bin/pg_basebackup/meson.build
+++ b/src/bin/pg_basebackup/meson.build
@@ -17,24 +17,56 @@ pg_basebackup_common = static_library('libpg_basebackup_common',
kwargs: internal_lib_args,
)
-pg_basebackup = executable('pg_basebackup',
+pg_basebackup_sources = files(
'pg_basebackup.c',
+)
+
+if host_system == 'windows'
+ pg_basebackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_basebackup',
+ '--FILEDESC', 'pg_basebackup - streaming WAL and backup receivers',])
+endif
+
+pg_basebackup = executable('pg_basebackup',
+ pg_basebackup_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_basebackup
-pg_receivewal = executable('pg_receivewal',
+
+pg_receivewal_sources = files(
'pg_receivewal.c',
+)
+
+if host_system == 'windows'
+ pg_receivewal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_receivewal',
+ '--FILEDESC', 'pg_receivewal - streaming WAL and backup receivers',])
+endif
+
+pg_receivewal = executable('pg_receivewal',
+ pg_receivewal_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
)
bin_targets += pg_receivewal
-pg_recvlogical = executable('pg_recvlogical',
+
+pg_recvlogical_sources = files(
'pg_recvlogical.c',
+)
+
+if host_system == 'windows'
+ pg_recvlogical_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_recvlogical',
+ '--FILEDESC', 'pg_recvlogical - streaming WAL and backup receivers',])
+endif
+
+pg_recvlogical = executable('pg_recvlogical',
+ pg_recvlogical_sources,
link_with: [pg_basebackup_common],
dependencies: pg_basebackup_deps,
kwargs: default_bin_args,
diff --git a/src/bin/pg_checksums/meson.build b/src/bin/pg_checksums/meson.build
index ee1f367bac3..d07ebc999b3 100644
--- a/src/bin/pg_checksums/meson.build
+++ b/src/bin/pg_checksums/meson.build
@@ -1,5 +1,15 @@
+pg_checksums_sources = files(
+ 'pg_checksums.c',
+)
+
+if host_system == 'windows'
+ pg_checksums_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_checksums',
+ '--FILEDESC', 'pg_checksums - verify data checksums in an offline cluster',])
+endif
+
pg_checksums = executable('pg_checksums',
- ['pg_checksums.c'],
+ pg_checksums_sources,
include_directories: [timezone_inc],
dependencies: [frontend_code],
kwargs: default_bin_args,
diff --git a/src/bin/pg_config/meson.build b/src/bin/pg_config/meson.build
index 0ecbf2f9d28..4be2fdc84ae 100644
--- a/src/bin/pg_config/meson.build
+++ b/src/bin/pg_config/meson.build
@@ -1,5 +1,15 @@
+pg_config_sources = files(
+ 'pg_config.c',
+)
+
+if host_system == 'windows'
+ pg_config_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_config',
+ '--FILEDESC', 'pg_config - report configuration information',])
+endif
+
pg_config = executable('pg_config',
- ['pg_config.c'],
+ pg_config_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_controldata/meson.build b/src/bin/pg_controldata/meson.build
index 557e672beb7..7fc239dbe65 100644
--- a/src/bin/pg_controldata/meson.build
+++ b/src/bin/pg_controldata/meson.build
@@ -1,5 +1,15 @@
+pg_controldata_sources = files(
+ 'pg_controldata.c',
+)
+
+if host_system == 'windows'
+ pg_controldata_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_controldata',
+ '--FILEDESC', 'pg_controldata - reads the data from pg_control',])
+endif
+
pg_controldata = executable('pg_controldata',
- ['pg_controldata.c'],
+ pg_controldata_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_ctl/meson.build b/src/bin/pg_ctl/meson.build
index 6812e73e329..96f962fa762 100644
--- a/src/bin/pg_ctl/meson.build
+++ b/src/bin/pg_ctl/meson.build
@@ -1,5 +1,15 @@
+pg_ctl_sources = files(
+ 'pg_ctl.c',
+)
+
+if host_system == 'windows'
+ pg_ctl_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_ctl',
+ '--FILEDESC', 'pg_ctl - starts/stops/restarts the PostgreSQL server',])
+endif
+
pg_ctl = executable('pg_ctl',
- ['pg_ctl.c'],
+ pg_ctl_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_dump/meson.build b/src/bin/pg_dump/meson.build
index 785ec094dbd..3527a25c288 100644
--- a/src/bin/pg_dump/meson.build
+++ b/src/bin/pg_dump/meson.build
@@ -24,6 +24,12 @@ pg_dump_sources = files(
'pg_dump_sort.c',
)
+if host_system == 'windows'
+ pg_dump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dump',
+ '--FILEDESC', 'pg_dump - backup one PostgreSQL database',])
+endif
+
pg_dump = executable('pg_dump',
pg_dump_sources,
link_with: [pg_dump_common],
@@ -37,6 +43,12 @@ pg_dumpall_sources = files(
'pg_dumpall.c',
)
+if host_system == 'windows'
+ pg_dumpall_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_dumpall',
+ '--FILEDESC', 'pg_dumpall - backup PostgreSQL databases'])
+endif
+
pg_dumpall = executable('pg_dumpall',
pg_dumpall_sources,
link_with: [pg_dump_common],
@@ -50,6 +62,12 @@ pg_restore_sources = files(
'pg_restore.c',
)
+if host_system == 'windows'
+ pg_restore_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_restore',
+ '--FILEDESC', 'pg_restore - restore PostgreSQL databases'])
+endif
+
pg_restore = executable('pg_restore',
pg_restore_sources,
link_with: [pg_dump_common],
diff --git a/src/bin/pg_resetwal/meson.build b/src/bin/pg_resetwal/meson.build
index 7c5de134ac0..d503db97b71 100644
--- a/src/bin/pg_resetwal/meson.build
+++ b/src/bin/pg_resetwal/meson.build
@@ -1,5 +1,15 @@
+pg_resetwal_sources = files(
+ 'pg_resetwal.c',
+)
+
+if host_system == 'windows'
+ pg_resetwal_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_resetwal',
+ '--FILEDESC', 'pg_resetwal - reset PostgreSQL WAL log'])
+endif
+
pg_resetwal = executable('pg_resetwal',
- files('pg_resetwal.c'),
+ pg_resetwal_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_rewind/meson.build b/src/bin/pg_rewind/meson.build
index d8ec9e482d5..6cd970909a2 100644
--- a/src/bin/pg_rewind/meson.build
+++ b/src/bin/pg_rewind/meson.build
@@ -11,6 +11,12 @@ pg_rewind_sources = files(
pg_rewind_sources += xlogreader_sources
+if host_system == 'windows'
+ pg_rewind_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_rewind',
+ '--FILEDESC', 'pg_rewind - synchronize a data directory with another one forked from'])
+endif
+
pg_rewind = executable('pg_rewind',
pg_rewind_sources,
dependencies: [frontend_code, libpq, lz4, zstd],
diff --git a/src/bin/pg_test_fsync/meson.build b/src/bin/pg_test_fsync/meson.build
index 2c01831e11f..31d288ba6da 100644
--- a/src/bin/pg_test_fsync/meson.build
+++ b/src/bin/pg_test_fsync/meson.build
@@ -1,4 +1,12 @@
-test_fsync_sources = files('pg_test_fsync.c')
+test_fsync_sources = files(
+ 'pg_test_fsync.c',
+)
+
+if host_system == 'windows'
+ test_fsync_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_fsync',
+ '--FILEDESC', 'pg_test_fsync - test various disk sync methods'])
+endif
pg_test_fsync = executable('pg_test_fsync',
test_fsync_sources,
diff --git a/src/bin/pg_test_timing/meson.build b/src/bin/pg_test_timing/meson.build
index 0a3068f1657..0aed03ea32f 100644
--- a/src/bin/pg_test_timing/meson.build
+++ b/src/bin/pg_test_timing/meson.build
@@ -1,5 +1,15 @@
+pg_test_timing_sources = files(
+ 'pg_test_timing.c'
+)
+
+if host_system == 'windows'
+ pg_test_timing_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_test_timing',
+ '--FILEDESC', 'pg_test_timing - test timing overhead'])
+endif
+
pg_test_timing = executable('pg_test_timing',
- ['pg_test_timing.c'],
+ pg_test_timing_sources,
dependencies: [frontend_code],
kwargs: default_bin_args,
)
diff --git a/src/bin/pg_upgrade/meson.build b/src/bin/pg_upgrade/meson.build
index 02f030e0ccf..a7b927a45c7 100644
--- a/src/bin/pg_upgrade/meson.build
+++ b/src/bin/pg_upgrade/meson.build
@@ -16,6 +16,12 @@ pg_upgrade_sources = files(
'version.c',
)
+if host_system == 'windows'
+ pg_upgrade_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_upgrade',
+ '--FILEDESC', 'pg_upgrade - an in-place binary upgrade utility'])
+endif
+
pg_upgrade = executable('pg_upgrade',
pg_upgrade_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_verifybackup/meson.build b/src/bin/pg_verifybackup/meson.build
index 4c3b2bb5f97..b934a408443 100644
--- a/src/bin/pg_verifybackup/meson.build
+++ b/src/bin/pg_verifybackup/meson.build
@@ -3,6 +3,12 @@ pg_verifybackup_sources = files(
'pg_verifybackup.c'
)
+if host_system == 'windows'
+ pg_verifybackup_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_verifybackup',
+ '--FILEDESC', 'pg_verifybackup - verify a backup against using a backup manifest'])
+endif
+
pg_verifybackup = executable('pg_verifybackup',
pg_verifybackup_sources,
dependencies: [frontend_code, libpq],
diff --git a/src/bin/pg_waldump/meson.build b/src/bin/pg_waldump/meson.build
index 95872652ffd..9605976870d 100644
--- a/src/bin/pg_waldump/meson.build
+++ b/src/bin/pg_waldump/meson.build
@@ -8,6 +8,12 @@ pg_waldump_sources += rmgr_desc_sources
pg_waldump_sources += xlogreader_sources
pg_waldump_sources += files('../../backend/access/transam/xlogstats.c')
+if host_system == 'windows'
+ pg_waldump_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_waldump',
+ '--FILEDESC', 'pg_waldump - decode and display WA'])
+endif
+
pg_waldump = executable('pg_waldump',
pg_waldump_sources,
dependencies: [frontend_code, lz4, zstd],
diff --git a/src/bin/pgbench/meson.build b/src/bin/pgbench/meson.build
index 6564e54029c..a32eb51fe07 100644
--- a/src/bin/pgbench/meson.build
+++ b/src/bin/pgbench/meson.build
@@ -17,6 +17,12 @@ exprparse = custom_target('exprparse',
generated_sources += exprparse.to_list()
pgbench_sources += exprparse
+if host_system == 'windows'
+ pgbench_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgbench',
+ '--FILEDESC', 'pgbench - a simple program for running benchmark tests'])
+endif
+
pgbench = executable('pgbench',
pgbench_sources,
dependencies: [frontend_code, libpq, thread_dep],
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
index 7a468879fd2..2e9aea4b0e1 100644
--- a/src/bin/pgevent/meson.build
+++ b/src/bin/pgevent/meson.build
@@ -6,6 +6,12 @@ pgevent_sources = files(
'pgevent.c',
)
+pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgevent',
+ '--FILEDESC', 'Eventlog message formatter',])
+
+pgevent_sources += windows.compile_resources('pgmsgevent.rc')
+
# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
pgevent_link_args = []
if cc.get_id() == 'msvc'
diff --git a/src/bin/psql/meson.build b/src/bin/psql/meson.build
index 410788e4767..1264fc19fbd 100644
--- a/src/bin/psql/meson.build
+++ b/src/bin/psql/meson.build
@@ -36,6 +36,12 @@ sql_help = custom_target('psql_help',
generated_sources += sql_help.to_list()
psql_sources += sql_help
+if host_system == 'windows'
+ psql_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'psql',
+ '--FILEDESC', 'psql - the PostgreSQL interactive terminal',])
+endif
+
psql = executable('psql',
psql_sources,
include_directories: include_directories('.'),
diff --git a/src/bin/scripts/meson.build b/src/bin/scripts/meson.build
index eaf250c7f73..837562c24e5 100644
--- a/src/bin/scripts/meson.build
+++ b/src/bin/scripts/meson.build
@@ -16,8 +16,16 @@ binaries = [
]
foreach binary : binaries
+ binary_sources = files('@0@.c'.format(binary))
+
+ if host_system == 'windows'
+ binary_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', binary,
+ '--FILEDESC', '@0@ - PostgreSQL utility'.format(binary),])
+ endif
+
binary = executable(binary,
- files(binary + '.c'),
+ binary_sources,
link_with: [scripts_common],
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
diff --git a/src/interfaces/libpq/meson.build b/src/interfaces/libpq/meson.build
index 34cb58c2617..533b2e6f773 100644
--- a/src/interfaces/libpq/meson.build
+++ b/src/interfaces/libpq/meson.build
@@ -16,9 +16,13 @@ libpq_sources = files(
'libpq-events.c',
'pqexpbuffer.c',
)
+libpq_so_sources = [] # for shared lib, in addition to the above
if host_system == 'windows'
libpq_sources += files('pthread-win32.c', 'win32.c')
+ libpq_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq',
+ '--FILEDESC', 'PostgreSQL Access Library',])
endif
if ssl.found()
@@ -59,7 +63,7 @@ libpq_st = static_library('libpq',
)
libpq_so = shared_library('libpq',
- libpq_sources,
+ libpq_sources + libpq_so_sources,
include_directories: [libpq_inc, postgres_inc],
c_args: libpq_c_args,
version: '5.' + pg_version_major.to_string(),
diff --git a/src/interfaces/libpq/test/meson.build b/src/interfaces/libpq/test/meson.build
index 16f94c1ed8b..017f729d435 100644
--- a/src/interfaces/libpq/test/meson.build
+++ b/src/interfaces/libpq/test/meson.build
@@ -1,13 +1,34 @@
+libpq_uri_regress_sources = files(
+ 'libpq_uri_regress.c',
+)
+
+if host_system == 'windows'
+ libpq_uri_regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_uri_regress',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_uri_regress',
- files('libpq_uri_regress.c'),
+ libpq_uri_regress_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
}
)
+
+libpq_testclient_sources = files(
+ 'libpq_testclient.c',
+)
+
+if host_system == 'windows'
+ libpq_testclient_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_testclient',
+ '--FILEDESC', 'libpq test program',])
+endif
+
executable('libpq_testclient',
- files('libpq_testclient.c'),
+ libpq_testclient_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/pl/plperl/meson.build b/src/pl/plperl/meson.build
index 73b733dd50b..535660085dd 100644
--- a/src/pl/plperl/meson.build
+++ b/src/pl/plperl/meson.build
@@ -36,6 +36,13 @@ foreach n : ['SPI', 'Util']
endforeach
plperl_inc = include_directories('.')
+
+if host_system == 'windows'
+ plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plperl',
+ '--FILEDESC', 'PL/Perl - procedural language',])
+endif
+
plperl = shared_module('plperl',
plperl_sources,
include_directories: [plperl_inc, postgres_inc],
diff --git a/src/pl/plpgsql/src/meson.build b/src/pl/plpgsql/src/meson.build
index dd499fdd151..c46c0a1da2a 100644
--- a/src/pl/plpgsql/src/meson.build
+++ b/src/pl/plpgsql/src/meson.build
@@ -40,6 +40,12 @@ pl_unreserved = custom_target('pl_unreserved_kwlist',
generated_sources += pl_unreserved
plpgsql_sources += pl_unreserved
+if host_system == 'windows'
+ plpgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpgsql',
+ '--FILEDESC', 'PL/pgSQL - procedural language',])
+endif
+
plpgsql = shared_module('plpgsql',
plpgsql_sources,
include_directories: include_directories('.'),
diff --git a/src/pl/plpython/meson.build b/src/pl/plpython/meson.build
index 366b3b171ac..40888386b5f 100644
--- a/src/pl/plpython/meson.build
+++ b/src/pl/plpython/meson.build
@@ -28,6 +28,12 @@ plpython_sources += custom_target('spiexceptions.h',
# FIXME: need to duplicate import library ugliness?
plpython_inc = include_directories('.')
+if host_system == 'windows'
+ plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plpython3',
+ '--FILEDESC', 'PL/Python - procedural language',])
+endif
+
plpython = shared_module('plpython3',
plpython_sources,
include_directories: [plpython_inc, postgres_inc],
diff --git a/src/pl/tcl/meson.build b/src/pl/tcl/meson.build
index 9b6addd7fd5..f09bb14c950 100644
--- a/src/pl/tcl/meson.build
+++ b/src/pl/tcl/meson.build
@@ -14,6 +14,12 @@ pltcl_sources += custom_target('pltclerrcodes.h',
command: [perl, gen_pltclerrcodes, '@INPUT@']
)
+if host_system == 'windows'
+ pltcl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pltcl',
+ '--FILEDESC', 'PL/Tcl - procedural language',])
+endif
+
pltcl = shared_module('pltcl',
pltcl_sources,
include_directories: [include_directories('.'), postgres_inc],
diff --git a/contrib/adminpack/meson.build b/contrib/adminpack/meson.build
index fc2368d02cf..7efec0efbc0 100644
--- a/contrib/adminpack/meson.build
+++ b/contrib/adminpack/meson.build
@@ -1,5 +1,15 @@
+adminpack_sources = files(
+ 'adminpack.c',
+)
+
+if host_system == 'windows'
+ adminpack_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'adminpack',
+ '--FILEDESC', 'adminpack - support functions for pgAdmin',])
+endif
+
adminpack = shared_module('adminpack',
- ['adminpack.c'],
+ adminpack_sources,
kwargs: contrib_mod_args,
)
contrib_targets += adminpack
diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build
index 1db3d20349e..fa807b72d98 100644
--- a/contrib/amcheck/meson.build
+++ b/contrib/amcheck/meson.build
@@ -1,7 +1,16 @@
-amcheck = shared_module('amcheck', [
- 'verify_heapam.c',
- 'verify_nbtree.c',
- ],
+amcheck_sources = files(
+ 'verify_heapam.c',
+ 'verify_nbtree.c',
+)
+
+if host_system == 'windows'
+ amcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'amcheck',
+ '--FILEDESC', 'amcheck - function for verifying relation integrity',])
+endif
+
+amcheck = shared_module('amcheck',
+ amcheck_sources,
kwargs: contrib_mod_args,
)
contrib_targets += amcheck
diff --git a/contrib/auth_delay/meson.build b/contrib/auth_delay/meson.build
index d2e01968f54..c4ffb0663bc 100644
--- a/contrib/auth_delay/meson.build
+++ b/contrib/auth_delay/meson.build
@@ -1,5 +1,15 @@
+auth_delay_sources = files(
+ 'auth_delay.c',
+)
+
+if host_system == 'windows'
+ auth_delay_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auth_delay',
+ '--FILEDESC', 'auth_delay - delay authentication failure reports',])
+endif
+
autoinc = shared_module('auth_delay',
- ['auth_delay.c'],
+ auth_delay_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
diff --git a/contrib/auto_explain/meson.build b/contrib/auto_explain/meson.build
index 249a8376faa..76f86617850 100644
--- a/contrib/auto_explain/meson.build
+++ b/contrib/auto_explain/meson.build
@@ -1,5 +1,15 @@
+auto_explain_sources = files(
+ 'auto_explain.c',
+)
+
+if host_system == 'windows'
+ auto_explain_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'auto_explain',
+ '--FILEDESC', 'auto_explain - logging facility for execution plans',])
+endif
+
auto_explain = shared_module('auto_explain',
- files('auto_explain.c'),
+ auto_explain_sources,
kwargs: contrib_mod_args,
)
contrib_targets += auto_explain
diff --git a/contrib/basebackup_to_shell/meson.build b/contrib/basebackup_to_shell/meson.build
index 9f0517f1701..3a389de9175 100644
--- a/contrib/basebackup_to_shell/meson.build
+++ b/contrib/basebackup_to_shell/meson.build
@@ -2,6 +2,12 @@ basebackup_to_shell_sources = files(
'basebackup_to_shell.c',
)
+if host_system == 'windows'
+ basebackup_to_shell_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basebackup_to_shell',
+ '--FILEDESC', 'basebackup_to_shell - target basebackup to shell command',])
+endif
+
basebackup_to_shell = shared_module('basebackup_to_shell',
basebackup_to_shell_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index b67cbef60bd..c30dcfa5d41 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -2,6 +2,12 @@ basic_archive_sources = files(
'basic_archive.c',
)
+if host_system == 'windows'
+ basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'basic_archive',
+ '--FILEDESC', 'basic_archive - basic archive module',])
+endif
+
basic_archive = shared_module('basic_archive',
basic_archive_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bloom/meson.build b/contrib/bloom/meson.build
index 1fe7632bdbe..16f3b83e4d2 100644
--- a/contrib/bloom/meson.build
+++ b/contrib/bloom/meson.build
@@ -7,6 +7,12 @@ bloom_sources = files(
'blvalidate.c',
)
+if host_system == 'windows'
+ bloom_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bloom',
+ '--FILEDESC', 'bloom access method - signature file based index',])
+endif
+
bloom = shared_module('bloom',
bloom_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/bool_plperl/meson.build b/contrib/bool_plperl/meson.build
index c20b667d75f..a68daab0dcd 100644
--- a/contrib/bool_plperl/meson.build
+++ b/contrib/bool_plperl/meson.build
@@ -6,6 +6,12 @@ bool_plperl_sources = files(
'bool_plperl.c',
)
+if host_system == 'windows'
+ bool_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'bool_plperl',
+ '--FILEDESC', 'bool_plperl - bool transform for plperl',])
+endif
+
bool_plperl = shared_module('bool_plperl',
bool_plperl_sources,
include_directories: [plperl_inc, include_directories('.')],
diff --git a/contrib/btree_gin/meson.build b/contrib/btree_gin/meson.build
index 15d6d31a6ee..fd4c76767a7 100644
--- a/contrib/btree_gin/meson.build
+++ b/contrib/btree_gin/meson.build
@@ -1,5 +1,15 @@
+btree_gin_sources = files(
+ 'btree_gin.c',
+)
+
+if host_system == 'windows'
+ btree_gin_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gin',
+ '--FILEDESC', 'btree_gin - B-tree equivalent GIN operator classes',])
+endif
+
btree_gin = shared_module('btree_gin',
- files('btree_gin.c'),
+ btree_gin_sources,
kwargs: contrib_mod_args,
)
contrib_targets += btree_gin
diff --git a/contrib/btree_gist/meson.build b/contrib/btree_gist/meson.build
index c0a8d238540..e98c91dacc8 100644
--- a/contrib/btree_gist/meson.build
+++ b/contrib/btree_gist/meson.build
@@ -25,6 +25,12 @@ btree_gist_sources = files(
'btree_uuid.c',
)
+if host_system == 'windows'
+ btree_gist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'btree_gist',
+ '--FILEDESC', 'btree_gist - B-tree equivalent GiST operator classes',])
+endif
+
btree_gist = shared_module('btree_gist',
btree_gist_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/citext/meson.build b/contrib/citext/meson.build
index ca60eded80b..26a101a19bd 100644
--- a/contrib/citext/meson.build
+++ b/contrib/citext/meson.build
@@ -2,6 +2,12 @@ citext_sources = files(
'citext.c',
)
+if host_system == 'windows'
+ citext_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'citext',
+ '--FILEDESC', 'citext - case-insensitive character string data type',])
+endif
+
citext = shared_module('citext',
citext_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/cube/meson.build b/contrib/cube/meson.build
index 72342b0c82c..041acf95a90 100644
--- a/contrib/cube/meson.build
+++ b/contrib/cube/meson.build
@@ -17,6 +17,12 @@ cube_parse = custom_target('cubeparse',
generated_sources += cube_parse.to_list()
cube_sources += cube_parse
+if host_system == 'windows'
+ cube_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'cube',
+ '--FILEDESC', 'cube - multidimensional cube data type',])
+endif
+
cube = shared_module('cube',
cube_sources,
include_directories: include_directories('.'),
diff --git a/contrib/dblink/meson.build b/contrib/dblink/meson.build
index d35f7b5d49e..66eeb03b736 100644
--- a/contrib/dblink/meson.build
+++ b/contrib/dblink/meson.build
@@ -2,6 +2,12 @@ dblink_sources = files(
'dblink.c',
)
+if host_system == 'windows'
+ dblink_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dblink',
+ '--FILEDESC', 'dblink - connect to other PostgreSQL databases',])
+endif
+
dblink = shared_module('dblink',
dblink_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/dict_int/meson.build b/contrib/dict_int/meson.build
index f00e8085619..6fff921adda 100644
--- a/contrib/dict_int/meson.build
+++ b/contrib/dict_int/meson.build
@@ -1,5 +1,15 @@
+dict_int_sources = files(
+ 'dict_int.c',
+)
+
+if host_system == 'windows'
+ dict_int_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_int',
+ '--FILEDESC', 'dict_int - add-on dictionary template for full-text search',])
+endif
+
dict_int = shared_module('dict_int',
- files('dict_int.c'),
+ dict_int_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_int
diff --git a/contrib/dict_xsyn/meson.build b/contrib/dict_xsyn/meson.build
index be53f55bb79..fabd505a7df 100644
--- a/contrib/dict_xsyn/meson.build
+++ b/contrib/dict_xsyn/meson.build
@@ -1,5 +1,15 @@
+dict_xsyn_sources = files(
+ 'dict_xsyn.c',
+)
+
+if host_system == 'windows'
+ dict_xsyn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dict_xsyn',
+ '--FILEDESC', 'dict_xsyn - add-on dictionary template for full-text search',])
+endif
+
dict_xsyn = shared_module('dict_xsyn',
- files('dict_xsyn.c'),
+ dict_xsyn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += dict_xsyn
diff --git a/contrib/earthdistance/meson.build b/contrib/earthdistance/meson.build
index 807f5cb7de3..78dc29c3da3 100644
--- a/contrib/earthdistance/meson.build
+++ b/contrib/earthdistance/meson.build
@@ -1,5 +1,15 @@
+earthdistance_sources = files(
+ 'earthdistance.c',
+)
+
+if host_system == 'windows'
+ earthdistance_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'earthdistance',
+ '--FILEDESC', 'earthdistance - calculate distances on the surface of the Earth',])
+endif
+
earthdistance = shared_module('earthdistance',
- files('earthdistance.c'),
+ earthdistance_sources,
kwargs: contrib_mod_args,
)
contrib_targets += earthdistance
diff --git a/contrib/file_fdw/meson.build b/contrib/file_fdw/meson.build
index f13efb6e38e..c4071faa669 100644
--- a/contrib/file_fdw/meson.build
+++ b/contrib/file_fdw/meson.build
@@ -1,5 +1,15 @@
+file_fdw_sources = files(
+ 'file_fdw.c',
+)
+
+if host_system == 'windows'
+ file_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'file_fdw',
+ '--FILEDESC', 'file_fdw - foreign data wrapper for files',])
+endif
+
file_fdw = shared_module('file_fdw',
- files('file_fdw.c'),
+ file_fdw_sources,
kwargs: contrib_mod_args,
)
contrib_targets += file_fdw
diff --git a/contrib/fuzzystrmatch/meson.build b/contrib/fuzzystrmatch/meson.build
index ec278a6211e..e6d06149cec 100644
--- a/contrib/fuzzystrmatch/meson.build
+++ b/contrib/fuzzystrmatch/meson.build
@@ -1,8 +1,16 @@
+fuzzystrmatch_sources = files(
+ 'fuzzystrmatch.c',
+ 'dmetaphone.c',
+)
+
+if host_system == 'windows'
+ fuzzystrmatch_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'fuzzystrmatch',
+ '--FILEDESC', 'fuzzystrmatch - similarities and distance between strings',])
+endif
+
fuzzystrmatch = shared_module('fuzzystrmatch',
- files(
- 'fuzzystrmatch.c',
- 'dmetaphone.c'
- ),
+ fuzzystrmatch_sources,
kwargs: contrib_mod_args,
)
contrib_targets += fuzzystrmatch
diff --git a/contrib/hstore/meson.build b/contrib/hstore/meson.build
index 07c59f40a97..2bb26bb772b 100644
--- a/contrib/hstore/meson.build
+++ b/contrib/hstore/meson.build
@@ -1,15 +1,23 @@
# .. so that includes of hstore/hstore.h work
hstore_inc = include_directories('.', '../')
+hstore_sources = files(
+ 'hstore_compat.c',
+ 'hstore_gin.c',
+ 'hstore_gist.c',
+ 'hstore_io.c',
+ 'hstore_op.c',
+ 'hstore_subs.c',
+)
+
+if host_system == 'windows'
+ hstore_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore',
+ '--FILEDESC', 'hstore - key/value pair data type',])
+endif
+
hstore = shared_module('hstore',
- files(
- 'hstore_compat.c',
- 'hstore_gin.c',
- 'hstore_gist.c',
- 'hstore_io.c',
- 'hstore_op.c',
- 'hstore_subs.c',
- ),
+ hstore_sources,
kwargs: contrib_mod_args,
)
contrib_targets += hstore
diff --git a/contrib/hstore_plperl/meson.build b/contrib/hstore_plperl/meson.build
index bbafa0221bd..a238fee6a26 100644
--- a/contrib/hstore_plperl/meson.build
+++ b/contrib/hstore_plperl/meson.build
@@ -6,6 +6,12 @@ hstore_plperl_sources = files(
'hstore_plperl.c',
)
+if host_system == 'windows'
+ hstore_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plperl',
+ '--FILEDESC', 'hstore_plperl - hstore transform for plperl',])
+endif
+
hstore_plperl = shared_module('hstore_plperl',
hstore_plperl_sources,
include_directories: [plperl_inc, hstore_inc],
diff --git a/contrib/hstore_plpython/meson.build b/contrib/hstore_plpython/meson.build
index 214b48519a9..6071aaeb4b3 100644
--- a/contrib/hstore_plpython/meson.build
+++ b/contrib/hstore_plpython/meson.build
@@ -6,6 +6,12 @@ hstore_plpython_sources = files(
'hstore_plpython.c',
)
+if host_system == 'windows'
+ hstore_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'hstore_plpython3',
+ '--FILEDESC', 'hstore_plpython - hstore transform for plpython',])
+endif
+
hstore_plpython = shared_module('hstore_plpython3',
hstore_plpython_sources,
include_directories: [plpython_inc, hstore_inc, ],
diff --git a/contrib/intarray/meson.build b/contrib/intarray/meson.build
index 1655bcbb3fd..b7cf1ce0cad 100644
--- a/contrib/intarray/meson.build
+++ b/contrib/intarray/meson.build
@@ -8,6 +8,12 @@ intarray_sources = files(
'_intbig_gist.c',
)
+if host_system == 'windows'
+ intarray_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', '_int',
+ '--FILEDESC', 'intarray - functions and operators for arrays of integers',])
+endif
+
intarray = shared_module('_int',
intarray_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/isn/meson.build b/contrib/isn/meson.build
index cc30bbeb55c..db68a718313 100644
--- a/contrib/isn/meson.build
+++ b/contrib/isn/meson.build
@@ -2,6 +2,12 @@ isn_sources = files(
'isn.c',
)
+if host_system == 'windows'
+ isn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isn',
+ '--FILEDESC', 'isn - data types for international product numbering standards',])
+endif
+
isn = shared_module('isn',
isn_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/jsonb_plperl/meson.build b/contrib/jsonb_plperl/meson.build
index 5c915d8ed94..071a7a98d2c 100644
--- a/contrib/jsonb_plperl/meson.build
+++ b/contrib/jsonb_plperl/meson.build
@@ -6,6 +6,12 @@ jsonb_plperl_sources = files(
'jsonb_plperl.c',
)
+if host_system == 'windows'
+ jsonb_plperl_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plperl',
+ '--FILEDESC', 'jsonb_plperl - jsonb transform for plperl',])
+endif
+
jsonb_plperl = shared_module('jsonb_plperl',
jsonb_plperl_sources,
include_directories: [plperl_inc],
diff --git a/contrib/jsonb_plpython/meson.build b/contrib/jsonb_plpython/meson.build
index de8e1105c6a..84dc1161e8b 100644
--- a/contrib/jsonb_plpython/meson.build
+++ b/contrib/jsonb_plpython/meson.build
@@ -6,6 +6,12 @@ jsonb_plpython_sources = files(
'jsonb_plpython.c',
)
+if host_system == 'windows'
+ jsonb_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'jsonb_plpython3',
+ '--FILEDESC', 'jsonb_plpython - jsonb transform for plpython',])
+endif
+
jsonb_plpython = shared_module('jsonb_plpython3',
jsonb_plpython_sources,
include_directories: [plpython_inc],
diff --git a/contrib/lo/meson.build b/contrib/lo/meson.build
index 9082d5713c7..61ae131f1cc 100644
--- a/contrib/lo/meson.build
+++ b/contrib/lo/meson.build
@@ -2,6 +2,12 @@ lo_sources = files(
'lo.c',
)
+if host_system == 'windows'
+ lo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'lo',
+ '--FILEDESC', 'lo - management for large objects',])
+endif
+
lo = shared_module('lo',
lo_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree/meson.build b/contrib/ltree/meson.build
index 9463fc2c5e5..421292cea9d 100644
--- a/contrib/ltree/meson.build
+++ b/contrib/ltree/meson.build
@@ -13,6 +13,12 @@ ltree_sources = files(
# .. so that includes of ltree/ltree.h work
ltree_inc = include_directories('.', '../')
+if host_system == 'windows'
+ ltree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree',
+ '--FILEDESC', 'ltree - hierarchical label data type',])
+endif
+
ltree = shared_module('ltree',
ltree_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/ltree_plpython/meson.build b/contrib/ltree_plpython/meson.build
index 429d75006aa..acf5e4a6fc8 100644
--- a/contrib/ltree_plpython/meson.build
+++ b/contrib/ltree_plpython/meson.build
@@ -6,6 +6,12 @@ ltree_plpython_sources = files(
'ltree_plpython.c',
)
+if host_system == 'windows'
+ ltree_plpython_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ltree_plpython3',
+ '--FILEDESC', 'ltree_plpython - ltree transform for plpython',])
+endif
+
ltree_plpython = shared_module('ltree_plpython3',
ltree_plpython_sources,
include_directories: [plpython_inc, ltree_inc],
diff --git a/contrib/oid2name/meson.build b/contrib/oid2name/meson.build
index 1dad5d8f6e7..1a248f19260 100644
--- a/contrib/oid2name/meson.build
+++ b/contrib/oid2name/meson.build
@@ -1,5 +1,15 @@
+oid2name_sources = files(
+ 'oid2name.c',
+)
+
+if host_system == 'windows'
+ oid2name_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'oid2name',
+ '--FILEDESC', 'oid2name - examine the file structure',])
+endif
+
oid2name = executable('oid2name',
- ['oid2name.c'],
+ oid2name_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/old_snapshot/meson.build b/contrib/old_snapshot/meson.build
index 8e7ee09a43a..77276c3715a 100644
--- a/contrib/old_snapshot/meson.build
+++ b/contrib/old_snapshot/meson.build
@@ -2,6 +2,12 @@ old_snapshot_sources = files(
'time_mapping.c',
)
+if host_system == 'windows'
+ old_snapshot_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'old_snapshot',
+ '--FILEDESC', 'old_snapshot - utilities in support of old_snapshot_threshold',])
+endif
+
old_snapshot = shared_module('old_snapshot',
old_snapshot_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/pageinspect/meson.build b/contrib/pageinspect/meson.build
index 4af8153e4fd..3ec50b9445e 100644
--- a/contrib/pageinspect/meson.build
+++ b/contrib/pageinspect/meson.build
@@ -9,6 +9,12 @@ pageinspect_sources = files(
'rawpage.c',
)
+if host_system == 'windows'
+ pageinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pageinspect',
+ '--FILEDESC', 'pageinspect - functions to inspect contents of database pages',])
+endif
+
pageinspect = shared_module('pageinspect',
pageinspect_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/passwordcheck/meson.build b/contrib/passwordcheck/meson.build
index 7da47d02f1d..383d7df372a 100644
--- a/contrib/passwordcheck/meson.build
+++ b/contrib/passwordcheck/meson.build
@@ -9,6 +9,12 @@ passwordcheck_deps = []
# passwordcheck_c_args += ['-DUSE_CRACKLIB', '-DCRACKLIB_DICTPATH="/usr/lib/cracklib_dict"']
# passwordcheck_deps += [cc.find_library('crack')]
+if host_system == 'windows'
+ passwordcheck_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'passwordcheck',
+ '--FILEDESC', 'passwordcheck - strengthen user password checks',])
+endif
+
passwordcheck = shared_module('passwordcheck',
passwordcheck_sources,
c_args: passwordcheck_c_args,
diff --git a/contrib/pg_buffercache/meson.build b/contrib/pg_buffercache/meson.build
index 2c69eae3ea2..dd9948e5f0b 100644
--- a/contrib/pg_buffercache/meson.build
+++ b/contrib/pg_buffercache/meson.build
@@ -1,7 +1,15 @@
+pg_buffercache_sources = files(
+ 'pg_buffercache_pages.c',
+)
+
+if host_system == 'windows'
+ pg_buffercache_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_buffercache',
+ '--FILEDESC', 'pg_buffercache - monitoring of shared buffer cache in real-time',])
+endif
+
pg_buffercache = shared_module('pg_buffercache',
- files(
- 'pg_buffercache_pages.c',
- ),
+ pg_buffercache_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_buffercache
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index f795014d7ca..904b37b6e9b 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -1,7 +1,15 @@
+pg_freespacemap_sources = files(
+ 'pg_freespacemap.c',
+)
+
+if host_system == 'windows'
+ pg_freespacemap_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_freespacemap',
+ '--FILEDESC', 'pg_freespacemap - monitoring of free space map',])
+endif
+
pg_freespacemap = shared_module('pg_freespacemap',
- files(
- 'pg_freespacemap.c',
- ),
+ pg_freespacemap_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_freespacemap
diff --git a/contrib/pg_prewarm/meson.build b/contrib/pg_prewarm/meson.build
index bdca9af4f27..b7140cee34b 100644
--- a/contrib/pg_prewarm/meson.build
+++ b/contrib/pg_prewarm/meson.build
@@ -1,8 +1,16 @@
+pg_prewarm_sources = files(
+ 'autoprewarm.c',
+ 'pg_prewarm.c',
+)
+
+if host_system == 'windows'
+ pg_prewarm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_prewarm',
+ '--FILEDESC', 'pg_prewarm - preload relation data into system buffer cache',])
+endif
+
pg_prewarm = shared_module('pg_prewarm',
- files(
- 'autoprewarm.c',
- 'pg_prewarm.c',
- ),
+ pg_prewarm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_prewarm
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index ac117d2fc1d..854df138e76 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -1,5 +1,15 @@
+pg_stat_statements_sources = files(
+ 'pg_stat_statements.c',
+)
+
+if host_system == 'windows'
+ pg_stat_statements_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_stat_statements',
+ '--FILEDESC', 'pg_stat_statements - execution statistics of SQL statements',])
+endif
+
pg_stat_statements = shared_module('pg_stat_statements',
- files('pg_stat_statements.c'),
+ pg_stat_statements_sources,
kwargs: contrib_mod_args + {
'dependencies': contrib_mod_args['dependencies'],
},
diff --git a/contrib/pg_surgery/meson.build b/contrib/pg_surgery/meson.build
index ac71caa5276..7b5c5999f4b 100644
--- a/contrib/pg_surgery/meson.build
+++ b/contrib/pg_surgery/meson.build
@@ -1,7 +1,15 @@
+pg_surgery_sources = files(
+ 'heap_surgery.c',
+)
+
+if host_system == 'windows'
+ pg_surgery_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_surgery',
+ '--FILEDESC', 'pg_surgery - perform surgery on a damaged relation',])
+endif
+
pg_surgery = shared_module('pg_surgery',
- files(
- 'heap_surgery.c',
- ),
+ pg_surgery_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_surgery
diff --git a/contrib/pg_trgm/meson.build b/contrib/pg_trgm/meson.build
index a90628d23c6..c8c7c07b308 100644
--- a/contrib/pg_trgm/meson.build
+++ b/contrib/pg_trgm/meson.build
@@ -1,10 +1,18 @@
+pg_trgm_sources = files(
+ 'trgm_gin.c',
+ 'trgm_gist.c',
+ 'trgm_op.c',
+ 'trgm_regexp.c',
+)
+
+if host_system == 'windows'
+ pg_trgm_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_trgm',
+ '--FILEDESC', 'pg_trgm - trigram matching',])
+endif
+
pg_trgm = shared_module('pg_trgm',
- files(
- 'trgm_gin.c',
- 'trgm_gist.c',
- 'trgm_op.c',
- 'trgm_regexp.c',
- ),
+ pg_trgm_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_trgm
diff --git a/contrib/pg_visibility/meson.build b/contrib/pg_visibility/meson.build
index 933dc99ac4d..263a0d08b82 100644
--- a/contrib/pg_visibility/meson.build
+++ b/contrib/pg_visibility/meson.build
@@ -1,7 +1,15 @@
+pg_visibility_sources = files(
+ 'pg_visibility.c',
+)
+
+if host_system == 'windows'
+ pg_visibility_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_visibility',
+ '--FILEDESC', 'pg_visibility - page visibility information',])
+endif
+
pg_visibility = shared_module('pg_visibility',
- files(
- 'pg_visibility.c',
- ),
+ pg_visibility_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pg_visibility
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index d6b27877dd0..4314a3182a2 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -1,5 +1,11 @@
pg_walinspect_sources = files('pg_walinspect.c')
+if host_system == 'windows'
+ pg_walinspect_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_walinspect',
+ '--FILEDESC', 'pg_walinspect - functions to inspect contents of PostgreSQL Write-Ahead Log',])
+endif
+
pg_walinspect = shared_module('pg_walinspect',
pg_walinspect_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/pgcrypto/meson.build b/contrib/pgcrypto/meson.build
index fe0851bf8e8..7fc7bbc7ca1 100644
--- a/contrib/pgcrypto/meson.build
+++ b/contrib/pgcrypto/meson.build
@@ -69,6 +69,12 @@ else
pgcrypto_regress += 'pgp-zlib-DISABLED'
endif
+if host_system == 'windows'
+ pgcrypto_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgcrypto',
+ '--FILEDESC', 'pgcrypto - cryptographic functions',])
+endif
+
pgcrypto = shared_module('pgcrypto',
pgcrypto_sources,
link_with: pgcrypto_link_with,
diff --git a/contrib/pgrowlocks/meson.build b/contrib/pgrowlocks/meson.build
index 1b41691a2a3..8092f0d4a64 100644
--- a/contrib/pgrowlocks/meson.build
+++ b/contrib/pgrowlocks/meson.build
@@ -1,7 +1,15 @@
+pgrowlocks_sources = files(
+ 'pgrowlocks.c',
+)
+
+if host_system == 'windows'
+ pgrowlocks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgrowlocks',
+ '--FILEDESC', 'pgrowlocks - display row locking information',])
+endif
+
pgrowlocks = shared_module('pgrowlocks',
- files(
- 'pgrowlocks.c',
- ),
+ pgrowlocks_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgrowlocks
diff --git a/contrib/pgstattuple/meson.build b/contrib/pgstattuple/meson.build
index 8e828692d5c..05e4cd46a5c 100644
--- a/contrib/pgstattuple/meson.build
+++ b/contrib/pgstattuple/meson.build
@@ -1,9 +1,17 @@
+pgstattuple_sources = files(
+ 'pgstatapprox.c',
+ 'pgstatindex.c',
+ 'pgstattuple.c',
+)
+
+if host_system == 'windows'
+ pgstattuple_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgstattuple',
+ '--FILEDESC', 'pgstattuple - tuple-level statistics',])
+endif
+
pgstattuple = shared_module('pgstattuple',
- files(
- 'pgstatapprox.c',
- 'pgstatindex.c',
- 'pgstattuple.c',
- ),
+ pgstattuple_sources,
kwargs: contrib_mod_args,
)
contrib_targets += pgstattuple
diff --git a/contrib/postgres_fdw/meson.build b/contrib/postgres_fdw/meson.build
index 378885ec93b..d3746ff135c 100644
--- a/contrib/postgres_fdw/meson.build
+++ b/contrib/postgres_fdw/meson.build
@@ -6,6 +6,12 @@ postgres_fdw_sources = files(
'shippable.c',
)
+if host_system == 'windows'
+ postgres_fdw_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'postgres_fdw',
+ '--FILEDESC', 'postgres_fdw - foreign data wrapper for PostgreSQL',])
+endif
+
postgres_fdw = shared_module('postgres_fdw',
postgres_fdw_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/seg/meson.build b/contrib/seg/meson.build
index e476eab2a77..c6fbb22999b 100644
--- a/contrib/seg/meson.build
+++ b/contrib/seg/meson.build
@@ -17,6 +17,12 @@ seg_parse = custom_target('segparse',
generated_sources += seg_parse.to_list()
seg_sources += seg_parse
+if host_system == 'windows'
+ seg_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'seg',
+ '--FILEDESC', 'seg - line segment data type',])
+endif
+
seg = shared_module('seg',
seg_sources,
include_directories: include_directories('.'),
diff --git a/contrib/sepgsql/meson.build b/contrib/sepgsql/meson.build
index 60a95e17c2f..8bef239e3c2 100644
--- a/contrib/sepgsql/meson.build
+++ b/contrib/sepgsql/meson.build
@@ -14,6 +14,12 @@ sepgsql_sources = files(
'uavc.c',
)
+if host_system == 'windows'
+ sepgsql_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sepgsql',
+ '--FILEDESC', 'sepgsql - SELinux integration',])
+endif
+
sepgsql = shared_module('sepgsql',
sepgsql_sources,
kwargs: contrib_mod_args + {
diff --git a/contrib/spi/meson.build b/contrib/spi/meson.build
index 98008980ec2..e7d78189ef5 100644
--- a/contrib/spi/meson.build
+++ b/contrib/spi/meson.build
@@ -1,5 +1,15 @@
+autoinc_sources = files(
+ 'autoinc.c',
+)
+
+if host_system == 'windows'
+ autoinc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'autoinc',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
autoinc = shared_module('autoinc',
- ['autoinc.c'],
+ autoinc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += autoinc
@@ -9,8 +19,18 @@ install_data('autoinc.control', 'autoinc--1.0.sql',
)
+insert_username_sources = files(
+ 'insert_username.c',
+)
+
+if host_system == 'windows'
+ insert_username_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'insert_username',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
insert_username = shared_module('insert_username',
- ['insert_username.c'],
+ insert_username_sources,
kwargs: contrib_mod_args,
)
contrib_targets += insert_username
@@ -22,8 +42,18 @@ install_data(
)
+moddatetime_sources = files(
+ 'moddatetime.c',
+)
+
+if host_system == 'windows'
+ moddatetime_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'moddatetime',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
moddatetime = shared_module('moddatetime',
- ['moddatetime.c'],
+ moddatetime_sources,
kwargs: contrib_mod_args,
)
contrib_targets += moddatetime
@@ -38,8 +68,18 @@ install_data(
# comment out if you want a quieter refint package for other uses
refint_cflags = ['-DREFINT_VERBOSE']
+refint_sources = files(
+ 'refint.c',
+)
+
+if host_system == 'windows'
+ refint_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'refint',
+ '--FILEDESC', 'spi - examples of using SPI and triggers',])
+endif
+
refint = shared_module('refint',
- ['refint.c'],
+ refint_sources,
c_args: refint_cflags,
kwargs: contrib_mod_args,
)
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
index 53f752a08ac..136983e783d 100644
--- a/contrib/sslinfo/meson.build
+++ b/contrib/sslinfo/meson.build
@@ -2,10 +2,18 @@ if not ssl.found()
subdir_done()
endif
+sslinfo_sources = files(
+ 'sslinfo.c',
+)
+
+if host_system == 'windows'
+ sslinfo_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'sslinfo',
+ '--FILEDESC', 'sslinfo - information about client SSL certificate',])
+endif
+
sslinfo = shared_module('sslinfo',
- files(
- 'sslinfo.c',
- ),
+ sslinfo_sources,
kwargs: contrib_mod_args + {
'dependencies': [ssl, contrib_mod_args['dependencies']],
}
diff --git a/contrib/tablefunc/meson.build b/contrib/tablefunc/meson.build
index f4230096c0c..d2ddc8d3b39 100644
--- a/contrib/tablefunc/meson.build
+++ b/contrib/tablefunc/meson.build
@@ -1,7 +1,15 @@
+tablefunc_sources = files(
+ 'tablefunc.c',
+)
+
+if host_system == 'windows'
+ tablefunc_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tablefunc',
+ '--FILEDESC', 'tablefunc - various functions that return tables',])
+endif
+
tablefunc = shared_module('tablefunc',
- files(
- 'tablefunc.c',
- ),
+ tablefunc_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tablefunc
diff --git a/contrib/tcn/meson.build b/contrib/tcn/meson.build
index c3a025247d4..71261c3b0a2 100644
--- a/contrib/tcn/meson.build
+++ b/contrib/tcn/meson.build
@@ -1,7 +1,15 @@
+tcn_sources = files(
+ 'tcn.c',
+)
+
+if host_system == 'windows'
+ tcn_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tcn',
+ '--FILEDESC', 'tcn - trigger function notifying listeners',])
+endif
+
tcn = shared_module('tcn',
- files(
- 'tcn.c',
- ),
+ tcn_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tcn
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index dd7cb0101ad..6376103c689 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -2,6 +2,12 @@ test_decoding_sources = files(
'test_decoding.c',
)
+if host_system == 'windows'
+ test_decoding_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_decoding',
+ '--FILEDESC', 'test_decoding - example of a logical decoding output plugin',])
+endif
+
test_decoding = shared_module('test_decoding',
test_decoding_sources,
kwargs: contrib_mod_args,
diff --git a/contrib/tsm_system_rows/meson.build b/contrib/tsm_system_rows/meson.build
index b9cd42115a8..380abb49883 100644
--- a/contrib/tsm_system_rows/meson.build
+++ b/contrib/tsm_system_rows/meson.build
@@ -1,7 +1,15 @@
+tsm_system_rows_sources = files(
+ 'tsm_system_rows.c',
+)
+
+if host_system == 'windows'
+ tsm_system_rows_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_rows',
+ '--FILEDESC', 'tsm_system_rows - TABLESAMPLE method which accepts number of rows as a limit',])
+endif
+
tsm_system_rows = shared_module('tsm_system_rows',
- files(
- 'tsm_system_rows.c',
- ),
+ tsm_system_rows_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_rows
diff --git a/contrib/tsm_system_time/meson.build b/contrib/tsm_system_time/meson.build
index 18015912ffb..e57a2702c60 100644
--- a/contrib/tsm_system_time/meson.build
+++ b/contrib/tsm_system_time/meson.build
@@ -1,7 +1,15 @@
+tsm_system_time_sources = files(
+ 'tsm_system_time.c',
+)
+
+if host_system == 'windows'
+ tsm_system_time_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'tsm_system_time',
+ '--FILEDESC', 'tsm_system_time - TABLESAMPLE method which accepts time in milliseconds as a limit',])
+endif
+
tsm_system_time = shared_module('tsm_system_time',
- files(
- 'tsm_system_time.c',
- ),
+ tsm_system_time_sources,
kwargs: contrib_mod_args,
)
contrib_targets += tsm_system_time
diff --git a/contrib/unaccent/meson.build b/contrib/unaccent/meson.build
index 872b76e3223..438035132f8 100644
--- a/contrib/unaccent/meson.build
+++ b/contrib/unaccent/meson.build
@@ -1,7 +1,15 @@
+unaccent_sources = files(
+ 'unaccent.c',
+)
+
+if host_system == 'windows'
+ unaccent_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'unaccent',
+ '--FILEDESC', 'unaccent - text search dictionary that removes accents',])
+endif
+
unaccent = shared_module('unaccent',
- files(
- 'unaccent.c',
- ),
+ unaccent_sources,
kwargs: contrib_mod_args,
)
contrib_targets += unaccent
diff --git a/contrib/uuid-ossp/meson.build b/contrib/uuid-ossp/meson.build
index da6d1d75c12..28730f398f0 100644
--- a/contrib/uuid-ossp/meson.build
+++ b/contrib/uuid-ossp/meson.build
@@ -2,10 +2,18 @@ if not uuid.found()
subdir_done()
endif
+uuid_ossp_sources = files(
+ 'uuid-ossp.c',
+)
+
+if host_system == 'windows'
+ uuid_ossp_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'uuid-ossp',
+ '--FILEDESC', 'uuid-ossp - UUID generation',])
+endif
+
uuid_ossp = shared_module('uuid-ossp',
- files(
- 'uuid-ossp.c',
- ),
+ uuid_ossp_sources,
kwargs: contrib_mod_args + {
'dependencies': [uuid, contrib_mod_args['dependencies']],
},
diff --git a/contrib/vacuumlo/meson.build b/contrib/vacuumlo/meson.build
index 7a632b87d1b..846de47dbd1 100644
--- a/contrib/vacuumlo/meson.build
+++ b/contrib/vacuumlo/meson.build
@@ -1,5 +1,15 @@
+vacuumlo_sources = files(
+ 'vacuumlo.c',
+)
+
+if host_system == 'windows'
+ vacuumlo_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'vacuumlo',
+ '--FILEDESC', 'vacuumlo - removes orphaned large objects',])
+endif
+
vacuumlo = executable('vacuumlo',
- ['vacuumlo.c'],
+ vacuumlo_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args,
)
diff --git a/contrib/xml2/meson.build b/contrib/xml2/meson.build
index 9c0b56f01f6..89b0d677516 100644
--- a/contrib/xml2/meson.build
+++ b/contrib/xml2/meson.build
@@ -2,11 +2,19 @@ if not libxml.found()
subdir_done()
endif
+xml2_sources = files(
+ 'xpath.c',
+ 'xslt_proc.c',
+)
+
+if host_system == 'windows'
+ xml2_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgxml',
+ '--FILEDESC', 'xml2 - XPath querying and XSLT',])
+endif
+
xml2 = shared_module('pgxml',
- files(
- 'xpath.c',
- 'xslt_proc.c',
- ),
+ xml2_sources,
kwargs: contrib_mod_args + {
'dependencies': [libxml, libxslt, contrib_mod_args['dependencies']],
},
diff --git a/src/interfaces/ecpg/compatlib/meson.build b/src/interfaces/ecpg/compatlib/meson.build
index b803000c708..4d6454381b5 100644
--- a/src/interfaces/ecpg/compatlib/meson.build
+++ b/src/interfaces/ecpg/compatlib/meson.build
@@ -7,6 +7,12 @@ ecpg_compat_inc = [include_directories('.'), ecpg_inc, libpq_inc]
ecpg_compat_c_args = ['-DSO_MAJOR_VERSION=3']
export_file = custom_target('libecpg_compat.exports', kwargs: gen_export_kwargs)
+if host_system == 'windows'
+ ecpg_compat_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libecpg_compat',
+ '--FILEDESC', 'ECPG compat - compatibility library for ECPG',])
+endif
+
# see src/interfaces/libpq/meson.build
ecpg_compat_st = static_library('libecpg_compat',
ecpg_compat_sources,
diff --git a/src/interfaces/ecpg/ecpglib/meson.build b/src/interfaces/ecpg/ecpglib/meson.build
index 6fdf019149c..7e6e6fbf5c0 100644
--- a/src/interfaces/ecpg/ecpglib/meson.build
+++ b/src/interfaces/ecpg/ecpglib/meson.build
@@ -16,6 +16,12 @@ ecpglib_inc = [include_directories('.'), ecpg_inc]
ecpglib_c_args = ['-DSO_MAJOR_VERSION=6']
export_file = custom_target('libecpg.exports', kwargs: gen_export_kwargs)
+if host_system == 'windows'
+ ecpglib_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libecpg',
+ '--FILEDESC', 'ECPG - embedded SQL in C',])
+endif
+
# see src/interfaces/libpq/meson.build
ecpglib_st = static_library('libecpg',
ecpglib_sources,
diff --git a/src/interfaces/ecpg/pgtypeslib/meson.build b/src/interfaces/ecpg/pgtypeslib/meson.build
index 8e5d235810a..530dd2c602d 100644
--- a/src/interfaces/ecpg/pgtypeslib/meson.build
+++ b/src/interfaces/ecpg/pgtypeslib/meson.build
@@ -12,6 +12,12 @@ export_file = custom_target('libpgtypes.exports', kwargs: gen_export_kwargs)
ecpg_pgtypes_inc = [include_directories('.'), ecpg_inc]
ecpg_pgtypes_c_args = ['-DSO_MAJOR_VERSION=3']
+if host_system == 'windows'
+ ecpg_pgtypes_so_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pgtypes',
+ '--FILEDESC', 'pgtypes - library for data type mapping',])
+endif
+
# see src/interfaces/libpq/meson.build
ecpg_pgtypes_st = static_library('libpgtypes',
ecpg_pgtypes_sources,
diff --git a/src/interfaces/ecpg/preproc/meson.build b/src/interfaces/ecpg/preproc/meson.build
index 1be49c8c27f..74876f039c9 100644
--- a/src/interfaces/ecpg/preproc/meson.build
+++ b/src/interfaces/ecpg/preproc/meson.build
@@ -93,6 +93,12 @@ ecpg_kwlist = custom_target('ecpg_kwlist_d.h',
generated_sources += ecpg_kwlist
ecpg_sources += ecpg_kwlist
+if host_system == 'windows'
+ ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ecpg',
+ '--FILEDESC', 'ecpg - embedded SQL precompiler for C',])
+endif
+
ecpg_exe = executable('ecpg',
ecpg_sources,
include_directories: ['.', ecpg_inc, postgres_inc, libpq_inc],
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index 8904aa7fd90..94b26d10314 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -7,6 +7,11 @@ pg_regress_ecpg_sources = pg_regress_c + files(
'pg_regress_ecpg.c',
)
+if host_system == 'windows'
+ pg_regress_ecpg_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress_ecpg',])
+endif
+
pg_regress_ecpg = executable('pg_regress_ecpg',
pg_regress_ecpg_sources,
c_args: pg_regress_cflags,
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index c7656fd4609..ba27b8c1d44 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -23,6 +23,12 @@ spec_parser = custom_target('specparse',
isolationtester_sources += spec_parser
generated_sources += spec_parser.to_list()
+if host_system == 'windows'
+ isolation_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_isolation_regress',
+ '--FILEDESC', 'pg_isolation_regress - multi-client test driver',])
+endif
+
pg_isolation_regress = executable('pg_isolation_regress',
isolation_sources,
c_args: pg_regress_cflags,
@@ -34,6 +40,13 @@ pg_isolation_regress = executable('pg_isolation_regress',
)
bin_targets += pg_isolation_regress
+
+if host_system == 'windows'
+ isolationtester_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'isolationtester',
+ '--FILEDESC', 'isolationtester - multi-client test driver',])
+endif
+
isolationtester = executable('isolationtester',
isolationtester_sources,
include_directories: include_directories('.'),
diff --git a/src/test/modules/delay_execution/meson.build b/src/test/modules/delay_execution/meson.build
index cf4bdaba637..a0c3ab6afe7 100644
--- a/src/test/modules/delay_execution/meson.build
+++ b/src/test/modules/delay_execution/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+delay_execution_sources = files(
+ 'delay_execution.c',
+)
+
+if host_system == 'windows'
+ delay_execution_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'delay_execution',
+ '--FILEDESC', 'delay_execution - allow delay between parsing and execution',])
+endif
+
delay_execution = shared_module('delay_execution',
- ['delay_execution.c'],
+ delay_execution_sources,
kwargs: pg_mod_args,
)
testprep_targets += delay_execution
diff --git a/src/test/modules/dummy_index_am/meson.build b/src/test/modules/dummy_index_am/meson.build
index 56ff5f48001..4ce82491135 100644
--- a/src/test/modules/dummy_index_am/meson.build
+++ b/src/test/modules/dummy_index_am/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_index_am_sources = files(
+ 'dummy_index_am.c',
+)
+
+if host_system == 'windows'
+ dummy_index_am_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_index_am',
+ '--FILEDESC', 'dummy_index_am - index access method template',])
+endif
+
dummy_index_am = shared_module('dummy_index_am',
- ['dummy_index_am.c'],
+ dummy_index_am_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_index_am
diff --git a/src/test/modules/dummy_seclabel/meson.build b/src/test/modules/dummy_seclabel/meson.build
index 21b7cf8f353..81b626e496c 100644
--- a/src/test/modules/dummy_seclabel/meson.build
+++ b/src/test/modules/dummy_seclabel/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+dummy_seclabel_sources = files(
+ 'dummy_seclabel.c',
+)
+
+if host_system == 'windows'
+ dummy_seclabel_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'dummy_seclabel',
+ '--FILEDESC', 'dummy_seclabel - regression testing of the SECURITY LABEL statement',])
+endif
+
dummy_seclabel = shared_module('dummy_seclabel',
- ['dummy_seclabel.c'],
+ dummy_seclabel_sources,
kwargs: pg_mod_args,
)
testprep_targets += dummy_seclabel
diff --git a/src/test/modules/libpq_pipeline/meson.build b/src/test/modules/libpq_pipeline/meson.build
index 8384b6e3b2a..de0e2d15626 100644
--- a/src/test/modules/libpq_pipeline/meson.build
+++ b/src/test/modules/libpq_pipeline/meson.build
@@ -1,7 +1,15 @@
+libpq_pipeline_sources = files(
+ 'libpq_pipeline.c',
+)
+
+if host_system == 'windows'
+ libpq_pipeline_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'libpq_pipeline',
+ '--FILEDESC', 'libpq_pipeline - test program for pipeline execution',])
+endif
+
libpq_pipeline = executable('libpq_pipeline',
- files(
- 'libpq_pipeline.c',
- ),
+ libpq_pipeline_sources,
dependencies: [frontend_code, libpq],
kwargs: default_bin_args + {
'install': false,
diff --git a/src/test/modules/plsample/meson.build b/src/test/modules/plsample/meson.build
index 45de3f1990d..e1ea2c7a16f 100644
--- a/src/test/modules/plsample/meson.build
+++ b/src/test/modules/plsample/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+plsample_sources = files(
+ 'plsample.c',
+)
+
+if host_system == 'windows'
+ plsample_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'plsample',
+ '--FILEDESC', 'PL/Sample - template for procedural language',])
+endif
+
plsample = shared_module('plsample',
- ['plsample.c'],
+ plsample_sources,
kwargs: pg_mod_args,
)
testprep_targets += plsample
diff --git a/src/test/modules/spgist_name_ops/meson.build b/src/test/modules/spgist_name_ops/meson.build
index 857fc7e140e..445296fee0b 100644
--- a/src/test/modules/spgist_name_ops/meson.build
+++ b/src/test/modules/spgist_name_ops/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+spgist_name_ops_sources = files(
+ 'spgist_name_ops.c',
+)
+
+if host_system == 'windows'
+ spgist_name_ops_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'spgist_name_ops',
+ '--FILEDESC', 'spgist_name_ops - test opclass for SP-GiST',])
+endif
+
spgist_name_ops = shared_module('spgist_name_ops',
- ['spgist_name_ops.c'],
+ spgist_name_ops_sources,
kwargs: pg_mod_args,
)
testprep_targets += spgist_name_ops
diff --git a/src/test/modules/ssl_passphrase_callback/meson.build b/src/test/modules/ssl_passphrase_callback/meson.build
index a57bd0693a3..a9eb4c564da 100644
--- a/src/test/modules/ssl_passphrase_callback/meson.build
+++ b/src/test/modules/ssl_passphrase_callback/meson.build
@@ -3,8 +3,19 @@ if not ssl.found()
endif
# FIXME: prevent install during main install, but not during test :/
+
+ssl_passphrase_callback_sources = files(
+ 'ssl_passphrase_func.c',
+)
+
+if host_system == 'windows'
+ ssl_passphrase_callback_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'ssl_passphrase_func',
+ '--FILEDESC', 'callback function to provide a passphrase',])
+endif
+
ssl_passphrase_callback = shared_module('ssl_passphrase_func',
- ['ssl_passphrase_func.c'],
+ ssl_passphrase_callback_sources,
kwargs: pg_mod_args + {
'dependencies': [ssl, pg_mod_args['dependencies']],
},
diff --git a/src/test/modules/test_bloomfilter/meson.build b/src/test/modules/test_bloomfilter/meson.build
index 945eb5a70c4..3cf6b05754f 100644
--- a/src/test/modules/test_bloomfilter/meson.build
+++ b/src/test/modules/test_bloomfilter/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_bloomfilter_sources = files(
+ 'test_bloomfilter.c',
+)
+
+if host_system == 'windows'
+ test_bloomfilter_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_bloomfilter',
+ '--FILEDESC', 'test_bloomfilter - test code for Bloom filter library',])
+endif
+
test_bloomfilter = shared_module('test_bloomfilter',
- ['test_bloomfilter.c'],
+ test_bloomfilter_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_bloomfilter
diff --git a/src/test/modules/test_ddl_deparse/meson.build b/src/test/modules/test_ddl_deparse/meson.build
index 81ad5adc526..54d44f9b2b4 100644
--- a/src/test/modules/test_ddl_deparse/meson.build
+++ b/src/test/modules/test_ddl_deparse/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ddl_deparse_sources = files(
+ 'test_ddl_deparse.c',
+)
+
+if host_system == 'windows'
+ test_ddl_deparse_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ddl_deparse',
+ '--FILEDESC', 'test_ddl_deparse - regression testing for DDL deparsing',])
+endif
+
test_ddl_deparse = shared_module('test_ddl_deparse',
- ['test_ddl_deparse.c'],
+ test_ddl_deparse_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ddl_deparse
diff --git a/src/test/modules/test_ginpostinglist/meson.build b/src/test/modules/test_ginpostinglist/meson.build
index abf0a3b0430..b3b49c56122 100644
--- a/src/test/modules/test_ginpostinglist/meson.build
+++ b/src/test/modules/test_ginpostinglist/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_ginpostinglist_sources = files(
+ 'test_ginpostinglist.c',
+)
+
+if host_system == 'windows'
+ test_ginpostinglist_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_ginpostinglist',
+ '--FILEDESC', 'test_ginpostinglist - test code for src/backend/access/gin//ginpostinglist.c',])
+endif
+
test_ginpostinglist = shared_module('test_ginpostinglist',
- ['test_ginpostinglist.c'],
+ test_ginpostinglist_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_ginpostinglist
diff --git a/src/test/modules/test_integerset/meson.build b/src/test/modules/test_integerset/meson.build
index c32c469c69a..4bd75af4b5e 100644
--- a/src/test/modules/test_integerset/meson.build
+++ b/src/test/modules/test_integerset/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_integerset_sources = files(
+ 'test_integerset.c',
+)
+
+if host_system == 'windows'
+ test_integerset_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_integerset',
+ '--FILEDESC', 'test_integerset - test code for src/backend/lib/integerset.c',])
+endif
+
test_integerset = shared_module('test_integerset',
- ['test_integerset.c'],
+ test_integerset_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_integerset
diff --git a/src/test/modules/test_lfind/meson.build b/src/test/modules/test_lfind/meson.build
index a388de1156a..c5405b8f878 100644
--- a/src/test/modules/test_lfind/meson.build
+++ b/src/test/modules/test_lfind/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_lfind_sources = files(
+ 'test_lfind.c',
+)
+
+if host_system == 'windows'
+ test_lfind_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_lfind',
+ '--FILEDESC', 'test_lfind - test code for optimized linear search functions',])
+endif
+
test_lfind = shared_module('test_lfind',
- ['test_lfind.c'],
+ test_lfind_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_lfind
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 5faf0459777..8802bbbac55 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_oat_hooks_sources = files(
+ 'test_oat_hooks.c',
+)
+
+if host_system == 'windows'
+ test_oat_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_oat_hooks',
+ '--FILEDESC', 'test_oat_hooks - example use of object access hooks',])
+endif
+
test_oat_hooks = shared_module('test_oat_hooks',
- ['test_oat_hooks.c'],
+ test_oat_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_oat_hooks
diff --git a/src/test/modules/test_parser/meson.build b/src/test/modules/test_parser/meson.build
index b59960f615e..1c17113347f 100644
--- a/src/test/modules/test_parser/meson.build
+++ b/src/test/modules/test_parser/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_parser_sources = files(
+ 'test_parser.c',
+)
+
+if host_system == 'windows'
+ test_parser_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_parser',
+ '--FILEDESC', 'test_parser - example of a custom parser for full-text search',])
+endif
+
test_parser = shared_module('test_parser',
- ['test_parser.c'],
+ test_parser_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_parser
diff --git a/src/test/modules/test_predtest/meson.build b/src/test/modules/test_predtest/meson.build
index 1cfa84b3609..9a5be43c9c0 100644
--- a/src/test/modules/test_predtest/meson.build
+++ b/src/test/modules/test_predtest/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_predtest_sources = files(
+ 'test_predtest.c',
+)
+
+if host_system == 'windows'
+ test_predtest_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_predtest',
+ '--FILEDESC', 'test_predtest - test code for optimizer/util/predtest.c',])
+endif
+
test_predtest = shared_module('test_predtest',
- ['test_predtest.c'],
+ test_predtest_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_predtest
diff --git a/src/test/modules/test_rbtree/meson.build b/src/test/modules/test_rbtree/meson.build
index 34cbc3e1624..f067e08d321 100644
--- a/src/test/modules/test_rbtree/meson.build
+++ b/src/test/modules/test_rbtree/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rbtree_sources = files(
+ 'test_rbtree.c',
+)
+
+if host_system == 'windows'
+ test_rbtree_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rbtree',
+ '--FILEDESC', 'test_rbtree - test code for red-black tree library',])
+endif
+
test_rbtree = shared_module('test_rbtree',
- ['test_rbtree.c'],
+ test_rbtree_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rbtree
diff --git a/src/test/modules/test_regex/meson.build b/src/test/modules/test_regex/meson.build
index 867a64e57c3..cfb938d9f1e 100644
--- a/src/test/modules/test_regex/meson.build
+++ b/src/test/modules/test_regex/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_regex_sources = files(
+ 'test_regex.c',
+)
+
+if host_system == 'windows'
+ test_regex_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_regex',
+ '--FILEDESC', 'test_regex - test code for backend/regex/',])
+endif
+
test_regex = shared_module('test_regex',
- ['test_regex.c'],
+ test_regex_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_regex
diff --git a/src/test/modules/test_rls_hooks/meson.build b/src/test/modules/test_rls_hooks/meson.build
index 80d8adda332..3fb273b2934 100644
--- a/src/test/modules/test_rls_hooks/meson.build
+++ b/src/test/modules/test_rls_hooks/meson.build
@@ -1,6 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_rls_hooks_sources = files(
+ 'test_rls_hooks.c',
+)
+
+if host_system == 'windows'
+ test_rls_hooks_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_rls_hooks',
+ '--FILEDESC', 'test_rls_hooks - example use of RLS hooks',])
+endif
+
test_rls_hooks = shared_module('test_rls_hooks',
- ['test_rls_hooks.c'],
+ test_rls_hooks_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_rls_hooks
diff --git a/src/test/modules/test_shm_mq/meson.build b/src/test/modules/test_shm_mq/meson.build
index b663543d616..16c8fdb57f4 100644
--- a/src/test/modules/test_shm_mq/meson.build
+++ b/src/test/modules/test_shm_mq/meson.build
@@ -1,10 +1,19 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_shm_mq_sources = files(
+ 'setup.c',
+ 'test.c',
+ 'worker.c',
+)
+
+if host_system == 'windows'
+ test_shm_mq_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'test_shm_mq',
+ '--FILEDESC', 'test_shm_mq - example use of shared memory message queue',])
+endif
+
test_shm_mq = shared_module('test_shm_mq',
- files(
- 'setup.c',
- 'test.c',
- 'worker.c',
- ),
+ test_shm_mq_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_shm_mq
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index 32acad883b2..a4a158c75b9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -1,8 +1,17 @@
# FIXME: prevent install during main install, but not during test :/
+
+test_worker_spi_sources = files(
+ 'worker_spi.c',
+)
+
+if host_system == 'windows'
+ test_worker_spi_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'worker_spi',
+ '--FILEDESC', 'worker_spi - background worker example',])
+endif
+
test_worker_spi = shared_module('worker_spi',
- files(
- 'worker_spi.c',
- ),
+ test_worker_spi_sources,
kwargs: pg_mod_args,
)
testprep_targets += test_worker_spi
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index 03de591b0c7..3dcfc11278f 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -17,6 +17,12 @@ host_tuple = '@0@-@1@-@2@'.format(host_cpu, host_system, host_tuple_cc)
pg_regress_cflags = ['-DHOST_TUPLE="@0@"'.format(host_tuple), '-DSHELLPROG="/bin/sh"']
+if host_system == 'windows'
+ regress_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'pg_regress',
+ '--FILEDESC', 'pg_regress - test driver',])
+endif
+
pg_regress = executable('pg_regress',
regress_sources,
c_args: pg_regress_cflags,
diff --git a/meson.build b/meson.build
index c709643fe5e..25a6fa941cc 100644
--- a/meson.build
+++ b/meson.build
@@ -2564,6 +2564,65 @@ gen_export_kwargs = {
+###
+### windows resources related stuff
+###
+
+if host_system == 'windows'
+ pg_ico = meson.source_root() / 'src' / 'port' / 'win32.ico'
+ win32ver_rc = files('src/port/win32ver.rc')
+ rcgen = find_program('src/tools/rcgen', native: true)
+
+ rcgen_base_args = [
+ '--srcdir', '@SOURCE_DIR@',
+ '--builddir', meson.build_root(),
+ '--rcout', '@OUTPUT0@',
+ '--out', '@OUTPUT1@',
+ '--input', '@INPUT@',
+ '@EXTRA_ARGS@',
+ ]
+
+ if cc.get_argument_syntax() == 'msvc'
+ rc = find_program('rc', required: true)
+ rcgen_base_args += ['--rc', rc.path()]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.res']
+ else
+ windres = find_program('windres', required: true)
+ rcgen_base_args += ['--windres', windres.path()]
+ rcgen_outputs = ['@BASENAME@.rc', '@BASENAME@.obj']
+ endif
+
+ # msbuild backend doesn't support this atm
+ if meson.backend() == 'ninja'
+ rcgen_base_args += ['--depfile', '@DEPFILE@']
+ endif
+
+ rcgen_bin_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_APP',
+ '--FILEENDING', 'exe',
+ '--ICO', pg_ico
+ ]
+
+ rcgen_lib_args = rcgen_base_args + [
+ '--VFT_TYPE', 'VFT_DLL',
+ '--FILEENDING', 'dll',
+ ]
+
+ rc_bin_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_bin_args,
+ output: rcgen_outputs,
+ )
+
+ rc_lib_gen = generator(rcgen,
+ depfile: '@BASENAME@.d',
+ arguments: rcgen_lib_args,
+ output: rcgen_outputs,
+ )
+endif
+
+
+
# headers that the whole build tree depends on
generated_headers = []
# headers that the backend build depends on
diff --git a/src/timezone/meson.build b/src/timezone/meson.build
index 16f082ecfa8..9e0934c000b 100644
--- a/src/timezone/meson.build
+++ b/src/timezone/meson.build
@@ -28,6 +28,12 @@ if get_option('system_tzdata') == ''
if meson.is_cross_build()
zic = find_program(get_option('ZIC'), native: true, required: true)
else
+ if host_system == 'windows'
+ zic_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
+ '--NAME', 'zic',
+ '--FILEDESC', 'zic - time zone compiler',])
+ endif
+
zic = executable('zic', zic_sources,
dependencies: [frontend_code],
kwargs: default_bin_args + {'install': false}
diff --git a/src/tools/rcgen b/src/tools/rcgen
new file mode 100755
index 00000000000..0c84772163c
--- /dev/null
+++ b/src/tools/rcgen
@@ -0,0 +1,105 @@
+#!/usr/bin/env python3
+
+# Helper for building resource files when building for windows. Always
+# generates a .rc from the input .rc file. When building with msvc we
+# additionally generate a .res file with 'rc', when building with gcc, we use
+# windres to directly generate a .o. Additionally we generate basic
+# dependencies if depfile is specified.
+
+import argparse
+import os
+import subprocess
+import sys
+
+parser = argparse.ArgumentParser(description='generate PostgreSQL rc file')
+
+parser.add_argument('--srcdir', type=os.path.abspath,
+ required=True)
+parser.add_argument('--builddir', type=os.path.abspath,
+ required=True)
+
+binaries = parser.add_argument_group('binaries')
+binaries.add_argument('--windres', type=os.path.abspath)
+binaries.add_argument('--rc', type=os.path.abspath)
+
+inout = parser.add_argument_group('inout')
+inout.add_argument('--depfile', type=argparse.FileType('w'))
+inout.add_argument('--input', type=argparse.FileType('r'),
+ required=True)
+inout.add_argument('--rcout', type=argparse.FileType('w'),
+ required=True)
+inout.add_argument('--out', type=str,
+ required=True)
+
+replacements = parser.add_argument_group('replacements')
+replacements.add_argument('--FILEDESC', type=str)
+replacements.add_argument('--NAME', type=str, required=True)
+replacements.add_argument('--VFT_TYPE', type=str, required=True)
+replacements.add_argument('--FILEENDING', type=str, required=True)
+replacements.add_argument('--ICO', type=str)
+
+args = parser.parse_args()
+
+# determine replacement strings
+
+internal_name = '"{0}"'.format(args.NAME)
+original_name = '"{0}.{1}"'.format(args.NAME, args.FILEENDING)
+
+# if no description is passed in, generate one based on the name
+if args.FILEDESC:
+ filedesc = args.FILEDESC
+elif args.NAME:
+ if args.VFT_TYPE == 'VFT_DLL':
+ filedesc = 'PostgreSQL {0} library'.format(args.NAME)
+ else:
+ filedesc = 'PostgreSQL {0} binary'.format(args.NAME)
+filedesc = '"{0}"'.format(filedesc)
+
+
+if args.ICO:
+ ico = 'IDI_ICON ICON "{0}"'.format(args.ICO)
+ if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(args.rcout.name, args.ICO))
+else:
+ ico = ''
+
+
+data = args.input.read()
+
+data = data.replace('VFT_APP', args.VFT_TYPE)
+data = data.replace('_INTERNAL_NAME_', internal_name)
+data = data.replace('_ORIGINAL_NAME_', original_name)
+data = data.replace('FILEDESC', filedesc)
+data = data.replace("_ICO_", ico)
+
+args.rcout.write(data)
+args.rcout.close()
+
+if args.windres:
+ cmd = [
+ args.windres,
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '-o', args.out, '-i', args.rcout.name,
+ ]
+elif args.rc:
+ cmd = [
+ args.rc, '/nologo',
+ '-I{0}/src/include/'.format(args.builddir),
+ '-I{0}/src/include/'.format(args.srcdir),
+ '/fo', args.out, args.rcout.name,
+ ]
+else:
+ sys.exit('either --windres or --rc needs to be specified')
+
+sp = subprocess.run(cmd)
+if sp.returncode != 0:
+ sys.exit(sp.returncode)
+
+# It'd be nicer if we could generate correct dependencies here, but 'rc'
+# doesn't support doing so. It's unlikely we'll ever need more, so...
+if args.depfile:
+ args.depfile.write("{0} : {1}\n".format(
+ args.rcout.name, args.input.name))
+ args.depfile.write("{0} : {1}/{2}\n".format(
+ args.out, args.builddir, 'src/include/pg_config.h'))
--
2.37.3.542.gdd3f6c4cae
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-05 06:40 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: samay sharma <smilingsamay@gmail.com>
0 siblings, 0 replies; 81+ messages in thread
From: Peter Eisentraut @ 2022-10-05 06:40 UTC (permalink / raw)
To: samay sharma <smilingsamay@gmail.com>; +Cc: Andres Freund <andres@anarazel.de>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 03.10.22 09:39, samay sharma wrote:
> 9f5be26c1215 meson: Add docs for building with meson
>
> I do like the overall layout of this.
>
> The "Supported Platforms" section should be moved back to near the end
> of the chapter. I don't see a reason to move it forward, at least
> none that is related to the meson issue.
>
>
> Agreed that it's unrelated to meson. However, I think it's better to
> move it in the front as it's generally useful to know if your platform
> is supported before you start performing the installation steps and get
> stuck somewhere.
The way it is currently organized is that 17.2 says
"In general, a modern Unix-compatible platform should be able to run
PostgreSQL. The platforms that had received specific testing at the time
of release are described in Section 17.6 below."
So basically, it says, don't worry about it, your platform is probably
supported, but check below if you are interested in the details.
I don't see a reason to turn this around.
>
> Do you think I should submit that as a separate commit in the same
> patch-set or just move it out to a completely different patch submission?
>
>
> The changes to the "Getting the Source" section are also not
> appropriate for this patch.
>
>
> Given that many developers are now using Git for downloading the source
> code, I think it makes sense to be in the Getting the source section.
> Also, meson today doesn't cleanly build via the tarballs. Hence, I added
> it to the section (and patchset).
Section 17.3 already contains a link to section I.1 about using Git.
> Do you think I should move this to a different patch?
If you wanted to pursue these changes, then yes, but I think they are
not clear improvements, as mentioned above.
I suggest focusing on getting the actual meson documentation finished
and then considering polishing the overall flow if desired.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-05 08:16 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: Peter Eisentraut @ 2022-10-05 08:16 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On 04.10.22 05:25, Andres Freund wrote:
> I've attached a revised version of the xml-tools dependency wrapper (0001):
> Cleanups, minor error handling improvements, and bit of comment polishing. I'd
> welcome review. But as it fixes a build-dependency bug / FIXME, I'm planning
> to push it relatively soon otherwise.
>
> 0002 fixes libpq's .pc file (static dependencies didn't show up anymore) and
> AIX compilation. AIX doesn't yet support link_whole (support was merged into
> meson yesterday though). On the way it also improves comments and a bit of
> generic infrastructure. The price for now is that the static libpq is built
> separately from the shared one, not reusing any objects. I felt that the
> complexity of reusing the objects isn't worth it for now.
>
> Peter, it'd be great if you could have a look at 0002.
>
> 0003 mirrors the setup of libpq to the various ecpg libraries. This is a
> prerequisite to adding resource files.
>
> 0004 adds the resource files
These patches look ok to me.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-05 17:14 Andres Freund <andres@anarazel.de>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-10-05 17:14 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-10-05 10:16:06 +0200, Peter Eisentraut wrote:
> On 04.10.22 05:25, Andres Freund wrote:
> > I've attached a revised version of the xml-tools dependency wrapper (0001):
> > Cleanups, minor error handling improvements, and bit of comment polishing. I'd
> > welcome review. But as it fixes a build-dependency bug / FIXME, I'm planning
> > to push it relatively soon otherwise.
> >
> > 0002 fixes libpq's .pc file (static dependencies didn't show up anymore) and
> > AIX compilation. AIX doesn't yet support link_whole (support was merged into
> > meson yesterday though). On the way it also improves comments and a bit of
> > generic infrastructure. The price for now is that the static libpq is built
> > separately from the shared one, not reusing any objects. I felt that the
> > complexity of reusing the objects isn't worth it for now.
> >
> > Peter, it'd be great if you could have a look at 0002.
> >
> > 0003 mirrors the setup of libpq to the various ecpg libraries. This is a
> > prerequisite to adding resource files.
> >
> > 0004 adds the resource files
>
> These patches look ok to me.
Thanks for checking.
With that I'm closing the original meson CF entry. Wohoo!
I'll post two new threads, one about pgxs compatibility, one about precompiled
headers in a bit.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* RE: [RFC] building postgres with meson - v13
@ 2022-10-13 09:24 shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: shiy.fnst@fujitsu.com @ 2022-10-13 09:24 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
I noticed that `pg_config --configure` didn't show the options given when
building with meson.
For example,
meson setup build -Dcache=gcc.cache -Ddtrace=enabled -Dicu=enabled -Dcassert=true -Dprefix=/home/postgres/install_meson/
meson compile -C build
meson install -C build
$ pg_config --configure
The options I specified (like dtrace) are not shown. I found they actually work
in compilation.
When specifying `-Ddtrace=enabled`, there is a log like this. And with
`-Ddtrace=disabled`, no such log.
[120/1834] /usr/bin/dtrace -C -h -s ../src/include/utils/../../backend/utils/probes.d -o src/include/utils/probes.h.tmp
Maybe it would be better if pg_config can output this information, to be
consistent with the output when building with `./configure` and `make`.
The output when building with `./configure` and `make`:
$ pg_config --configure
'--prefix=/home/postgres/install/' '--cache' 'gcc.cache' '--enable-dtrace' '--with-icu' '--enable-cassert'
Regards,
Shi yu
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-13 16:39 Andres Freund <andres@anarazel.de>
parent: shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-10-13 16:39 UTC (permalink / raw)
To: shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-10-13 09:24:51 +0000, shiy.fnst@fujitsu.com wrote:
> I noticed that `pg_config --configure` didn't show the options given when
> building with meson.
Yes, that was noted somewhere on this thread.
> Maybe it would be better if pg_config can output this information, to be
> consistent with the output when building with `./configure` and `make`.
>
> The output when building with `./configure` and `make`:
> $ pg_config --configure
> '--prefix=/home/postgres/install/' '--cache' 'gcc.cache' '--enable-dtrace' '--with-icu' '--enable-cassert'
It'd be a fair amount of work, both initially and to maintain it, to generate
something compatible. I can see some benefit in showing some feature
influencing output in --configure, but compatible output doesn't seem worth it
to me.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* RE: [RFC] building postgres with meson - v13
@ 2022-10-14 03:21 shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 81+ messages in thread
From: shiy.fnst@fujitsu.com @ 2022-10-14 03:21 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
On Fri, Oct 14, 2022 12:40 AM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
> On 2022-10-13 09:24:51 +0000, shiy.fnst@fujitsu.com wrote:
> > I noticed that `pg_config --configure` didn't show the options given when
> > building with meson.
>
> Yes, that was noted somewhere on this thread.
>
>
> > Maybe it would be better if pg_config can output this information, to be
> > consistent with the output when building with `./configure` and `make`.
> >
> > The output when building with `./configure` and `make`:
> > $ pg_config --configure
> > '--prefix=/home/postgres/install/' '--cache' 'gcc.cache' '--enable-dtrace' '--
> with-icu' '--enable-cassert'
>
> It'd be a fair amount of work, both initially and to maintain it, to generate
> something compatible. I can see some benefit in showing some feature
> influencing output in --configure, but compatible output doesn't seem worth it
> to me.
>
I agree that there are some benefits to showing that, which helps to confirm the
build options. Although that can be confirmed from the compile log, but the log
may not be available all the time.
And it's ok for me that the output is not exactly the same as before.
Regards,
Shi yu
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-14 03:35 Tom Lane <tgl@sss.pgh.pa.us>
parent: shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>
0 siblings, 1 reply; 81+ messages in thread
From: Tom Lane @ 2022-10-14 03:35 UTC (permalink / raw)
To: shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>; +Cc: Andres Freund <andres@anarazel.de>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
"shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com> writes:
> On Fri, Oct 14, 2022 12:40 AM Andres Freund <andres@anarazel.de> wrote:
>> It'd be a fair amount of work, both initially and to maintain it, to generate
>> something compatible. I can see some benefit in showing some feature
>> influencing output in --configure, but compatible output doesn't seem worth it
>> to me.
> And it's ok for me that the output is not exactly the same as before.
Yeah, the output doesn't have to be exactly the same. But it had better
show all the options influencing the compilation, or else we will be
looking for other ways to reconstruct that information.
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-15 19:10 Andres Freund <andres@anarazel.de>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 81+ messages in thread
From: Andres Freund @ 2022-10-15 19:10 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-10-13 23:35:14 -0400, Tom Lane wrote:
> "shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com> writes:
> > On Fri, Oct 14, 2022 12:40 AM Andres Freund <andres@anarazel.de> wrote:
> >> It'd be a fair amount of work, both initially and to maintain it, to generate
> >> something compatible. I can see some benefit in showing some feature
> >> influencing output in --configure, but compatible output doesn't seem worth it
> >> to me.
>
> > And it's ok for me that the output is not exactly the same as before.
>
> Yeah, the output doesn't have to be exactly the same.
Seems like we should have a different pg_config flag for meson options than
for configure, and perhaps separately an option to show the buildsystem?
Maybe --buildsystem -> autoconf|meson, --configure -> existing CONFIGURE_ARGS
for autoconf, empty otherwise, --meson-options -> meson options?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-15 21:39 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 81+ messages in thread
From: Tom Lane @ 2022-10-15 21:39 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Seems like we should have a different pg_config flag for meson options than
> for configure, and perhaps separately an option to show the buildsystem?
Yeah, probably a good idea, given that shoving the options for one
buildsystem into the other isn't likely to work.
regards, tom lane
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-10-18 17:09 Justin Pryzby <pryzby@telsasoft.com>
parent: Andres Freund <andres@anarazel.de>
4 siblings, 0 replies; 81+ messages in thread
From: Justin Pryzby @ 2022-10-18 17:09 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com, Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
> From 680ff3f7b4da1dbf21d0c7cd87af9bb5ee8b230c Mon Sep 17 00:00:00 2001
> From: Andres Freund <andres@anarazel.de>
> Date: Wed, 21 Sep 2022 20:36:36 -0700
> Subject: [PATCH v17 01/23] meson: ci: wip: move compilerwarnings task to meson
>
> ---
> .cirrus.yml | 92 +++++++++++++-------------
> src/tools/ci/linux-mingw-w64-64bit.txt | 13 ++++
> 2 files changed, 59 insertions(+), 46 deletions(-)
> create mode 100644 src/tools/ci/linux-mingw-w64-64bit.txt
>
> diff --git a/.cirrus.yml b/.cirrus.yml
> index 7b5cb021027..eb33fdc4855 100644
> --- a/.cirrus.yml
> +++ b/.cirrus.yml
> @@ -465,6 +465,10 @@ task:
> ccache_cache:
> folder: $CCACHE_DIR
>
> + ccache_stats_start_script:
> + ccache -s
> + ccache -z
I realized that ccache -z clears out not only the global stats, but the
per-file cache stats (from which the global stats are derived) - which
obviously makes the cache work poorly.
Newer ccache has CCACHE_STATSLOG, and --show-log-stats, which I think
can do what's wanted. I'll update my ci branch with that.
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-12-02 17:40 Andres Freund <andres@anarazel.de>
parent: Andrew Dunstan <andrew@dunslane.net>
1 sibling, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-12-02 17:40 UTC (permalink / raw)
To: Andrew Dunstan <andrew@dunslane.net>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-22 04:29:15 -0400, Andrew Dunstan wrote:
> Now I'll start on buildfarm support. Given my current commitments, this will
> take me a while, but I hope to have a working client by about the beginning
> of November.
Just checking: Any progress on this? Anything I can help with?
I'd like to move towards dropping src/tools/msvc at some point not too far
away, and we can't do so before having buildfarm support. I was just reminded
of this by looking at the windows-arm support patch...
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-12-07 03:25 Andres Freund <andres@anarazel.de>
parent: Peter Geoghegan <pg@bowt.ie>
0 siblings, 0 replies; 81+ messages in thread
From: Andres Freund @ 2022-12-07 03:25 UTC (permalink / raw)
To: Peter Geoghegan <pg@bowt.ie>; +Cc: Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Tom Lane <tgl@sss.pgh.pa.us>; Thomas Munro <thomas.munro@gmail.com>; Justin Pryzby <pryzby@telsasoft.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
Hi,
On 2022-09-26 14:15:35 -0700, Peter Geoghegan wrote:
> On Mon, Sep 26, 2022 at 1:27 PM Andres Freund <andres@anarazel.de> wrote:
> > > Some feedback:
> > > * I gather that "running" as it appears in commands like "meson test
> > > --setup running" refers to a particular setup named "running", that
> > > you invented as part of creating a meson-ish substitute for
> > > installcheck. Can "running" be renamed to something that makes it
> > > obvious that it's a Postgres thing, and not a generic meson thing?
> >
> > Yes. The only caveat is that it makes lines longer, because it's included in
> > the printed test line (there's no real requirement to have the test suite and
> > the setup named the same,b ut it seems confusing not to)
>
> Probably doesn't have to be too long. And I'm not sure of the details.
> Just a small thing from my point of view.
Attached is an updated version of that patch. I left the name as 'running'
because a postgres- or pg- prefix felt to awkward. This just adds fairly
minimal documentation for the 'running' setup, while we now have some basic
docs for building with meson, we don't yet have a "translation" of
regress.sgml. Not sure how to structure that best, either.
I plan to commit that soon. This likely isn't the be-all-end-all, but it's
quite useful as-is.
Greetings,
Andres Freund
Attachments:
[text/x-diff] v2-0001-meson-Add-running-test-setup-as-a-replacement-for.patch (15.4K, ../../20221207032501.krclzqro6evqyzas@awork3.anarazel.de/2-v2-0001-meson-Add-running-test-setup-as-a-replacement-for.patch)
download | inline diff:
From a50cc9ac3045b0ef1cfd3cc76b3ff5759bdb85ef Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Tue, 6 Dec 2022 19:24:44 -0800
Subject: [PATCH v2] meson: Add 'running' test setup, as a replacement for
installcheck
To run all tests that support running against existing server:
$ meson test --setup running
To run just the main pg_regress tests against existing server:
$ meson test --setup running regress-running/regress
To ensure the 'running' setup continues to work, test it as part of the
freebsd CI task.
Discussion: https://postgr.es/m/CAH2-Wz=XDQcmLoo7RR_i6FKQdDmcyb9q5gStnfuuQXrOGhB2sQ@mail.gmail.com
---
meson.build | 91 ++++++++++++++++---
contrib/basic_archive/meson.build | 3 +
contrib/pg_freespacemap/meson.build | 3 +
contrib/pg_stat_statements/meson.build | 4 +
contrib/pg_walinspect/meson.build | 3 +
contrib/test_decoding/meson.build | 5 +
src/interfaces/ecpg/test/meson.build | 1 +
doc/src/sgml/installation.sgml | 6 ++
.cirrus.yml | 15 +++
src/test/isolation/meson.build | 1 +
src/test/modules/commit_ts/meson.build | 3 +
src/test/modules/snapshot_too_old/meson.build | 3 +
src/test/modules/test_oat_hooks/meson.build | 1 +
src/test/modules/test_pg_dump/meson.build | 2 +
src/test/modules/test_slru/meson.build | 1 +
src/test/modules/worker_spi/meson.build | 4 +-
src/test/regress/meson.build | 1 +
17 files changed, 132 insertions(+), 15 deletions(-)
diff --git a/meson.build b/meson.build
index 39fc3ddab26..3cb50c0b172 100644
--- a/meson.build
+++ b/meson.build
@@ -2920,6 +2920,20 @@ endif
# Test Generation
###############################################################
+# When using a meson version understanding exclude_suites, define a
+# 'tmp_install' test setup (the default) that excludes tests running against a
+# pre-existing install and a 'running' setup that conflicts with creation of
+# the temporary installation and tap tests (which don't support running
+# against a running server).
+
+running_suites = []
+install_suites = []
+if meson.version().version_compare('>=0.57')
+ runningcheck = true
+else
+ runningcheck = false
+endif
+
testwrap = files('src/tools/testwrap')
foreach test_dir : tests
@@ -2927,7 +2941,6 @@ foreach test_dir : tests
testwrap,
'--basedir', meson.build_root(),
'--srcdir', test_dir['sd'],
- '--testgroup', test_dir['name'],
]
foreach kind, v : test_dir
@@ -2940,55 +2953,94 @@ foreach test_dir : tests
if kind in ['regress', 'isolation', 'ecpg']
if kind == 'regress'
runner = pg_regress
+ fallback_dbname = 'regression_@0@'
elif kind == 'isolation'
runner = pg_isolation_regress
+ fallback_dbname = 'isolation_regression_@0@'
elif kind == 'ecpg'
runner = pg_regress_ecpg
+ fallback_dbname = 'ecpg_regression_@0@'
endif
- test_output = test_result_dir / test_dir['name'] / kind
+ test_group = test_dir['name']
+ test_group_running = test_dir['name'] + '-running'
- test_command = [
+ test_output = test_result_dir / test_group / kind
+ test_output_running = test_result_dir / test_group_running/ kind
+
+ # Unless specified by the test, choose a non-conflicting database name,
+ # to avoid conflicts when running against existing server.
+ dbname = t.get('dbname',
+ fallback_dbname.format(test_dir['name']))
+
+ test_command_base = [
runner.full_path(),
'--inputdir', t.get('inputdir', test_dir['sd']),
'--expecteddir', t.get('expecteddir', test_dir['sd']),
- '--outputdir', test_output,
- '--temp-instance', test_output / 'tmp_check',
'--bindir', '',
'--dlpath', test_dir['bd'],
'--max-concurrent-tests=20',
- '--port', testport.to_string(),
+ '--dbname', dbname,
] + t.get('regress_args', [])
+ test_selection = []
if t.has_key('schedule')
- test_command += ['--schedule', t['schedule'],]
+ test_selection += ['--schedule', t['schedule'],]
endif
if kind == 'isolation'
- test_command += t.get('specs', [])
+ test_selection += t.get('specs', [])
else
- test_command += t.get('sql', [])
+ test_selection += t.get('sql', [])
endif
env = test_env
env.prepend('PATH', temp_install_bindir, test_dir['bd'])
test_kwargs = {
- 'suite': [test_dir['name']],
'priority': 10,
'timeout': 1000,
'depends': test_deps + t.get('deps', []),
'env': env,
} + t.get('test_kwargs', {})
- test(test_dir['name'] / kind,
+ test(test_group / kind,
python,
- args: testwrap_base + [
+ args: [
+ testwrap_base,
+ '--testgroup', test_group,
'--testname', kind,
- '--', test_command,
+ '--',
+ test_command_base,
+ '--outputdir', test_output,
+ '--temp-instance', test_output / 'tmp_check',
+ '--port', testport.to_string(),
+ test_selection,
],
+ suite: test_group,
kwargs: test_kwargs,
)
+ install_suites += test_group
+
+ # some tests can't support running against running DB
+ if runningcheck and t.get('runningcheck', true)
+ test(test_group_running / kind,
+ python,
+ args: [
+ testwrap_base,
+ '--testgroup', test_group_running,
+ '--testname', kind,
+ '--',
+ test_command_base,
+ '--outputdir', test_output_running,
+ test_selection,
+ ],
+ is_parallel: t.get('runningcheck-parallel', true),
+ suite: test_group_running,
+ kwargs: test_kwargs,
+ )
+ running_suites += test_group_running
+ endif
testport += 1
elif kind == 'tap'
@@ -3011,9 +3063,10 @@ foreach test_dir : tests
env.set(name, value)
endforeach
+ test_group = test_dir['name']
test_kwargs = {
'protocol': 'tap',
- 'suite': [test_dir['name']],
+ 'suite': test_group,
'timeout': 1000,
'depends': test_deps + t.get('deps', []),
'env': env,
@@ -3033,12 +3086,14 @@ foreach test_dir : tests
python,
kwargs: test_kwargs,
args: testwrap_base + [
+ '--testgroup', test_dir['name'],
'--testname', onetap_p,
'--', test_command,
test_dir['sd'] / onetap,
],
)
endforeach
+ install_suites += test_group
else
error('unknown kind @0@ of test in @1@'.format(kind, test_dir['sd']))
endif
@@ -3047,6 +3102,14 @@ foreach test_dir : tests
endforeach # directories with tests
+# repeat condition so meson realizes version dependency
+if meson.version().version_compare('>=0.57')
+ add_test_setup('tmp_install',
+ is_default: true,
+ exclude_suites: running_suites)
+ add_test_setup('running',
+ exclude_suites: ['setup'] + install_suites)
+endif
###############################################################
diff --git a/contrib/basic_archive/meson.build b/contrib/basic_archive/meson.build
index c30dcfa5d41..08d72598e9d 100644
--- a/contrib/basic_archive/meson.build
+++ b/contrib/basic_archive/meson.build
@@ -25,5 +25,8 @@ tests += {
'regress_args': [
'--temp-config', files('basic_archive.conf'),
],
+ # Disabled because these tests require "shared_preload_libraries=basic_archive",
+ # which typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_freespacemap/meson.build b/contrib/pg_freespacemap/meson.build
index 904b37b6e9b..f802e297b67 100644
--- a/contrib/pg_freespacemap/meson.build
+++ b/contrib/pg_freespacemap/meson.build
@@ -33,5 +33,8 @@ tests += {
'regress_args': [
'--temp-config', files('pg_freespacemap.conf')
],
+ # Disabled because these tests require "autovacuum=off", which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index 854df138e76..bd0e42331eb 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -41,5 +41,9 @@ tests += {
'pg_stat_statements',
],
'regress_args': ['--temp-config', files('pg_stat_statements.conf')],
+ # Disabled because these tests require
+ # "shared_preload_libraries=pg_stat_statements", which typical
+ # runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/contrib/pg_walinspect/meson.build b/contrib/pg_walinspect/meson.build
index 4314a3182a2..351f184de83 100644
--- a/contrib/pg_walinspect/meson.build
+++ b/contrib/pg_walinspect/meson.build
@@ -28,6 +28,9 @@ tests += {
'sql': [
'pg_walinspect',
],
+ # Disabled because these tests require "wal_level=replica", which
+ # some runningcheck users do not have (e.g. buildfarm clients).
'regress_args': ['--temp-config', files('walinspect.conf')],
+ 'runningcheck': false,
},
}
diff --git a/contrib/test_decoding/meson.build b/contrib/test_decoding/meson.build
index 6876792fd86..65dfd3f7d88 100644
--- a/contrib/test_decoding/meson.build
+++ b/contrib/test_decoding/meson.build
@@ -43,6 +43,9 @@ tests += {
'regress_args': [
'--temp-config', files('logical.conf'),
],
+ # Disabled because these tests require "wal_level=logical", which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
'isolation': {
'specs': [
@@ -61,6 +64,8 @@ tests += {
'regress_args': [
'--temp-config', files('logical.conf'),
],
+ # see above
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/interfaces/ecpg/test/meson.build b/src/interfaces/ecpg/test/meson.build
index 94b26d10314..d4f1f1c0fcf 100644
--- a/src/interfaces/ecpg/test/meson.build
+++ b/src/interfaces/ecpg/test/meson.build
@@ -84,6 +84,7 @@ tests += {
'test_kwargs': {
'depends': ecpg_test_dependencies,
},
+ 'dbname': 'ecpg1_regression,ecpg2_regression',
'regress_args': ecpg_regress_args,
},
}
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 9c7f019392e..f64f3290447 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2108,6 +2108,12 @@ ninja
detailed information about interpreting the test results. You can
repeat this test at any later time by issuing the same command.
</para>
+
+ <para>
+ To run pg_regress and pg_isolation_regress tests against a running
+ postgres instance, specify <userinput>--setup running</userinput> as an
+ argument to <userinput>meson test</userinput>.
+ </para>
</step>
<step id="meson-install">
diff --git a/.cirrus.yml b/.cirrus.yml
index f31923333ef..0113799a6e2 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -195,6 +195,21 @@ task:
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
EOF
+ # test runningcheck, freebsd chosen because it's currently fast enough
+ test_running_script: |
+ su postgres <<-EOF
+ set -e
+ ulimit -c unlimited
+ meson test $MTEST_ARGS --quiet --suite setup
+ export LD_LIBRARY_PATH="$(pwd)/build/tmp_install/usr/local/pgsql/lib/:$LD_LIBRARY_PATH"
+ mkdir -p build/testrun
+ build/tmp_install/usr/local/pgsql/bin/initdb -N build/runningcheck --no-instructions -A trust
+ echo "include '$(pwd)/src/tools/ci/pg_ci_base.conf'" >> build/runningcheck/postgresql.conf
+ build/tmp_install/usr/local/pgsql/bin/pg_ctl -c -o '-c fsync=off' -D build/runningcheck -l build/testrun/runningcheck.log start
+ meson test $MTEST_ARGS --num-processes ${TEST_JOBS} --setup running
+ build/tmp_install/usr/local/pgsql/bin/pg_ctl -D build/runningcheck stop
+ EOF
+
on_failure:
<<: *on_failure_meson
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
diff --git a/src/test/isolation/meson.build b/src/test/isolation/meson.build
index e2ed400a80a..a999791876a 100644
--- a/src/test/isolation/meson.build
+++ b/src/test/isolation/meson.build
@@ -67,5 +67,6 @@ tests += {
'priority': 40,
'timeout': 1000,
},
+ 'dbname': 'isolation_regression',
},
}
diff --git a/src/test/modules/commit_ts/meson.build b/src/test/modules/commit_ts/meson.build
index 60cb12164d2..fa86e70e880 100644
--- a/src/test/modules/commit_ts/meson.build
+++ b/src/test/modules/commit_ts/meson.build
@@ -6,6 +6,9 @@ tests += {
'sql': [
'commit_timestamp',
],
+ # Disabled because these tests require "track_commit_timestamp = on",
+ # which typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/test/modules/snapshot_too_old/meson.build b/src/test/modules/snapshot_too_old/meson.build
index efd3f1f113b..5094b52949b 100644
--- a/src/test/modules/snapshot_too_old/meson.build
+++ b/src/test/modules/snapshot_too_old/meson.build
@@ -10,5 +10,8 @@ tests += {
'sto_using_hash_index',
],
'regress_args': ['--temp-config', files('sto.conf')],
+ # Disabled because these tests require "old_snapshot_threshold" >= 0, which
+ # typical runningcheck users do not have (e.g. buildfarm clients).
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/test_oat_hooks/meson.build b/src/test/modules/test_oat_hooks/meson.build
index 8802bbbac55..e9d09d92c30 100644
--- a/src/test/modules/test_oat_hooks/meson.build
+++ b/src/test/modules/test_oat_hooks/meson.build
@@ -25,5 +25,6 @@ tests += {
'test_oat_hooks',
],
'regress_args': ['--no-locale', '--encoding=UTF8'],
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/test_pg_dump/meson.build b/src/test/modules/test_pg_dump/meson.build
index 41021829f3a..73f1fcf9428 100644
--- a/src/test/modules/test_pg_dump/meson.build
+++ b/src/test/modules/test_pg_dump/meson.build
@@ -13,6 +13,8 @@ tests += {
'sql': [
'test_pg_dump',
],
+ # doesn't delete its user
+ 'runningcheck': false,
},
'tap': {
'tests': [
diff --git a/src/test/modules/test_slru/meson.build b/src/test/modules/test_slru/meson.build
index ca4633c793e..74dacd11ac8 100644
--- a/src/test/modules/test_slru/meson.build
+++ b/src/test/modules/test_slru/meson.build
@@ -31,5 +31,6 @@ tests += {
'test_slru',
],
'regress_args': ['--temp-config', files('test_slru.conf')],
+ 'runningcheck': false,
},
}
diff --git a/src/test/modules/worker_spi/meson.build b/src/test/modules/worker_spi/meson.build
index a4a158c75b9..660d721eea9 100644
--- a/src/test/modules/worker_spi/meson.build
+++ b/src/test/modules/worker_spi/meson.build
@@ -30,6 +30,8 @@ tests += {
'sql': [
'worker_spi',
],
- 'regress_args': ['--temp-config', files('dynamic.conf'), '--dbname=contrib_regression'],
+ 'dbname': 'contrib_regression',
+ 'regress_args': ['--temp-config', files('dynamic.conf')],
+ 'runningcheck': false,
},
}
diff --git a/src/test/regress/meson.build b/src/test/regress/meson.build
index 72a23737fa7..fbca624948b 100644
--- a/src/test/regress/meson.build
+++ b/src/test/regress/meson.build
@@ -75,5 +75,6 @@ tests += {
'priority': 50,
'timeout': 1000,
},
+ 'dbname': 'regression',
},
}
--
2.38.0
^ permalink raw reply [nested|flat] 81+ messages in thread
* Re: [RFC] building postgres with meson - v13
@ 2022-12-23 16:51 Justin Pryzby <pryzby@telsasoft.com>
parent: Andres Freund <andres@anarazel.de>
4 siblings, 0 replies; 81+ messages in thread
From: Justin Pryzby @ 2022-12-23 16:51 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Peter Geoghegan <pg@bowt.ie>; wangw.fnst@fujitsu.com, Tom Lane <tgl@sss.pgh.pa.us>; Nathan Bossart <nathandbossart@gmail.com>; Andrew Dunstan <andrew@dunslane.net>; Thomas Munro <thomas.munro@gmail.com>; samay sharma <smilingsamay@gmail.com>; Nazir Bilal Yavuz <byavuz81@gmail.com>; pgsql-hackers
> From 680ff3f7b4da1dbf21d0c7cd87af9bb5ee8b230c Mon Sep 17 00:00:00 2001
> From: Andres Freund <andres@anarazel.de>
> Date: Wed, 21 Sep 2022 20:36:36 -0700
> Subject: [PATCH v17 01/23] meson: ci: wip: move compilerwarnings task to meson
> always:
> gcc_warning_script: |
> - time ./configure \
> - --cache gcc.cache \
> - --enable-dtrace \
> - ${LINUX_CONFIGURE_FEATURES} \
> - CC="ccache gcc" CXX="ccache g++" CLANG="ccache clang"
> - make -s -j${BUILD_JOBS} clean
> - time make -s -j${BUILD_JOBS} world-bin
> + mkdir build && cd build
> + CC="ccache gcc" CXX="ccache g++" \
> + meson setup \
> + -Dwerror=true \
> + -Dcassert=false \
> + -Ddtrace=enabled \
> + ${LINUX_MESON_FEATURES} \
> + ..
> + time ninja -j${BUILD_JOBS}
With gcc, autoconf uses -O2, so I think this should specify
buildtype=debugoptimized, or pass -Doptimization=2. Otherwise it ends
up in release mode with -O3.
^ permalink raw reply [nested|flat] 81+ messages in thread
end of thread, other threads:[~2022-12-23 16:51 UTC | newest]
Thread overview: 81+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15 02:26 Re: [RFC] building postgres with meson - v13 Andres Freund <andres@anarazel.de>
2022-09-15 05:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-15 05:17 ` Andres Freund <andres@anarazel.de>
2022-09-15 21:14 ` Thomas Munro <thomas.munro@gmail.com>
2022-09-15 22:11 ` Andres Freund <andres@anarazel.de>
2022-09-16 18:49 ` Andres Freund <andres@anarazel.de>
2022-09-16 20:22 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-17 16:58 ` Andres Freund <andres@anarazel.de>
2022-09-19 00:24 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-19 00:29 ` Andres Freund <andres@anarazel.de>
2022-09-19 09:25 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-20 02:16 ` Andres Freund <andres@anarazel.de>
2022-09-21 00:11 ` Andres Freund <andres@anarazel.de>
2022-09-21 02:52 ` John Naylor <john.naylor@enterprisedb.com>
2022-09-21 05:15 ` Andres Freund <andres@anarazel.de>
2022-09-26 08:18 ` John Naylor <john.naylor@enterprisedb.com>
2022-09-26 19:06 ` Andres Freund <andres@anarazel.de>
2022-09-27 07:41 ` John Naylor <john.naylor@enterprisedb.com>
2022-09-30 04:53 ` John Naylor <john.naylor@enterprisedb.com>
2022-09-21 16:46 ` Andres Freund <andres@anarazel.de>
2022-09-21 17:56 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-21 18:21 ` Andres Freund <andres@anarazel.de>
2022-09-21 18:22 ` Justin Pryzby <pryzby@telsasoft.com>
2022-09-21 23:10 ` Andres Freund <andres@anarazel.de>
2022-09-22 05:57 ` Andres Freund <andres@anarazel.de>
2022-09-22 08:29 ` Andrew Dunstan <andrew@dunslane.net>
2022-09-22 15:05 ` Andres Freund <andres@anarazel.de>
2022-09-22 20:05 ` Nathan Bossart <nathandbossart@gmail.com>
2022-09-22 20:21 ` Peter Geoghegan <pg@bowt.ie>
2022-09-22 21:50 ` Andres Freund <andres@anarazel.de>
2022-09-22 22:04 ` Peter Geoghegan <pg@bowt.ie>
2022-09-24 23:56 ` Peter Geoghegan <pg@bowt.ie>
2022-09-25 00:13 ` Andres Freund <andres@anarazel.de>
2022-09-25 00:33 ` Peter Geoghegan <pg@bowt.ie>
2022-09-25 19:38 ` Andres Freund <andres@anarazel.de>
2022-09-26 00:38 ` Andres Freund <andres@anarazel.de>
2022-09-26 06:24 ` wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
2022-09-26 06:46 ` Andres Freund <andres@anarazel.de>
2022-09-26 07:25 ` wangw.fnst@fujitsu.com <wangw.fnst@fujitsu.com>
2022-09-26 08:41 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-26 15:41 ` Andres Freund <andres@anarazel.de>
2022-09-26 19:47 ` Peter Geoghegan <pg@bowt.ie>
2022-09-26 20:27 ` Andres Freund <andres@anarazel.de>
2022-09-26 21:15 ` Peter Geoghegan <pg@bowt.ie>
2022-12-07 03:25 ` Andres Freund <andres@anarazel.de>
2022-09-22 20:28 ` Andres Freund <andres@anarazel.de>
2022-09-22 22:37 ` Nathan Bossart <nathandbossart@gmail.com>
2022-09-24 17:52 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-24 18:09 ` Andres Freund <andres@anarazel.de>
2022-09-26 13:01 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-26 16:35 ` Andres Freund <andres@anarazel.de>
2022-09-26 19:44 ` Andres Freund <andres@anarazel.de>
2022-09-27 01:19 ` Andres Freund <andres@anarazel.de>
2022-09-27 04:29 ` Thomas Munro <thomas.munro@gmail.com>
2022-09-27 04:48 ` Andres Freund <andres@anarazel.de>
2022-09-30 21:51 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-09-30 22:35 ` Andres Freund <andres@anarazel.de>
2022-10-04 03:25 ` Andres Freund <andres@anarazel.de>
2022-10-05 08:16 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-10-05 17:14 ` Andres Freund <andres@anarazel.de>
2022-10-13 09:24 ` shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>
2022-10-13 16:39 ` Andres Freund <andres@anarazel.de>
2022-10-14 03:21 ` shiy.fnst@fujitsu.com <shiy.fnst@fujitsu.com>
2022-10-14 03:35 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-10-15 19:10 ` Andres Freund <andres@anarazel.de>
2022-10-15 21:39 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-10-02 17:25 ` Justin Pryzby <pryzby@telsasoft.com>
2022-10-02 18:05 ` Andres Freund <andres@anarazel.de>
2022-10-02 18:38 ` Justin Pryzby <pryzby@telsasoft.com>
2022-10-03 00:19 ` Justin Pryzby <pryzby@telsasoft.com>
2022-10-18 17:09 ` Justin Pryzby <pryzby@telsasoft.com>
2022-12-23 16:51 ` Justin Pryzby <pryzby@telsasoft.com>
2022-09-27 13:16 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-10-03 07:39 ` samay sharma <smilingsamay@gmail.com>
2022-10-05 06:40 ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2022-12-02 17:40 ` Andres Freund <andres@anarazel.de>
2022-09-22 14:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-22 14:56 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-22 15:04 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-09-22 15:21 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-22 15:05 ` Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox