Received: from malur.postgresql.org ([217.196.149.56])
by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
(Exim 4.94.2)
(envelope-from )
id 1qnDXl-00A8ar-QK
for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Oct 2023 07:40:42 +0000
Received: from localhost ([127.0.0.1] helo=malur.postgresql.org)
by malur.postgresql.org with esmtp (Exim 4.94.2)
(envelope-from )
id 1qnDXj-00HKGE-Dr
for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Oct 2023 07:40:39 +0000
Received: from makus.postgresql.org ([2001:4800:3e1:1::229])
by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
(Exim 4.94.2)
(envelope-from )
id 1qnDXh-00HKFR-Td
for pgsql-hackers@lists.postgresql.org; Mon, 02 Oct 2023 07:40:38 +0000
Received: from wout2-smtp.messagingengine.com ([64.147.123.25])
by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
(Exim 4.94.2)
(envelope-from )
id 1qnDXa-007kB2-Hj
for pgsql-hackers@lists.postgresql.org; Mon, 02 Oct 2023 07:40:36 +0000
Received: from compute5.internal (compute5.nyi.internal [10.202.2.45])
by mailout.west.internal (Postfix) with ESMTP id 371EB32015E5;
Mon, 2 Oct 2023 03:38:18 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
by compute5.internal (MEProxy); Mon, 02 Oct 2023 03:38:18 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h=
cc:cc:content-type:content-type:date:date:from:from:in-reply-to
:in-reply-to:message-id:mime-version:references:reply-to:sender
:subject:subject:to:to; s=fm2; t=1696232297; x=1696318697; bh=5V
NPYaH9VrBNPSRBCcWp9nKueXBSRXBZGKdWi7v/oNM=; b=rlcGTqg9zghTK/rZh8
KNL2ZbxhUgDPysKSnSVbp8jrtNWkDNKa/6QvbWmAEnYPzupxyjHPbhn4pU2awCdM
69JkGSw6aZ8WPfkAfJMFzuAocoEAVU/wPl40SJwNU7J5cQSjzRM1ZEbvM9GV33iL
t59/7rJjMyzpLglFk1y4du6bD2qWAqQ0s0YOsOfdFEDMKTCVI9IYLkrMs1nF+pRv
82Kk7iDP11GZvo0VeekvEnehKdcWT3gYjSWNy8UbkDXNTKeirFd42gLH8BpqMErS
qa4llseQod8FccplHtVjvpp5k9E3AP/1gpTj8oqSTlcD6Z2IubZfLJ1KZ2a67Yjm
ufCQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:sender:subject
:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
:x-sasl-enc; s=fm2; t=1696232297; x=1696318697; bh=5VNPYaH9VrBNP
SRBCcWp9nKueXBSRXBZGKdWi7v/oNM=; b=nQxnGuNBnuiYMGBBhghBkHx0d4OXP
9bwEZcGiM5JiXizbdbhaoHOQtLvV9xx27euX5oa5muL3AMqJ9ZTCQFPS4K4mx7rz
UgcT2MvgKC3mLHpnJZyiBwT+vBkgdNvC5ecxekM/5r6v5f4RYJHXqnRsTxlxMl2z
8kGAm1jNBuR7ZPlUrZQKr8FEPDFIttBBW4xKgTVhJEloYIyiQM9f+myhQOUrpfRk
xsHr/FsDstA905JSTD8Bftw+e2J3mdmuJ/u+cb/GsxOOzrNFnWprHmNP0vK7RjFP
RXRrBumsPq8pjwh9D+CY/guD3Ro/ebwJcXPlZzgyPOKtzMmy2l6Maxq0w==
X-ME-Sender:
X-ME-Received:
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdekgddujecutefuodetggdotefrodftvf
curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg
hrlhcuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt
vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg
hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeg
geffhfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtne
curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii
X-ME-Proxy:
Feedback-ID: i0fe9450f:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
2 Oct 2023 03:38:14 -0400 (EDT)
Date: Mon, 2 Oct 2023 16:38:11 +0900
From: Michael Paquier
To: Peter Eisentraut
Cc: Postgres hackers
Subject: Re: Remove MSVC scripts from the tree
Message-ID:
References:
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="PT/k+DAIh5wT9u9p"
Content-Disposition: inline
In-Reply-To:
List-Id:
List-Help:
List-Subscribe:
List-Post:
List-Owner:
List-Archive:
Archived-At:
Precedence: bulk
--PT/k+DAIh5wT9u9p
Content-Type: multipart/mixed; boundary="G2OByfeWSmw0dIXN"
Content-Disposition: inline
--G2OByfeWSmw0dIXN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Fri, Sep 29, 2023 at 11:26:55AM +0200, Peter Eisentraut wrote:
> Your patch still leaves various mentions of Mkvcbuild.pm and Project.pm in
> other files, including in
Indeed, thanks. I didn't think to check for references to these
modules.
> config/perl.m4
Here is the thing:
# switches for symbols not beginning with underscore. Some exceptions are the
# Windows-specific -D_USE_32BIT_TIME_T and -D__MINGW_USE_VC2005_COMPAT; see
# Mkvcbuild.pm for details.
And we'd lose quite some information here. meson.build loops back to
perl.m4 for this part. Reformating the comments perl.m4 should do the
job.
> meson.build
These were in Project::_new() and WriteItemDefinitionGroup(). Just
removing the reference does not remove any information.
> src/bin/pg_basebackup/Makefile
-# If you add or remove files here, also update Mkvcbuild.pm, which only knows
-# about OBJS, not BBOBJS, and thus has to be manually updated to stay in sync
-# with this list.
This can be removed, I guess.
> src/bin/pgevent/meson.build
The reference can be removed. The original says nothing about the use
of DisableLinkerWarnings() in this case.
> src/common/Makefile
> src/common/meson.build
These two have the same copy-pasted comment, and the reference can be
removed.
> src/interfaces/libpq/Makefile
Can be removed once the MSVC files are gone.
> src/port/Makefile
Can be removed.
Attached is a v2 with these adjustments, for now.
--
Michael
--G2OByfeWSmw0dIXN
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v2-0001-Remove-MSVC-scripts.patch"
Content-Transfer-Encoding: quoted-printable
=46rom e2f67a31e066b6a4df559ec3e3bf6a038e27a3a9 Mon Sep 17 00:00:00 2001
=46rom: Michael Paquier
Date: Mon, 2 Oct 2023 16:26:48 +0900
Subject: [PATCH v2] Remove MSVC scripts
---
src/backend/meson.build | 2 +-
src/common/Makefile | 9 +-
src/common/meson.build | 7 +-
src/port/Makefile | 2 -
src/bin/pg_basebackup/Makefile | 3 -
src/bin/pgevent/meson.build | 2 +-
src/interfaces/libpq/Makefile | 3 -
config/perl.m4 | 18 +-
doc/src/sgml/filelist.sgml | 1 -
doc/src/sgml/install-windows.sgml | 589 --------
doc/src/sgml/installation.sgml | 20 +-
doc/src/sgml/postgres.sgml | 1 -
doc/src/sgml/standalone-profile.xsl | 4 -
meson.build | 3 +-
src/tools/msvc/.gitignore | 3 -
src/tools/msvc/Install.pm | 748 ----------
src/tools/msvc/MSBuildProject.pm | 508 -------
src/tools/msvc/Mkvcbuild.pm | 1216 ----------------
src/tools/msvc/Project.pm | 482 -------
src/tools/msvc/README | 99 --
src/tools/msvc/Solution.pm | 1358 ------------------
src/tools/msvc/VSObjectFactory.pm | 174 ---
src/tools/msvc/build.bat | 6 -
src/tools/msvc/build.pl | 92 --
src/tools/msvc/clean.bat | 160 ---
src/tools/msvc/config_default.pl | 32 -
src/tools/msvc/dummylib/README | 13 -
src/tools/msvc/dummylib/Win32.pm | 7 -
src/tools/msvc/dummylib/Win32/Registry.pm | 16 -
src/tools/msvc/dummylib/Win32API/File.pm | 17 -
src/tools/msvc/ecpg_regression.proj | 64 -
src/tools/msvc/install.bat | 6 -
src/tools/msvc/install.pl | 39 -
src/tools/msvc/mkvcbuild.pl | 31 -
src/tools/msvc/pgbison.bat | 7 -
src/tools/msvc/pgbison.pl | 55 -
src/tools/msvc/pgflex.bat | 7 -
src/tools/msvc/pgflex.pl | 108 --
src/tools/msvc/vcregress.bat | 6 -
src/tools/msvc/vcregress.pl | 664 ---------
src/tools/{msvc/gendef.pl =3D> msvc_gendef.pl} | 4 +-
src/tools/perlcheck/pgperlsyncheck | 2 +-
42 files changed, 38 insertions(+), 6550 deletions(-)
delete mode 100644 doc/src/sgml/install-windows.sgml
delete mode 100644 src/tools/msvc/.gitignore
delete mode 100644 src/tools/msvc/Install.pm
delete mode 100644 src/tools/msvc/MSBuildProject.pm
delete mode 100644 src/tools/msvc/Mkvcbuild.pm
delete mode 100644 src/tools/msvc/Project.pm
delete mode 100644 src/tools/msvc/README
delete mode 100644 src/tools/msvc/Solution.pm
delete mode 100644 src/tools/msvc/VSObjectFactory.pm
delete mode 100755 src/tools/msvc/build.bat
delete mode 100644 src/tools/msvc/build.pl
delete mode 100755 src/tools/msvc/clean.bat
delete mode 100644 src/tools/msvc/config_default.pl
delete mode 100644 src/tools/msvc/dummylib/README
delete mode 100644 src/tools/msvc/dummylib/Win32.pm
delete mode 100644 src/tools/msvc/dummylib/Win32/Registry.pm
delete mode 100644 src/tools/msvc/dummylib/Win32API/File.pm
delete mode 100644 src/tools/msvc/ecpg_regression.proj
delete mode 100644 src/tools/msvc/install.bat
delete mode 100755 src/tools/msvc/install.pl
delete mode 100644 src/tools/msvc/mkvcbuild.pl
delete mode 100755 src/tools/msvc/pgbison.bat
delete mode 100644 src/tools/msvc/pgbison.pl
delete mode 100755 src/tools/msvc/pgflex.bat
delete mode 100644 src/tools/msvc/pgflex.pl
delete mode 100644 src/tools/msvc/vcregress.bat
delete mode 100644 src/tools/msvc/vcregress.pl
rename src/tools/{msvc/gendef.pl =3D> msvc_gendef.pl} (97%)
diff --git a/src/backend/meson.build b/src/backend/meson.build
index 88a35e9676..fbc8a9c6aa 100644
--- a/src/backend/meson.build
+++ b/src/backend/meson.build
@@ -72,7 +72,7 @@ postgres_lib =3D static_library('postgres_lib',
=20
if cc.get_id() =3D=3D 'msvc'
postgres_def =3D custom_target('postgres.def',
- command: [perl, files('../tools/msvc/gendef.pl'),
+ command: [perl, files('../tools/msvc_gendef.pl'),
'--arch', host_cpu,
'--tempdir', '@PRIVATE_DIR@',
'--deffile', '@OUTPUT@',
diff --git a/src/common/Makefile b/src/common/Makefile
index cc5c54dcee..c84f270368 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -43,8 +43,6 @@ override CPPFLAGS +=3D -DVAL_LIBS=3D"\"$(LIBS)\""
override CPPFLAGS :=3D -DFRONTEND -I. -I$(top_srcdir)/src/common $(CPPFLAG=
S)
LIBS +=3D $(PTHREAD_LIBS)
=20
-# If you add objects here, see also src/tools/msvc/Mkvcbuild.pm
-
OBJS_COMMON =3D \
archive.o \
base64.o \
@@ -98,10 +96,9 @@ OBJS_COMMON +=3D \
endif
=20
# 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.
+# 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.
OBJS_FRONTEND_SHLIB =3D \
$(OBJS_COMMON) \
fe_memutils.o \
diff --git a/src/common/meson.build b/src/common/meson.build
index 3b97497d1a..6984fba1ab 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -95,10 +95,9 @@ common_sources_cflags =3D {
=20
=20
# 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.
+# 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.
=20
common_sources_frontend_shlib =3D common_sources
common_sources_frontend_shlib +=3D files(
diff --git a/src/port/Makefile b/src/port/Makefile
index f205c2c9c5..8c79731269 100644
--- a/src/port/Makefile
+++ b/src/port/Makefile
@@ -35,8 +35,6 @@ include $(top_builddir)/src/Makefile.global
override CPPFLAGS :=3D -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
LIBS +=3D $(PTHREAD_LIBS)
=20
-# If you add objects here, see also src/tools/msvc/Mkvcbuild.pm
-
OBJS =3D \
$(LIBOBJS) \
$(PG_CRC32C_OBJS) \
diff --git a/src/bin/pg_basebackup/Makefile b/src/bin/pg_basebackup/Makefile
index 893a75c942..31609469bc 100644
--- a/src/bin/pg_basebackup/Makefile
+++ b/src/bin/pg_basebackup/Makefile
@@ -35,9 +35,6 @@ OBJS =3D \
streamutil.o \
walmethods.o
=20
-# If you add or remove files here, also update Mkvcbuild.pm, which only kn=
ows
-# about OBJS, not BBOBJS, and thus has to be manually updated to stay in s=
ync
-# with this list.
BBOBJS =3D \
pg_basebackup.o \
bbstreamer_file.o \
diff --git a/src/bin/pgevent/meson.build b/src/bin/pgevent/meson.build
index eca930ae47..0f9062b5e6 100644
--- a/src/bin/pgevent/meson.build
+++ b/src/bin/pgevent/meson.build
@@ -14,7 +14,7 @@ pgevent_sources +=3D rc_bin_gen.process(win32ver_rc, extr=
a_args: [
=20
pgevent_sources +=3D windows.compile_resources('pgmsgevent.rc')
=20
-# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right appr=
oach
+# FIXME: this may not not the right approach..
pgevent_link_args =3D []
if cc.get_id() =3D=3D 'msvc'
pgevent_link_args +=3D '/ignore:4104'
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 46653682b0..296d7c65d8 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -27,9 +27,6 @@ ifneq ($(PORTNAME), win32)
override CFLAGS +=3D $(PTHREAD_CFLAGS)
endif
=20
-# The MSVC build system scrapes OBJS from this file. If you change any of
-# the conditional additions of files to OBJS, update Mkvcbuild.pm to match.
-
OBJS =3D \
$(WIN32RES) \
fe-auth-scram.o \
diff --git a/config/perl.m4 b/config/perl.m4
index 8126e79f67..f69e463ed7 100644
--- a/config/perl.m4
+++ b/config/perl.m4
@@ -59,9 +59,21 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
# Postgres uses. The available information says that most symbols that af=
fect
# Perl's own ABI begin with letters, so it's almost sufficient to adopt -D
# switches for symbols not beginning with underscore. Some exceptions are=
the
-# Windows-specific -D_USE_32BIT_TIME_T and -D__MINGW_USE_VC2005_COMPAT; see
-# Mkvcbuild.pm for details. We absorb the former when Perl reports it. P=
erl
-# never reports the latter, and we don't attempt to deduce when it's neede=
d.
+# Windows-specific -D_USE_32BIT_TIME_T and -D__MINGW_USE_VC2005_COMPAT. To=
be
+# exact, Windows offers several 32-bit ABIs. Perl is sensitive to
+# sizeof(time_t), one of the ABI dimensions. To get 32-bit time_t, use
+# "cl -D_USE_32BIT_TIME_T" or plain "gcc". For 64-bit time_t, use
+# "gcc -D__MINGW_USE_VC2005_COMPAT" or plain "cl". Before MSVC 2005, plain
+# "cl" chose 32-bit time_t. PostgreSQL doesn't support building with
+# pre-MSVC-2005 compilers, but it does support linking to Perl built with =
such
+# a compiler. MSVC-built Perl 5.13.4 and later report -D_USE_32BIT_TIME_T=
in
+# $Config{ccflags} if applicable, but MinGW-built Perl never reports
+# -D_USE_32BIT_TIME_T despite typically needing it. Ignore the $Config{cc=
flags}
+# opinion about -D_USE_32BIT_TIME_T, and use a runtime test to deduce the =
ABI
+# Perl expects. Specifically, test use of PL_modglobal, which maps to a
+# PerlInterpreter field whose position depends on sizeof(time_t). We abso=
rb
+# the former when Perl reports it. Perl never reports the latter, and we =
don't
+# attempt to deduce when it's needed.
# Consequently, we don't support using MinGW to link to MSVC-built Perl. =
As
# of 2017, all supported ActivePerl and Strawberry Perl are MinGW-built. =
If
# that changes or an MSVC-built Perl distribution becomes prominent, we can
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index 4c63a7e768..5f6b58133b 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -38,7 +38,6 @@
-
diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windo=
ws.sgml
deleted file mode 100644
index f959d27d20..0000000000
--- a/doc/src/sgml/install-windows.sgml
+++ /dev/null
@@ -1,589 +0,0 @@
-
-
-
- Installation from Source Code on Windows
-
-
- installation
- on Windows
-
-
-
- It is recommended that most users download the binary distribution for
- Windows, available as a graphical installer package
- from the PostgreSQL website at
- . Building f=
rom source
- is only intended for people developing PostgreSQL
- or extensions.
-
-
-
- There are several different ways of building PostgreSQL on
- Windows. The simplest way to build with
- Microsoft tools is to install Visual Studio 2022
- and use the included compiler. It is also possible to build with the full
- Microsoft Visual C++ 2015 to 2022.
- In some cases that requires the installation of the
- Windows SDK in addition to the compiler.
-
-
-
- It is also possible to build PostgreSQL using the GNU compiler tools
- provided by MinGW, or using
- Cygwin for older versions of
- Windows.
-
-
-
- Building using MinGW or
- Cygwin uses the normal build system, see
- and the specific notes in
- and .
- To produce native 64 bit binaries in these environments, use the tools f=
rom
- MinGW-w64. These tools can also be used to
- cross-compile for 32 bit and 64 bit Windows
- targets on other hosts, such as Linux and
- macOS.
- Cygwin is not recommended for running a
- production server, and it should only be used for running on
- older versions of Windows where
- the native build does not work. The official
- binaries are built using Visual Studio.
-
-
-
- Native builds of psql don't support command
- line editing. The Cygwin build does support
- command line editing, so it should be used where psql is needed for
- interactive use on Windows.
-
-
-
- Building with Visual C++ or the
- Microsoft Windows SDK
-
-
- PostgreSQL can be built using the Visual C++ compiler suite from Microso=
ft.
- These compilers can be either from Visual Studio,
- Visual Studio Express or some versions of the
- Microsoft Windows SDK. If you do not already =
have a
- Visual Studio environment set up, the easiest
- ways are to use the compilers from
- Visual Studio 2022 or those in the
- Windows SDK 10, which are both free downloads
- from Microsoft.
-
-
-
- Both 32-bit and 64-bit builds are possible with the Microsoft Compiler s=
uite.
- 32-bit PostgreSQL builds are possible with
- Visual Studio 2015 to
- Visual Studio 2022,
- as well as standalone Windows SDK releases 10 and above.
- 64-bit PostgreSQL builds are supported with
- Microsoft Windows SDK version 10 and above or
- Visual Studio 2015 and above.
-
-
-
-
- The tools for building using Visual C++ or
- Platform SDK are in the
- src\tools\msvc directory. When building, make sure
- there are no tools from MinGW or
- Cygwin present in your system PATH. Also, make
- sure you have all the required Visual C++ tools available in the PATH. In
- Visual Studio, start the
- Visual Studio Command Prompt.
- If you wish to build a 64-bit version, you must use the 64-bit version of
- the command, and vice versa.
- Starting with Visual Studio 2017 this can be
- done from the command line using VsDevCmd.bat, see
- -help for the available options and their default val=
ues.
- vsvars32.bat is available in
- Visual Studio 2015 and earlier versions for t=
he
- same purpose.
- From the Visual Studio Command Prompt, you can
- change the targeted CPU architecture, build type, and target OS by using=
the
- vcvarsall.bat command, e.g.,
- vcvarsall.bat x64 10.0.10240.0 to target Windows 10
- with a 64-bit release build. See -help for the other
- options of vcvarsall.bat. All commands should be run =
=66rom
- the src\tools\msvc directory.
-
-
-
- Before you build, you can create the file config.pl
- to reflect any configuration options you want to change, or the paths to
- any third party libraries to use. The complete configuration is determin=
ed
- by first reading and parsing the file config_default.pl,
- and then apply any changes from config.pl. For exam=
ple,
- to specify the location of your Python instal=
lation,
- put the following in config.pl:
-
-$config->{python} =3D 'c:\python310';
-
- You only need to specify those parameters that are different from what's=
in
- config_default.pl.
-
-
-
- If you need to set any other environment variables, create a file called
- buildenv.pl and put the required commands there. For
- example, to add the path for bison when it's not in the PATH, create a f=
ile
- containing:
-
-$ENV{PATH}=3D$ENV{PATH} . ';c:\some\where\bison\bin';
-
-
-
-
- To pass additional command line arguments to the Visual Studio build
- command (msbuild or vcbuild):
-
-$ENV{MSBFLAGS}=3D"/m";
-
-
-
-
- Requirements
-
- The following additional products are required to build
- PostgreSQL. Use the
- config.pl file to specify which directories the li=
braries
- are available in.
-
-
-
- Microsoft Windows SDK
-
- If your build environment doesn't ship with a supported version of t=
he
- Microsoft Windows SDK it
- is recommended that you upgrade to the latest version (currently
- version 10), available for download from
- .
-
-
- You must always include the
- Windows Headers and Libraries part of the=
SDK.
- If you install a Windows SDK
- including the Visual C++ Compilers,
- you don't need Visual Studio to build.
- Note that as of Version 8.0a the Windows SDK no longer ships with a
- complete command-line build environment.
-
-
-
-
- ActiveState Perl
-
- ActiveState Perl is required to run the build generation scripts. Mi=
nGW
- or Cygwin Perl will not work. It must also be present in the PATH.
- Binaries can be downloaded from
-
- (Note: version 5.14 or later is required,
- the free Standard Distribution is sufficient).
-
-
-
-
-
-
- The following additional products are not required to get started,
- but are required to build the complete package. Use the
- config.pl file to specify which directories the li=
braries
- are available in.
-
-
-
- ActiveState TCL
-
- Required for building PL/Tcl (Note: versi=
on
- 8.4 is required, the free Standard Distribution is sufficient).
-
-
-
-
- Bison and
- Flex
-
-
- Bison and Flex=
are
- required to build from Git, but not required when building from a re=
lease
- file. Only Bison versions 2.3 and later
- will work. Flex must be version 2.5.35 or=
later.
-
-
-
- Both Bison and Flex
- are included in the msys tool suite, avai=
lable
- from as part =
of the
- MinGW compiler suite.
-
-
-
- You will need to add the directory containing
- flex.exe and bison.exe to =
the
- PATH environment variable in buildenv.pl unless
- they are already in PATH. In the case of MinGW, the directory is the
- \msys\1.0\bin subdirectory of your MinGW
- installation directory.
-
-
-
-
- The Bison distribution from GnuWin32 appears to have a bug that
- causes Bison to malfunction when installed in a directory with
- spaces in the name, such as the default location on English
- installations C:\Program Files\GnuWin32.
- Consider installing into C:\GnuWin32 or use t=
he
- NTFS short name path to GnuWin32 in your PATH environment setting
- (e.g., C:\PROGRA~1\GnuWin32).
-
-
-
-
-
-
-
- Diff
-
- Diff is required to run the regression tests, and can be downloaded
- from .
-
-
-
-
- Gettext
-
- Gettext is required to build with NLS support, and can be downloaded
- from . Note t=
hat binaries,
- dependencies and developer files are all needed.
-
-
-
-
- MIT Kerberos
-
- Required for GSSAPI authentication support. MIT Kerberos can be
- downloaded from
- .
-
-
-
-
- libxml2 and
- libxslt
-
- Required for XML support. Binaries can be downloaded from
- or source f=
rom
- . Note that libxml2 requir=
es iconv,
- which is available from the same download location.
-
-
-
-
- LZ4
-
- Required for supporting LZ4 compression.
- Binaries and source can be downloaded from
- .
-
-
-
-
- Zstandard
-
- Required for supporting Zstandard compres=
sion.
- Binaries and source can be downloaded from
- .
-
-
-
-
- OpenSSL
-
- Required for SSL support. Binaries can be downloaded from
-
- or source from .
-
-
-
-
- ossp-uuid
-
- Required for UUID-OSSP support (contrib only). Source can be
- downloaded from
- .
-
-
-
-
- Python
-
- Required for building PL/Python. Binaries=
can
- be downloaded from .
-
-
-
-
- zlib
-
- Required for compression support in pg_dump
- and pg_restore. Binaries can be downloaded
- from .
-
-
-
-
-
-
-
-
- Special Considerations for 64-Bit Windows
-
-
- PostgreSQL will only build for the x64 architecture on 64-bit Windows.
-
-
-
- Mixing 32- and 64-bit versions in the same build tree is not supported.
- The build system will automatically detect if it's running in a 32- or
- 64-bit environment, and build PostgreSQL accordingly. For this reason, =
it
- is important to start the correct command prompt before building.
-
-
-
- To use a server-side third party library such as Python
or
- OpenSSL, this library must also be
- 64-bit. There is no support for loading a 32-bit library in a 64-bit
- server. Several of the third party libraries that PostgreSQL supports m=
ay
- only be available in 32-bit versions, in which case they cannot be used=
with
- 64-bit PostgreSQL.
-
-
-
-
- Building
-
-
- To build all of PostgreSQL in release configuration (the default), run =
the
- command:
-
-build
-
- To build all of PostgreSQL in debug configuration, run the command:
-
-build DEBUG
-
- To build just a single project, for example psql, run the commands:
-
-build psql
-build DEBUG psql
-
- To change the default build configuration to debug, put the following
- in the buildenv.pl file:
-
-$ENV{CONFIG}=3D"Debug";
-
-
-
-
- It is also possible to build from inside the Visual Studio GUI. In this
- case, you need to run:
-
-perl mkvcbuild.pl
-
- from the command prompt, and then open the generated
- pgsql.sln (in the root directory of the source tre=
e)
- in Visual Studio.
-
-
-
-
- Cleaning and Installing
-
-
- Most of the time, the automatic dependency tracking in Visual Studio wi=
ll
- handle changed files. But if there have been large changes, you may need
- to clean the installation. To do this, simply run the
- clean.bat command, which will automatically clean =
out
- all generated files. You can also run it with the
- dist parameter, in which case it will behave like
- make distclean and remove the flex/bison output =
files
- as well.
-
-
-
- By default, all files are written into a subdirectory of the
- debug or release directories.=
To
- install these files using the standard layout, and also generate the fi=
les
- required to initialize and use the database, run the command:
-
-install c:\destination\directory
-
-
-
-
- If you want to install only the client applications and
- interface libraries, then you can use these commands:
-
-install c:\destination\directory client
-
-
-
-
-
- Running the Regression Tests
-
-
- To run the regression tests, make sure you have completed the build of =
all
- required parts first. Also, make sure that the DLLs required to load all
- parts of the system (such as the Perl and Python DLLs for the procedural
- languages) are present in the system path. If they are not, set it thro=
ugh
- the buildenv.pl file. To run the tests, run one of
- the following commands from the src\tools\msvc
- directory:
-
-vcregress check
-vcregress installcheck
-vcregress plcheck
-vcregress contribcheck
-vcregress modulescheck
-vcregress ecpgcheck
-vcregress isolationcheck
-vcregress bincheck
-vcregress recoverycheck
-vcregress taptest
-
-
- To change the schedule used (default is parallel), append it to the
- command line like:
-
-vcregress check serial
-
-
- vcregress taptest can be used to run the TAP tests
- of a target directory, like:
-
-vcregress taptest src\bin\initdb\
-
-
- For more information about the regression tests, see
- .
-
-
-
- Running the regression tests on client programs with
- vcregress bincheck, on recovery tests with
- vcregress recoverycheck, or TAP tests specified with
- vcregress taptest requires an additional Perl module
- to be installed:
-
-
- IPC::Run
-
- As of this writing, IPC::Run is not included in t=
he
- ActiveState Perl installation, nor in the ActiveState Perl Package
- Manager (PPM) library. To install, download the
- IPC-Run-<version>.tar.gz source archive f=
rom
- CPAN,
- at , and
- uncompress. Edit the buildenv.pl file, and add =
a PERL5LIB
- variable to point to the lib subdirectory from =
the
- extracted archive. For example:
-
-$ENV{PERL5LIB}=3D$ENV{PERL5LIB} . ';c:\IPC-Run-0.94\lib';
-
-
-
-
-
-
-
- The TAP tests run with vcregress support the
- environment variables PROVE_TESTS, that is expanded
- automatically using the name patterns given, and
- PROVE_FLAGS. These can be set on a Windows terminal,
- before running vcregress:
-
-set PROVE_FLAGS=3D--timer --jobs 2
-set PROVE_TESTS=3Dt/020*.pl t/010*.pl
-
- It is also possible to set up those parameters in
- buildenv.pl:
-
-$ENV{PROVE_FLAGS}=3D'--timer --jobs 2'
-$ENV{PROVE_TESTS}=3D't/020*.pl t/010*.pl'
-
-
-
-
- Additionally, the behavior of TAP tests can be controlled by a set of
- environment variables, see .
-
-
-
- Some of the TAP tests depend on a set of external commands that would
- optionally trigger tests related to them. Each one of those variables
- can be set or unset in buildenv.pl:
-
-
- GZIP_PROGRAM
-
- Path to a gzip command. The default is
- gzip, which will search for a command by that
- name in the configured PATH.
-
-
-
-
- LZ4
-
- Path to a lz4 command. The default is
- lz4, which will search for a command by that
- name in the configured PATH.
-
-
-
-
- OPENSSL
-
- Path to an openssl command. The default is
- openssl, which will search for a command by that
- name in the configured PATH.
-
-
-
-
- TAR
-
- Path to a tar command. The default is
- tar, which will search for a command by that
- name in the configured PATH.
-
-
-
-
- ZSTD
-
- Path to a zstd command. The default is
- zstd, which will search for a command by that
- name in the configured PATH.
-
-
-
-
-
-
-
-
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index f4b1f81189..51d160c556 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -26,9 +26,8 @@ documentation. See standalone-profile.xsl for details.
=20
If you are building PostgreSQL for Microsoft
- Windows, read this chapter if you intend to build with MinGW or Cygwin;
- but if you intend to build with Microsoft's Visual
- C++, see instead.
+ Windows, read this chapter if you intend to build with Meson, MinGW or
+ Cygwin.
=20
@@ -3542,8 +3541,7 @@ ERROR: could not load library "/opt/dbs/pgsql/lib/pl=
perl.so": Bad address
PostgreSQL can be built using Cygwin, a Linux-like environment for
Windows, but that method is inferior to the native Windows build
- (see ) and
- running a server under Cygwin is no longer recommended.
+ with Meson, and running a server under Cygwin is no longer recommended.
=20
@@ -3717,12 +3715,14 @@ xcrun --show-sdk-path
=20
- PostgreSQL for Windows can be built using MinGW, a Unix-like build
- environment for Microsoft operating systems, or using
- Microsoft's Visual C++ compiler suite.
+ PostgreSQL for Windows can be built using MinGW, a Unix-like
+ build environment for Microsoft operating systems, or using
+ Microsoft's Visual C++ compiler suite
+ with Meson.
The MinGW build procedure uses the normal build system described in
- this chapter; the Visual C++ build works completely differently
- and is described in .
+ this chapter; the build of Meson using
+ Visual C++ works completely differently
+ and is described in .
=20
diff --git a/doc/src/sgml/postgres.sgml b/doc/src/sgml/postgres.sgml
index f629524be0..5230c6c077 100644
--- a/doc/src/sgml/postgres.sgml
+++ b/doc/src/sgml/postgres.sgml
@@ -156,7 +156,6 @@ break is not needed in a wider output rendering.
=20
&installbin;
&installation;
- &installw;
&runtime;
&config;
&client-auth;
diff --git a/doc/src/sgml/standalone-profile.xsl b/doc/src/sgml/standalone-=
profile.xsl
index 1b3938a638..e726ee61a2 100644
--- a/doc/src/sgml/standalone-profile.xsl
+++ b/doc/src/sgml/standalone-profile.xsl
@@ -60,10 +60,6 @@ variant without links and references to the main documen=
tation.
the configuration parameter wal_compression
=20
-
- the documentation
-
-
the documentation
diff --git a/meson.build b/meson.build
index 862c955453..f0ef075cfb 100644
--- a/meson.build
+++ b/meson.build
@@ -1871,7 +1871,7 @@ foreach w : negative_warning_flags
endforeach
=20
=20
-# From Project.pm
+# MSVC flags
if cc.get_id() =3D=3D 'msvc'
cflags_warn +=3D [
'/wd4018', # signed/unsigned mismatch
@@ -1883,6 +1883,7 @@ if cc.get_id() =3D=3D 'msvc'
'/wd4267', # conversion from 'size_t' to 'type', possible loss of data
]
=20
+ # Preprocessor definitions.
cppflags +=3D [
'/DWIN32',
'/DWINDOWS',
diff --git a/src/tools/msvc/.gitignore b/src/tools/msvc/.gitignore
deleted file mode 100644
index 2470e7850d..0000000000
--- a/src/tools/msvc/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Custom configuration files for MSVC build
-/config.pl
-/buildenv.pl
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
deleted file mode 100644
index b6dd2c3bba..0000000000
--- a/src/tools/msvc/Install.pm
+++ /dev/null
@@ -1,748 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Install;
-
-#
-# Package that provides 'make install' functionality for msvc builds
-#
-# src/tools/msvc/Install.pm
-#
-use strict;
-use warnings;
-use Carp;
-use File::Basename;
-use File::Copy;
-use File::Find ();
-
-use Exporter;
-our (@ISA, @EXPORT_OK);
-@ISA =3D qw(Exporter);
-@EXPORT_OK =3D qw(Install);
-
-my $insttype;
-my @client_contribs =3D ('oid2name', 'pgbench', 'vacuumlo');
-my @client_program_files =3D (
- 'clusterdb', 'createdb', 'createuser', 'dropdb',
- 'dropuser', 'ecpg', 'libecpg', 'libecpg_compat',
- 'libpgtypes', 'libpq', 'pg_amcheck', 'pg_basebackup',
- 'pg_config', 'pg_dump', 'pg_dumpall', 'pg_isready',
- 'pg_receivewal', 'pg_recvlogical', 'pg_restore', 'psql',
- 'reindexdb', 'vacuumdb', @client_contribs);
-
-sub lcopy
-{
- my $src =3D shift;
- my $target =3D shift;
-
- if (-f $target)
- {
- unlink $target || confess "Could not delete $target\n";
- }
-
- (my $retval =3D copy($src, $target))
- || confess "Could not copy $src to $target\n";
-
- return $retval;
-}
-
-sub Install
-{
- $| =3D 1;
-
- my $target =3D shift;
- $insttype =3D shift;
- $insttype =3D "all" unless ($insttype);
-
- # if called from vcregress, the config will be passed to us
- # so no need to re-include these
- our $config =3D shift;
- unless ($config)
- {
-
- # suppress warning about harmless redeclaration of $config
- no warnings 'misc';
- do "./config_default.pl";
- do "./config.pl" if (-f "config.pl");
- }
-
- # Move to the root path depending on the current location.
- if (-f "../../../configure")
- {
- chdir("../../..");
- }
- elsif (-f "../../../../configure")
- {
- chdir("../../../..");
- }
-
- my $conf =3D "";
- if (-d "debug")
- {
- $conf =3D "debug";
- }
- if (-d "release")
- {
- $conf =3D "release";
- }
- die "Could not find debug or release binaries" if ($conf eq "");
- my $majorver =3D DetermineMajorVersion();
- print "Installing version $majorver for $conf in $target\n";
-
- my @client_dirs =3D ('bin', 'lib', 'share', 'symbols');
- my @all_dirs =3D (
- @client_dirs, 'doc', 'doc/contrib', 'doc/extension', 'share/contrib',
- 'share/extension', 'share/timezonesets', 'share/tsearch_data');
- if ($insttype eq "client")
- {
- EnsureDirectories($target, @client_dirs);
- }
- else
- {
- EnsureDirectories($target, @all_dirs);
- }
-
- CopySolutionOutput($conf, $target);
- my $sample_files =3D [];
- my @top_dir =3D ("src");
- @top_dir =3D ("src\\bin", "src\\interfaces") if ($insttype eq "client");
- File::Find::find(
- {
- wanted =3D> sub {
- /^.*\.sample\z/s
- && push(@$sample_files, $File::Find::name);
-
- # Don't find files of in-tree temporary installations.
- $_ eq 'share' and $File::Find::prune =3D 1;
- }
- },
- @top_dir);
- CopySetOfFiles('config files', $sample_files, $target . '/share/');
- CopyFiles(
- 'Import libraries',
- $target . '/lib/',
- "$conf\\", "postgres\\postgres.lib", "libpgcommon\\libpgcommon.lib",
- "libpgport\\libpgport.lib");
- CopyContribFiles($config, $target);
- CopyIncludeFiles($target);
-
- if ($insttype ne "client")
- {
- CopySetOfFiles(
- 'timezone names',
- [ glob('src\timezone\tznames\*.txt') ],
- $target . '/share/timezonesets/');
- CopyFiles(
- 'timezone sets',
- $target . '/share/timezonesets/',
- 'src/timezone/tznames/', 'Default', 'Australia', 'India');
- CopySetOfFiles(
- 'BKI files',
- [ glob("src\\backend\\catalog\\postgres.*") ],
- $target . '/share/');
- CopySetOfFiles(
- 'SQL files',
- [ glob("src\\backend\\catalog\\*.sql") ],
- $target . '/share/');
- CopyFiles(
- 'Information schema data', $target . '/share/',
- 'src/backend/catalog/', 'sql_features.txt');
- CopyFiles(
- 'Error code data', $target . '/share/',
- 'src/backend/utils/', 'errcodes.txt');
- GenerateTimezoneFiles($target, $conf);
- GenerateTsearchFiles($target);
- CopySetOfFiles(
- 'Stopword files',
- [ glob("src\\backend\\snowball\\stopwords\\*.stop") ],
- $target . '/share/tsearch_data/');
- CopySetOfFiles(
- 'Dictionaries sample files',
- [ glob("src\\backend\\tsearch\\dicts\\*_sample*") ],
- $target . '/share/tsearch_data/');
-
- my $pl_extension_files =3D [];
- my @pldirs =3D ('src/pl/plpgsql/src');
- push @pldirs, "src/pl/plperl" if $config->{perl};
- push @pldirs, "src/pl/plpython" if $config->{python};
- push @pldirs, "src/pl/tcl" if $config->{tcl};
- File::Find::find(
- {
- wanted =3D> sub {
- /^(.*--.*\.sql|.*\.control)\z/s
- && push(@$pl_extension_files, $File::Find::name);
-
- # Don't find files of in-tree temporary installations.
- $_ eq 'share' and $File::Find::prune =3D 1;
- }
- },
- @pldirs);
- CopySetOfFiles('PL Extension files',
- $pl_extension_files, $target . '/share/extension/');
- }
-
- GenerateNLSFiles($target, $config->{nls}, $majorver) if ($config->{nls});
-
- print "Installation complete.\n";
- return;
-}
-
-sub EnsureDirectories
-{
- my $target =3D shift;
- mkdir $target unless -d ($target);
- while (my $d =3D shift)
- {
- mkdir $target . '/' . $d unless -d ($target . '/' . $d);
- }
- return;
-}
-
-sub CopyFiles
-{
- my $what =3D shift;
- my $target =3D shift;
- my $basedir =3D shift;
-
- print "Copying $what";
- while (my $f =3D shift)
- {
- print ".";
- $f =3D $basedir . $f;
- die "No file $f\n" if (!-f $f);
- lcopy($f, $target . basename($f)) || croak "Could not copy $f: $!\n";
- }
- print "\n";
- return;
-}
-
-sub CopySetOfFiles
-{
- my $what =3D shift;
- my $flist =3D shift;
- my $target =3D shift;
- print "Copying $what" if $what;
- foreach (@$flist)
- {
- my $tgt =3D $target . basename($_);
- print ".";
- lcopy($_, $tgt) || croak "Could not copy $_: $!\n";
- }
- print "\n";
- return;
-}
-
-sub CopySolutionOutput
-{
- my $conf =3D shift;
- my $target =3D shift;
- my $rem =3D
- qr{Project\("\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\}"\) =3D "([^"]+)"};
-
- my $sln =3D read_file("pgsql.sln") || croak "Could not open pgsql.sln\n";
-
- my $vcproj =3D 'vcproj';
- if ($sln =3D~
- /Microsoft Visual Studio Solution File, Format Version (\d+)\.\d+/
- && $1 >=3D 11)
- {
- $vcproj =3D 'vcxproj';
- }
-
- print "Copying build output files...";
- while ($sln =3D~ $rem)
- {
- my $pf =3D $1;
-
- # Hash-of-arrays listing where to install things. For each
- # subdirectory there's a hash key, and the value is an array
- # of file extensions to install in that subdirectory. Example:
- # { 'bin' =3D> [ 'dll', 'lib' ],
- # 'lib' =3D> [ 'lib' ] }
- my %install_list;
- my $is_sharedlib =3D 0;
-
- $sln =3D~ s/$rem//;
-
- next
- if ($insttype eq "client" && !grep { $_ eq $pf }
- @client_program_files);
-
- my $proj =3D read_file("$pf.$vcproj")
- || croak "Could not open $pf.$vcproj\n";
-
- # Check if this project uses a shared library by looking if
- # SO_MAJOR_VERSION is defined in its Makefile, whose path
- # can be found using the resource file of this project.
- if (( $vcproj eq 'vcxproj'
- && $proj =3D~ qr{ResourceCompile\s*Include=3D"([^"]+)"})
- || ( $vcproj eq 'vcproj'
- && $proj =3D~ qr{File\s*RelativePath=3D"([^\"]+)\.rc"}))
- {
- my $projpath =3D dirname($1);
- my $mfname =3D
- -e "$projpath/GNUmakefile"
- ? "$projpath/GNUmakefile"
- : "$projpath/Makefile";
- my $mf =3D read_file($mfname) || croak "Could not open $mfname\n";
-
- $is_sharedlib =3D 1 if ($mf =3D~ /^SO_MAJOR_VERSION\s*=3D\s*(.*)$/mg);
- }
-
- if ($vcproj eq 'vcproj' && $proj =3D~ qr{ConfigurationType=3D"([^"]+)"})
- {
- if ($1 =3D=3D 1)
- {
- push(@{ $install_list{'bin'} }, "exe");
- }
- elsif ($1 =3D=3D 2)
- {
- push(@{ $install_list{'lib'} }, "dll");
- if ($is_sharedlib)
- {
- push(@{ $install_list{'bin'} }, "dll");
- push(@{ $install_list{'lib'} }, "lib");
- }
- }
- else
- {
-
- # Static libraries, such as libpgport, only used internally
- # during build, don't install.
- next;
- }
- }
- elsif ($vcproj eq 'vcxproj'
- && $proj =3D~ qr{(\w+)})
- {
- if ($1 eq 'Application')
- {
- push(@{ $install_list{'bin'} }, "exe");
- }
- elsif ($1 eq 'DynamicLibrary')
- {
- push(@{ $install_list{'lib'} }, "dll");
- if ($is_sharedlib)
- {
- push(@{ $install_list{'bin'} }, "dll");
- push(@{ $install_list{'lib'} }, "lib");
- }
- }
- else # 'StaticLibrary'
- {
-
- # Static lib, such as libpgport, only used internally
- # during build, don't install.
- next;
- }
- }
- else
- {
- croak "Could not parse $pf.$vcproj\n";
- }
-
- # Install each element
- foreach my $dir (keys %install_list)
- {
- foreach my $ext (@{ $install_list{$dir} })
- {
- lcopy("$conf\\$pf\\$pf.$ext", "$target\\$dir\\$pf.$ext")
- || croak "Could not copy $pf.$ext\n";
- }
- }
- lcopy("$conf\\$pf\\$pf.pdb", "$target\\symbols\\$pf.pdb")
- || croak "Could not copy $pf.pdb\n";
- print ".";
- }
- print "\n";
- return;
-}
-
-sub GenerateTimezoneFiles
-{
- my $target =3D shift;
- my $conf =3D shift;
- my $mf =3D read_file("src/timezone/Makefile");
- $mf =3D~ s{\\\r?\n}{}g;
-
- $mf =3D~ /^TZDATAFILES\s*:?=3D\s*(.*)$/m
- || die "Could not find TZDATAFILES line in timezone makefile\n";
- my @tzfiles =3D split /\s+/, $1;
-
- print "Generating timezone files...";
-
- my @args =3D ("$conf/zic/zic", '-d', "$target/share/timezone");
- foreach (@tzfiles)
- {
- my $tzfile =3D $_;
- $tzfile =3D~ s|\$\(srcdir\)|src/timezone|;
- push(@args, $tzfile);
- }
-
- system(@args);
- print "\n";
- return;
-}
-
-sub GenerateTsearchFiles
-{
- my $target =3D shift;
-
- print "Generating tsearch script...";
- system(
- 'perl', 'src/backend/snowball/snowball_create.pl',
- '--input', 'src/backend/snowball/',
- '--outdir', "$target/share/");
- print "\n";
- return;
-}
-
-sub CopyContribFiles
-{
- my $config =3D shift;
- my $target =3D shift;
-
- print "Copying contrib data files...";
- foreach my $subdir ('contrib', 'src/test/modules')
- {
- my $D;
- opendir($D, $subdir) || croak "Could not opendir on $subdir!\n";
- while (my $d =3D readdir($D))
- {
- # These configuration-based exclusions must match vcregress.pl
- next if ($d eq "uuid-ossp" && !defined($config->{uuid}));
- next if ($d eq "sslinfo" && !defined($config->{openssl}));
- next if ($d eq "pgcrypto" && !defined($config->{openssl}));
- next if ($d eq "xml2" && !defined($config->{xml}));
- next if ($d =3D~ /_plperl$/ && !defined($config->{perl}));
- next if ($d =3D~ /_plpython$/ && !defined($config->{python}));
- next if ($d eq "sepgsql");
-
- CopySubdirFiles($subdir, $d, $config, $target);
- }
- }
- print "\n";
- return;
-}
-
-sub CopySubdirFiles
-{
- my $subdir =3D shift;
- my $module =3D shift;
- my $config =3D shift;
- my $target =3D shift;
-
- return if ($module =3D~ /^\./);
- return unless (-f "$subdir/$module/Makefile");
- return
- if ($insttype eq "client" && !grep { $_ eq $module } @client_contribs);
-
- my $mf =3D read_file("$subdir/$module/Makefile");
- $mf =3D~ s{\\\r?\n}{}g;
-
- # Note: we currently don't support setting MODULEDIR in the makefile
- my $moduledir =3D 'contrib';
-
- my $flist =3D '';
- if ($mf =3D~ /^EXTENSION\s*=3D\s*(.*)$/m) { $flist .=3D $1 }
- if ($flist ne '')
- {
- $moduledir =3D 'extension';
- $flist =3D ParseAndCleanRule($flist, $mf);
-
- foreach my $f (split /\s+/, $flist)
- {
- lcopy("$subdir/$module/$f.control",
- "$target/share/extension/$f.control")
- || croak("Could not copy file $f.control in contrib $module");
- print '.';
- }
- }
-
- $flist =3D '';
- if ($mf =3D~ /^DATA_built\s*=3D\s*(.*)$/m) { $flist .=3D $1 }
- if ($mf =3D~ /^DATA\s*=3D\s*(.*)$/m) { $flist .=3D " $1" }
- $flist =3D~ s/^\s*//; # Remove leading spaces if we had only DATA_built
-
- if ($flist ne '')
- {
- $flist =3D ParseAndCleanRule($flist, $mf);
-
- foreach my $f (split /\s+/, $flist)
- {
- lcopy("$subdir/$module/$f",
- "$target/share/$moduledir/" . basename($f))
- || croak("Could not copy file $f in contrib $module");
- print '.';
- }
- }
-
- $flist =3D '';
- if ($mf =3D~ /^DATA_TSEARCH\s*=3D\s*(.*)$/m) { $flist .=3D $1 }
- if ($flist ne '')
- {
- $flist =3D ParseAndCleanRule($flist, $mf);
-
- foreach my $f (split /\s+/, $flist)
- {
- lcopy("$subdir/$module/$f",
- "$target/share/tsearch_data/" . basename($f))
- || croak("Could not copy file $f in $subdir $module");
- print '.';
- }
- }
-
- {
- $flist =3D '';
- if ($mf =3D~ /^HEADERS\s*=3D\s*(.*)$/m) { $flist .=3D $1 }
- my @modlist =3D ();
- my %fmodlist =3D ();
- while ($mf =3D~ /^HEADERS_([^\s=3D]+)\s*=3D\s*(.*)$/mg)
- {
- $fmodlist{$1} .=3D $2;
- }
-
- if ($mf =3D~ /^MODULE_big\s*=3D\s*(.*)$/m)
- {
- push @modlist, $1;
- if ($flist ne '')
- {
- $fmodlist{$1} =3D $flist;
- $flist =3D '';
- }
- }
- elsif ($mf =3D~ /^MODULES\s*=3D\s*(.*)$/m)
- {
- push @modlist, split /\s+/, $1;
- }
-
- croak "HEADERS requires MODULE_big in $subdir $module"
- if $flist ne '';
-
- foreach my $mod (keys %fmodlist)
- {
- croak "HEADERS_$mod for unknown module in $subdir $module"
- unless grep { $_ eq $mod } @modlist;
- $flist =3D ParseAndCleanRule($fmodlist{$mod}, $mf);
- EnsureDirectories($target, "include", "include/server",
- "include/server/$moduledir",
- "include/server/$moduledir/$mod");
- foreach my $f (split /\s+/, $flist)
- {
- lcopy("$subdir/$module/$f",
- "$target/include/server/$moduledir/$mod/" . basename($f))
- || croak("Could not copy file $f in $subdir $module");
- print '.';
- }
- }
- }
-
- $flist =3D '';
- if ($mf =3D~ /^DOCS\s*=3D\s*(.*)$/mg) { $flist .=3D $1 }
- if ($flist ne '')
- {
- $flist =3D ParseAndCleanRule($flist, $mf);
-
- # Special case for contrib/spi
- $flist =3D
- "autoinc.example insert_username.example moddatetime.example refint.ex=
ample"
- if ($module eq 'spi');
- foreach my $f (split /\s+/, $flist)
- {
- lcopy("$subdir/$module/$f", "$target/doc/$moduledir/$f")
- || croak("Could not copy file $f in contrib $module");
- print '.';
- }
- }
- return;
-}
-
-sub ParseAndCleanRule
-{
- my $flist =3D shift;
- my $mf =3D shift;
-
- # Strip out $(addsuffix) rules
- if (index($flist, '$(addsuffix ') >=3D 0)
- {
- my $pcount =3D 0;
- my $i;
- for (
- $i =3D index($flist, '$(addsuffix ') + 12;
- $i < length($flist);
- $i++)
- {
- $pcount++ if (substr($flist, $i, 1) eq '(');
- $pcount-- if (substr($flist, $i, 1) eq ')');
- last if ($pcount < 0);
- }
- $flist =3D
- substr($flist, 0, index($flist, '$(addsuffix '))
- . substr($flist, $i + 1);
- }
- return $flist;
-}
-
-sub CopyIncludeFiles
-{
- my $target =3D shift;
-
- EnsureDirectories($target, 'include', 'include/libpq', 'include/internal',
- 'include/internal/libpq', 'include/server', 'include/server/parser');
-
- CopyFiles(
- 'Public headers', $target . '/include/',
- 'src/include/', 'postgres_ext.h',
- 'pg_config.h', 'pg_config_ext.h',
- 'pg_config_os.h', 'pg_config_manual.h');
- lcopy('src/include/libpq/libpq-fs.h', $target . '/include/libpq/')
- || croak 'Could not copy libpq-fs.h';
-
- CopyFiles(
- 'Libpq headers',
- $target . '/include/',
- 'src/interfaces/libpq/', 'libpq-fe.h', 'libpq-events.h');
- CopyFiles(
- 'Libpq internal headers',
- $target . '/include/internal/',
- 'src/interfaces/libpq/', 'libpq-int.h', 'fe-auth-sasl.h',
- 'pqexpbuffer.h');
-
- CopyFiles(
- 'Internal headers',
- $target . '/include/internal/',
- 'src/include/', 'c.h', 'port.h', 'postgres_fe.h');
- lcopy('src/include/libpq/pqcomm.h', $target . '/include/internal/libpq/')
- || croak 'Could not copy pqcomm.h';
- lcopy('src/include/libpq/protocol.h', $target . '/include/internal/libpq/=
')
- || croak 'Could not copy protocol.h';
-
- CopyFiles(
- 'Server headers',
- $target . '/include/server/',
- 'src/include/', 'pg_config.h', 'pg_config_ext.h', 'pg_config_os.h');
- CopySetOfFiles(
- '',
- [ glob("src\\include\\*.h") ],
- $target . '/include/server/');
- my $D;
- opendir($D, 'src/include') || croak "Could not opendir on src/include!\n";
-
- CopyFiles(
- 'PL/pgSQL header',
- $target . '/include/server/',
- 'src/pl/plpgsql/src/', 'plpgsql.h');
-
- # some xcopy progs don't like mixed slash style paths
- (my $ctarget =3D $target) =3D~ s!/!\\!g;
- while (my $d =3D readdir($D))
- {
- next if ($d =3D~ /^\./);
- next if ($d eq '.git');
- next if ($d eq 'CVS');
- next unless (-d "src/include/$d");
-
- EnsureDirectories("$target/include/server/$d");
- my @args =3D (
- 'xcopy', '/s', '/i', '/q', '/r', '/y', "src\\include\\$d\\*.h",
- "$ctarget\\include\\server\\$d\\");
- system(@args) && croak("Failed to copy include directory $d\n");
- }
- closedir($D);
-
- my $mf =3D read_file('src/interfaces/ecpg/include/Makefile');
- $mf =3D~ s{\\\r?\n}{}g;
- $mf =3D~ /^ecpg_headers\s*=3D\s*(.*)$/m
- || croak "Could not find ecpg_headers line\n";
- CopyFiles(
- 'ECPG headers',
- $target . '/include/',
- 'src/interfaces/ecpg/include/',
- 'ecpg_config.h', split /\s+/, $1);
- $mf =3D~ /^informix_headers\s*=3D\s*(.*)$/m
- || croak "Could not find informix_headers line\n";
- EnsureDirectories($target . '/include', 'informix', 'informix/esql');
- CopyFiles(
- 'ECPG informix headers',
- $target . '/include/informix/esql/',
- 'src/interfaces/ecpg/include/',
- split /\s+/, $1);
- return;
-}
-
-sub GenerateNLSFiles
-{
- my $target =3D shift;
- my $nlspath =3D shift;
- my $majorver =3D shift;
-
- print "Installing NLS files...";
- EnsureDirectories($target, "share/locale");
- my @flist;
- File::Find::find(
- {
- wanted =3D> sub {
- /^nls\.mk\z/s
- && !push(@flist, $File::Find::name);
- }
- },
- "src");
- foreach (@flist)
- {
- my $prgm =3D DetermineCatalogName($_);
- s/nls.mk/po/;
- my $dir =3D $_;
- next unless ($dir =3D~ /([^\/]+)\/po$/);
- foreach (glob("$dir/*.po"))
- {
- my $lang;
- next unless /([^\/]+)\.po/;
- $lang =3D $1;
-
- EnsureDirectories($target, "share/locale/$lang",
- "share/locale/$lang/LC_MESSAGES");
- my @args =3D (
- "$nlspath\\bin\\msgfmt",
- '-o',
- "$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo",
- $_);
- system(@args) && croak("Could not run msgfmt on $dir\\$_");
- print ".";
- }
- }
- print "\n";
- return;
-}
-
-sub DetermineMajorVersion
-{
- my $f =3D read_file('src/include/pg_config.h')
- || croak 'Could not open pg_config.h';
- $f =3D~ /^#define\s+PG_MAJORVERSION\s+"([^"]+)"/m
- || croak 'Could not determine major version';
- return $1;
-}
-
-sub DetermineCatalogName
-{
- my $filename =3D shift;
-
- my $f =3D read_file($filename) || croak "Could not open $filename";
- $f =3D~ /CATALOG_NAME\s*\:?=3D\s*(\S+)/m
- || croak "Could not determine catalog name in $filename";
- return $1;
-}
-
-sub read_file
-{
- my $filename =3D shift;
- my $F;
- local $/ =3D undef;
- open($F, '<', $filename) || die "Could not open file $filename\n";
- my $txt =3D <$F>;
- close($F);
-
- return $txt;
-}
-
-1;
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProje=
ct.pm
deleted file mode 100644
index 62fec1fee5..0000000000
--- a/src/tools/msvc/MSBuildProject.pm
+++ /dev/null
@@ -1,508 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package MSBuildProject;
-
-#
-# Package that encapsulates a MSBuild project file (Visual C++ 2015 or gre=
ater)
-#
-# src/tools/msvc/MSBuildProject.pm
-#
-
-use Carp;
-use strict;
-use warnings;
-use base qw(Project);
-
-no warnings qw(redefine); ## no critic
-
-sub _new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{filenameExtension} =3D '.vcxproj';
- $self->{ToolsVersion} =3D '4.0';
-
- return $self;
-}
-
-sub WriteHeader
-{
- my ($self, $f) =3D @_;
-
- print $f <
-{ToolsVersion}" x=
mlns=3D"http://schemas.microsoft.com/developer/msbuild/2003">
-
-EOF
- $self->WriteConfigurationHeader($f, 'Debug');
- $self->WriteConfigurationHeader($f, 'Release');
- print $f <
-
- $self->{guid}
-EOF
- # Check whether WindowsSDKVersion env variable is present.
- # Add WindowsTargetPlatformVersion node if so.
- my $sdkVersion =3D $ENV{'WindowsSDKVersion'};
- if (defined($sdkVersion))
- {
- # remove trailing backslash if necessary.
- $sdkVersion =3D~ s/\\$//;
- print $f <$sdkVersion
-EOF
- }
- print $f <
-
-EOF
- $self->WriteConfigurationPropertyGroup($f, 'Release',
- { wholeopt =3D> 'false' });
- $self->WriteConfigurationPropertyGroup($f, 'Debug',
- { wholeopt =3D> 'false' });
- print $f <
-
-
-EOF
- $self->WritePropertySheetsPropertyGroup($f, 'Release');
- $self->WritePropertySheetsPropertyGroup($f, 'Debug');
- print $f <
-
- <_ProjectFileVersion>10.0.30319.1
-EOF
- $self->WriteAdditionalProperties($f, 'Debug');
- $self->WriteAdditionalProperties($f, 'Release');
- print $f <
-EOF
-
- $self->WriteItemDefinitionGroup(
- $f, 'Debug',
- {
- defs =3D> "_DEBUG;DEBUG=3D1",
- opt =3D> 'Disabled',
- strpool =3D> 'false',
- runtime =3D> 'MultiThreadedDebugDLL'
- });
- $self->WriteItemDefinitionGroup(
- $f,
- 'Release',
- {
- defs =3D> "",
- opt =3D> 'Full',
- strpool =3D> 'true',
- runtime =3D> 'MultiThreadedDLL'
- });
- return;
-}
-
-sub AddDefine
-{
- my ($self, $def) =3D @_;
-
- $self->{defines} .=3D $def . ';';
- return;
-}
-
-sub WriteReferences
-{
- my ($self, $f) =3D @_;
-
- my @references =3D @{ $self->{references} };
-
- if (scalar(@references))
- {
- print $f <
-EOF
- foreach my $ref (@references)
- {
- print $f <{name}$ref->{filenameExtension}">
- $ref->{guid}
-
-EOF
- }
- print $f <
-EOF
- }
- return;
-}
-
-sub WriteFiles
-{
- my ($self, $f) =3D @_;
- print $f <
-EOF
- my @grammarFiles =3D ();
- my @resourceFiles =3D ();
- my %uniquefiles;
- foreach my $fileNameWithPath (sort keys %{ $self->{files} })
- {
- confess "Bad format filename '$fileNameWithPath'\n"
- unless ($fileNameWithPath =3D~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!);
- my $dir =3D $1;
- my $fileName =3D $2;
- if ($fileNameWithPath =3D~ /\.y$/ or $fileNameWithPath =3D~ /\.l$/)
- {
- push @grammarFiles, $fileNameWithPath;
- }
- elsif ($fileNameWithPath =3D~ /\.rc$/)
- {
- push @resourceFiles, $fileNameWithPath;
- }
- elsif (defined($uniquefiles{$fileName}))
- {
-
- # File already exists, so fake a new name
- my $obj =3D $dir;
- $obj =3D~ s!/!_!g;
-
- print $f <
- {platform}'">.\\debug\\$self->{name}\\${obj}_$fileName.obj
- {platform}'">.\\release\\$self->{name}\\${obj}_$fileName.obj=
-
-EOF
- }
- else
- {
- $uniquefiles{$fileName} =3D 1;
- print $f <
-EOF
- }
-
- }
- print $f <
-EOF
- if (scalar(@grammarFiles))
- {
- print $f <
-EOF
- foreach my $grammarFile (@grammarFiles)
- {
- (my $outputFile =3D $grammarFile) =3D~ s/\.(y|l)$/.c/;
- if ($grammarFile =3D~ /\.y$/)
- {
- $outputFile =3D~
- s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
- print $f <
- {platform}'">Running bison on $grammarFile
- {platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"
- {platform}'">%(AdditionalInputs)
- {platform}'">$outputFile;%(Outputs)
- {platform}'">Running bison on $grammarFile
- {platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"
- {platform}'">%(AdditionalInputs)
- {platform}'">$outputFile;%(Outputs)
-
-EOF
- }
- else #if ($grammarFile =3D~ /\.l$/)
- {
- print $f <
- {platform}'">Running flex on $grammarFile
- {platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"
- {platform}'">%(AdditionalInputs)
- {platform}'">$outputFile;%(Outputs)
- {platform}'">Running flex on $grammarFile
- {platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"
- {platform}'">%(AdditionalInputs)
- {platform}'">$outputFile;%(Outputs)
-
-EOF
- }
- }
- print $f <
-EOF
- }
- if (scalar(@resourceFiles))
- {
- print $f <
-EOF
- foreach my $rcFile (@resourceFiles)
- {
- print $f <
-EOF
- }
- print $f <
-EOF
- }
- return;
-}
-
-sub WriteConfigurationHeader
-{
- my ($self, $f, $cfgname) =3D @_;
- print $f <{platform}">
- $cfgname
- $self->{platform}
-
-EOF
- return;
-}
-
-sub WriteConfigurationPropertyGroup
-{
- my ($self, $f, $cfgname, $p) =3D @_;
- my $cfgtype =3D
- ($self->{type} eq "exe")
- ? 'Application'
- : ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary');
-
- print $f <{platform}'" Label=3D"Configuration">
- $cfgtype
- false
- MultiByte
- $p->{wholeopt}
- $self->{PlatformToolset}
-
-EOF
- return;
-}
-
-sub WritePropertySheetsPropertyGroup
-{
- my ($self, $f, $cfgname) =3D @_;
- print $f <{platform}'" Label=3D"PropertySheets">
-
-
-EOF
- return;
-}
-
-sub WriteAdditionalProperties
-{
- my ($self, $f, $cfgname) =3D @_;
- print $f <{platform}'">.\\$cfgname\\$self->{name}\\
- {platform}'">.\\$cfgname\\$self->{name}\\
- {platform}'">false
-EOF
- return;
-}
-
-sub WriteItemDefinitionGroup
-{
- my ($self, $f, $cfgname, $p) =3D @_;
- my $cfgtype =3D
- ($self->{type} eq "exe")
- ? 'Application'
- : ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary');
- my $libs =3D $self->GetAdditionalLinkerDependencies($cfgname, ';');
-
- my $targetmachine =3D
- $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
- my $arch =3D $self->{platform} eq 'Win32' ? 'x86' : 'x86_64';
-
- my $includes =3D join ';', @{ $self->{includes} }, "";
-
- print $f <{platform}'">
-
- $p->{opt}
- $self->{prefixincludes}src/include;src=
/include/port/win32;src/include/port/win32_msvc;$includes\%(AdditionalInclu=
deDirectories)
- WIN32;_WINDOWS;__WINDOWS__;__WIN32__;WIN32_=
STACK_RLIMIT=3D4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$s=
elf->{defines}$p->{defs}\%(PreprocessorDefinitions)
- $p->{strpool}
- $p->{runtime}
- $self->{disablewarnings};\%(DisableSpecific=
Warnings)
- /MP \%(AdditionalOptions)
-
-
- .\\$cfgname\\$self->{name}\\
- .\\$cfgname\\$self->{name}\\
- .\\$cfgname\\$self->{name}\\
- false
- Level3
- true
- ProgramDatabase
- Default
-
-
- .\\$cfgname\\$self->{name}\\$self->{name}.$self->{type}<=
/OutputFile>
- $libs;\%(AdditionalDependencies)
- true
- \%(AdditionalLibraryDirectories)
- libc;\%(IgnoreSpecificDefaultLibrari=
es)
- 4194304
- true
- .\\$cfgname\\$self->{name}\\$self->{name}.pdb=
ProgramDatabaseFile>
- false
- .\\$cfgname\\$self->{name}\\$self->{name}.map
-
-
- Console
- $targetmachine
-EOF
- if ($self->{disablelinkerwarnings})
- {
- print $f
- " /ignore:$self->{disablelinkerwarnings} \%(Ad=
ditionalOptions)\n";
- }
- if ($self->{implib})
- {
- my $l =3D $self->{implib};
- $l =3D~ s/__CFGNAME__/$cfgname/g;
- print $f " $l\n";
- }
- if ($self->{def})
- {
- my $d =3D $self->{def};
- $d =3D~ s/__CFGNAME__/$cfgname/g;
- print $f " $d\n";
- }
- print $f <
-
- src\\include;\%(AdditionalIncludeDirec=
tories)
-
-EOF
- if ($self->{builddef})
- {
- print $f <
- Generate DEF file
- perl src\\tools\\msvc\\gendef.pl --arch $arch --deffile $cf=
gname\\$self->{name}\\$self->{name}.def --tempdir $cfgname\\$self->{name} $=
cfgname\\$self->{name}
-
-EOF
- }
- print $f <
-EOF
- return;
-}
-
-sub Footer
-{
- my ($self, $f) =3D @_;
- $self->WriteReferences($f);
-
- print $f <
-
-
-
-EOF
- return;
-}
-
-package VC2015Project;
-
-#
-# Package that encapsulates a Visual C++ 2015 project file
-#
-
-use strict;
-use warnings;
-use base qw(MSBuildProject);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{vcver} =3D '14.00';
- $self->{PlatformToolset} =3D 'v140';
- $self->{ToolsVersion} =3D '14.0';
-
- return $self;
-}
-
-package VC2017Project;
-
-#
-# Package that encapsulates a Visual C++ 2017 project file
-#
-
-use strict;
-use warnings;
-use base qw(MSBuildProject);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{vcver} =3D '15.00';
- $self->{PlatformToolset} =3D 'v141';
- $self->{ToolsVersion} =3D '15.0';
-
- return $self;
-}
-
-package VC2019Project;
-
-#
-# Package that encapsulates a Visual C++ 2019 project file
-#
-
-use strict;
-use warnings;
-use base qw(MSBuildProject);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{vcver} =3D '16.00';
- $self->{PlatformToolset} =3D 'v142';
- $self->{ToolsVersion} =3D '16.0';
-
- return $self;
-}
-
-package VC2022Project;
-
-#
-# Package that encapsulates a Visual C++ 2022 project file
-#
-
-use strict;
-use warnings;
-use base qw(MSBuildProject);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{vcver} =3D '17.00';
- $self->{PlatformToolset} =3D 'v143';
- $self->{ToolsVersion} =3D '17.0';
-
- return $self;
-}
-
-1;
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
deleted file mode 100644
index db242c9205..0000000000
--- a/src/tools/msvc/Mkvcbuild.pm
+++ /dev/null
@@ -1,1216 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Mkvcbuild;
-
-#
-# Package that generates build files for msvc build
-#
-# src/tools/msvc/Mkvcbuild.pm
-#
-use strict;
-use warnings;
-
-use Carp;
-use if ($^O eq "MSWin32"), 'Win32';
-use Project;
-use Solution;
-use Cwd;
-use File::Copy;
-use Config;
-use VSObjectFactory;
-use List::Util qw(first);
-
-use Exporter;
-our (@ISA, @EXPORT_OK);
-@ISA =3D qw(Exporter);
-@EXPORT_OK =3D qw(Mkvcbuild);
-
-my $solution;
-my $libpgport;
-my $libpgcommon;
-my $libpgfeutils;
-my $postgres;
-my $libpq;
-my @unlink_on_exit;
-
-# Set of variables for modules in contrib/ and src/test/modules/
-my $contrib_defines =3D {};
-my @contrib_uselibpq =3D ();
-my @contrib_uselibpgport =3D ();
-my @contrib_uselibpgcommon =3D ();
-my $contrib_extralibs =3D { 'libpq_pipeline' =3D> ['ws2_32.lib'] };
-my $contrib_extraincludes =3D {};
-my $contrib_extrasource =3D {};
-my @contrib_excludes =3D (
- 'bool_plperl', 'commit_ts',
- 'hstore_plperl', 'hstore_plpython',
- 'intagg', 'jsonb_plperl',
- 'jsonb_plpython', 'ltree_plpython',
- 'sepgsql', 'brin',
- 'test_extensions', 'test_misc',
- 'test_pg_dump', 'snapshot_too_old',
- 'unsafe_tests');
-
-# Set of variables for frontend modules
-my $frontend_defines =3D { 'pgbench' =3D> 'FD_SETSIZE=3D1024' };
-my @frontend_uselibpq =3D
- ('pg_amcheck', 'pg_ctl', 'pg_upgrade', 'pgbench', 'psql', 'initdb');
-my @frontend_uselibpgport =3D (
- 'pg_amcheck', 'pg_archivecleanup',
- 'pg_test_fsync', 'pg_test_timing',
- 'pg_upgrade', 'pg_waldump',
- 'pgbench');
-my @frontend_uselibpgcommon =3D (
- 'pg_amcheck', 'pg_archivecleanup',
- 'pg_test_fsync', 'pg_test_timing',
- 'pg_upgrade', 'pg_waldump',
- 'pgbench');
-my $frontend_extralibs =3D {
- 'initdb' =3D> ['ws2_32.lib'],
- 'pg_amcheck' =3D> ['ws2_32.lib'],
- 'pg_restore' =3D> ['ws2_32.lib'],
- 'pgbench' =3D> ['ws2_32.lib'],
- 'psql' =3D> ['ws2_32.lib']
-};
-my $frontend_extraincludes =3D {
- 'initdb' =3D> ['src/timezone'],
- 'psql' =3D> ['src/backend']
-};
-my $frontend_extrasource =3D {
- 'psql' =3D> ['src/bin/psql/psqlscanslash.l'],
- 'pgbench' =3D>
- [ 'src/bin/pgbench/exprscan.l', 'src/bin/pgbench/exprparse.y' ]
-};
-my @frontend_excludes =3D (
- 'pgevent', 'pg_basebackup', 'pg_rewind', 'pg_dump',
- 'pg_waldump', 'scripts');
-
-sub mkvcbuild
-{
- our $config =3D shift;
-
- chdir('../../..') if (-d '../msvc' && -d '../../../src');
- die 'Must run from root or msvc directory'
- unless (-d 'src/tools/msvc' && -d 'src');
-
- my $vsVersion =3D DetermineVisualStudioVersion();
-
- $solution =3D CreateSolution($vsVersion, $config);
-
- our @pgportfiles =3D qw(
- chklocale.c explicit_bzero.c
- getpeereid.c inet_aton.c
- inet_net_ntop.c kill.c open.c
- snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
- dirent.c getopt.c getopt_long.c
- preadv.c pwritev.c pg_bitutils.c
- pg_strong_random.c pgcheckdir.c pgmkdirp.c pgsleep.c pgstrcasecmp.c
- pqsignal.c mkdtemp.c qsort.c qsort_arg.c bsearch_arg.c quotes.c system.c
- strerror.c tar.c
- win32common.c
- win32dlopen.c
- win32env.c win32error.c
- win32fdatasync.c
- win32fseek.c
- win32getrusage.c
- win32gettimeofday.c
- win32link.c
- win32pread.c
- win32pwrite.c
- win32ntdll.c
- win32security.c win32setlocale.c win32stat.c);
-
- push(@pgportfiles, 'strtof.c') if ($vsVersion < '14.00');
-
- if ($vsVersion >=3D '9.00')
- {
- push(@pgportfiles, 'pg_crc32c_sse42_choose.c');
- push(@pgportfiles, 'pg_crc32c_sse42.c');
- push(@pgportfiles, 'pg_crc32c_sb8.c');
- }
- else
- {
- push(@pgportfiles, 'pg_crc32c_sb8.c');
- }
-
- our @pgcommonallfiles =3D qw(
- archive.c base64.c binaryheap.c checksum_helper.c compression.c
- config_info.c controldata_utils.c d2s.c encnames.c exec.c
- f2s.c file_perm.c file_utils.c hashfn.c ip.c jsonapi.c
- keywords.c kwlookup.c link-canary.c md5_common.c percentrepl.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 ($solution->{options}->{openssl})
- {
- push(@pgcommonallfiles, 'cryptohash_openssl.c');
- push(@pgcommonallfiles, 'hmac_openssl.c');
- push(@pgcommonallfiles, 'protocol_openssl.c');
- }
- else
- {
- push(@pgcommonallfiles, 'cryptohash.c');
- push(@pgcommonallfiles, 'hmac.c');
- push(@pgcommonallfiles, 'md5.c');
- push(@pgcommonallfiles, 'sha1.c');
- push(@pgcommonallfiles, 'sha2.c');
- }
-
- our @pgcommonfrontendfiles =3D (
- @pgcommonallfiles, qw(fe_memutils.c
- logging.c restricted_token.c sprompt.c));
-
- our @pgcommonbkndfiles =3D @pgcommonallfiles;
-
- our @pgfeutilsfiles =3D qw(
- archive.c cancel.c conditional.c connect_utils.c mbprint.c option_utils=
=2Ec
- parallel_slot.c print.c psqlscan.l psqlscan.c query_utils.c simple_list=
=2Ec
- string_utils.c recovery_gen.c);
-
- $libpgport =3D $solution->AddProject('libpgport', 'lib', 'misc');
- $libpgport->AddDefine('FRONTEND');
- $libpgport->AddFiles('src/port', @pgportfiles);
-
- $libpgcommon =3D $solution->AddProject('libpgcommon', 'lib', 'misc');
- $libpgcommon->AddDefine('FRONTEND');
- $libpgcommon->AddFiles('src/common', @pgcommonfrontendfiles);
-
- $libpgfeutils =3D $solution->AddProject('libpgfeutils', 'lib', 'misc');
- $libpgfeutils->AddDefine('FRONTEND');
- $libpgfeutils->AddDefine('FD_SETSIZE=3D1024');
- $libpgfeutils->AddIncludeDir('src/interfaces/libpq');
- $libpgfeutils->AddFiles('src/fe_utils', @pgfeutilsfiles);
-
- $postgres =3D $solution->AddProject('postgres', 'exe', '', 'src/backend');
- $postgres->AddIncludeDir('src/backend');
- $postgres->AddDir('src/backend/port/win32');
- $postgres->AddFile('src/backend/utils/fmgrtab.c');
- $postgres->ReplaceFile('src/backend/port/pg_sema.c',
- 'src/backend/port/win32_sema.c');
- $postgres->ReplaceFile('src/backend/port/pg_shmem.c',
- 'src/backend/port/win32_shmem.c');
- $postgres->AddFiles('src/port', @pgportfiles);
- $postgres->AddFiles('src/common', @pgcommonbkndfiles);
- $postgres->AddDir('src/timezone');
-
- # We need source files from src/timezone, but that directory's resource
- # file pertains to "zic", not to the backend.
- $postgres->RemoveFile('src/timezone/win32ver.rc');
- $postgres->AddFiles('src/backend/parser', 'scan.l', 'gram.y');
- $postgres->AddFiles('src/backend/bootstrap', 'bootscanner.l',
- 'bootparse.y');
- $postgres->AddFiles('src/backend/utils/misc', 'guc-file.l');
- $postgres->AddFiles(
- 'src/backend/replication', 'repl_scanner.l',
- 'repl_gram.y', 'syncrep_scanner.l',
- 'syncrep_gram.y');
- $postgres->AddFiles('src/backend/utils/adt', 'jsonpath_scan.l',
- 'jsonpath_gram.y');
- $postgres->AddDefine('BUILDING_DLL');
- $postgres->AddLibrary('secur32.lib');
- $postgres->AddLibrary('ws2_32.lib');
- $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
- $postgres->FullExportDLL('postgres.lib');
-
- # The OBJS scraper doesn't know about ifdefs, so remove appropriate files
- # if building without OpenSSL.
- if (!$solution->{options}->{openssl})
- {
- $postgres->RemoveFile('src/backend/libpq/be-secure-common.c');
- $postgres->RemoveFile('src/backend/libpq/be-secure-openssl.c');
- }
- if (!$solution->{options}->{gss})
- {
- $postgres->RemoveFile('src/backend/libpq/be-gssapi-common.c');
- $postgres->RemoveFile('src/backend/libpq/be-secure-gssapi.c');
- }
-
- my $snowball =3D $solution->AddProject('dict_snowball', 'dll', '',
- 'src/backend/snowball');
-
- # This Makefile uses VPATH to find most source files in a subdirectory.
- $snowball->RelocateFiles(
- 'src/backend/snowball/libstemmer',
- sub {
- return shift !~ /(dict_snowball.c|win32ver.rc)$/;
- });
- $snowball->AddIncludeDir('src/include/snowball');
- $snowball->AddReference($postgres);
-
- my $plpgsql =3D
- $solution->AddProject('plpgsql', 'dll', 'PLs', 'src/pl/plpgsql/src');
- $plpgsql->AddFiles('src/pl/plpgsql/src', 'pl_gram.y');
- $plpgsql->AddReference($postgres);
-
- if ($solution->{options}->{tcl})
- {
- my $found =3D 0;
- my $pltcl =3D
- $solution->AddProject('pltcl', 'dll', 'PLs', 'src/pl/tcl');
- $pltcl->AddIncludeDir($solution->{options}->{tcl} . '/include');
- $pltcl->AddReference($postgres);
-
- for my $tclver (qw(86t 86 85 84))
- {
- my $tcllib =3D $solution->{options}->{tcl} . "/lib/tcl$tclver.lib";
- if (-e $tcllib)
- {
- $pltcl->AddLibrary($tcllib);
- $found =3D 1;
- last;
- }
- }
- die "Unable to find $solution->{options}->{tcl}/lib/tcl.lib"
- unless $found;
- }
-
- $libpq =3D $solution->AddProject('libpq', 'dll', 'interfaces',
- 'src/interfaces/libpq');
- $libpq->AddIncludeDir('src/port');
- $libpq->AddLibrary('secur32.lib');
- $libpq->AddLibrary('ws2_32.lib');
- $libpq->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
- $libpq->UseDef('src/interfaces/libpq/libpqdll.def');
- $libpq->AddReference($libpgcommon, $libpgport);
-
- # The OBJS scraper doesn't know about ifdefs, so remove appropriate files
- # if building without OpenSSL.
- if (!$solution->{options}->{openssl})
- {
- $libpq->RemoveFile('src/interfaces/libpq/fe-secure-common.c');
- $libpq->RemoveFile('src/interfaces/libpq/fe-secure-openssl.c');
- }
- if (!$solution->{options}->{gss})
- {
- $libpq->RemoveFile('src/interfaces/libpq/fe-gssapi-common.c');
- $libpq->RemoveFile('src/interfaces/libpq/fe-secure-gssapi.c');
- }
-
- my $libpqwalreceiver =3D
- $solution->AddProject('libpqwalreceiver', 'dll', '',
- 'src/backend/replication/libpqwalreceiver');
- $libpqwalreceiver->AddIncludeDir('src/interfaces/libpq');
- $libpqwalreceiver->AddReference($postgres, $libpq);
-
- my $libpq_testclient =3D
- $solution->AddProject('libpq_testclient', 'exe', 'misc',
- 'src/interfaces/libpq/test');
- $libpq_testclient->AddFile(
- 'src/interfaces/libpq/test/libpq_testclient.c');
- $libpq_testclient->AddIncludeDir('src/interfaces/libpq');
- $libpq_testclient->AddReference($libpgport, $libpq);
- $libpq_testclient->AddLibrary('ws2_32.lib');
-
- my $libpq_uri_regress =3D
- $solution->AddProject('libpq_uri_regress', 'exe', 'misc',
- 'src/interfaces/libpq/test');
- $libpq_uri_regress->AddFile(
- 'src/interfaces/libpq/test/libpq_uri_regress.c');
- $libpq_uri_regress->AddIncludeDir('src/interfaces/libpq');
- $libpq_uri_regress->AddReference($libpgport, $libpq);
- $libpq_uri_regress->AddLibrary('ws2_32.lib');
-
- my $pgoutput =3D $solution->AddProject('pgoutput', 'dll', '',
- 'src/backend/replication/pgoutput');
- $pgoutput->AddReference($postgres);
-
- my $pgtypes =3D $solution->AddProject(
- 'libpgtypes', 'dll',
- 'interfaces', 'src/interfaces/ecpg/pgtypeslib');
- $pgtypes->AddReference($libpgcommon, $libpgport);
- $pgtypes->UseDef('src/interfaces/ecpg/pgtypeslib/pgtypeslib.def');
- $pgtypes->AddIncludeDir('src/interfaces/ecpg/include');
-
- my $libecpg =3D $solution->AddProject('libecpg', 'dll', 'interfaces',
- 'src/interfaces/ecpg/ecpglib');
- $libecpg->AddIncludeDir('src/interfaces/ecpg/include');
- $libecpg->AddIncludeDir('src/interfaces/libpq');
- $libecpg->AddIncludeDir('src/port');
- $libecpg->UseDef('src/interfaces/ecpg/ecpglib/ecpglib.def');
- $libecpg->AddLibrary('ws2_32.lib');
- $libecpg->AddReference($libpq, $pgtypes, $libpgport);
-
- my $libecpgcompat =3D $solution->AddProject(
- 'libecpg_compat', 'dll',
- 'interfaces', 'src/interfaces/ecpg/compatlib');
- $libecpgcompat->AddIncludeDir('src/interfaces/ecpg/include');
- $libecpgcompat->AddIncludeDir('src/interfaces/libpq');
- $libecpgcompat->UseDef('src/interfaces/ecpg/compatlib/compatlib.def');
- $libecpgcompat->AddReference($pgtypes, $libecpg, $libpgport,
- $libpgcommon);
-
- my $ecpg =3D $solution->AddProject('ecpg', 'exe', 'interfaces',
- 'src/interfaces/ecpg/preproc');
- $ecpg->AddIncludeDir('src/interfaces/ecpg/include');
- $ecpg->AddIncludeDir('src/interfaces/ecpg/ecpglib');
- $ecpg->AddIncludeDir('src/interfaces/libpq');
- $ecpg->AddPrefixInclude('src/interfaces/ecpg/preproc');
- $ecpg->AddFiles('src/interfaces/ecpg/preproc', 'pgc.l', 'preproc.y');
- $ecpg->AddReference($libpgcommon, $libpgport);
-
- my $pgregress_ecpg =3D
- $solution->AddProject('pg_regress_ecpg', 'exe', 'misc');
- $pgregress_ecpg->AddFile('src/interfaces/ecpg/test/pg_regress_ecpg.c');
- $pgregress_ecpg->AddFile('src/test/regress/pg_regress.c');
- $pgregress_ecpg->AddIncludeDir('src/port');
- $pgregress_ecpg->AddIncludeDir('src/test/regress');
- $pgregress_ecpg->AddDefine('HOST_TUPLE=3D"i686-pc-win32vc"');
- $pgregress_ecpg->AddLibrary('ws2_32.lib');
- $pgregress_ecpg->AddDirResourceFile('src/interfaces/ecpg/test');
- $pgregress_ecpg->AddReference($libpgcommon, $libpgport);
-
- my $isolation_tester =3D
- $solution->AddProject('isolationtester', 'exe', 'misc');
- $isolation_tester->AddFile('src/test/isolation/isolationtester.c');
- $isolation_tester->AddFile('src/test/isolation/specparse.y');
- $isolation_tester->AddFile('src/test/isolation/specscanner.l');
- $isolation_tester->AddFile('src/test/isolation/specparse.c');
- $isolation_tester->AddFile('src/test/isolation/specscanner.c');
- $isolation_tester->AddIncludeDir('src/test/isolation');
- $isolation_tester->AddIncludeDir('src/port');
- $isolation_tester->AddIncludeDir('src/test/regress');
- $isolation_tester->AddIncludeDir('src/interfaces/libpq');
- $isolation_tester->AddDefine('HOST_TUPLE=3D"i686-pc-win32vc"');
- $isolation_tester->AddLibrary('ws2_32.lib');
- $isolation_tester->AddDirResourceFile('src/test/isolation');
- $isolation_tester->AddReference($libpq, $libpgcommon, $libpgport);
-
- my $pgregress_isolation =3D
- $solution->AddProject('pg_isolation_regress', 'exe', 'misc');
- $pgregress_isolation->AddFile('src/test/isolation/isolation_main.c');
- $pgregress_isolation->AddFile('src/test/regress/pg_regress.c');
- $pgregress_isolation->AddIncludeDir('src/port');
- $pgregress_isolation->AddIncludeDir('src/test/regress');
- $pgregress_isolation->AddDefine('HOST_TUPLE=3D"i686-pc-win32vc"');
- $pgregress_isolation->AddLibrary('ws2_32.lib');
- $pgregress_isolation->AddDirResourceFile('src/test/isolation');
- $pgregress_isolation->AddReference($libpgcommon, $libpgport);
-
- # src/bin
- my $D;
- opendir($D, 'src/bin') || croak "Could not opendir on src/bin!\n";
- while (my $d =3D readdir($D))
- {
- next if ($d =3D~ /^\./);
- next unless (-f "src/bin/$d/Makefile");
- next if (grep { /^$d$/ } @frontend_excludes);
- AddSimpleFrontend($d);
- }
-
- my $pgbasebackup =3D AddSimpleFrontend('pg_basebackup', 1);
- # This list of files has to match BBOBJS in pg_basebackup's Makefile.
- $pgbasebackup->AddFile('src/bin/pg_basebackup/pg_basebackup.c');
- $pgbasebackup->AddFile('src/bin/pg_basebackup/bbstreamer_file.c');
- $pgbasebackup->AddFile('src/bin/pg_basebackup/bbstreamer_gzip.c');
- $pgbasebackup->AddFile('src/bin/pg_basebackup/bbstreamer_inject.c');
- $pgbasebackup->AddFile('src/bin/pg_basebackup/bbstreamer_lz4.c');
- $pgbasebackup->AddFile('src/bin/pg_basebackup/bbstreamer_tar.c');
- $pgbasebackup->AddFile('src/bin/pg_basebackup/bbstreamer_zstd.c');
- $pgbasebackup->AddLibrary('ws2_32.lib');
-
- my $pgreceivewal =3D AddSimpleFrontend('pg_basebackup', 1);
- $pgreceivewal->{name} =3D 'pg_receivewal';
- $pgreceivewal->AddFile('src/bin/pg_basebackup/pg_receivewal.c');
- $pgreceivewal->AddLibrary('ws2_32.lib');
-
- my $pgrecvlogical =3D AddSimpleFrontend('pg_basebackup', 1);
- $pgrecvlogical->{name} =3D 'pg_recvlogical';
- $pgrecvlogical->AddFile('src/bin/pg_basebackup/pg_recvlogical.c');
- $pgrecvlogical->AddLibrary('ws2_32.lib');
-
- my $pgrewind =3D AddSimpleFrontend('pg_rewind', 1);
- $pgrewind->{name} =3D 'pg_rewind';
- $pgrewind->AddFile('src/backend/access/transam/xlogreader.c');
- $pgrewind->AddLibrary('ws2_32.lib');
- $pgrewind->AddDefine('FRONTEND');
-
- my $pgevent =3D $solution->AddProject('pgevent', 'dll', 'bin');
- $pgevent->AddFiles('src/bin/pgevent', 'pgevent.c', 'pgmsgevent.rc');
- $pgevent->AddResourceFile('src/bin/pgevent', 'Eventlog message formatter',
- 'win32');
- $pgevent->UseDef('src/bin/pgevent/pgevent.def');
- $pgevent->DisableLinkerWarnings('4104');
-
- my $pgdump =3D AddSimpleFrontend('pg_dump', 1);
- $pgdump->AddIncludeDir('src/backend');
- $pgdump->AddFile('src/bin/pg_dump/pg_dump.c');
- $pgdump->AddFile('src/bin/pg_dump/common.c');
- $pgdump->AddFile('src/bin/pg_dump/pg_dump_sort.c');
- $pgdump->AddLibrary('ws2_32.lib');
-
- my $pgdumpall =3D AddSimpleFrontend('pg_dump', 1);
-
- # pg_dumpall doesn't use the files in the Makefile's $(OBJS), unlike
- # pg_dump and pg_restore.
- # So remove their sources from the object, keeping the other setup that
- # AddSimpleFrontend() has done.
- my @nodumpall =3D grep { m!src/bin/pg_dump/.*\.c$! }
- keys %{ $pgdumpall->{files} };
- delete @{ $pgdumpall->{files} }{@nodumpall};
- $pgdumpall->{name} =3D 'pg_dumpall';
- $pgdumpall->AddIncludeDir('src/backend');
- $pgdumpall->AddFile('src/bin/pg_dump/pg_dumpall.c');
- $pgdumpall->AddFile('src/bin/pg_dump/dumputils.c');
- $pgdumpall->AddLibrary('ws2_32.lib');
-
- my $pgrestore =3D AddSimpleFrontend('pg_dump', 1);
- $pgrestore->{name} =3D 'pg_restore';
- $pgrestore->AddIncludeDir('src/backend');
- $pgrestore->AddFile('src/bin/pg_dump/pg_restore.c');
- $pgrestore->AddLibrary('ws2_32.lib');
-
- my $zic =3D $solution->AddProject('zic', 'exe', 'utils');
- $zic->AddFiles('src/timezone', 'zic.c');
- $zic->AddDirResourceFile('src/timezone');
- $zic->AddReference($libpgcommon, $libpgport);
-
- if (!$solution->{options}->{xml})
- {
- push @contrib_excludes, 'xml2';
- }
-
- if (!$solution->{options}->{openssl})
- {
- push @contrib_excludes, 'sslinfo', 'ssl_passphrase_callback',
- 'pgcrypto';
- }
-
- if (!$solution->{options}->{ldap})
- {
- push @contrib_excludes, 'ldap_password_func';
- }
-
- if (!$solution->{options}->{uuid})
- {
- push @contrib_excludes, 'uuid-ossp';
- }
-
- foreach my $subdir ('contrib', 'src/test/modules')
- {
- opendir($D, $subdir) || croak "Could not opendir on $subdir!\n";
- while (my $d =3D readdir($D))
- {
- next if ($d =3D~ /^\./);
- next unless (-f "$subdir/$d/Makefile");
- next if (grep { /^$d$/ } @contrib_excludes);
- AddContrib($subdir, $d);
- }
- closedir($D);
- }
-
- # Build Perl and Python modules after contrib/ modules to satisfy some
- # dependencies with transform contrib modules, like hstore_plpython
- # ltree_plpython and hstore_plperl.
- if ($solution->{options}->{python})
- {
-
- # Attempt to get python version and location.
- # Assume python.exe in specified dir.
- my $pythonprog =3D "import sys;print(sys.prefix);"
- . "print(str(sys.version_info[0])+str(sys.version_info[1]))";
- my $prefixcmd =3D
- qq("$solution->{options}->{python}\\python" -c "$pythonprog");
- my $pyout =3D `$prefixcmd`;
- die "Could not query for python version!\n" if $?;
- my ($pyprefix, $pyver) =3D split(/\r?\n/, $pyout);
-
- # Sometimes (always?) if python is not present, the execution
- # appears to work, but gives no data...
- die "Failed to query python for version information\n"
- if (!(defined($pyprefix) && defined($pyver)));
-
- my $pymajorver =3D substr($pyver, 0, 1);
-
- die
- "Python version $pyver is too old (version 3 or later is required)"
- if int($pymajorver) < 3;
-
- my $plpython =3D $solution->AddProject('plpython' . $pymajorver,
- 'dll', 'PLs', 'src/pl/plpython');
- $plpython->AddIncludeDir($pyprefix . '/include');
- $plpython->AddLibrary($pyprefix . "/Libs/python$pyver.lib");
- $plpython->AddReference($postgres);
-
- # Add transform modules dependent on plpython
- my $hstore_plpython =3D AddTransformModule(
- 'hstore_plpython' . $pymajorver, 'contrib/hstore_plpython',
- 'plpython' . $pymajorver, 'src/pl/plpython',
- 'hstore', 'contrib');
- $hstore_plpython->AddDefine(
- 'PLPYTHON_LIBNAME=3D"plpython' . $pymajorver . '"');
- my $jsonb_plpython =3D AddTransformModule(
- 'jsonb_plpython' . $pymajorver, 'contrib/jsonb_plpython',
- 'plpython' . $pymajorver, 'src/pl/plpython');
- $jsonb_plpython->AddDefine(
- 'PLPYTHON_LIBNAME=3D"plpython' . $pymajorver . '"');
- my $ltree_plpython =3D AddTransformModule(
- 'ltree_plpython' . $pymajorver, 'contrib/ltree_plpython',
- 'plpython' . $pymajorver, 'src/pl/plpython',
- 'ltree', 'contrib');
- $ltree_plpython->AddDefine(
- 'PLPYTHON_LIBNAME=3D"plpython' . $pymajorver . '"');
- }
-
- if ($solution->{options}->{perl})
- {
- my $plperlsrc =3D "src/pl/plperl/";
- my $plperl =3D
- $solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl');
- $plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE');
- $plperl->AddReference($postgres);
-
- my $perl_path =3D $solution->{options}->{perl} . '\lib\CORE\*perl*';
-
- # ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a
- # Starting with ActivePerl 5.24, both perlnn.lib and libperlnn.a are pr=
ovided.
- # In this case, prefer .lib.
- my @perl_libs =3D
- reverse sort grep { /perl\d+\.lib$|libperl\d+\.a$/ }
- glob($perl_path);
- if (@perl_libs > 0)
- {
- $plperl->AddLibrary($perl_libs[0]);
- }
- else
- {
- die
- "could not identify perl library version matching pattern $perl_path\=
n";
- }
-
- # Add defines from Perl's ccflags; see PGAC_CHECK_PERL_EMBED_CCFLAGS
- my @perl_embed_ccflags;
- foreach my $f (split(" ", $Config{ccflags}))
- {
- if ($f =3D~ /^-D[^_]/)
- {
- $f =3D~ s/\-D//;
- push(@perl_embed_ccflags, $f);
- }
- }
-
- # hack to prevent duplicate definitions of uid_t/gid_t
- push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID');
- # prevent binary mismatch between MSVC built plperl and
- # Strawberry or msys ucrt perl libraries
- push(@perl_embed_ccflags, 'NO_THREAD_SAFE_LOCALE');
-
- # Windows offers several 32-bit ABIs. Perl is sensitive to
- # sizeof(time_t), one of the ABI dimensions. To get 32-bit time_t,
- # use "cl -D_USE_32BIT_TIME_T" or plain "gcc". For 64-bit time_t, use
- # "gcc -D__MINGW_USE_VC2005_COMPAT" or plain "cl". Before MSVC 2005,
- # plain "cl" chose 32-bit time_t. PostgreSQL doesn't support building
- # with pre-MSVC-2005 compilers, but it does support linking to Perl
- # built with such a compiler. MSVC-built Perl 5.13.4 and later report
- # -D_USE_32BIT_TIME_T in $Config{ccflags} if applicable, but
- # MinGW-built Perl never reports -D_USE_32BIT_TIME_T despite typically
- # needing it. Ignore the $Config{ccflags} opinion about
- # -D_USE_32BIT_TIME_T, and use a runtime test to deduce the ABI Perl
- # expects. Specifically, test use of PL_modglobal, which maps to a
- # PerlInterpreter field whose position depends on sizeof(time_t).
- if ($solution->{platform} eq 'Win32')
- {
- my $source_file =3D 'conftest.c';
- my $obj =3D 'conftest.obj';
- my $exe =3D 'conftest.exe';
- my @conftest =3D ($source_file, $obj, $exe);
- push @unlink_on_exit, @conftest;
- unlink $source_file;
- open my $o, '>', $source_file
- || croak "Could not write to $source_file";
- print $o '
- /* compare to plperl.h */
- #define __inline__ __inline
- #define PERL_NO_GET_CONTEXT
- #include
- #include
-
- int
- main(int argc, char **argv)
- {
- int dummy_argc =3D 1;
- char *dummy_argv[1] =3D {""};
- char *dummy_env[1] =3D {NULL};
- static PerlInterpreter *interp;
-
- PERL_SYS_INIT3(&dummy_argc, (char ***) &dummy_argv,
- (char ***) &dummy_env);
- interp =3D perl_alloc();
- perl_construct(interp);
- {
- dTHX;
- const char key[] =3D "dummy";
-
- PL_exit_flags |=3D PERL_EXIT_DESTRUCT_END;
- hv_store(PL_modglobal, key, sizeof(key) - 1, newSViv(1), 0);
- return hv_fetch(PL_modglobal, key, sizeof(key) - 1, 0) =3D=3D NULL;
- }
- }
-';
- close $o;
-
- # Build $source_file with a given #define, and return a true value
- # if a run of the resulting binary exits successfully.
- my $try_define =3D sub {
- my $define =3D shift;
-
- unlink $obj, $exe;
- my @cmd =3D (
- 'cl',
- '-I' . $solution->{options}->{perl} . '/lib/CORE',
- (map { "-D$_" } @perl_embed_ccflags, $define || ()),
- $source_file,
- '/link',
- $perl_libs[0]);
- my $compile_output =3D `@cmd 2>&1`;
- -f $exe || die "Failed to build Perl test:\n$compile_output";
-
- {
-
- # Some builds exhibit runtime failure through Perl warning
- # 'Can't spawn "conftest.exe"'; suppress that.
- no warnings;
-
- no strict 'subs'; ## no critic (ProhibitNoStrict)
-
- # Disable error dialog boxes like we do in the postmaster.
- # Here, we run code that triggers relevant errors.
- use
- if ($^O eq "MSWin32"), 'Win32API::File',
- qw(SetErrorMode :SEM_);
- my $oldmode =3D SetErrorMode(
- SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
- system(".\\$exe");
- SetErrorMode($oldmode);
- }
-
- return !($? >> 8);
- };
-
- my $define_32bit_time =3D '_USE_32BIT_TIME_T';
- my $ok_now =3D $try_define->(undef);
- my $ok_32bit =3D $try_define->($define_32bit_time);
- unlink @conftest;
- if (!$ok_now && !$ok_32bit)
- {
-
- # Unsupported configuration. Since we used %Config from the
- # Perl running the build scripts, this is expected if
- # attempting to link with some other Perl.
- die "Perl test fails with or without -D$define_32bit_time";
- }
- elsif ($ok_now && $ok_32bit)
- {
-
- # Resulting build may work, but it's especially important to
- # verify with "vcregress plcheck". A refined test may avoid
- # this outcome.
- warn "Perl test passes with or without -D$define_32bit_time";
- }
- elsif ($ok_32bit)
- {
- push(@perl_embed_ccflags, $define_32bit_time);
- } # else $ok_now, hence no flag required
- }
-
- print "CFLAGS recommended by Perl: $Config{ccflags}\n";
- print "CFLAGS to compile embedded Perl: ",
- (join ' ', map { "-D$_" } @perl_embed_ccflags), "\n";
- foreach my $f (@perl_embed_ccflags)
- {
- $plperl->AddDefine($f);
- }
-
- foreach my $xs ('SPI.xs', 'Util.xs')
- {
- (my $xsc =3D $xs) =3D~ s/\.xs/.c/;
- if (Solution::IsNewer("$plperlsrc$xsc", "$plperlsrc$xs"))
- {
- my $xsubppdir =3D first { -e "$_/ExtUtils/xsubpp" } (@INC);
- print "Building $plperlsrc$xsc...\n";
- system( $solution->{options}->{perl}
- . '/bin/perl '
- . "$xsubppdir/ExtUtils/xsubpp -typemap "
- . $solution->{options}->{perl}
- . '/lib/ExtUtils/typemap '
- . "$plperlsrc$xs "
- . ">$plperlsrc$xsc");
- if ((!(-f "$plperlsrc$xsc")) || -z "$plperlsrc$xsc")
- {
- unlink("$plperlsrc$xsc"); # if zero size
- die "Failed to create $xsc.\n";
- }
- }
- }
- if (Solution::IsNewer(
- 'src/pl/plperl/perlchunks.h',
- 'src/pl/plperl/plc_perlboot.pl')
- || Solution::IsNewer(
- 'src/pl/plperl/perlchunks.h',
- 'src/pl/plperl/plc_trusted.pl'))
- {
- print 'Building src/pl/plperl/perlchunks.h ...' . "\n";
- my $basedir =3D getcwd;
- chdir 'src/pl/plperl';
- system( $solution->{options}->{perl}
- . '/bin/perl '
- . 'text2macro.pl '
- . '--strip=3D"^(\#.*|\s*)$$" '
- . 'plc_perlboot.pl plc_trusted.pl '
- . '>perlchunks.h');
- chdir $basedir;
- if ((!(-f 'src/pl/plperl/perlchunks.h'))
- || -z 'src/pl/plperl/perlchunks.h')
- {
- unlink('src/pl/plperl/perlchunks.h'); # if zero size
- die 'Failed to create perlchunks.h' . "\n";
- }
- }
- if (Solution::IsNewer(
- 'src/pl/plperl/plperl_opmask.h',
- 'src/pl/plperl/plperl_opmask.pl'))
- {
- print 'Building src/pl/plperl/plperl_opmask.h ...' . "\n";
- my $basedir =3D getcwd;
- chdir 'src/pl/plperl';
- system( $solution->{options}->{perl}
- . '/bin/perl '
- . 'plperl_opmask.pl '
- . 'plperl_opmask.h');
- chdir $basedir;
- if ((!(-f 'src/pl/plperl/plperl_opmask.h'))
- || -z 'src/pl/plperl/plperl_opmask.h')
- {
- unlink('src/pl/plperl/plperl_opmask.h'); # if zero size
- die 'Failed to create plperl_opmask.h' . "\n";
- }
- }
-
- # Add transform modules dependent on plperl
- my $bool_plperl =3D AddTransformModule(
- 'bool_plperl', 'contrib/bool_plperl',
- 'plperl', 'src/pl/plperl');
- my $hstore_plperl =3D AddTransformModule(
- 'hstore_plperl', 'contrib/hstore_plperl',
- 'plperl', 'src/pl/plperl',
- 'hstore', 'contrib');
- my $jsonb_plperl =3D AddTransformModule(
- 'jsonb_plperl', 'contrib/jsonb_plperl',
- 'plperl', 'src/pl/plperl');
-
- foreach my $f (@perl_embed_ccflags)
- {
- $bool_plperl->AddDefine($f);
- $hstore_plperl->AddDefine($f);
- $jsonb_plperl->AddDefine($f);
- }
- }
-
- my $mf =3D
- Project::read_file('src/backend/utils/mb/conversion_procs/Makefile');
- $mf =3D~ s{\\\r?\n}{}g;
- $mf =3D~ m{SUBDIRS\s*=3D\s*(.*)$}m
- || die 'Could not match in conversion makefile' . "\n";
- foreach my $sub (split /\s+/, $1)
- {
- my $dir =3D 'src/backend/utils/mb/conversion_procs/' . $sub;
- my $p =3D $solution->AddProject($sub, 'dll', 'conversion procs', $dir);
- $p->AddFile("$dir/$sub.c"); # implicit source file
- $p->AddReference($postgres);
- }
-
- $mf =3D Project::read_file('src/bin/scripts/Makefile');
- $mf =3D~ s{\\\r?\n}{}g;
- $mf =3D~ m{PROGRAMS\s*=3D\s*(.*)$}m
- || die 'Could not match in bin/scripts/Makefile' . "\n";
- foreach my $prg (split /\s+/, $1)
- {
- my $proj =3D $solution->AddProject($prg, 'exe', 'bin');
- $mf =3D~ m{$prg\s*:\s*(.*)$}m
- || die 'Could not find script define for $prg' . "\n";
- my @files =3D split /\s+/, $1;
- foreach my $f (@files)
- {
- $f =3D~ s/\.o$/\.c/;
- if ($f =3D~ /\.c$/)
- {
- $proj->AddFile('src/bin/scripts/' . $f);
- }
- }
- $proj->AddIncludeDir('src/interfaces/libpq');
- $proj->AddReference($libpq, $libpgfeutils, $libpgcommon, $libpgport);
- $proj->AddDirResourceFile('src/bin/scripts');
- $proj->AddLibrary('ws2_32.lib');
- }
-
- # Regression DLL and EXE
- my $regress =3D $solution->AddProject('regress', 'dll', 'misc');
- $regress->AddFile('src/test/regress/regress.c');
- $regress->AddDirResourceFile('src/test/regress');
- $regress->AddReference($postgres);
-
- my $pgregress =3D $solution->AddProject('pg_regress', 'exe', 'misc');
- $pgregress->AddFile('src/test/regress/pg_regress.c');
- $pgregress->AddFile('src/test/regress/pg_regress_main.c');
- $pgregress->AddIncludeDir('src/port');
- $pgregress->AddDefine('HOST_TUPLE=3D"i686-pc-win32vc"');
- $pgregress->AddLibrary('ws2_32.lib');
- $pgregress->AddDirResourceFile('src/test/regress');
- $pgregress->AddReference($libpgcommon, $libpgport);
-
- # fix up pg_waldump once it's been set up
- # files symlinked on Unix are copied on windows
- my $pg_waldump =3D AddSimpleFrontend('pg_waldump');
- $pg_waldump->AddDefine('FRONTEND');
- foreach my $xf (glob('src/backend/access/rmgrdesc/*desc*.c'))
- {
- $pg_waldump->AddFile($xf);
- }
- $pg_waldump->AddFile('src/backend/access/transam/xlogreader.c');
-
- $solution->Save();
- return $solution->{vcver};
-}
-
-#####################
-# Utility functions #
-#####################
-
-# Add a simple frontend project (exe)
-sub AddSimpleFrontend
-{
- my $n =3D shift;
- my $uselibpq =3D shift;
-
- my $p =3D $solution->AddProject($n, 'exe', 'bin');
- $p->AddDir('src/bin/' . $n);
- $p->AddReference($libpgfeutils, $libpgcommon, $libpgport);
- if ($uselibpq)
- {
- $p->AddIncludeDir('src/interfaces/libpq');
- $p->AddReference($libpq);
- }
-
- # Adjust module definition using frontend variables
- AdjustFrontendProj($p);
-
- return $p;
-}
-
-# Add a simple transform module
-sub AddTransformModule
-{
- my $n =3D shift;
- my $n_src =3D shift;
- my $pl_proj_name =3D shift;
- my $pl_src =3D shift;
- my $type_name =3D shift;
- my $type_src =3D shift;
-
- my $type_proj =3D undef;
- if ($type_name)
- {
- foreach my $proj (@{ $solution->{projects}->{'contrib'} })
- {
- if ($proj->{name} eq $type_name)
- {
- $type_proj =3D $proj;
- last;
- }
- }
- die "could not find base module $type_name for transform module $n"
- if (!defined($type_proj));
- }
-
- my $pl_proj =3D undef;
- foreach my $proj (@{ $solution->{projects}->{'PLs'} })
- {
- if ($proj->{name} eq $pl_proj_name)
- {
- $pl_proj =3D $proj;
- last;
- }
- }
- die "could not find PL $pl_proj_name for transform module $n"
- if (!defined($pl_proj));
-
- my $p =3D $solution->AddProject($n, 'dll', 'contrib', $n_src);
- for my $file (glob("$n_src/*.c"))
- {
- $p->AddFile($file);
- }
- $p->AddReference($postgres);
-
- # Add PL dependencies
- $p->AddIncludeDir($pl_src);
- $p->AddReference($pl_proj);
- $p->AddIncludeDir($_) for @{ $pl_proj->{includes} };
- foreach my $pl_lib (@{ $pl_proj->{libraries} })
- {
- $p->AddLibrary($pl_lib);
- }
-
- # Add base module dependencies
- if ($type_proj)
- {
- $p->AddIncludeDir($type_src);
- $p->AddIncludeDir($_) for @{ $type_proj->{includes} };
- foreach my $type_lib (@{ $type_proj->{libraries} })
- {
- $p->AddLibrary($type_lib);
- }
- $p->AddReference($type_proj);
- }
-
- return $p;
-}
-
-# Add a simple contrib project
-sub AddContrib
-{
- my $subdir =3D shift;
- my $n =3D shift;
- my $mf =3D Project::read_file("$subdir/$n/Makefile");
- my @projects =3D ();
-
- if ($mf =3D~ /^MODULE_big\s*=3D\s*(.*)$/mg)
- {
- my $dn =3D $1;
- my $proj =3D $solution->AddProject($dn, 'dll', 'contrib', "$subdir/$n");
- $proj->AddReference($postgres);
- AdjustContribProj($proj);
- push @projects, $proj;
- }
- elsif ($mf =3D~ /^MODULES\s*=3D\s*(.*)$/mg)
- {
- foreach my $mod (split /\s+/, $1)
- {
- my $proj =3D
- $solution->AddProject($mod, 'dll', 'contrib', "$subdir/$n");
- my $filename =3D $mod . '.c';
- $proj->AddFile("$subdir/$n/$filename");
- $proj->AddReference($postgres);
- AdjustContribProj($proj);
- push @projects, $proj;
- }
- }
- elsif ($mf =3D~ /^PROGRAM\s*=3D\s*(.*)$/mg)
- {
- my $proj =3D $solution->AddProject($1, 'exe', 'contrib', "$subdir/$n");
- AdjustContribProj($proj);
- push @projects, $proj;
- }
- else
- {
- croak "Could not determine contrib module type for $n\n";
- }
-
- # Process custom compiler flags
- if ( $mf =3D~ /^PG_CPPFLAGS\s*=3D\s*(.*)$/mg
- || $mf =3D~ /^override\s*CPPFLAGS\s*[+:]?=3D\s*(.*)$/mg)
- {
- foreach my $flag (split /\s+/, $1)
- {
- if ($flag =3D~ /^-D(.*)$/)
- {
- foreach my $proj (@projects)
- {
- $proj->AddDefine($1);
- }
- }
- elsif ($flag =3D~ /^-I(.*)$/)
- {
- if ($1 eq '$(libpq_srcdir)')
- {
- foreach my $proj (@projects)
- {
- $proj->AddIncludeDir('src/interfaces/libpq');
- $proj->AddReference($libpq);
- }
- }
- }
- }
- }
-
- if ($mf =3D~ /^SHLIB_LINK_INTERNAL\s*[+:]?=3D\s*(.*)$/mg)
- {
- foreach my $lib (split /\s+/, $1)
- {
- if ($lib eq '$(libpq)')
- {
- foreach my $proj (@projects)
- {
- $proj->AddIncludeDir('src/interfaces/libpq');
- $proj->AddReference($libpq);
- }
- }
- }
- }
-
- if ($mf =3D~ /^PG_LIBS_INTERNAL\s*[+:]?=3D\s*(.*)$/mg)
- {
- foreach my $lib (split /\s+/, $1)
- {
- if ($lib eq '$(libpq_pgport)')
- {
- foreach my $proj (@projects)
- {
- $proj->AddReference($libpgport);
- $proj->AddReference($libpgcommon);
- }
- }
- }
- }
-
- foreach my $line (split /\n/, $mf)
- {
- if ($line =3D~ /^[A-Za-z0-9_]*\.o:\s(.*)/)
- {
- foreach my $file (split /\s+/, $1)
- {
- foreach my $proj (@projects)
- {
- $proj->AddDependantFiles("$subdir/$n/$file");
- }
- }
- }
- }
-
- # Are there any output data files to build?
- GenerateContribSqlFiles($n, $mf);
- return;
-}
-
-sub GenerateContribSqlFiles
-{
- my $n =3D shift;
- my $mf =3D shift;
- $mf =3D~ s{\\\r?\n}{}g;
- if ($mf =3D~ /^DATA_built\s*=3D\s*(.*)$/mg)
- {
- my $l =3D $1;
-
- # Strip out $(addsuffix) rules
- if (index($l, '$(addsuffix ') >=3D 0)
- {
- my $pcount =3D 0;
- my $i;
- for ($i =3D index($l, '$(addsuffix ') + 12; $i < length($l); $i++)
- {
- $pcount++ if (substr($l, $i, 1) eq '(');
- $pcount-- if (substr($l, $i, 1) eq ')');
- last if ($pcount < 0);
- }
- $l =3D
- substr($l, 0, index($l, '$(addsuffix ')) . substr($l, $i + 1);
- }
-
- foreach my $d (split /\s+/, $l)
- {
- my $in =3D "$d.in";
- my $out =3D "$d";
-
- if (Solution::IsNewer("contrib/$n/$out", "contrib/$n/$in"))
- {
- print "Building $out from $in (contrib/$n)...\n";
- my $cont =3D Project::read_file("contrib/$n/$in");
- my $dn =3D $out;
- $dn =3D~ s/\.sql$//;
- $cont =3D~ s/MODULE_PATHNAME/\$libdir\/$dn/g;
- my $o;
- open($o, '>', "contrib/$n/$out")
- || croak "Could not write to contrib/$n/$d";
- print $o $cont;
- close($o);
- }
- }
- }
- return;
-}
-
-sub AdjustContribProj
-{
- my $proj =3D shift;
- AdjustModule(
- $proj, $contrib_defines,
- \@contrib_uselibpq, \@contrib_uselibpgport,
- \@contrib_uselibpgcommon, $contrib_extralibs,
- $contrib_extrasource, $contrib_extraincludes);
- return;
-}
-
-sub AdjustFrontendProj
-{
- my $proj =3D shift;
- AdjustModule(
- $proj, $frontend_defines,
- \@frontend_uselibpq, \@frontend_uselibpgport,
- \@frontend_uselibpgcommon, $frontend_extralibs,
- $frontend_extrasource, $frontend_extraincludes);
- return;
-}
-
-sub AdjustModule
-{
- my $proj =3D shift;
- my $module_defines =3D shift;
- my $module_uselibpq =3D shift;
- my $module_uselibpgport =3D shift;
- my $module_uselibpgcommon =3D shift;
- my $module_extralibs =3D shift;
- my $module_extrasource =3D shift;
- my $module_extraincludes =3D shift;
- my $n =3D $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');
- $proj->AddReference($libpq);
- }
- if (grep { /^$n$/ } @{$module_uselibpgport})
- {
- $proj->AddReference($libpgport);
- }
- if (grep { /^$n$/ } @{$module_uselibpgcommon})
- {
- $proj->AddReference($libpgcommon);
- }
- if ($module_extralibs->{$n})
- {
- foreach my $l (@{ $module_extralibs->{$n} })
- {
- $proj->AddLibrary($l);
- }
- }
- if ($module_extraincludes->{$n})
- {
- foreach my $i (@{ $module_extraincludes->{$n} })
- {
- $proj->AddIncludeDir($i);
- }
- }
- if ($module_extrasource->{$n})
- {
- foreach my $i (@{ $module_extrasource->{$n} })
- {
- print "Files $i\n";
- $proj->AddFile($i);
- }
- }
- return;
-}
-
-END
-{
- unlink @unlink_on_exit;
-}
-
-1;
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
deleted file mode 100644
index 0507ad08c5..0000000000
--- a/src/tools/msvc/Project.pm
+++ /dev/null
@@ -1,482 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Project;
-
-#
-# Package that encapsulates a Visual C++ project file generation
-#
-# src/tools/msvc/Project.pm
-#
-use Carp;
-use strict;
-use warnings;
-use File::Basename;
-
-sub _new
-{
- my ($classname, $name, $type, $solution) =3D @_;
- my $good_types =3D {
- lib =3D> 1,
- exe =3D> 1,
- dll =3D> 1,
- };
- confess("Bad project type: $type\n") unless exists $good_types->{$type};
- my $self =3D {
- name =3D> $name,
- type =3D> $type,
- guid =3D> $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE',
- files =3D> {},
- references =3D> [],
- libraries =3D> [],
- suffixlib =3D> [],
- includes =3D> [],
- prefixincludes =3D> '',
- defines =3D> ';',
- solution =3D> $solution,
- disablewarnings =3D> '4018;4244;4273;4101;4102;4090;4267',
- disablelinkerwarnings =3D> '',
- platform =3D> $solution->{platform},
- };
-
- bless($self, $classname);
- return $self;
-}
-
-sub AddFile
-{
- my ($self, $filename) =3D @_;
-
- $self->FindAndAddAdditionalFiles($filename);
- $self->{files}->{$filename} =3D 1;
- return;
-}
-
-sub AddDependantFiles
-{
- my ($self, $filename) =3D @_;
-
- $self->FindAndAddAdditionalFiles($filename);
- return;
-}
-
-sub AddFiles
-{
- my $self =3D shift;
- my $dir =3D shift;
-
- while (my $f =3D shift)
- {
- $self->AddFile($dir . "/" . $f, 1);
- }
- return;
-}
-
-# Handle Makefile rules by searching for other files which exist with the =
same
-# name but a different file extension and add those files too.
-sub FindAndAddAdditionalFiles
-{
- my $self =3D shift;
- my $fname =3D shift;
- $fname =3D~ /(.*)(\.[^.]+)$/;
- my $filenoext =3D $1;
- my $fileext =3D $2;
-
- # For .c files, check if either a .l or .y file of the same name
- # exists and add that too.
- if ($fileext eq ".c")
- {
- my $file =3D $filenoext . ".l";
- if (-e $file)
- {
- $self->AddFile($file);
- }
-
- $file =3D $filenoext . ".y";
- if (-e $file)
- {
- $self->AddFile($file);
- }
- }
-}
-
-sub ReplaceFile
-{
- my ($self, $filename, $newname) =3D @_;
- my $re =3D "\\/$filename\$";
-
- foreach my $file (keys %{ $self->{files} })
- {
-
- # Match complete filename
- if ($filename =3D~ m!/!)
- {
- if ($file eq $filename)
- {
- delete $self->{files}{$file};
- $self->AddFile($newname);
- return;
- }
- }
- elsif ($file =3D~ m/($re)/)
- {
- delete $self->{files}{$file};
- $self->AddFile("$newname/$filename");
- return;
- }
- }
- confess("Could not find file $filename to replace\n");
-}
-
-sub RemoveFile
-{
- my ($self, $filename) =3D @_;
- my $orig =3D scalar keys %{ $self->{files} };
- delete $self->{files}->{$filename};
- if ($orig > scalar keys %{ $self->{files} })
- {
- return;
- }
- confess("Could not find file $filename to remove\n");
-}
-
-sub RelocateFiles
-{
- my ($self, $targetdir, $proc) =3D @_;
- foreach my $f (keys %{ $self->{files} })
- {
- my $r =3D &$proc($f);
- if ($r)
- {
- $self->RemoveFile($f);
- $self->AddFile($targetdir . '/' . basename($f));
- }
- }
- return;
-}
-
-sub AddReference
-{
- my $self =3D shift;
-
- while (my $ref =3D shift)
- {
- if (!grep { $_ eq $ref } @{ $self->{references} })
- {
- push @{ $self->{references} }, $ref;
- }
- $self->AddLibrary(
- "__CFGNAME__/" . $ref->{name} . "/" . $ref->{name} . ".lib");
- }
- return;
-}
-
-sub AddLibrary
-{
- my ($self, $lib, $dbgsuffix) =3D @_;
-
- # quote lib name if it has spaces and isn't already quoted
- if ($lib =3D~ m/\s/ && $lib !~ m/^[&]quot;/)
- {
- $lib =3D '"' . $lib . """;
- }
-
- if (!grep { $_ eq $lib } @{ $self->{libraries} })
- {
- push @{ $self->{libraries} }, $lib;
- }
-
- if ($dbgsuffix)
- {
- push @{ $self->{suffixlib} }, $lib;
- }
- return;
-}
-
-sub AddIncludeDir
-{
- my ($self, $incstr) =3D @_;
-
- foreach my $inc (split(/;/, $incstr))
- {
- if (!grep { $_ eq $inc } @{ $self->{includes} })
- {
- push @{ $self->{includes} }, $inc;
- }
- }
- return;
-}
-
-sub AddPrefixInclude
-{
- my ($self, $inc) =3D @_;
-
- $self->{prefixincludes} =3D $inc . ';' . $self->{prefixincludes};
- return;
-}
-
-sub AddDefine
-{
- my ($self, $def) =3D @_;
-
- $def =3D~ s/"/""/g;
- $self->{defines} .=3D $def . ';';
- return;
-}
-
-sub FullExportDLL
-{
- my ($self, $libname) =3D @_;
-
- $self->{builddef} =3D 1;
- $self->{def} =3D "./__CFGNAME__/$self->{name}/$self->{name}.def";
- $self->{implib} =3D "__CFGNAME__/$self->{name}/$libname";
- return;
-}
-
-sub UseDef
-{
- my ($self, $def) =3D @_;
-
- $self->{def} =3D $def;
- return;
-}
-
-sub AddDir
-{
- my ($self, $reldir) =3D @_;
- my $mf =3D read_makefile($reldir);
-
- $mf =3D~ s{\\\r?\n}{}g;
- if ($mf =3D~ m{^(?:SUB)?DIRS[^=3D]*=3D\s*(.*)$}mg)
- {
- foreach my $subdir (split /\s+/, $1)
- {
- next
- if $subdir eq "\$(top_builddir)/src/timezone"
- ; #special case for non-standard include
- next
- if $reldir . "/" . $subdir eq "src/backend/port/darwin";
-
- $self->AddDir($reldir . "/" . $subdir);
- }
- }
- while ($mf =3D~ m{^(?:EXTRA_)?OBJS[^=3D]*=3D\s*(.*)$}m)
- {
- my $s =3D $1;
- my $filter_re =3D qr{\$\(filter ([^,]+),\s+\$\(([^\)]+)\)\)};
- while ($s =3D~ /$filter_re/)
- {
-
- # Process $(filter a b c, $(VAR)) expressions
- my $list =3D $1;
- my $filter =3D $2;
- $list =3D~ s/\.o/\.c/g;
- my @pieces =3D split /\s+/, $list;
- my $matches =3D "";
- foreach my $p (@pieces)
- {
-
- if ($filter eq "LIBOBJS")
- {
- no warnings qw(once);
- if (grep(/$p/, @main::pgportfiles) =3D=3D 1)
- {
- $p =3D~ s/\.c/\.o/;
- $matches .=3D $p . " ";
- }
- }
- else
- {
- confess "Unknown filter $filter\n";
- }
- }
- $s =3D~ s/$filter_re/$matches/;
- }
- foreach my $f (split /\s+/, $s)
- {
- next if $f =3D~ /^\s*$/;
- next if $f eq "\\";
- next if $f =3D~ /\/SUBSYS.o$/;
- $f =3D~ s/,$//
- ; # Remove trailing comma that can show up from filter stuff
- next unless $f =3D~ /.*\.o$/;
- $f =3D~ s/\.o$/\.c/;
- if ($f =3D~ /^\$\(top_builddir\)\/(.*)/)
- {
- $f =3D $1;
- $self->AddFile($f);
- }
- else
- {
- $self->AddFile("$reldir/$f");
- }
- }
- $mf =3D~ s{OBJS[^=3D]*=3D\s*(.*)$}{}m;
- }
-
- # Match rules that pull in source files from different directories, eg
- # pgstrcasecmp.c rint.c snprintf.c: % : $(top_srcdir)/src/port/%
- my $replace_re =3D
- qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+\n}m;
- while ($mf =3D~ m{$replace_re}m)
- {
- my $match =3D $1;
- my $top =3D $2;
- my $target =3D $3;
- my @pieces =3D split /\s+/, $match;
- foreach my $fn (@pieces)
- {
- if ($top eq "(top_srcdir)")
- {
- eval { $self->ReplaceFile($fn, $target) };
- }
- elsif ($top eq "(backend_src)")
- {
- eval { $self->ReplaceFile($fn, "src/backend/$target") };
- }
- else
- {
- confess "Bad replacement top: $top, on line $_\n";
- }
- }
- $mf =3D~ s{$replace_re}{}m;
- }
-
- $self->AddDirResourceFile($reldir);
- return;
-}
-
-# If the directory's Makefile bears a description string, add a resource f=
ile.
-sub AddDirResourceFile
-{
- my ($self, $reldir) =3D @_;
- my $mf =3D read_makefile($reldir);
-
- if ($mf =3D~ /^PGFILEDESC\s*=3D\s*\"([^\"]+)\"/m)
- {
- my $desc =3D $1;
- my $ico;
- if ($mf =3D~ /^PGAPPICON\s*=3D\s*(.*)$/m) { $ico =3D $1; }
- $self->AddResourceFile($reldir, $desc, $ico);
- }
- return;
-}
-
-sub AddResourceFile
-{
- my ($self, $dir, $desc, $ico) =3D @_;
-
- if (Solution::IsNewer("$dir/win32ver.rc", 'src/port/win32ver.rc'))
- {
- print "Generating win32ver.rc for $dir\n";
- open(my $i, '<', 'src/port/win32ver.rc')
- || confess "Could not open win32ver.rc";
- open(my $o, '>', "$dir/win32ver.rc")
- || confess "Could not write win32ver.rc";
- my $icostr =3D $ico ? "IDI_ICON ICON \"src/port/$ico.ico\"" : "";
- while (<$i>)
- {
- s/FILEDESC/"$desc"/gm;
- s/_ICO_/$icostr/gm;
- if ($self->{type} eq "dll")
- {
- s/VFT_APP/VFT_DLL/gm;
- my $name =3D $self->{name};
- s/_INTERNAL_NAME_/"$name"/;
- s/_ORIGINAL_NAME_/"$name.dll"/;
- }
- else
- {
- /_INTERNAL_NAME_/ && next;
- /_ORIGINAL_NAME_/ && next;
- }
- print $o $_;
- }
- close($o);
- close($i);
- }
- $self->AddFile("$dir/win32ver.rc");
- return;
-}
-
-sub DisableLinkerWarnings
-{
- my ($self, $warnings) =3D @_;
-
- $self->{disablelinkerwarnings} .=3D ','
- unless ($self->{disablelinkerwarnings} eq '');
- $self->{disablelinkerwarnings} .=3D $warnings;
- return;
-}
-
-sub Save
-{
- my ($self) =3D @_;
-
- # Warning 4197 is about double exporting, disable this per
- # http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Fe=
edbackID=3D99193
- $self->DisableLinkerWarnings('4197') if ($self->{platform} eq 'x64');
-
- # Dump the project
- open(my $f, '>', "$self->{name}$self->{filenameExtension}")
- || croak(
- "Could not write to $self->{name}$self->{filenameExtension}\n");
- $self->WriteHeader($f);
- $self->WriteFiles($f);
- $self->Footer($f);
- close($f);
- return;
-}
-
-sub GetAdditionalLinkerDependencies
-{
- my ($self, $cfgname, $separator) =3D @_;
- my $libcfg =3D (uc $cfgname eq "RELEASE") ? "MD" : "MDd";
- my $libs =3D '';
- foreach my $lib (@{ $self->{libraries} })
- {
- my $xlib =3D $lib;
- foreach my $slib (@{ $self->{suffixlib} })
- {
- if ($slib eq $lib)
- {
- $xlib =3D~ s/\.lib$/$libcfg.lib/;
- last;
- }
- }
- $libs .=3D $xlib . $separator;
- }
- $libs =3D~ s/.$//;
- $libs =3D~ s/__CFGNAME__/$cfgname/g;
- return $libs;
-}
-
-# Utility function that loads a complete file
-sub read_file
-{
- my $filename =3D shift;
- my $F;
- local $/ =3D undef;
- open($F, '<', $filename) || croak "Could not open file $filename\n";
- my $txt =3D <$F>;
- close($F);
-
- return $txt;
-}
-
-sub read_makefile
-{
- my $reldir =3D shift;
- my $F;
- local $/ =3D undef;
- open($F, '<', "$reldir/GNUmakefile")
- || open($F, '<', "$reldir/Makefile")
- || confess "Could not open $reldir/Makefile\n";
- my $txt =3D <$F>;
- close($F);
-
- return $txt;
-}
-
-1;
diff --git a/src/tools/msvc/README b/src/tools/msvc/README
deleted file mode 100644
index 1c36925258..0000000000
--- a/src/tools/msvc/README
+++ /dev/null
@@ -1,99 +0,0 @@
-src/tools/msvc/README
-
-MSVC build
-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
-
-This directory contains the tools required to build PostgreSQL using
-Microsoft Visual Studio 2015 - 2022. This builds the whole backend, not ju=
st
-the libpq frontend library. For more information, see the documentation
-chapter "Installation on Windows" and the description below.
-
-
-Notes about Visual Studio Express
----------------------------------
-To build PostgreSQL using Visual Studio Express, the Microsoft Windows SDK
-has to be installed. Since this is not included in the product
-originally, extra steps are needed to make it work.
-
-First, download and install a supported version of the Microsoft Windows S=
DK
-from www.microsoft.com (v8.1a or greater).
-
-Locate the files vcprojectengine.dll.express.config and
-vcprojectengine.dll.config in the vc\vcpackages directory of
-the Visual C++ Express installation. In these files, add the paths
-to the Platform SDK to the Include, Library and Path tags. Be sure
-to add them to the beginning of the list.
-
-This should work for both GUI and commandline builds, but a restart
-may be necessary.
-
-If you are using a recent version of the Microsoft Windows SDK that includ=
es
-the compilers and build tools you probably don't even need Visual Studio
-Express to build PostgreSQL.
-
-
-Structure of the build tools
-----------------------------
-The tools for building PostgreSQL using Microsoft Visual Studio currently
-consist of the following files:
-
-- Configuration files -
-config_default.pl default configuration arguments
-
-A typical build environment has two more files, buildenv.pl and config.pl
-that contain the user's build environment settings and configuration
-arguments.
-
-
-- User tools -
-build.pl tool to build the binaries
-clean.bat batch file for cleaning up generated files
-install.pl tool to install the generated files
-mkvcbuild.pl tool to generate the Visual Studio build files
-vcregress.pl tool to run the regression tests
-
-
-- Internal tools -
-gendef.pl internal tool to generate .DEF files
-pgbison.pl internal tool to process .y files using bison
-pgflex.pl internal tool to process .l files using flex
-
-Many of those .pl files also have a corresponding .bat-wrapper that doesn't
-contain any additional logic.
-
-
-- Internal modules -
-Install.pm module containing the install logic
-Mkvcbuild.pm module containing the code to generate the Visual
- Studio build (project/solution) files
-MSBuildProject.pm module containing the code to generate MSBuild based
- project files (Visual Studio 2015 or greater)
-Project.pm module containing the common code to generate the
- Visual Studio project files. Also provides the
- common interface of all project file generators
-Solution.pm module containing the code to generate the Visual
- Studio solution files.
-VSObjectFactory.pm factory module providing the code to create the
- appropriate project/solution files for the current
- environment
-
-
-Description of the internals of the Visual Studio build process
----------------------------------------------------------------
-By typing 'build' the user starts the build.bat wrapper which simply passes
-its arguments to build.pl.
-In build.pl the user's buildenv.pl is used to set up the build environment
-(i. e. path to bison and flex). In addition his config.pl file is merged i=
nto
-config_default.pl to create the configuration arguments.
-These configuration arguments are passed over to Mkvcbuild::mkvcbuild
-(Mkvcbuild.pm) which creates the Visual Studio project and solution files.
-It does this by using VSObjectFactory::CreateSolution to create an object
-implementing the Solution interface (this could be either
-VS2015Solution, VS2017Solution, VS2019Solution or VS2022Solution, all in
-Solution.pm, depending on the user's build environment) and adding objects
-implementing the corresponding Project interface (
-VC2015Project, VC2017Project, VC2019Project or VC2022Project from
-MSBuildProject.pm) to it. When Solution::Save is called, the implementatio=
ns
-of Solution and Project save their content in the appropriate format.
-The final step of starting the appropriate build program (msbuild) is
-performed in build.pl again.
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
deleted file mode 100644
index a50f730260..0000000000
--- a/src/tools/msvc/Solution.pm
+++ /dev/null
@@ -1,1358 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Solution;
-
-#
-# Package that encapsulates a Visual C++ solution file generation
-#
-# src/tools/msvc/Solution.pm
-#
-use Carp;
-use strict;
-use warnings;
-use VSObjectFactory;
-
-no warnings qw(redefine); ## no critic
-
-sub _new
-{
- my $classname =3D shift;
- my $options =3D shift;
- my $self =3D {
- projects =3D> {},
- options =3D> $options,
- VisualStudioVersion =3D> undef,
- MinimumVisualStudioVersion =3D> undef,
- vcver =3D> undef,
- platform =3D> undef,
- };
- bless($self, $classname);
-
- $self->DeterminePlatform();
-
- if ($options->{xslt} && !$options->{xml})
- {
- die "XSLT requires XML\n";
- }
- $options->{blocksize} =3D 8
- unless $options->{blocksize}; # undef or 0 means default
- die "Bad blocksize $options->{blocksize}"
- unless grep { $_ =3D=3D $options->{blocksize} } (1, 2, 4, 8, 16, 32);
- $options->{segsize} =3D 1
- unless $options->{segsize}; # undef or 0 means default
- # only allow segsize 1 for now, as we can't do large files yet in windows
- die "Bad segsize $options->{segsize}"
- unless $options->{segsize} =3D=3D 1;
- $options->{wal_blocksize} =3D 8
- unless $options->{wal_blocksize}; # undef or 0 means default
- die "Bad wal_blocksize $options->{wal_blocksize}"
- unless grep { $_ =3D=3D $options->{wal_blocksize} }
- (1, 2, 4, 8, 16, 32, 64);
-
- return $self;
-}
-
-sub GetAdditionalHeaders
-{
- return '';
-}
-
-sub DeterminePlatform
-{
- my $self =3D shift;
-
- if ($^O eq "MSWin32")
- {
- # Examine CL help output to determine if we are in 32 or 64-bit mode.
- my $output =3D `cl /help 2>&1`;
- $? >> 8 =3D=3D 0 or die "cl command not found";
- $self->{platform} =3D
- ($output =3D~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
- }
- else
- {
- $self->{platform} =3D 'FAKE';
- }
- print "Detected hardware platform: $self->{platform}\n";
- return;
-}
-
-# Return 1 if $oldfile is newer than $newfile, or if $newfile doesn't exis=
t.
-# Special case - if config.pl has changed, always return 1
-sub IsNewer
-{
- my ($newfile, $oldfile) =3D @_;
- -e $oldfile or warn "source file \"$oldfile\" does not exist";
- if ( $oldfile ne 'src/tools/msvc/config.pl'
- && $oldfile ne 'src/tools/msvc/config_default.pl')
- {
- return 1
- if (-f 'src/tools/msvc/config.pl')
- && IsNewer($newfile, 'src/tools/msvc/config.pl');
- return 1
- if (-f 'src/tools/msvc/config_default.pl')
- && IsNewer($newfile, 'src/tools/msvc/config_default.pl');
- }
- return 1 if (!(-e $newfile));
- my @nstat =3D stat($newfile);
- my @ostat =3D stat($oldfile);
- return 1 if ($nstat[9] < $ostat[9]);
- return 0;
-}
-
-# Copy a file, *not* preserving date. Only works for text files.
-sub copyFile
-{
- my ($src, $dest) =3D @_;
- open(my $i, '<', $src) || croak "Could not open $src";
- open(my $o, '>', $dest) || croak "Could not open $dest";
- while (<$i>)
- {
- print $o $_;
- }
- close($i);
- close($o);
- return;
-}
-
-# Fetch version of OpenSSL based on a parsing of the command shipped with
-# the installer this build is linking to. This returns as result an array
-# made of the three first digits of the OpenSSL version, which is enough
-# to decide which options to apply depending on the version of OpenSSL
-# linking with.
-sub GetOpenSSLVersion
-{
- my $self =3D shift;
-
- # Attempt to get OpenSSL version and location. This assumes that
- # openssl.exe is in the specified directory.
- # Quote the .exe name in case it has spaces
- my $opensslcmd =3D
- qq("$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1);
- my $sslout =3D `$opensslcmd`;
-
- $? >> 8 =3D=3D 0
- or croak
- "Unable to determine OpenSSL version: The openssl.exe command wasn't fo=
und.";
-
- if ($sslout =3D~ /(\d+)\.(\d+)\.(\d+)(\D)/m)
- {
- return ($1, $2, $3);
- }
-
- croak
- "Unable to determine OpenSSL version: The openssl.exe version could not=
be determined.";
-}
-
-sub GenerateFiles
-{
- my $self =3D shift;
- my $bits =3D $self->{platform} eq 'Win32' ? 32 : 64;
- my $ac_init_found =3D 0;
- my $package_name;
- my $package_version;
- my $package_bugreport;
- my $package_url;
- my ($majorver, $minorver);
- my $ac_define_openssl_api_compat_found =3D 0;
- my $openssl_api_compat;
-
- # Parse configure.ac to get version numbers
- open(my $c, '<', "configure.ac")
- || confess("Could not open configure.ac for reading\n");
- while (<$c>)
- {
- if (/^AC_INIT\(\[([^\]]+)\], \[([^\]]+)\], \[([^\]]+)\], \[([^\]]*)\], \=
[([^\]]+)\]/
- )
- {
- $ac_init_found =3D 1;
-
- $package_name =3D $1;
- $package_version =3D $2;
- $package_bugreport =3D $3;
- #$package_tarname =3D $4;
- $package_url =3D $5;
-
- if ($package_version !~ /^(\d+)(?:\.(\d+))?/)
- {
- confess "Bad format of version: $package_version\n";
- }
- $majorver =3D sprintf("%d", $1);
- $minorver =3D sprintf("%d", $2 ? $2 : 0);
- }
- elsif (/\bAC_DEFINE\(OPENSSL_API_COMPAT, \[([0-9xL]+)\]/)
- {
- $ac_define_openssl_api_compat_found =3D 1;
- $openssl_api_compat =3D $1;
- }
- }
- close($c);
- confess "Unable to parse configure.ac for all variables!"
- unless $ac_init_found && $ac_define_openssl_api_compat_found;
-
- if (IsNewer("src/include/pg_config_os.h", "src/include/port/win32.h"))
- {
- print "Copying pg_config_os.h...\n";
- copyFile("src/include/port/win32.h", "src/include/pg_config_os.h");
- }
-
- print "Generating configuration headers...\n";
- my $extraver =3D $self->{options}->{extraver};
- $extraver =3D '' unless defined $extraver;
- my $port =3D $self->{options}->{"--with-pgport"} || 5432;
-
- # Every symbol in pg_config.h.in must be accounted for here. Set
- # to undef if the symbol should not be defined.
- my %define =3D (
- ALIGNOF_DOUBLE =3D> 8,
- ALIGNOF_INT =3D> 4,
- ALIGNOF_LONG =3D> 4,
- ALIGNOF_LONG_LONG_INT =3D> 8,
- ALIGNOF_PG_INT128_TYPE =3D> undef,
- ALIGNOF_SHORT =3D> 2,
- AC_APPLE_UNIVERSAL_BUILD =3D> undef,
- BLCKSZ =3D> 1024 * $self->{options}->{blocksize},
- CONFIGURE_ARGS =3D> '"' . $self->GetFakeConfigure() . '"',
- DEF_PGPORT =3D> $port,
- DEF_PGPORT_STR =3D> qq{"$port"},
- DLSUFFIX =3D> '".dll"',
- ENABLE_GSS =3D> $self->{options}->{gss} ? 1 : undef,
- ENABLE_NLS =3D> $self->{options}->{nls} ? 1 : undef,
- HAVE_APPEND_HISTORY =3D> undef,
- HAVE_ASN1_STRING_GET0_DATA =3D> undef,
- HAVE_ATOMICS =3D> 1,
- HAVE_ATOMIC_H =3D> undef,
- HAVE_BACKTRACE_SYMBOLS =3D> undef,
- HAVE_BIO_GET_DATA =3D> undef,
- HAVE_BIO_METH_NEW =3D> undef,
- HAVE_COMPUTED_GOTO =3D> undef,
- HAVE_COPYFILE =3D> undef,
- HAVE_COPYFILE_H =3D> undef,
- HAVE_CRTDEFS_H =3D> undef,
- HAVE_CRYPTO_LOCK =3D> undef,
- HAVE_DECL_FDATASYNC =3D> 0,
- HAVE_DECL_F_FULLFSYNC =3D> 0,
- HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER =3D> 0,
- HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER =3D> 0,
- HAVE_DECL_LLVMGETHOSTCPUNAME =3D> 0,
- HAVE_DECL_LLVMGETHOSTCPUFEATURES =3D> 0,
- HAVE_DECL_LLVMORCGETSYMBOLADDRESSIN =3D> 0,
- HAVE_DECL_POSIX_FADVISE =3D> 0,
- HAVE_DECL_PREADV =3D> 0,
- HAVE_DECL_PWRITEV =3D> 0,
- HAVE_DECL_STRLCAT =3D> 0,
- HAVE_DECL_STRLCPY =3D> 0,
- HAVE_DECL_STRNLEN =3D> 1,
- HAVE_EDITLINE_HISTORY_H =3D> undef,
- HAVE_EDITLINE_READLINE_H =3D> undef,
- HAVE_EXECINFO_H =3D> undef,
- HAVE_EXPLICIT_BZERO =3D> undef,
- HAVE_FSEEKO =3D> 1,
- HAVE_GCC__ATOMIC_INT32_CAS =3D> undef,
- HAVE_GCC__ATOMIC_INT64_CAS =3D> undef,
- HAVE_GCC__SYNC_CHAR_TAS =3D> undef,
- HAVE_GCC__SYNC_INT32_CAS =3D> undef,
- HAVE_GCC__SYNC_INT32_TAS =3D> undef,
- HAVE_GCC__SYNC_INT64_CAS =3D> undef,
- HAVE_GETIFADDRS =3D> undef,
- HAVE_GETOPT =3D> undef,
- HAVE_GETOPT_H =3D> undef,
- HAVE_GETOPT_LONG =3D> undef,
- HAVE_GETPEEREID =3D> undef,
- HAVE_GETPEERUCRED =3D> undef,
- HAVE_GSSAPI_EXT_H =3D> undef,
- HAVE_GSSAPI_GSSAPI_EXT_H =3D> undef,
- HAVE_GSSAPI_GSSAPI_H =3D> undef,
- HAVE_GSSAPI_H =3D> undef,
- HAVE_HMAC_CTX_FREE =3D> undef,
- HAVE_HMAC_CTX_NEW =3D> undef,
- HAVE_HISTORY_H =3D> undef,
- HAVE_HISTORY_TRUNCATE_FILE =3D> undef,
- HAVE_IFADDRS_H =3D> undef,
- HAVE_INET_ATON =3D> undef,
- HAVE_INET_PTON =3D> 1,
- HAVE_INT_TIMEZONE =3D> 1,
- HAVE_INT64 =3D> undef,
- HAVE_INT8 =3D> undef,
- HAVE_INTTYPES_H =3D> undef,
- HAVE_INT_OPTERR =3D> undef,
- HAVE_INT_OPTRESET =3D> undef,
- HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P =3D> undef,
- HAVE_KQUEUE =3D> undef,
- HAVE_LANGINFO_H =3D> undef,
- HAVE_LDAP_INITIALIZE =3D> undef,
- HAVE_LIBCRYPTO =3D> undef,
- HAVE_LIBLDAP =3D> undef,
- HAVE_LIBLZ4 =3D> undef,
- HAVE_LIBM =3D> undef,
- HAVE_LIBPAM =3D> undef,
- HAVE_LIBREADLINE =3D> undef,
- HAVE_LIBSELINUX =3D> undef,
- HAVE_LIBSSL =3D> undef,
- HAVE_LIBWLDAP32 =3D> undef,
- HAVE_LIBXML2 =3D> undef,
- HAVE_LIBXSLT =3D> undef,
- HAVE_LIBZ =3D> $self->{options}->{zlib} ? 1 : undef,
- HAVE_LIBZSTD =3D> undef,
- HAVE_LONG_INT_64 =3D> undef,
- HAVE_LONG_LONG_INT_64 =3D> 1,
- HAVE_MBARRIER_H =3D> undef,
- HAVE_MBSTOWCS_L =3D> undef,
- HAVE_MEMORY_H =3D> 1,
- HAVE_MEMSET_S =3D> undef,
- HAVE_MKDTEMP =3D> undef,
- HAVE_OPENSSL_INIT_SSL =3D> undef,
- HAVE_OSSP_UUID_H =3D> undef,
- HAVE_PAM_PAM_APPL_H =3D> undef,
- HAVE_POSIX_FADVISE =3D> undef,
- HAVE_POSIX_FALLOCATE =3D> undef,
- HAVE_PPOLL =3D> undef,
- HAVE_PTHREAD =3D> undef,
- HAVE_PTHREAD_BARRIER_WAIT =3D> undef,
- HAVE_PTHREAD_IS_THREADED_NP =3D> undef,
- HAVE_PTHREAD_PRIO_INHERIT =3D> undef,
- HAVE_READLINE_H =3D> undef,
- HAVE_READLINE_HISTORY_H =3D> undef,
- HAVE_READLINE_READLINE_H =3D> undef,
- HAVE_RL_COMPLETION_MATCHES =3D> undef,
- HAVE_RL_COMPLETION_SUPPRESS_QUOTE =3D> undef,
- HAVE_RL_FILENAME_COMPLETION_FUNCTION =3D> undef,
- HAVE_RL_FILENAME_QUOTE_CHARACTERS =3D> undef,
- HAVE_RL_FILENAME_QUOTING_FUNCTION =3D> undef,
- HAVE_RL_RESET_SCREEN_SIZE =3D> undef,
- HAVE_RL_VARIABLE_BIND =3D> undef,
- HAVE_SECURITY_PAM_APPL_H =3D> undef,
- HAVE_SETPROCTITLE =3D> undef,
- HAVE_SETPROCTITLE_FAST =3D> undef,
- HAVE_SOCKLEN_T =3D> 1,
- HAVE_SPINLOCKS =3D> 1,
- HAVE_SSL_CTX_SET_CERT_CB =3D> undef,
- HAVE_STDBOOL_H =3D> 1,
- HAVE_STDINT_H =3D> 1,
- HAVE_STDLIB_H =3D> 1,
- HAVE_STRCHRNUL =3D> undef,
- HAVE_STRERROR_R =3D> undef,
- HAVE_STRINGS_H =3D> undef,
- HAVE_STRING_H =3D> 1,
- HAVE_STRLCAT =3D> undef,
- HAVE_STRLCPY =3D> undef,
- HAVE_STRNLEN =3D> 1,
- HAVE_STRSIGNAL =3D> undef,
- HAVE_STRUCT_OPTION =3D> undef,
- HAVE_STRUCT_SOCKADDR_SA_LEN =3D> undef,
- HAVE_STRUCT_TM_TM_ZONE =3D> undef,
- HAVE_SYNC_FILE_RANGE =3D> undef,
- HAVE_SYNCFS =3D> undef,
- HAVE_SYSLOG =3D> undef,
- HAVE_SYS_EPOLL_H =3D> undef,
- HAVE_SYS_EVENT_H =3D> undef,
- HAVE_SYS_PERSONALITY_H =3D> undef,
- HAVE_SYS_PRCTL_H =3D> undef,
- HAVE_SYS_PROCCTL_H =3D> undef,
- HAVE_SYS_SIGNALFD_H =3D> undef,
- HAVE_SYS_STAT_H =3D> 1,
- HAVE_SYS_TYPES_H =3D> 1,
- HAVE_SYS_UCRED_H =3D> undef,
- HAVE_TERMIOS_H =3D> undef,
- HAVE_TYPEOF =3D> undef,
- HAVE_UCRED_H =3D> undef,
- HAVE_UINT64 =3D> undef,
- HAVE_UINT8 =3D> undef,
- HAVE_UNION_SEMUN =3D> undef,
- HAVE_UNISTD_H =3D> 1,
- HAVE_USELOCALE =3D> undef,
- HAVE_UUID_BSD =3D> undef,
- HAVE_UUID_E2FS =3D> undef,
- HAVE_UUID_OSSP =3D> undef,
- HAVE_UUID_H =3D> undef,
- HAVE_UUID_UUID_H =3D> undef,
- HAVE_WCSTOMBS_L =3D> undef,
- HAVE_VISIBILITY_ATTRIBUTE =3D> undef,
- HAVE_X509_GET_SIGNATURE_INFO =3D> undef,
- HAVE_X86_64_POPCNTQ =3D> undef,
- HAVE__BOOL =3D> undef,
- HAVE__BUILTIN_BSWAP16 =3D> undef,
- HAVE__BUILTIN_BSWAP32 =3D> undef,
- HAVE__BUILTIN_BSWAP64 =3D> undef,
- HAVE__BUILTIN_CLZ =3D> undef,
- HAVE__BUILTIN_CONSTANT_P =3D> undef,
- HAVE__BUILTIN_CTZ =3D> undef,
- HAVE__BUILTIN_FRAME_ADDRESS =3D> undef,
- HAVE__BUILTIN_OP_OVERFLOW =3D> undef,
- HAVE__BUILTIN_POPCOUNT =3D> undef,
- HAVE__BUILTIN_TYPES_COMPATIBLE_P =3D> undef,
- HAVE__BUILTIN_UNREACHABLE =3D> undef,
- HAVE__CONFIGTHREADLOCALE =3D> 1,
- HAVE__CPUID =3D> 1,
- HAVE__GET_CPUID =3D> undef,
- HAVE__STATIC_ASSERT =3D> undef,
- INT64_MODIFIER =3D> qq{"ll"},
- LOCALE_T_IN_XLOCALE =3D> undef,
- MAXIMUM_ALIGNOF =3D> 8,
- MEMSET_LOOP_LIMIT =3D> 1024,
- OPENSSL_API_COMPAT =3D> $openssl_api_compat,
- PACKAGE_BUGREPORT =3D> qq{"$package_bugreport"},
- PACKAGE_NAME =3D> qq{"$package_name"},
- PACKAGE_STRING =3D> qq{"$package_name $package_version"},
- PACKAGE_TARNAME =3D> lc qq{"$package_name"},
- PACKAGE_URL =3D> qq{"$package_url"},
- PACKAGE_VERSION =3D> qq{"$package_version"},
- PG_INT128_TYPE =3D> undef,
- PG_INT64_TYPE =3D> 'long long int',
- PG_KRB_SRVNAM =3D> qq{"postgres"},
- PG_MAJORVERSION =3D> qq{"$majorver"},
- PG_MAJORVERSION_NUM =3D> $majorver,
- PG_MINORVERSION_NUM =3D> $minorver,
- PG_PRINTF_ATTRIBUTE =3D> undef,
- PG_USE_STDBOOL =3D> 1,
- PG_VERSION =3D> qq{"$package_version$extraver"},
- PG_VERSION_NUM =3D> sprintf("%d%04d", $majorver, $minorver),
- PG_VERSION_STR =3D>
- qq{"PostgreSQL $package_version$extraver, compiled by Visual C++ build=
" CppAsString2(_MSC_VER) ", $bits-bit"},
- PROFILE_PID_DIR =3D> undef,
- PTHREAD_CREATE_JOINABLE =3D> undef,
- RELSEG_SIZE =3D> (1024 / $self->{options}->{blocksize}) *
- $self->{options}->{segsize} * 1024,
- SIZEOF_BOOL =3D> 1,
- SIZEOF_LONG =3D> 4,
- SIZEOF_OFF_T =3D> undef,
- SIZEOF_SIZE_T =3D> $bits / 8,
- SIZEOF_VOID_P =3D> $bits / 8,
- STDC_HEADERS =3D> 1,
- STRERROR_R_INT =3D> undef,
- USE_ARMV8_CRC32C =3D> undef,
- USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK =3D> undef,
- USE_ASSERT_CHECKING =3D> $self->{options}->{asserts} ? 1 : undef,
- USE_BONJOUR =3D> undef,
- USE_BSD_AUTH =3D> undef,
- USE_ICU =3D> $self->{options}->{icu} ? 1 : undef,
- USE_LIBXML =3D> undef,
- USE_LIBXSLT =3D> undef,
- USE_LZ4 =3D> undef,
- USE_LDAP =3D> $self->{options}->{ldap} ? 1 : undef,
- USE_LLVM =3D> undef,
- USE_LOONGARCH_CRC32C =3D> undef,
- USE_NAMED_POSIX_SEMAPHORES =3D> undef,
- USE_OPENSSL =3D> undef,
- USE_PAM =3D> undef,
- USE_SLICING_BY_8_CRC32C =3D> undef,
- USE_SSE42_CRC32C =3D> undef,
- USE_SSE42_CRC32C_WITH_RUNTIME_CHECK =3D> 1,
- USE_SYSTEMD =3D> undef,
- USE_SYSV_SEMAPHORES =3D> undef,
- USE_SYSV_SHARED_MEMORY =3D> undef,
- USE_UNNAMED_POSIX_SEMAPHORES =3D> undef,
- USE_WIN32_SEMAPHORES =3D> 1,
- USE_WIN32_SHARED_MEMORY =3D> 1,
- USE_ZSTD =3D> undef,
- WCSTOMBS_L_IN_XLOCALE =3D> undef,
- WORDS_BIGENDIAN =3D> undef,
- XLOG_BLCKSZ =3D> 1024 * $self->{options}->{wal_blocksize},
- _FILE_OFFSET_BITS =3D> undef,
- _LARGEFILE_SOURCE =3D> undef,
- _LARGE_FILES =3D> undef,
- inline =3D> '__inline',
- pg_restrict =3D> '__restrict',
- # not defined, because it'd conflict with __declspec(restrict)
- restrict =3D> undef,
- typeof =3D> undef,);
-
- if ($self->{options}->{uuid})
- {
- $define{HAVE_UUID_OSSP} =3D 1;
- $define{HAVE_UUID_H} =3D 1;
- }
- if ($self->{options}->{xml})
- {
- $define{HAVE_LIBXML2} =3D 1;
- $define{USE_LIBXML} =3D 1;
- }
- if ($self->{options}->{xslt})
- {
- $define{HAVE_LIBXSLT} =3D 1;
- $define{USE_LIBXSLT} =3D 1;
- }
- if ($self->{options}->{lz4})
- {
- $define{HAVE_LIBLZ4} =3D 1;
- $define{USE_LZ4} =3D 1;
- }
- if ($self->{options}->{zstd})
- {
- $define{HAVE_LIBZSTD} =3D 1;
- $define{USE_ZSTD} =3D 1;
- }
- if ($self->{options}->{openssl})
- {
- $define{USE_OPENSSL} =3D 1;
- $define{HAVE_SSL_CTX_SET_CERT_CB} =3D 1;
-
- my ($digit1, $digit2, $digit3) =3D $self->GetOpenSSLVersion();
-
- # Symbols needed with OpenSSL 1.1.1 and above.
- if ( ($digit1 >=3D '3' && $digit2 >=3D '0' && $digit3 >=3D '0')
- || ($digit1 >=3D '1' && $digit2 >=3D '1' && $digit3 >=3D '1'))
- {
- $define{HAVE_X509_GET_SIGNATURE_INFO} =3D 1;
- }
-
- # Symbols needed with OpenSSL 1.1.0 and above.
- if ( ($digit1 >=3D '3' && $digit2 >=3D '0' && $digit3 >=3D '0')
- || ($digit1 >=3D '1' && $digit2 >=3D '1' && $digit3 >=3D '0'))
- {
- $define{HAVE_ASN1_STRING_GET0_DATA} =3D 1;
- $define{HAVE_BIO_GET_DATA} =3D 1;
- $define{HAVE_BIO_METH_NEW} =3D 1;
- $define{HAVE_HMAC_CTX_FREE} =3D 1;
- $define{HAVE_HMAC_CTX_NEW} =3D 1;
- $define{HAVE_OPENSSL_INIT_SSL} =3D 1;
- }
- }
-
- $self->GenerateConfigHeader('src/include/pg_config.h', \%define, 1);
- $self->GenerateConfigHeader('src/include/pg_config_ext.h', \%define, 0);
- $self->GenerateConfigHeader('src/interfaces/ecpg/include/ecpg_config.h',
- \%define, 0);
-
- $self->GenerateDefFile(
- "src/interfaces/libpq/libpqdll.def",
- "src/interfaces/libpq/exports.txt",
- "LIBPQ");
- $self->GenerateDefFile(
- "src/interfaces/ecpg/ecpglib/ecpglib.def",
- "src/interfaces/ecpg/ecpglib/exports.txt",
- "LIBECPG");
- $self->GenerateDefFile(
- "src/interfaces/ecpg/compatlib/compatlib.def",
- "src/interfaces/ecpg/compatlib/exports.txt",
- "LIBECPG_COMPAT");
- $self->GenerateDefFile(
- "src/interfaces/ecpg/pgtypeslib/pgtypeslib.def",
- "src/interfaces/ecpg/pgtypeslib/exports.txt",
- "LIBPGTYPES");
-
- chdir('src/backend/utils');
- my $pg_proc_dat =3D '../../../src/include/catalog/pg_proc.dat';
- if ( IsNewer('fmgr-stamp', 'Gen_fmgrtab.pl')
- || IsNewer('fmgr-stamp', '../catalog/Catalog.pm')
- || IsNewer('fmgr-stamp', $pg_proc_dat)
- || IsNewer('fmgr-stamp', '../../../src/include/access/transam.h'))
- {
- system(
- "perl -I ../catalog Gen_fmgrtab.pl --include-path ../../../src/include/=
$pg_proc_dat"
- );
- open(my $f, '>', 'fmgr-stamp')
- || confess "Could not touch fmgr-stamp";
- close($f);
- }
- chdir('../../..');
-
- if (IsNewer(
- 'src/include/utils/fmgroids.h',
- 'src/backend/utils/fmgroids.h'))
- {
- copyFile('src/backend/utils/fmgroids.h',
- 'src/include/utils/fmgroids.h');
- }
-
- if (IsNewer(
- 'src/include/utils/fmgrprotos.h',
- 'src/backend/utils/fmgrprotos.h'))
- {
- copyFile(
- 'src/backend/utils/fmgrprotos.h',
- 'src/include/utils/fmgrprotos.h');
- }
-
- if (IsNewer(
- 'src/include/storage/lwlocknames.h',
- 'src/backend/storage/lmgr/lwlocknames.txt'))
- {
- print "Generating lwlocknames.c and lwlocknames.h...\n";
- my $lmgr =3D 'src/backend/storage/lmgr';
- system(
- "perl $lmgr/generate-lwlocknames.pl --outdir $lmgr $lmgr/lwlocknames.tx=
t"
- );
- }
- if (IsNewer(
- 'src/include/storage/lwlocknames.h',
- 'src/backend/storage/lmgr/lwlocknames.h'))
- {
- copyFile(
- 'src/backend/storage/lmgr/lwlocknames.h',
- 'src/include/storage/lwlocknames.h');
- }
-
- if (IsNewer(
- 'src/include/utils/wait_event_types.h',
- 'src/backend/utils/activity/wait_event_names.txt'))
- {
- print
- "Generating pgstat_wait_event.c, wait_event_types.h and wait_event_fun=
cs_data.c...\n";
- my $activ =3D 'src/backend/utils/activity';
- system(
- "perl $activ/generate-wait_event_types.pl --outdir $activ --code $activ=
/wait_event_names.txt"
- );
- }
- if (IsNewer(
- 'src/include/utils/wait_event_types.h',
- 'src/backend/utils/activity/wait_event_types.h'))
- {
- copyFile(
- 'src/backend/utils/activity/wait_event_types.h',
- 'src/include/utils/wait_event_types.h');
- }
-
- if (IsNewer('src/include/utils/probes.h', 'src/backend/utils/probes.d'))
- {
- print "Generating probes.h...\n";
- system(
- 'perl src/backend/utils/Gen_dummy_probes.pl src/backend/utils/probes.d =
> src/include/utils/probes.h'
- );
- }
-
- if ($self->{options}->{python}
- && IsNewer(
- 'src/pl/plpython/spiexceptions.h',
- 'src/backend/utils/errcodes.txt'))
- {
- print "Generating spiexceptions.h...\n";
- system(
- 'perl src/pl/plpython/generate-spiexceptions.pl src/backend/utils/errco=
des.txt > src/pl/plpython/spiexceptions.h'
- );
- }
-
- if (IsNewer(
- 'src/include/utils/errcodes.h',
- 'src/backend/utils/errcodes.txt'))
- {
- print "Generating errcodes.h...\n";
- system(
- 'perl src/backend/utils/generate-errcodes.pl --outfile src/backend/util=
s/errcodes.h src/backend/utils/errcodes.txt'
- );
- copyFile('src/backend/utils/errcodes.h',
- 'src/include/utils/errcodes.h');
- }
-
- if (IsNewer(
- 'src/pl/plpgsql/src/plerrcodes.h',
- 'src/backend/utils/errcodes.txt'))
- {
- print "Generating plerrcodes.h...\n";
- system(
- 'perl src/pl/plpgsql/src/generate-plerrcodes.pl src/backend/utils/errco=
des.txt > src/pl/plpgsql/src/plerrcodes.h'
- );
- }
-
- if ($self->{options}->{tcl}
- && IsNewer(
- 'src/pl/tcl/pltclerrcodes.h', 'src/backend/utils/errcodes.txt'))
- {
- print "Generating pltclerrcodes.h...\n";
- system(
- 'perl src/pl/tcl/generate-pltclerrcodes.pl src/backend/utils/errcodes.t=
xt > src/pl/tcl/pltclerrcodes.h'
- );
- }
-
- if (IsNewer(
- 'contrib/fuzzystrmatch/daitch_mokotoff.h',
- 'contrib/fuzzystrmatch/daitch_mokotoff_header.pl'))
- {
- print "Generating daitch_mokotoff.h...\n";
- system( 'perl contrib/fuzzystrmatch/daitch_mokotoff_header.pl '
- . 'contrib/fuzzystrmatch/daitch_mokotoff.h');
- }
-
- if (IsNewer('src/bin/psql/sql_help.h', 'src/bin/psql/create_help.pl'))
- {
- print "Generating sql_help.h...\n";
- my $psql =3D 'src/bin/psql';
- system(
- "perl $psql/create_help.pl --docdir doc/src/sgml/ref --outdir $psql --b=
asename sql_help"
- );
- }
-
- if (IsNewer('src/common/kwlist_d.h', 'src/include/parser/kwlist.h'))
- {
- print "Generating kwlist_d.h...\n";
- system(
- 'perl -I src/tools src/tools/gen_keywordlist.pl --extern -o src/common =
src/include/parser/kwlist.h'
- );
- }
-
- if (IsNewer(
- 'src/pl/plpgsql/src/pl_reserved_kwlist_d.h',
- 'src/pl/plpgsql/src/pl_reserved_kwlist.h')
- || IsNewer(
- 'src/pl/plpgsql/src/pl_unreserved_kwlist_d.h',
- 'src/pl/plpgsql/src/pl_unreserved_kwlist.h'))
- {
- print
- "Generating pl_reserved_kwlist_d.h and pl_unreserved_kwlist_d.h...\n";
- chdir('src/pl/plpgsql/src');
- system(
- 'perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname Res=
ervedPLKeywords pl_reserved_kwlist.h'
- );
- system(
- 'perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname Unr=
eservedPLKeywords pl_unreserved_kwlist.h'
- );
- chdir('../../../..');
- }
-
- if (IsNewer(
- 'src/interfaces/ecpg/preproc/c_kwlist_d.h',
- 'src/interfaces/ecpg/preproc/c_kwlist.h')
- || IsNewer(
- 'src/interfaces/ecpg/preproc/ecpg_kwlist_d.h',
- 'src/interfaces/ecpg/preproc/ecpg_kwlist.h'))
- {
- print "Generating c_kwlist_d.h and ecpg_kwlist_d.h...\n";
- chdir('src/interfaces/ecpg/preproc');
- system(
- 'perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname Sca=
nCKeywords --no-case-fold c_kwlist.h'
- );
- system(
- 'perl -I ../../../tools ../../../tools/gen_keywordlist.pl --varname Sca=
nECPGKeywords ecpg_kwlist.h'
- );
- chdir('../../../..');
- }
-
- if (IsNewer(
- 'src/interfaces/ecpg/preproc/preproc.y',
- 'src/backend/parser/gram.y'))
- {
- print "Generating preproc.y...\n";
- my $ecpg =3D 'src/interfaces/ecpg';
- system(
- "perl $ecpg/preproc/parse.pl --srcdir $ecpg/preproc --parser src/backen=
d/parser/gram.y --output $ecpg/preproc/preproc.y"
- );
- }
-
- unless (-f "src/port/pg_config_paths.h")
- {
- print "Generating pg_config_paths.h...\n";
- open(my $o, '>', 'src/port/pg_config_paths.h')
- || confess "Could not open pg_config_paths.h";
- print $o <', 'bki-stamp')
- || confess "Could not touch bki-stamp";
- close($f);
- chdir('../../..');
- }
-
- if (IsNewer(
- 'src/include/catalog/header-stamp',
- 'src/backend/catalog/bki-stamp'))
- {
- # Copy generated headers to include directory.
- opendir(my $dh, 'src/backend/catalog/')
- || die "Can't opendir src/backend/catalog/ $!";
- my @def_headers =3D grep { /pg_\w+_d\.h$/ } readdir($dh);
- closedir $dh;
- foreach my $def_header (@def_headers)
- {
- copyFile(
- "src/backend/catalog/$def_header",
- "src/include/catalog/$def_header");
- }
- copyFile(
- 'src/backend/catalog/schemapg.h',
- 'src/include/catalog/schemapg.h');
- copyFile(
- 'src/backend/catalog/system_fk_info.h',
- 'src/include/catalog/system_fk_info.h');
- open(my $chs, '>', 'src/include/catalog/header-stamp')
- || confess "Could not touch header-stamp";
- close($chs);
- }
-
- my $nmf =3D Project::read_file('src/backend/nodes/Makefile');
- $nmf =3D~ s{\\\r?\n}{}g;
- $nmf =3D~ /^node_headers\s*:?=3D(.*)$/gm
- || croak "Could not find node_headers in Makefile\n";
- my @node_headers =3D split /\s+/, $1;
- @node_headers =3D grep { $_ ne '' } @node_headers;
- my @node_files =3D map { "src/include/$_" } @node_headers;
-
- my $need_node_support =3D 0;
- foreach my $nodefile (@node_files)
- {
- if (IsNewer('src/backend/nodes/node-support-stamp', $nodefile))
- {
- $need_node_support =3D 1;
- last;
- }
- }
- $need_node_support =3D 1
- if IsNewer(
- 'src/backend/nodes/node-support-stamp',
- 'src/backend/nodes/gen_node_support.pl');
-
- if ($need_node_support)
- {
- system(
- "perl src/backend/nodes/gen_node_support.pl --outdir src/backend/nodes =
@node_files"
- );
- open(my $f, '>', 'src/backend/nodes/node-support-stamp')
- || confess "Could not touch node-support-stamp";
- close($f);
- }
-
- if (IsNewer(
- 'src/include/nodes/nodetags.h',
- 'src/backend/nodes/nodetags.h'))
- {
- copyFile('src/backend/nodes/nodetags.h',
- 'src/include/nodes/nodetags.h');
- }
-
- open(my $o, '>', "doc/src/sgml/version.sgml")
- || croak "Could not write to version.sgml\n";
- print $o <
-
-EOF
- close($o);
- return;
-}
-
-# Read lines from input file and substitute symbols using the same
-# logic that config.status uses. There should be one call of this for
-# each AC_CONFIG_HEADERS call in configure.ac.
-#
-# If the "required" argument is true, we also keep track which of our
-# defines have been found and error out if any are left unused at the
-# end. That way we avoid accumulating defines in this file that are
-# no longer used by configure.
-sub GenerateConfigHeader
-{
- my ($self, $config_header, $defines, $required) =3D @_;
-
- my $config_header_in =3D $config_header . '.in';
-
- if ( IsNewer($config_header, $config_header_in)
- || IsNewer($config_header, __FILE__))
- {
- my %defines_copy =3D %$defines;
-
- open(my $i, '<', $config_header_in)
- || confess "Could not open $config_header_in\n";
- open(my $o, '>', $config_header)
- || confess "Could not write to $config_header\n";
-
- print $o
- "/* $config_header. Generated from $config_header_in by src/tools/msv=
c/Solution.pm. */\n";
-
- while (<$i>)
- {
- if (m/^#(\s*)undef\s+(\w+)/)
- {
- my $ws =3D $1;
- my $macro =3D $2;
- if (exists $defines->{$macro})
- {
- if (defined $defines->{$macro})
- {
- print $o "#${ws}define $macro ", $defines->{$macro},
- "\n";
- }
- else
- {
- print $o "/* #${ws}undef $macro */\n";
- }
- delete $defines_copy{$macro};
- }
- else
- {
- croak
- "undefined symbol: $macro at $config_header line $.";
- }
- }
- else
- {
- print $o $_;
- }
- }
- close($o);
- close($i);
-
- if ($required && scalar(keys %defines_copy) > 0)
- {
- croak "unused defines: " . join(' ', keys %defines_copy);
- }
- }
-}
-
-sub GenerateDefFile
-{
- my ($self, $deffile, $txtfile, $libname) =3D @_;
-
- if (IsNewer($deffile, $txtfile))
- {
- print "Generating $deffile...\n";
- open(my $if, '<', $txtfile) || confess("Could not open $txtfile\n");
- open(my $of, '>', $deffile) || confess("Could not open $deffile\n");
- print $of "LIBRARY $libname\nEXPORTS\n";
- while (<$if>)
- {
- next if (/^#/);
- next if (/^\s*$/);
- my ($f, $o) =3D split;
- print $of " $f @ $o\n";
- }
- close($of);
- close($if);
- }
- return;
-}
-
-sub AddProject
-{
- my ($self, $name, $type, $folder, $initialdir) =3D @_;
-
- my $proj =3D
- VSObjectFactory::CreateProject($self->{vcver}, $name, $type, $self);
- push @{ $self->{projects}->{$folder} }, $proj;
- $proj->AddDir($initialdir) if ($initialdir);
- if ($self->{options}->{zlib})
- {
- $proj->AddIncludeDir($self->{options}->{zlib} . '\include');
- $proj->AddLibrary($self->{options}->{zlib} . '\lib\zdll.lib');
- }
- if ($self->{options}->{openssl})
- {
- $proj->AddIncludeDir($self->{options}->{openssl} . '\include');
- my ($digit1, $digit2, $digit3) =3D $self->GetOpenSSLVersion();
-
- # Starting at version 1.1.0 the OpenSSL installers have
- # changed their library names from:
- # - libeay to libcrypto
- # - ssleay to libssl
- if ( ($digit1 >=3D '3' && $digit2 >=3D '0' && $digit3 >=3D '0')
- || ($digit1 >=3D '1' && $digit2 >=3D '1' && $digit3 >=3D '0'))
- {
- my $dbgsuffix;
- my $libsslpath;
- my $libcryptopath;
-
- # The format name of the libraries is slightly
- # different between the Win32 and Win64 platform, so
- # adapt.
- if (-e "$self->{options}->{openssl}/lib/VC/sslcrypto32MD.lib")
- {
- # Win32 here, with a debugging library set.
- $dbgsuffix =3D 1;
- $libsslpath =3D '\lib\VC\libssl32.lib';
- $libcryptopath =3D '\lib\VC\libcrypto32.lib';
- }
- elsif (-e "$self->{options}->{openssl}/lib/VC/sslcrypto64MD.lib")
- {
- # Win64 here, with a debugging library set.
- $dbgsuffix =3D 1;
- $libsslpath =3D '\lib\VC\libssl64.lib';
- $libcryptopath =3D '\lib\VC\libcrypto64.lib';
- }
- else
- {
- # On both Win32 and Win64 the same library
- # names are used without a debugging context.
- $dbgsuffix =3D 0;
- $libsslpath =3D '\lib\libssl.lib';
- $libcryptopath =3D '\lib\libcrypto.lib';
- }
-
- $proj->AddLibrary($self->{options}->{openssl} . $libsslpath,
- $dbgsuffix);
- $proj->AddLibrary($self->{options}->{openssl} . $libcryptopath,
- $dbgsuffix);
- }
- else
- {
- # Choose which set of libraries to use depending on if
- # debugging libraries are in place in the installer.
- if (-e "$self->{options}->{openssl}/lib/VC/ssleay32MD.lib")
- {
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\VC\ssleay32.lib', 1);
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\VC\libeay32.lib', 1);
- }
- else
- {
- # We don't expect the config-specific library
- # to be here, so don't ask for it in last
- # parameter.
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\ssleay32.lib', 0);
- $proj->AddLibrary(
- $self->{options}->{openssl} . '\lib\libeay32.lib', 0);
- }
- }
- }
- if ($self->{options}->{nls})
- {
- $proj->AddIncludeDir($self->{options}->{nls} . '\include');
- $proj->AddLibrary($self->{options}->{nls} . '\lib\libintl.lib');
- }
- if ($self->{options}->{gss})
- {
- $proj->AddIncludeDir($self->{options}->{gss} . '\include');
- $proj->AddIncludeDir($self->{options}->{gss} . '\include\krb5');
- if ($self->{platform} eq 'Win32')
- {
- $proj->AddLibrary(
- $self->{options}->{gss} . '\lib\i386\krb5_32.lib');
- $proj->AddLibrary(
- $self->{options}->{gss} . '\lib\i386\comerr32.lib');
- $proj->AddLibrary(
- $self->{options}->{gss} . '\lib\i386\gssapi32.lib');
- }
- else
- {
- $proj->AddLibrary(
- $self->{options}->{gss} . '\lib\amd64\krb5_64.lib');
- $proj->AddLibrary(
- $self->{options}->{gss} . '\lib\amd64\comerr64.lib');
- $proj->AddLibrary(
- $self->{options}->{gss} . '\lib\amd64\gssapi64.lib');
- }
- }
- if ($self->{options}->{iconv})
- {
- $proj->AddIncludeDir($self->{options}->{iconv} . '\include');
- $proj->AddLibrary($self->{options}->{iconv} . '\lib\iconv.lib');
- }
- if ($self->{options}->{icu})
- {
- $proj->AddIncludeDir($self->{options}->{icu} . '\include');
- if ($self->{platform} eq 'Win32')
- {
- $proj->AddLibrary($self->{options}->{icu} . '\lib\icuin.lib');
- $proj->AddLibrary($self->{options}->{icu} . '\lib\icuuc.lib');
- $proj->AddLibrary($self->{options}->{icu} . '\lib\icudt.lib');
- }
- else
- {
- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icuin.lib');
- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icuuc.lib');
- $proj->AddLibrary($self->{options}->{icu} . '\lib64\icudt.lib');
- }
- }
- if ($self->{options}->{xml})
- {
- $proj->AddIncludeDir($self->{options}->{xml} . '\include');
- $proj->AddIncludeDir($self->{options}->{xml} . '\include\libxml2');
- $proj->AddLibrary($self->{options}->{xml} . '\lib\libxml2.lib');
- }
- if ($self->{options}->{xslt})
- {
- $proj->AddIncludeDir($self->{options}->{xslt} . '\include');
- $proj->AddLibrary($self->{options}->{xslt} . '\lib\libxslt.lib');
- }
- if ($self->{options}->{lz4})
- {
- $proj->AddIncludeDir($self->{options}->{lz4} . '\include');
- $proj->AddLibrary($self->{options}->{lz4} . '\lib\liblz4.lib');
- }
- if ($self->{options}->{zstd})
- {
- $proj->AddIncludeDir($self->{options}->{zstd} . '\include');
- $proj->AddLibrary($self->{options}->{zstd} . '\lib\libzstd.lib');
- }
- if ($self->{options}->{uuid})
- {
- $proj->AddIncludeDir($self->{options}->{uuid} . '\include');
- $proj->AddLibrary($self->{options}->{uuid} . '\lib\uuid.lib');
- }
- return $proj;
-}
-
-sub Save
-{
- my ($self) =3D @_;
- my %flduid;
-
- $self->GenerateFiles();
- foreach my $fld (keys %{ $self->{projects} })
- {
- foreach my $proj (@{ $self->{projects}->{$fld} })
- {
- $proj->Save();
- }
- }
-
- open(my $sln, '>', "pgsql.sln") || croak "Could not write to pgsql.sln\n";
- print $sln <{solutionFile=
Version}
-# $self->{visualStudioName}
-EOF
-
- print $sln $self->GetAdditionalHeaders();
-
- foreach my $fld (keys %{ $self->{projects} })
- {
- foreach my $proj (@{ $self->{projects}->{$fld} })
- {
- print $sln <{name}", "$p=
roj->{name}$proj->{filenameExtension}", "$proj->{guid}"
-EndProject
-EOF
- }
- if ($fld ne "")
- {
- $flduid{$fld} =3D $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE';
- print $sln <{platform}=3D Debug|$self->{platform}
- Release|$self->{platform} =3D Release|$self->{platform}
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) =3D postSolution
-EOF
-
- foreach my $fld (keys %{ $self->{projects} })
- {
- foreach my $proj (@{ $self->{projects}->{$fld} })
- {
- print $sln <{guid}.Debug|$self->{platform}.ActiveCfg =3D Debug|$self->{platfo=
rm}
- $proj->{guid}.Debug|$self->{platform}.Build.0 =3D Debug|$self->{platfor=
m}
- $proj->{guid}.Release|$self->{platform}.ActiveCfg =3D Release|$self->{pl=
atform}
- $proj->{guid}.Release|$self->{platform}.Build.0 =3D Release|$self->{plat=
form}
-EOF
- }
- }
-
- print $sln <{projects} })
- {
- next if ($fld eq "");
- foreach my $proj (@{ $self->{projects}->{$fld} })
- {
- print $sln "\t\t$proj->{guid} =3D $flduid{$fld}\n";
- }
- }
-
- print $sln <{options}->{asserts});
- $cfg .=3D ' --enable-nls' if ($self->{options}->{nls});
- $cfg .=3D ' --enable-tap-tests' if ($self->{options}->{tap_tests});
- $cfg .=3D ' --with-ldap' if ($self->{options}->{ldap});
- $cfg .=3D ' --without-zlib' unless ($self->{options}->{zlib});
- $cfg .=3D ' --with-extra-version' if ($self->{options}->{extraver});
- $cfg .=3D ' --with-ssl=3Dopenssl' if ($self->{options}->{openssl});
- $cfg .=3D ' --with-uuid' if ($self->{options}->{uuid});
- $cfg .=3D ' --with-libxml' if ($self->{options}->{xml});
- $cfg .=3D ' --with-libxslt' if ($self->{options}->{xslt});
- $cfg .=3D ' --with-lz4' if ($self->{options}->{lz4});
- $cfg .=3D ' --with-zstd' if ($self->{options}->{zstd});
- $cfg .=3D ' --with-gssapi' if ($self->{options}->{gss});
- $cfg .=3D ' --with-icu' if ($self->{options}->{icu});
- $cfg .=3D ' --with-tcl' if ($self->{options}->{tcl});
- $cfg .=3D ' --with-perl' if ($self->{options}->{perl});
- $cfg .=3D ' --with-python' if ($self->{options}->{python});
- my $port =3D $self->{options}->{'--with-pgport'};
- $cfg .=3D " --with-pgport=3D$port" if defined($port);
-
- return $cfg;
-}
-
-package VS2015Solution;
-
-#
-# Package that encapsulates a Visual Studio 2015 solution file
-#
-
-use Carp;
-use strict;
-use warnings;
-use base qw(Solution);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{solutionFileVersion} =3D '12.00';
- $self->{vcver} =3D '14.00';
- $self->{visualStudioName} =3D 'Visual Studio 2015';
- $self->{VisualStudioVersion} =3D '14.0.24730.2';
- $self->{MinimumVisualStudioVersion} =3D '10.0.40219.1';
-
- return $self;
-}
-
-package VS2017Solution;
-
-#
-# Package that encapsulates a Visual Studio 2017 solution file
-#
-
-use Carp;
-use strict;
-use warnings;
-use base qw(Solution);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{solutionFileVersion} =3D '12.00';
- $self->{vcver} =3D '15.00';
- $self->{visualStudioName} =3D 'Visual Studio 2017';
- $self->{VisualStudioVersion} =3D '15.0.26730.3';
- $self->{MinimumVisualStudioVersion} =3D '10.0.40219.1';
-
- return $self;
-}
-
-package VS2019Solution;
-
-#
-# Package that encapsulates a Visual Studio 2019 solution file
-#
-
-use Carp;
-use strict;
-use warnings;
-use base qw(Solution);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{solutionFileVersion} =3D '12.00';
- $self->{vcver} =3D '16.00';
- $self->{visualStudioName} =3D 'Visual Studio 2019';
- $self->{VisualStudioVersion} =3D '16.0.28729.10';
- $self->{MinimumVisualStudioVersion} =3D '10.0.40219.1';
-
- return $self;
-}
-
-package VS2022Solution;
-
-#
-# Package that encapsulates a Visual Studio 2022 solution file
-#
-
-use Carp;
-use strict;
-use warnings;
-use base qw(Solution);
-
-no warnings qw(redefine); ## no critic
-
-sub new
-{
- my $classname =3D shift;
- my $self =3D $classname->SUPER::_new(@_);
- bless($self, $classname);
-
- $self->{solutionFileVersion} =3D '12.00';
- $self->{vcver} =3D '17.00';
- $self->{visualStudioName} =3D 'Visual Studio 2022';
- $self->{VisualStudioVersion} =3D '17.0.31903.59';
- $self->{MinimumVisualStudioVersion} =3D '10.0.40219.1';
-
- return $self;
-}
-
-sub GetAdditionalHeaders
-{
- my ($self, $f) =3D @_;
-
- return qq|VisualStudioVersion =3D $self->{VisualStudioVersion}
-MinimumVisualStudioVersion =3D $self->{MinimumVisualStudioVersion}
-|;
-}
-
-1;
diff --git a/src/tools/msvc/VSObjectFactory.pm b/src/tools/msvc/VSObjectFac=
tory.pm
deleted file mode 100644
index 9df2ab4282..0000000000
--- a/src/tools/msvc/VSObjectFactory.pm
+++ /dev/null
@@ -1,174 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package VSObjectFactory;
-
-#
-# Package that creates Visual Studio wrapper objects for msvc build
-#
-# src/tools/msvc/VSObjectFactory.pm
-#
-
-use Carp;
-use strict;
-use warnings;
-
-use Exporter;
-use Project;
-use Solution;
-use MSBuildProject;
-
-our (@ISA, @EXPORT);
-@ISA =3D qw(Exporter);
-@EXPORT =3D qw(CreateSolution CreateProject DetermineVisualStudioVersion);
-
-no warnings qw(redefine); ## no critic
-
-sub CreateSolution
-{
- my $visualStudioVersion =3D shift;
-
- if (!defined($visualStudioVersion))
- {
- $visualStudioVersion =3D DetermineVisualStudioVersion();
- }
-
- if ($visualStudioVersion eq '14.00')
- {
- return new VS2015Solution(@_);
- }
-
- # The version of nmake bundled in Visual Studio 2017 is greater
- # than 14.10 and less than 14.20. And the version number is
- # actually 15.00.
- elsif (
- ($visualStudioVersion ge '14.10' && $visualStudioVersion lt '14.20')
- || $visualStudioVersion eq '15.00')
- {
- return new VS2017Solution(@_);
- }
-
- # The version of nmake bundled in Visual Studio 2019 is greater
- # than 14.20 and less than 14.30. And the version number is
- # actually 16.00.
- elsif (
- ($visualStudioVersion ge '14.20' && $visualStudioVersion lt '14.30')
- || $visualStudioVersion eq '16.00')
- {
- return new VS2019Solution(@_);
- }
-
- # The version of nmake bundled in Visual Studio 2022 is greater
- # than 14.30 and less than 14.40. And the version number is
- # actually 17.00.
- elsif (
- ($visualStudioVersion ge '14.30' && $visualStudioVersion lt '14.40')
- || $visualStudioVersion eq '17.00')
- {
- return new VS2022Solution(@_);
- }
- else
- {
- croak
- "The requested Visual Studio version $visualStudioVersion is not suppo=
rted.";
- }
-}
-
-sub CreateProject
-{
- my $visualStudioVersion =3D shift;
-
- if (!defined($visualStudioVersion))
- {
- $visualStudioVersion =3D DetermineVisualStudioVersion();
- }
-
- if ($visualStudioVersion eq '14.00')
- {
- return new VC2015Project(@_);
- }
-
- # The version of nmake bundled in Visual Studio 2017 is greater
- # than 14.10 and less than 14.20. And the version number is
- # actually 15.00.
- elsif (
- ($visualStudioVersion ge '14.10' && $visualStudioVersion lt '14.20')
- || $visualStudioVersion eq '15.00')
- {
- return new VC2017Project(@_);
- }
-
- # The version of nmake bundled in Visual Studio 2019 is greater
- # than 14.20 and less than 14.30. And the version number is
- # actually 16.00.
- elsif (
- ($visualStudioVersion ge '14.20' && $visualStudioVersion lt '14.30')
- || $visualStudioVersion eq '16.00')
- {
- return new VC2019Project(@_);
- }
-
- # The version of nmake bundled in Visual Studio 2022 is greater
- # than 14.30 and less than 14.40. And the version number is
- # actually 17.00.
- elsif (
- ($visualStudioVersion ge '14.30' && $visualStudioVersion lt '14.40')
- || $visualStudioVersion eq '17.00')
- {
- return new VC2022Project(@_);
- }
- else
- {
- croak
- "The requested Visual Studio version $visualStudioVersion is not suppo=
rted.";
- }
-}
-
-sub DetermineVisualStudioVersion
-{
- if ($^O eq "MSWin32")
- {
- # To determine version of Visual Studio we use nmake as it has
- # existed for a long time and still exists in current Visual
- # Studio versions.
- my $output =3D `nmake /? 2>&1`;
- $? >> 8 =3D=3D 0
- or croak
- "Unable to determine Visual Studio version: The nmake command wasn't f=
ound.";
- if ($output =3D~ /(\d+)\.(\d+)\.\d+(\.\d+)?/)
- {
- return _GetVisualStudioVersion($1, $2);
- }
-
- croak
- "Unable to determine Visual Studio version: The nmake version could no=
t be determined.";
- }
- else
- {
- # fake version
- return '17.00';
- }
-}
-
-sub _GetVisualStudioVersion
-{
- my ($major, $minor) =3D @_;
-
- # The major visual studio that is supported has nmake
- # version <=3D 14.40, so stick with it as the latest version
- # if bumping on something even newer.
- if ($major >=3D 14 && $minor >=3D 40)
- {
- carp
- "The determined version of Visual Studio is newer than the latest supp=
orted version. Returning the latest supported version instead.";
- return '14.30';
- }
- elsif ($major < 12)
- {
- croak
- "Unable to determine Visual Studio version: Visual Studio versions bef=
ore 12.0 aren't supported.";
- }
- return "$major.$minor";
-}
-
-1;
diff --git a/src/tools/msvc/build.bat b/src/tools/msvc/build.bat
deleted file mode 100755
index 171f7498e2..0000000000
--- a/src/tools/msvc/build.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@echo off
-REM src/tools/msvc/build.bat
-REM all the logic for this now belongs in build.pl. This file really
-REM only exists so you don't have to type "perl build.pl"
-REM Resist any temptation to add any logic here.
-@perl %~dp0/build.pl %*
diff --git a/src/tools/msvc/build.pl b/src/tools/msvc/build.pl
deleted file mode 100644
index 9853e5c3d8..0000000000
--- a/src/tools/msvc/build.pl
+++ /dev/null
@@ -1,92 +0,0 @@
-# -*-perl-*- hey - emacs - this is a perl file
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-#
-# Script that provides 'make' functionality for msvc builds.
-#
-# src/tools/msvc/build.pl
-#
-use strict;
-use warnings;
-
-use FindBin;
-use lib $FindBin::RealBin;
-
-use Cwd;
-
-use Mkvcbuild;
-
-sub usage
-{
- die( "Usage: build.pl [ [ ] ]\n"
- . "Options are case-insensitive.\n"
- . " configuration: Release | Debug. This sets the configuration\n"
- . " to build. Default is Release.\n"
- . " component: name of component to build. An empty value means\n"
- . " to build all components.\n");
-}
-
-chdir('../../..') if (-d '../msvc' && -d '../../../src');
-die 'Must run from root or msvc directory'
- unless (-d 'src/tools/msvc' && -d 'src');
-
-usage() unless scalar(@ARGV) <=3D 2;
-
-# buildenv.pl is for specifying the build environment settings
-# it should contain lines like:
-# $ENV{PATH} =3D "c:/path/to/bison/bin;$ENV{PATH}";
-
-if (-e "src/tools/msvc/buildenv.pl")
-{
- do "./src/tools/msvc/buildenv.pl";
-}
-elsif (-e "./buildenv.pl")
-{
- do "./buildenv.pl";
-}
-
-# set up the project
-our $config;
-do "./src/tools/msvc/config_default.pl";
-do "./src/tools/msvc/config.pl" if (-f "src/tools/msvc/config.pl");
-
-my $vcver =3D Mkvcbuild::mkvcbuild($config);
-
-# check what sort of build we are doing
-my $bconf =3D $ENV{CONFIG} || "Release";
-my $msbflags =3D $ENV{MSBFLAGS} || "";
-my $buildwhat =3D $ARGV[1] || "";
-
-if (defined($ARGV[0]))
-{
- if (uc($ARGV[0]) eq 'DEBUG')
- {
- $bconf =3D "Debug";
- }
- elsif (uc($ARGV[0]) ne "RELEASE")
- {
- $buildwhat =3D $ARGV[0] || "";
- }
-}
-
-# ... and do it
-
-if ($buildwhat)
-{
- system(
- "msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=
=3D$bconf"
- );
-}
-else
-{
- system(
- "msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=3D$bconf"
- );
-}
-
-# report status
-
-my $status =3D $? >> 8;
-
-exit $status;
diff --git a/src/tools/msvc/clean.bat b/src/tools/msvc/clean.bat
deleted file mode 100755
index ac8da581e4..0000000000
--- a/src/tools/msvc/clean.bat
+++ /dev/null
@@ -1,160 +0,0 @@
-@echo off
-REM src/tools/msvc/clean.bat
-
-set DIST=3D0
-if "%1"=3D=3D"dist" set DIST=3D1
-
-setlocal
-
-cd "%~dp0\..\..\.."
-
-if exist debug rd /s /q debug
-if exist release rd /s /q release
-for %%f in (*.vcproj) do del %%f
-for %%f in (*.vcxproj) do del %%f
-for %%f in (*.vcxproj.user) do del %%f
-if exist pgsql.sln del /q pgsql.sln
-if exist pgsql.sln.cache del /q pgsql.sln.cache
-if exist pgsql.sdf del /q pgsql.sdf
-if exist pgsql.suo del /q /a:H pgsql.suo
-del /s /q src\bin\win32ver.rc 2> NUL
-del /s /q src\interfaces\win32ver.rc 2> NUL
-if exist src\backend\win32ver.rc del /q src\backend\win32ver.rc
-if exist src\backend\replication\libpqwalreceiver\win32ver.rc del /q src\b=
ackend\replication\libpqwalreceiver\win32ver.rc
-if exist src\backend\replication\pgoutput\win32ver.rc del /q src\backend\r=
eplication\pgoutput\win32ver.rc
-if exist src\backend\snowball\win32ver.rc del /q src\backend\snowball\win3=
2ver.rc
-if exist src\interfaces\ecpg\test\win32ver.rc del /q src\interfaces\ecpg\t=
est\win32ver.rc
-if exist src\pl\plperl\win32ver.rc del /q src\pl\plperl\win32ver.rc
-if exist src\pl\plpgsql\src\win32ver.rc del /q src\pl\plpgsql\src\win32ver=
=2Erc
-if exist src\pl\plpython\win32ver.rc del /q src\pl\plpython\win32ver.rc
-if exist src\pl\tcl\win32ver.rc del /q src\pl\tcl\win32ver.rc
-if exist src\test\isolation\win32ver.rc del /q src\test\isolation\win32ver=
=2Erc
-if exist src\test\regress\win32ver.rc del /q src\test\regress\win32ver.rc
-if exist src\timezone\win32ver.rc del /q src\timezone\win32ver.rc
-
-for /d %%f in (src\interfaces\ecpg\*) do if exist %%f\win32ver.rc del /q %=
%f\win32ver.rc
-for /d %%f in (contrib\*) do if exist %%f\win32ver.rc del /q %%f\win32ver.=
rc
-for /d %%f in (src\backend\utils\mb\conversion_procs\*) do if exist %%f\wi=
n32ver.rc del /q %%f\win32ver.rc
-for /d %%f in (src\test\modules\*) do if exist %%f\win32ver.rc del /q %%f\=
win32ver.rc
-
-REM Delete files created with GenerateFiles() in Solution.pm
-if exist src\include\pg_config.h del /q src\include\pg_config.h
-if exist src\include\pg_config_ext.h del /q src\include\pg_config_ext.h
-if exist src\include\pg_config_os.h del /q src\include\pg_config_os.h
-if exist src\include\nodes\nodetags.h del /q src\include\nodes\nodetags.h
-if exist src\include\utils\errcodes.h del /q src\include\utils\errcodes.h
-if exist src\include\utils\fmgroids.h del /q src\include\utils\fmgroids.h
-if exist src\include\utils\fmgrprotos.h del /q src\include\utils\fmgrproto=
s.h
-if exist src\include\storage\lwlocknames.h del /q src\include\storage\lwlo=
cknames.h
-if exist src\include\utils\wait_event_types.h del /q src\include\utils\wai=
t_event_types.h
-if exist src\include\utils\probes.h del /q src\include\utils\probes.h
-if exist src\include\catalog\schemapg.h del /q src\include\catalog\schemap=
g.h
-if exist src\include\catalog\system_fk_info.h del /q src\include\catalog\s=
ystem_fk_info.h
-if exist src\include\catalog\pg_*_d.h del /q src\include\catalog\pg_*_d.h
-if exist src\include\catalog\header-stamp del /q src\include\catalog\heade=
r-stamp
-if exist doc\src\sgml\version.sgml del /q doc\src\sgml\version.sgml
-
-if %DIST%=3D=3D1 if exist src\backend\utils\activity\pgstat_wait_event.c d=
el /q src\backend\utils\activity\pgstat_wait_event.c
-if %DIST%=3D=3D1 if exist src\backend\utils\activity\wait_event_funcs_data=
=2Ec del /q src\backend\utils\activity\wait_event_funcs_data.c
-if %DIST%=3D=3D1 if exist src\backend\utils\activity\wait_event_types.h de=
l /q src\backend\utils\activity\wait_event_types.h
-if %DIST%=3D=3D1 if exist src\backend\utils\fmgroids.h del /q src\backend\=
utils\fmgroids.h
-if %DIST%=3D=3D1 if exist src\backend\utils\fmgrprotos.h del /q src\backen=
d\utils\fmgrprotos.h
-if %DIST%=3D=3D1 if exist src\backend\utils\fmgrtab.c del /q src\backend\u=
tils\fmgrtab.c
-if %DIST%=3D=3D1 if exist src\backend\utils\fmgr-stamp del /q src\backend\=
utils\fmgr-stamp
-if %DIST%=3D=3D1 if exist src\backend\utils\errcodes.h del /q src\backend\=
utils\errcodes.h
-if %DIST%=3D=3D1 if exist src\backend\nodes\node-support-stamp del /q src\=
backend\nodes\node-support-stamp
-if %DIST%=3D=3D1 for %%F IN (copy equal out queryjumble read) do if exist =
src\backend\nodes\%%Ffuncs.funcs.c del /q src\backend\nodes\%%Ffuncs.funcs.c
-if %DIST%=3D=3D1 for %%F IN (copy equal out queryjumble read) do if exist =
src\backend\nodes\%%Ffuncs.switch.c del /q src\backend\nodes\%%Ffuncs.switc=
h.c
-if %DIST%=3D=3D1 if exist src\backend\nodes\nodetags.h del /q src\backend\=
nodes\nodetags.h
-if %DIST%=3D=3D1 if exist src\backend\storage\lmgr\lwlocknames.c del /q sr=
c\backend\storage\lmgr\lwlocknames.c
-if %DIST%=3D=3D1 if exist src\backend\storage\lmgr\lwlocknames.h del /q sr=
c\backend\storage\lmgr\lwlocknames.h
-if %DIST%=3D=3D1 if exist src\pl\plpython\spiexceptions.h del /q src\pl\pl=
python\spiexceptions.h
-if %DIST%=3D=3D1 if exist src\pl\plpgsql\src\plerrcodes.h del /q src\pl\pl=
pgsql\src\plerrcodes.h
-if %DIST%=3D=3D1 if exist src\pl\tcl\pltclerrcodes.h del /q src\pl\tcl\plt=
clerrcodes.h
-if %DIST%=3D=3D1 if exist src\bin\psql\sql_help.c del /q src\bin\psql\sql_=
help.c
-if %DIST%=3D=3D1 if exist src\bin\psql\sql_help.h del /q src\bin\psql\sql_=
help.h
-if %DIST%=3D=3D1 if exist src\common\kwlist_d.h del /q src\common\kwlist_d=
=2Eh
-if %DIST%=3D=3D1 if exist src\pl\plpgsql\src\pl_reserved_kwlist_d.h del /q=
src\pl\plpgsql\src\pl_reserved_kwlist_d.h
-if %DIST%=3D=3D1 if exist src\pl\plpgsql\src\pl_unreserved_kwlist_d.h del =
/q src\pl\plpgsql\src\pl_unreserved_kwlist_d.h
-if %DIST%=3D=3D1 if exist src\interfaces\ecpg\preproc\c_kwlist_d.h del /q =
src\interfaces\ecpg\preproc\c_kwlist_d.h
-if %DIST%=3D=3D1 if exist src\interfaces\ecpg\preproc\ecpg_kwlist_d.h del =
/q src\interfaces\ecpg\preproc\ecpg_kwlist_d.h
-if %DIST%=3D=3D1 if exist src\interfaces\ecpg\preproc\preproc.y del /q src=
\interfaces\ecpg\preproc\preproc.y
-if %DIST%=3D=3D1 if exist src\backend\catalog\postgres.bki del /q src\back=
end\catalog\postgres.bki
-if %DIST%=3D=3D1 if exist src\backend\catalog\system_constraints.sql del /=
q src\backend\catalog\system_constraints.sql
-if %DIST%=3D=3D1 if exist src\backend\catalog\schemapg.h del /q src\backen=
d\catalog\schemapg.h
-if %DIST%=3D=3D1 if exist src\backend\catalog\system_fk_info.h del /q src\=
backend\catalog\system_fk_info.h
-if %DIST%=3D=3D1 if exist src\backend\catalog\pg_*_d.h del /q src\backend\=
catalog\pg_*_d.h
-if %DIST%=3D=3D1 if exist src\backend\catalog\bki-stamp del /q src\backend=
\catalog\bki-stamp
-if %DIST%=3D=3D1 if exist src\backend\parser\scan.c del /q src\backend\par=
ser\scan.c
-if %DIST%=3D=3D1 if exist src\backend\parser\gram.c del /q src\backend\par=
ser\gram.c
-if %DIST%=3D=3D1 if exist src\backend\parser\gram.h del /q src\backend\par=
ser\gram.h
-if %DIST%=3D=3D1 if exist src\backend\bootstrap\bootscanner.c del /q src\b=
ackend\bootstrap\bootscanner.c
-if %DIST%=3D=3D1 if exist src\backend\bootstrap\bootparse.c del /q src\bac=
kend\bootstrap\bootparse.c
-if %DIST%=3D=3D1 if exist src\backend\bootstrap\bootparse.h del /q src\bac=
kend\bootstrap\bootparse.h
-if %DIST%=3D=3D1 if exist src\backend\utils\adt\jsonpath_gram.c del /q src=
\backend\utils\adt\jsonpath_gram.c
-if %DIST%=3D=3D1 if exist src\backend\utils\adt\jsonpath_gram.h del /q src=
\backend\utils\adt\jsonpath_gram.h
-if %DIST%=3D=3D1 if exist src\backend\utils\adt\jsonpath_scan.c del /q src=
\backend\utils\adt\jsonpath_scan.c
-if %DIST%=3D=3D1 if exist src\backend\utils\misc\guc-file.c del /q src\bac=
kend\utils\misc\guc-file.c
-if %DIST%=3D=3D1 if exist src\backend\replication\repl_scanner.c del /q sr=
c\backend\replication\repl_scanner.c
-if %DIST%=3D=3D1 if exist src\backend\replication\repl_gram.c del /q src\b=
ackend\replication\repl_gram.c
-if %DIST%=3D=3D1 if exist src\backend\replication\repl_gram.h del /q src\b=
ackend\replication\repl_gram.h
-if %DIST%=3D=3D1 if exist src\backend\replication\syncrep_scanner.c del /q=
src\backend\replication\syncrep_scanner.c
-if %DIST%=3D=3D1 if exist src\backend\replication\syncrep_gram.c del /q sr=
c\backend\replication\syncrep_gram.c
-if %DIST%=3D=3D1 if exist src\backend\replication\syncrep_gram.h del /q sr=
c\backend\replication\syncrep_gram.h
-
-
-if exist src\interfaces\libpq\libpqdll.def del /q src\interfaces\libpq\lib=
pqdll.def
-if exist src\interfaces\ecpg\compatlib\compatlib.def del /q src\interfaces=
\ecpg\compatlib\compatlib.def
-if exist src\interfaces\ecpg\ecpglib\ecpglib.def del /q src\interfaces\ecp=
g\ecpglib\ecpglib.def
-if exist src\interfaces\ecpg\include\ecpg_config.h del /q src\interfaces\e=
cpg\include\ecpg_config.h
-if exist src\interfaces\ecpg\pgtypeslib\pgtypeslib.def del /q src\interfac=
es\ecpg\pgtypeslib\pgtypeslib.def
-if %DIST%=3D=3D1 if exist src\interfaces\ecpg\preproc\pgc.c del /q src\int=
erfaces\ecpg\preproc\pgc.c
-if %DIST%=3D=3D1 if exist src\interfaces\ecpg\preproc\preproc.c del /q src=
\interfaces\ecpg\preproc\preproc.c
-if %DIST%=3D=3D1 if exist src\interfaces\ecpg\preproc\preproc.h del /q src=
\interfaces\ecpg\preproc\preproc.h
-
-if exist src\port\pg_config_paths.h del /q src\port\pg_config_paths.h
-
-if exist src\pl\plperl\SPI.c del /q src\pl\plperl\SPI.c
-if exist src\pl\plperl\Util.c del /q src\pl\plperl\Util.c
-if exist src\pl\plperl\perlchunks.h del /q src\pl\plperl\perlchunks.h
-if exist src\pl\plperl\plperl_opmask.h del /q src\pl\plperl\plperl_opmask.h
-if %DIST%=3D=3D1 if exist src\pl\plpgsql\src\pl_gram.c del /q src\pl\plpgs=
ql\src\pl_gram.c
-if %DIST%=3D=3D1 if exist src\pl\plpgsql\src\pl_gram.h del /q src\pl\plpgs=
ql\src\pl_gram.h
-
-if %DIST%=3D=3D1 if exist src\fe_utils\psqlscan.c del /q src\fe_utils\psql=
scan.c
-if %DIST%=3D=3D1 if exist src\bin\psql\psqlscanslash.c del /q src\bin\psql=
\psqlscanslash.c
-if %DIST%=3D=3D1 if exist src\bin\pgbench\exprscan.c del /q src\bin\pgbenc=
h\exprscan.c
-if %DIST%=3D=3D1 if exist src\bin\pgbench\exprparse.c del /q src\bin\pgben=
ch\exprparse.c
-if %DIST%=3D=3D1 if exist src\bin\pgbench\exprparse.h del /q src\bin\pgben=
ch\exprparse.h
-
-if %DIST%=3D=3D1 if exist contrib\cube\cubescan.c del /q contrib\cube\cube=
scan.c
-if %DIST%=3D=3D1 if exist contrib\cube\cubeparse.c del /q contrib\cube\cub=
eparse.c
-if %DIST%=3D=3D1 if exist contrib\cube\cubeparse.h del /q contrib\cube\cub=
eparse.h
-if %DIST%=3D=3D1 if exist contrib\fuzzystrmatch\daitch_mokotoff.h del /q c=
ontrib\fuzzystrmatch\daitch_mokotoff.h
-if %DIST%=3D=3D1 if exist contrib\seg\segscan.c del /q contrib\seg\segscan=
=2Ec
-if %DIST%=3D=3D1 if exist contrib\seg\segparse.c del /q contrib\seg\segpar=
se.c
-if %DIST%=3D=3D1 if exist contrib\seg\segparse.h del /q contrib\seg\segpar=
se.h
-
-if exist src\test\regress\tmp_check rd /s /q src\test\regress\tmp_check
-if exist contrib\spi\refint.dll del /q contrib\spi\refint.dll
-if exist contrib\spi\autoinc.dll del /q contrib\spi\autoinc.dll
-if exist src\test\regress\regress.dll del /q src\test\regress\regress.dll
-if exist src\test\regress\refint.dll del /q src\test\regress\refint.dll
-if exist src\test\regress\autoinc.dll del /q src\test\regress\autoinc.dll
-if %DIST%=3D=3D1 if exist src\test\isolation\specscanner.c del /q src\test=
\isolation\specscanner.c
-if %DIST%=3D=3D1 if exist src\test\isolation\specparse.c del /q src\test\i=
solation\specparse.c
-if %DIST%=3D=3D1 if exist src\test\isolation\specparse.h del /q src\test\i=
solation\specparse.h
-
-for /d %%f in (contrib\* src\bin\* src\test\* src\test\modules\*
- ) do if exist %%f\tmp_check rd /s /q %%f\tmp_check
-
-REM Clean up datafiles built with contrib
-REM cd contrib
-REM for /r %%f in (*.sql) do if exist %%f.in del %%f
-
-cd "%~dp0"
-
-REM Clean up ecpg regression test files
-msbuild ecpg_regression.proj /NoLogo /v:q %MSBFLAGS% /t:clean
-
-goto :eof
diff --git a/src/tools/msvc/config_default.pl b/src/tools/msvc/config_defau=
lt.pl
deleted file mode 100644
index 8945e772c2..0000000000
--- a/src/tools/msvc/config_default.pl
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-# Configuration arguments for vcbuild.
-use strict;
-use warnings;
-
-our $config =3D {
- asserts =3D> 0, # --enable-cassert
-
- # blocksize =3D> 8, # --with-blocksize, 8kB by default
- # wal_blocksize =3D> 8, # --with-wal-blocksize, 8kB by default
- ldap =3D> 1, # --with-ldap
- extraver =3D> undef, # --with-extra-version=3D
- gss =3D> undef, # --with-gssapi=3D
- icu =3D> undef, # --with-icu=3D
- lz4 =3D> undef, # --with-lz4=3D
- zstd =3D> undef, # --with-zstd=3D
- nls =3D> undef, # --enable-nls=3D
- tap_tests =3D> undef, # --enable-tap-tests
- tcl =3D> undef, # --with-tcl=3D
- perl =3D> undef, # --with-perl=3D
- python =3D> undef, # --with-python=3D
- openssl =3D> undef, # --with-ssl=3Dopenssl with
- uuid =3D> undef, # --with-uuid=3D
- xml =3D> undef, # --with-libxml=3D
- xslt =3D> undef, # --with-libxslt=3D
- iconv =3D> undef, # (not in configure, path to iconv)
- zlib =3D> undef # --with-zlib=3D
-};
-
-1;
diff --git a/src/tools/msvc/dummylib/README b/src/tools/msvc/dummylib/README
deleted file mode 100644
index 7b63d0ed43..0000000000
--- a/src/tools/msvc/dummylib/README
+++ /dev/null
@@ -1,13 +0,0 @@
-
-src/tools/msvc/dummylib
-
-This directory contains just enough of a dummy library to allow checking of
-the programs in src/tools/msvc and src/tools/win32tzlist.pl with
-perl -cw, even on machines that lack the Win32 perl infrastructure.
-
-invoke via:
-
-PERL5LIB=3Dsrc/tools/msvc/dummylib perl -cw $file
-
-This is the only use that should be made of this directory. Attempting act=
ually
-running of any programs using this library will result in a lot of grief.
diff --git a/src/tools/msvc/dummylib/Win32.pm b/src/tools/msvc/dummylib/Win=
32.pm
deleted file mode 100644
index df2d7a2929..0000000000
--- a/src/tools/msvc/dummylib/Win32.pm
+++ /dev/null
@@ -1,7 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Win32;
-use strict;
-use warnings;
-1;
diff --git a/src/tools/msvc/dummylib/Win32/Registry.pm b/src/tools/msvc/dum=
mylib/Win32/Registry.pm
deleted file mode 100644
index e14636eb31..0000000000
--- a/src/tools/msvc/dummylib/Win32/Registry.pm
+++ /dev/null
@@ -1,16 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Win32::Registry;
-
-use strict;
-use warnings;
-
-use vars qw($HKEY_LOCAL_MACHINE);
-
-use Exporter ();
-our (@EXPORT, @ISA);
-@ISA =3D qw(Exporter);
-@EXPORT =3D qw($HKEY_LOCAL_MACHINE);
-
-1;
diff --git a/src/tools/msvc/dummylib/Win32API/File.pm b/src/tools/msvc/dumm=
ylib/Win32API/File.pm
deleted file mode 100644
index 7baf34c4e5..0000000000
--- a/src/tools/msvc/dummylib/Win32API/File.pm
+++ /dev/null
@@ -1,17 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-package Win32API::File;
-
-use strict;
-use warnings;
-
-use constant { SEM_FAILCRITICALERRORS =3D> 1, SEM_NOGPFAULTERRORBOX =3D> 2=
};
-sub SetErrormode { }
-use Exporter;
-our (@ISA, @EXPORT_OK, %EXPORT_TAGS);
-@ISA =3D qw(Exporter);
-@EXPORT_OK =3D qw(SetErrorMode SEM_FAILCRITICALERRORS SEM_NOGPFAULTERRORBO=
X);
-%EXPORT_TAGS =3D (SEM_ =3D> [qw(SEM_FAILCRITICALERRORS SEM_NOGPFAULTERRORB=
OX)]);
-
-1;
diff --git a/src/tools/msvc/ecpg_regression.proj b/src/tools/msvc/ecpg_regr=
ession.proj
deleted file mode 100644
index 0ec60a275e..0000000000
--- a/src/tools/msvc/ecpg_regression.proj
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
- ..\..\interfaces\ecpg\test
- Debug
- ..\..\..\..\..\$(CONFIG)\
-
-
-
- d
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/tools/msvc/install.bat b/src/tools/msvc/install.bat
deleted file mode 100644
index d02b80826b..0000000000
--- a/src/tools/msvc/install.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@echo off
-REM src/tools/msvc/install.bat
-REM all the logic for this now belongs in install.pl. This file really
-REM only exists so you don't have to type "perl install.pl"
-REM Resist any temptation to add any logic here.
-@perl %~dp0/install.pl %*
diff --git a/src/tools/msvc/install.pl b/src/tools/msvc/install.pl
deleted file mode 100755
index 8de7cee90f..0000000000
--- a/src/tools/msvc/install.pl
+++ /dev/null
@@ -1,39 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-#
-# Script that provides 'make install' functionality for msvc builds
-#
-# src/tools/msvc/install.pl
-#
-use strict;
-use warnings;
-
-use FindBin;
-use lib $FindBin::RealBin;
-
-use Install qw(Install);
-
-# buildenv.pl is for specifying the build environment settings
-# it should contain lines like:
-# $ENV{PATH} =3D "c:/path/to/bison/bin;$ENV{PATH}";
-
-if (-e "src/tools/msvc/buildenv.pl")
-{
- do "./src/tools/msvc/buildenv.pl";
-}
-elsif (-e "./buildenv.pl")
-{
- do "./buildenv.pl";
-}
-
-my $target =3D shift || Usage();
-my $insttype =3D shift;
-Install($target, $insttype);
-
-sub Usage
-{
- print "Usage: install.pl [installtype]\n";
- print "installtype: client\n";
- exit(1);
-}
diff --git a/src/tools/msvc/mkvcbuild.pl b/src/tools/msvc/mkvcbuild.pl
deleted file mode 100644
index 7f94b1a6c9..0000000000
--- a/src/tools/msvc/mkvcbuild.pl
+++ /dev/null
@@ -1,31 +0,0 @@
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-#
-# Script that parses Unix style build environment and generates build files
-# for building with Visual Studio.
-#
-# src/tools/msvc/mkvcbuild.pl
-#
-use strict;
-use warnings;
-
-use FindBin;
-use lib $FindBin::RealBin;
-
-use Mkvcbuild;
-
-chdir('../../..') if (-d '../msvc' && -d '../../../src');
-die 'Must run from root or msvc directory'
- unless (-d 'src/tools/msvc' && -d 'src');
-
-die 'Could not find config_default.pl'
- unless (-f 'src/tools/msvc/config_default.pl');
-print "Warning: no config.pl found, using default.\n"
- unless (-f 'src/tools/msvc/config.pl');
-
-our $config;
-do './src/tools/msvc/config_default.pl';
-do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
-
-Mkvcbuild::mkvcbuild($config);
diff --git a/src/tools/msvc/pgbison.bat b/src/tools/msvc/pgbison.bat
deleted file mode 100755
index dc8ac4a2cf..0000000000
--- a/src/tools/msvc/pgbison.bat
+++ /dev/null
@@ -1,7 +0,0 @@
-@echo off
-
-REM src/tools/msvc/pgbison.bat
-REM all the logic for this now belongs in pgbison.pl. This file really
-REM only exists so you don't have to type "perl src/tools/msvc/pgbison.pl"
-REM Resist any temptation to add any logic here.
-@perl %~dp0/pgbison.pl %*
diff --git a/src/tools/msvc/pgbison.pl b/src/tools/msvc/pgbison.pl
deleted file mode 100644
index 25df6699b5..0000000000
--- a/src/tools/msvc/pgbison.pl
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*-perl-*- hey - emacs - this is a perl file
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-# src/tools/msvc/pgbison.pl
-
-use strict;
-use warnings;
-
-use File::Basename;
-
-# assume we are in the postgres source root
-
-do './src/tools/msvc/buildenv.pl' if -e 'src/tools/msvc/buildenv.pl';
-
-my ($bisonver) =3D `bison -V`; # grab first line
-$bisonver =3D (split(/\s+/, $bisonver))[3]; # grab version number
-
-unless ($bisonver ge '2.3')
-{
- print "WARNING! Bison install not found, or unsupported Bison version.\n";
- print "echo Attempting to build without.\n";
- exit 0;
-}
-
-my $input =3D shift;
-if ($input !~ /\.y$/)
-{
- print "Input must be a .y file\n";
- exit 1;
-}
-elsif (!-e $input)
-{
- print "Input file $input not found\n";
- exit 1;
-}
-
-(my $output =3D $input) =3D~ s/\.y$/.c/;
-
-# plpgsql just has to be different
-$output =3D~ s/gram\.c$/pl_gram.c/ if $input =3D~ /src.pl.plpgsql.src.gram=
\.y$/;
-
-my $makefile =3D dirname($input) . "/Makefile";
-my ($mf, $make);
-open($mf, '<', $makefile);
-local $/ =3D undef;
-$make =3D <$mf>;
-close($mf);
-my $basetarg =3D basename($output);
-my $headerflag =3D ($make =3D~ /^$basetarg:\s+BISONFLAGS\b.*-d/m ? '-d' : =
'');
-
-my $nodep =3D $bisonver ge '3.0' ? "-Wno-deprecated" : "";
-
-system("bison $nodep $headerflag $input -o $output");
-exit $? >> 8;
diff --git a/src/tools/msvc/pgflex.bat b/src/tools/msvc/pgflex.bat
deleted file mode 100755
index f20834ba9b..0000000000
--- a/src/tools/msvc/pgflex.bat
+++ /dev/null
@@ -1,7 +0,0 @@
-@echo off
-
-REM src/tools/msvc/pgflex.bat
-REM all the logic for this now belongs in pgflex.pl. This file really
-REM only exists so you don't have to type "perl src/tools/msvc/pgflex.pl"
-REM Resist any temptation to add any logic here.
-@perl %~dp0/pgflex.pl %*
diff --git a/src/tools/msvc/pgflex.pl b/src/tools/msvc/pgflex.pl
deleted file mode 100644
index c308a08b55..0000000000
--- a/src/tools/msvc/pgflex.pl
+++ /dev/null
@@ -1,108 +0,0 @@
-# -*-perl-*- hey - emacs - this is a perl file
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-# src/tools/msvc/pgflex.pl
-
-use strict;
-use warnings;
-
-use File::Basename;
-
-# silence flex bleatings about file path style
-$ENV{CYGWIN} =3D 'nodosfilewarning';
-
-# assume we are in the postgres source root
-
-do './src/tools/msvc/buildenv.pl' if -e 'src/tools/msvc/buildenv.pl';
-
-my ($flexver) =3D `flex -V`; # grab first line
-$flexver =3D (split(/\s+/, $flexver))[1];
-$flexver =3D~ s/[^0-9.]//g;
-my @verparts =3D split(/\./, $flexver);
-unless ($verparts[0] =3D=3D 2
- && ($verparts[1] > 5 || ($verparts[1] =3D=3D 5 && $verparts[2] >=3D 35)))
-{
- print "WARNING! Flex install not found, or unsupported Flex version.\n";
- print "echo Attempting to build without.\n";
- exit 0;
-}
-
-my $input =3D shift;
-if ($input !~ /\.l$/)
-{
- print "Input must be a .l file\n";
- exit 1;
-}
-elsif (!-e $input)
-{
- print "Input file $input not found\n";
- exit 1;
-}
-
-(my $output =3D $input) =3D~ s/\.l$/.c/;
-
-# get flex flags from make file
-my $makefile =3D dirname($input) . "/Makefile";
-my ($mf, $make);
-open($mf, '<', $makefile);
-local $/ =3D undef;
-$make =3D <$mf>;
-close($mf);
-my $basetarg =3D basename($output);
-my $flexflags =3D ($make =3D~ /^$basetarg:\s*FLEXFLAGS\s*=3D\s*(\S.*)/m ? =
$1 : '');
-
-system("flex $flexflags -o$output $input");
-if ($? =3D=3D 0)
-{
-
- # Check for "%option reentrant" in .l file.
- my $lfile;
- open($lfile, '<', $input) || die "opening $input for reading: $!";
- my $lcode =3D <$lfile>;
- close($lfile);
- if ($lcode =3D~ /\%option\sreentrant/)
- {
-
- # Reentrant scanners usually need a fix to prevent
- # "unused variable" warnings with older flex versions.
- system("perl src\\tools\\fix-old-flex-code.pl $output");
- }
- else
- {
-
- # For non-reentrant scanners we need to fix up the yywrap
- # macro definition to keep the MS compiler happy.
- # For reentrant scanners (like the core scanner) we do not
- # need to (and must not) change the yywrap definition.
- my $cfile;
- open($cfile, '<', $output) || die "opening $output for reading: $!";
- my $ccode =3D <$cfile>;
- close($cfile);
- $ccode =3D~ s/yywrap\(n\)/yywrap()/;
- open($cfile, '>', $output) || die "opening $output for writing: $!";
- print $cfile $ccode;
- close($cfile);
- }
- if ($flexflags =3D~ /\s-b\s/)
- {
- my $lexback =3D "lex.backup";
- open($lfile, '<', $lexback) || die "opening $lexback for reading: $!";
- my $lexbacklines =3D <$lfile>;
- close($lfile);
- my $linecount =3D $lexbacklines =3D~ tr /\n/\n/;
- if ($linecount !=3D 1)
- {
- print "Scanner requires backup, see lex.backup.\n";
- exit 1;
- }
- unlink $lexback;
- }
-
- exit 0;
-
-}
-else
-{
- exit $? >> 8;
-}
diff --git a/src/tools/msvc/vcregress.bat b/src/tools/msvc/vcregress.bat
deleted file mode 100644
index 7fba45c1e7..0000000000
--- a/src/tools/msvc/vcregress.bat
+++ /dev/null
@@ -1,6 +0,0 @@
-@echo off
-REM src/tools/msvc/vcregress.bat
-REM all the logic for this now belongs in vcregress.pl. This file really
-REM only exists so you don't have to type "perl vcregress.pl"
-REM Resist any temptation to add any logic here.
-@perl %~dp0/vcregress.pl %*
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
deleted file mode 100644
index 78170d105d..0000000000
--- a/src/tools/msvc/vcregress.pl
+++ /dev/null
@@ -1,664 +0,0 @@
-# -*-perl-*- hey - emacs - this is a perl file
-
-# Copyright (c) 2021-2023, PostgreSQL Global Development Group
-
-# src/tools/msvc/vcregress.pl
-
-use strict;
-use warnings;
-
-our $config;
-
-use Cwd;
-use File::Basename;
-use File::Copy;
-use File::Find ();
-use File::Path qw(rmtree);
-use File::Spec qw(devnull);
-
-use FindBin;
-use lib $FindBin::RealBin;
-
-use Install qw(Install);
-
-my $startdir =3D getcwd();
-
-chdir "../../.." if (-d "../../../src/tools/msvc");
-
-my $topdir =3D getcwd();
-my $tmp_installdir =3D "$topdir/tmp_install";
-
-do './src/tools/msvc/config_default.pl';
-do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
-
-my $devnull =3D File::Spec->devnull;
-
-# These values are defaults that can be overridden by the calling environm=
ent
-# (see buildenv.pl processing below). We assume that the ones listed here
-# always exist by default. Other values may optionally be set for bincheck
-# or taptest, see set_command_env() below.
-# c.f. src/Makefile.global.in and configure.ac
-$ENV{TAR} ||=3D 'tar';
-
-# buildenv.pl is for specifying the build environment settings
-# it should contain lines like:
-# $ENV{PATH} =3D "c:/path/to/bison/bin;$ENV{PATH}";
-
-if (-e "src/tools/msvc/buildenv.pl")
-{
- do "./src/tools/msvc/buildenv.pl";
-}
-
-my $what =3D shift || "";
-if ($what =3D~
- /^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolati=
oncheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
- )
-{
- $what =3D uc $what;
-}
-else
-{
- usage();
-}
-
-# use a capital C here because config.pl has $config
-my $Config =3D -e "release/postgres/postgres.exe" ? "Release" : "Debug";
-
-copy("$Config/refint/refint.dll", "src/test/regress");
-copy("$Config/autoinc/autoinc.dll", "src/test/regress");
-copy("$Config/regress/regress.dll", "src/test/regress");
-copy("$Config/dummy_seclabel/dummy_seclabel.dll", "src/test/regress");
-
-# Configuration settings used by TAP tests
-$ENV{with_ssl} =3D $config->{openssl} ? 'openssl' : 'no';
-$ENV{with_ldap} =3D $config->{ldap} ? 'yes' : 'no';
-$ENV{with_icu} =3D $config->{icu} ? 'yes' : 'no';
-$ENV{with_gssapi} =3D $config->{gss} ? 'yes' : 'no';
-$ENV{with_krb_srvnam} =3D $config->{krb_srvnam} || 'postgres';
-$ENV{with_readline} =3D 'no';
-
-$ENV{PATH} =3D "$topdir/$Config/libpq;$ENV{PATH}";
-
-if ($ENV{PERL5LIB})
-{
- $ENV{PERL5LIB} =3D "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
-}
-else
-{
- $ENV{PERL5LIB} =3D "$topdir/src/tools/msvc";
-}
-
-my $maxconn =3D "";
-$maxconn =3D "--max-connections=3D$ENV{MAX_CONNECTIONS}"
- if $ENV{MAX_CONNECTIONS};
-
-my $temp_config =3D "";
-$temp_config =3D "--temp-config=3D\"$ENV{TEMP_CONFIG}\""
- if $ENV{TEMP_CONFIG};
-
-chdir "src/test/regress";
-
-my %command =3D (
- CHECK =3D> \&check,
- PLCHECK =3D> \&plcheck,
- INSTALLCHECK =3D> \&installcheck,
- ECPGCHECK =3D> \&ecpgcheck,
- CONTRIBCHECK =3D> \&contribcheck,
- MODULESCHECK =3D> \&modulescheck,
- ISOLATIONCHECK =3D> \&isolationcheck,
- BINCHECK =3D> \&bincheck,
- RECOVERYCHECK =3D> \&recoverycheck,
- UPGRADECHECK =3D> \&upgradecheck, # no-op
- TAPTEST =3D> \&taptest,);
-
-my $proc =3D $command{$what};
-
-exit 3 unless $proc;
-
-&$proc(@ARGV);
-
-exit 0;
-
-########################################################################
-
-# Helper function for set_command_env, to set one environment command.
-sub set_single_env
-{
- my $envname =3D shift;
- my $envdefault =3D shift;
-
- # If a command is defined by the environment, just use it.
- return if (defined($ENV{$envname}));
-
- # Nothing is defined, so attempt to assign a default. The command
- # may not be in the current environment, hence check if it can be
- # executed.
- my $rc =3D system("$envdefault --version >$devnull 2>&1");
-
- # Set the environment to the default if it exists, else leave it.
- $ENV{$envname} =3D $envdefault if $rc =3D=3D 0;
- return;
-}
-
-# Set environment values for various command types. These can be used
-# in the TAP tests.
-sub set_command_env
-{
- set_single_env('GZIP_PROGRAM', 'gzip');
- set_single_env('LZ4', 'lz4');
- set_single_env('OPENSSL', 'openssl');
- set_single_env('ZSTD', 'zstd');
-}
-
-sub installcheck_internal
-{
- my ($schedule, @EXTRA_REGRESS_OPTS) =3D @_;
- # for backwards compatibility, "serial" runs the tests in
- # parallel_schedule one by one.
- my $maxconn =3D $maxconn;
- $maxconn =3D "--max-connections=3D1" if $schedule eq 'serial';
- $schedule =3D 'parallel' if $schedule eq 'serial';
-
- my @args =3D (
- "../../../$Config/pg_regress/pg_regress",
- "--dlpath=3D.",
- "--bindir=3D../../../$Config/psql",
- "--schedule=3D${schedule}_schedule",
- "--max-concurrent-tests=3D20");
- push(@args, $maxconn) if $maxconn;
- push(@args, @EXTRA_REGRESS_OPTS);
- system(@args);
- my $status =3D $? >> 8;
- exit $status if $status;
- return;
-}
-
-sub installcheck
-{
- my $schedule =3D shift || 'serial';
- installcheck_internal($schedule);
- return;
-}
-
-sub check
-{
- my $schedule =3D shift || 'parallel';
- my $encoding =3D $ENV{ENCODING} || "SQL_ASCII";
- # for backwards compatibility, "serial" runs the tests in
- # parallel_schedule one by one.
- my $maxconn =3D $maxconn;
- $maxconn =3D "--max-connections=3D1" if $schedule eq 'serial';
- $schedule =3D 'parallel' if $schedule eq 'serial';
-
- InstallTemp();
- chdir "${topdir}/src/test/regress";
- my @args =3D (
- "../../../$Config/pg_regress/pg_regress",
- "--dlpath=3D.",
- "--bindir=3D",
- "--schedule=3D${schedule}_schedule",
- "--max-concurrent-tests=3D20",
- "--encoding=3D${encoding}",
- "--no-locale",
- "--temp-instance=3D./tmp_check");
- push(@args, $maxconn) if $maxconn;
- push(@args, $temp_config) if $temp_config;
- system(@args);
- my $status =3D $? >> 8;
- exit $status if $status;
- return;
-}
-
-sub ecpgcheck
-{
- my $msbflags =3D $ENV{MSBFLAGS} || "";
- chdir $startdir;
- system("msbuild ecpg_regression.proj $msbflags /p:config=3D$Config");
- my $status =3D $? >> 8;
- exit $status if $status;
- InstallTemp();
- chdir "$topdir/src/interfaces/ecpg/test";
- my $schedule =3D "ecpg";
- my @args =3D (
- "../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
- "--bindir=3D",
- "--dbname=3Decpg1_regression,ecpg2_regression",
- "--create-role=3Dregress_ecpg_user1,regress_ecpg_user2",
- "--schedule=3D${schedule}_schedule",
- "--encoding=3DSQL_ASCII",
- "--no-locale",
- "--temp-instance=3D./tmp_chk");
- push(@args, $maxconn) if $maxconn;
- system(@args);
- $status =3D $? >> 8;
- exit $status if $status;
- return;
-}
-
-sub isolationcheck
-{
- chdir "../isolation";
- copy("../../../$Config/isolationtester/isolationtester.exe",
- "../../../$Config/pg_isolation_regress");
- my @args =3D (
- "../../../$Config/pg_isolation_regress/pg_isolation_regress",
- "--bindir=3D../../../$Config/psql",
- "--inputdir=3D.",
- "--schedule=3D./isolation_schedule");
- push(@args, $maxconn) if $maxconn;
- system(@args);
- my $status =3D $? >> 8;
- exit $status if $status;
- return;
-}
-
-sub tap_check
-{
- die "Tap tests not enabled in configuration"
- unless $config->{tap_tests};
-
- my @flags;
- foreach my $arg (0 .. scalar(@_) - 1)
- {
- next unless $_[$arg] =3D~ /^PROVE_FLAGS=3D(.*)/;
- @flags =3D split(/\s+/, $1);
- splice(@_, $arg, 1);
- last;
- }
-
- my $dir =3D shift;
- chdir $dir;
-
- # Fetch and adjust PROVE_TESTS, applying glob() to each element
- # defined to build a list of all the tests matching patterns.
- my $prove_tests_val =3D $ENV{PROVE_TESTS} || "t/*.pl";
- my @prove_tests_array =3D split(/\s+/, $prove_tests_val);
- my @prove_tests =3D ();
- foreach (@prove_tests_array)
- {
- push(@prove_tests, glob($_));
- }
-
- # Fetch and adjust PROVE_FLAGS, handling multiple arguments.
- my $prove_flags_val =3D $ENV{PROVE_FLAGS} || "";
- my @prove_flags =3D split(/\s+/, $prove_flags_val);
-
- my @args =3D ("prove", @flags, @prove_tests, @prove_flags);
-
- # adjust the environment for just this test
- local %ENV =3D %ENV;
- $ENV{PERL5LIB} =3D "$topdir/src/test/perl;$ENV{PERL5LIB}";
- $ENV{PG_REGRESS} =3D "$topdir/$Config/pg_regress/pg_regress";
- $ENV{REGRESS_SHLIB} =3D "$topdir/src/test/regress/regress.dll";
-
- $ENV{TESTDATADIR} =3D "$dir/tmp_check";
- $ENV{TESTLOGDIR} =3D "$dir/tmp_check/log";
-
- my $module =3D basename $dir;
- # add the module build dir as the second element in the PATH
- $ENV{PATH} =3D~ s!;!;$topdir/$Config/$module;!;
-
- rmtree('tmp_check');
- system(@args);
- my $status =3D $? >> 8;
- return $status;
-}
-
-sub bincheck
-{
- InstallTemp();
-
- set_command_env();
-
- my $mstat =3D 0;
-
- # Find out all the existing TAP tests by looking for t/ directories
- # in the tree.
- my @bin_dirs =3D glob("$topdir/src/bin/*");
-
- # Process each test
- foreach my $dir (@bin_dirs)
- {
- next unless -d "$dir/t";
-
- my $status =3D tap_check($dir);
- $mstat ||=3D $status;
- }
- exit $mstat if $mstat;
- return;
-}
-
-sub taptest
-{
- my $dir =3D shift;
- my @args;
-
- if ($dir =3D~ /^PROVE_FLAGS=3D/)
- {
- push(@args, $dir);
- $dir =3D shift;
- }
-
- die "no tests found!" unless -d "$topdir/$dir/t";
-
- push(@args, "$topdir/$dir");
-
- InstallTemp();
-
- set_command_env();
-
- my $status =3D tap_check(@args);
- exit $status if $status;
- return;
-}
-
-sub plcheck
-{
- chdir "$topdir/src/pl";
-
- foreach my $dir (glob("*/src *"))
- {
- next unless -d "$dir/sql" && -d "$dir/expected";
- my $lang;
- if ($dir eq 'plpgsql/src')
- {
- $lang =3D 'plpgsql';
- }
- elsif ($dir eq 'tcl')
- {
- $lang =3D 'pltcl';
- }
- else
- {
- $lang =3D $dir;
- }
- if ($lang eq 'plpython')
- {
- next
- unless -d "$topdir/$Config/plpython3";
- $lang =3D 'plpythonu';
- }
- else
- {
- next unless -d "$topdir/$Config/$lang";
- }
- my @lang_args =3D ("--load-extension=3D$lang");
- chdir $dir;
- my @tests =3D fetchTests();
- if ($lang eq 'plperl')
- {
-
- # plperl tests will install the extensions themselves
- @lang_args =3D ();
-
- # assume we're using this perl to built postgres
- # test if we can run two interpreters in one backend, and if so
- # run the trusted/untrusted interaction tests
- use Config;
- if ($Config{usemultiplicity} eq 'define')
- {
- push(@tests, 'plperl_plperlu');
- }
- }
- elsif ($lang eq 'plpythonu' && -d "$topdir/$Config/plpython3")
- {
- @lang_args =3D ();
- }
-
- # Move on if no tests are listed.
- next if (scalar @tests =3D=3D 0);
-
- print
- "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n";
- print "Checking $lang\n";
- my @args =3D (
- "$topdir/$Config/pg_regress/pg_regress",
- "--bindir=3D$topdir/$Config/psql",
- "--dbname=3Dpl_regression", @lang_args, @tests);
- system(@args);
- my $status =3D $? >> 8;
- exit $status if $status;
- chdir "$topdir/src/pl";
- }
-
- chdir "$topdir";
- return;
-}
-
-sub subdircheck
-{
- my $module =3D shift;
-
- if ( !-d "$module/sql"
- || !-d "$module/expected"
- || (!-f "$module/GNUmakefile" && !-f "$module/Makefile"))
- {
- return;
- }
-
- chdir $module;
- my @tests =3D fetchTests();
-
- # Leave if no tests are listed in the module.
- if (scalar @tests =3D=3D 0)
- {
- chdir "..";
- return;
- }
-
- my @opts =3D fetchRegressOpts();
-
- print "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n";
- print "Checking $module\n";
- my @args =3D (
- "$topdir/$Config/pg_regress/pg_regress",
- "--bindir=3D${topdir}/${Config}/psql",
- "--dbname=3Dcontrib_regression", @opts, @tests);
- print join(' ', @args), "\n";
- system(@args);
- chdir "..";
- return;
-}
-
-sub contribcheck
-{
- chdir "../../../contrib";
- my $mstat =3D 0;
- foreach my $module (glob("*"))
- {
- # these configuration-based exclusions must match Install.pm
- next if ($module eq "uuid-ossp" && !defined($config->{uuid}));
- next if ($module eq "sslinfo" && !defined($config->{openssl}));
- next if ($module eq "pgcrypto" && !defined($config->{openssl}));
- next if ($module eq "xml2" && !defined($config->{xml}));
- next if ($module =3D~ /_plperl$/ && !defined($config->{perl}));
- next if ($module =3D~ /_plpython$/ && !defined($config->{python}));
- next if ($module eq "sepgsql");
-
- subdircheck($module);
- my $status =3D $? >> 8;
- $mstat ||=3D $status;
- }
- exit $mstat if $mstat;
- return;
-}
-
-sub modulescheck
-{
- chdir "../../../src/test/modules";
- my $mstat =3D 0;
- foreach my $module (glob("*"))
- {
- subdircheck($module);
- my $status =3D $? >> 8;
- $mstat ||=3D $status;
- }
- exit $mstat if $mstat;
- return;
-}
-
-sub recoverycheck
-{
- InstallTemp();
-
- my $dir =3D "$topdir/src/test/recovery";
- my $status =3D tap_check($dir);
- exit $status if $status;
- return;
-}
-
-# Run "initdb", then reconfigure authentication.
-sub standard_initdb
-{
- return (
- system('initdb', '-N') =3D=3D 0 and system(
- "$topdir/$Config/pg_regress/pg_regress", '--config-auth',
- $ENV{PGDATA}) =3D=3D 0);
-}
-
-# This is similar to appendShellString(). Perl system(@args) bypasses
-# cmd.exe, so omit the caret escape layer.
-sub quote_system_arg
-{
- my $arg =3D shift;
-
- # Change N >=3D 0 backslashes before a double quote to 2N+1 backslashes.
- $arg =3D~ s/(\\*)"/${\($1 . $1)}\\"/gs;
-
- # Change N >=3D 1 backslashes at end of argument to 2N backslashes.
- $arg =3D~ s/(\\+)$/${\($1 . $1)}/gs;
-
- # Wrap the whole thing in unescaped double quotes.
- return "\"$arg\"";
-}
-
-sub upgradecheck
-{
- # pg_upgrade is now handled by bincheck, but keep this target for
- # backward compatibility.
- print "upgradecheck is a no-op, use bincheck instead.\n";
- return;
-}
-
-sub fetchRegressOpts
-{
- my $handle;
- open($handle, '<', "GNUmakefile")
- || open($handle, '<', "Makefile")
- || die "Could not open Makefile";
- local ($/) =3D undef;
- my $m =3D <$handle>;
- close($handle);
- my @opts;
-
- $m =3D~ s{\\\r?\n}{}g;
- if ($m =3D~ /^\s*REGRESS_OPTS\s*\+?=3D(.*)/m)
- {
-
- # Substitute known Makefile variables, then ignore options that retain
- # an unhandled variable reference. Ignore anything that isn't an
- # option starting with "--".
- @opts =3D grep { !/\$\(/ && /^--/ }
- map { (my $x =3D $_) =3D~ s/\Q$(top_builddir)\E/\"$topdir\"/; $x; }
- split(/\s+/, $1);
- }
- if ($m =3D~ /^\s*ENCODING\s*=3D\s*(\S+)/m)
- {
- push @opts, "--encoding=3D$1";
- }
- if ($m =3D~ /^\s*NO_LOCALE\s*=3D\s*\S+/m)
- {
- push @opts, "--no-locale";
- }
- return @opts;
-}
-
-# Fetch the list of tests by parsing a module's Makefile. An empty
-# list is returned if the module does not need to run anything.
-sub fetchTests
-{
- my $handle;
- open($handle, '<', "GNUmakefile")
- || open($handle, '<', "Makefile")
- || die "Could not open Makefile";
- local ($/) =3D undef;
- my $m =3D <$handle>;
- close($handle);
- my $t =3D "";
-
- $m =3D~ s{\\\r?\n}{}g;
-
- # A module specifying NO_INSTALLCHECK does not support installcheck,
- # so bypass its run by returning an empty set of tests.
- if ($m =3D~ /^\s*NO_INSTALLCHECK\s*=3D\s*\S+/m)
- {
- return ();
- }
-
- if ($m =3D~ /^REGRESS\s*=3D\s*(.*)$/gm)
- {
- $t =3D $1;
- $t =3D~ s/\s+/ /g;
-
- if ($m =3D~ /contrib\/pgcrypto/)
- {
-
- # pgcrypto is special since some tests depend on the
- # configuration of the build
-
- my $pgptests =3D
- $config->{zlib}
- ? GetTests("ZLIB_TST", $m)
- : GetTests("ZLIB_OFF_TST", $m);
- $t =3D~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
- }
- }
-
- return split(/\s+/, $t);
-}
-
-sub GetTests
-{
- my $testname =3D shift;
- my $m =3D shift;
- if ($m =3D~ /^$testname\s*=3D\s*(.*)$/gm)
- {
- return $1;
- }
- return "";
-}
-
-sub InstallTemp
-{
- unless ($ENV{NO_TEMP_INSTALL})
- {
- print "Setting up temp install\n\n";
- Install("$tmp_installdir", "all", $config);
- }
- $ENV{PATH} =3D "$tmp_installdir/bin;$ENV{PATH}";
- return;
-}
-
-sub usage
-{
- print STDERR
- "Usage: vcregress.pl []\n\n",
- "Options for :\n",
- " bincheck run tests of utilities in src/bin/\n",
- " check deploy instance and run regression tests on it\n",
- " contribcheck run tests of modules in contrib/\n",
- " ecpgcheck run regression tests of ECPG\n",
- " installcheck run regression tests on existing instance\n",
- " isolationcheck run isolation tests\n",
- " modulescheck run tests of modules in src/test/modules/\n",
- " plcheck run tests of PL languages\n",
- " recoverycheck run recovery test suite\n",
- " taptest run an arbitrary TAP test set\n",
- " upgradecheck run tests of pg_upgrade (no-op)\n",
- "\nOptions for : (used by check and installcheck)\n",
- " serial serial mode\n",
- " parallel parallel mode\n",
- "\nOption for : for taptest\n",
- " TEST_DIR (required) directory where tests reside\n";
- exit(1);
-}
diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc_gendef.pl
similarity index 97%
rename from src/tools/msvc/gendef.pl
rename to src/tools/msvc_gendef.pl
index cf83d7d056..8749fd0dd7 100644
--- a/src/tools/msvc/gendef.pl
+++ b/src/tools/msvc_gendef.pl
@@ -11,7 +11,7 @@ my @def;
#
# Script that generates a .DEF file for all objects in a directory
#
-# src/tools/msvc/gendef.pl
+# src/tools/msvc_gendef.pl
#
=20
# Given a symbol file path, loops over its contents
@@ -142,7 +142,7 @@ sub writedef
=20
sub usage
{
- die("Usage: gendef.pl --arch --deffile --tempdir files-or-directories\n"
+ die("Usage: msvc_gendef.pl --arch --deffile --tempdir files-or-directories\n"
. " arch: x86 | x86_64\n"
. " deffile: path of the generated file\n"
. " tempdir: directory for temporary files\n"
diff --git a/src/tools/perlcheck/pgperlsyncheck b/src/tools/perlcheck/pgper=
lsyncheck
index da59c9727c..657d2afcc0 100755
--- a/src/tools/perlcheck/pgperlsyncheck
+++ b/src/tools/perlcheck/pgperlsyncheck
@@ -2,7 +2,7 @@
=20
# script to detect compile time errors and warnings in all perl files
=20
-INCLUDES=3D"-I src/tools/msvc -I src/tools/msvc/dummylib -I src/backend/ca=
talog"
+INCLUDES=3D"-I src/backend/catalog"
INCLUDES=3D"-I src/test/perl -I src/backend/utils/mb/Unicode $INCLUDES"
INCLUDES=3D"-I src/bin/pg_rewind -I src/test/ssl/t $INCLUDES"
=20
--=20
2.42.0
--G2OByfeWSmw0dIXN--
--PT/k+DAIh5wT9u9p
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmUac2MACgkQnvQgOdby
QH3VCQ//S3V9ANEAlZ4rdeqAbDypYlPCnwzOEGLF4HPj/9Vhs6BZF2edT4KP0Pw3
QSx8vAPMv/ZhyyW/jjhwxudeypfEnlY6UaDmJxAugGOUyUGbvUkQwXeIjTPdKsjt
klVAWTu+eHU59toffLdkAEQZOhfL6x8XaPcqJaZWf+N3J94NQoM0dX8u0K6/jNgs
IvxNZOSLbUjVaBGnDP5AXHPvqYxmCJa5g9Ep3tHpK0fOdTOelxvZRZNRWN/y4XJ7
+Zaf3+esI/rkkJJiu00p/WIHXuAECp8mlJZCKN68We052Dd4swDD4CGikU15x5+L
sbc/IYKbNQ7PSxPcME8RWi0Aula/Ffaa1gUAemdN4HPPnSro1Nxjs9q0dqJj5eoh
x1mnoNhpX4MhawTdKHfI8LW6jbm/QMVF9+3qsoVBCDTz8gQiYxj0XtOc2yxQPk6t
bK26xRdveBYkF3fZIuR5f5k+Uo2rG2Mvt/sq0HHa5KsBKkP9D8KuVwad2UupsYVt
PgLxx0CBMACd6stqPEAwJSo8qo+faY/SqiWGl1L1o+V4SU1f3GVbBlG6hm1zc2oQ
KJBekv86gD1SusNJTcuttPlOS95Uq1VF0oyxIYgzGUqh+rYwLnnmamNhwdQNHoQ+
oGmbseB8rqIQFVuQJGtpK2HNjsSW8LOQ4AsZR7SYy4Tid99Bq8M=
=Gr9G
-----END PGP SIGNATURE-----
--PT/k+DAIh5wT9u9p--