Files
buildroot/package/mosquitto/0011-cmake-Only-include-C-support-when-required.patch
Yann E. MORIN 583a02e398 package/mosquitto: bump to version 2.1.2
Version 2.1.x has introduced a cmake-based build, and upstream strongly
recomends using it over the legacy Makefiles, which will ultimately be
retired.

So we do the switch, which cause quite some noise in the .mk file, but
at the same time allows for a bit of cleanup in the build process, as we
can now use the cmake-package infra.

Mosquitto now wants to peek into the malloc() internals for memory
tracking, and that only works on systems with an MMU (uClibc-ng does not
expose it for noMMU builds, as it's part of its malloc-standard
implementation).

Static-only builds are broken, even when only building the library. This
seems beyond a simple repair, so just require shared libs now (since
we're requiring an MMU as well, requiring shared libs is not too much of
an additional burden).

cJSON is now a required dependency, used in common parts of the code
(not just for the plugins).

There are a few options that we forcibly disable; they'll get addressed
in followup patches.

There are still a few build failures that are difficult to account for
(except):

    $ printf 'BR2_PACKAGE_MOSQUITTO=y\n' >mosq.cfg
    $ ./utils/docker-run ./utils/test-pkg -d $(pwd)/run-tests -c mosq.cfg -p mosquitto
    br-arm-full-static [5/6]: FAILED
    => old uClibc-ng, would need __GNU_SOURCE (with dunder) to define
       getrandom(); no longer needed since uClibc-ng 1.0.50; would need
       openssl otherwise

    bootlin-aarch64-glibc-old [6/6]: FAILED
    => really old glibc, missing getrandom(); would need openssl

Drop our existing patches, they've either been applied upstream, or are
no longer needed. Add new patches to fix various build issues
(submission upstream pending the signature of the CLA..,).

Thanks a lot to Titouan for providing his initial work on the update!
Some of his findings ended up in this patch. 👍

Note: by lack of a trusted path back to the PGP key that signed the
archive, the comment was dropped, as checking a signature without a
trust-chain does not make much sense...

Co-developped-by: Titouan Christophe <titouan.christophe@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Titouan Christophe <titouan.christophe@mind.be>
[Romain: remove "mosquitto broker" comment for static builds]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
2026-03-13 21:05:12 +01:00

57 lines
1.6 KiB
Diff

From 8db331b93053debfb2c0e42982847eeacd571aee Mon Sep 17 00:00:00 2001
From: "Roger A. Light" <roger@atchoo.org>
Date: Tue, 24 Feb 2026 10:26:50 +0000
Subject: [PATCH] cmake: Only include C++ support when required
Thanks to Yann Morin
Upstream: https://github.com/eclipse-mosquitto/mosquitto/commit/ae19460c132ec7b2b62c0703e1fafd3a0a3527aa)
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
---
CMakeLists.txt | 8 +++++++-
lib/CMakeLists.txt | 1 -
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6c68bb9c..b3e28300 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ set (VERSION 2.1.2)
project(mosquitto
VERSION ${VERSION}
DESCRIPTION "Eclipse Mosquitto"
- LANGUAGES C CXX
+ LANGUAGES C
)
set(CMAKE_C_STANDARD 99)
@@ -46,10 +46,16 @@ include(CMakePushCheckState)
include(CheckSourceCompiles)
option(WITH_BUNDLED_DEPS "Build with bundled dependencies?" ON)
+option(WITH_LIB_CPP "Build C++ library?" ON)
option(WITH_TLS "Include SSL/TLS support?" ON)
option(WITH_TLS_PSK "Include TLS-PSK support (requires WITH_TLS)?" ON)
option(WITH_TESTS "Enable tests" ON)
option(INC_MEMTRACK "Include memory tracking support?" ON)
+
+if (WITH_LIB_CPP OR WITH_TESTS)
+ ENABLE_LANGUAGE(CXX)
+endif()
+
if (WITH_TLS)
find_package(OpenSSL REQUIRED)
add_definitions("-DWITH_TLS")
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 4585a51a..d8bb3d8b 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -1,4 +1,3 @@
-option(WITH_LIB_CPP "Build C++ library?" ON)
if(WITH_LIB_CPP)
add_subdirectory(cpp)
endif()
--
2.34.1