summaryrefslogtreecommitdiffstats
path: root/external/postgresql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /external/postgresql
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--external/postgresql/ExternalPackage_postgresql.mk16
-rw-r--r--external/postgresql/ExternalProject_postgresql.mk86
-rw-r--r--external/postgresql/Makefile7
-rw-r--r--external/postgresql/Module_postgresql.mk23
-rw-r--r--external/postgresql/README3
-rw-r--r--external/postgresql/UnpackedTarball_postgresql.mk27
-rw-r--r--external/postgresql/arm64.patch.153
-rw-r--r--external/postgresql/config.pl1
-rw-r--r--external/postgresql/postgres-msvc-build.patch.1110
-rw-r--r--external/postgresql/postgresql.exit.patch.019
-rw-r--r--external/postgresql/windows.patch.011
11 files changed, 356 insertions, 0 deletions
diff --git a/external/postgresql/ExternalPackage_postgresql.mk b/external/postgresql/ExternalPackage_postgresql.mk
new file mode 100644
index 000000000..ada8c4f38
--- /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
new file mode 100644
index 000000000..24e54adf3
--- /dev/null
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -0,0 +1,86 @@
+# -*- 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_ExternalProject_ExternalProject,postgresql))
+
+$(eval $(call gb_ExternalProject_use_externals,postgresql,\
+ $(if $(ENABLE_LDAP),openldap) \
+ openssl \
+))
+
+$(eval $(call gb_ExternalProject_register_targets,postgresql,\
+ build \
+))
+
+ifeq ($(OS),WNT)
+
+$(eval $(call gb_ExternalProject_use_nmake,postgresql,build))
+
+$(call gb_ExternalProject_get_state_target,postgresql,build) :
+ $(call gb_Trace_StartRange,postgresql,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ MSBFLAGS="/p:Platform=$(gb_MSBUILD_PLATFORM) \
+ /p:PlatformToolset=$(VCTOOLSET) /p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
+ $(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION))" \
+ $(PERL) build.pl $(gb_MSBUILD_CONFIG) libpq \
+ ,src/tools/msvc)
+ $(call gb_Trace_EndRange,postgresql,EXTERNAL)
+
+else
+
+postgresql_CPPFLAGS := $(ZLIB_CFLAGS)
+postgresql_LDFLAGS := $(LDFLAGS)
+
+ifeq ($(SYSTEM_ZLIB),)
+postgresql_LDFLAGS += $(ZLIB_LIBS)
+endif
+
+ifeq ($(ENABLE_OPENSSL),TRUE)
+ifeq ($(SYSTEM_OPENSSL),)
+postgresql_CPPFLAGS += -I$(call gb_UnpackedTarball_get_dir,openssl)/include
+postgresql_LDFLAGS += -L$(call gb_UnpackedTarball_get_dir,openssl)/ $(if $(filter $(OS),LINUX),-pthread)
+endif
+endif
+
+ifeq ($(SYSTEM_OPENLDAP),)
+postgresql_CPPFLAGS += -I$(call gb_UnpackedTarball_get_dir,openldap)/include
+postgresql_LDFLAGS += \
+ -L$(call gb_UnpackedTarball_get_dir,openldap)/libraries/libldap_r/.libs \
+ -L$(call gb_UnpackedTarball_get_dir,openldap)/libraries/libldap/.libs \
+ -L$(call gb_UnpackedTarball_get_dir,openldap)/libraries/liblber/.libs \
+ $(if $(SYSTEM_NSS),,\
+ -L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib) \
+
+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_Trace_StartRange,postgresql,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(gb_RUN_CONFIGURE) ./configure \
+ --without-readline \
+ --without-zlib \
+ --with-ldap \
+ $(gb_CONFIGURE_PLATFORMS) \
+ $(if $(ENABLE_OPENSSL),--with-openssl \
+ $(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) MAKELEVEL=0 all-static-lib)
+ $(call gb_Trace_EndRange,postgresql,EXTERNAL)
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/Makefile b/external/postgresql/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/postgresql/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/Module_postgresql.mk b/external/postgresql/Module_postgresql.mk
new file mode 100644
index 000000000..7ea89dad3
--- /dev/null
+++ b/external/postgresql/Module_postgresql.mk
@@ -0,0 +1,23 @@
+# -*- 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_Module_Module,postgresql))
+
+$(eval $(call gb_Module_add_targets,postgresql,\
+ ExternalProject_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/README b/external/postgresql/README
new file mode 100644
index 000000000..edc3d5df2
--- /dev/null
+++ b/external/postgresql/README
@@ -0,0 +1,3 @@
+PostgreSQL object-relational database management system
+
+We use some pieces of this code for the postgresql database connector. \ No newline at end of file
diff --git a/external/postgresql/UnpackedTarball_postgresql.mk b/external/postgresql/UnpackedTarball_postgresql.mk
new file mode 100644
index 000000000..11fb603ef
--- /dev/null
+++ b/external/postgresql/UnpackedTarball_postgresql.mk
@@ -0,0 +1,27 @@
+# -*- 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_UnpackedTarball_UnpackedTarball,postgresql))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,postgresql,$(POSTGRESQL_TARBALL),,postgresql))
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,postgresql,config))
+
+$(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_AARCH64,$(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 000000000..db8a3ad0a
--- /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 +346,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
+ {
diff --git a/external/postgresql/config.pl b/external/postgresql/config.pl
new file mode 100644
index 000000000..ae163ebbd
--- /dev/null
+++ b/external/postgresql/config.pl
@@ -0,0 +1 @@
+$config->{openssl} = "$ENV{WORKDIR}/UnpackedTarball/openssl";
diff --git a/external/postgresql/postgres-msvc-build.patch.1 b/external/postgresql/postgres-msvc-build.patch.1
new file mode 100644
index 000000000..dec317422
--- /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`;
+@@ -1100,7 +1100,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
+@@ -131,7 +131,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
+@@ -967,8 +967,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,
+@@ -993,9 +993,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.exit.patch.0 b/external/postgresql/postgresql.exit.patch.0
new file mode 100644
index 000000000..8eaa1ea52
--- /dev/null
+++ b/external/postgresql/postgresql.exit.patch.0
@@ -0,0 +1,19 @@
+# error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
+--- configure
++++ configure
+@@ -16997,6 +16997,7 @@
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
++#include <stdlib.h>
+ typedef long int ac_int64;
+
+ /*
+@@ -17081,6 +17082,7 @@
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
++#include <stdlib.h>
+ typedef long long int ac_int64;
+
+ /*
diff --git a/external/postgresql/windows.patch.0 b/external/postgresql/windows.patch.0
new file mode 100644
index 000000000..28fc9046c
--- /dev/null
+++ b/external/postgresql/windows.patch.0
@@ -0,0 +1,11 @@
+--- src/port/chklocale.c
++++ src/port/chklocale.c
+@@ -220,7 +220,7 @@
+ {
+ r = malloc(16); /* excess */
+ if (r != NULL)
+- sprintf(r, "CP%u", loct->locinfo->lc_codepage);
++ sprintf(r, "CP%u", ((struct __crt_locale_data_public *) loct->locinfo)->_locale_lc_codepage);
+ _free_locale(loct);
+ }
+ #else