This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 6e56388956817368df831e056a45acc0d6e9ae82
Author: raiden00pl <[email protected]>
AuthorDate: Fri Aug 21 10:09:49 2026 +0200

    netutils/paho_mqtt: fix package preparation and utilities
    
    The bundled patch still contains an MQTTPacket.h hunk for a bool
    typedef that no longer exists in Paho 1.3.15. Make and CMake both
    hide the resulting rejection, allowing a partially patched source
    tree to be compiled. Remove the stale hunk and make patch failures
    fatal.
    
    The Make context target also allows VersionInfo.h generation to
    race source extraction under parallel builds. Make the generated
    header depend on the extraction target so the input template is
    present first.
    
    The publisher and subscriber samples live below src/samples but
    include public headers from src. Add the Paho source include directory
    to the Make flags, matching the CMake targets, so CONFIG_UTILS_MQTT5
    builds both utilities.
    
    Finally, define distclean independently of whether the downloaded
    tree exists when Make parses the file. Remove package-owned archives
    and sources while preserving a developer Git checkout, and ignore
    those downloaded paths.
    
    Signed-off-by: raiden00pl <[email protected]>
    Assisted-by: OpenAI Codex:gpt-5
---
 netutils/paho_mqtt/.gitignore         |  2 ++
 netutils/paho_mqtt/CMakeLists.txt     |  4 ++--
 netutils/paho_mqtt/Makefile           | 19 +++++++++++--------
 netutils/paho_mqtt/paho_mqtt_01.patch | 18 +-----------------
 4 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/netutils/paho_mqtt/.gitignore b/netutils/paho_mqtt/.gitignore
new file mode 100644
index 000000000..29487dfe9
--- /dev/null
+++ b/netutils/paho_mqtt/.gitignore
@@ -0,0 +1,2 @@
+/paho_mqtt
+/v*.zip
diff --git a/netutils/paho_mqtt/CMakeLists.txt 
b/netutils/paho_mqtt/CMakeLists.txt
index 0139fb8e8..f76d20de4 100644
--- a/netutils/paho_mqtt/CMakeLists.txt
+++ b/netutils/paho_mqtt/CMakeLists.txt
@@ -81,8 +81,8 @@ if(CONFIG_LIB_MQTT5)
       execute_process(
         COMMAND
           sh -c
-          "patch -p1 --forward --ignore-whitespace < 
${CMAKE_CURRENT_LIST_DIR}/paho_mqtt_01.patch || true"
-        WORKING_DIRECTORY ${PAHO_MQTT_DIR})
+          "patch -p1 --forward --ignore-whitespace < 
${CMAKE_CURRENT_LIST_DIR}/paho_mqtt_01.patch"
+        WORKING_DIRECTORY ${PAHO_MQTT_DIR} COMMAND_ERROR_IS_FATAL ANY)
       message("paho_mqtt_01 patching done")
     endif()
 
diff --git a/netutils/paho_mqtt/Makefile b/netutils/paho_mqtt/Makefile
index 21c9d904f..325a68f85 100644
--- a/netutils/paho_mqtt/Makefile
+++ b/netutils/paho_mqtt/Makefile
@@ -34,6 +34,8 @@ PAHO_MQTT_UNPACK  = paho_mqtt
 
 SRCDIR = $(APPDIR)/netutils/paho_mqtt/$(PAHO_MQTT_UNPACK)/src
 
+CFLAGS += $(INCDIR_PREFIX)$(SRCDIR)
+
 ifeq ($(CONFIG_LIB_MQTT5), y)
 
 # Check if paho_mqtt directory exists, if not download and extract
@@ -49,15 +51,10 @@ $(PAHO_MQTT_UNPACK): $(PAHO_MQTT_ZIP)
        $(Q) rm -f $(PAHO_MQTT_ZIP)
        $(Q) if [ -f paho_mqtt_01.patch ]; then \
                echo "Applying paho_mqtt_01 patch to $(PAHO_MQTT_UNPACK)"; \
-               cd $(PAHO_MQTT_UNPACK) && patch -p1 --forward 
--ignore-whitespace < ../paho_mqtt_01.patch || true; \
+               cd $(PAHO_MQTT_UNPACK) && patch -p1 --forward 
--ignore-whitespace < ../paho_mqtt_01.patch; \
        fi
        $(Q) touch $(PAHO_MQTT_UNPACK)
 
-context:: $(PAHO_MQTT_UNPACK)
-
-distclean::
-       $(call DELFILE, $(PAHO_MQTT_ZIP))
-       $(call DELDIR, $(PAHO_MQTT_UNPACK))
 endif
 
 ifeq ($(CONFIG_OPENSSL_MBEDTLS_WRAPPER), y)
@@ -80,8 +77,8 @@ MQTT5_VERSION = $(SRCDIR)/VersionInfo.h
 
 SED_COMMANDS = $(foreach var,$(VARS),-e 's/@$(var)@/$($(var))/g')
 
-$(MQTT5_VERSION): $(SRCDIR)/VersionInfo.h.in
-       sed $(SED_COMMANDS) $< > $@
+$(MQTT5_VERSION): $(PAHO_MQTT_UNPACK)
+       sed $(SED_COMMANDS) $(SRCDIR)/VersionInfo.h.in > $@
 
 context:: $(MQTT5_VERSION)
 
@@ -108,4 +105,10 @@ endif
 
 endif
 
+ifeq ($(wildcard $(PAHO_MQTT_UNPACK)/.git),)
+distclean::
+       $(call DELFILE, $(wildcard v*.zip))
+       $(call DELDIR, $(PAHO_MQTT_UNPACK))
+endif
+
 include $(APPDIR)/Application.mk
diff --git a/netutils/paho_mqtt/paho_mqtt_01.patch 
b/netutils/paho_mqtt/paho_mqtt_01.patch
index 67a1fccdf..526f69ba4 100644
--- a/netutils/paho_mqtt/paho_mqtt_01.patch
+++ b/netutils/paho_mqtt/paho_mqtt_01.patch
@@ -6,7 +6,6 @@ Subject: [PATCH] paho_mqtt: Fix mqtt compile warning
 Signed-off-by: zhangshuai39 <[email protected]>
 ---
  src/MQTTAsync.c          |  2 +-
- src/MQTTPacket.h         |  2 ++
  src/SHA1.c               |  2 +-
  src/Socket.c             | 16 +++++++++++++++-
  src/Socket.h             |  1 +
@@ -16,7 +15,7 @@ Signed-off-by: zhangshuai39 <[email protected]>
  src/WebSocket.h          |  2 +-
  src/samples/paho_c_pub.c | 29 ++++++++++++++++++-----------
  src/samples/paho_c_sub.c |  4 +++-
- 11 files changed, 45 insertions(+), 18 deletions(-)
+ 10 files changed, 43 insertions(+), 18 deletions(-)
 
 diff --git a/src/MQTTAsync.c b/src/MQTTAsync.c
 index c548ae3..2487d69 100644
@@ -31,20 +30,6 @@ index c548ae3..2487d69 100644
  {
        thread_id_type thread_id = Paho_thread_getid();
        return thread_id == sendThread_id || thread_id == receiveThread_id;
-diff --git a/src/MQTTPacket.h b/src/MQTTPacket.h
-index fd384ae..c833d0c 100644
---- a/src/MQTTPacket.h
-+++ b/src/MQTTPacket.h
-@@ -28,7 +28,9 @@
- #include "LinkedList.h"
- #include "Clients.h"
- 
-+#ifndef bool
- typedef unsigned int bool;
-+#endif
- typedef void* (*pf)(int, unsigned char, char*, size_t);
- 
- #include "MQTTProperties.h"
 diff --git a/src/SHA1.c b/src/SHA1.c
 index a1b2c3d..e4f5g6h 100644
 --- a/src/SHA1.c
@@ -311,4 +296,3 @@ index 85875c9..1fe18ce 100644
        return EXIT_SUCCESS;
 -- 
 2.34.1
-

Reply via email to