<pre style='margin:0'>
Herby Gillot (herbygillot) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/b4ae84e6b83b9f52ed3884823eea7cf3809c2089">https://github.com/macports/macports-ports/commit/b4ae84e6b83b9f52ed3884823eea7cf3809c2089</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit b4ae84e6b83b9f52ed3884823eea7cf3809c2089
</span>Author: Sergey Fedorov <barracuda@macos-powerpc.org>
AuthorDate: Tue Sep 17 16:15:35 2024 +0800
<span style='display:block; white-space:pre;color:#404040;'> paho.mqtt.c: fix build on old macOS
</span>---
net/paho.mqtt.c/Portfile | 15 ++++
.../0001-Thread-fix-dispatch-usage-on-macOS.patch | 95 ++++++++++++++++++++++
.../0002-Thread.c-fix-Availability-macros.patch | 31 +++++++
3 files changed, 141 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/paho.mqtt.c/Portfile b/net/paho.mqtt.c/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 2e804ec405c..a35aa6a9ae0 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/net/paho.mqtt.c/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/paho.mqtt.c/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -24,6 +24,10 @@ long_description MQTT and MQTT-SN are lightweight publish/subscribe \
</span> # clock_gettime
legacysupport.newest_darwin_requires_legacy 15
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# https://github.com/eclipse/paho.mqtt.c/pull/1523
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles-append 0001-Thread-fix-dispatch-usage-on-macOS.patch \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 0002-Thread.c-fix-Availability-macros.patch
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # We enable SSL so that the paho.mqtt.cpp library builds without issues
configure.args-append \
-DPAHO_BUILD_SHARED=ON \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -39,5 +43,16 @@ configure.pre_args-replace \
</span> -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF
<span style='display:block; white-space:pre;background:#e0ffe0;'>+if {${os.platform} eq "darwin" && ${configure.build_arch} in [list ppc ppc64]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ variant legacy_dispatch description "Use dispatch via libdispatch-legacy port" {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ depends_lib-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ port:libdispatch-legacy
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.cppflags-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ -DHAS_DISPATCH -I${prefix}/libexec/dispatch/usr/include
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ configure.ldflags-append \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${prefix}/libexec/dispatch/usr/lib/libdispatch.a
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> # FIXME: https://github.com/eclipse/paho.mqtt.c/issues/1524
test.run yes
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/paho.mqtt.c/files/0001-Thread-fix-dispatch-usage-on-macOS.patch b/net/paho.mqtt.c/files/0001-Thread-fix-dispatch-usage-on-macOS.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..5c53cf3b8bd
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/paho.mqtt.c/files/0001-Thread-fix-dispatch-usage-on-macOS.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,95 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 7b3a2053406906585ac7ec4aec38f31b5102826c Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From: Sergey Fedorov <barracuda@macos-powerpc.org>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Tue, 17 Sep 2024 14:07:48 +0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 1/2] Thread: fix dispatch usage on macOS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/Thread.c | 12 ++++++------
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/Thread.h | 9 ++++++++-
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 2 files changed, 14 insertions(+), 7 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git src/Thread.c src/Thread.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index f4d43fb..e2964b2 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/Thread.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/Thread.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -234,7 +234,7 @@ sem_type Thread_create_sem(int *rc)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ NULL /* object name */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ );
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *rc = (sem == NULL) ? GetLastError() : 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- #elif defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #elif defined(OSX) && defined(HAS_DISPATCH)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem = dispatch_semaphore_create(0L);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *rc = (sem == NULL) ? -1 : 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -259,7 +259,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * so I've used trywait in a loop instead. Ian Craggs 23/7/2010
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int rc = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#if !defined(_WIN32) && !defined(_WIN64) && !defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if !defined(_WIN32) && !defined(_WIN64) && !(defined(OSX) && defined(HAS_DISPATCH))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define USE_TRYWAIT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(USE_TRYWAIT)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int i = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -276,7 +276,7 @@ int Thread_wait_sem(sem_type sem, int timeout)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = WaitForSingleObject(sem, timeout < 0 ? 0 : timeout);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (rc == WAIT_TIMEOUT)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = ETIMEDOUT;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- #elif defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #elif defined(OSX) && defined(HAS_DISPATCH)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* returns 0 on success, non-zero if timeout occurred */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = (int)dispatch_semaphore_wait(sem, dispatch_time(DISPATCH_TIME_NOW, (int64_t)timeout*1000000L));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (rc != 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -320,7 +320,7 @@ int Thread_check_sem(sem_type sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32) || defined(_WIN64)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* if the return value is not 0, the semaphore will not have been decremented */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return WaitForSingleObject(sem, 0) == WAIT_OBJECT_0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#elif defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elif defined(OSX) && defined(HAS_DISPATCH)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* if the return value is not 0, the semaphore will not have been decremented */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return dispatch_semaphore_wait(sem, DISPATCH_TIME_NOW) == 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -344,7 +344,7 @@ int Thread_post_sem(sem_type sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32) || defined(_WIN64)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (SetEvent(sem) == 0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = GetLastError();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- #elif defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #elif defined(OSX) && defined(HAS_DISPATCH)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = (int)dispatch_semaphore_signal(sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int val;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -371,7 +371,7 @@ int Thread_destroy_sem(sem_type sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ FUNC_ENTRY;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #if defined(_WIN32) || defined(_WIN64)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = CloseHandle(sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- #elif defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #elif defined(OSX) && defined(HAS_DISPATCH)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ dispatch_release(sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = sem_destroy(sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git src/Thread.h src/Thread.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index b0c823b..721b027 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/Thread.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/Thread.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -29,6 +29,13 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#ifdef __APPLE__
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #include <AvailabilityMacros.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 && !defined(__ppc__)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #define HAS_DISPATCH
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include "MQTTExportDeclarations.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include "MQTTClient.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -54,7 +61,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typedef thread_return_type (*thread_fn)(void*);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typedef struct { pthread_cond_t cond; pthread_mutex_t mutex; } cond_type_struct;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typedef cond_type_struct *cond_type;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- #if defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ #if defined(OSX) && defined(HAS_DISPATCH)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <dispatch/dispatch.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typedef dispatch_semaphore_t sem_type;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/paho.mqtt.c/files/0002-Thread.c-fix-Availability-macros.patch b/net/paho.mqtt.c/files/0002-Thread.c-fix-Availability-macros.patch
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..3f936d7abe1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/paho.mqtt.c/files/0002-Thread.c-fix-Availability-macros.patch
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,31 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From 757c95535526e770ca51a2fa3dbc35b39868a3b9 Mon Sep 17 00:00:00 2001
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+From: Sergey Fedorov <barracuda@macos-powerpc.org>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Date: Tue, 17 Sep 2024 14:25:31 +0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+Subject: [PATCH 2/2] Thread.c: fix Availability macros
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+---
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ src/Thread.c | 4 ++--
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ 1 file changed, 2 insertions(+), 2 deletions(-)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git src/Thread.c src/Thread.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index e2964b2..83ef267 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/Thread.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/Thread.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -98,7 +98,7 @@ int Thread_set_name(const char* thread_name)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif*/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #elif defined(OSX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* pthread_setname_np __API_AVAILABLE(macos(10.6), ios(3.2)) */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ rc = pthread_setname_np(thread_name);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -449,7 +449,7 @@ int Thread_wait_cond(cond_type condvar, int timeout_ms)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ interval.tv_sec = timeout_ms / 1000;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ interval.tv_nsec = (timeout_ms % 1000) * 1000000L;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200 /* for older versions of MacOS */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED < 101200 /* for older versions of MacOS */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct timeval cur_time;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gettimeofday(&cur_time, NULL);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cond_timeout.tv_sec = cur_time.tv_sec;
</span></pre><pre style='margin:0'>
</pre>