1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add support for building with ZSTD.

This commit doesn't actually add anything that uses ZSTD; that will be
done separately. It just puts the basic infrastructure into place.

Jeevan Ladhe, Robert Haas, and Michael Paquier. Reviewed by Justin
Pryzby and Andres Freund.

Discussion: http://postgr.es/m/CA+TgmoatQKGd+8SjcV+bzvw4XaoEwminHjU83yG12+NXtQzTTQ@mail.gmail.com
This commit is contained in:
Robert Haas
2022-02-18 13:40:31 -05:00
parent 2e372869aa
commit 6c417bbcc8
9 changed files with 338 additions and 0 deletions

View File

@ -351,6 +351,7 @@ XGETTEXT = @XGETTEXT@
GZIP = gzip
BZIP2 = bzip2
LZ4 = @LZ4@
ZSTD = @ZSTD@
DOWNLOAD = wget -O $@ --no-use-server-timestamps
#DOWNLOAD = curl -o $@

View File

@ -352,6 +352,9 @@
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the `zstd' library (-lzstd). */
#undef HAVE_LIBZSTD
/* Define to 1 if you have the `link' function. */
#undef HAVE_LINK
@ -952,6 +955,9 @@
/* Define to select Win32-style shared memory. */
#undef USE_WIN32_SHARED_MEMORY
/* Define to 1 to build with ZSTD support. (--with-zstd) */
#undef USE_ZSTD
/* Define to 1 if `wcstombs_l' requires <xlocale.h>. */
#undef WCSTOMBS_L_IN_XLOCALE

View File

@ -311,6 +311,7 @@ sub GenerateFiles
HAVE_LIBXML2 => undef,
HAVE_LIBXSLT => undef,
HAVE_LIBZ => $self->{options}->{zlib} ? 1 : undef,
HAVE_LIBZSTD => undef,
HAVE_LINK => undef,
HAVE_LOCALE_T => 1,
HAVE_LONG_INT_64 => undef,
@ -507,6 +508,7 @@ sub GenerateFiles
USE_UNNAMED_POSIX_SEMAPHORES => undef,
USE_WIN32_SEMAPHORES => 1,
USE_WIN32_SHARED_MEMORY => 1,
USE_ZSTD => undef,
WCSTOMBS_L_IN_XLOCALE => undef,
WORDS_BIGENDIAN => undef,
XLOG_BLCKSZ => 1024 * $self->{options}->{wal_blocksize},
@ -540,6 +542,11 @@ sub GenerateFiles
$define{HAVE_LZ4_H} = 1;
$define{USE_LZ4} = 1;
}
if ($self->{options}->{zstd})
{
$define{HAVE_LIBZSTD} = 1;
$define{USE_ZSTD} = 1;
}
if ($self->{options}->{openssl})
{
$define{USE_OPENSSL} = 1;
@ -1082,6 +1089,11 @@ sub AddProject
$proj->AddIncludeDir($self->{options}->{lz4} . '\include');
$proj->AddLibrary($self->{options}->{lz4} . '\lib\liblz4.lib');
}
if ($self->{options}->{zstd})
{
$proj->AddIncludeDir($self->{options}->{zstd} . '\include');
$proj->AddLibrary($self->{options}->{zstd} . '\lib\libzstd.lib');
}
if ($self->{options}->{uuid})
{
$proj->AddIncludeDir($self->{options}->{uuid} . '\include');
@ -1194,6 +1206,7 @@ sub GetFakeConfigure
$cfg .= ' --with-libxml' if ($self->{options}->{xml});
$cfg .= ' --with-libxslt' if ($self->{options}->{xslt});
$cfg .= ' --with-lz4' if ($self->{options}->{lz4});
$cfg .= ' --with-zstd' if ($self->{options}->{zstd});
$cfg .= ' --with-gssapi' if ($self->{options}->{gss});
$cfg .= ' --with-icu' if ($self->{options}->{icu});
$cfg .= ' --with-tcl' if ($self->{options}->{tcl});

View File

@ -15,6 +15,7 @@ our $config = {
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>

View File

@ -36,6 +36,7 @@ do './src/tools/msvc/config.pl' if (-f 'src/tools/msvc/config.pl');
$ENV{GZIP_PROGRAM} ||= 'gzip';
$ENV{LZ4} ||= 'lz4';
$ENV{TAR} ||= 'tar';
$ENV{ZSTD} ||= 'zstd';
# buildenv.pl is for specifying the build environment settings
# it should contain lines like: