From 6bde2097992f7d672e4c2c36168bfb5c73579bc3 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 6 Nov 2019 15:04:54 +0000 Subject: [PATCH] Added `CLIENT_STATIC_LDADD` to makefile builds This allow more libraries to be linked when compiling the clients with a static libmosquitto, as required for e.g. openssl on some systems. Closes #1371. Thanks to Fabrice Fontaine. --- ChangeLog.txt | 5 +++++ client/Makefile | 6 +++--- config.mk | 5 +++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4c5da4a2ca..ce05389594 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -23,6 +23,11 @@ Clients: - Fix duplicate cfg definition in rr_client. Closes #1453. - Fix `mosquitto_pub -l` hang when stdin stream ends. Closes #1448. +Build: +- Added `CLIENT_STATIC_LDADD` to makefile builds to allow more libraries to be + linked when compiling the clients with a static libmosquitto, as required + for e.g. openssl on some systems. + Installer: - Fix mosquitto_rr.exe not being included in Windows installers. Closes #1463. diff --git a/client/Makefile b/client/Makefile index 54bb9edda1..034db49bec 100644 --- a/client/Makefile +++ b/client/Makefile @@ -21,13 +21,13 @@ static : static_pub static_sub static_rr # libmosquitto only. static_pub : pub_client.o pub_shared.o client_props.o client_shared.o ../lib/libmosquitto.a - ${CROSS_COMPILE}${CC} $^ -o mosquitto_pub ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS} + ${CROSS_COMPILE}${CC} $^ -o mosquitto_pub ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS} ${CLIENT_STATIC_LDADD} static_sub : sub_client.o sub_client_output.o client_props.o client_shared.o ../lib/libmosquitto.a - ${CROSS_COMPILE}${CC} $^ -o mosquitto_sub ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS} + ${CROSS_COMPILE}${CC} $^ -o mosquitto_sub ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS} ${CLIENT_STATIC_LDADD} static_rr : rr_client.o client_props.o client_shared.o pub_shared.o sub_client_output.o ../lib/libmosquitto.a - ${CROSS_COMPILE}${CC} $^ -o mosquitto_rr ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS} + ${CROSS_COMPILE}${CC} $^ -o mosquitto_rr ${CLIENT_LDFLAGS} ${STATIC_LIB_DEPS} ${CLIENT_STATIC_LDADD} mosquitto_pub : pub_client.o pub_shared.o client_shared.o client_props.o ${CROSS_COMPILE}${CC} $(CLIENT_LDFLAGS) $^ -o $@ $(CLIENT_LDADD) diff --git a/config.mk b/config.mk index b37ff330ff..18a3dd2667 100644 --- a/config.mk +++ b/config.mk @@ -82,6 +82,11 @@ WITH_STRIP:=no # Build static libraries WITH_STATIC_LIBRARIES:=no +# Use this variable to add extra library dependencies when building the clients +# with the static libmosquitto library. This may be required on some systems +# where e.g. -lz or -latomic are needed for openssl. +CLIENT_STATIC_LDADD:= + # Build shared libraries WITH_SHARED_LIBRARIES:=yes