Index: client/CMakeLists.txt --- client/CMakeLists.txt.orig 2018-05-03 08:55:54.000000000 +0200 +++ client/CMakeLists.txt 2018-05-05 10:19:10.153913000 +0200 @@ -11,8 +11,8 @@ add_executable(mosquitto_pub pub_client.c ${shared_src}) add_executable(mosquitto_sub sub_client.c sub_client_output.c ${shared_src}) -target_link_libraries(mosquitto_pub libmosquitto) -target_link_libraries(mosquitto_sub libmosquitto) +target_link_libraries(mosquitto_pub libmosquitto_static) +target_link_libraries(mosquitto_sub libmosquitto_static) -install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") -install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") +install(TARGETS mosquitto_pub RUNTIME DESTINATION "${BINDIR}" ARCHIVE DESTINATION "${LIBDIR}") +install(TARGETS mosquitto_sub RUNTIME DESTINATION "${BINDIR}" ARCHIVE DESTINATION "${LIBDIR}") Index: config.mk --- config.mk.orig 2018-05-03 08:55:54.000000000 +0200 +++ config.mk 2018-05-05 10:19:10.154064000 +0200 @@ -243,7 +243,7 @@ ifeq ($(WITH_WEBSOCKETS),yes) BROKER_CFLAGS:=$(BROKER_CFLAGS) -DWITH_WEBSOCKETS - BROKER_LIBS:=$(BROKER_LIBS) -lwebsockets + BROKER_LIBS:=$(BROKER_LIBS) -lwebsockets -lssl -lcrypto -lz endif ifeq ($(UNAME),SunOS) @@ -266,9 +266,9 @@ endif INSTALL?=install -prefix=/usr/local -mandir=${prefix}/share/man -localedir=${prefix}/share/locale +prefix=${PREFIX} +mandir=${PREFIX}/man +localedir=${PREFIX}/share/locale STRIP?=strip ifeq ($(WITH_STRIP),yes) Index: lib/CMakeLists.txt --- lib/CMakeLists.txt.orig 2018-05-03 08:55:54.000000000 +0200 +++ lib/CMakeLists.txt 2018-05-05 10:19:10.154187000 +0200 @@ -95,21 +95,6 @@ endif (ARES_HEADER) endif (${WITH_SRV} STREQUAL ON) -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 "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") - if (${WITH_STATIC_LIBRARIES} STREQUAL ON) add_library(libmosquitto_static STATIC ${C_SRC}) if (${WITH_PIC} STREQUAL ON) @@ -131,7 +116,3 @@ install(FILES mosquitto.h DESTINATION "${INCLUDEDIR}") -if (UNIX AND NOT APPLE) - install(CODE "EXEC_PROGRAM(/sbin/ldconfig)") -endif (UNIX AND NOT APPLE) - Index: lib/cpp/CMakeLists.txt --- lib/cpp/CMakeLists.txt.orig 2018-05-03 08:55:54.000000000 +0200 +++ lib/cpp/CMakeLists.txt 2018-05-05 10:19:10.154300000 +0200 @@ -4,17 +4,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 "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") - if (${WITH_STATIC_LIBRARIES} STREQUAL ON) add_library(mosquittopp_static STATIC ${C_SRC} @@ -39,7 +28,3 @@ install(FILES mosquittopp.h DESTINATION "${INCLUDEDIR}") -if (UNIX AND NOT APPLE) - install(CODE "EXEC_PROGRAM(/sbin/ldconfig)") -endif (UNIX AND NOT APPLE) - Index: lib/mosquitto.c --- lib/mosquitto.c.orig 2018-05-03 08:55:54.000000000 +0200 +++ lib/mosquitto.c 2018-05-05 10:19:56.169556000 +0200 @@ -16,6 +16,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 2018-05-03 08:55:54.000000000 +0200 +++ lib/tls_mosq.c 2018-05-05 10:19:10.154415000 +0200 @@ -24,6 +24,7 @@ #else # include # include +# include # include #endif Index: lib/tls_mosq.h --- lib/tls_mosq.h.orig 2018-05-03 08:55:54.000000000 +0200 +++ lib/tls_mosq.h 2018-05-05 10:19:10.154516000 +0200 @@ -26,6 +26,7 @@ #ifdef WITH_TLS #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 2018-05-03 08:55:54.000000000 +0200 +++ src/CMakeLists.txt 2018-05-05 10:19:10.154647000 +0200 @@ -128,7 +128,11 @@ if (APPLE) set (MOSQ_LIBS ${MOSQ_LIBS} dl m) 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) @@ -141,7 +145,7 @@ endif (WIN32) if (${WITH_WEBSOCKETS} STREQUAL ON) - set (MOSQ_LIBS ${MOSQ_LIBS} websockets) + set (MOSQ_LIBS ${MOSQ_LIBS} websockets ssl crypto z) endif (${WITH_WEBSOCKETS} STREQUAL ON) # Simple detect libuuid @@ -163,17 +167,12 @@ endif (APPLE) endif (UNIX) -install(TARGETS mosquitto RUNTIME DESTINATION "${SBINDIR}" LIBRARY DESTINATION "${LIBDIR}") +install(TARGETS mosquitto RUNTIME DESTINATION "${SBINDIR}" ARCHIVE DESTINATION "${LIBDIR}") install(FILES mosquitto_broker.h mosquitto_plugin.h DESTINATION "${INCLUDEDIR}") if (${WITH_TLS} STREQUAL ON) add_executable(mosquitto_passwd mosquitto_passwd.c) target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES}) - install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${BINDIR}" LIBRARY DESTINATION "${LIBDIR}") + install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${BINDIR}" ARCHIVE DESTINATION "${LIBDIR}") endif (${WITH_TLS} STREQUAL ON) -if (UNIX AND NOT APPLE) - install(CODE "EXEC_PROGRAM(/sbin/ldconfig)") -endif (UNIX AND NOT APPLE) - - Index: src/conf.c --- src/conf.c.orig 2018-05-03 08:55:54.000000000 +0200 +++ src/conf.c 2018-05-05 10:19:10.154955000 +0200 @@ -114,6 +114,9 @@ int rc; memset(&gai_hints, 0, sizeof(struct addrinfo)); +#ifndef PF_UNSPEC +#define PF_UNSPEC AF_UNSPEC +#endif gai_hints.ai_family = PF_UNSPEC; gai_hints.ai_flags = AI_ADDRCONFIG; gai_hints.ai_socktype = SOCK_STREAM; Index: src/mosquitto.c --- src/mosquitto.c.orig 2018-05-03 08:55:54.000000000 +0200 +++ src/mosquitto.c 2018-05-05 10:19:10.155112000 +0200 @@ -16,6 +16,11 @@ #include "config.h" +#if defined(__FreeBSD__) +#define __XSI_VISIBLE 1 +#define __BSD_VISIBLE 1 +#endif + #ifndef WIN32 /* For initgroups() */ # include @@ -32,6 +37,7 @@ #endif #ifndef WIN32 +# include # include #endif Index: src/net.c --- src/net.c.orig 2018-05-03 08:55:54.000000000 +0200 +++ src/net.c 2018-05-05 10:19:10.155271000 +0200 @@ -353,6 +353,9 @@ snprintf(service, 10, "%d", listener->port); memset(&hints, 0, sizeof(struct addrinfo)); +#ifndef PF_UNSPEC +#define PF_UNSPEC AF_UNSPEC +#endif hints.ai_family = PF_UNSPEC; hints.ai_flags = AI_PASSIVE; hints.ai_socktype = SOCK_STREAM; Index: src/websockets.c --- src/websockets.c.orig 2018-05-03 08:55:54.000000000 +0200 +++ src/websockets.c 2018-05-05 10:19:10.155432000 +0200 @@ -41,6 +41,9 @@ #include #include +#if defined(__FreeBSD__) +#define __XSI_VISIBLE 1 +#endif #include extern struct mosquitto_db int_db;