Add support for LZ4 build in MSVC scripts
authorMichael Paquier <michael@paquier.xyz>
Tue, 11 May 2021 01:43:05 +0000 (10:43 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 11 May 2021 01:43:05 +0000 (10:43 +0900)
Since its introduction in bbe0a81, compression of table data supports
LZ4, but nothing had been done within the MSVC scripts to allow users to
build the code with this library.

This commit closes the gap by extending the MSVC scripts to be able to
build optionally with LZ4.  Getting libraries that can be used for
compilation and execution is possible as LZ4 can be compiled down to
MSVC 2010 using its source tarball.  MinGW may require extra efforts to
be able to work, and I have been able to test this only with MSVC, still
this is better than nothing to give users a way to test the feature on
Windows.

Author: Dilip Kumar
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/YJPdNeF68XpwDDki@paquier.xyz

doc/src/sgml/install-windows.sgml
src/tools/msvc/Solution.pm
src/tools/msvc/config_default.pl

index 64687b12e6733e9c82478cf74200d7931c16a630..92087dba6870e2a0e7c1ecfa0e471355035666db 100644 (file)
@@ -304,6 +304,16 @@ $ENV{MSBFLAGS}="/m";
      </para></listitem>
     </varlistentry>
 
+    <varlistentry>
+     <term><productname>LZ4</productname></term>
+     <listitem><para>
+      Required for supporting <productname>LZ4</productname> compression
+      method for compressing the table data. Binaries and source can be
+      downloaded from
+      <ulink url="https://github.com/lz4/lz4/releases"></ulink>.
+     </para></listitem>
+    </varlistentry>
+
     <varlistentry>
      <term><productname>OpenSSL</productname></term>
      <listitem><para>
index 459579d312f3010ebabc3579cb2b534a15a4b98b..85af28fe0bd092542038e9e2367b31ec470debdd 100644 (file)
@@ -535,6 +535,12 @@ sub GenerateFiles
        $define{HAVE_LIBXSLT} = 1;
        $define{USE_LIBXSLT}  = 1;
    }
+   if ($self->{options}->{lz4})
+   {
+       $define{HAVE_LIBLZ4} = 1;
+       $define{HAVE_LZ4_H}  = 1;
+       $define{USE_LZ4}     = 1;
+   }
    if ($self->{options}->{openssl})
    {
        $define{USE_OPENSSL} = 1;
@@ -1054,6 +1060,11 @@ sub AddProject
        $proj->AddIncludeDir($self->{options}->{xslt} . '\include');
        $proj->AddLibrary($self->{options}->{xslt} . '\lib\libxslt.lib');
    }
+   if ($self->{options}->{lz4})
+   {
+       $proj->AddIncludeDir($self->{options}->{lz4} . '\include');
+       $proj->AddLibrary($self->{options}->{lz4} . '\lib\liblz4.lib');
+   }
    if ($self->{options}->{uuid})
    {
        $proj->AddIncludeDir($self->{options}->{uuid} . '\include');
@@ -1165,6 +1176,7 @@ sub GetFakeConfigure
    $cfg .= ' --with-uuid'          if ($self->{options}->{uuid});
    $cfg .= ' --with-libxml'        if ($self->{options}->{xml});
    $cfg .= ' --with-libxslt'       if ($self->{options}->{xslt});
+   $cfg .= ' --with-lz4'           if ($self->{options}->{lz4});
    $cfg .= ' --with-gssapi'        if ($self->{options}->{gss});
    $cfg .= ' --with-icu'           if ($self->{options}->{icu});
    $cfg .= ' --with-tcl'           if ($self->{options}->{tcl});
index 256878f5820861cd0bd340f85fc987fbff1b2464..460c0375d4b56546d92abd6f2da7a1abd2215271 100644 (file)
@@ -14,6 +14,7 @@ our $config = {
    extraver  => undef,    # --with-extra-version=<string>
    gss       => undef,    # --with-gssapi=<path>
    icu       => undef,    # --with-icu=<path>
+   lz4       => undef,    # --with-lz4=<path>
    nls       => undef,    # --enable-nls=<path>
    tap_tests => undef,    # --enable-tap-tests
    tcl       => undef,    # --with-tcl=<path>