[moved to ports@ and cc'ing mosquitto maintainer] In gmane.os.openbsd.misc, Jeff Ross wrote: > Greetings, > > I've been trying to build mosquitto with websockets enabled on 6.8 > release. The web says that all I should have to do is edit config.mk > and change WITH_WEBSOCKETS:=no to WITH_WEBSOCKETS:=yes. > I also added libwebsockets from ports. > > I built a patch to do that and then built the port with that patch. > > test68# cd /usr/ports/net/mosquitto/patches/ > test68# cat patch-config_mk > --- config.mk.orig Wed Nov 25 09:33:17 2020 > +++ config.mk Wed Nov 25 09:33:34 2020 > @@ -65,7 +65,7 @@ > WITH_SRV:=no > > # Build with websockets support on the broker. > -WITH_WEBSOCKETS:=no > +WITH_WEBSOCKETS:=yes > > # Use elliptic keys in broker > WITH_EC:=yes > > However, I still get the following: > > test68# /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf > 1606323544: Error: Websockets support not available. > 1606323544: Error found at /etc/mosquitto/mosquitto.conf:241. > > ktracing the command above I don't even see a place where it actually > looks to see if websockets are enabled. > > I'm hoping someone has gone down this path before and can share the > secret sauce to enable websockets. > > Alternatively, a suggestion for a different implementation of MQTT with > websockets would be fine. > > Thanks, > > Jeff Ross > >
config.mk is for the autoconf-based build system, the mosquitto port uses the CMake one instead so you need to set configure flags. This works for me - Jasper, what do you think about adding to the port? (either directly like this or as a flavour)? Index: Makefile =================================================================== RCS file: /cvs/ports/net/mosquitto/Makefile,v retrieving revision 1.33 diff -u -p -r1.33 Makefile --- Makefile 22 Aug 2020 13:55:07 -0000 1.33 +++ Makefile 25 Nov 2020 21:42:00 -0000 @@ -3,6 +3,7 @@ COMMENT = opensource MQTT broker DISTNAME = mosquitto-1.6.12 +REVISION = 0 SHARED_LIBS += mosquitto 1.0 # 1.5 SHARED_LIBS += mosquittopp 1.0 # 1.5 @@ -15,7 +16,7 @@ MAINTAINER = Jasper Lievisse Adriaanse # EPL/EDL PERMIT_PACKAGE = Yes -WANTLIB += c crypto m pthread ssl ${COMPILER_LIBCXX} +WANTLIB += c crypto m pthread ssl websockets ${COMPILER_LIBCXX} MASTER_SITES = https://mosquitto.org/files/source/ @@ -29,12 +30,15 @@ MODPY_RUNDEP= No MODPY_VERSION= ${MODPY_DEFAULT_VERSION_3} BUILD_DEPENDS = devel/uthash +LIB_DEPENDS = www/libwebsockets DEBUG_PACKAGES = ${BUILD_PACKAGES} -CONFIGURE_ARGS= -DWITH_SRV=no +CONFIGURE_ARGS= -DWITH_SRV=no \ + -DWITH_WEBSOCKETS=yes # Pre-shared key support was intentionally removed from libressl CONFIGURE_ARGS += -DWITH_TLS_PSK=no +CONFIGURE_ENV += LDFLAGS="-L${LOCALBASE}/lib" CFLAGS += -I${LOCALBASE}/include