From d90cd585dd8cc1f9cecd9082d71333e1e638df2d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Mon, 13 Jun 2016 21:36:41 +0100 Subject: [PATCH] Add WITH_STRIP build option. --- ChangeLog.txt | 3 +++ client/Makefile | 4 ++-- config.mk | 9 ++++++++- lib/Makefile | 2 +- lib/cpp/Makefile | 2 +- src/Makefile | 6 ++++-- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a3f9e35f..84bd46e8 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -48,6 +48,9 @@ Client: - Connections now default to using MQTT v3.1.1. - Default to using port 8883 when using TLS. +Build: +- Add WITH_STRIP option (defaulting to "no") that when set to "yes" will strip + executables and shared libraries when installing. 1.4.7 - 20151221 ================ diff --git a/client/Makefile b/client/Makefile index a1c6c9df..2bb6bbaf 100644 --- a/client/Makefile +++ b/client/Makefile @@ -32,8 +32,8 @@ client_shared.o : client_shared.c client_shared.h install : all $(INSTALL) -d ${DESTDIR}$(prefix)/bin - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub + $(INSTALL) ${STRIP_OPTS} mosquitto_pub ${DESTDIR}${prefix}/bin/mosquitto_pub + $(INSTALL) ${STRIP_OPTS} mosquitto_sub ${DESTDIR}${prefix}/bin/mosquitto_sub uninstall : -rm -f ${DESTDIR}${prefix}/bin/mosquitto_pub diff --git a/config.mk b/config.mk index a1699050..5ed1dbe7 100644 --- a/config.mk +++ b/config.mk @@ -80,6 +80,9 @@ WITH_DOCS:=yes # Build with client support for SOCK5 proxy. WITH_SOCKS:=yes +# Strip executables and shared libraries on install. +WITH_STRIP:=no + # ============================================================================= # End of user configuration # ============================================================================= @@ -88,7 +91,6 @@ WITH_SOCKS:=yes # Also bump lib/mosquitto.h, CMakeLists.txt, # installer/mosquitto.nsi, installer/mosquitto64.nsi VERSION=1.4.90 -TIMESTAMP:=$(shell date "+%F %T%z") # Client library SO version. Bump if incompatible API/ABI changes are made. SOVERSION=1 @@ -97,6 +99,7 @@ SOVERSION=1 XSLTPROC=xsltproc # For html generation DB_HTML_XSL=man/html.xsl +TIMESTAMP:=$(shell date "+%F %T%z") #MANCOUNTRIES=en_GB @@ -254,3 +257,7 @@ prefix=/usr/local mandir=${prefix}/share/man localedir=${prefix}/share/locale STRIP?=strip + +ifeq ($(WITH_STRIP),yes) + STRIP_OPTS:=-s --strip-program=${CROSS_COMPILE}${STRIP} +endif diff --git a/lib/Makefile b/lib/Makefile index 598d1ddf..eef87b95 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -37,7 +37,7 @@ all : libmosquitto.so.${SOVERSION} libmosquitto.a install : all $(INSTALL) -d ${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/ - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION} + $(INSTALL) ${STRIP_OPTS} libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION} ln -sf libmosquitto.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so $(INSTALL) -d ${DESTDIR}${prefix}/include/ $(INSTALL) mosquitto.h ${DESTDIR}${prefix}/include/mosquitto.h diff --git a/lib/cpp/Makefile b/lib/cpp/Makefile index 8b627d32..9f521358 100644 --- a/lib/cpp/Makefile +++ b/lib/cpp/Makefile @@ -10,7 +10,7 @@ all : libmosquittopp.so.${SOVERSION} install : all $(INSTALL) -d ${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/ - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION} + $(INSTALL) ${STRIP_OPTS} libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION} ln -sf libmosquittopp.so.${SOVERSION} ${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so $(INSTALL) -d ${DESTDIR}${prefix}/include/ $(INSTALL) mosquittopp.h ${DESTDIR}${prefix}/include/mosquittopp.h diff --git a/src/Makefile b/src/Makefile index 198ff29c..812feaea 100644 --- a/src/Makefile +++ b/src/Makefile @@ -188,10 +188,12 @@ mosquitto_passwd.o : mosquitto_passwd.c install : all $(INSTALL) -d ${DESTDIR}$(prefix)/sbin - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto ${DESTDIR}${prefix}/sbin/mosquitto + $(INSTALL) ${STRIP_OPTS} mosquitto ${DESTDIR}${prefix}/sbin/mosquitto + $(INSTALL) -d ${DESTDIR}$(prefix)/include $(INSTALL) mosquitto_plugin.h ${DESTDIR}${prefix}/include/mosquitto_plugin.h ifeq ($(WITH_TLS),yes) - $(INSTALL) -s --strip-program=${CROSS_COMPILE}${STRIP} mosquitto_passwd ${DESTDIR}${prefix}/bin/mosquitto_passwd + $(INSTALL) -d ${DESTDIR}$(prefix)/bin + $(INSTALL) ${STRIP_OPTS} mosquitto_passwd ${DESTDIR}${prefix}/bin/mosquitto_passwd endif uninstall :