mirror of https://github.com/postgres/postgres
Remove MSVC scripts
This commit removes all the scripts located in src/tools/msvc/ to build PostgreSQL with Visual Studio on Windows, meson becoming the recommended way to achieve that. The scripts held some information that is still relevant with meson, information kept and moved to better locations. Comments that referred directly to the scripts are removed. All the documentation still relevant that was in install-windows.sgml has been moved to installation.sgml under a new subsection for Visual. All the content specific to the scripts is removed. Some adjustments for the documentation are planned in a follow-up set of changes. Author: Michael Paquier Reviewed-by: Peter Eisentraut, Andres Freund Discussion: https://postgr.es/m/ZQzp_VMJcerM1Cs_@paquier.xyz
This commit is contained in:
parent
27f7f81e4c
commit
1301c80b21
|
@ -53,10 +53,17 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
|
|||
# would be fatal to try to compile PL/Perl to a different libc ABI than core
|
||||
# Postgres uses. The available information says that most symbols that affect
|
||||
# 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. Perl
|
||||
# never reports the latter, and we don't attempt to deduce when it's needed.
|
||||
# switches for symbols not beginning with underscore.
|
||||
|
||||
# Some exceptions are the 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. 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.
|
||||
#
|
||||
# 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
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
<!ENTITY installbin SYSTEM "install-binaries.sgml">
|
||||
<!ENTITY installation SYSTEM "installation.sgml">
|
||||
<!ENTITY targets-meson SYSTEM "targets-meson.sgml">
|
||||
<!ENTITY installw SYSTEM "install-windows.sgml">
|
||||
<!ENTITY maintenance SYSTEM "maintenance.sgml">
|
||||
<!ENTITY manage-ag SYSTEM "manage-ag.sgml">
|
||||
<!ENTITY monitoring SYSTEM "monitoring.sgml">
|
||||
|
|
|
@ -1,588 +0,0 @@
|
|||
<!-- doc/src/sgml/install-windows.sgml -->
|
||||
|
||||
<chapter id="install-windows">
|
||||
<title>Installation from Source Code on <productname>Windows</productname></title>
|
||||
|
||||
<indexterm>
|
||||
<primary>installation</primary>
|
||||
<secondary>on Windows</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>
|
||||
It is recommended that most users download the binary distribution for
|
||||
Windows, available as a graphical installer package
|
||||
from the <productname>PostgreSQL</productname> website at
|
||||
<ulink url="https://www.postgresql.org/download/"></ulink>. Building from source
|
||||
is only intended for people developing <productname>PostgreSQL</productname>
|
||||
or extensions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There are several different ways of building PostgreSQL on
|
||||
<productname>Windows</productname>. The simplest way to build with
|
||||
Microsoft tools is to install <productname>Visual Studio 2022</productname>
|
||||
and use the included compiler. It is also possible to build with the full
|
||||
<productname>Microsoft Visual C++ 2015 to 2022</productname>.
|
||||
In some cases that requires the installation of the
|
||||
<productname>Windows SDK</productname> in addition to the compiler.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is also possible to build PostgreSQL using the GNU compiler tools
|
||||
provided by <productname>MinGW</productname>, or using
|
||||
<productname>Cygwin</productname> for older versions of
|
||||
<productname>Windows</productname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Building using <productname>MinGW</productname> or
|
||||
<productname>Cygwin</productname> uses the normal build system, see
|
||||
<xref linkend="installation"/> and the specific notes in
|
||||
<xref linkend="installation-notes-mingw"/> and <xref linkend="installation-notes-cygwin"/>.
|
||||
To produce native 64 bit binaries in these environments, use the tools from
|
||||
<productname>MinGW-w64</productname>. These tools can also be used to
|
||||
cross-compile for 32 bit and 64 bit <productname>Windows</productname>
|
||||
targets on other hosts, such as <productname>Linux</productname> and
|
||||
<productname>macOS</productname>.
|
||||
<productname>Cygwin</productname> is not recommended for running a
|
||||
production server, and it should only be used for running on
|
||||
older versions of <productname>Windows</productname> where
|
||||
the native build does not work. The official
|
||||
binaries are built using <productname>Visual Studio</productname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Native builds of <application>psql</application> don't support command
|
||||
line editing. The <productname>Cygwin</productname> build does support
|
||||
command line editing, so it should be used where psql is needed for
|
||||
interactive use on <productname>Windows</productname>.
|
||||
</para>
|
||||
|
||||
<sect1 id="install-windows-full">
|
||||
<title>Building with <productname>Visual C++</productname> or the
|
||||
<productname>Microsoft Windows SDK</productname></title>
|
||||
|
||||
<para>
|
||||
PostgreSQL can be built using the Visual C++ compiler suite from Microsoft.
|
||||
These compilers can be either from <productname>Visual Studio</productname>,
|
||||
<productname>Visual Studio Express</productname> or some versions of the
|
||||
<productname>Microsoft Windows SDK</productname>. If you do not already have a
|
||||
<productname>Visual Studio</productname> environment set up, the easiest
|
||||
ways are to use the compilers from
|
||||
<productname>Visual Studio 2022</productname> or those in the
|
||||
<productname>Windows SDK 10</productname>, which are both free downloads
|
||||
from Microsoft.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite.
|
||||
32-bit PostgreSQL builds are possible with
|
||||
<productname>Visual Studio 2015</productname> to
|
||||
<productname>Visual Studio 2022</productname>,
|
||||
as well as standalone Windows SDK releases 10 and above.
|
||||
64-bit PostgreSQL builds are supported with
|
||||
<productname>Microsoft Windows SDK</productname> version 10 and above or
|
||||
<productname>Visual Studio 2015</productname> and above.
|
||||
<!--
|
||||
For 2015 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2015-sysrequirements-vs
|
||||
For 2017 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2017-system-requirements-vs
|
||||
For 2019 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/releases/2019/system-requirements
|
||||
For 2022 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/releases/2022/system-requirements
|
||||
-->
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The tools for building using <productname>Visual C++</productname> or
|
||||
<productname>Platform SDK</productname> are in the
|
||||
<filename>src\tools\msvc</filename> directory. When building, make sure
|
||||
there are no tools from <productname>MinGW</productname> or
|
||||
<productname>Cygwin</productname> present in your system PATH. Also, make
|
||||
sure you have all the required Visual C++ tools available in the PATH. In
|
||||
<productname>Visual Studio</productname>, start the
|
||||
<application>Visual Studio Command Prompt</application>.
|
||||
If you wish to build a 64-bit version, you must use the 64-bit version of
|
||||
the command, and vice versa.
|
||||
Starting with <productname>Visual Studio 2017</productname> this can be
|
||||
done from the command line using <command>VsDevCmd.bat</command>, see
|
||||
<command>-help</command> for the available options and their default values.
|
||||
<command>vsvars32.bat</command> is available in
|
||||
<productname>Visual Studio 2015</productname> and earlier versions for the
|
||||
same purpose.
|
||||
From the <application>Visual Studio Command Prompt</application>, you can
|
||||
change the targeted CPU architecture, build type, and target OS by using the
|
||||
<command>vcvarsall.bat</command> command, e.g.,
|
||||
<command>vcvarsall.bat x64 10.0.10240.0</command> to target Windows 10
|
||||
with a 64-bit release build. See <command>-help</command> for the other
|
||||
options of <command>vcvarsall.bat</command>. All commands should be run from
|
||||
the <filename>src\tools\msvc</filename> directory.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Before you build, you can create the file <filename>config.pl</filename>
|
||||
to reflect any configuration options you want to change, or the paths to
|
||||
any third party libraries to use. The complete configuration is determined
|
||||
by first reading and parsing the file <filename>config_default.pl</filename>,
|
||||
and then apply any changes from <filename>config.pl</filename>. For example,
|
||||
to specify the location of your <productname>Python</productname> installation,
|
||||
put the following in <filename>config.pl</filename>:
|
||||
<programlisting>
|
||||
$config->{python} = 'c:\python310';
|
||||
</programlisting>
|
||||
You only need to specify those parameters that are different from what's in
|
||||
<filename>config_default.pl</filename>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you need to set any other environment variables, create a file called
|
||||
<filename>buildenv.pl</filename> and put the required commands there. For
|
||||
example, to add the path for bison when it's not in the PATH, create a file
|
||||
containing:
|
||||
<programlisting>
|
||||
$ENV{PATH}=$ENV{PATH} . ';c:\some\where\bison\bin';
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To pass additional command line arguments to the Visual Studio build
|
||||
command (msbuild or vcbuild):
|
||||
<programlisting>
|
||||
$ENV{MSBFLAGS}="/m";
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<sect2 id="install-windows-full-requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
The following additional products are required to build
|
||||
<productname>PostgreSQL</productname>. Use the
|
||||
<filename>config.pl</filename> file to specify which directories the libraries
|
||||
are available in.
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><productname>Microsoft Windows SDK</productname></term>
|
||||
<listitem><para>
|
||||
If your build environment doesn't ship with a supported version of the
|
||||
<productname>Microsoft Windows SDK</productname> it
|
||||
is recommended that you upgrade to the latest version (currently
|
||||
version 10), available for download from
|
||||
<ulink url="https://www.microsoft.com/download"></ulink>.
|
||||
</para>
|
||||
<para>
|
||||
You must always include the
|
||||
<application>Windows Headers and Libraries</application> part of the SDK.
|
||||
If you install a <productname>Windows SDK</productname>
|
||||
including the <application>Visual C++ Compilers</application>,
|
||||
you don't need <productname>Visual Studio</productname> to build.
|
||||
Note that as of Version 8.0a the Windows SDK no longer ships with a
|
||||
complete command-line build environment.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>ActiveState Perl</productname></term>
|
||||
<listitem><para>
|
||||
ActiveState Perl is required to run the build generation scripts. MinGW
|
||||
or Cygwin Perl will not work. It must also be present in the PATH.
|
||||
Binaries can be downloaded from
|
||||
<ulink url="https://www.activestate.com"></ulink>
|
||||
(Note: version 5.14 or later is required,
|
||||
the free Standard Distribution is sufficient).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
<para>
|
||||
The following additional products are not required to get started,
|
||||
but are required to build the complete package. Use the
|
||||
<filename>config.pl</filename> file to specify which directories the libraries
|
||||
are available in.
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><productname>ActiveState Tcl</productname></term>
|
||||
<listitem><para>
|
||||
Required for building <application>PL/Tcl</application> (Note: version
|
||||
8.4 is required, the free Standard Distribution is sufficient).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Bison</productname> and
|
||||
<productname>Flex</productname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<productname>Bison</productname> and <productname>Flex</productname> are
|
||||
required. Only <productname>Bison</productname> versions 2.3 and later
|
||||
will work. <productname>Flex</productname> must be version 2.5.35 or later.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Both <productname>Bison</productname> and <productname>Flex</productname>
|
||||
are included in the <productname>msys</productname> tool suite, available
|
||||
from <ulink url="http://www.mingw.org/wiki/MSYS"></ulink> as part of the
|
||||
<productname>MinGW</productname> compiler suite.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You will need to add the directory containing
|
||||
<filename>flex.exe</filename> and <filename>bison.exe</filename> to the
|
||||
PATH environment variable in <filename>buildenv.pl</filename> unless
|
||||
they are already in PATH. In the case of MinGW, the directory is the
|
||||
<filename>\msys\1.0\bin</filename> subdirectory of your MinGW
|
||||
installation directory.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
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 <filename>C:\Program Files\GnuWin32</filename>.
|
||||
Consider installing into <filename>C:\GnuWin32</filename> or use the
|
||||
NTFS short name path to GnuWin32 in your PATH environment setting
|
||||
(e.g., <filename>C:\PROGRA~1\GnuWin32</filename>).
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Diff</productname></term>
|
||||
<listitem><para>
|
||||
Diff is required to run the regression tests, and can be downloaded
|
||||
from <ulink url="http://gnuwin32.sourceforge.net"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Gettext</productname></term>
|
||||
<listitem><para>
|
||||
Gettext is required to build with NLS support, and can be downloaded
|
||||
from <ulink url="http://gnuwin32.sourceforge.net"></ulink>. Note that binaries,
|
||||
dependencies and developer files are all needed.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>MIT Kerberos</productname></term>
|
||||
<listitem><para>
|
||||
Required for GSSAPI authentication support. MIT Kerberos can be
|
||||
downloaded from
|
||||
<ulink url="https://web.mit.edu/Kerberos/dist/index.html"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>libxml2</productname> and
|
||||
<productname>libxslt</productname></term>
|
||||
<listitem><para>
|
||||
Required for XML support. Binaries can be downloaded from
|
||||
<ulink url="https://zlatkovic.com/pub/libxml"></ulink> or source from
|
||||
<ulink url="http://xmlsoft.org"></ulink>. Note that libxml2 requires iconv,
|
||||
which is available from the same download location.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>LZ4</productname></term>
|
||||
<listitem><para>
|
||||
Required for supporting <productname>LZ4</productname> compression.
|
||||
Binaries and source can be downloaded from
|
||||
<ulink url="https://github.com/lz4/lz4/releases"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Zstandard</productname></term>
|
||||
<listitem><para>
|
||||
Required for supporting <productname>Zstandard</productname> compression.
|
||||
Binaries and source can be downloaded from
|
||||
<ulink url="https://github.com/facebook/zstd/releases"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>OpenSSL</productname></term>
|
||||
<listitem><para>
|
||||
Required for SSL support. Binaries can be downloaded from
|
||||
<ulink url="https://slproweb.com/products/Win32OpenSSL.html"></ulink>
|
||||
or source from <ulink url="https://www.openssl.org"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>ossp-uuid</productname></term>
|
||||
<listitem><para>
|
||||
Required for UUID-OSSP support (contrib only). Source can be
|
||||
downloaded from
|
||||
<ulink url="http://www.ossp.org/pkg/lib/uuid/"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Python</productname></term>
|
||||
<listitem><para>
|
||||
Required for building <application>PL/Python</application>. Binaries can
|
||||
be downloaded from <ulink url="https://www.python.org"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>zlib</productname></term>
|
||||
<listitem><para>
|
||||
Required for compression support in <application>pg_dump</application>
|
||||
and <application>pg_restore</application>. Binaries can be downloaded
|
||||
from <ulink url="https://www.zlib.net"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="install-windows-full-64-bit">
|
||||
<title>Special Considerations for 64-Bit Windows</title>
|
||||
|
||||
<para>
|
||||
PostgreSQL will only build for the x64 architecture on 64-bit Windows.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To use a server-side third party library such as <productname>Python</productname> or
|
||||
<productname>OpenSSL</productname>, this library <emphasis>must</emphasis> 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 may
|
||||
only be available in 32-bit versions, in which case they cannot be used with
|
||||
64-bit PostgreSQL.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="install-windows-full-build">
|
||||
<title>Building</title>
|
||||
|
||||
<para>
|
||||
To build all of PostgreSQL in release configuration (the default), run the
|
||||
command:
|
||||
<screen>
|
||||
<userinput>build</userinput>
|
||||
</screen>
|
||||
To build all of PostgreSQL in debug configuration, run the command:
|
||||
<screen>
|
||||
<userinput>build DEBUG</userinput>
|
||||
</screen>
|
||||
To build just a single project, for example psql, run the commands:
|
||||
<screen>
|
||||
<userinput>build psql</userinput>
|
||||
<userinput>build DEBUG psql</userinput>
|
||||
</screen>
|
||||
To change the default build configuration to debug, put the following
|
||||
in the <filename>buildenv.pl</filename> file:
|
||||
<programlisting>
|
||||
$ENV{CONFIG}="Debug";
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
It is also possible to build from inside the Visual Studio GUI. In this
|
||||
case, you need to run:
|
||||
<screen>
|
||||
<userinput>perl mkvcbuild.pl</userinput>
|
||||
</screen>
|
||||
from the command prompt, and then open the generated
|
||||
<filename>pgsql.sln</filename> (in the root directory of the source tree)
|
||||
in Visual Studio.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="install-windows-full-clean-inst">
|
||||
<title>Cleaning and Installing</title>
|
||||
|
||||
<para>
|
||||
Most of the time, the automatic dependency tracking in Visual Studio will
|
||||
handle changed files. But if there have been large changes, you may need
|
||||
to clean the installation. To do this, simply run the
|
||||
<filename>clean.bat</filename> command, which will automatically clean out
|
||||
all generated files. You can also run it with the
|
||||
<parameter>dist</parameter> parameter, in which case it will behave like
|
||||
<userinput>make distclean</userinput> and remove the flex/bison output files
|
||||
as well.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
By default, all files are written into a subdirectory of the
|
||||
<filename>debug</filename> or <filename>release</filename> directories. To
|
||||
install these files using the standard layout, and also generate the files
|
||||
required to initialize and use the database, run the command:
|
||||
<screen>
|
||||
<userinput>install c:\destination\directory</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to install only the client applications and
|
||||
interface libraries, then you can use these commands:
|
||||
<screen>
|
||||
<userinput>install c:\destination\directory client</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="install-windows-full-reg-tests">
|
||||
<title>Running the Regression Tests</title>
|
||||
|
||||
<para>
|
||||
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 through
|
||||
the <filename>buildenv.pl</filename> file. To run the tests, run one of
|
||||
the following commands from the <filename>src\tools\msvc</filename>
|
||||
directory:
|
||||
<screen>
|
||||
<userinput>vcregress check</userinput>
|
||||
<userinput>vcregress installcheck</userinput>
|
||||
<userinput>vcregress plcheck</userinput>
|
||||
<userinput>vcregress contribcheck</userinput>
|
||||
<userinput>vcregress modulescheck</userinput>
|
||||
<userinput>vcregress ecpgcheck</userinput>
|
||||
<userinput>vcregress isolationcheck</userinput>
|
||||
<userinput>vcregress bincheck</userinput>
|
||||
<userinput>vcregress recoverycheck</userinput>
|
||||
<userinput>vcregress taptest</userinput>
|
||||
</screen>
|
||||
|
||||
To change the schedule used (default is parallel), append it to the
|
||||
command line like:
|
||||
<screen>
|
||||
<userinput>vcregress check serial</userinput>
|
||||
</screen>
|
||||
|
||||
<command>vcregress taptest</command> can be used to run the TAP tests
|
||||
of a target directory, like:
|
||||
<screen>
|
||||
<userinput>vcregress taptest src\bin\initdb\</userinput>
|
||||
</screen>
|
||||
|
||||
For more information about the regression tests, see
|
||||
<xref linkend="regress"/>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Running the regression tests on client programs with
|
||||
<command>vcregress bincheck</command>, on recovery tests with
|
||||
<command>vcregress recoverycheck</command>, or TAP tests specified with
|
||||
<command>vcregress taptest</command> requires an additional Perl module
|
||||
to be installed:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><productname>IPC::Run</productname></term>
|
||||
<listitem><para>
|
||||
As of this writing, <literal>IPC::Run</literal> is not included in the
|
||||
ActiveState Perl installation, nor in the ActiveState Perl Package
|
||||
Manager (PPM) library. To install, download the
|
||||
<filename>IPC-Run-<version>.tar.gz</filename> source archive from
|
||||
<acronym>CPAN</acronym>,
|
||||
at <ulink url="https://metacpan.org/dist/IPC-Run"></ulink>, and
|
||||
uncompress. Edit the <filename>buildenv.pl</filename> file, and add a PERL5LIB
|
||||
variable to point to the <filename>lib</filename> subdirectory from the
|
||||
extracted archive. For example:
|
||||
<programlisting>
|
||||
$ENV{PERL5LIB}=$ENV{PERL5LIB} . ';c:\IPC-Run-0.94\lib';
|
||||
</programlisting>
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The TAP tests run with <command>vcregress</command> support the
|
||||
environment variables <varname>PROVE_TESTS</varname>, that is expanded
|
||||
automatically using the name patterns given, and
|
||||
<varname>PROVE_FLAGS</varname>. These can be set on a Windows terminal,
|
||||
before running <command>vcregress</command>:
|
||||
<programlisting>
|
||||
set PROVE_FLAGS=--timer --jobs 2
|
||||
set PROVE_TESTS=t/020*.pl t/010*.pl
|
||||
</programlisting>
|
||||
It is also possible to set up those parameters in
|
||||
<filename>buildenv.pl</filename>:
|
||||
<programlisting>
|
||||
$ENV{PROVE_FLAGS}='--timer --jobs 2'
|
||||
$ENV{PROVE_TESTS}='t/020*.pl t/010*.pl'
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Additionally, the behavior of TAP tests can be controlled by a set of
|
||||
environment variables, see <xref linkend="regress-tap-vars" />.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
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 <filename>buildenv.pl</filename>:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><varname>GZIP_PROGRAM</varname></term>
|
||||
<listitem><para>
|
||||
Path to a <application>gzip</application> command. The default is
|
||||
<literal>gzip</literal>, which will search for a command by that
|
||||
name in the configured <envar>PATH</envar>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>LZ4</varname></term>
|
||||
<listitem><para>
|
||||
Path to a <application>lz4</application> command. The default is
|
||||
<literal>lz4</literal>, which will search for a command by that
|
||||
name in the configured <envar>PATH</envar>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>OPENSSL</varname></term>
|
||||
<listitem><para>
|
||||
Path to an <application>openssl</application> command. The default is
|
||||
<literal>openssl</literal>, which will search for a command by that
|
||||
name in the configured <envar>PATH</envar>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>TAR</varname></term>
|
||||
<listitem><para>
|
||||
Path to a <application>tar</application> command. The default is
|
||||
<literal>tar</literal>, which will search for a command by that
|
||||
name in the configured <envar>PATH</envar>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>ZSTD</varname></term>
|
||||
<listitem><para>
|
||||
Path to a <application>zstd</application> command. The default is
|
||||
<literal>zstd</literal>, which will search for a command by that
|
||||
name in the configured <envar>PATH</envar>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -24,13 +24,6 @@ documentation. See standalone-profile.xsl for details.
|
|||
and see <xref linkend="install-binaries" /> instead.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you are building <productname>PostgreSQL</productname> for Microsoft
|
||||
Windows, read this chapter if you intend to build with MinGW or Cygwin;
|
||||
but if you intend to build with Microsoft's <productname>Visual
|
||||
C++</productname>, see <xref linkend="install-windows"/> instead.
|
||||
</para>
|
||||
|
||||
<sect1 id="install-requirements">
|
||||
<title>Requirements</title>
|
||||
|
||||
|
@ -3567,8 +3560,7 @@ ERROR: could not load library "/opt/dbs/pgsql/lib/plperl.so": Bad address
|
|||
<para>
|
||||
PostgreSQL can be built using Cygwin, a Linux-like environment for
|
||||
Windows, but that method is inferior to the native Windows build
|
||||
<phrase condition="standalone-ignore">(see <xref linkend="install-windows"/>)</phrase> and
|
||||
running a server under Cygwin is no longer recommended.
|
||||
and running a server under Cygwin is no longer recommended.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -3734,7 +3726,7 @@ xcrun --show-sdk-path
|
|||
</sect2>
|
||||
|
||||
<sect2 id="installation-notes-mingw">
|
||||
<title>MinGW/Native Windows</title>
|
||||
<title>MinGW</title>
|
||||
|
||||
<indexterm zone="installation-notes-mingw">
|
||||
<primary>MinGW</primary>
|
||||
|
@ -3743,18 +3735,13 @@ xcrun --show-sdk-path
|
|||
|
||||
<para>
|
||||
PostgreSQL for Windows can be built using MinGW, a Unix-like build
|
||||
environment for Microsoft operating systems, or using
|
||||
Microsoft's <productname>Visual C++</productname> compiler suite.
|
||||
environment for Microsoft operating systems.
|
||||
The MinGW build procedure uses the normal build system described in
|
||||
this chapter; the Visual C++ build works completely differently
|
||||
and is described in <xref linkend="install-windows"/>.
|
||||
this chapter.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The native Windows port requires a 32 or 64-bit version of Windows
|
||||
2000 or later. Earlier operating systems do
|
||||
not have sufficient infrastructure (but Cygwin may be used on
|
||||
those). MinGW, the Unix-like build tools, and MSYS, a collection
|
||||
MinGW, the Unix-like build tools, and MSYS, a collection
|
||||
of Unix tools required to run shell scripts
|
||||
like <command>configure</command>, can be downloaded
|
||||
from <ulink url="http://www.mingw.org/"></ulink>. Neither is
|
||||
|
@ -3777,8 +3764,8 @@ xcrun --show-sdk-path
|
|||
buffering issues.
|
||||
</para>
|
||||
|
||||
<sect3 id="windows-crash-dumps">
|
||||
<title>Collecting Crash Dumps on Windows</title>
|
||||
<sect3 id="mingw-crash-dumps">
|
||||
<title>Collecting Crash Dumps</title>
|
||||
|
||||
<para>
|
||||
If PostgreSQL on Windows crashes, it has the ability to generate
|
||||
|
@ -3897,6 +3884,293 @@ make: *** [postgres] Error 1
|
|||
</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="installation-notes-visual">
|
||||
<title>Visual</title>
|
||||
|
||||
<indexterm zone="installation-notes-visual">
|
||||
<primary>Visual</primary>
|
||||
<secondary>installation on</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>
|
||||
It is recommended that most users download the binary distribution for
|
||||
Windows, available as a graphical installer package from the
|
||||
<productname>PostgreSQL</productname> website at
|
||||
<ulink url="https://www.postgresql.org/download/"></ulink>. Building from
|
||||
source is only intended for people developing
|
||||
<productname>PostgreSQL</productname> or extensions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
PostgreSQL for Windows with Visual can be built using meson, as described
|
||||
in <xref linkend="install-meson"/>.
|
||||
The native Windows port requires a 32 or 64-bit version of Windows
|
||||
10 or later.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Native builds of <application>psql</application> don't support command
|
||||
line editing. The <productname>Cygwin</productname> build does support
|
||||
command line editing, so it should be used where psql is needed for
|
||||
interactive use on <productname>Windows</productname>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
PostgreSQL can be built using the Visual C++ compiler suite from Microsoft.
|
||||
These compilers can be either from <productname>Visual Studio</productname>,
|
||||
<productname>Visual Studio Express</productname> or some versions of the
|
||||
<productname>Microsoft Windows SDK</productname>. If you do not already have a
|
||||
<productname>Visual Studio</productname> environment set up, the easiest
|
||||
ways are to use the compilers from
|
||||
<productname>Visual Studio 2022</productname> or those in the
|
||||
<productname>Windows SDK 10</productname>, which are both free downloads
|
||||
from Microsoft.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Both 32-bit and 64-bit builds are possible with the Microsoft Compiler suite.
|
||||
32-bit PostgreSQL builds are possible with
|
||||
<productname>Visual Studio 2015</productname> to
|
||||
<productname>Visual Studio 2022</productname>,
|
||||
as well as standalone Windows SDK releases 10 and above.
|
||||
64-bit PostgreSQL builds are supported with
|
||||
<productname>Microsoft Windows SDK</productname> version 10 and above or
|
||||
<productname>Visual Studio 2015</productname> and above.
|
||||
<!--
|
||||
For 2015 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2015-sysrequirements-vs
|
||||
For 2017 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2017-system-requirements-vs
|
||||
For 2019 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/releases/2019/system-requirements
|
||||
For 2022 requirements:
|
||||
https://docs.microsoft.com/en-us/visualstudio/releases/2022/system-requirements
|
||||
-->
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If your build environment doesn't ship with a supported version of the
|
||||
<productname>Microsoft Windows SDK</productname> it is recommended
|
||||
that you upgrade to the latest version (currently version 10), available
|
||||
for download from <ulink url="https://www.microsoft.com/download"></ulink>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You must always include the
|
||||
<application>Windows Headers and Libraries</application> part of the SDK.
|
||||
If you install a <productname>Windows SDK</productname>
|
||||
including the <application>Visual C++ Compilers</application>,
|
||||
you don't need <productname>Visual Studio</productname> to build.
|
||||
Note that as of Version 8.0a the Windows SDK no longer ships with a
|
||||
complete command-line build environment.
|
||||
</para>
|
||||
|
||||
<sect3 id="windows-requirements">
|
||||
<title>Requirements</title>
|
||||
<para>
|
||||
The following additional products are required to build
|
||||
<productname>PostgreSQL</productname> on Windows.
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><productname>ActiveState Perl</productname></term>
|
||||
<listitem><para>
|
||||
ActiveState Perl is required to run the build generation scripts. MinGW
|
||||
or Cygwin Perl will not work. It must also be present in the PATH.
|
||||
Binaries can be downloaded from
|
||||
<ulink url="https://www.activestate.com"></ulink>
|
||||
(Note: version 5.14 or later is required,
|
||||
the free Standard Distribution is sufficient).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Bison</productname> and
|
||||
<productname>Flex</productname></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<productname>Bison</productname> and <productname>Flex</productname> are
|
||||
required. Only <productname>Bison</productname> versions 2.3 and later
|
||||
will work. <productname>Flex</productname> must be version 2.5.35 or later.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Both <productname>Bison</productname> and <productname>Flex</productname>
|
||||
are included in the <productname>msys</productname> tool suite, available
|
||||
from <ulink url="http://www.mingw.org/wiki/MSYS"></ulink> as part of the
|
||||
<productname>MinGW</productname> compiler suite.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You will need to add the directory containing
|
||||
<filename>flex.exe</filename> and <filename>bison.exe</filename> to the
|
||||
PATH environment variable. In the case of MinGW, the directory is the
|
||||
<filename>\msys\1.0\bin</filename> subdirectory of your MinGW
|
||||
installation directory.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
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 <filename>C:\Program Files\GnuWin32</filename>.
|
||||
Consider installing into <filename>C:\GnuWin32</filename> or use the
|
||||
NTFS short name path to GnuWin32 in your PATH environment setting
|
||||
(e.g., <filename>C:\PROGRA~1\GnuWin32</filename>).
|
||||
</para>
|
||||
</note>
|
||||
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following additional products are not required to get started,
|
||||
but are required to build the complete package.
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><productname>ActiveState Tcl</productname></term>
|
||||
<listitem><para>
|
||||
Required for building <application>PL/Tcl</application> (Note: version
|
||||
8.4 is required, the free Standard Distribution is sufficient).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Diff</productname></term>
|
||||
<listitem><para>
|
||||
Diff is required to run the regression tests, and can be downloaded
|
||||
from <ulink url="http://gnuwin32.sourceforge.net"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Gettext</productname></term>
|
||||
<listitem><para>
|
||||
Gettext is required to build with NLS support, and can be downloaded
|
||||
from <ulink url="http://gnuwin32.sourceforge.net"></ulink>. Note that binaries,
|
||||
dependencies and developer files are all needed.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>MIT Kerberos</productname></term>
|
||||
<listitem><para>
|
||||
Required for GSSAPI authentication support. MIT Kerberos can be
|
||||
downloaded from
|
||||
<ulink url="https://web.mit.edu/Kerberos/dist/index.html"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>libxml2</productname> and
|
||||
<productname>libxslt</productname></term>
|
||||
<listitem><para>
|
||||
Required for XML support. Binaries can be downloaded from
|
||||
<ulink url="https://zlatkovic.com/pub/libxml"></ulink> or source from
|
||||
<ulink url="http://xmlsoft.org"></ulink>. Note that libxml2 requires iconv,
|
||||
which is available from the same download location.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>LZ4</productname></term>
|
||||
<listitem><para>
|
||||
Required for supporting <productname>LZ4</productname> compression.
|
||||
Binaries and source can be downloaded from
|
||||
<ulink url="https://github.com/lz4/lz4/releases"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Zstandard</productname></term>
|
||||
<listitem><para>
|
||||
Required for supporting <productname>Zstandard</productname> compression.
|
||||
Binaries and source can be downloaded from
|
||||
<ulink url="https://github.com/facebook/zstd/releases"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>OpenSSL</productname></term>
|
||||
<listitem><para>
|
||||
Required for SSL support. Binaries can be downloaded from
|
||||
<ulink url="https://slproweb.com/products/Win32OpenSSL.html"></ulink>
|
||||
or source from <ulink url="https://www.openssl.org"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>ossp-uuid</productname></term>
|
||||
<listitem><para>
|
||||
Required for UUID-OSSP support (contrib only). Source can be
|
||||
downloaded from
|
||||
<ulink url="http://www.ossp.org/pkg/lib/uuid/"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>Python</productname></term>
|
||||
<listitem><para>
|
||||
Required for building <application>PL/Python</application>. Binaries can
|
||||
be downloaded from <ulink url="https://www.python.org"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><productname>zlib</productname></term>
|
||||
<listitem><para>
|
||||
Required for compression support in <application>pg_dump</application>
|
||||
and <application>pg_restore</application>. Binaries can be downloaded
|
||||
from <ulink url="https://www.zlib.net"></ulink>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 id="install-windows-full-64-bit">
|
||||
<title>Special Considerations for 64-Bit Windows</title>
|
||||
<para>
|
||||
PostgreSQL will only build for the x64 architecture on 64-bit Windows.
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
<para>
|
||||
To use a server-side third party library such as <productname>Python</productname> or
|
||||
<productname>OpenSSL</productname>, this library <emphasis>must</emphasis> 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 may
|
||||
only be available in 32-bit versions, in which case they cannot be used with
|
||||
64-bit PostgreSQL.
|
||||
</para>
|
||||
</sect3>
|
||||
|
||||
<sect3 id="windows-crash-dumps">
|
||||
<title>Collecting Crash Dumps</title>
|
||||
|
||||
<para>
|
||||
If PostgreSQL on Windows crashes, it has the ability to generate
|
||||
<productname>minidumps</productname> that can be used to track down the cause
|
||||
for the crash, similar to core dumps on Unix. These dumps can be
|
||||
read using the <productname>Windows Debugger Tools</productname> or using
|
||||
<productname>Visual Studio</productname>. To enable the generation of dumps
|
||||
on Windows, create a subdirectory named <filename>crashdumps</filename>
|
||||
inside the cluster data directory. The dumps will then be written
|
||||
into this directory with a unique name based on the identifier of
|
||||
the crashing process and the current time of the crash.
|
||||
</para>
|
||||
</sect3>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
</chapter>
|
||||
|
|
|
@ -152,7 +152,6 @@ break is not needed in a wider output rendering.
|
|||
|
||||
&installbin;
|
||||
&installation;
|
||||
&installw;
|
||||
&runtime;
|
||||
&config;
|
||||
&client-auth;
|
||||
|
|
|
@ -60,10 +60,6 @@ variant without links and references to the main documentation.
|
|||
<xsl:text>the configuration parameter wal_compression</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xref[@linkend='install-windows']">
|
||||
<xsl:text>the documentation</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="xref[@linkend='locale-providers']">
|
||||
<xsl:text>the documentation</xsl:text>
|
||||
</xsl:template>
|
||||
|
|
|
@ -1876,7 +1876,6 @@ foreach w : negative_warning_flags
|
|||
endforeach
|
||||
|
||||
|
||||
# From Project.pm
|
||||
if cc.get_id() == 'msvc'
|
||||
cflags_warn += [
|
||||
'/wd4018', # signed/unsigned mismatch
|
||||
|
|
|
@ -72,7 +72,7 @@ postgres_lib = static_library('postgres_lib',
|
|||
|
||||
if cc.get_id() == 'msvc'
|
||||
postgres_def = 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@',
|
||||
|
|
|
@ -35,9 +35,6 @@ OBJS = \
|
|||
streamutil.o \
|
||||
walmethods.o
|
||||
|
||||
# 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.
|
||||
BBOBJS = \
|
||||
pg_basebackup.o \
|
||||
bbstreamer_file.o \
|
||||
|
|
|
@ -14,7 +14,8 @@ pgevent_sources += rc_bin_gen.process(win32ver_rc, extra_args: [
|
|||
|
||||
pgevent_sources += windows.compile_resources('pgmsgevent.rc')
|
||||
|
||||
# FIXME: copied from Mkvcbuild.pm, but I don't think that's the right approach
|
||||
# XXX: We may want to revisit the addition of this flag and improve the
|
||||
# way symbols are exported.
|
||||
pgevent_link_args = []
|
||||
if cc.get_id() == 'msvc'
|
||||
pgevent_link_args += '/ignore:4104'
|
||||
|
|
|
@ -43,8 +43,6 @@ override CPPFLAGS += -DVAL_LIBS="\"$(LIBS)\""
|
|||
override CPPFLAGS := -DFRONTEND -I. -I$(top_srcdir)/src/common $(CPPFLAGS)
|
||||
LIBS += $(PTHREAD_LIBS)
|
||||
|
||||
# If you add objects here, see also src/tools/msvc/Mkvcbuild.pm
|
||||
|
||||
OBJS_COMMON = \
|
||||
archive.o \
|
||||
base64.o \
|
||||
|
@ -99,11 +97,10 @@ OBJS_COMMON += \
|
|||
sha2.o
|
||||
endif
|
||||
|
||||
# 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.
|
||||
# A few files are currently only built for frontend, not server.
|
||||
# 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 = \
|
||||
$(OBJS_COMMON) \
|
||||
fe_memutils.o \
|
||||
|
|
|
@ -96,11 +96,10 @@ common_sources_cflags = {
|
|||
}
|
||||
|
||||
|
||||
# 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.
|
||||
# A few files are currently only built for frontend, not server.
|
||||
# logging.c is excluded from OBJS_FRONTEND_SHLIB (shared library) as
|
||||
# a matter of policy, because it is not appropriate for general purpose
|
||||
# libraries such as libpq to report errors directly.
|
||||
|
||||
common_sources_frontend_shlib = common_sources
|
||||
common_sources_frontend_shlib += files(
|
||||
|
|
|
@ -27,9 +27,6 @@ ifneq ($(PORTNAME), win32)
|
|||
override CFLAGS += $(PTHREAD_CFLAGS)
|
||||
endif
|
||||
|
||||
# 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 = \
|
||||
$(WIN32RES) \
|
||||
fe-auth-scram.o \
|
||||
|
|
|
@ -35,8 +35,6 @@ include $(top_builddir)/src/Makefile.global
|
|||
override CPPFLAGS := -I$(top_builddir)/src/port -DFRONTEND $(CPPFLAGS)
|
||||
LIBS += $(PTHREAD_LIBS)
|
||||
|
||||
# If you add objects here, see also src/tools/msvc/Mkvcbuild.pm
|
||||
|
||||
OBJS = \
|
||||
$(LIBOBJS) \
|
||||
$(PG_CRC32C_OBJS) \
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
* On platforms compliant with modern POSIX, this just wraps strsignal(3).
|
||||
* Elsewhere, we do the best we can.
|
||||
*
|
||||
* This file is not currently built in MSVC builds, since it's useless
|
||||
* on non-Unix platforms.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# Custom configuration files for MSVC build
|
||||
/config.pl
|
||||
/buildenv.pl
|
|
@ -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 = qw(Exporter);
|
||||
@EXPORT_OK = qw(Install);
|
||||
|
||||
my $insttype;
|
||||
my @client_contribs = ('oid2name', 'pgbench', 'vacuumlo');
|
||||
my @client_program_files = (
|
||||
'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 = shift;
|
||||
my $target = shift;
|
||||
|
||||
if (-f $target)
|
||||
{
|
||||
unlink $target || confess "Could not delete $target\n";
|
||||
}
|
||||
|
||||
(my $retval = copy($src, $target))
|
||||
|| confess "Could not copy $src to $target\n";
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
sub Install
|
||||
{
|
||||
$| = 1;
|
||||
|
||||
my $target = shift;
|
||||
$insttype = shift;
|
||||
$insttype = "all" unless ($insttype);
|
||||
|
||||
# if called from vcregress, the config will be passed to us
|
||||
# so no need to re-include these
|
||||
our $config = 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 = "";
|
||||
if (-d "debug")
|
||||
{
|
||||
$conf = "debug";
|
||||
}
|
||||
if (-d "release")
|
||||
{
|
||||
$conf = "release";
|
||||
}
|
||||
die "Could not find debug or release binaries" if ($conf eq "");
|
||||
my $majorver = DetermineMajorVersion();
|
||||
print "Installing version $majorver for $conf in $target\n";
|
||||
|
||||
my @client_dirs = ('bin', 'lib', 'share', 'symbols');
|
||||
my @all_dirs = (
|
||||
@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 = [];
|
||||
my @top_dir = ("src");
|
||||
@top_dir = ("src\\bin", "src\\interfaces") if ($insttype eq "client");
|
||||
File::Find::find(
|
||||
{
|
||||
wanted => 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 = 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 = [];
|
||||
my @pldirs = ('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 => 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 = 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 = shift;
|
||||
mkdir $target unless -d ($target);
|
||||
while (my $d = shift)
|
||||
{
|
||||
mkdir $target . '/' . $d unless -d ($target . '/' . $d);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub CopyFiles
|
||||
{
|
||||
my $what = shift;
|
||||
my $target = shift;
|
||||
my $basedir = shift;
|
||||
|
||||
print "Copying $what";
|
||||
while (my $f = shift)
|
||||
{
|
||||
print ".";
|
||||
$f = $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 = shift;
|
||||
my $flist = shift;
|
||||
my $target = shift;
|
||||
print "Copying $what" if $what;
|
||||
foreach (@$flist)
|
||||
{
|
||||
my $tgt = $target . basename($_);
|
||||
print ".";
|
||||
lcopy($_, $tgt) || croak "Could not copy $_: $!\n";
|
||||
}
|
||||
print "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
sub CopySolutionOutput
|
||||
{
|
||||
my $conf = shift;
|
||||
my $target = shift;
|
||||
my $rem =
|
||||
qr{Project\("\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942\}"\) = "([^"]+)"};
|
||||
|
||||
my $sln = read_file("pgsql.sln") || croak "Could not open pgsql.sln\n";
|
||||
|
||||
my $vcproj = 'vcproj';
|
||||
if ($sln =~
|
||||
/Microsoft Visual Studio Solution File, Format Version (\d+)\.\d+/
|
||||
&& $1 >= 11)
|
||||
{
|
||||
$vcproj = 'vcxproj';
|
||||
}
|
||||
|
||||
print "Copying build output files...";
|
||||
while ($sln =~ $rem)
|
||||
{
|
||||
my $pf = $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' => [ 'dll', 'lib' ],
|
||||
# 'lib' => [ 'lib' ] }
|
||||
my %install_list;
|
||||
my $is_sharedlib = 0;
|
||||
|
||||
$sln =~ s/$rem//;
|
||||
|
||||
next
|
||||
if ($insttype eq "client" && !grep { $_ eq $pf }
|
||||
@client_program_files);
|
||||
|
||||
my $proj = 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 =~ qr{ResourceCompile\s*Include="([^"]+)"})
|
||||
|| ( $vcproj eq 'vcproj'
|
||||
&& $proj =~ qr{File\s*RelativePath="([^\"]+)\.rc"}))
|
||||
{
|
||||
my $projpath = dirname($1);
|
||||
my $mfname =
|
||||
-e "$projpath/GNUmakefile"
|
||||
? "$projpath/GNUmakefile"
|
||||
: "$projpath/Makefile";
|
||||
my $mf = read_file($mfname) || croak "Could not open $mfname\n";
|
||||
|
||||
$is_sharedlib = 1 if ($mf =~ /^SO_MAJOR_VERSION\s*=\s*(.*)$/mg);
|
||||
}
|
||||
|
||||
if ($vcproj eq 'vcproj' && $proj =~ qr{ConfigurationType="([^"]+)"})
|
||||
{
|
||||
if ($1 == 1)
|
||||
{
|
||||
push(@{ $install_list{'bin'} }, "exe");
|
||||
}
|
||||
elsif ($1 == 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 =~ qr{<ConfigurationType>(\w+)</ConfigurationType>})
|
||||
{
|
||||
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 = shift;
|
||||
my $conf = shift;
|
||||
my $mf = read_file("src/timezone/Makefile");
|
||||
$mf =~ s{\\\r?\n}{}g;
|
||||
|
||||
$mf =~ /^TZDATAFILES\s*:?=\s*(.*)$/m
|
||||
|| die "Could not find TZDATAFILES line in timezone makefile\n";
|
||||
my @tzfiles = split /\s+/, $1;
|
||||
|
||||
print "Generating timezone files...";
|
||||
|
||||
my @args = ("$conf/zic/zic", '-d', "$target/share/timezone");
|
||||
foreach (@tzfiles)
|
||||
{
|
||||
my $tzfile = $_;
|
||||
$tzfile =~ s|\$\(srcdir\)|src/timezone|;
|
||||
push(@args, $tzfile);
|
||||
}
|
||||
|
||||
system(@args);
|
||||
print "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
sub GenerateTsearchFiles
|
||||
{
|
||||
my $target = 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 = shift;
|
||||
my $target = 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 = 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 =~ /_plperl$/ && !defined($config->{perl}));
|
||||
next if ($d =~ /_plpython$/ && !defined($config->{python}));
|
||||
next if ($d eq "sepgsql");
|
||||
|
||||
CopySubdirFiles($subdir, $d, $config, $target);
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
sub CopySubdirFiles
|
||||
{
|
||||
my $subdir = shift;
|
||||
my $module = shift;
|
||||
my $config = shift;
|
||||
my $target = shift;
|
||||
|
||||
return if ($module =~ /^\./);
|
||||
return unless (-f "$subdir/$module/Makefile");
|
||||
return
|
||||
if ($insttype eq "client" && !grep { $_ eq $module } @client_contribs);
|
||||
|
||||
my $mf = read_file("$subdir/$module/Makefile");
|
||||
$mf =~ s{\\\r?\n}{}g;
|
||||
|
||||
# Note: we currently don't support setting MODULEDIR in the makefile
|
||||
my $moduledir = 'contrib';
|
||||
|
||||
my $flist = '';
|
||||
if ($mf =~ /^EXTENSION\s*=\s*(.*)$/m) { $flist .= $1 }
|
||||
if ($flist ne '')
|
||||
{
|
||||
$moduledir = 'extension';
|
||||
$flist = 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 = '';
|
||||
if ($mf =~ /^DATA_built\s*=\s*(.*)$/m) { $flist .= $1 }
|
||||
if ($mf =~ /^DATA\s*=\s*(.*)$/m) { $flist .= " $1" }
|
||||
$flist =~ s/^\s*//; # Remove leading spaces if we had only DATA_built
|
||||
|
||||
if ($flist ne '')
|
||||
{
|
||||
$flist = 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 = '';
|
||||
if ($mf =~ /^DATA_TSEARCH\s*=\s*(.*)$/m) { $flist .= $1 }
|
||||
if ($flist ne '')
|
||||
{
|
||||
$flist = 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 = '';
|
||||
if ($mf =~ /^HEADERS\s*=\s*(.*)$/m) { $flist .= $1 }
|
||||
my @modlist = ();
|
||||
my %fmodlist = ();
|
||||
while ($mf =~ /^HEADERS_([^\s=]+)\s*=\s*(.*)$/mg)
|
||||
{
|
||||
$fmodlist{$1} .= $2;
|
||||
}
|
||||
|
||||
if ($mf =~ /^MODULE_big\s*=\s*(.*)$/m)
|
||||
{
|
||||
push @modlist, $1;
|
||||
if ($flist ne '')
|
||||
{
|
||||
$fmodlist{$1} = $flist;
|
||||
$flist = '';
|
||||
}
|
||||
}
|
||||
elsif ($mf =~ /^MODULES\s*=\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 = 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 = '';
|
||||
if ($mf =~ /^DOCS\s*=\s*(.*)$/mg) { $flist .= $1 }
|
||||
if ($flist ne '')
|
||||
{
|
||||
$flist = ParseAndCleanRule($flist, $mf);
|
||||
|
||||
# Special case for contrib/spi
|
||||
$flist =
|
||||
"autoinc.example insert_username.example moddatetime.example refint.example"
|
||||
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 = shift;
|
||||
my $mf = shift;
|
||||
|
||||
# Strip out $(addsuffix) rules
|
||||
if (index($flist, '$(addsuffix ') >= 0)
|
||||
{
|
||||
my $pcount = 0;
|
||||
my $i;
|
||||
for (
|
||||
$i = 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 =
|
||||
substr($flist, 0, index($flist, '$(addsuffix '))
|
||||
. substr($flist, $i + 1);
|
||||
}
|
||||
return $flist;
|
||||
}
|
||||
|
||||
sub CopyIncludeFiles
|
||||
{
|
||||
my $target = 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 = $target) =~ s!/!\\!g;
|
||||
while (my $d = readdir($D))
|
||||
{
|
||||
next if ($d =~ /^\./);
|
||||
next if ($d eq '.git');
|
||||
next if ($d eq 'CVS');
|
||||
next unless (-d "src/include/$d");
|
||||
|
||||
EnsureDirectories("$target/include/server/$d");
|
||||
my @args = (
|
||||
'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 = read_file('src/interfaces/ecpg/include/Makefile');
|
||||
$mf =~ s{\\\r?\n}{}g;
|
||||
$mf =~ /^ecpg_headers\s*=\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 =~ /^informix_headers\s*=\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 = shift;
|
||||
my $nlspath = shift;
|
||||
my $majorver = shift;
|
||||
|
||||
print "Installing NLS files...";
|
||||
EnsureDirectories($target, "share/locale");
|
||||
my @flist;
|
||||
File::Find::find(
|
||||
{
|
||||
wanted => sub {
|
||||
/^nls\.mk\z/s
|
||||
&& !push(@flist, $File::Find::name);
|
||||
}
|
||||
},
|
||||
"src");
|
||||
foreach (@flist)
|
||||
{
|
||||
my $prgm = DetermineCatalogName($_);
|
||||
s/nls.mk/po/;
|
||||
my $dir = $_;
|
||||
next unless ($dir =~ /([^\/]+)\/po$/);
|
||||
foreach (glob("$dir/*.po"))
|
||||
{
|
||||
my $lang;
|
||||
next unless /([^\/]+)\.po/;
|
||||
$lang = $1;
|
||||
|
||||
EnsureDirectories($target, "share/locale/$lang",
|
||||
"share/locale/$lang/LC_MESSAGES");
|
||||
my @args = (
|
||||
"$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 = read_file('src/include/pg_config.h')
|
||||
|| croak 'Could not open pg_config.h';
|
||||
$f =~ /^#define\s+PG_MAJORVERSION\s+"([^"]+)"/m
|
||||
|| croak 'Could not determine major version';
|
||||
return $1;
|
||||
}
|
||||
|
||||
sub DetermineCatalogName
|
||||
{
|
||||
my $filename = shift;
|
||||
|
||||
my $f = read_file($filename) || croak "Could not open $filename";
|
||||
$f =~ /CATALOG_NAME\s*\:?=\s*(\S+)/m
|
||||
|| croak "Could not determine catalog name in $filename";
|
||||
return $1;
|
||||
}
|
||||
|
||||
sub read_file
|
||||
{
|
||||
my $filename = shift;
|
||||
my $F;
|
||||
local $/ = undef;
|
||||
open($F, '<', $filename) || die "Could not open file $filename\n";
|
||||
my $txt = <$F>;
|
||||
close($F);
|
||||
|
||||
return $txt;
|
||||
}
|
||||
|
||||
1;
|
|
@ -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 greater)
|
||||
#
|
||||
# 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 = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{filenameExtension} = '.vcxproj';
|
||||
$self->{ToolsVersion} = '4.0';
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub WriteHeader
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
|
||||
print $f <<EOF;
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="$self->{ToolsVersion}" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
EOF
|
||||
$self->WriteConfigurationHeader($f, 'Debug');
|
||||
$self->WriteConfigurationHeader($f, 'Release');
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>$self->{guid}</ProjectGuid>
|
||||
EOF
|
||||
# Check whether WindowsSDKVersion env variable is present.
|
||||
# Add WindowsTargetPlatformVersion node if so.
|
||||
my $sdkVersion = $ENV{'WindowsSDKVersion'};
|
||||
if (defined($sdkVersion))
|
||||
{
|
||||
# remove trailing backslash if necessary.
|
||||
$sdkVersion =~ s/\\$//;
|
||||
print $f <<EOF;
|
||||
<WindowsTargetPlatformVersion>$sdkVersion</WindowsTargetPlatformVersion>
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
</PropertyGroup>
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />
|
||||
EOF
|
||||
$self->WriteConfigurationPropertyGroup($f, 'Release',
|
||||
{ wholeopt => 'false' });
|
||||
$self->WriteConfigurationPropertyGroup($f, 'Debug',
|
||||
{ wholeopt => 'false' });
|
||||
print $f <<EOF;
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
EOF
|
||||
$self->WritePropertySheetsPropertyGroup($f, 'Release');
|
||||
$self->WritePropertySheetsPropertyGroup($f, 'Debug');
|
||||
print $f <<EOF;
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
EOF
|
||||
$self->WriteAdditionalProperties($f, 'Debug');
|
||||
$self->WriteAdditionalProperties($f, 'Release');
|
||||
print $f <<EOF;
|
||||
</PropertyGroup>
|
||||
EOF
|
||||
|
||||
$self->WriteItemDefinitionGroup(
|
||||
$f, 'Debug',
|
||||
{
|
||||
defs => "_DEBUG;DEBUG=1",
|
||||
opt => 'Disabled',
|
||||
strpool => 'false',
|
||||
runtime => 'MultiThreadedDebugDLL'
|
||||
});
|
||||
$self->WriteItemDefinitionGroup(
|
||||
$f,
|
||||
'Release',
|
||||
{
|
||||
defs => "",
|
||||
opt => 'Full',
|
||||
strpool => 'true',
|
||||
runtime => 'MultiThreadedDLL'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddDefine
|
||||
{
|
||||
my ($self, $def) = @_;
|
||||
|
||||
$self->{defines} .= $def . ';';
|
||||
return;
|
||||
}
|
||||
|
||||
sub WriteReferences
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
|
||||
my @references = @{ $self->{references} };
|
||||
|
||||
if (scalar(@references))
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
foreach my $ref (@references)
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ProjectReference Include="$ref->{name}$ref->{filenameExtension}">
|
||||
<Project>$ref->{guid}</Project>
|
||||
</ProjectReference>
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub WriteFiles
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
my @grammarFiles = ();
|
||||
my @resourceFiles = ();
|
||||
my %uniquefiles;
|
||||
foreach my $fileNameWithPath (sort keys %{ $self->{files} })
|
||||
{
|
||||
confess "Bad format filename '$fileNameWithPath'\n"
|
||||
unless ($fileNameWithPath =~ m!^(.*)/([^/]+)\.(c|cpp|y|l|rc)$!);
|
||||
my $dir = $1;
|
||||
my $fileName = $2;
|
||||
if ($fileNameWithPath =~ /\.y$/ or $fileNameWithPath =~ /\.l$/)
|
||||
{
|
||||
push @grammarFiles, $fileNameWithPath;
|
||||
}
|
||||
elsif ($fileNameWithPath =~ /\.rc$/)
|
||||
{
|
||||
push @resourceFiles, $fileNameWithPath;
|
||||
}
|
||||
elsif (defined($uniquefiles{$fileName}))
|
||||
{
|
||||
|
||||
# File already exists, so fake a new name
|
||||
my $obj = $dir;
|
||||
$obj =~ s!/!_!g;
|
||||
|
||||
print $f <<EOF;
|
||||
<ClCompile Include="$fileNameWithPath">
|
||||
<ObjectFileName Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">.\\debug\\$self->{name}\\${obj}_$fileName.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">.\\release\\$self->{name}\\${obj}_$fileName.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
EOF
|
||||
}
|
||||
else
|
||||
{
|
||||
$uniquefiles{$fileName} = 1;
|
||||
print $f <<EOF;
|
||||
<ClCompile Include="$fileNameWithPath" />
|
||||
EOF
|
||||
}
|
||||
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
if (scalar(@grammarFiles))
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
foreach my $grammarFile (@grammarFiles)
|
||||
{
|
||||
(my $outputFile = $grammarFile) =~ s/\.(y|l)$/.c/;
|
||||
if ($grammarFile =~ /\.y$/)
|
||||
{
|
||||
$outputFile =~
|
||||
s{^src\\pl\\plpgsql\\src\\gram.c$}{src\\pl\\plpgsql\\src\\pl_gram.c};
|
||||
print $f <<EOF;
|
||||
<CustomBuild Include="$grammarFile">
|
||||
<Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running bison on $grammarFile</Message>
|
||||
<Command Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"</Command>
|
||||
<AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
|
||||
<Message Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">Running bison on $grammarFile</Message>
|
||||
<Command Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">perl "src\\tools\\msvc\\pgbison.pl" "$grammarFile"</Command>
|
||||
<AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
EOF
|
||||
}
|
||||
else #if ($grammarFile =~ /\.l$/)
|
||||
{
|
||||
print $f <<EOF;
|
||||
<CustomBuild Include="$grammarFile">
|
||||
<Message Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">Running flex on $grammarFile</Message>
|
||||
<Command Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"</Command>
|
||||
<AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'\$(Configuration)|\$(Platform)'=='Debug|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
|
||||
<Message Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">Running flex on $grammarFile</Message>
|
||||
<Command Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">perl "src\\tools\\msvc\\pgflex.pl" "$grammarFile"</Command>
|
||||
<AdditionalInputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">%(AdditionalInputs)</AdditionalInputs>
|
||||
<Outputs Condition="'\$(Configuration)|\$(Platform)'=='Release|$self->{platform}'">$outputFile;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
EOF
|
||||
}
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
}
|
||||
if (scalar(@resourceFiles))
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ItemGroup>
|
||||
EOF
|
||||
foreach my $rcFile (@resourceFiles)
|
||||
{
|
||||
print $f <<EOF;
|
||||
<ResourceCompile Include="$rcFile" />
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemGroup>
|
||||
EOF
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub WriteConfigurationHeader
|
||||
{
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
<ProjectConfiguration Include="$cfgname|$self->{platform}">
|
||||
<Configuration>$cfgname</Configuration>
|
||||
<Platform>$self->{platform}</Platform>
|
||||
</ProjectConfiguration>
|
||||
EOF
|
||||
return;
|
||||
}
|
||||
|
||||
sub WriteConfigurationPropertyGroup
|
||||
{
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype =
|
||||
($self->{type} eq "exe")
|
||||
? 'Application'
|
||||
: ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary');
|
||||
|
||||
print $f <<EOF;
|
||||
<PropertyGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" Label="Configuration">
|
||||
<ConfigurationType>$cfgtype</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>$p->{wholeopt}</WholeProgramOptimization>
|
||||
<PlatformToolset>$self->{PlatformToolset}</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
EOF
|
||||
return;
|
||||
}
|
||||
|
||||
sub WritePropertySheetsPropertyGroup
|
||||
{
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
<ImportGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'" Label="PropertySheets">
|
||||
<Import Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
EOF
|
||||
return;
|
||||
}
|
||||
|
||||
sub WriteAdditionalProperties
|
||||
{
|
||||
my ($self, $f, $cfgname) = @_;
|
||||
print $f <<EOF;
|
||||
<OutDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</OutDir>
|
||||
<IntDir Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">.\\$cfgname\\$self->{name}\\</IntDir>
|
||||
<LinkIncremental Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">false</LinkIncremental>
|
||||
EOF
|
||||
return;
|
||||
}
|
||||
|
||||
sub WriteItemDefinitionGroup
|
||||
{
|
||||
my ($self, $f, $cfgname, $p) = @_;
|
||||
my $cfgtype =
|
||||
($self->{type} eq "exe")
|
||||
? 'Application'
|
||||
: ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary');
|
||||
my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';');
|
||||
|
||||
my $targetmachine =
|
||||
$self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
|
||||
my $arch = $self->{platform} eq 'Win32' ? 'x86' : 'x86_64';
|
||||
|
||||
my $includes = join ';', @{ $self->{includes} }, "";
|
||||
|
||||
print $f <<EOF;
|
||||
<ItemDefinitionGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">
|
||||
<ClCompile>
|
||||
<Optimization>$p->{opt}</Optimization>
|
||||
<AdditionalIncludeDirectories>$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$includes\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;__WINDOWS__;__WIN32__;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}\%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>$p->{strpool}</StringPooling>
|
||||
<RuntimeLibrary>$p->{runtime}</RuntimeLibrary>
|
||||
<DisableSpecificWarnings>$self->{disablewarnings};\%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/MP \%(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerOutput>
|
||||
</AssemblerOutput>
|
||||
<AssemblerListingLocation>.\\$cfgname\\$self->{name}\\</AssemblerListingLocation>
|
||||
<ObjectFileName>.\\$cfgname\\$self->{name}\\</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\\$cfgname\\$self->{name}\\</ProgramDataBaseFileName>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>.\\$cfgname\\$self->{name}\\$self->{name}.$self->{type}</OutputFile>
|
||||
<AdditionalDependencies>$libs;\%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>\%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>libc;\%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<StackReserveSize>4194304</StackReserveSize>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>.\\$cfgname\\$self->{name}\\$self->{name}.pdb</ProgramDatabaseFile>
|
||||
<GenerateMapFile>false</GenerateMapFile>
|
||||
<MapFileName>.\\$cfgname\\$self->{name}\\$self->{name}.map</MapFileName>
|
||||
<!-- Permit links to MinGW-built, 32-bit DLLs (default before VS2012). -->
|
||||
<ImageHasSafeExceptionHandlers/>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>$targetmachine</TargetMachine>
|
||||
EOF
|
||||
if ($self->{disablelinkerwarnings})
|
||||
{
|
||||
print $f
|
||||
" <AdditionalOptions>/ignore:$self->{disablelinkerwarnings} \%(AdditionalOptions)</AdditionalOptions>\n";
|
||||
}
|
||||
if ($self->{implib})
|
||||
{
|
||||
my $l = $self->{implib};
|
||||
$l =~ s/__CFGNAME__/$cfgname/g;
|
||||
print $f " <ImportLibrary>$l</ImportLibrary>\n";
|
||||
}
|
||||
if ($self->{def})
|
||||
{
|
||||
my $d = $self->{def};
|
||||
$d =~ s/__CFGNAME__/$cfgname/g;
|
||||
print $f " <ModuleDefinitionFile>$d</ModuleDefinitionFile>\n";
|
||||
}
|
||||
print $f <<EOF;
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>src\\include;\%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
EOF
|
||||
if ($self->{builddef})
|
||||
{
|
||||
print $f <<EOF;
|
||||
<PreLinkEvent>
|
||||
<Message>Generate DEF file</Message>
|
||||
<Command>perl src\\tools\\msvc\\gendef.pl --arch $arch --deffile $cfgname\\$self->{name}\\$self->{name}.def --tempdir $cfgname\\$self->{name} $cfgname\\$self->{name}</Command>
|
||||
</PreLinkEvent>
|
||||
EOF
|
||||
}
|
||||
print $f <<EOF;
|
||||
</ItemDefinitionGroup>
|
||||
EOF
|
||||
return;
|
||||
}
|
||||
|
||||
sub Footer
|
||||
{
|
||||
my ($self, $f) = @_;
|
||||
$self->WriteReferences($f);
|
||||
|
||||
print $f <<EOF;
|
||||
<Import Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
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 = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '14.00';
|
||||
$self->{PlatformToolset} = 'v140';
|
||||
$self->{ToolsVersion} = '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 = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '15.00';
|
||||
$self->{PlatformToolset} = 'v141';
|
||||
$self->{ToolsVersion} = '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 = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '16.00';
|
||||
$self->{PlatformToolset} = 'v142';
|
||||
$self->{ToolsVersion} = '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 = shift;
|
||||
my $self = $classname->SUPER::_new(@_);
|
||||
bless($self, $classname);
|
||||
|
||||
$self->{vcver} = '17.00';
|
||||
$self->{PlatformToolset} = 'v143';
|
||||
$self->{ToolsVersion} = '17.0';
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
1;
|
File diff suppressed because it is too large
Load Diff
|
@ -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) = @_;
|
||||
my $good_types = {
|
||||
lib => 1,
|
||||
exe => 1,
|
||||
dll => 1,
|
||||
};
|
||||
confess("Bad project type: $type\n") unless exists $good_types->{$type};
|
||||
my $self = {
|
||||
name => $name,
|
||||
type => $type,
|
||||
guid => $^O eq "MSWin32" ? Win32::GuidGen() : 'FAKE',
|
||||
files => {},
|
||||
references => [],
|
||||
libraries => [],
|
||||
suffixlib => [],
|
||||
includes => [],
|
||||
prefixincludes => '',
|
||||
defines => ';',
|
||||
solution => $solution,
|
||||
disablewarnings => '4018;4244;4273;4101;4102;4090;4267',
|
||||
disablelinkerwarnings => '',
|
||||
platform => $solution->{platform},
|
||||
};
|
||||
|
||||
bless($self, $classname);
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub AddFile
|
||||
{
|
||||
my ($self, $filename) = @_;
|
||||
|
||||
$self->FindAndAddAdditionalFiles($filename);
|
||||
$self->{files}->{$filename} = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddDependantFiles
|
||||
{
|
||||
my ($self, $filename) = @_;
|
||||
|
||||
$self->FindAndAddAdditionalFiles($filename);
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddFiles
|
||||
{
|
||||
my $self = shift;
|
||||
my $dir = shift;
|
||||
|
||||
while (my $f = 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 = shift;
|
||||
my $fname = shift;
|
||||
$fname =~ /(.*)(\.[^.]+)$/;
|
||||
my $filenoext = $1;
|
||||
my $fileext = $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 = $filenoext . ".l";
|
||||
if (-e $file)
|
||||
{
|
||||
$self->AddFile($file);
|
||||
}
|
||||
|
||||
$file = $filenoext . ".y";
|
||||
if (-e $file)
|
||||
{
|
||||
$self->AddFile($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub ReplaceFile
|
||||
{
|
||||
my ($self, $filename, $newname) = @_;
|
||||
my $re = "\\/$filename\$";
|
||||
|
||||
foreach my $file (keys %{ $self->{files} })
|
||||
{
|
||||
|
||||
# Match complete filename
|
||||
if ($filename =~ m!/!)
|
||||
{
|
||||
if ($file eq $filename)
|
||||
{
|
||||
delete $self->{files}{$file};
|
||||
$self->AddFile($newname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
elsif ($file =~ 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) = @_;
|
||||
my $orig = 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) = @_;
|
||||
foreach my $f (keys %{ $self->{files} })
|
||||
{
|
||||
my $r = &$proc($f);
|
||||
if ($r)
|
||||
{
|
||||
$self->RemoveFile($f);
|
||||
$self->AddFile($targetdir . '/' . basename($f));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddReference
|
||||
{
|
||||
my $self = shift;
|
||||
|
||||
while (my $ref = 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) = @_;
|
||||
|
||||
# quote lib name if it has spaces and isn't already quoted
|
||||
if ($lib =~ m/\s/ && $lib !~ m/^[&]quot;/)
|
||||
{
|
||||
$lib = '"' . $lib . """;
|
||||
}
|
||||
|
||||
if (!grep { $_ eq $lib } @{ $self->{libraries} })
|
||||
{
|
||||
push @{ $self->{libraries} }, $lib;
|
||||
}
|
||||
|
||||
if ($dbgsuffix)
|
||||
{
|
||||
push @{ $self->{suffixlib} }, $lib;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddIncludeDir
|
||||
{
|
||||
my ($self, $incstr) = @_;
|
||||
|
||||
foreach my $inc (split(/;/, $incstr))
|
||||
{
|
||||
if (!grep { $_ eq $inc } @{ $self->{includes} })
|
||||
{
|
||||
push @{ $self->{includes} }, $inc;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddPrefixInclude
|
||||
{
|
||||
my ($self, $inc) = @_;
|
||||
|
||||
$self->{prefixincludes} = $inc . ';' . $self->{prefixincludes};
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddDefine
|
||||
{
|
||||
my ($self, $def) = @_;
|
||||
|
||||
$def =~ s/"/""/g;
|
||||
$self->{defines} .= $def . ';';
|
||||
return;
|
||||
}
|
||||
|
||||
sub FullExportDLL
|
||||
{
|
||||
my ($self, $libname) = @_;
|
||||
|
||||
$self->{builddef} = 1;
|
||||
$self->{def} = "./__CFGNAME__/$self->{name}/$self->{name}.def";
|
||||
$self->{implib} = "__CFGNAME__/$self->{name}/$libname";
|
||||
return;
|
||||
}
|
||||
|
||||
sub UseDef
|
||||
{
|
||||
my ($self, $def) = @_;
|
||||
|
||||
$self->{def} = $def;
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddDir
|
||||
{
|
||||
my ($self, $reldir) = @_;
|
||||
my $mf = read_makefile($reldir);
|
||||
|
||||
$mf =~ s{\\\r?\n}{}g;
|
||||
if ($mf =~ m{^(?:SUB)?DIRS[^=]*=\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 =~ m{^(?:EXTRA_)?OBJS[^=]*=\s*(.*)$}m)
|
||||
{
|
||||
my $s = $1;
|
||||
my $filter_re = qr{\$\(filter ([^,]+),\s+\$\(([^\)]+)\)\)};
|
||||
while ($s =~ /$filter_re/)
|
||||
{
|
||||
|
||||
# Process $(filter a b c, $(VAR)) expressions
|
||||
my $list = $1;
|
||||
my $filter = $2;
|
||||
$list =~ s/\.o/\.c/g;
|
||||
my @pieces = split /\s+/, $list;
|
||||
my $matches = "";
|
||||
foreach my $p (@pieces)
|
||||
{
|
||||
|
||||
if ($filter eq "LIBOBJS")
|
||||
{
|
||||
no warnings qw(once);
|
||||
if (grep(/$p/, @main::pgportfiles) == 1)
|
||||
{
|
||||
$p =~ s/\.c/\.o/;
|
||||
$matches .= $p . " ";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
confess "Unknown filter $filter\n";
|
||||
}
|
||||
}
|
||||
$s =~ s/$filter_re/$matches/;
|
||||
}
|
||||
foreach my $f (split /\s+/, $s)
|
||||
{
|
||||
next if $f =~ /^\s*$/;
|
||||
next if $f eq "\\";
|
||||
next if $f =~ /\/SUBSYS.o$/;
|
||||
$f =~ s/,$//
|
||||
; # Remove trailing comma that can show up from filter stuff
|
||||
next unless $f =~ /.*\.o$/;
|
||||
$f =~ s/\.o$/\.c/;
|
||||
if ($f =~ /^\$\(top_builddir\)\/(.*)/)
|
||||
{
|
||||
$f = $1;
|
||||
$self->AddFile($f);
|
||||
}
|
||||
else
|
||||
{
|
||||
$self->AddFile("$reldir/$f");
|
||||
}
|
||||
}
|
||||
$mf =~ s{OBJS[^=]*=\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 =
|
||||
qr{^([^:\n\$]+\.c)\s*:\s*(?:%\s*: )?\$(\([^\)]+\))\/(.*)\/[^\/]+\n}m;
|
||||
while ($mf =~ m{$replace_re}m)
|
||||
{
|
||||
my $match = $1;
|
||||
my $top = $2;
|
||||
my $target = $3;
|
||||
my @pieces = 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 =~ s{$replace_re}{}m;
|
||||
}
|
||||
|
||||
$self->AddDirResourceFile($reldir);
|
||||
return;
|
||||
}
|
||||
|
||||
# If the directory's Makefile bears a description string, add a resource file.
|
||||
sub AddDirResourceFile
|
||||
{
|
||||
my ($self, $reldir) = @_;
|
||||
my $mf = read_makefile($reldir);
|
||||
|
||||
if ($mf =~ /^PGFILEDESC\s*=\s*\"([^\"]+)\"/m)
|
||||
{
|
||||
my $desc = $1;
|
||||
my $ico;
|
||||
if ($mf =~ /^PGAPPICON\s*=\s*(.*)$/m) { $ico = $1; }
|
||||
$self->AddResourceFile($reldir, $desc, $ico);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub AddResourceFile
|
||||
{
|
||||
my ($self, $dir, $desc, $ico) = @_;
|
||||
|
||||
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 = $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 = $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) = @_;
|
||||
|
||||
$self->{disablelinkerwarnings} .= ','
|
||||
unless ($self->{disablelinkerwarnings} eq '');
|
||||
$self->{disablelinkerwarnings} .= $warnings;
|
||||
return;
|
||||
}
|
||||
|
||||
sub Save
|
||||
{
|
||||
my ($self) = @_;
|
||||
|
||||
# Warning 4197 is about double exporting, disable this per
|
||||
# http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99193
|
||||
$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) = @_;
|
||||
my $libcfg = (uc $cfgname eq "RELEASE") ? "MD" : "MDd";
|
||||
my $libs = '';
|
||||
foreach my $lib (@{ $self->{libraries} })
|
||||
{
|
||||
my $xlib = $lib;
|
||||
foreach my $slib (@{ $self->{suffixlib} })
|
||||
{
|
||||
if ($slib eq $lib)
|
||||
{
|
||||
$xlib =~ s/\.lib$/$libcfg.lib/;
|
||||
last;
|
||||
}
|
||||
}
|
||||
$libs .= $xlib . $separator;
|
||||
}
|
||||
$libs =~ s/.$//;
|
||||
$libs =~ s/__CFGNAME__/$cfgname/g;
|
||||
return $libs;
|
||||
}
|
||||
|
||||
# Utility function that loads a complete file
|
||||
sub read_file
|
||||
{
|
||||
my $filename = shift;
|
||||
my $F;
|
||||
local $/ = undef;
|
||||
open($F, '<', $filename) || croak "Could not open file $filename\n";
|
||||
my $txt = <$F>;
|
||||
close($F);
|
||||
|
||||
return $txt;
|
||||
}
|
||||
|
||||
sub read_makefile
|
||||
{
|
||||
my $reldir = shift;
|
||||
my $F;
|
||||
local $/ = undef;
|
||||
open($F, '<', "$reldir/GNUmakefile")
|
||||
|| open($F, '<', "$reldir/Makefile")
|
||||
|| confess "Could not open $reldir/Makefile\n";
|
||||
my $txt = <$F>;
|
||||
close($F);
|
||||
|
||||
return $txt;
|
||||
}
|
||||
|
||||
1;
|
|
@ -1,99 +0,0 @@
|
|||
src/tools/msvc/README
|
||||
|
||||
MSVC build
|
||||
==========
|
||||
|
||||
This directory contains the tools required to build PostgreSQL using
|
||||
Microsoft Visual Studio 2015 - 2022. This builds the whole backend, not just
|
||||
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 SDK
|
||||
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 includes
|
||||
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 into
|
||||
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 implementations
|
||||
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.
|
File diff suppressed because it is too large
Load Diff
|
@ -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 = qw(Exporter);
|
||||
@EXPORT = qw(CreateSolution CreateProject DetermineVisualStudioVersion);
|
||||
|
||||
no warnings qw(redefine); ## no critic
|
||||
|
||||
sub CreateSolution
|
||||
{
|
||||
my $visualStudioVersion = shift;
|
||||
|
||||
if (!defined($visualStudioVersion))
|
||||
{
|
||||
$visualStudioVersion = 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 supported.";
|
||||
}
|
||||
}
|
||||
|
||||
sub CreateProject
|
||||
{
|
||||
my $visualStudioVersion = shift;
|
||||
|
||||
if (!defined($visualStudioVersion))
|
||||
{
|
||||
$visualStudioVersion = 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 supported.";
|
||||
}
|
||||
}
|
||||
|
||||
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 = `nmake /? 2>&1`;
|
||||
$? >> 8 == 0
|
||||
or croak
|
||||
"Unable to determine Visual Studio version: The nmake command wasn't found.";
|
||||
if ($output =~ /(\d+)\.(\d+)\.\d+(\.\d+)?/)
|
||||
{
|
||||
return _GetVisualStudioVersion($1, $2);
|
||||
}
|
||||
|
||||
croak
|
||||
"Unable to determine Visual Studio version: The nmake version could not be determined.";
|
||||
}
|
||||
else
|
||||
{
|
||||
# fake version
|
||||
return '17.00';
|
||||
}
|
||||
}
|
||||
|
||||
sub _GetVisualStudioVersion
|
||||
{
|
||||
my ($major, $minor) = @_;
|
||||
|
||||
# The major visual studio that is supported has nmake
|
||||
# version <= 14.40, so stick with it as the latest version
|
||||
# if bumping on something even newer.
|
||||
if ($major >= 14 && $minor >= 40)
|
||||
{
|
||||
carp
|
||||
"The determined version of Visual Studio is newer than the latest supported version. Returning the latest supported version instead.";
|
||||
return '14.30';
|
||||
}
|
||||
elsif ($major < 12)
|
||||
{
|
||||
croak
|
||||
"Unable to determine Visual Studio version: Visual Studio versions before 12.0 aren't supported.";
|
||||
}
|
||||
return "$major.$minor";
|
||||
}
|
||||
|
||||
1;
|
|
@ -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 %*
|
|
@ -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 [ [ <configuration> ] <component> ]\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) <= 2;
|
||||
|
||||
# buildenv.pl is for specifying the build environment settings
|
||||
# it should contain lines like:
|
||||
# $ENV{PATH} = "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 = Mkvcbuild::mkvcbuild($config);
|
||||
|
||||
# check what sort of build we are doing
|
||||
my $bconf = $ENV{CONFIG} || "Release";
|
||||
my $msbflags = $ENV{MSBFLAGS} || "";
|
||||
my $buildwhat = $ARGV[1] || "";
|
||||
|
||||
if (defined($ARGV[0]))
|
||||
{
|
||||
if (uc($ARGV[0]) eq 'DEBUG')
|
||||
{
|
||||
$bconf = "Debug";
|
||||
}
|
||||
elsif (uc($ARGV[0]) ne "RELEASE")
|
||||
{
|
||||
$buildwhat = $ARGV[0] || "";
|
||||
}
|
||||
}
|
||||
|
||||
# ... and do it
|
||||
|
||||
if ($buildwhat)
|
||||
{
|
||||
system(
|
||||
"msbuild $buildwhat.vcxproj /verbosity:normal $msbflags /p:Configuration=$bconf"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
system(
|
||||
"msbuild pgsql.sln /verbosity:normal $msbflags /p:Configuration=$bconf"
|
||||
);
|
||||
}
|
||||
|
||||
# report status
|
||||
|
||||
my $status = $? >> 8;
|
||||
|
||||
exit $status;
|
|
@ -1,160 +0,0 @@
|
|||
@echo off
|
||||
REM src/tools/msvc/clean.bat
|
||||
|
||||
set DIST=0
|
||||
if "%1"=="dist" set DIST=1
|
||||
|
||||
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\backend\replication\libpqwalreceiver\win32ver.rc
|
||||
if exist src\backend\replication\pgoutput\win32ver.rc del /q src\backend\replication\pgoutput\win32ver.rc
|
||||
if exist src\backend\snowball\win32ver.rc del /q src\backend\snowball\win32ver.rc
|
||||
if exist src\interfaces\ecpg\test\win32ver.rc del /q src\interfaces\ecpg\test\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.rc
|
||||
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.rc
|
||||
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\win32ver.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\fmgrprotos.h
|
||||
if exist src\include\storage\lwlocknames.h del /q src\include\storage\lwlocknames.h
|
||||
if exist src\include\utils\wait_event_types.h del /q src\include\utils\wait_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\schemapg.h
|
||||
if exist src\include\catalog\system_fk_info.h del /q src\include\catalog\system_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\header-stamp
|
||||
if exist doc\src\sgml\version.sgml del /q doc\src\sgml\version.sgml
|
||||
|
||||
if %DIST%==1 if exist src\backend\utils\activity\pgstat_wait_event.c del /q src\backend\utils\activity\pgstat_wait_event.c
|
||||
if %DIST%==1 if exist src\backend\utils\activity\wait_event_funcs_data.c del /q src\backend\utils\activity\wait_event_funcs_data.c
|
||||
if %DIST%==1 if exist src\backend\utils\activity\wait_event_types.h del /q src\backend\utils\activity\wait_event_types.h
|
||||
if %DIST%==1 if exist src\backend\utils\fmgroids.h del /q src\backend\utils\fmgroids.h
|
||||
if %DIST%==1 if exist src\backend\utils\fmgrprotos.h del /q src\backend\utils\fmgrprotos.h
|
||||
if %DIST%==1 if exist src\backend\utils\fmgrtab.c del /q src\backend\utils\fmgrtab.c
|
||||
if %DIST%==1 if exist src\backend\utils\fmgr-stamp del /q src\backend\utils\fmgr-stamp
|
||||
if %DIST%==1 if exist src\backend\utils\errcodes.h del /q src\backend\utils\errcodes.h
|
||||
if %DIST%==1 if exist src\backend\nodes\node-support-stamp del /q src\backend\nodes\node-support-stamp
|
||||
if %DIST%==1 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%==1 for %%F IN (copy equal out queryjumble read) do if exist src\backend\nodes\%%Ffuncs.switch.c del /q src\backend\nodes\%%Ffuncs.switch.c
|
||||
if %DIST%==1 if exist src\backend\nodes\nodetags.h del /q src\backend\nodes\nodetags.h
|
||||
if %DIST%==1 if exist src\backend\storage\lmgr\lwlocknames.c del /q src\backend\storage\lmgr\lwlocknames.c
|
||||
if %DIST%==1 if exist src\backend\storage\lmgr\lwlocknames.h del /q src\backend\storage\lmgr\lwlocknames.h
|
||||
if %DIST%==1 if exist src\pl\plpython\spiexceptions.h del /q src\pl\plpython\spiexceptions.h
|
||||
if %DIST%==1 if exist src\pl\plpgsql\src\plerrcodes.h del /q src\pl\plpgsql\src\plerrcodes.h
|
||||
if %DIST%==1 if exist src\pl\tcl\pltclerrcodes.h del /q src\pl\tcl\pltclerrcodes.h
|
||||
if %DIST%==1 if exist src\bin\psql\sql_help.c del /q src\bin\psql\sql_help.c
|
||||
if %DIST%==1 if exist src\bin\psql\sql_help.h del /q src\bin\psql\sql_help.h
|
||||
if %DIST%==1 if exist src\common\kwlist_d.h del /q src\common\kwlist_d.h
|
||||
if %DIST%==1 if exist src\pl\plpgsql\src\pl_reserved_kwlist_d.h del /q src\pl\plpgsql\src\pl_reserved_kwlist_d.h
|
||||
if %DIST%==1 if exist src\pl\plpgsql\src\pl_unreserved_kwlist_d.h del /q src\pl\plpgsql\src\pl_unreserved_kwlist_d.h
|
||||
if %DIST%==1 if exist src\interfaces\ecpg\preproc\c_kwlist_d.h del /q src\interfaces\ecpg\preproc\c_kwlist_d.h
|
||||
if %DIST%==1 if exist src\interfaces\ecpg\preproc\ecpg_kwlist_d.h del /q src\interfaces\ecpg\preproc\ecpg_kwlist_d.h
|
||||
if %DIST%==1 if exist src\interfaces\ecpg\preproc\preproc.y del /q src\interfaces\ecpg\preproc\preproc.y
|
||||
if %DIST%==1 if exist src\backend\catalog\postgres.bki del /q src\backend\catalog\postgres.bki
|
||||
if %DIST%==1 if exist src\backend\catalog\system_constraints.sql del /q src\backend\catalog\system_constraints.sql
|
||||
if %DIST%==1 if exist src\backend\catalog\schemapg.h del /q src\backend\catalog\schemapg.h
|
||||
if %DIST%==1 if exist src\backend\catalog\system_fk_info.h del /q src\backend\catalog\system_fk_info.h
|
||||
if %DIST%==1 if exist src\backend\catalog\pg_*_d.h del /q src\backend\catalog\pg_*_d.h
|
||||
if %DIST%==1 if exist src\backend\catalog\bki-stamp del /q src\backend\catalog\bki-stamp
|
||||
if %DIST%==1 if exist src\backend\parser\scan.c del /q src\backend\parser\scan.c
|
||||
if %DIST%==1 if exist src\backend\parser\gram.c del /q src\backend\parser\gram.c
|
||||
if %DIST%==1 if exist src\backend\parser\gram.h del /q src\backend\parser\gram.h
|
||||
if %DIST%==1 if exist src\backend\bootstrap\bootscanner.c del /q src\backend\bootstrap\bootscanner.c
|
||||
if %DIST%==1 if exist src\backend\bootstrap\bootparse.c del /q src\backend\bootstrap\bootparse.c
|
||||
if %DIST%==1 if exist src\backend\bootstrap\bootparse.h del /q src\backend\bootstrap\bootparse.h
|
||||
if %DIST%==1 if exist src\backend\utils\adt\jsonpath_gram.c del /q src\backend\utils\adt\jsonpath_gram.c
|
||||
if %DIST%==1 if exist src\backend\utils\adt\jsonpath_gram.h del /q src\backend\utils\adt\jsonpath_gram.h
|
||||
if %DIST%==1 if exist src\backend\utils\adt\jsonpath_scan.c del /q src\backend\utils\adt\jsonpath_scan.c
|
||||
if %DIST%==1 if exist src\backend\utils\misc\guc-file.c del /q src\backend\utils\misc\guc-file.c
|
||||
if %DIST%==1 if exist src\backend\replication\repl_scanner.c del /q src\backend\replication\repl_scanner.c
|
||||
if %DIST%==1 if exist src\backend\replication\repl_gram.c del /q src\backend\replication\repl_gram.c
|
||||
if %DIST%==1 if exist src\backend\replication\repl_gram.h del /q src\backend\replication\repl_gram.h
|
||||
if %DIST%==1 if exist src\backend\replication\syncrep_scanner.c del /q src\backend\replication\syncrep_scanner.c
|
||||
if %DIST%==1 if exist src\backend\replication\syncrep_gram.c del /q src\backend\replication\syncrep_gram.c
|
||||
if %DIST%==1 if exist src\backend\replication\syncrep_gram.h del /q src\backend\replication\syncrep_gram.h
|
||||
|
||||
|
||||
if exist src\interfaces\libpq\libpqdll.def del /q src\interfaces\libpq\libpqdll.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\ecpg\ecpglib\ecpglib.def
|
||||
if exist src\interfaces\ecpg\include\ecpg_config.h del /q src\interfaces\ecpg\include\ecpg_config.h
|
||||
if exist src\interfaces\ecpg\pgtypeslib\pgtypeslib.def del /q src\interfaces\ecpg\pgtypeslib\pgtypeslib.def
|
||||
if %DIST%==1 if exist src\interfaces\ecpg\preproc\pgc.c del /q src\interfaces\ecpg\preproc\pgc.c
|
||||
if %DIST%==1 if exist src\interfaces\ecpg\preproc\preproc.c del /q src\interfaces\ecpg\preproc\preproc.c
|
||||
if %DIST%==1 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%==1 if exist src\pl\plpgsql\src\pl_gram.c del /q src\pl\plpgsql\src\pl_gram.c
|
||||
if %DIST%==1 if exist src\pl\plpgsql\src\pl_gram.h del /q src\pl\plpgsql\src\pl_gram.h
|
||||
|
||||
if %DIST%==1 if exist src\fe_utils\psqlscan.c del /q src\fe_utils\psqlscan.c
|
||||
if %DIST%==1 if exist src\bin\psql\psqlscanslash.c del /q src\bin\psql\psqlscanslash.c
|
||||
if %DIST%==1 if exist src\bin\pgbench\exprscan.c del /q src\bin\pgbench\exprscan.c
|
||||
if %DIST%==1 if exist src\bin\pgbench\exprparse.c del /q src\bin\pgbench\exprparse.c
|
||||
if %DIST%==1 if exist src\bin\pgbench\exprparse.h del /q src\bin\pgbench\exprparse.h
|
||||
|
||||
if %DIST%==1 if exist contrib\cube\cubescan.c del /q contrib\cube\cubescan.c
|
||||
if %DIST%==1 if exist contrib\cube\cubeparse.c del /q contrib\cube\cubeparse.c
|
||||
if %DIST%==1 if exist contrib\cube\cubeparse.h del /q contrib\cube\cubeparse.h
|
||||
if %DIST%==1 if exist contrib\fuzzystrmatch\daitch_mokotoff.h del /q contrib\fuzzystrmatch\daitch_mokotoff.h
|
||||
if %DIST%==1 if exist contrib\seg\segscan.c del /q contrib\seg\segscan.c
|
||||
if %DIST%==1 if exist contrib\seg\segparse.c del /q contrib\seg\segparse.c
|
||||
if %DIST%==1 if exist contrib\seg\segparse.h del /q contrib\seg\segparse.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%==1 if exist src\test\isolation\specscanner.c del /q src\test\isolation\specscanner.c
|
||||
if %DIST%==1 if exist src\test\isolation\specparse.c del /q src\test\isolation\specparse.c
|
||||
if %DIST%==1 if exist src\test\isolation\specparse.h del /q src\test\isolation\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
|
|
@ -1,32 +0,0 @@
|
|||
|
||||
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
|
||||
|
||||
# Configuration arguments for vcbuild.
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $config = {
|
||||
asserts => 0, # --enable-cassert
|
||||
|
||||
# blocksize => 8, # --with-blocksize, 8kB by default
|
||||
# wal_blocksize => 8, # --with-wal-blocksize, 8kB by default
|
||||
ldap => 1, # --with-ldap
|
||||
extraver => undef, # --with-extra-version=<string>
|
||||
gss => undef, # --with-gssapi=<path>
|
||||
icu => undef, # --with-icu=<path>
|
||||
lz4 => undef, # --with-lz4=<path>
|
||||
zstd => undef, # --with-zstd=<path>
|
||||
nls => undef, # --enable-nls=<path>
|
||||
tap_tests => undef, # --enable-tap-tests
|
||||
tcl => undef, # --with-tcl=<path>
|
||||
perl => undef, # --with-perl=<path>
|
||||
python => undef, # --with-python=<path>
|
||||
openssl => undef, # --with-ssl=openssl with <path>
|
||||
uuid => undef, # --with-uuid=<path>
|
||||
xml => undef, # --with-libxml=<path>
|
||||
xslt => undef, # --with-libxslt=<path>
|
||||
iconv => undef, # (not in configure, path to iconv)
|
||||
zlib => undef # --with-zlib=<path>
|
||||
};
|
||||
|
||||
1;
|
|
@ -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=src/tools/msvc/dummylib perl -cw $file
|
||||
|
||||
This is the only use that should be made of this directory. Attempting actually
|
||||
running of any programs using this library will result in a lot of grief.
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
|
||||
|
||||
package Win32;
|
||||
use strict;
|
||||
use warnings;
|
||||
1;
|
|
@ -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 = qw(Exporter);
|
||||
@EXPORT = qw($HKEY_LOCAL_MACHINE);
|
||||
|
||||
1;
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
|
||||
|
||||
package Win32API::File;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use constant { SEM_FAILCRITICALERRORS => 1, SEM_NOGPFAULTERRORBOX => 2 };
|
||||
sub SetErrormode { }
|
||||
use Exporter;
|
||||
our (@ISA, @EXPORT_OK, %EXPORT_TAGS);
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT_OK = qw(SetErrorMode SEM_FAILCRITICALERRORS SEM_NOGPFAULTERRORBOX);
|
||||
%EXPORT_TAGS = (SEM_ => [qw(SEM_FAILCRITICALERRORS SEM_NOGPFAULTERRORBOX)]);
|
||||
|
||||
1;
|
|
@ -1,64 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="all">
|
||||
<!--
|
||||
MSBuild project file to build ecpg regression tests
|
||||
-->
|
||||
|
||||
<PropertyGroup>
|
||||
<TESTDIR>..\..\interfaces\ecpg\test</TESTDIR>
|
||||
<CONFIG>Debug</CONFIG>
|
||||
<OUTDIR>..\..\..\..\..\$(CONFIG)\</OUTDIR>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(CONFIG)'=='DEBUG'">
|
||||
<!-- set debug runtime library if necessary to be compatible with the LIB files generated -->
|
||||
<DEBUGLIB>d</DEBUGLIB>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Pgc Include="$(TESTDIR)\**\*.pgc" Exclude="$(TESTDIR)\performance\perftest.pgc"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<OutputToDelete Include="$(TESTDIR)\**\*.exe" />
|
||||
<OutputToDelete Include="$(TESTDIR)\**\*.exe.manifest" />
|
||||
<OutputToDelete Include="$(TESTDIR)\**\*.obj" />
|
||||
<OutputToDelete Include="$(TESTDIR)\**\*.c" Exclude="$(TESTDIR)\pg_regress_ecpg.c;$(TESTDIR)\expected\*.c" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="all" Inputs="@(Pgc)" Outputs="%(RelativeDir)%(Filename).exe">
|
||||
<!-- Set special parameters for some tests -->
|
||||
<CreateProperty Value="-C INFORMIX" Condition="'%(Pgc.RelativeDir)'=='$(TESTDIR)\compat_informix\'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-C INFORMIX -r no_indicator" Condition="'%(Pgc.FileName)'=='rnull'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-C ORACLE" Condition="'%(Pgc.RelativeDir)'=='$(TESTDIR)\compat_oracle\'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-c" Condition="'%(Pgc.FileName)'=='array_of_struct'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-c" Condition="'%(Pgc.FileName)'=='pointer_to_struct'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-r questionmarks" Condition="'%(Pgc.FileName)'=='oldexec'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-r prepare" Condition="'%(Pgc.FileName)'=='autoprep'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
<CreateProperty Value="-i" Condition="'%(Pgc.FileName)'=='strings'">
|
||||
<Output TaskParameter="Value" PropertyName="ECPGPARAM" />
|
||||
</CreateProperty>
|
||||
|
||||
<!-- Run ECPG and the Visual C++ compiler on the files. Don't bother with dependency check between the steps -->
|
||||
<Exec WorkingDirectory="%(Pgc.RelativeDir)" Command="$(OUTDIR)ecpg\ecpg -I ../../include --regression $(ECPGPARAM) -o %(Pgc.Filename).c %(Pgc.Filename).pgc" />
|
||||
<Exec WorkingDirectory="%(Pgc.RelativeDir)" Command="cl /nologo %(Pgc.FileName).c /TC /MD$(DEBUGLIB) /DWIN32 /I. /I..\..\include /I..\..\..\libpq /I..\..\..\..\include /link /defaultlib:$(OUTDIR)libecpg\libecpg.lib /defaultlib:$(OUTDIR)libecpg_compat\libecpg_compat.lib /defaultlib:$(OUTDIR)libpgtypes\libpgtypes.lib" />
|
||||
</Target>
|
||||
|
||||
<!-- Clean up all output files -->
|
||||
<Target Name="clean">
|
||||
<Delete Files="@(OutputToDelete)" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -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 %*
|
|
@ -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} = "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 = shift || Usage();
|
||||
my $insttype = shift;
|
||||
Install($target, $insttype);
|
||||
|
||||
sub Usage
|
||||
{
|
||||
print "Usage: install.pl <targetdir> [installtype]\n";
|
||||
print "installtype: client\n";
|
||||
exit(1);
|
||||
}
|
|
@ -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);
|
|
@ -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 %*
|
|
@ -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) = `bison -V`; # grab first line
|
||||
$bisonver = (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 = 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 = $input) =~ s/\.y$/.c/;
|
||||
|
||||
# plpgsql just has to be different
|
||||
$output =~ s/gram\.c$/pl_gram.c/ if $input =~ /src.pl.plpgsql.src.gram\.y$/;
|
||||
|
||||
my $makefile = dirname($input) . "/Makefile";
|
||||
my ($mf, $make);
|
||||
open($mf, '<', $makefile);
|
||||
local $/ = undef;
|
||||
$make = <$mf>;
|
||||
close($mf);
|
||||
my $basetarg = basename($output);
|
||||
my $headerflag = ($make =~ /^$basetarg:\s+BISONFLAGS\b.*-d/m ? '-d' : '');
|
||||
|
||||
my $nodep = $bisonver ge '3.0' ? "-Wno-deprecated" : "";
|
||||
|
||||
system("bison $nodep $headerflag $input -o $output");
|
||||
exit $? >> 8;
|
|
@ -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 %*
|
|
@ -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} = 'nodosfilewarning';
|
||||
|
||||
# assume we are in the postgres source root
|
||||
|
||||
do './src/tools/msvc/buildenv.pl' if -e 'src/tools/msvc/buildenv.pl';
|
||||
|
||||
my ($flexver) = `flex -V`; # grab first line
|
||||
$flexver = (split(/\s+/, $flexver))[1];
|
||||
$flexver =~ s/[^0-9.]//g;
|
||||
my @verparts = split(/\./, $flexver);
|
||||
unless ($verparts[0] == 2
|
||||
&& ($verparts[1] > 5 || ($verparts[1] == 5 && $verparts[2] >= 35)))
|
||||
{
|
||||
print "WARNING! Flex install not found, or unsupported Flex version.\n";
|
||||
print "echo Attempting to build without.\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my $input = 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 = $input) =~ s/\.l$/.c/;
|
||||
|
||||
# get flex flags from make file
|
||||
my $makefile = dirname($input) . "/Makefile";
|
||||
my ($mf, $make);
|
||||
open($mf, '<', $makefile);
|
||||
local $/ = undef;
|
||||
$make = <$mf>;
|
||||
close($mf);
|
||||
my $basetarg = basename($output);
|
||||
my $flexflags = ($make =~ /^$basetarg:\s*FLEXFLAGS\s*=\s*(\S.*)/m ? $1 : '');
|
||||
|
||||
system("flex $flexflags -o$output $input");
|
||||
if ($? == 0)
|
||||
{
|
||||
|
||||
# Check for "%option reentrant" in .l file.
|
||||
my $lfile;
|
||||
open($lfile, '<', $input) || die "opening $input for reading: $!";
|
||||
my $lcode = <$lfile>;
|
||||
close($lfile);
|
||||
if ($lcode =~ /\%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 = <$cfile>;
|
||||
close($cfile);
|
||||
$ccode =~ s/yywrap\(n\)/yywrap()/;
|
||||
open($cfile, '>', $output) || die "opening $output for writing: $!";
|
||||
print $cfile $ccode;
|
||||
close($cfile);
|
||||
}
|
||||
if ($flexflags =~ /\s-b\s/)
|
||||
{
|
||||
my $lexback = "lex.backup";
|
||||
open($lfile, '<', $lexback) || die "opening $lexback for reading: $!";
|
||||
my $lexbacklines = <$lfile>;
|
||||
close($lfile);
|
||||
my $linecount = $lexbacklines =~ tr /\n/\n/;
|
||||
if ($linecount != 1)
|
||||
{
|
||||
print "Scanner requires backup, see lex.backup.\n";
|
||||
exit 1;
|
||||
}
|
||||
unlink $lexback;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
exit $? >> 8;
|
||||
}
|
|
@ -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 %*
|
|
@ -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 = getcwd();
|
||||
|
||||
chdir "../../.." if (-d "../../../src/tools/msvc");
|
||||
|
||||
my $topdir = getcwd();
|
||||
my $tmp_installdir = "$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 = File::Spec->devnull;
|
||||
|
||||
# These values are defaults that can be overridden by the calling environment
|
||||
# (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} ||= 'tar';
|
||||
|
||||
# buildenv.pl is for specifying the build environment settings
|
||||
# it should contain lines like:
|
||||
# $ENV{PATH} = "c:/path/to/bison/bin;$ENV{PATH}";
|
||||
|
||||
if (-e "src/tools/msvc/buildenv.pl")
|
||||
{
|
||||
do "./src/tools/msvc/buildenv.pl";
|
||||
}
|
||||
|
||||
my $what = shift || "";
|
||||
if ($what =~
|
||||
/^(check|installcheck|plcheck|contribcheck|modulescheck|ecpgcheck|isolationcheck|upgradecheck|bincheck|recoverycheck|taptest)$/i
|
||||
)
|
||||
{
|
||||
$what = uc $what;
|
||||
}
|
||||
else
|
||||
{
|
||||
usage();
|
||||
}
|
||||
|
||||
# use a capital C here because config.pl has $config
|
||||
my $Config = -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} = $config->{openssl} ? 'openssl' : 'no';
|
||||
$ENV{with_ldap} = $config->{ldap} ? 'yes' : 'no';
|
||||
$ENV{with_icu} = $config->{icu} ? 'yes' : 'no';
|
||||
$ENV{with_gssapi} = $config->{gss} ? 'yes' : 'no';
|
||||
$ENV{with_krb_srvnam} = $config->{krb_srvnam} || 'postgres';
|
||||
$ENV{with_readline} = 'no';
|
||||
|
||||
$ENV{PATH} = "$topdir/$Config/libpq;$ENV{PATH}";
|
||||
|
||||
if ($ENV{PERL5LIB})
|
||||
{
|
||||
$ENV{PERL5LIB} = "$topdir/src/tools/msvc;$ENV{PERL5LIB}";
|
||||
}
|
||||
else
|
||||
{
|
||||
$ENV{PERL5LIB} = "$topdir/src/tools/msvc";
|
||||
}
|
||||
|
||||
my $maxconn = "";
|
||||
$maxconn = "--max-connections=$ENV{MAX_CONNECTIONS}"
|
||||
if $ENV{MAX_CONNECTIONS};
|
||||
|
||||
my $temp_config = "";
|
||||
$temp_config = "--temp-config=\"$ENV{TEMP_CONFIG}\""
|
||||
if $ENV{TEMP_CONFIG};
|
||||
|
||||
chdir "src/test/regress";
|
||||
|
||||
my %command = (
|
||||
CHECK => \&check,
|
||||
PLCHECK => \&plcheck,
|
||||
INSTALLCHECK => \&installcheck,
|
||||
ECPGCHECK => \&ecpgcheck,
|
||||
CONTRIBCHECK => \&contribcheck,
|
||||
MODULESCHECK => \&modulescheck,
|
||||
ISOLATIONCHECK => \&isolationcheck,
|
||||
BINCHECK => \&bincheck,
|
||||
RECOVERYCHECK => \&recoverycheck,
|
||||
UPGRADECHECK => \&upgradecheck, # no-op
|
||||
TAPTEST => \&taptest,);
|
||||
|
||||
my $proc = $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 = shift;
|
||||
my $envdefault = 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 = system("$envdefault --version >$devnull 2>&1");
|
||||
|
||||
# Set the environment to the default if it exists, else leave it.
|
||||
$ENV{$envname} = $envdefault if $rc == 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) = @_;
|
||||
# for backwards compatibility, "serial" runs the tests in
|
||||
# parallel_schedule one by one.
|
||||
my $maxconn = $maxconn;
|
||||
$maxconn = "--max-connections=1" if $schedule eq 'serial';
|
||||
$schedule = 'parallel' if $schedule eq 'serial';
|
||||
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress",
|
||||
"--dlpath=.",
|
||||
"--bindir=../../../$Config/psql",
|
||||
"--schedule=${schedule}_schedule",
|
||||
"--max-concurrent-tests=20");
|
||||
push(@args, $maxconn) if $maxconn;
|
||||
push(@args, @EXTRA_REGRESS_OPTS);
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
return;
|
||||
}
|
||||
|
||||
sub installcheck
|
||||
{
|
||||
my $schedule = shift || 'serial';
|
||||
installcheck_internal($schedule);
|
||||
return;
|
||||
}
|
||||
|
||||
sub check
|
||||
{
|
||||
my $schedule = shift || 'parallel';
|
||||
my $encoding = $ENV{ENCODING} || "SQL_ASCII";
|
||||
# for backwards compatibility, "serial" runs the tests in
|
||||
# parallel_schedule one by one.
|
||||
my $maxconn = $maxconn;
|
||||
$maxconn = "--max-connections=1" if $schedule eq 'serial';
|
||||
$schedule = 'parallel' if $schedule eq 'serial';
|
||||
|
||||
InstallTemp();
|
||||
chdir "${topdir}/src/test/regress";
|
||||
my @args = (
|
||||
"../../../$Config/pg_regress/pg_regress",
|
||||
"--dlpath=.",
|
||||
"--bindir=",
|
||||
"--schedule=${schedule}_schedule",
|
||||
"--max-concurrent-tests=20",
|
||||
"--encoding=${encoding}",
|
||||
"--no-locale",
|
||||
"--temp-instance=./tmp_check");
|
||||
push(@args, $maxconn) if $maxconn;
|
||||
push(@args, $temp_config) if $temp_config;
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
return;
|
||||
}
|
||||
|
||||
sub ecpgcheck
|
||||
{
|
||||
my $msbflags = $ENV{MSBFLAGS} || "";
|
||||
chdir $startdir;
|
||||
system("msbuild ecpg_regression.proj $msbflags /p:config=$Config");
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
InstallTemp();
|
||||
chdir "$topdir/src/interfaces/ecpg/test";
|
||||
my $schedule = "ecpg";
|
||||
my @args = (
|
||||
"../../../../$Config/pg_regress_ecpg/pg_regress_ecpg",
|
||||
"--bindir=",
|
||||
"--dbname=ecpg1_regression,ecpg2_regression",
|
||||
"--create-role=regress_ecpg_user1,regress_ecpg_user2",
|
||||
"--schedule=${schedule}_schedule",
|
||||
"--encoding=SQL_ASCII",
|
||||
"--no-locale",
|
||||
"--temp-instance=./tmp_chk");
|
||||
push(@args, $maxconn) if $maxconn;
|
||||
system(@args);
|
||||
$status = $? >> 8;
|
||||
exit $status if $status;
|
||||
return;
|
||||
}
|
||||
|
||||
sub isolationcheck
|
||||
{
|
||||
chdir "../isolation";
|
||||
copy("../../../$Config/isolationtester/isolationtester.exe",
|
||||
"../../../$Config/pg_isolation_regress");
|
||||
my @args = (
|
||||
"../../../$Config/pg_isolation_regress/pg_isolation_regress",
|
||||
"--bindir=../../../$Config/psql",
|
||||
"--inputdir=.",
|
||||
"--schedule=./isolation_schedule");
|
||||
push(@args, $maxconn) if $maxconn;
|
||||
system(@args);
|
||||
my $status = $? >> 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] =~ /^PROVE_FLAGS=(.*)/;
|
||||
@flags = split(/\s+/, $1);
|
||||
splice(@_, $arg, 1);
|
||||
last;
|
||||
}
|
||||
|
||||
my $dir = 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 = $ENV{PROVE_TESTS} || "t/*.pl";
|
||||
my @prove_tests_array = split(/\s+/, $prove_tests_val);
|
||||
my @prove_tests = ();
|
||||
foreach (@prove_tests_array)
|
||||
{
|
||||
push(@prove_tests, glob($_));
|
||||
}
|
||||
|
||||
# Fetch and adjust PROVE_FLAGS, handling multiple arguments.
|
||||
my $prove_flags_val = $ENV{PROVE_FLAGS} || "";
|
||||
my @prove_flags = split(/\s+/, $prove_flags_val);
|
||||
|
||||
my @args = ("prove", @flags, @prove_tests, @prove_flags);
|
||||
|
||||
# adjust the environment for just this test
|
||||
local %ENV = %ENV;
|
||||
$ENV{PERL5LIB} = "$topdir/src/test/perl;$ENV{PERL5LIB}";
|
||||
$ENV{PG_REGRESS} = "$topdir/$Config/pg_regress/pg_regress";
|
||||
$ENV{REGRESS_SHLIB} = "$topdir/src/test/regress/regress.dll";
|
||||
|
||||
$ENV{TESTDATADIR} = "$dir/tmp_check";
|
||||
$ENV{TESTLOGDIR} = "$dir/tmp_check/log";
|
||||
|
||||
my $module = basename $dir;
|
||||
# add the module build dir as the second element in the PATH
|
||||
$ENV{PATH} =~ s!;!;$topdir/$Config/$module;!;
|
||||
|
||||
rmtree('tmp_check');
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub bincheck
|
||||
{
|
||||
InstallTemp();
|
||||
|
||||
set_command_env();
|
||||
|
||||
my $mstat = 0;
|
||||
|
||||
# Find out all the existing TAP tests by looking for t/ directories
|
||||
# in the tree.
|
||||
my @bin_dirs = glob("$topdir/src/bin/*");
|
||||
|
||||
# Process each test
|
||||
foreach my $dir (@bin_dirs)
|
||||
{
|
||||
next unless -d "$dir/t";
|
||||
|
||||
my $status = tap_check($dir);
|
||||
$mstat ||= $status;
|
||||
}
|
||||
exit $mstat if $mstat;
|
||||
return;
|
||||
}
|
||||
|
||||
sub taptest
|
||||
{
|
||||
my $dir = shift;
|
||||
my @args;
|
||||
|
||||
if ($dir =~ /^PROVE_FLAGS=/)
|
||||
{
|
||||
push(@args, $dir);
|
||||
$dir = shift;
|
||||
}
|
||||
|
||||
die "no tests found!" unless -d "$topdir/$dir/t";
|
||||
|
||||
push(@args, "$topdir/$dir");
|
||||
|
||||
InstallTemp();
|
||||
|
||||
set_command_env();
|
||||
|
||||
my $status = 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 = 'plpgsql';
|
||||
}
|
||||
elsif ($dir eq 'tcl')
|
||||
{
|
||||
$lang = 'pltcl';
|
||||
}
|
||||
else
|
||||
{
|
||||
$lang = $dir;
|
||||
}
|
||||
if ($lang eq 'plpython')
|
||||
{
|
||||
next
|
||||
unless -d "$topdir/$Config/plpython3";
|
||||
$lang = 'plpythonu';
|
||||
}
|
||||
else
|
||||
{
|
||||
next unless -d "$topdir/$Config/$lang";
|
||||
}
|
||||
my @lang_args = ("--load-extension=$lang");
|
||||
chdir $dir;
|
||||
my @tests = fetchTests();
|
||||
if ($lang eq 'plperl')
|
||||
{
|
||||
|
||||
# plperl tests will install the extensions themselves
|
||||
@lang_args = ();
|
||||
|
||||
# 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 = ();
|
||||
}
|
||||
|
||||
# Move on if no tests are listed.
|
||||
next if (scalar @tests == 0);
|
||||
|
||||
print
|
||||
"============================================================\n";
|
||||
print "Checking $lang\n";
|
||||
my @args = (
|
||||
"$topdir/$Config/pg_regress/pg_regress",
|
||||
"--bindir=$topdir/$Config/psql",
|
||||
"--dbname=pl_regression", @lang_args, @tests);
|
||||
system(@args);
|
||||
my $status = $? >> 8;
|
||||
exit $status if $status;
|
||||
chdir "$topdir/src/pl";
|
||||
}
|
||||
|
||||
chdir "$topdir";
|
||||
return;
|
||||
}
|
||||
|
||||
sub subdircheck
|
||||
{
|
||||
my $module = shift;
|
||||
|
||||
if ( !-d "$module/sql"
|
||||
|| !-d "$module/expected"
|
||||
|| (!-f "$module/GNUmakefile" && !-f "$module/Makefile"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
chdir $module;
|
||||
my @tests = fetchTests();
|
||||
|
||||
# Leave if no tests are listed in the module.
|
||||
if (scalar @tests == 0)
|
||||
{
|
||||
chdir "..";
|
||||
return;
|
||||
}
|
||||
|
||||
my @opts = fetchRegressOpts();
|
||||
|
||||
print "============================================================\n";
|
||||
print "Checking $module\n";
|
||||
my @args = (
|
||||
"$topdir/$Config/pg_regress/pg_regress",
|
||||
"--bindir=${topdir}/${Config}/psql",
|
||||
"--dbname=contrib_regression", @opts, @tests);
|
||||
print join(' ', @args), "\n";
|
||||
system(@args);
|
||||
chdir "..";
|
||||
return;
|
||||
}
|
||||
|
||||
sub contribcheck
|
||||
{
|
||||
chdir "../../../contrib";
|
||||
my $mstat = 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 =~ /_plperl$/ && !defined($config->{perl}));
|
||||
next if ($module =~ /_plpython$/ && !defined($config->{python}));
|
||||
next if ($module eq "sepgsql");
|
||||
|
||||
subdircheck($module);
|
||||
my $status = $? >> 8;
|
||||
$mstat ||= $status;
|
||||
}
|
||||
exit $mstat if $mstat;
|
||||
return;
|
||||
}
|
||||
|
||||
sub modulescheck
|
||||
{
|
||||
chdir "../../../src/test/modules";
|
||||
my $mstat = 0;
|
||||
foreach my $module (glob("*"))
|
||||
{
|
||||
subdircheck($module);
|
||||
my $status = $? >> 8;
|
||||
$mstat ||= $status;
|
||||
}
|
||||
exit $mstat if $mstat;
|
||||
return;
|
||||
}
|
||||
|
||||
sub recoverycheck
|
||||
{
|
||||
InstallTemp();
|
||||
|
||||
my $dir = "$topdir/src/test/recovery";
|
||||
my $status = tap_check($dir);
|
||||
exit $status if $status;
|
||||
return;
|
||||
}
|
||||
|
||||
# Run "initdb", then reconfigure authentication.
|
||||
sub standard_initdb
|
||||
{
|
||||
return (
|
||||
system('initdb', '-N') == 0 and system(
|
||||
"$topdir/$Config/pg_regress/pg_regress", '--config-auth',
|
||||
$ENV{PGDATA}) == 0);
|
||||
}
|
||||
|
||||
# This is similar to appendShellString(). Perl system(@args) bypasses
|
||||
# cmd.exe, so omit the caret escape layer.
|
||||
sub quote_system_arg
|
||||
{
|
||||
my $arg = shift;
|
||||
|
||||
# Change N >= 0 backslashes before a double quote to 2N+1 backslashes.
|
||||
$arg =~ s/(\\*)"/${\($1 . $1)}\\"/gs;
|
||||
|
||||
# Change N >= 1 backslashes at end of argument to 2N backslashes.
|
||||
$arg =~ 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 ($/) = undef;
|
||||
my $m = <$handle>;
|
||||
close($handle);
|
||||
my @opts;
|
||||
|
||||
$m =~ s{\\\r?\n}{}g;
|
||||
if ($m =~ /^\s*REGRESS_OPTS\s*\+?=(.*)/m)
|
||||
{
|
||||
|
||||
# Substitute known Makefile variables, then ignore options that retain
|
||||
# an unhandled variable reference. Ignore anything that isn't an
|
||||
# option starting with "--".
|
||||
@opts = grep { !/\$\(/ && /^--/ }
|
||||
map { (my $x = $_) =~ s/\Q$(top_builddir)\E/\"$topdir\"/; $x; }
|
||||
split(/\s+/, $1);
|
||||
}
|
||||
if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
|
||||
{
|
||||
push @opts, "--encoding=$1";
|
||||
}
|
||||
if ($m =~ /^\s*NO_LOCALE\s*=\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 ($/) = undef;
|
||||
my $m = <$handle>;
|
||||
close($handle);
|
||||
my $t = "";
|
||||
|
||||
$m =~ 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 =~ /^\s*NO_INSTALLCHECK\s*=\s*\S+/m)
|
||||
{
|
||||
return ();
|
||||
}
|
||||
|
||||
if ($m =~ /^REGRESS\s*=\s*(.*)$/gm)
|
||||
{
|
||||
$t = $1;
|
||||
$t =~ s/\s+/ /g;
|
||||
|
||||
if ($m =~ /contrib\/pgcrypto/)
|
||||
{
|
||||
|
||||
# pgcrypto is special since some tests depend on the
|
||||
# configuration of the build
|
||||
|
||||
my $pgptests =
|
||||
$config->{zlib}
|
||||
? GetTests("ZLIB_TST", $m)
|
||||
: GetTests("ZLIB_OFF_TST", $m);
|
||||
$t =~ s/\$\(CF_PGP_TESTS\)/$pgptests/;
|
||||
}
|
||||
}
|
||||
|
||||
return split(/\s+/, $t);
|
||||
}
|
||||
|
||||
sub GetTests
|
||||
{
|
||||
my $testname = shift;
|
||||
my $m = shift;
|
||||
if ($m =~ /^$testname\s*=\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} = "$tmp_installdir/bin;$ENV{PATH}";
|
||||
return;
|
||||
}
|
||||
|
||||
sub usage
|
||||
{
|
||||
print STDERR
|
||||
"Usage: vcregress.pl <mode> [<arg>]\n\n",
|
||||
"Options for <mode>:\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 <arg>: (used by check and installcheck)\n",
|
||||
" serial serial mode\n",
|
||||
" parallel parallel mode\n",
|
||||
"\nOption for <arg>: for taptest\n",
|
||||
" TEST_DIR (required) directory where tests reside\n";
|
||||
exit(1);
|
||||
}
|
|
@ -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
|
||||
#
|
||||
|
||||
# Given a symbol file path, loops over its contents
|
||||
|
@ -142,7 +142,7 @@ sub writedef
|
|||
|
||||
sub usage
|
||||
{
|
||||
die("Usage: gendef.pl --arch <arch> --deffile <deffile> --tempdir <tempdir> files-or-directories\n"
|
||||
die("Usage: msvc_gendef.pl --arch <arch> --deffile <deffile> --tempdir <tempdir> files-or-directories\n"
|
||||
. " arch: x86 | x86_64\n"
|
||||
. " deffile: path of the generated file\n"
|
||||
. " tempdir: directory for temporary files\n"
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
# script to detect compile time errors and warnings in all perl files
|
||||
|
||||
INCLUDES="-I src/tools/msvc -I src/tools/msvc/dummylib -I src/backend/catalog"
|
||||
INCLUDES="-I src/backend/catalog"
|
||||
INCLUDES="-I src/test/perl -I src/backend/utils/mb/Unicode $INCLUDES"
|
||||
INCLUDES="-I src/bin/pg_rewind -I src/test/ssl/t $INCLUDES"
|
||||
|
||||
|
|
Loading…
Reference in New Issue