summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2016-08-17 05:03:29 (GMT)
committerGitHub <noreply@github.com>2016-08-17 05:03:29 (GMT)
commitdb6c850815935b2aeccadd9171e5c0e38d6a943e (patch)
treec678d63ac7d258836757acc9bc75f2eea251d58a /src
parentd0566b2e0e22ceb90ac9e1e746f969ea2a2df652 (diff)
parentec2ed12b6fd763db42eaffba58c73762a3b06322 (diff)
downloadmxe-db6c850815935b2aeccadd9171e5c0e38d6a943e.zip
mxe-db6c850815935b2aeccadd9171e5c0e38d6a943e.tar.gz
mxe-db6c850815935b2aeccadd9171e5c0e38d6a943e.tar.bz2
Merge pull request #1488 from tonytheodore/posix-sql
Fix MySQL and PostgreSQL posix and win32 build
Diffstat (limited to 'src')
-rw-r--r--src/libmysqlclient-1-fixes.patch80
-rw-r--r--src/postgresql.mk13
-rw-r--r--src/qt.mk2
-rw-r--r--src/qtbase.mk2
4 files changed, 92 insertions, 5 deletions
diff --git a/src/libmysqlclient-1-fixes.patch b/src/libmysqlclient-1-fixes.patch
index bae92e2..3fbb963 100644
--- a/src/libmysqlclient-1-fixes.patch
+++ b/src/libmysqlclient-1-fixes.patch
@@ -371,3 +371,83 @@ index 1111111..2222222 100644
IF (lib MATCHES "^\\-l")
SET(${var} "${${var}} ${lib} ")
ELSEIF(lib MATCHES "^/")
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "fix@me" <fix@me>
+Date: Fri, 13 Nov 2015 10:22:12 -0500
+Subject: [PATCH] For Windows, check if POSIX thread model or win32 thread
+ model is being used.
+
+
+diff --git a/configure.cmake b/configure.cmake
+index 1111111..2222222 100644
+--- a/configure.cmake
++++ b/configure.cmake
+@@ -389,6 +389,7 @@ CHECK_INCLUDE_FILES (fnmatch.h HAVE_FNMATCH_H)
+ CHECK_INCLUDE_FILES (sys/un.h HAVE_SYS_UN_H)
+ CHECK_INCLUDE_FILES (vis.h HAVE_VIS_H) # Used by libedit
+ CHECK_INCLUDE_FILES (sasl/sasl.h HAVE_SASL_SASL_H) # Used by memcached
++CHECK_INCLUDE_FILES (pthread.h HAVE_PTHREAD_H)
+
+ # For libevent
+ CHECK_INCLUDE_FILES(sys/devpoll.h HAVE_DEVPOLL)
+diff --git a/include/my_pthread.h b/include/my_pthread.h
+index 1111111..2222222 100644
+--- a/include/my_pthread.h
++++ b/include/my_pthread.h
+@@ -20,7 +20,7 @@
+
+ #include "my_global.h" /* myf */
+
+-#if !defined(_WIN32)
++#if !(defined(_WIN32) && !defined(USING_PTHREADS))
+ #include <pthread.h>
+ #endif
+
+@@ -35,7 +35,7 @@ extern "C" {
+ #define EXTERNC
+ #endif /* __cplusplus */
+
+-#if defined(_WIN32)
++#if defined(_WIN32) && !defined(__WINPTHREADS_VERSION)
+ typedef DWORD pthread_t;
+ #define pthread_self() GetCurrentThreadId()
+ #define pthread_handler_t EXTERNC void * __cdecl
+@@ -51,7 +51,7 @@ typedef DWORD pthread_t;
+ #include "thr_cond.h"
+ #include "thr_rwlock.h"
+
+-#if defined(_WIN32)
++#if defined(_WIN32) && !defined(__WINPTHREADS_VERSION)
+ /*
+ Existing mysql_thread_create() or pthread_create() does not work well
+ in windows platform when threads are joined because
+diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt
+index 1111111..2222222 100644
+--- a/mysys/CMakeLists.txt
++++ b/mysys/CMakeLists.txt
+@@ -78,6 +78,11 @@ IF(CMAKE_USE_PTHREADS_INIT AND CMAKE_C_FLAGS MATCHES "-fsanitize=")
+ TARGET_LINK_LIBRARIES(mysys pthread)
+ ENDIF()
+
++IF(HAVE_PTHREAD_H)
++ ADD_DEFINITIONS(-DUSING_PTHREADS)
++ TARGET_LINK_LIBRARIES(mysys pthread)
++ENDIF()
++
+ IF(WITH_UNIT_TESTS)
+
+ ADD_EXECUTABLE(thr_lock thr_lock.c)
+diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c
+index 1111111..2222222 100644
+--- a/mysys/my_winthread.c
++++ b/mysys/my_winthread.c
+@@ -16,7 +16,7 @@
+ /*****************************************************************************
+ ** Simulation of posix threads calls for Windows
+ *****************************************************************************/
+-#if defined (_WIN32)
++#if defined (_WIN32) && !defined (USING_PTHREADS)
+ #include "mysys_priv.h"
+ #include <process.h>
+ #include <signal.h>
diff --git a/src/postgresql.mk b/src/postgresql.mk
index b702607..1817126 100644
--- a/src/postgresql.mk
+++ b/src/postgresql.mk
@@ -8,7 +8,7 @@ $(PKG)_CHECKSUM := d97dd918a88a4449225998f46aafa85216a3f89163a3411830d6890507ffa
$(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)
-$(PKG)_DEPS := gcc openssl zlib
+$(PKG)_DEPS := gcc openssl pthreads zlib
define $(PKG)_UPDATE
$(WGET) -q -O- 'http://git.postgresql.org/gitweb?p=postgresql.git;a=tags' | \
@@ -23,6 +23,7 @@ define $(PKG)_BUILD
cd '$(1)' && autoconf
cp -Rp '$(1)' '$(1).native'
# Since we build only client libary, use bogus tzdata to satisfy configure.
+ # pthreads is needed in both LIBS and PTHREAD_LIBS
cd '$(1)' && ./configure \
$(MXE_CONFIGURE_OPTS) \
--disable-rpath \
@@ -41,9 +42,15 @@ define $(PKG)_BUILD
--without-libxslt \
--with-zlib \
--with-system-tzdata=/dev/null \
- LIBS="-lsecur32 `'$(TARGET)-pkg-config' openssl --libs`" \
+ LIBS="-lsecur32 `'$(TARGET)-pkg-config' openssl pthreads --libs`" \
ac_cv_func_getaddrinfo=no
- $(MAKE) -C '$(1)'/src/interfaces/libpq -j '$(JOBS)' install
+
+ # 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)' \
+ install \
+ enable_thread_safety=no \
+ PTHREAD_LIBS="`'$(TARGET)-pkg-config' pthreads --libs`"
$(MAKE) -C '$(1)'/src/port -j '$(JOBS)'
$(MAKE) -C '$(1)'/src/bin/psql -j '$(JOBS)' install
$(INSTALL) -m644 '$(1)/src/include/pg_config.h' '$(PREFIX)/$(TARGET)/include/'
diff --git a/src/qt.mk b/src/qt.mk
index 2e4c8d0..d25b65e 100644
--- a/src/qt.mk
+++ b/src/qt.mk
@@ -22,7 +22,7 @@ define $(PKG)_BUILD
cd '$(1)' && QTDIR='$(1)' ./bin/syncqt
cd '$(1)' && \
OPENSSL_LIBS="`'$(TARGET)-pkg-config' --libs-only-l openssl`" \
- PSQL_LIBS="-lpq -lsecur32 `'$(TARGET)-pkg-config' --libs-only-l openssl` -lws2_32" \
+ PSQL_LIBS="-lpq -lsecur32 `'$(TARGET)-pkg-config' --libs-only-l openssl pthreads` -lws2_32" \
SYBASE_LIBS="-lsybdb `'$(TARGET)-pkg-config' --libs-only-l gnutls` -liconv -lws2_32" \
CXXFLAGS="-std=gnu++98" \
./configure \
diff --git a/src/qtbase.mk b/src/qtbase.mk
index 0904373..b54549d 100644
--- a/src/qtbase.mk
+++ b/src/qtbase.mk
@@ -22,7 +22,7 @@ define $(PKG)_BUILD
# ICU is buggy. See #653. TODO: reenable it some time in the future.
cd '$(1)' && \
OPENSSL_LIBS="`'$(TARGET)-pkg-config' --libs-only-l openssl`" \
- PSQL_LIBS="-lpq -lsecur32 `'$(TARGET)-pkg-config' --libs-only-l openssl` -lws2_32" \
+ PSQL_LIBS="-lpq -lsecur32 `'$(TARGET)-pkg-config' --libs-only-l openssl pthreads` -lws2_32" \
SYBASE_LIBS="-lsybdb `'$(TARGET)-pkg-config' --libs-only-l gnutls` -liconv -lws2_32" \
./configure \
-opensource \