Skip to contentSkip to conversation

package/mosquitto: add option for websockets

Buildroot Romain Naour via buildroot 1 participant 1 message Mar 13

lore
Share & tools
lore
#0 lore raw

commit: https://gitlab.com/buildroot.org/buildroot/-/commit/c5ed4f52235293b9b6bc26d435e5484e461cbb6d
branch: https://gitlab.com/buildroot.org/buildroot/-/tree/master

Mosquitto 2.1.x adds the possibility to use a builtin websocket implementation, as an alternative to using libwebsockets.

When using libwebsockets as the implementation, only the broker supports websockets, and CLI tools do not; only when using the builtin one are websockets usable with CLI tools (and the broker, of course).

Add a choice to select what type of websockets support to enable, if any. Since the builtin implementation is still new, we keep the libwebsockets one available.

Since this inverts the dependency logic to libwebsockets, we can't provide a backward compatibility with existing (def)config files.

Cc Peter Korsgaard <[email protected]>
Cc Titouan Christophe <[email protected]>
---
 package/mosquitto/Config.in    | 25 ++++++++++++++++++++++++-
 package/mosquitto/mosquitto.mk |  4 +++-
 2 files changed, 27 insertions(+), 2 deletions(-)
package/mosquitto/Config.in +24 -1
index 754c07be78..789e30f97f 100644
@@ -24,6 +24,30 @@ config BR2_PACKAGE_MOSQUITTO
 
 if BR2_PACKAGE_MOSQUITTO
 
+choice
+	prompt "Websockets support"
+	help
+	  Choose what websocket implementation to use. Note that
+	  the mosquitto_{sub,pub,rr} clients (above) only support
+	  websockets with the builtin implementation, while the
+	  broker supports websockets with either libwebsockets
+	  or the builtin implementation.
+
+config BR2_PACKAGE_MOSQUITTO_WS_NONE
+	bool "none"
+
+config BR2_PACKAGE_MOSQUITTO_WS_LIBWS
+	bool "with libwebsockets"
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_LIBWEBSOCKETS
+	select BR2_PACKAGE_LIBWEBSOCKETS_EXT_POLL
+
+config BR2_PACKAGE_MOSQUITTO_WS_BUILTIN
+	bool "with builtin implementation"
+	select BR2_PACKAGE_OPENSSL
+
+endchoice
+
 config BR2_PACKAGE_MOSQUITTO_CLIENTS
 	bool "install clients"
 	default y  # Backward compatibility
@@ -52,7 +76,6 @@ config BR2_PACKAGE_MOSQUITTO_APPS
 config BR2_PACKAGE_MOSQUITTO_BROKER
 	bool "install the mosquitto broker"
 	default y
-	select BR2_PACKAGE_LIBWEBSOCKETS_EXT_POLL if BR2_PACKAGE_LIBWEBSOCKETS
 	help
 	  Build and install the mosquitto broker onto target.
 
package/mosquitto/mosquitto.mk +3 -1
index a1848f96b3..9b3bcc1cf5 100644
@@ -41,9 +41,11 @@ MOSQUITTO_CONF_OPTS += \
 	-DWITH_TLS=ON \
 	-DWITH_TLS_PSK=ON
 
-ifeq ($(BR2_PACKAGE_LIBWEBSOCKETS),y)
+ifeq ($(BR2_PACKAGE_MOSQUITTO_WS_LIBWS),y)
 MOSQUITTO_DEPENDENCIES += libwebsockets
 MOSQUITTO_CONF_OPTS += -DWITH_WEBSOCKETS=ON -DWITH_WEBSOCKETS_BUILTIN=OFF
+else ifeq ($(BR2_PACKAGE_MOSQUITTO_WS_BUILTIN),y)
+MOSQUITTO_CONF_OPTS += -DWITH_WEBSOCKETS=ON -DWITH_WEBSOCKETS_BUILTIN=ON
 else
 MOSQUITTO_CONF_OPTS += -DWITH_WEBSOCKETS=OFF -DWITH_WEBSOCKETS_BUILTIN=OFF
 endif

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot