b407d03afaf6c8ed44ab0cd5cb7ef9b0bbfe1bc4
[feed/packages.git] / net / mosquitto / Makefile
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.4.7
13 PKG_RELEASE:=1
14 PKG_LICENSE:=BSD-3-Clause
15 PKG_LICENSE_FILES:=LICENSE.txt
16
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_SOURCE_URL:=http://mosquitto.org/files/source/
19 PKG_MD5SUM:=4cb978502312bff2dcdaab6a433b1bf2
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/package.mk
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 +libuuid
31 USERID:=mosquitto=200:mosquitto=200
32 endef
33
34 define Package/$(PKG_NAME)
35 $(call Package/mosquitto/default)
36 TITLE+= (with SSL support)
37 DEPENDS+= +libopenssl +MOSQUITTO_LWS:libwebsockets-openssl
38 VARIANT:=ssl
39 endef
40
41 define Package/$(PKG_NAME)-nossl
42 $(call Package/$(PKG_NAME)/default)
43 TITLE+= (without SSL support)
44 VARIANT:=nossl
45 endef
46
47 define Package/$(PKG_NAME)/config
48 source "$(SOURCE)/Config.in"
49 endef
50
51 define Package/$(PKG_NAME)/default/description
52 Mosquitto is an open source (BSD licensed) message broker that implements
53 the MQTT protocol version 3.1 and 3.1.1. MQTT provides a lightweight
54 method of carrying out messaging using a publish/subscribe model.
55
56 This package also includes some basic support for configuring via UCI
57 endef
58
59 define Package/$(PKG_NAME)/description
60 $(call Package/$(PKG_NAME)/default/description)
61 This package is built with SSL support
62 endef
63
64 define Package/$(PKG_NAME)-nossl/description
65 $(call Package/$(PKG_NAME)/default/description)
66 This package is built WITHOUT SSL support.
67 endef
68
69
70 define Package/mosquitto-client/default
71 $(Package/mosquitto/default)
72 TITLE:= mosquitto - client tools
73 DEPENDS+=+libcares
74 endef
75 define Package/mosquitto-client
76 $(call Package/mosquitto-client/default)
77 TITLE+= (With SSL support)
78 DEPENDS+=+libmosquitto
79 VARIANT:=ssl
80 endef
81 define Package/mosquitto-client-nossl
82 $(call Package/mosquitto-client/default)
83 TITLE+= (Without SSL support)
84 DEPENDS+=+libmosquitto-nossl
85 VARIANT:=nossl
86 endef
87
88 define Package/mosquitto-client/default/description
89 Command line client tools for publishing messages to MQTT servers
90 and subscribing to topics.
91 endef
92
93 define Package/mosquitto-client/description
94 $(call Package/mosquitto-client/default/description)
95 This package is built with SSL support
96 endef
97 define Package/mosquitto-client-nossl/description
98 $(call Package/mosquitto-client/default/description)
99 This package is built without SSL support
100 endef
101
102 define Package/libmosquitto/default
103 $(Package/mosquitto/default)
104 SECTION:=libs
105 CATEGORY:=Libraries
106 DEPENDS:=+libpthread +librt +libcares
107 TITLE:= mosquitto - client library
108 endef
109
110 define Package/libmosquitto
111 $(call Package/libmosquitto/default)
112 TITLE+= (With SSL Support)
113 DEPENDS+= +libopenssl
114 VARIANT=ssl
115 endef
116 define Package/libmosquitto-nossl
117 $(call Package/libmosquitto/default)
118 TITLE+= (Without SSL Support)
119 VARIANT=nossl
120 endef
121
122 define Package/libmosquitto/default/description
123 Library required for mosquitto's command line client tools, also for
124 use by any third party software that wants to communicate with a
125 mosquitto server.
126
127 Should be useable for communicating with any MQTT v3.1/3.1.1 compatible
128 server, such as IBM's RSMB, in addition to Mosquitto
129 endef
130
131 define Package/libmosquitto/description
132 $(call Package/libmosquitto/default/description)
133 This package is built with SSL support
134 endef
135 define Package/libmosquitto-nossl/description
136 $(call Package/libmosquitto/default/description)
137 This package is built without SSL support
138 endef
139
140 define Package/libmosquittopp
141 SECTION:=libs
142 CATEGORY:=Libraries
143 DEPENDS:=+libmosquitto +libstdcpp
144 TITLE:= mosquitto - client c++ library
145 endef
146
147 define Package/libmosquittopp/description
148 C++ Library wrapper for libmosquitto.
149 endef
150
151 define Package/$(PKG_NAME)/conffiles
152 /etc/mosquitto/mosquitto.conf
153 /etc/config/mosquitto
154 endef
155
156 Package/$(PKG_NAME)-nossl/conffiles = $(Package/$(PKG_NAME)/conffiles)
157
158 define Package/mosquitto/install/default
159 $(INSTALL_DIR) $(1)/usr/sbin
160 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto $(1)/usr/sbin/mosquitto
161 $(INSTALL_DIR) $(1)/etc/mosquitto
162 $(INSTALL_CONF) $(PKG_BUILD_DIR)/mosquitto.conf $(1)/etc/mosquitto/mosquitto.conf
163 $(CP) ./files/* $(1)/
164 endef
165
166 define Package/mosquitto-nossl/install
167 $(call Package/mosquitto/install/default,$(1))
168 endef
169
170 define Package/mosquitto/install
171 $(call Package/mosquitto/install/default,$(1))
172 ifeq ($(CONFIG_MOSQUITTO_PASSWD),y)
173 $(INSTALL_DIR) $(1)/usr/bin
174 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mosquitto_passwd $(1)/usr/bin
175 endif
176 endef
177
178 define Package/mosquitto-client/install
179 $(INSTALL_DIR) $(1)/usr/bin
180 $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_pub $(1)/usr/bin/mosquitto_pub
181 $(INSTALL_BIN) $(PKG_BUILD_DIR)/client/mosquitto_sub $(1)/usr/bin/mosquitto_sub
182 endef
183 Package/mosquitto-client-nossl/install = $(Package/mosquitto-client/install)
184
185 # This installs files into ./staging_dir/. so that you can cross compile from the host
186 define Build/InstallDev
187 $(INSTALL_DIR) $(1)/usr/include
188 $(CP) $(PKG_BUILD_DIR)/lib/mosquitto.h $(1)/usr/include
189 $(CP) $(PKG_BUILD_DIR)/lib/cpp/mosquittopp.h $(1)/usr/include
190 $(INSTALL_DIR) $(1)/usr/lib
191 $(CP) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
192 $(CP) $(PKG_BUILD_DIR)/lib/cpp/libmosquittopp.so.1 $(1)/usr/lib/
193 $(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
194 $(LN) libmosquittopp.so.1 $(1)/usr/lib/libmosquittopp.so
195 endef
196
197 # This installs files on the target. Compare with Build/InstallDev
198 define Package/libmosquitto/install
199 $(INSTALL_DIR) $(1)/usr/lib
200 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/libmosquitto.so.1 $(1)/usr/lib/
201 $(LN) libmosquitto.so.1 $(1)/usr/lib/libmosquitto.so
202 endef
203 Package/libmosquitto-nossl/install = $(Package/libmosquitto/install)
204
205 define Package/libmosquittopp/install
206 $(INSTALL_DIR) $(1)/usr/lib
207 $(INSTALL_BIN) $(PKG_BUILD_DIR)/lib/cpp/libmosquittopp.so.1 $(1)/usr/lib/
208 $(LN) libmosquittopp.so.1 $(1)/usr/lib/libmosquittopp.so
209 endef
210
211 # Applies to all...
212 MAKE_FLAGS += WITH_DOCS=no
213 ifeq ($(BUILD_VARIANT),nossl)
214 MAKE_FLAGS += WITH_TLS=no WITH_WEBSOCKETS=no
215 else
216 MAKE_FLAGS += WITH_WEBSOCKETS=$(if $(CONFIG_MOSQUITTO_LWS),"yes","no")
217 endif
218
219 $(eval $(call BuildPackage,$(PKG_NAME)))
220 $(eval $(call BuildPackage,$(PKG_NAME)-nossl))
221 $(eval $(call BuildPackage,libmosquitto))
222 $(eval $(call BuildPackage,libmosquitto-nossl))
223 $(eval $(call BuildPackage,libmosquittopp))
224 $(eval $(call BuildPackage,mosquitto-client))
225 $(eval $(call BuildPackage,mosquitto-client-nossl))