Explorar el Código

net/mosquitto: Import 1.3.1 from packages

This is actively maintained, and will continue to be maintained.

Upstream development versions of the package is available at
https://github.com/remakeelectric/owrt_pub_feeds

Signed-off-by: Karl Palsson <karlp@remake.is>
Karl Palsson hace 10 años
padre
commit
f417152407

+ 190
- 0
net/mosquitto/Makefile Ver fichero

@@ -0,0 +1,190 @@
1
+#
2
+# Copyright (C) 2011-2013 OpenWrt.org
3
+# Copyright (C) 2010 Jo-Philipp Wich <xm@subsignal.org>
4
+#
5
+# This is free software, licensed under the GNU General Public License v2.
6
+# See /LICENSE for more information.
7
+#
8
+
9
+include $(TOPDIR)/rules.mk
10
+
11
+PKG_NAME:=mosquitto
12
+PKG_VERSION:=1.3.1
13
+PKG_RELEASE:=1
14
+
15
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16
+PKG_SOURCE_URL:=http://mosquitto.org/files/source/
17
+PKG_MD5SUM:=2f2870e965cf6f0b5df4ecaf2a0955d2
18
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19
+
20
+include $(INCLUDE_DIR)/package.mk
21
+
22
+MAKE_FLAGS+=WITH_MEMORY_TRACKING=no
23
+
24
+define Package/$(PKG_NAME)/default
25
+  SECTION:=net
26
+  CATEGORY:=Network
27
+  TITLE:=mosquitto - an MQTT message broker
28
+  URL:=http://www.mosquitto.org/
29
+  MAINTAINER:=Karl Palsson <karlp@remake.is>
30
+  DEPENDS:= +librt
31
+endef
32
+
33
+define Package/$(PKG_NAME)
34
+    $(call Package/mosquitto/default)
35
+    TITLE+= (with SSL support)
36
+    DEPENDS+= +libopenssl
37
+    VARIANT:=ssl
38
+endef
39
+
40
+define Package/$(PKG_NAME)-nossl
41
+    $(call Package/$(PKG_NAME)/default)
42
+    TITLE+= (without SSL support)
43
+    VARIANT:=nossl
44
+endef
45
+
46
+define Package/$(PKG_NAME)/default/description
47
+ mosquitto is a message broker that supports v3.1 of the MQ Telemetry
48
+Transport protocol. MQTT provides a lightweight method for
49
+messaging using a publish/subscribe model.
50
+
51
+This package also includes some basic support for configuring via UCI
52
+endef
53
+
54
+define Package/$(PKG_NAME)/description
55
+	$(call Package/$(PKG_NAME)/default/description)
56
+	This package is built with SSL support
57
+endef
58
+
59
+define Package/$(PKG_NAME)-nossl/description
60
+        $(call Package/$(PKG_NAME)/default/description)
61
+        This package is built WITHOUT SSL support.
62
+endef
63
+
64
+
65
+define Package/mosquitto-client/default
66
+    $(Package/mosquitto/default)
67
+    TITLE:= mosquitto - client tools
68
+    DEPENDS+=+libcares
69
+endef
70
+define Package/mosquitto-client
71
+    $(call Package/mosquitto-client/default)
72
+    TITLE+= (With SSL support)
73
+    DEPENDS+=+libmosquitto
74
+    VARIANT:=ssl
75
+endef
76
+define Package/mosquitto-client-nossl
77
+    $(call Package/mosquitto-client/default)
78
+    TITLE+= (Without SSL support)
79
+    DEPENDS+=+libmosquitto-nossl
80
+    VARIANT:=nossl
81
+endef
82
+
83
+define Package/mosquitto-client/default/description
84
+ Command line client tools for publishing messages to MQTT servers
85
+and subscribing to topics.
86
+endef
87
+
88
+define Package/mosquitto-client/description
89
+$(call Package/mosquitto-client/default/description)
90
+        This package is built with SSL support
91
+endef
92
+define Package/mosquitto-client-nossl/description
93
+$(call Package/mosquitto-client/default/description)
94
+        This package is built without SSL support
95
+endef
96
+
97
+define Package/libmosquitto/default
98
+    $(Package/mosquitto/default)
99
+    SECTION:=libs
100
+    CATEGORY:=Libraries
101
+    DEPENDS:=+libpthread +librt +libcares
102
+    TITLE:= mosquitto - client library
103
+endef
104
+
105
+define Package/libmosquitto
106
+    $(call Package/libmosquitto/default)
107
+    TITLE+= (With SSL Support)
108
+    DEPENDS+= +libopenssl
109
+    VARIANT=ssl
110
+endef
111
+define Package/libmosquitto-nossl
112
+    $(call Package/libmosquitto/default)
113
+    TITLE+= (Without SSL Support)
114
+    VARIANT=nossl
115
+endef
116
+
117
+define Package/libmosquitto/default/description
118
+ Library required for mosquitto's command line client tools, also for
119
+use by any third party software that wants to communicate with a
120
+mosquitto server.
121
+
122
+Should be useable for communicating with any MQTT v3.1 compatible
123
+server, such as IBM's RSMB, in addition to Mosquitto
124
+endef
125
+
126
+define Package/libmosquitto/description
127
+    $(call Package/libmosquitto/default/description)
128
+    This package is built with SSL support
129
+endef
130
+define Package/libmosquitto-nossl/description
131
+    $(call Package/libmosquitto/default/description)
132
+    This package is built without SSL support
133
+endef
134
+
135
+
136
+define Package/$(PKG_NAME)/conffiles
137
+/etc/mosquitto/mosquitto.conf
138
+/etc/config/mosquitto
139
+endef
140
+
141
+Package/$(PKG_NAME)-nossl/conffiles = $(Package/$(PKG_NAME)/conffiles)
142
+
143
+define Package/$(PKG_NAME)/install
144
+	$(INSTALL_DIR) $(1)/usr/sbin
145
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto $(1)/usr/sbin/mosquitto
146
+	$(INSTALL_DIR) $(1)/etc/mosquitto
147
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/mosquitto.conf $(1)/etc/mosquitto/mosquitto.conf
148
+	$(INSTALL_DIR) $(1)/etc/init.d
149
+	$(INSTALL_BIN) ./files/mosquitto.init $(1)/etc/init.d/mosquitto
150
+	$(INSTALL_DIR) $(1)/usr/bin
151
+	$(INSTALL_BIN) ./files/mosquitto.uci.convert $(1)/usr/bin
152
+endef
153
+Package/$(PKG_NAME)-nossl/install = $(Package/$(PKG_NAME)/install)
154
+
155
+
156
+define Package/mosquitto-client/install
157
+	$(INSTALL_DIR) $(1)/usr/bin
158
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_pub $(1)/usr/bin/mosquitto_pub
159
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_sub $(1)/usr/bin/mosquitto_sub
160
+endef
161
+Package/mosquitto-client-nossl/install = $(Package/mosquitto-client/install)
162
+
163
+# This installs files into ./staging_dir/. so that you can cross compile from the host
164
+define Build/InstallDev
165
+	$(INSTALL_DIR) $(1)/usr/include
166
+	$(CP) $(PKG_BUILD_DIR)/lib/mosquitto.h $(1)/usr/include
167
+	$(INSTALL_DIR) $(1)/usr/lib
168
+	$(CP) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
169
+	$(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
170
+endef
171
+
172
+# This installs files on the target.  Compare with Build/InstallDev
173
+define Package/libmosquitto/install
174
+	$(INSTALL_DIR) $(1)/usr/lib
175
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
176
+	$(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
177
+endef
178
+Package/libmosquitto-nossl/install = $(Package/libmosquitto/install)
179
+
180
+# Applies to all...
181
+ifeq ($(BUILD_VARIANT),nossl)
182
+        MAKE_FLAGS += WITH_TLS=no
183
+endif
184
+
185
+$(eval $(call BuildPackage,$(PKG_NAME)))
186
+$(eval $(call BuildPackage,$(PKG_NAME)-nossl))
187
+$(eval $(call BuildPackage,libmosquitto))
188
+$(eval $(call BuildPackage,libmosquitto-nossl))
189
+$(eval $(call BuildPackage,mosquitto-client))
190
+$(eval $(call BuildPackage,mosquitto-client-nossl))

+ 29
- 0
net/mosquitto/files/mosquitto.init Ver fichero

@@ -0,0 +1,29 @@
1
+#!/bin/sh /etc/rc.common
2
+# Basic init script for mosquitto
3
+# April 2012, OpenWrt.org
4
+# Provides support for the luci-app-mosquitto package, if installed
5
+
6
+START=80
7
+APP=`which mosquitto`
8
+USE_UCI_CONFIG=$(uci -q get mosquitto.owrt.use_uci)
9
+if [ $? -eq 1 ]; then
10
+    USE_UCI_CONFIG=0
11
+fi
12
+
13
+SERVICE_DAEMONIZE=1
14
+SERVICE_WRITE_PID=1
15
+
16
+start() {
17
+        user_exists mosquitto 200 || user_add mosquitto 200
18
+        if [ "$USE_UCI_CONFIG" -eq 1 ]; then
19
+            CONF=/tmp/mosquitto.converted.$$.conf
20
+            mosquitto.uci.convert -f $CONF
21
+        else
22
+            CONF=/etc/mosquitto/mosquitto.conf
23
+        fi
24
+        service_start $APP -c $CONF
25
+}
26
+
27
+stop() {
28
+        service_stop $APP
29
+}

+ 88
- 0
net/mosquitto/files/mosquitto.uci.convert Ver fichero

@@ -0,0 +1,88 @@
1
+#!/bin/sh
2
+# Converts a uci config file into an appropriate mosquitto.conf snippet
3
+# expected to be used in an init file to generate a config file to run from
4
+# Karl Palsson <karlp@remake.is> 2012.
5
+# Considered to be released into the public domain
6
+
7
+TCONF=/tmp/mosquitto.generated.$$.conf
8
+while getopts "f:" o; do
9
+    case $o in
10
+    f)
11
+        TCONF=$OPTARG
12
+        ;;
13
+    esac
14
+done
15
+
16
+if [ -e $TCONF ]; then
17
+    echo "Odd, same temporary generated config file already existed: $TCONF"
18
+    exit 1
19
+fi
20
+
21
+echo "Generating mosquitto config file in $TCONF"
22
+NOW=$(date)
23
+echo "# mosquitto.conf file generated from UCI config." >>$TCONF
24
+echo "# Config snippet generated by $0 on $NOW" >>$TCONF
25
+echo "#" >> $TCONF
26
+QQ=$(uci -q get mosquitto.mosquitto.log_dest)
27
+if [ $? = 0 ]; then
28
+    for dest in $QQ; do
29
+        echo "log_dest $dest" >> $TCONF
30
+    done
31
+fi
32
+
33
+QQ=$(uci -q get mosquitto.mosquitto.no_remote_access)
34
+if [ $? = 0 ]; then
35
+    if [ "$QQ" -eq 1 ]; then
36
+        echo "bind_address 127.0.0.1" >> $TCONF
37
+    fi
38
+fi
39
+
40
+HATE_SECTION_COUNT=$(grep config /etc/config/mosquitto | grep bridge | wc -l)
41
+if [ $HATE_SECTION_COUNT -gt 0 ]; then
42
+    for i in $(seq $HATE_SECTION_COUNT -1 1); do
43
+        NN=$(uci -q get mosquitto.@bridge[-$i].connection)
44
+        echo "" >> $TCONF
45
+        echo "# Bridge connection from UCI section" >> $TCONF
46
+        echo "connection $NN" >> $TCONF
47
+        ADDR=$(uci -q get mosquitto.@bridge[-$i].address)
48
+        echo "address $ADDR" >> $TCONF
49
+        TOPICS=$(uci -q -d';' get mosquitto.@bridge[-$i].topic)
50
+        # UGLY! just want to split on the ; :(
51
+        echo $TOPICS | sed "s/^/topic /" | sed "s/;/\ntopic /g" >> $TCONF
52
+        CS=$(uci -q get mosquitto.@bridge[-$i].cleansession)
53
+        if [ $? -eq 0 ]; then
54
+            if [ "$CS" -eq 1 ]; then
55
+                echo "cleansession true" >> $TCONF
56
+            fi
57
+        else
58
+            echo "cleansession false" >> $TCONF
59
+        fi
60
+        TRYPRIV=$(uci -q get mosquitto.@bridge[-$i].tryprivate)
61
+        if [ $? -eq 0 ]; then
62
+            if [ "$TRYPRIV" -eq 1 ]; then
63
+                echo "try_private true" >> $TCONF
64
+            else
65
+                echo "try_private false" >> $TCONF
66
+            fi
67
+        else
68
+            # Override default to avoid crashes with 0.15 brokers :(
69
+            echo "try_private false" >> $TCONF
70
+        fi
71
+        CLIENTID=$(uci -q get mosquitto.@bridge[-$i].clientid)
72
+        if [ $? -eq 0 ]; then
73
+            echo "clientid $CLIENTID" >> $TCONF
74
+        fi
75
+        BRIDGEID=$(uci -q get mosquitto.@bridge[-$i].identity)
76
+        if [ $? -eq 0 ]; then
77
+            echo "bridge_identity $BRIDGEID" >> $TCONF
78
+        fi
79
+        BRIDGEPSK=$(uci -q get mosquitto.@bridge[-$i].psk)
80
+        if [ $? -eq 0 ]; then
81
+            echo "bridge_psk $BRIDGEPSK" >> $TCONF
82
+        fi
83
+        BRIDGETLSVERSION=$(uci -q get mosquitto.@bridge[-$i].tls_version)
84
+        if [ $? -eq 0 ]; then
85
+            echo "bridge_tls_version $BRIDGETLSVERSION" >> $TCONF
86
+        fi
87
+    done
88
+fi