diff --git a/src/postgresql-1-fixes.patch b/src/postgresql-1-fixes.patch new file mode 100644 index 00000000..6a1e3f7d --- /dev/null +++ b/src/postgresql-1-fixes.patch @@ -0,0 +1,149 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. + +From a92f8ef8826f38edfe010752badc5c280f5b9605 Mon Sep 17 00:00:00 2001 +From: "a@a.org" +Date: Mon, 24 Oct 2011 14:02:33 +0200 +Subject: [PATCH 1/4] use unix style names for openssl on mingw-cross-env + + +diff --git a/configure.in b/configure.in +index 2f8bb3d..441b42b 100644 +--- a/configure.in ++++ b/configure.in +@@ -926,13 +926,8 @@ fi + + if test "$with_openssl" = yes ; then + dnl Order matters! +- if test "$PORTNAME" != "win32"; then +- AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])]) +- AC_CHECK_LIB(ssl, SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])]) +- else +- AC_SEARCH_LIBS(CRYPTO_new_ex_data, eay32 crypto, [], [AC_MSG_ERROR([library 'eay32' or 'crypto' is required for OpenSSL])]) +- AC_SEARCH_LIBS(SSL_library_init, ssleay32 ssl, [], [AC_MSG_ERROR([library 'ssleay32' or 'ssl' is required for OpenSSL])]) +- fi ++ AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [AC_MSG_ERROR([library 'crypto' is required for OpenSSL])]) ++ AC_CHECK_LIB(ssl, SSL_library_init, [], [AC_MSG_ERROR([library 'ssl' is required for OpenSSL])]) + fi + + if test "$with_pam" = yes ; then +-- +1.9.1 + + +From 6bbf26ce1f6c0bbd6fc53db1152b1132795b2850 Mon Sep 17 00:00:00 2001 +From: "a@a.org" +Date: Mon, 24 Oct 2011 14:09:38 +0200 +Subject: [PATCH 2/4] do not check autoconf version + + +diff --git a/configure.in b/configure.in +index 441b42b..1257071 100644 +--- a/configure.in ++++ b/configure.in +@@ -19,10 +19,6 @@ m4_pattern_forbid(^PGAC_)dnl to catch undefined macros + + AC_INIT([PostgreSQL], [9.2.4], [pgsql-bugs@postgresql.org]) + +-m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.63], [], [m4_fatal([Autoconf version 2.63 is required. +-Untested combinations of 'autoconf' and PostgreSQL versions are not +-recommended. You can remove the check from 'configure.in' but it is then +-your responsibility whether the result works or not.])]) + AC_COPYRIGHT([Copyright (c) 1996-2012, PostgreSQL Global Development Group]) + AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c]) + AC_CONFIG_AUX_DIR(config) +-- +1.9.1 + + +From e7cdd570742aa958d5b45c6971253d9a0ac8ecf4 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Tue, 1 Jul 2014 14:27:21 -0700 +Subject: [PATCH 3/4] Fix shared lib install location + +Signed-off-by: Timothy Gu + +diff --git a/src/Makefile.shlib b/src/Makefile.shlib +index 294d10f..3acdd81 100644 +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -293,6 +293,7 @@ endif + ifeq ($(PORTNAME), win32) + ifdef SO_MAJOR_VERSION + shlib = lib$(NAME)$(DLSUFFIX) ++ stlib = lib$(NAME)$(DLSUFFIX).a + endif + haslibarule = yes + endif +@@ -447,14 +448,16 @@ ifeq ($(PORTNAME), darwin) + endif + + ifeq ($(enable_shared), yes) +-install-lib-shared: $(shlib) installdirs-lib ++install-lib-shared: $(shlib) ++ifeq (, $(filter $(PORTNAME), win32 cygwin)) ++install-lib-shared: installdirs-lib ++endif # not win32 or cygwin + ifdef soname + # we don't install $(shlib) on AIX + # (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at) + ifneq ($(PORTNAME), aix) ++ifeq (, $(filter $(PORTNAME), win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)' +-ifneq ($(PORTNAME), cygwin) +-ifneq ($(PORTNAME), win32) + ifneq ($(shlib), $(shlib_major)) + cd '$(DESTDIR)$(libdir)' && \ + rm -f $(shlib_major) && \ +@@ -465,8 +468,9 @@ ifneq ($(shlib), $(shlib_bare)) + rm -f $(shlib_bare) && \ + $(LN_S) $(shlib) $(shlib_bare) + endif +-endif # not win32 +-endif # not cygwin ++else # win32 or cygwin ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' ++endif # not win32 or cygwin + endif # not aix + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' +-- +1.9.1 + + +From 49f1ebdd0a4523f77b889b7dfbd5d34c2e11dab1 Mon Sep 17 00:00:00 2001 +From: Timothy Gu +Date: Tue, 1 Jul 2014 14:41:44 -0700 +Subject: [PATCH 4/4] Don't build shared lib on win32 if --disable-shared is + set + +Signed-off-by: Timothy Gu + +diff --git a/src/Makefile.shlib b/src/Makefile.shlib +index 3acdd81..68084cd 100644 +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -291,11 +291,15 @@ ifeq ($(PORTNAME), cygwin) + endif + + ifeq ($(PORTNAME), win32) +- ifdef SO_MAJOR_VERSION +- shlib = lib$(NAME)$(DLSUFFIX) +- stlib = lib$(NAME)$(DLSUFFIX).a ++ ifeq ($(enable_shared), yes) ++ ifdef SO_MAJOR_VERSION ++ shlib = lib$(NAME)$(DLSUFFIX) ++ stlib = lib$(NAME)$(DLSUFFIX).a ++ endif ++ haslibarule = yes ++ else ++ shlib = + endif +- haslibarule = yes + endif + + +-- +1.9.1 + diff --git a/src/postgresql-2-autoconf-min-version.patch b/src/postgresql-2-autoconf-min-version.patch new file mode 100644 index 00000000..f61f7fea --- /dev/null +++ b/src/postgresql-2-autoconf-min-version.patch @@ -0,0 +1,29 @@ +This file is part of MXE. See LICENSE.md for licensing information. + +Contains ad hoc patches for cross building. +see https://github.com/mxe/mxe/issues/672 + +From b18fec680ef90c65247d998e3f68e7574d45e83e Mon Sep 17 00:00:00 2001 +From: "Avi Halachmi (:avih)" +Date: Fri, 24 Apr 2015 07:25:04 +0300 +Subject: [PATCH] autoconf: require minimum version 2.50 + +--- + configure.in | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configure.in b/configure.in +index 1257071..24f91cd 100644 +--- a/configure.in ++++ b/configure.in +@@ -17,6 +17,7 @@ dnl Read the Autoconf manual for details. + dnl + m4_pattern_forbid(^PGAC_)dnl to catch undefined macros + ++AC_PREREQ(2.63) + AC_INIT([PostgreSQL], [9.2.4], [pgsql-bugs@postgresql.org]) + + AC_COPYRIGHT([Copyright (c) 1996-2012, PostgreSQL Global Development Group]) +-- +1.9.1 + diff --git a/src/postgresql-3-mingw-errno.patch b/src/postgresql-3-mingw-errno.patch new file mode 100644 index 00000000..ae3bfe03 --- /dev/null +++ b/src/postgresql-3-mingw-errno.patch @@ -0,0 +1,152 @@ +--- postgresql-9.2.4/src/interfaces/libpq/fe-connect.c.orig 2013-08-15 09:08:59.850609595 -0500 ++++ postgresql-9.2.4/src/interfaces/libpq/fe-connect.c 2013-08-15 09:42:59.001463906 -0500 +@@ -1778,10 +1778,16 @@ + if (connect(conn->sock, addr_cur->ai_addr, + addr_cur->ai_addrlen) < 0) + { ++#ifndef WIN32 + if (SOCK_ERRNO == EINPROGRESS || + SOCK_ERRNO == EWOULDBLOCK || + SOCK_ERRNO == EINTR || ++#else ++ if (SOCK_ERRNO == WSAEINPROGRESS || ++ SOCK_ERRNO == WSAEWOULDBLOCK || ++ SOCK_ERRNO == WSAEINTR || + SOCK_ERRNO == 0) ++#endif + { + /* + * This is fine - we're in non-blocking mode, and +--- postgresql-9.2.4/src/interfaces/libpq/fe-misc.c.orig 2013-04-01 13:20:36.000000000 -0500 ++++ postgresql-9.2.4/src/interfaces/libpq/fe-misc.c 2013-08-15 10:08:03.190928760 -0500 +@@ -656,7 +656,11 @@ + conn->inBufSize - conn->inEnd); + if (nread < 0) + { ++#ifndef WIN32 + if (SOCK_ERRNO == EINTR) ++#else ++ if (SOCK_ERRNO == WSAEINTR) ++#endif + goto retry3; + /* Some systems return EAGAIN/EWOULDBLOCK for no data */ + #ifdef EAGAIN +@@ -664,12 +668,20 @@ + return someread; + #endif + #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) ++#ifndef WIN32 + if (SOCK_ERRNO == EWOULDBLOCK) ++#else ++ if (SOCK_ERRNO == WSAEWOULDBLOCK) ++#endif + return someread; + #endif + /* We might get ECONNRESET here if using TCP and backend died */ + #ifdef ECONNRESET ++#ifndef WIN32 + if (SOCK_ERRNO == ECONNRESET) ++#else ++ if (SOCK_ERRNO == WSAECONNRESET) ++#endif + goto definitelyFailed; + #endif + /* pqsecure_read set the error message for us */ +@@ -749,7 +761,11 @@ + conn->inBufSize - conn->inEnd); + if (nread < 0) + { ++#ifndef WIN32 + if (SOCK_ERRNO == EINTR) ++#else ++ if (SOCK_ERRNO == WSAEINTR) ++#endif + goto retry4; + /* Some systems return EAGAIN/EWOULDBLOCK for no data */ + #ifdef EAGAIN +@@ -757,12 +773,20 @@ + return 0; + #endif + #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) ++#ifndef WIN32 + if (SOCK_ERRNO == EWOULDBLOCK) ++#else ++ if (SOCK_ERRNO == WSAEWOULDBLOCK) ++#endif + return 0; + #endif + /* We might get ECONNRESET here if using TCP and backend died */ + #ifdef ECONNRESET ++#ifndef WIN32 + if (SOCK_ERRNO == ECONNRESET) ++#else ++ if (SOCK_ERRNO == WSAECONNRESET) ++#endif + goto definitelyFailed; + #endif + /* pqsecure_read set the error message for us */ +@@ -838,10 +862,18 @@ + break; + #endif + #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) ++#ifndef WIN32 + case EWOULDBLOCK: ++#else ++ case WSAEWOULDBLOCK: ++#endif + break; + #endif ++#ifndef WIN32 + case EINTR: ++#else ++ case WSAEINTR: ++#endif + continue; + + default: +--- postgresql-9.2.4/src/interfaces/libpq/fe-secure.c.orig 2013-08-15 10:10:44.039355056 -0500 ++++ postgresql-9.2.4/src/interfaces/libpq/fe-secure.c 2013-08-15 10:22:57.767650717 -0500 +@@ -433,12 +433,20 @@ + #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) + case EWOULDBLOCK: + #endif ++#ifndef WIN32 + case EINTR: ++#else ++ case WSAEWOULDBLOCK: ++ case WSAEINTR: ++#endif + /* no error message, caller is expected to retry */ + break; + + #ifdef ECONNRESET + case ECONNRESET: ++#ifdef WIN32 ++ case WSAECONNRESET: ++#endif + printfPQExpBuffer(&conn->errorMessage, + libpq_gettext( + "server closed the connection unexpectedly\n" +@@ -617,7 +625,12 @@ + #if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) + case EWOULDBLOCK: + #endif ++#ifndef WIN32 + case EINTR: ++#else ++ case WSAEWOULDBLOCK: ++ case WSAEINTR: ++#endif + /* no error message, caller is expected to retry */ + break; + +@@ -629,6 +642,9 @@ + #ifdef ECONNRESET + case ECONNRESET: + #endif ++#ifdef WIN32 ++ case WSAECONNRESET: ++#endif + printfPQExpBuffer(&conn->errorMessage, + libpq_gettext( + "server closed the connection unexpectedly\n" diff --git a/src/postgresql.mk b/src/postgresql.mk index ad345ea8..e0ad874c 100644 --- a/src/postgresql.mk +++ b/src/postgresql.mk @@ -4,8 +4,8 @@ PKG := postgresql $(PKG)_WEBSITE := http://www.postgresql.org/ $(PKG)_DESCR := PostgreSQL $(PKG)_IGNORE := -$(PKG)_VERSION := 9.6.2 -$(PKG)_CHECKSUM := 0187b5184be1c09034e74e44761505e52357248451b0c854dddec6c231fe50c9 +$(PKG)_VERSION := 9.2.4 +$(PKG)_CHECKSUM := d97dd918a88a4449225998f46aafa85216a3f89163a3411830d6890507ffae93 $(PKG)_SUBDIR := postgresql-$($(PKG)_VERSION) $(PKG)_FILE := postgresql-$($(PKG)_VERSION).tar.bz2 $(PKG)_URL := http://ftp.postgresql.org/pub/source/v$($(PKG)_VERSION)/$($(PKG)_FILE) @@ -46,7 +46,6 @@ define $(PKG)_BUILD LIBS="-lsecur32 `'$(TARGET)-pkg-config' openssl pthreads --libs`" \ ac_cv_func_getaddrinfo=no - $(MAKE) -C '$(1)'/src/common -j '$(JOBS)' # enable_thread_safety means "build internal pthreads" on windows # disable it and link mingw-w64 pthreads to and avoid name conflicts $(MAKE) -C '$(1)'/src/interfaces/libpq -j '$(JOBS)' \