Index: client/client_shared.h --- client/client_shared.h.orig 2021-11-17 01:28:35.000000000 +0100 +++ client/client_shared.h 2021-11-23 23:16:21.223641000 +0100 @@ -20,6 +20,7 @@ #define CLIENT_CONFIG_H #include +#include #ifdef WIN32 # include Index: config.mk --- config.mk.orig 2021-11-23 23:16:21.223833000 +0100 +++ config.mk 2021-11-23 23:17:56.609790000 +0100 @@ -330,15 +330,15 @@ ifeq ($(WITH_WEBSOCKETS),yes) BROKER_CPPFLAGS:=$(BROKER_CPPFLAGS) -DWITH_WEBSOCKETS - BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets + BROKER_LDADD:=$(BROKER_LDADD) -lwebsockets -lssl -lcrypto -lz endif INSTALL?=install -prefix?=/usr/local +prefix?=${PREFIX} incdir?=${prefix}/include -libdir?=${prefix}/lib${LIB_SUFFIX} -localedir?=${prefix}/share/locale -mandir?=${prefix}/share/man +libdir?=${prefix}/lib +localedir?=${PREFIX}/share/locale +mandir?=${PREFIX}/man STRIP?=strip ifeq ($(WITH_STRIP),yes) Index: lib/CMakeLists.txt --- lib/CMakeLists.txt.orig 2021-11-17 01:28:35.000000000 +0100 +++ lib/CMakeLists.txt 2021-11-23 23:18:21.191755000 +0100 @@ -83,24 +83,6 @@ endif (ARES_HEADER) endif (WITH_SRV) -add_library(libmosquitto SHARED ${C_SRC}) -set_target_properties(libmosquitto PROPERTIES - POSITION_INDEPENDENT_CODE 1 -) - -target_link_libraries(libmosquitto ${LIBRARIES}) - -set_target_properties(libmosquitto PROPERTIES - OUTPUT_NAME mosquitto - VERSION ${VERSION} - SOVERSION 1 -) - -install(TARGETS libmosquitto - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") - if (WITH_STATIC_LIBRARIES) add_library(libmosquitto_static STATIC ${C_SRC}) if (WITH_PIC) Index: lib/cpp/CMakeLists.txt --- lib/cpp/CMakeLists.txt.orig 2021-11-17 01:28:35.000000000 +0100 +++ lib/cpp/CMakeLists.txt 2021-11-23 23:18:44.425923000 +0100 @@ -5,20 +5,6 @@ set(CPP_SRC mosquittopp.cpp mosquittopp.h) -add_library(mosquittopp SHARED ${CPP_SRC}) -set_target_properties(mosquittopp PROPERTIES - POSITION_INDEPENDENT_CODE 1 -) -target_link_libraries(mosquittopp libmosquitto) -set_target_properties(mosquittopp PROPERTIES - VERSION ${VERSION} - SOVERSION 1 -) -install(TARGETS mosquittopp - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") - if (WITH_STATIC_LIBRARIES) add_library(mosquittopp_static STATIC ${C_SRC} Index: lib/mosquitto.c --- lib/mosquitto.c.orig 2021-11-17 01:28:35.000000000 +0100 +++ lib/mosquitto.c 2021-11-23 23:17:06.730438000 +0100 @@ -18,6 +18,10 @@ #include "config.h" +#if defined(__FreeBSD__) +#define __XSI_VISIBLE 1 +#endif + #include #include #include Index: lib/tls_mosq.c --- lib/tls_mosq.c.orig 2021-11-17 01:28:35.000000000 +0100 +++ lib/tls_mosq.c 2021-11-23 23:17:06.730555000 +0100 @@ -26,6 +26,7 @@ #else # include # include +# include # include #endif Index: lib/tls_mosq.h --- lib/tls_mosq.h.orig 2021-11-17 01:28:35.000000000 +0100 +++ lib/tls_mosq.h 2021-11-23 23:17:06.730654000 +0100 @@ -29,6 +29,7 @@ #include #include +#include int mosquitto__server_certificate_verify(int preverify_ok, X509_STORE_CTX *ctx); int mosquitto__verify_certificate_hostname(X509 *cert, const char *hostname); Index: src/CMakeLists.txt --- src/CMakeLists.txt.orig 2021-11-17 01:28:35.000000000 +0100 +++ src/CMakeLists.txt 2021-11-23 23:17:06.730783000 +0100 @@ -180,7 +180,11 @@ elseif(QNX) set(MOSQ_LIBS ${MOSQ_LIBS} m socket) else(APPLE) - set (MOSQ_LIBS ${MOSQ_LIBS} dl m) + set (MOSQ_LIBS ${MOSQ_LIBS} m) + find_library(LIBDL dl) + if (LIBDL) + set (MOSQ_LIBS ${MOSQ_LIBS} dl) + endif (LIBDL) find_library(LIBRT rt) if (LIBRT) set (MOSQ_LIBS ${MOSQ_LIBS} rt) @@ -194,13 +198,13 @@ if (WITH_WEBSOCKETS) if (STATIC_WEBSOCKETS) - set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static) + set (MOSQ_LIBS ${MOSQ_LIBS} websockets_static ssl crypto z) if (WIN32) set (MOSQ_LIBS ${MOSQ_LIBS} iphlpapi) link_directories(${mosquitto_SOURCE_DIR}) endif (WIN32) else (STATIC_WEBSOCKETS) - set (MOSQ_LIBS ${MOSQ_LIBS} websockets) + set (MOSQ_LIBS ${MOSQ_LIBS} websockets ssl crypto z) endif (STATIC_WEBSOCKETS) endif (WITH_WEBSOCKETS) Index: src/conf.c --- src/conf.c.orig 2021-11-17 01:28:35.000000000 +0100 +++ src/conf.c 2021-11-23 23:17:06.731093000 +0100 @@ -1327,7 +1327,7 @@ }else if(!strcmp(token, "include_dir")){ if(level == 0){ /* Only process include_dir from the main config file. */ - token = strtok_r(NULL, "", &saveptr); + token = strtok_r(NULL, " ", &saveptr); if(!token){ log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty include_dir value in configuration."); return 1; Index: src/mosquitto.c --- src/mosquitto.c.orig 2021-11-17 01:28:35.000000000 +0100 +++ src/mosquitto.c 2021-11-23 23:17:06.731239000 +0100 @@ -18,6 +18,11 @@ #include "config.h" +#if defined(__FreeBSD__) +#define __XSI_VISIBLE 1 +#define __BSD_VISIBLE 1 +#endif + #ifndef WIN32 /* For initgroups() */ # include @@ -34,6 +39,7 @@ #endif #ifndef WIN32 +# include # include #endif @@ -41,6 +47,8 @@ #include #include #include +#include +#include #ifdef WITH_SYSTEMD # include #endif Index: src/mosquitto_broker_internal.h --- src/mosquitto_broker_internal.h.orig 2021-11-17 01:28:35.000000000 +0100 +++ src/mosquitto_broker_internal.h 2021-11-23 23:17:06.731403000 +0100 @@ -22,10 +22,12 @@ #include "config.h" #include +#include +#include #ifdef WITH_WEBSOCKETS # include -# if LWS_LIBRARY_VERSION_NUMBER >= 3002000 && !defined(LWS_WITH_EXTERNAL_POLL) +# if LWS_LIBRARY_VERSION_NUMBER >= 3002000 && !defined(LWS_WITH_EXTERNAL_POLL) && !defined(__FreeBSD__) # warning "libwebsockets is not compiled with LWS_WITH_EXTERNAL_POLL support. Websocket performance will be unusable." # endif #endif Index: src/signals.c --- src/signals.c.orig 2021-11-17 01:28:35.000000000 +0100 +++ src/signals.c 2021-11-23 23:17:06.731507000 +0100 @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "mosquitto_broker_internal.h" Index: src/websockets.c --- src/websockets.c.orig 2021-11-17 01:28:35.000000000 +0100 +++ src/websockets.c 2021-11-23 23:17:06.731642000 +0100 @@ -20,6 +20,8 @@ #include "config.h" +#include +#include #include #include "mosquitto_internal.h" #include "mosquitto_broker_internal.h"