package/mosquitto: allow to build as static lib
authorTitouan Christophe <titouan.christophe@railnova.eu>
Sat, 3 Aug 2019 09:38:56 +0000 (11:38 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Sat, 3 Aug 2019 11:14:48 +0000 (13:14 +0200)
Since version 1.5, it is possible to build mosquitto as a static lib.

However, the broker still needs a toolchain with support for shared libraries,
because it contains code to dynamically load modules at runtime. This
code makes use of dlfcn.h, which is only available for dylib enabled
systems.

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
[Peter: adjust broker comment]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/mosquitto/Config.in
package/mosquitto/mosquitto.mk

index c7373d9a845821d384c354e99f2487cac6398122..1b3d1070f8af253f569cef75c40b94debdb00587 100644 (file)
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_MOSQUITTO
        bool "mosquitto"
-       depends on !BR2_STATIC_LIBS # builds .so
        help
          Mosquitto is an open source message broker that implements
          the MQ Telemetry Transport protocol versions 3.1 and
@@ -16,12 +15,12 @@ config BR2_PACKAGE_MOSQUITTO_BROKER
        bool "install the mosquitto broker"
        default y
        depends on BR2_USE_MMU # fork()
+       depends on !BR2_STATIC_LIBS # include <dlfcn.h>
        depends on BR2_PACKAGE_MOSQUITTO
        help
          Build and install the mosquitto broker onto target.
 
-comment "mosquitto broker needs a system with MMU"
-       depends on BR2_PACKAGE_MOSQUITTO && !BR2_USE_MMU
-
-comment "mosquitto needs a toolchain w/ dynamic library"
+comment "mosquitto broker needs a toolchain w/ dynamic library"
+       depends on BR2_USE_MMU
        depends on BR2_STATIC_LIBS
+       depends on BR2_PACKAGE_MOSQUITTO
index a172afcc5337c77997ea901c47f86c8f5c8886c5..eb39f0af6e963f5a026499403a3449ee2396d6cc 100644 (file)
@@ -17,6 +17,18 @@ MOSQUITTO_MAKE_OPTS = \
        WITH_WRAP=no \
        WITH_DOCS=no
 
+ifeq ($(BR2_SHARED_LIBS),y)
+MOSQUITTO_MAKE_OPTS += WITH_STATIC_LIBRARIES=no
+else
+MOSQUITTO_MAKE_OPTS += WITH_STATIC_LIBRARIES=yes
+endif
+
+ifeq ($(BR2_STATIC_LIBS),y)
+MOSQUITTO_MAKE_OPTS += WITH_SHARED_LIBRARIES=no
+else
+MOSQUITTO_MAKE_OPTS += WITH_SHARED_LIBRARIES=yes
+endif
+
 # adns uses getaddrinfo_a
 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
 MOSQUITTO_MAKE_OPTS += WITH_ADNS=yes