RepositoryExternal.mk                                  |   22 ++-
 download.lst                                           |    4 
 external/openldap/openldap-2.4.44.patch.1              |   12 +
 external/postgresql/ExternalPackage_postgresql.mk      |   16 ++
 external/postgresql/ExternalProject_postgresql.mk      |   16 +-
 external/postgresql/Module_postgresql.mk               |    6 
 external/postgresql/UnpackedTarball_postgresql.mk      |   12 -
 external/postgresql/arm64.patch.1                      |   53 ++++++++
 external/postgresql/config.pl                          |    1 
 external/postgresql/internal-zlib.patch.1              |   29 ----
 external/postgresql/postgres-msvc-build.patch.1        |  110 +++++++++++++++++
 external/postgresql/postgresql-9.2.1-libreoffice.patch |   74 -----------
 external/postgresql/postgresql-libs-leak.patch         |   40 ------
 external/postgresql/postgresql.exit.patch.0            |    8 -
 solenv/flatpak-manifest.in                             |    6 
 15 files changed, 235 insertions(+), 174 deletions(-)

New commits:
commit 2bbcf744fc4bd2e30ca1f0429286a0180fa0e528
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Wed Nov 10 13:36:43 2021 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Nov 29 13:34:52 2021 +0100

    Add forward declaration to openldap to fix compilation with current Xcode
    
    For some reason the warning about this undeclared function is treated
    as an error by the Clang version in current Xcode, at least for me,
    even if openldap isn't compiled with -Werror.
    
    Change-Id: Ic8479ca63031319ce55c6fb9d95132019ae82cae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124959
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/external/openldap/openldap-2.4.44.patch.1 
b/external/openldap/openldap-2.4.44.patch.1
index 0d3cf5b70c3f..317ef9a62e56 100644
--- a/external/openldap/openldap-2.4.44.patch.1
+++ b/external/openldap/openldap-2.4.44.patch.1
@@ -1,3 +1,4 @@
+-*- Mode: diff -*-
 --- openldap.org/configure
 +++ openldap/configure
 @@ -15735,7 +15735,7 @@
@@ -52,6 +53,17 @@
  
  #undef NSS_VERSION_INT
  #define       NSS_VERSION_INT ((NSS_VMAJOR << 24) | (NSS_VMINOR << 16) | \
+--- openldap.org/libraries/libldap/tls2.c
++++ openldap.org/libraries/libldap/tls2.c
+@@ -80,6 +80,8 @@
+       { BER_BVNULL, BER_BVNULL }
+ };
+ 
++int ldap_pvt_tls_check_hostname( LDAP *ld, void *s, const char *name_in );
++
+ #ifdef HAVE_TLS
+ 
+ void
 --- openldap.org/Makefile.in
 +++ openldap/Makefile.in
 @@ -13,7 +13,7 @@
commit bae9e6d917224fded701f24649457294f641f861
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Nov 16 14:41:57 2021 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Nov 29 13:34:52 2021 +0100

    postgresql: upgrade to release 13.5
    
    Fixes CVE-2021-23222.
    
    Change-Id: I4e16fcc60c634382a864f66b211d0e0170a06db0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125308
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/download.lst b/download.lst
index 90a070010620..c5564512a189 100644
--- a/download.lst
+++ b/download.lst
@@ -232,8 +232,8 @@ export LIBPNG_SHA256SUM := 
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201f
 export LIBPNG_TARBALL := libpng-1.6.37.tar.xz
 export POPPLER_SHA256SUM := 
016dde34e5f868ea98a32ca99b643325a9682281500942b7113f4ec88d20e2f3
 export POPPLER_TARBALL := poppler-21.01.0.tar.xz
-export POSTGRESQL_SHA256SUM := 
12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f
-export POSTGRESQL_TARBALL := postgresql-13.1.tar.bz2
+export POSTGRESQL_SHA256SUM := 
9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3
+export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2
 export PYTHON_SHA256SUM := 
f8d82e7572c86ec9d55c8627aae5040124fd2203af400c383c821b980306ee6b
 export PYTHON_TARBALL := Python-3.7.10.tar.xz
 export QRCODEGEN_SHA256SUM := 
fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
commit 18839707cf4d44d9e844bf31d4471cddb9193157
Author:     Thorsten Behrens <thorsten.behr...@allotropia.de>
AuthorDate: Sun Mar 14 02:24:59 2021 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Nov 29 13:34:52 2021 +0100

    Fix ARM64 build after postgres upgrade to 13.1
    
    Change-Id: I12bdda6aedd9b7b15423f997fe8c6910d9c9e9d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112464
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    (cherry picked from commit db8fb941ecc4c6e0279b47e4560b4b285339a17f)

diff --git a/external/postgresql/UnpackedTarball_postgresql.mk 
b/external/postgresql/UnpackedTarball_postgresql.mk
index c189b10dcb4b..b941de56822e 100644
--- a/external/postgresql/UnpackedTarball_postgresql.mk
+++ b/external/postgresql/UnpackedTarball_postgresql.mk
@@ -17,8 +17,11 @@ $(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
        external/postgresql/windows.patch.0 \
        external/postgresql/postgresql.exit.patch.0 \
        external/postgresql/postgres-msvc-build.patch.1 \
+       $(if $(filter WNT_ARM64,$(OS)_$(CPUNAME)), 
external/postgresql/arm64.patch.1) \
 ))
 
+ifeq ($(CROSS_COMPILING),)
 $(eval $(call 
gb_UnpackedTarball_add_file,postgresql,src/tools/msvc/config.pl,external/postgresql/config.pl))
+endif
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/arm64.patch.1 
b/external/postgresql/arm64.patch.1
new file mode 100644
index 000000000000..7f8f2d6e4137
--- /dev/null
+++ b/external/postgresql/arm64.patch.1
@@ -0,0 +1,53 @@
+diff -ur postgresql.org/src/tools/msvc/Mkvcbuild.pm 
postgresql/src/tools/msvc/Mkvcbuild.pm
+--- postgresql.org/src/tools/msvc/Mkvcbuild.pm 2021-03-14 02:09:15.288060770 
+0100
++++ postgresql/src/tools/msvc/Mkvcbuild.pm     2021-03-14 02:12:22.351726582 
+0100
+@@ -107,13 +107,6 @@
+ 
+       push(@pgportfiles, 'strtof.c') if ($vsVersion < '14.00');
+ 
+-      if ($vsVersion >= '9.00')
+-      {
+-              push(@pgportfiles, 'pg_crc32c_sse42_choose.c');
+-              push(@pgportfiles, 'pg_crc32c_sse42.c');
+-              push(@pgportfiles, 'pg_crc32c_sb8.c');
+-      }
+-      else
+       {
+               push(@pgportfiles, 'pg_crc32c_sb8.c');
+       }
+diff -ur postgresql.org/src/tools/msvc/MSBuildProject.pm 
postgresql/src/tools/msvc/MSBuildProject.pm
+--- postgresql.org/src/tools/msvc/MSBuildProject.pm    2021-03-14 
02:09:15.288060770 +0100
++++ postgresql/src/tools/msvc/MSBuildProject.pm        2021-03-14 
02:12:22.351726582 +0100
+@@ -307,8 +307,7 @@
+         : ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary');
+       my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';');
+ 
+-      my $targetmachine =
+-        $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
++      my $targetmachine = "MachineARM64";
+ 
+       my $includes = $self->{includes};
+       unless ($includes eq '' or $includes =~ /;$/)
+@@ -347,7 +347,6 @@
+       
<ProgramDatabaseFile>.\\$cfgname\\$self->{name}\\$self->{name}.pdb</ProgramDatabaseFile>
+       <GenerateMapFile>false</GenerateMapFile>
+       <MapFileName>.\\$cfgname\\$self->{name}\\$self->{name}.map</MapFileName>
+-      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+       <!-- Permit links to MinGW-built, 32-bit DLLs (default before VS2012). 
-->
+       <ImageHasSafeExceptionHandlers/>
+       <SubSystem>Console</SubSystem>
+diff -ur postgresql.org/src/tools/msvc/Solution.pm 
postgresql/src/tools/msvc/Solution.pm
+--- postgresql.org/src/tools/msvc/Solution.pm  2021-03-14 02:09:15.288060770 
+0100
++++ postgresql/src/tools/msvc/Solution.pm      2021-03-14 02:12:22.351726582 
+0100
+@@ -62,10 +62,7 @@
+       if (1) #($^O eq "MSWin32")
+       {
+               # Examine CL help output to determine if we are in 32 or 64-bit 
mode.
+-              my $output = `cl /? 2>&1`;
+-              $? >> 8 == 0 or die "cl command not found";
+-              $self->{platform} =
+-                ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
++              $self->{platform} = 'ARM64';
+       }
+       else
+       {
commit 616a21162c76188655e75b462c03ad674a840f82
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Tue Jan 19 15:38:05 2021 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Nov 29 13:34:52 2021 +0100

    postgresql: upgrade to release 13.1
    
    Fixes CVE-2020-25694, plus a bunch more CVE that don't look relevant.
    
    * --with-krb5 no longer exists, neither does --disable-shared
    * remove internal-zlib.patch.1:
      zlib is only used by pg_* tools / contrib/pgcrypto
    * remove postgresql-libs-leak.patch:
      some relic from pre-gbuild times, not clear what the point is for
      static libs
    * remove postgresql-9.2.1-libreoffice.patch:
      another dmake .mk file relic, and the win32 nmake build system was
      removed
    * add postgres-msvc-build.patch.1 to fix Cygwin perl and openssl
    * on WNT, libpq.dll is now built, no longer static lib
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109640
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 234833f7823a1424b62c93e145f0cfe2c6b6efd5)
    
    Change-Id: Ic0232a28801b2f604d9f4e33d5621ae3362defaa

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index bed2cf19725f..931eb38a383a 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3049,7 +3049,7 @@ else # !SYSTEM_POSTGRESQL
 
 define gb_LinkTarget__use_postgresql
 
-$(call gb_LinkTarget_use_external_project,$(1),postgresql)
+$(call gb_LinkTarget_use_external_project,$(1),postgresql,full)
 
 $(call gb_LinkTarget_set_include,$(1),\
        -I$(call gb_UnpackedTarball_get_dir,postgresql)/src/include \
@@ -3057,19 +3057,25 @@ $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
 )
 
+ifeq ($(OS),WNT)
+
+$(eval $(call gb_Helper_register_packages_for_install,postgresqlsdbc,\
+       postgresql \
+))
+
 $(call gb_LinkTarget_add_libs,$(1),\
-       $(call 
gb_UnpackedTarball_get_dir,postgresql)/src/interfaces/libpq/libpq$(gb_StaticLibrary_PLAINEXT)
 \
+       $(call 
gb_UnpackedTarball_get_dir,postgresql)/$(gb_MSBUILD_CONFIG)/libpq/libpq.lib \
 )
 
-ifeq ($(OS),WNT)
-$(call gb_LinkTarget_use_external,$(1),openssl)
+else # WNT
 
-$(call gb_LinkTarget_use_system_win32_libs,$(1),\
-       secur32 \
-       ws2_32 \
+$(call gb_LinkTarget_add_libs,$(1),\
+       $(call 
gb_UnpackedTarball_get_dir,postgresql)/src/interfaces/libpq/libpq$(gb_StaticLibrary_PLAINEXT)
 \
+       $(call 
gb_UnpackedTarball_get_dir,postgresql)/src/common/libpgcommon$(gb_StaticLibrary_PLAINEXT)
 \
+       $(call 
gb_UnpackedTarball_get_dir,postgresql)/src/port/libpgport$(gb_StaticLibrary_PLAINEXT)
 \
 )
 
-endif
+endif # WNT
 
 endef
 
diff --git a/download.lst b/download.lst
index 8f1444d047b9..90a070010620 100644
--- a/download.lst
+++ b/download.lst
@@ -232,8 +232,8 @@ export LIBPNG_SHA256SUM := 
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201f
 export LIBPNG_TARBALL := libpng-1.6.37.tar.xz
 export POPPLER_SHA256SUM := 
016dde34e5f868ea98a32ca99b643325a9682281500942b7113f4ec88d20e2f3
 export POPPLER_TARBALL := poppler-21.01.0.tar.xz
-export POSTGRESQL_SHA256SUM := 
a754c02f7051c2f21e52f8669a421b50485afcde9a581674d6106326b189d126
-export POSTGRESQL_TARBALL := postgresql-9.2.24.tar.bz2
+export POSTGRESQL_SHA256SUM := 
12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f
+export POSTGRESQL_TARBALL := postgresql-13.1.tar.bz2
 export PYTHON_SHA256SUM := 
f8d82e7572c86ec9d55c8627aae5040124fd2203af400c383c821b980306ee6b
 export PYTHON_TARBALL := Python-3.7.10.tar.xz
 export QRCODEGEN_SHA256SUM := 
fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
diff --git a/external/postgresql/ExternalPackage_postgresql.mk 
b/external/postgresql/ExternalPackage_postgresql.mk
new file mode 100644
index 000000000000..ada8c4f38eba
--- /dev/null
+++ b/external/postgresql/ExternalPackage_postgresql.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,postgresql,postgresql))
+
+$(eval $(call gb_ExternalPackage_use_external_project,postgresql,postgresql))
+
+$(eval $(call 
gb_ExternalPackage_add_file,postgresql,$(LIBO_LIB_FOLDER)/libpq.dll,$(gb_MSBUILD_CONFIG)/libpq/libpq.dll))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/ExternalProject_postgresql.mk 
b/external/postgresql/ExternalProject_postgresql.mk
index ba462a34a1a1..2812a80764a1 100644
--- a/external/postgresql/ExternalProject_postgresql.mk
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -12,7 +12,6 @@ $(eval $(call gb_ExternalProject_ExternalProject,postgresql))
 $(eval $(call gb_ExternalProject_use_externals,postgresql,\
        $(if $(ENABLE_LDAP),openldap) \
        openssl \
-       zlib \
 ))
 
 $(eval $(call gb_ExternalProject_register_targets,postgresql,\
@@ -25,8 +24,9 @@ $(eval $(call gb_ExternalProject_use_nmake,postgresql,build))
 
 $(call gb_ExternalProject_get_state_target,postgresql,build) :
        $(call gb_ExternalProject_run,build,\
-               nmake -f win32.mak USE_SSL=1 USE_LDAP=1 \
-       ,src)
+               MSBFLAGS=/p:Platform=$(gb_MSBUILD_PLATFORM) \
+               $(PERL) build.pl $(gb_MSBUILD_CONFIG) libpq \
+       ,src/tools/msvc)
 
 else
 
@@ -55,21 +55,25 @@ postgresql_LDFLAGS  += \
 
 endif
 
+# note: as of 13.1, zlib is not needed by libpq
+# passing MAKELEVEL=0 is required to find internal headers
 
 $(call gb_ExternalProject_get_state_target,postgresql,build) :
        $(call gb_ExternalProject_run,build,\
                ./configure \
-                       --without-readline --disable-shared --with-ldap \
+                       --without-readline \
+                       --without-zlib \
+                       --with-ldap \
                        $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) 
--host=$(HOST_PLATFORM)) \
                        $(if $(DISABLE_OPENSSL),,--with-openssl \
-                               $(if $(WITH_KRB5), --with-krb5) \
                                $(if $(WITH_GSSAPI),--with-gssapi)) \
                                $(if $(ENABLE_LDAP),,--with-ldap=no) \
+                       CFLAGS="-fPIC" \
                        CPPFLAGS="$(postgresql_CPPFLAGS)" \
                        LDFLAGS="$(postgresql_LDFLAGS)" \
                        $(if $(ENABLE_LDAP),EXTRA_LDAP_LIBS="-llber -lssl3 
-lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4") \
                && cd src/interfaces/libpq \
-               && MAKEFLAGS= && $(MAKE) all-static-lib)
+               && MAKEFLAGS= && $(MAKE) MAKELEVEL=0 all-static-lib)
 
 endif
 
diff --git a/external/postgresql/Module_postgresql.mk 
b/external/postgresql/Module_postgresql.mk
index 1f655c6e5034..7ea89dad3b39 100644
--- a/external/postgresql/Module_postgresql.mk
+++ b/external/postgresql/Module_postgresql.mk
@@ -14,4 +14,10 @@ $(eval $(call gb_Module_add_targets,postgresql,\
        UnpackedTarball_postgresql \
 ))
 
+ifeq ($(OS),WNT)
+$(eval $(call gb_Module_add_targets,postgresql,\
+       ExternalPackage_postgresql \
+))
+endif # WNT
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/UnpackedTarball_postgresql.mk 
b/external/postgresql/UnpackedTarball_postgresql.mk
index 90b363c2dccf..c189b10dcb4b 100644
--- a/external/postgresql/UnpackedTarball_postgresql.mk
+++ b/external/postgresql/UnpackedTarball_postgresql.mk
@@ -13,19 +13,12 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,postgresql,$(POSTGRESQL_TARBALL),,p
 
 $(eval $(call gb_UnpackedTarball_update_autoconf_configs,postgresql,config))
 
-$(eval $(call gb_UnpackedTarball_set_patchlevel,postgresql,3))
-
 $(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
-       external/postgresql/postgresql-libs-leak.patch \
-       external/postgresql/postgresql-9.2.1-libreoffice.patch \
        external/postgresql/windows.patch.0 \
        external/postgresql/postgresql.exit.patch.0 \
+       external/postgresql/postgres-msvc-build.patch.1 \
 ))
 
-ifeq ($(SYSTEM_ZLIB),)
-$(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
-       external/postgresql/internal-zlib.patch.1 \
-))
-endif
+$(eval $(call 
gb_UnpackedTarball_add_file,postgresql,src/tools/msvc/config.pl,external/postgresql/config.pl))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/config.pl b/external/postgresql/config.pl
new file mode 100644
index 000000000000..ae163ebbd166
--- /dev/null
+++ b/external/postgresql/config.pl
@@ -0,0 +1 @@
+$config->{openssl} = "$ENV{WORKDIR}/UnpackedTarball/openssl";
diff --git a/external/postgresql/internal-zlib.patch.1 
b/external/postgresql/internal-zlib.patch.1
deleted file mode 100644
index ac2b728e1314..000000000000
--- a/external/postgresql/internal-zlib.patch.1
+++ /dev/null
@@ -1,29 +0,0 @@
-diff -up postgresql/configure.dt postgresql/configure
---- postgresql/configure.dt    2016-11-03 17:34:17.282388226 +0100
-+++ postgresql/configure       2016-11-03 17:34:35.004202484 +0100
-@@ -8566,13 +8566,13 @@ fi
- 
- if test "$with_zlib" = yes; then
- 
--{ $as_echo "$as_me:$LINENO: checking for inflate in -lz" >&5
--$as_echo_n "checking for inflate in -lz... " >&6; }
-+{ $as_echo "$as_me:$LINENO: checking for inflate in -lzlib" >&5
-+$as_echo_n "checking for inflate in -lzlib... " >&6; }
- if test "${ac_cv_lib_z_inflate+set}" = set; then
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lz  $LIBS"
-+LIBS="-lzlib  $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
- _ACEOF
-@@ -8636,7 +8636,7 @@ if test "x$ac_cv_lib_z_inflate" = x""yes
- #define HAVE_LIBZ 1
- _ACEOF
- 
--  LIBS="-lz $LIBS"
-+  LIBS="-lzlib $LIBS"
- 
- else
-   { { $as_echo "$as_me:$LINENO: error: zlib library not found
diff --git a/external/postgresql/postgres-msvc-build.patch.1 
b/external/postgresql/postgres-msvc-build.patch.1
new file mode 100644
index 000000000000..c217a755918b
--- /dev/null
+++ b/external/postgresql/postgres-msvc-build.patch.1
@@ -0,0 +1,110 @@
+Cygwin perl calls /bin/sh which can't resolve to .exe
+
+Also Cygwin perl has $Config{osname} different from MSWin32, and why even 
check that?
+
+--- postgresql/src/tools/msvc/build.pl.orig    2021-01-19 17:36:09.801463500 
+0100
++++ postgresql/src/tools/msvc/build.pl 2021-01-19 17:36:20.426821300 +0100
+@@ -55,13 +55,13 @@
+ if ($buildwhat)
+ {
+       system(
+-              "msbuild $buildwhat.vcxproj /verbosity:normal $msbflags 
/p:Configuration=$bconf"
++              "msbuild.exe $buildwhat.vcxproj /verbosity:normal $msbflags 
/p:Configuration=$bconf"
+       );
+ }
+ else
+ {
+       system(
+-              "msbuild pgsql.sln /verbosity:normal $msbflags 
/p:Configuration=$bconf"
++              "msbuild.exe pgsql.sln /verbosity:normal $msbflags 
/p:Configuration=$bconf"
+       );
+ }
+ 
+--- postgresql/src/tools/msvc/Project.pm.orig  2021-01-19 17:59:18.799237700 
+0100
++++ postgresql/src/tools/msvc/Project.pm       2021-01-19 17:59:48.487711700 
+0100
+@@ -22,7 +22,7 @@
+       my $self = {
+               name                  => $name,
+               type                  => $type,
+-              guid                  => $^O eq "MSWin32" ? Win32::GuidGen() : 
'FAKE',
++              guid                  => Win32::GuidGen(),
+               files                 => {},
+               references            => [],
+               libraries             => [],
+--- postgresql/src/tools/msvc/Solution.pm.orig 2021-01-19 18:03:04.594229100 
+0100
++++ postgresql/src/tools/msvc/Solution.pm      2021-01-19 18:04:13.677610100 
+0100
+@@ -59,7 +59,7 @@
+ {
+       my $self = shift;
+ 
+-      if ($^O eq "MSWin32")
++      if (1) #($^O eq "MSWin32")
+       {
+               # Examine CL help output to determine if we are in 32 or 64-bit 
mode.
+               my $output = `cl /? 2>&1`;
+@@ -1081,7 +1081,7 @@
+               }
+               if ($fld ne "")
+               {
+-                      $flduid{$fld} = $^O eq "MSWin32" ? Win32::GuidGen() : 
'FAKE';
++                      $flduid{$fld} = Win32::GuidGen();
+                       print $sln <<EOF;
+ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "$fld", "$fld", 
"$flduid{$fld}"
+ EndProject
+--- postgresql/src/tools/msvc/VSObjectFactory.pm.orig  2021-01-19 
18:06:42.633421700 +0100
++++ postgresql/src/tools/msvc/VSObjectFactory.pm       2021-01-19 
18:06:28.663523200 +0100
+@@ -111,7 +111,7 @@
+ 
+ sub DetermineVisualStudioVersion
+ {
+-      if ($^O eq "MSWin32")
++      if (1) # ($^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
+--- postgresql/src/tools/msvc/Mkvcbuild.pm.orig        2021-01-19 
18:23:59.830153900 +0100
++++ postgresql/src/tools/msvc/Mkvcbuild.pm     2021-01-19 18:24:04.095411300 
+0100
+@@ -9,7 +9,7 @@
+ use warnings;
+ 
+ use Carp;
+-use if ($^O eq "MSWin32"), 'Win32';
++use Win32;
+ use Project;
+ use Solution;
+ use Cwd;
+--- postgresql/src/tools/msvc/Solution.pm.orig 2021-01-19 20:27:21.366237600 
+0100
++++ postgresql/src/tools/msvc/Solution.pm      2021-01-19 20:28:17.773662900 
+0100
+@@ -126,7 +126,8 @@
+       # openssl.exe is in the specified directory.
+       # Quote the .exe name in case it has spaces
+       my $opensslcmd =
+-        qq("$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1);
++        qq("$self->{options}->{openssl}\\apps\\openssl.exe" version 2>&1);
++ print "$opensslcmd";
+       my $sslout = `$opensslcmd`;
+ 
+       $? >> 8 == 0
+@@ -964,8 +964,8 @@
+                               # On both Win32 and Win64 the same library
+                               # names are used without a debugging context.
+                               $dbgsuffix     = 0;
+-                              $libsslpath    = '\lib\libssl.lib';
+-                              $libcryptopath = '\lib\libcrypto.lib';
++                              $libsslpath    = '\libssl.lib';
++                              $libcryptopath = '\libcrypto.lib';
+                       }
+ 
+                       $proj->AddLibrary($self->{options}->{openssl} . 
$libsslpath,
+@@ -990,9 +990,9 @@
+                               # to be here, so don't ask for it in last
+                               # parameter.
+                               $proj->AddLibrary(
+-                                      $self->{options}->{openssl} . 
'\lib\ssleay32.lib', 0);
++                                      $self->{options}->{openssl} . 
'\ssleay32.lib', 0);
+                               $proj->AddLibrary(
+-                                      $self->{options}->{openssl} . 
'\lib\libeay32.lib', 0);
++                                      $self->{options}->{openssl} . 
'\libeay32.lib', 0);
+                       }
+               }
+       }
diff --git a/external/postgresql/postgresql-9.2.1-libreoffice.patch 
b/external/postgresql/postgresql-9.2.1-libreoffice.patch
deleted file mode 100644
index 174ee8551a78..000000000000
--- a/external/postgresql/postgresql-9.2.1-libreoffice.patch
+++ /dev/null
@@ -1,74 +0,0 @@
---- misc/build/postgresql-9.1.1/src/interfaces/libpq/Makefile  2011-09-22 
23:57:57.000000000 +0200
-+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/Makefile  
2011-12-15 09:02:18.000000000 +0100
-@@ -148,3 +148,6 @@
- maintainer-clean: distclean maintainer-clean-lib
-       $(MAKE) -C test $@
-       rm -f libpq-dist.rc
-+
-+libpq-flags.mk:
-+      @printf '%s\n' 'LIBPQ_DEP_LIBS+=$(SHLIB_LINK)' > '$@'
---- misc/build/postgresql-9.1.1/src/interfaces/libpq/win32.mak 2011-12-14 
14:28:59.000000000 +0100
-+++ misc/build/postgresql-9.1.1.patched/src/interfaces/libpq/win32.mak 
2011-12-15 09:11:37.000000000 +0100
-@@ -11,14 +11,12 @@
- !ENDIF
- 
- !IFDEF DEBUG
--OPT=/Od /Zi /MDd
-+OPT=/Od /Zi
- LOPT=/DEBUG
--DEBUGDEF=/D _DEBUG
--OUTFILENAME=libpqd
-+OUTFILENAME=libpq
- !ELSE
- OPT=/O2 /MD
- LOPT=
--DEBUGDEF=/D NDEBUG
- OUTFILENAME=libpq
- !ENDIF
- 
-@@ -67,18 +66,11 @@
- CPP=cl.exe
- RSC=rc.exe
- 
--!IFDEF DEBUG
--OUTDIR=.\Debug
--INTDIR=.\Debug
--CPP_OBJS=.\Debug/
--!ELSE
--OUTDIR=.\Release
--INTDIR=.\Release
--CPP_OBJS=.\Release/
--!ENDIF
--
-+OUTDIR=.
-+INTDIR=.
-+CPP_OBJS=./
- 
--ALL : config "$(OUTDIR)\$(OUTFILENAME).lib" "$(OUTDIR)\$(OUTFILENAME).dll"
-+ALL : config "$(OUTDIR)\$(OUTFILENAME).lib"
- 
- CLEAN :
-       -@erase "$(INTDIR)\getaddrinfo.obj"
-@@ -178,10 +170,11 @@
- "$(OUTDIR)" :
-     if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
- 
--CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I 
"..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" 
/I. /I "$(SSL_INC)" \
-+CPP_PROJ=/nologo /W3 /EHsc $(OPT) /I "..\..\include" /I 
"..\..\include\port\win32" /I "..\..\include\port\win32_msvc" /I "..\..\port" 
/I. $(SOLARINC) /I $(WORKDIR)/UnpackedTarball/openssl/include \
-  /D "FRONTEND" $(DEBUGDEF) \
-  /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq.pch" \
-  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c  \
-+ /D "_CRT_NONSTDC_NO_DEPRECATE" \
-  /D "_CRT_SECURE_NO_DEPRECATE" $(ADD_DEFINES)
- 
- !IFDEF USE_SSL
-@@ -222,7 +215,7 @@
- <<
- 
- "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq-dist.rc
--      $(RSC) $(RSC_PROJ) libpq-dist.rc
-+      $(RSC) $(SOLARINC) $(RSC_PROJ) libpq-dist.rc
- 
- 
- "$(OUTDIR)\$(OUTFILENAME).dll" : "$(OUTDIR)" "$(INTDIR)\libpq.res"
-
diff --git a/external/postgresql/postgresql-libs-leak.patch 
b/external/postgresql/postgresql-libs-leak.patch
deleted file mode 100644
index 8224137f1f97..000000000000
--- a/external/postgresql/postgresql-libs-leak.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --recursive -u misc/build/postgresql-9.1.1/configure.in 
misc/build/postgresql-9.1.1.patched/configure.in
---- misc/build/postgresql-9.1.1/configure.in   2011-09-22 23:57:57.000000000 
+0200
-+++ misc/build/postgresql-9.1.1.patched/configure.in   2012-02-03 
11:42:45.000000000 +0100
-@@ -903,18 +903,9 @@
- *** Not using spinlocks will cause poor performance.])
- fi
- 
--if test "$with_gssapi" = yes ; then
--  if test "$PORTNAME" != "win32"; then
--    AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 
-lcrypto'], [],
--                                [AC_MSG_ERROR([could not find function 
'gss_init_sec_context' required for GSSAPI])])
--  else
--    LIBS="$LIBS -lgssapi32"
--  fi
--fi
--
- if test "$with_krb5" = yes ; then
-   if test "$PORTNAME" != "win32"; then
--     AC_SEARCH_LIBS(com_err, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken' 
com_err 'com_err -lssl -lcrypto'], [],
-+     AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 
-lcrypto -ldes -lasn1 -lroken'], [],
-                     [AC_MSG_ERROR([could not find function 'com_err' required 
for Kerberos 5])])
-      AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 
-lroken'], [],
-                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' 
required for Kerberos 5])])
-@@ -924,6 +915,15 @@
-   fi
- fi
- 
-+if test "$with_gssapi" = yes ; then
-+  if test "$PORTNAME" != "win32"; then
-+    AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 
-lcrypto'], [],
-+                                [AC_MSG_ERROR([could not find function 
'gss_init_sec_context' required for GSSAPI])])
-+  else
-+    LIBS="$LIBS -lgssapi32"
-+  fi
-+fi
-+
- if test "$with_openssl" = yes ; then
-   dnl Order matters!
-   if test "$PORTNAME" != "win32"; then
-
diff --git a/external/postgresql/postgresql.exit.patch.0 
b/external/postgresql/postgresql.exit.patch.0
index 0d167925f4a4..77912038e88e 100644
--- a/external/postgresql/postgresql.exit.patch.0
+++ b/external/postgresql/postgresql.exit.patch.0
@@ -2,16 +2,16 @@
 --- configure
 +++ configure
 @@ -24565,6 +24565,7 @@
- cat confdefs.h >>conftest.$ac_ext
- cat >>conftest.$ac_ext <<_ACEOF
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
 +#include <stdlib.h>
  typedef long int ac_int64;
  
  /*
 @@ -24702,6 +24702,7 @@
- cat confdefs.h >>conftest.$ac_ext
- cat >>conftest.$ac_ext <<_ACEOF
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  /* end confdefs.h.  */
 +#include <stdlib.h>
  typedef long long int ac_int64;
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 59d1c9cdedea..b264a32eeeaf 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -381,10 +381,10 @@
                     "dest-filename": "external/tarballs/poppler-0.82.0.tar.xz"
                 },
                 {
-                    "url": 
"https://dev-www.libreoffice.org/src/postgresql-9.2.24.tar.bz2";,
-                    "sha256": 
"a754c02f7051c2f21e52f8669a421b50485afcde9a581674d6106326b189d126",
+                    "url": 
"https://dev-www.libreoffice.org/src/postgresql-13.1.tar.bz2";,
+                    "sha256": 
"12345c83b89aa29808568977f5200d6da00f88a035517f925293355432ffe61f",
                     "type": "file",
-                    "dest-filename": 
"external/tarballs/postgresql-9.2.24.tar.bz2"
+                    "dest-filename": 
"external/tarballs/postgresql-13.1.tar.bz2"
                 },
                 {
                     "url": 
"https://dev-www.libreoffice.org/src/QR-Code-generator-1.4.0.tar.gz";,

Reply via email to