diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index 9930e302b..796e2d4d9 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -461,9 +461,8 @@ build_external(sodium) add_static_target(sodium sodium_external libsodium.a) -if(ZMQ_VERSION VERSION_LESS 4.3.3 AND CMAKE_CROSSCOMPILING AND ARCH_TRIPLET MATCHES mingw) - set(zmq_patch PATCH_COMMAND patch -p1 -i ${PROJECT_SOURCE_DIR}/utils/build_scripts/libzmq-pr3601-mingw-build-fix.patch - COMMAND patch -p1 -i ${PROJECT_SOURCE_DIR}/utils/build_scripts/libzmq-pr3613-fix-funcptr-call.patch) +if(ZMQ_VERSION VERSION_LESS 4.3.4 AND CMAKE_CROSSCOMPILING AND ARCH_TRIPLET MATCHES mingw) + set(zmq_patch PATCH_COMMAND patch -p1 -i ${PROJECT_SOURCE_DIR}/utils/build_scripts/libzmq-mingw-closesocket.patch) endif() build_external(zmq DEPENDS sodium_external diff --git a/utils/build_scripts/libzmq-mingw-closesocket.patch b/utils/build_scripts/libzmq-mingw-closesocket.patch new file mode 100644 index 000000000..1971d6bc9 --- /dev/null +++ b/utils/build_scripts/libzmq-mingw-closesocket.patch @@ -0,0 +1,12 @@ +diff --git a/tests/testutil.hpp b/tests/testutil.hpp +index c6f5e4de..6a1c8bb8 100644 +--- a/tests/testutil.hpp ++++ b/tests/testutil.hpp +@@ -102,7 +102,6 @@ const uint8_t zmtp_ready_sub[27] = { + #include + #include + #include +-#define close closesocket + typedef int socket_size_t; + inline const char *as_setsockopt_opt_t (const void *opt) + { diff --git a/utils/build_scripts/libzmq-pr3601-mingw-build-fix.patch b/utils/build_scripts/libzmq-pr3601-mingw-build-fix.patch deleted file mode 100644 index 0693ed92d..000000000 --- a/utils/build_scripts/libzmq-pr3601-mingw-build-fix.patch +++ /dev/null @@ -1,69 +0,0 @@ -diff --git a/src/thread.cpp b/src/thread.cpp -index b14d70757..3675899be 100644 ---- a/src/thread.cpp -+++ b/src/thread.cpp -@@ -32,6 +32,10 @@ - #include "thread.hpp" - #include "err.hpp" - -+#ifdef ZMQ_HAVE_WINDOWS -+#include -+#endif -+ - bool zmq::thread_t::get_started () const - { - return _started; -@@ -113,10 +117,22 @@ struct thread_info_t - #pragma pack(pop) - } - -+typedef struct _MY_EXCEPTION_REGISTRATION_RECORD -+{ -+ struct _MY_EXCEPTION_REGISTRATION_RECORD *Next; -+ void *Handler; -+} MY_EXCEPTION_REGISTRATION_RECORD; -+ -+static EXCEPTION_DISPOSITION NTAPI continue_execution (EXCEPTION_RECORD *rec, -+ void *frame, CONTEXT *ctx, void *disp) -+{ -+ return ExceptionContinueExecution; -+} -+ - void zmq::thread_t:: - applyThreadName () // to be called in secondary thread context - { -- if (!_name[0]) -+ if (!_name[0] || !IsDebuggerPresent()) - return; - - thread_info_t thread_info; -@@ -125,17 +141,19 @@ void zmq::thread_t:: - thread_info._thread_id = -1; - thread_info._flags = 0; - --#pragma warning(push) --#pragma warning(disable : 6320 6322) -- __try { -- DWORD MS_VC_EXCEPTION = 0x406D1388; -+ NT_TIB *tib = ((NT_TIB*)NtCurrentTeb()); -+ -+ MY_EXCEPTION_REGISTRATION_RECORD rec; -+ rec.Next = (MY_EXCEPTION_REGISTRATION_RECORD *)tib->ExceptionList; -+ rec.Handler = continue_execution; -+ -+ // push our handler, raise, and finally pop our handler -+ tib->ExceptionList = (_EXCEPTION_REGISTRATION_RECORD *)&rec; -+ DWORD MS_VC_EXCEPTION = 0x406D1388; - RaiseException (MS_VC_EXCEPTION, 0, -- sizeof (thread_info) / sizeof (ULONG_PTR), -- (ULONG_PTR *) &thread_info); -- } -- __except (EXCEPTION_CONTINUE_EXECUTION) { -- } --#pragma warning(pop) -+ sizeof (thread_info) / sizeof (ULONG_PTR), -+ (ULONG_PTR *) &thread_info); -+ tib->ExceptionList = (_EXCEPTION_REGISTRATION_RECORD *)(((MY_EXCEPTION_REGISTRATION_RECORD *)tib->ExceptionList)->Next); - } - - #elif defined ZMQ_HAVE_VXWORKS diff --git a/utils/build_scripts/libzmq-pr3613-fix-funcptr-call.patch b/utils/build_scripts/libzmq-pr3613-fix-funcptr-call.patch deleted file mode 100644 index a17252823..000000000 --- a/utils/build_scripts/libzmq-pr3613-fix-funcptr-call.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/RELICENSE/tomzbench.md b/RELICENSE/tomzbench.md -new file mode 100644 -index 000000000..1cbcc4fdb ---- /dev/null -+++ b/RELICENSE/tomzbench.md -@@ -0,0 +1,14 @@ -+# Permission to Relicense under MPLv2 -+ -+This is a statement by Thomas Chiantia -+that grants permission to relicense its copyrights in the libzmq C++ -+library (ZeroMQ) under the Mozilla Public License v2 (MPLv2). -+ -+A portion of the commits made by the Github handle "tomzbench", with -+commit author "Thomas", are copyright of -+Thomas Chiantia. -+This document hereby grants the libzmq project team to relicense libzmq, -+including all past, present and future contributions of the author listed above. -+ -+Thomas Chiantia -+2019/08/10 -diff --git a/src/thread.cpp b/src/thread.cpp -index 2cad2adaa..6f07e9cee 100644 ---- a/src/thread.cpp -+++ b/src/thread.cpp -@@ -117,11 +117,14 @@ struct thread_info_t - #pragma pack(pop) - } - --typedef struct _MY_EXCEPTION_REGISTRATION_RECORD -+struct MY_EXCEPTION_REGISTRATION_RECORD - { -- struct _MY_EXCEPTION_REGISTRATION_RECORD *Next; -- void *Handler; --} MY_EXCEPTION_REGISTRATION_RECORD; -+ typedef EXCEPTION_DISPOSITION (NTAPI *HandlerFunctionType) ( -+ EXCEPTION_RECORD *, void *, CONTEXT *, void *); -+ -+ MY_EXCEPTION_REGISTRATION_RECORD *Next; -+ HandlerFunctionType Handler; -+}; - - static EXCEPTION_DISPOSITION NTAPI continue_execution (EXCEPTION_RECORD *rec, - void *frame,