Hi, I know that trunk is just about to be released, but I was really hoping to get mosquitto upgraded to the newly released 1.0 if at all possible. The new SSL features are a major improvement, and plenty of bugfixes.
I maintain a feed separately at https://github.com/karlp/owrt_pub_feeds so it's not the end of the world, but amongst other things, mosquitto didn't exist at all in backfire, and this patch bumps the soversion from .0 to .1. If the initial stable release of Attitude Adjustment can have the same soversion, There won't be any need to try and maintain both in the future. Sincerely, Karl P >From e4ffb958829a71f3142b8080aa004b5458b7dbc1 Mon Sep 17 00:00:00 2001 From: Karl Palsson <ka...@remake.is> Date: Thu, 16 Aug 2012 16:38:49 +0000 Subject: [PATCH] Upgrade mosquitto MQTT tools to v1.0.1 Major changes since v0.15 currently in trunk * SSL/TLS support across the board, broker, clients and client library * TLS-PSK support if openssl version is new enough * thread support in client library * lots and lots of bug fixes Because prior versions of mosquitto didn't have any SSL support, I've made the openssl dependency optional (but on by default) Tested with both all -nossl and all regular packages. (Have to run a "make package/mosquitto/clean" between builds) Signed-off-by: Karl Palsson <ka...@remake.is> --- net/mosquitto/Makefile | 122 +++++++++++++++++--- net/mosquitto/files/mosquitto.uci.convert | 54 +++++++++ .../patches/100-disable-memory-reporting.patch | 12 -- net/mosquitto/patches/100-fix-pthread-cancel.patch | 12 ++ net/mosquitto/patches/101-disable-docbook.patch | 11 -- 5 files changed, 172 insertions(+), 39 deletions(-) create mode 100755 net/mosquitto/files/mosquitto.uci.convert delete mode 100644 net/mosquitto/patches/100-disable-memory-reporting.patch create mode 100644 net/mosquitto/patches/100-fix-pthread-cancel.patch delete mode 100644 net/mosquitto/patches/101-disable-docbook.patch diff --git a/net/mosquitto/Makefile b/net/mosquitto/Makefile index 56f2a64..b0aa14b 100644 --- a/net/mosquitto/Makefile +++ b/net/mosquitto/Makefile @@ -9,51 +9,114 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mosquitto -PKG_VERSION:=0.15 +PKG_VERSION:=1.0.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=http://mosquitto.org/files/source/ -PKG_MD5SUM:=7ae0ac38f1f379578ab5530e5dc7269e +PKG_MD5SUM:=2a7930d4252f9b8fb5d4147f8c84ed29 include $(INCLUDE_DIR)/package.mk -define Package/mosquitto/default +MAKE_FLAGS+=WITH_MEMORY_TRACKING=no +include $(INCLUDE_DIR)/version.mk +# The version of libopenssl in backfire doesn't support psk. +ifeq ($(findstring 10.03,$(VERSION_CODE)),10.03) + MAKE_FLAGS += WITH_TLS_PSK=no +endif + + +define Package/$(PKG_NAME)/default SECTION:=net CATEGORY:=Network TITLE:=mosquitto - an MQTT message broker URL:=http://www.mosquitto.org/ endef -define Package/mosquitto - $(Package/mosquitto/default) +define Package/$(PKG_NAME) + $(call Package/mosquitto/default) + TITLE+= (with SSL support) + DEPENDS+= +libopenssl + VARIANT:=ssl +endef + +define Package/$(PKG_NAME)-nossl + $(call Package/$(PKG_NAME)/default) + TITLE+= (without SSL support) + VARIANT:=nossl endef -define Package/mosquitto/description +define Package/$(PKG_NAME)/default/description mosquitto is a message broker that supports v3.1 of the MQ Telemetry Transport protocol. MQTT provides a lightweight method for messaging using a publish/subscribe model. + +This package also includes some basic support for configuring via UCI endef -define Package/mosquitto-client +define Package/$(PKG_NAME)/description + $(call Package/$(PKG_NAME)/default/description) + This package is built with SSL support +endef + +define Package/$(PKG_NAME)-nossl/description + $(call Package/$(PKG_NAME)/default/description) + This package is built WITHOUT SSL support. +endef + + +define Package/mosquitto-client/default $(Package/mosquitto/default) TITLE:= mosquitto - client tools - DEPENDS:= +libmosquitto +endef +define Package/mosquitto-client + $(call Package/mosquitto-client/default) + TITLE+= (With SSL support) + DEPENDS+=+libmosquitto + VARIANT:=ssl +endef +define Package/mosquitto-client-nossl + $(call Package/mosquitto-client/default) + TITLE+= (Without SSL support) + DEPENDS+=+libmosquitto-nossl + VARIANT:=nossl endef -define Package/mosquitto-client/description +define Package/mosquitto-client/default/description Command line client tools for publishing messages to MQTT servers and subscribing to topics. endef -define Package/libmosquitto +define Package/mosquitto-client/description +$(call Package/mosquitto-client/default/description) + This package is built with SSL support +endef +define Package/mosquitto-client-nossl/description +$(call Package/mosquitto-client/default/description) + This package is built without SSL support +endef + +define Package/libmosquitto/default $(Package/mosquitto/default) SECTION:=libs CATEGORY:=Libraries + DEPENDS:=+libpthread TITLE:= mosquitto - client library endef -define Package/libmosquitto/description +define Package/libmosquitto + $(call Package/libmosquitto/default) + TITLE+= (With SSL Support) + DEPENDS+= +libopenssl + VARIANT=ssl +endef +define Package/libmosquitto-nossl + $(call Package/libmosquitto/default) + TITLE+= (Without SSL Support) + VARIANT=nossl +endef + +define Package/libmosquitto/default/description Library required for mosquitto's command line client tools, also for use by any third party software that wants to communicate with a mosquitto server. @@ -62,25 +125,42 @@ Should be useable for communicating with any MQTT v3.1 compatible server, such as IBM's RSMB, in addition to Mosquitto endef +define Package/libmosquitto/description + $(call Package/libmosquitto/default/description) + This package is built with SSL support +endef +define Package/libmosquitto-nossl/description + $(call Package/libmosquitto/default/description) + This package is built without SSL support +endef -define Package/mosquitto/conffiles + +define Package/$(PKG_NAME)/conffiles /etc/mosquitto/mosquitto.conf +/etc/config/mosquitto endef -define Package/mosquitto/install +Package/$(PKG_NAME)-nossl/conffiles = $(Package/$(PKG_NAME)/conffiles) + +define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto $(1)/usr/sbin/mosquitto $(INSTALL_DIR) $(1)/etc/mosquitto $(INSTALL_CONF) $(PKG_BUILD_DIR)/mosquitto.conf $(1)/etc/mosquitto/mosquitto.conf $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/mosquitto.init $(1)/etc/init.d/mosquitto + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./files/mosquitto.uci.convert $(1)/usr/bin endef +Package/$(PKG_NAME)-nossl/install = $(Package/$(PKG_NAME)/install) + define Package/mosquitto-client/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_pub $(1)/usr/bin/mosquitto_pub $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_sub $(1)/usr/bin/mosquitto_sub endef +Package/mosquitto-client-nossl/install = $(Package/mosquitto-client/install) # This installs files into ./staging_dir/. so that you can cross compile from the host define Build/InstallDev @@ -88,14 +168,24 @@ define Build/InstallDev $(CP) $(PKG_BUILD_DIR)/lib/mosquitto.h $(1)/usr/include $(INSTALL_DIR) $(1)/usr/lib # This should just get symlinked, but I can't work out the magic syntax :( - $(CP) $(PKG_BUILD_DIR)/lib/libmosquitto.so.0 $(1)/usr/lib/libmosquitto.so + $(CP) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so endef # This installs files on the target. Compare with Build/InstallDev define Package/libmosquitto/install $(INSTALL_DIR) $(1)/usr/lib - $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libmosquitto.so.0 $(1)/usr/lib/libmosquitto.so.0 + $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so.1 endef -$(eval $(call BuildPackage,mosquitto)) +Package/libmosquitto-nossl/install = $(Package/libmosquitto/install) + +# Applies to all... +ifeq ($(BUILD_VARIANT),nossl) + MAKE_FLAGS += WITH_TLS=no +endif + +$(eval $(call BuildPackage,$(PKG_NAME))) +$(eval $(call BuildPackage,$(PKG_NAME)-nossl)) $(eval $(call BuildPackage,libmosquitto)) +$(eval $(call BuildPackage,libmosquitto-nossl)) $(eval $(call BuildPackage,mosquitto-client)) +$(eval $(call BuildPackage,mosquitto-client-nossl)) diff --git a/net/mosquitto/files/mosquitto.uci.convert b/net/mosquitto/files/mosquitto.uci.convert new file mode 100755 index 0000000..004b8fe --- /dev/null +++ b/net/mosquitto/files/mosquitto.uci.convert @@ -0,0 +1,54 @@ +#!/bin/sh +# Converts a uci config file into an appropriate mosquitto.conf snippet +# expected to be used in an init file to generate a config file to run from +# Karl Palsson <ka...@remake.is> 2012. +# Considered to be released into the public domain + +TCONF=/tmp/mosquitto.generated.$$.conf +while getopts "f:" o; do + case $o in + f) + TCONF=$OPTARG + ;; + esac +done + +if [ -e $TCONF ]; then + echo "Odd, same temporary generated config file already existed: $TCONF" + exit 1 +fi + +echo "Generating mosquitto config file in $TCONF" +NOW=$(date) +echo "# mosquitto.conf file generated from UCI config." >>$TCONF +echo "# Config snippet generated by $0 on $NOW" >>$TCONF +echo "#" >> $TCONF +QQ=$(uci -q get mosquitto.mosquitto.log_dest) +if [ $? = 0 ]; then + for dest in $QQ; do + echo "log_dest $dest" >> $TCONF + done +fi + +HATE_SECTION_COUNT=$(grep config /etc/config/mosquitto | grep bridge | wc -l) +if [ $HATE_SECTION_COUNT -gt 0 ]; then + for i in $(seq $HATE_SECTION_COUNT -1 1); do + NN=$(uci -q get mosquitto.@bridge[-$i].connection) + echo "" >> $TCONF + echo "# Bridge connection from UCI section" >> $TCONF + echo "connection $NN" >> $TCONF + ADDR=$(uci -q get mosquitto.@bridge[-$i].address) + echo "address $ADDR" >> $TCONF + TOPICS=$(uci -q -d';' get mosquitto.@bridge[-$i].topic) + # UGLY! just want to split on the ; :( + echo $TOPICS | sed "s/^/topic /" | sed "s/;/\ntopic /g" >> $TCONF + CS=$(uci -q get mosquitto.@bridge[-$i].cleansession) + if [ $? -eq 0 ]; then + if [ "$CS" -eq 1 ]; then + echo "cleansession true" >> $TCONF + fi + else + echo "cleansession false" >> $TCONF + fi + done +fi diff --git a/net/mosquitto/patches/100-disable-memory-reporting.patch b/net/mosquitto/patches/100-disable-memory-reporting.patch deleted file mode 100644 index 8d589b4..0000000 --- a/net/mosquitto/patches/100-disable-memory-reporting.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -r 490c907277dc config.h ---- a/config.h Sat Jan 15 22:23:50 2011 +0000 -+++ b/config.h Wed Jan 26 13:37:36 2011 +0000 -@@ -15,7 +15,7 @@ - /* Compile with memory tracking support? If disabled, mosquitto won't track - * heap memory usage nor export '$SYS/broker/heap/current size', but will use - * slightly less memory and CPU time. */ --#define WITH_MEMORY_TRACKING -+//#define WITH_MEMORY_TRACKING - - /* Compile with the ability to upgrade from old style sqlite persistent - * databases to the new mosquitto format. This means a dependency on sqlite. It diff --git a/net/mosquitto/patches/100-fix-pthread-cancel.patch b/net/mosquitto/patches/100-fix-pthread-cancel.patch new file mode 100644 index 0000000..d48ee16 --- /dev/null +++ b/net/mosquitto/patches/100-fix-pthread-cancel.patch @@ -0,0 +1,12 @@ +--- a/lib/mosquitto.c ++++ b/lib/mosquitto.c +@@ -103,6 +103,9 @@ + mosq = (struct mosquitto *)_mosquitto_calloc(1, sizeof(struct mosquitto)); + if(mosq){ + mosq->sock = INVALID_SOCKET; ++#ifdef WITH_THREADING ++ mosq->thread_id = pthread_self(); ++#endif + rc = mosquitto_reinitialise(mosq, id, clean_session, obj); + if(rc){ + mosquitto_destroy(mosq); diff --git a/net/mosquitto/patches/101-disable-docbook.patch b/net/mosquitto/patches/101-disable-docbook.patch deleted file mode 100644 index 8670197..0000000 --- a/net/mosquitto/patches/101-disable-docbook.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -r bebd02e8bed4 -r 77b64fb10075 Makefile ---- a/Makefile Thu Jul 07 13:34:54 2011 +0100 -+++ b/Makefile Thu Jul 07 16:50:05 2011 +0000 -@@ -1,6 +1,6 @@ - include config.mk - --DIRS=lib client src man -+DIRS=lib client src - DISTDIRS=man - - .PHONY : all mosquitto clean reallyclean install uninstall dist sign copy -- 1.7.2.5 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel