summaryrefslogtreecommitdiffstats
path: root/external/postgresql
diff options
context:
space:
mode:
Diffstat (limited to 'external/postgresql')
-rw-r--r--external/postgresql/ExternalProject_postgresql.mk80
-rw-r--r--external/postgresql/Makefile7
-rw-r--r--external/postgresql/Module_postgresql.mk17
-rw-r--r--external/postgresql/README3
-rw-r--r--external/postgresql/UnpackedTarball_postgresql.mk31
-rw-r--r--external/postgresql/internal-zlib.patch.129
-rw-r--r--external/postgresql/postgresql-9.2.1-libreoffice.patch74
-rw-r--r--external/postgresql/postgresql-libs-leak.patch40
-rw-r--r--external/postgresql/postgresql.exit.patch.019
-rw-r--r--external/postgresql/windows.patch.011
10 files changed, 311 insertions, 0 deletions
diff --git a/external/postgresql/ExternalProject_postgresql.mk b/external/postgresql/ExternalProject_postgresql.mk
new file mode 100644
index 000000000..c437bb29a
--- /dev/null
+++ b/external/postgresql/ExternalProject_postgresql.mk
@@ -0,0 +1,80 @@
+# -*- 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 \
+ zlib \
+))
+
+$(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,\
+ nmake -f win32.mak USE_SSL=1 USE_LDAP=1 \
+ ,src)
+ $(call gb_Trace_EndRange,postgresql,EXTERNAL)
+
+else
+
+postgresql_CPPFLAGS := $(ZLIB_CFLAGS)
+postgresql_LDFLAGS := $(LDFLAGS)
+
+ifeq ($(SYSTEM_ZLIB),)
+postgresql_LDFLAGS += $(ZLIB_LIBS)
+endif
+
+ifeq ($(DISABLE_OPENSSL),)
+ifeq ($(SYSTEM_OPENSSL),)
+postgresql_CPPFLAGS += -I$(call gb_UnpackedTarball_get_dir,openssl)/include
+postgresql_LDFLAGS += -L$(call gb_UnpackedTarball_get_dir,openssl)/
+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
+
+
+$(call gb_ExternalProject_get_state_target,postgresql,build) :
+ $(call gb_Trace_StartRange,postgresql,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ ./configure \
+ --without-readline --disable-shared --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) \
+ 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)
+ $(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..1f655c6e5
--- /dev/null
+++ b/external/postgresql/Module_postgresql.mk
@@ -0,0 +1,17 @@
+# -*- 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 \
+))
+
+# 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..a53bbbffd
--- /dev/null
+++ b/external/postgresql/UnpackedTarball_postgresql.mk
@@ -0,0 +1,31 @@
+# -*- 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_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 \
+))
+
+ifeq ($(SYSTEM_ZLIB),)
+$(eval $(call gb_UnpackedTarball_add_patches,postgresql, \
+ external/postgresql/internal-zlib.patch.1 \
+))
+endif
+
+$(eval $(call gb_UnpackedTarball_update_autoconf_configs,postgresql))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/postgresql/internal-zlib.patch.1 b/external/postgresql/internal-zlib.patch.1
new file mode 100644
index 000000000..ac2b728e1
--- /dev/null
+++ b/external/postgresql/internal-zlib.patch.1
@@ -0,0 +1,29 @@
+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/postgresql-9.2.1-libreoffice.patch b/external/postgresql/postgresql-9.2.1-libreoffice.patch
new file mode 100644
index 000000000..174ee8551
--- /dev/null
+++ b/external/postgresql/postgresql-9.2.1-libreoffice.patch
@@ -0,0 +1,74 @@
+--- 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
new file mode 100644
index 000000000..8224137f1
--- /dev/null
+++ b/external/postgresql/postgresql-libs-leak.patch
@@ -0,0 +1,40 @@
+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
new file mode 100644
index 000000000..0d167925f
--- /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
+@@ -24565,6 +24565,7 @@
+ cat confdefs.h >>conftest.$ac_ext
+ cat >>conftest.$ac_ext <<_ACEOF
+ /* 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
+ /* 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..dbac548d4
--- /dev/null
+++ b/external/postgresql/windows.patch.0
@@ -0,0 +1,11 @@
+--- src/port/chklocale.c
++++ src/port/chklocale.c
+@@ -211,7 +211,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